| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index 39e39bbb5eb2c509d85321ab7a9f0c1c72413def..ec730b7a45178f4137f684578d79c72cee059025 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -2045,6 +2045,42 @@ Local<UnboundScript> Script::GetUnboundScript() {
|
| i::Handle<i::SharedFunctionInfo>(i::JSFunction::cast(*obj)->shared()));
|
| }
|
|
|
| +// static
|
| +bool Module::FinishDynamicImportSuccess(Local<Context> context,
|
| + Local<Promise> promise,
|
| + Local<Module> module) {
|
| + PREPARE_FOR_EXECUTION_BOOL(context, Module, FinishDynamicImportSuccess);
|
| + i::Handle<i::Module> module_obj = Utils::OpenHandle(*module);
|
| + i::Handle<i::JSModuleNamespace> module_namespace =
|
| + i::Module::GetModuleNamespace(module_obj);
|
| + i::Handle<i::Object> argv[] = {Utils::OpenHandle(*promise), module_namespace};
|
| + has_pending_exception =
|
| + i::Execution::Call(isolate, isolate->promise_resolve(),
|
| + isolate->factory()->undefined_value(), arraysize(argv),
|
| + argv)
|
| + .is_null();
|
| + RETURN_ON_FAILED_EXECUTION_BOOL();
|
| + return true;
|
| +}
|
| +
|
| +// static
|
| +bool Module::FinishDynamicImportFailure(Local<Context> context,
|
| + Local<Promise> promise,
|
| + Local<Value> exception) {
|
| + PREPARE_FOR_EXECUTION_BOOL(context, Module, FinishDynamicImportFailure);
|
| + // We pass true to trigger the debugger's on exception handler.
|
| + i::Handle<i::Object> argv[] = {Utils::OpenHandle(*promise),
|
| + Utils::OpenHandle(*exception),
|
| + isolate->factory()->ToBoolean(true)};
|
| + has_pending_exception =
|
| + i::Execution::Call(isolate, isolate->promise_internal_reject(),
|
| + isolate->factory()->undefined_value(), arraysize(argv),
|
| + argv)
|
| + .is_null();
|
| + RETURN_ON_FAILED_EXECUTION_BOOL();
|
| + return true;
|
| +}
|
| +
|
| int Module::GetModuleRequestsLength() const {
|
| i::Handle<i::Module> self = Utils::OpenHandle(this);
|
| return self->info()->module_requests()->length();
|
| @@ -8174,6 +8210,12 @@ Isolate* Isolate::New(const Isolate::CreateParams& params) {
|
|
|
| isolate->set_api_external_references(params.external_references);
|
| isolate->set_allow_atomics_wait(params.allow_atomics_wait);
|
| +
|
| + if (params.host_import_module_dynamically_callback_ != nullptr) {
|
| + isolate->SetHostImportModuleDynamicallyCallback(
|
| + params.host_import_module_dynamically_callback_);
|
| + }
|
| +
|
| SetResourceConstraints(isolate, params.constraints);
|
| // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this.
|
| Isolate::Scope isolate_scope(v8_isolate);
|
|
|