diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-08-15 14:12:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-15 14:12:11 +0200 |
commit | 5a4f84a0e1a514c0e6040116953717051b44c168 (patch) | |
tree | 6cdbaa14f14963cb8567a56570bd6e299a35571e /core/bindings.rs | |
parent | 18dcc64910e6dd5f26f3828a07f2ff0845dfaa4b (diff) |
chore: upgrade rusty_v8 to 0.48.1 (#15310)
Diffstat (limited to 'core/bindings.rs')
-rw-r--r-- | core/bindings.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/core/bindings.rs b/core/bindings.rs index aef479472..f3c16acbf 100644 --- a/core/bindings.rs +++ b/core/bindings.rs @@ -140,6 +140,22 @@ pub fn set_func_raw( obj.set(scope, key.into(), val.into()); } +pub extern "C" fn wasm_async_resolve_promise_callback( + _isolate: *mut v8::Isolate, + context: v8::Local<v8::Context>, + resolver: v8::Local<v8::PromiseResolver>, + compilation_result: v8::Local<v8::Value>, + success: v8::WasmAsyncSuccess, +) { + // SAFETY: `CallbackScope` can be safely constructed from `Local<Context>` + let scope = &mut unsafe { v8::CallbackScope::new(context) }; + if success == v8::WasmAsyncSuccess::Success { + resolver.resolve(scope, compilation_result).unwrap(); + } else { + resolver.reject(scope, compilation_result).unwrap(); + } +} + pub extern "C" fn host_import_module_dynamically_callback( context: v8::Local<v8::Context>, _host_defined_options: v8::Local<v8::Data>, |