Skip to content

Commit

Permalink
src: allow preventing SetPromiseRejectCallback
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jul 20, 2020
1 parent 1b6565b commit a7a5972
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/api/environment.cc
Expand Up @@ -242,9 +242,11 @@ void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback;
isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb);

auto* promise_reject_cb = s.promise_reject_callback ?
s.promise_reject_callback : task_queue::PromiseRejectCallback;
isolate->SetPromiseRejectCallback(promise_reject_cb);
if ((s.flags & SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK) == 0) {
auto* promise_reject_cb = s.promise_reject_callback ?
s.promise_reject_callback : task_queue::PromiseRejectCallback;
isolate->SetPromiseRejectCallback(promise_reject_cb);
}

if (s.flags & DETAILED_SOURCE_POSITIONS_FOR_PROFILING)
v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
Expand Down
3 changes: 2 additions & 1 deletion src/node.h
Expand Up @@ -328,7 +328,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {

enum IsolateSettingsFlags {
MESSAGE_LISTENER_WITH_ERROR_LEVEL = 1 << 0,
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1
DETAILED_SOURCE_POSITIONS_FOR_PROFILING = 1 << 1,
SHOULD_NOT_SET_PROMISE_REJECTION_CALLBACK = 1 << 2
};

struct IsolateSettings {
Expand Down

0 comments on commit a7a5972

Please sign in to comment.