Skip to content

Commit b9794f7

Browse files
author
Guy Bedford
committed
latest pr feedback
1 parent 2a4f7f8 commit b9794f7

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

src/module_wrap.cc

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,8 @@ void ModuleWrap::Instantiate(const FunctionCallbackInfo<Value>& args) {
540540
Local<Context> context = obj->context();
541541
Local<Module> module = obj->module_.Get(isolate);
542542
TryCatchScope try_catch(realm->env());
543-
USE(module->InstantiateModule(
544-
context, ResolveModuleCallback, ResolveSourceCallback));
543+
USE(module->InstantiateModule(context, ResolveModuleCallback,
544+
ResolveSourceCallback));
545545

546546
// clear resolve cache on instantiate
547547
obj->resolve_cache_.clear();
@@ -569,7 +569,7 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {
569569
ContextifyContext* contextify_context = obj->contextify_context_;
570570
MicrotaskQueue* microtask_queue = nullptr;
571571
if (contextify_context != nullptr)
572-
microtask_queue = contextify_context->microtask_queue();
572+
microtask_queue = contextify_context->microtask_queue();
573573

574574
// module.evaluate(timeout, breakOnSigint)
575575
CHECK_EQ(args.Length(), 2);
@@ -625,7 +625,8 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo<Value>& args) {
625625
}
626626

627627
if (try_catch.HasCaught()) {
628-
if (!try_catch.HasTerminated()) try_catch.ReThrow();
628+
if (!try_catch.HasTerminated())
629+
try_catch.ReThrow();
629630
return;
630631
}
631632

@@ -646,8 +647,8 @@ void ModuleWrap::InstantiateSync(const FunctionCallbackInfo<Value>& args) {
646647

647648
{
648649
TryCatchScope try_catch(env);
649-
USE(module->InstantiateModule(
650-
context, ResolveModuleCallback, ResolveSourceCallback));
650+
USE(module->InstantiateModule(context, ResolveModuleCallback,
651+
ResolveSourceCallback));
651652

652653
// clear resolve cache on instantiate
653654
obj->resolve_cache_.clear();
@@ -987,10 +988,11 @@ static MaybeLocal<Promise> ImportModuleDynamicallyWithPhase(
987988
};
988989

989990
Local<Value> result;
990-
if (import_callback
991-
->Call(
992-
context, Undefined(isolate), arraysize(import_args), import_args)
993-
.ToLocal(&result)) {
991+
if (import_callback->Call(
992+
context,
993+
Undefined(isolate),
994+
arraysize(import_args),
995+
import_args).ToLocal(&result)) {
994996
CHECK(result->IsPromise());
995997
return handle_scope.Escape(result.As<Promise>());
996998
}
@@ -1034,7 +1036,8 @@ void ModuleWrap::HostInitializeImportMetaObjectCallback(Local<Context> context,
10341036
Local<Module> module,
10351037
Local<Object> meta) {
10361038
Environment* env = Environment::GetCurrent(context);
1037-
if (env == nullptr) return;
1039+
if (env == nullptr)
1040+
return;
10381041
ModuleWrap* module_wrap = GetFromModule(env, module);
10391042

10401043
if (module_wrap == nullptr) {
@@ -1091,10 +1094,10 @@ MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback(
10911094
->GetInternalField(kSyntheticEvaluationStepsSlot)
10921095
.As<Value>()
10931096
.As<Function>();
1094-
obj->object()->SetInternalField(kSyntheticEvaluationStepsSlot,
1095-
Undefined(isolate));
1096-
MaybeLocal<Value> ret =
1097-
synthetic_evaluation_steps->Call(context, obj->object(), 0, nullptr);
1097+
obj->object()->SetInternalField(
1098+
kSyntheticEvaluationStepsSlot, Undefined(isolate));
1099+
MaybeLocal<Value> ret = synthetic_evaluation_steps->Call(context,
1100+
obj->object(), 0, nullptr);
10981101
if (ret.IsEmpty()) {
10991102
CHECK(try_catch.HasCaught());
11001103
}

test/es-module/test-esm-wasm.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ describe('ESM: WASM modules', { concurrency: !process.env.TEST_PARALLEL }, () =>
145145
'import { strictEqual } from "node:assert";',
146146
`import source mod from ${JSON.stringify(fixtures.fileURL('es-modules/unimportable.wasm'))};`,
147147
'assert.strictEqual(mod instanceof WebAssembly.Module, true);',
148+
`await assert.rejects(import(${JSON.stringify(fixtures.fileURL('es-modules/unimportable.wasm'))}));`,
148149
].join('\n'),
149150
]);
150151

0 commit comments

Comments
 (0)