1d9a4ab02c
* chore: bump node in DEPS to v18.13.0 * child_process: validate arguments for null bytes https://github.com/nodejs/node/pull/44782 * bootstrap: merge main thread and worker thread initializations https://github.com/nodejs/node/pull/44869 * module: ensure relative requires work from deleted directories https://github.com/nodejs/node/pull/42384 * src: add support for externally shared js builtins https://github.com/nodejs/node/issues/44000 * lib: disambiguate `native module` to `binding` https://github.com/nodejs/node/pull/45673 * test: convert test-debugger-pid to async/await https://github.com/nodejs/node/pull/45179 * deps: upgrade to libuv 1.44.2 https://github.com/nodejs/node/pull/42340 * src: fix cppgc incompatibility in v8 https://github.com/nodejs/node/pull/43521 * src: use qualified `std::move` call in node_http2 https://github.com/nodejs/node/pull/45555 * build: fix env.h for cpp20 https://github.com/nodejs/node/pull/45516 * test: remove experimental-wasm-threads flag https://github.com/nodejs/node/pull/45074 * src: iwyu in cleanup_queue.cc https://github.com/nodejs/node/pull/44983 * src: add missing include for `std::all_of` https://github.com/nodejs/node/pull/45541 * deps: update ICU to 72.1 https://github.com/nodejs/node/pull/45068 * chore: fixup patch indices * chore: remove errant semicolons - https://github.com/nodejs/node/pull/44179 - https://github.com/nodejs/node/pull/44193 * src: add support for externally shared js builtins https://github.com/nodejs/node/pull/44376 * chore: add missing GN filenames * deps: update nghttp2 to 1.51.0 https://github.com/nodejs/node/pull/45537 * chore: disable more Node.js snapshot tests The Snapshot feature is currently disabled * chore: disable ICU timezone tests Node.js uses a different version of ICU than Electron so they will often be out of sync. * chore: disable threadpool event tracing test Event tracing is not enabled in embedded Node.js * chore: fixup patch indices * chore: comments from review Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
44 lines
2.2 KiB
Diff
44 lines
2.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jeremy Rose <japthorp@slack-corp.com>
|
|
Date: Mon, 5 Dec 2022 14:28:40 -0800
|
|
Subject: allow embedder to control CodeGenerationFromStringsCallback
|
|
|
|
This is needed to blend Blink and Node's code generation policy.
|
|
|
|
This should be upstreamed.
|
|
|
|
diff --git a/src/api/environment.cc b/src/api/environment.cc
|
|
index c0c422e969543dcd570dabfd8ff0755abe37face..4f14b308d14f3653c8646345a5b375014a51851f 100644
|
|
--- a/src/api/environment.cc
|
|
+++ b/src/api/environment.cc
|
|
@@ -267,11 +267,15 @@ void SetIsolateErrorHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
|
void SetIsolateMiscHandlers(v8::Isolate* isolate, const IsolateSettings& s) {
|
|
isolate->SetMicrotasksPolicy(s.policy);
|
|
|
|
+ // Allow the embedder first chance at policy decisions.
|
|
+ // This is particularly important for embedders that combine Node and Blink,
|
|
+ // as Blink must be able to make Content Security Policy-based decisions.
|
|
auto* allow_wasm_codegen_cb = s.allow_wasm_code_generation_callback ?
|
|
s.allow_wasm_code_generation_callback : AllowWasmCodeGenerationCallback;
|
|
isolate->SetAllowWasmCodeGenerationCallback(allow_wasm_codegen_cb);
|
|
- isolate->SetModifyCodeGenerationFromStringsCallback(
|
|
- ModifyCodeGenerationFromStrings);
|
|
+ auto* modify_code_generation_from_strings_callback = s.modify_code_generation_from_strings_callback ?
|
|
+ s.modify_code_generation_from_strings_callback : ModifyCodeGenerationFromStrings;
|
|
+ isolate->SetModifyCodeGenerationFromStringsCallback(modify_code_generation_from_strings_callback);
|
|
|
|
Mutex::ScopedLock lock(node::per_process::cli_options_mutex);
|
|
if (per_process::cli_options->get_per_isolate_options()
|
|
diff --git a/src/node.h b/src/node.h
|
|
index 6ff7527d4fe4d126bda80615ffed75f77f700b86..5a849f047feca5d4d101c21c125e1c0500150077 100644
|
|
--- a/src/node.h
|
|
+++ b/src/node.h
|
|
@@ -463,6 +463,8 @@ struct IsolateSettings {
|
|
v8::PromiseRejectCallback promise_reject_callback = nullptr;
|
|
v8::AllowWasmCodeGenerationCallback
|
|
allow_wasm_code_generation_callback = nullptr;
|
|
+ v8::ModifyCodeGenerationFromStringsCallback2
|
|
+ modify_code_generation_from_strings_callback = nullptr;
|
|
};
|
|
|
|
// Overriding IsolateSettings may produce unexpected behavior
|