diff --git a/Cargo.lock b/Cargo.lock index 2b052373ffc20e..16173cfd199457 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5189,9 +5189,9 @@ dependencies = [ [[package]] name = "v8" -version = "0.47.1" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be156dece7a023d5959a72dc0d398d6c95100ec601a2cea10d868da143e85166" +checksum = "3734ddf37e06e5020a1d5c969301be0cdf023cde0ef4257248ff19eb3a7223e3" dependencies = [ "bitflags", "fslock", diff --git a/cli/tests/testdata/worker_close_in_wasm_reactions.js.out b/cli/tests/testdata/worker_close_in_wasm_reactions.js.out index eef017a96f4d5c..6485c620e5c3dc 100644 --- a/cli/tests/testdata/worker_close_in_wasm_reactions.js.out +++ b/cli/tests/testdata/worker_close_in_wasm_reactions.js.out @@ -1 +1 @@ -Error: CompileError: WebAssembly.compile(): expected string length @+10 +Error: CompileError: WebAssembly.compile(): expected length: @+10 diff --git a/core/Cargo.toml b/core/Cargo.toml index 7f9b5072f32e75..61c38521d90cd5 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -33,7 +33,7 @@ serde_json = { version = "1.0.79", features = ["preserve_order"] } serde_v8 = { version = "0.58.0", path = "../serde_v8" } sourcemap = "=6.0.1" url = { version = "2.2.2", features = ["serde"] } -v8 = { version = "0.47.1", default-features = false } +v8 = { version = "0.48.1", default-features = false } [[example]] name = "http_bench_json_ops" diff --git a/core/bindings.rs b/core/bindings.rs index aef479472caa66..f3c16acbff6ecc 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, + resolver: v8::Local, + compilation_result: v8::Local, + success: v8::WasmAsyncSuccess, +) { + // SAFETY: `CallbackScope` can be safely constructed from `Local` + 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, _host_defined_options: v8::Local, diff --git a/core/runtime.rs b/core/runtime.rs index 541aa7c021a8b1..7f113223f3690f 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -227,11 +227,6 @@ fn v8_init( static ICU_DATA: IcuData = IcuData(*include_bytes!("icudtl.dat")); v8::icu::set_common_data_71(&ICU_DATA.0).unwrap(); - let v8_platform = v8_platform - .unwrap_or_else(|| v8::new_default_platform(0, false).make_shared()); - v8::V8::initialize_platform(v8_platform); - v8::V8::initialize(); - let flags = concat!( " --experimental-wasm-threads", " --wasm-test-streaming", @@ -248,6 +243,11 @@ fn v8_init( } else { v8::V8::set_flags_from_string(flags); } + + let v8_platform = v8_platform + .unwrap_or_else(|| v8::new_default_platform(0, false).make_shared()); + v8::V8::initialize_platform(v8_platform); + v8::V8::initialize(); } #[derive(Default)] @@ -516,6 +516,9 @@ impl JsRuntime { isolate.set_host_import_module_dynamically_callback( bindings::host_import_module_dynamically_callback, ); + isolate.set_wasm_async_resolve_promise_callback( + bindings::wasm_async_resolve_promise_callback, + ); isolate } diff --git a/serde_v8/Cargo.toml b/serde_v8/Cargo.toml index a5a144151ee6a0..38e0678578f3d3 100644 --- a/serde_v8/Cargo.toml +++ b/serde_v8/Cargo.toml @@ -18,7 +18,7 @@ derive_more = "0.99.17" serde = { version = "1.0.136", features = ["derive"] } serde_bytes = "0.11" smallvec = { version = "1.8", features = ["union"] } -v8 = { version = "0.47.1", default-features = false } +v8 = { version = "0.48.1", default-features = false } [dev-dependencies] bencher = "0.1" diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json index 0d53dd962ab914..813abbbba562e3 100644 --- a/tools/wpt/expectation.json +++ b/tools/wpt/expectation.json @@ -1479,8 +1479,8 @@ ], "is.tentative.any.html": true, "is.tentative.any.worker.html": true, - "toString.tentative.any.html": false, - "toString.tentative.any.worker.html": false, + "toString.tentative.any.html": true, + "toString.tentative.any.worker.html": true, "type.tentative.any.html": false, "type.tentative.any.worker.html": false },