summaryrefslogtreecommitdiff
path: root/core/libdeno/binding.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2019-06-10 15:27:34 -0400
committerGitHub <noreply@github.com>2019-06-10 15:27:34 -0400
commite0436975211202afadb1a8ccd7d5154694162f38 (patch)
treea4e864991a109071b32e79ae5ab9624c1228b0a4 /core/libdeno/binding.cc
parent88b0c8756eef96c8adaff1005d00aae52bd2272c (diff)
Expose dynamic import in core (#2472)
Diffstat (limited to 'core/libdeno/binding.cc')
-rw-r--r--core/libdeno/binding.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/libdeno/binding.cc b/core/libdeno/binding.cc
index f8ef1c7a7..eac104677 100644
--- a/core/libdeno/binding.cc
+++ b/core/libdeno/binding.cc
@@ -521,6 +521,8 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallback(
auto* isolate = context->GetIsolate();
DenoIsolate* d = DenoIsolate::FromIsolate(isolate);
v8::Isolate::Scope isolate_scope(isolate);
+ v8::Context::Scope context_scope(context);
+ v8::EscapableHandleScope handle_scope(isolate);
v8::String::Utf8Value specifier_str(isolate, specifier);
@@ -544,7 +546,9 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallback(
d->dyn_import_cb_(d->user_data_, *specifier_str, *referrer_name_str,
import_id);
- return resolver->GetPromise();
+
+ auto promise = resolver->GetPromise();
+ return handle_scope.Escape(promise);
}
void DenoIsolate::AddIsolate(v8::Isolate* isolate) {