electron/patches/node/src_update_importmoduledynamically.patch
electron-roller[bot] d0e220cbce
chore: bump node to v16.17.0 (main) (#35350)
* chore: bump node in DEPS to v16.17.0

* chore: fixup asar patch

* lib: use null-prototype objects for property descriptors

https://github.com/nodejs/node/pull/43270

* src: make SecureContext fields private

https://github.com/nodejs/node/pull/43173

* crypto: remove Node.js-specific webcrypto extensions

https://github.com/nodejs/node/pull/43310

* test: refactor to top-level await

https://github.com/nodejs/node/pull/43500

* deps: cherry-pick two libuv fixes

https://github.com/nodejs/node/pull/43950

* src: slim down env-inl.h

https://github.com/nodejs/node/pull/43745

* util: add AggregateError.prototype.errors to inspect output

https://github.com/nodejs/node/pull/43646

* esm: improve performance & tidy tests

https://github.com/nodejs/node/pull/43784

* src: NodeArrayBufferAllocator delegates to v8's allocator

https://github.com/nodejs/node/pull/43594

* chore: update patch indices

* chore: update filenames

* src: refactor IsSupportedAuthenticatedMode

https://github.com/nodejs/node/pull/42368

* src: add --openssl-legacy-provider option

https://github.com/nodejs/node/pull/40478

* lib,src: add source map support for global eval

https://github.com/nodejs/node/pull/43428

* trace_events: trace net connect event

https://github.com/nodejs/node/pull/43903

* deps: update ICU to 71.1

https://github.com/nodejs/node/pull/42655

This fails the test because it's missing https://chromium-review.googlesource.com/c/chromium/deps/icu/+/3841093

* lib: give names to promisified exists() and question()

https://github.com/nodejs/node/pull/43218

* crypto: add CFRG curves to Web Crypto API

https://github.com/nodejs/node/pull/42507

* src: fix memory leak for v8.serialize

https://github.com/nodejs/node/pull/42695

This test does not work for Electron as they do not use V8's
ArrayBufferAllocator.

* buffer: fix atob input validation

https://github.com/nodejs/node/pull/42539

* src: fix ssize_t error from nghttp2.h

https://github.com/nodejs/node/pull/44393

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2022-08-29 09:55:36 -04:00

56 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Camillo Bruni <cbruni@chromium.org>
Date: Mon, 15 Nov 2021 15:34:38 +0100
Subject: src: update ImportModuleDynamically
PR-URL: https://github.com/nodejs/node/pull/41610
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
diff --git a/src/module_wrap.cc b/src/module_wrap.cc
index b4b70ec1afd3eaa2489075156e7ccd7682ddd307..50ce8d510cb1a4299f3c161198ee6ed63fabc05f 100644
--- a/src/module_wrap.cc
+++ b/src/module_wrap.cc
@@ -46,7 +46,6 @@ using v8::PrimitiveArray;
using v8::Promise;
using v8::ScriptCompiler;
using v8::ScriptOrigin;
-using v8::ScriptOrModule;
using v8::String;
using v8::UnboundModuleScript;
using v8::Undefined;
@@ -553,7 +552,8 @@ MaybeLocal<Module> ModuleWrap::ResolveModuleCallback(
static MaybeLocal<Promise> ImportModuleDynamically(
Local<Context> context,
- Local<ScriptOrModule> referrer,
+ Local<v8::Data> host_defined_options,
+ Local<Value> resource_name,
Local<String> specifier,
Local<FixedArray> import_assertions) {
Isolate* isolate = context->GetIsolate();
@@ -568,7 +568,7 @@ static MaybeLocal<Promise> ImportModuleDynamically(
Local<Function> import_callback =
env->host_import_module_dynamically_callback();
- Local<PrimitiveArray> options = referrer->GetHostDefinedOptions();
+ Local<FixedArray> options = host_defined_options.As<FixedArray>();
if (options->Length() != HostDefinedOptions::kLength) {
Local<Promise::Resolver> resolver;
if (!Promise::Resolver::New(context).ToLocal(&resolver)) return {};
@@ -582,11 +582,11 @@ static MaybeLocal<Promise> ImportModuleDynamically(
Local<Value> object;
- int type = options->Get(isolate, HostDefinedOptions::kType)
+ int type = options->Get(context, HostDefinedOptions::kType)
.As<Number>()
->Int32Value(context)
.ToChecked();
- uint32_t id = options->Get(isolate, HostDefinedOptions::kID)
+ uint32_t id = options->Get(context, HostDefinedOptions::kID)
.As<Number>()
->Uint32Value(context)
.ToChecked();