diff options
Diffstat (limited to 'core/bindings.rs')
-rw-r--r-- | core/bindings.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/core/bindings.rs b/core/bindings.rs index 52ecf7bac..fdd8abf1a 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -228,16 +228,13 @@ pub extern "C" fn wasm_async_resolve_promise_callback( } } -pub extern "C" fn host_import_module_dynamically_callback( - context: v8::Local<v8::Context>, - _host_defined_options: v8::Local<v8::Data>, - resource_name: v8::Local<v8::Value>, - specifier: v8::Local<v8::String>, - import_assertions: v8::Local<v8::FixedArray>, -) -> *mut v8::Promise { - // SAFETY: `CallbackScope` can be safely constructed from `Local<Context>` - let scope = &mut unsafe { v8::CallbackScope::new(context) }; - +pub fn host_import_module_dynamically_callback<'s>( + scope: &mut v8::HandleScope<'s>, + _host_defined_options: v8::Local<'s, v8::Data>, + resource_name: v8::Local<'s, v8::Value>, + specifier: v8::Local<'s, v8::String>, + import_assertions: v8::Local<'s, v8::FixedArray>, +) -> Option<v8::Local<'s, v8::Promise>> { // NOTE(bartlomieju): will crash for non-UTF-8 specifier let specifier_str = specifier .to_string(scope) @@ -298,7 +295,7 @@ pub extern "C" fn host_import_module_dynamically_callback( let promise = promise.catch(scope, map_err).unwrap(); - &*promise as *const _ as *mut _ + Some(promise) } pub extern "C" fn host_initialize_import_meta_object_callback( |