Skip to content

Commit

Permalink
src: update ImportModuleDynamically
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
camillobruni authored and targos committed Feb 2, 2022
1 parent 468fffd commit aa7dc80
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -559,7 +558,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();
Expand All @@ -574,7 +574,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 {};
Expand All @@ -588,11 +588,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();
Expand Down

0 comments on commit aa7dc80

Please sign in to comment.