summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-04-27 20:50:46 +0200
committerGitHub <noreply@github.com>2023-04-27 20:50:46 +0200
commit6cd62ea5e969de258b1d308daf5bec91e73e79d3 (patch)
tree9f80438d87c92cf66e6b7636b532469675d68230
parentc3d670dbc992ffaff02cd8df82335ee41e88596e (diff)
chore: upgrade rusty_v8 to 0.71.0 (#18868)
-rwxr-xr-x.github/workflows/ci.generate.ts4
-rw-r--r--.github/workflows/ci.yml6
-rw-r--r--Cargo.lock4
-rw-r--r--Cargo.toml2
-rw-r--r--cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out4
-rw-r--r--cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out4
-rw-r--r--core/runtime.rs25
-rw-r--r--serde_v8/error.rs3
-rw-r--r--serde_v8/magic/v8slice.rs13
-rw-r--r--serde_v8/tests/de.rs10
-rw-r--r--tools/wpt/expectation.json113
11 files changed, 48 insertions, 140 deletions
diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts
index 41abf1737..ea9f93bc1 100755
--- a/.github/workflows/ci.generate.ts
+++ b/.github/workflows/ci.generate.ts
@@ -17,7 +17,7 @@ const Runners = (() => {
})();
// bump the number at the start when you want to purge the cache
const prCacheKeyPrefix =
- "22-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-";
+ "23-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-";
const installPkgsCommand =
"sudo apt-get install --no-install-recommends debootstrap clang-15 lld-15";
@@ -476,7 +476,7 @@ const ci = {
"~/.cargo/git/db",
].join("\n"),
key:
- "22-cargo-home-${{ matrix.os }}-${{ hashFiles('Cargo.lock') }}",
+ "23-cargo-home-${{ matrix.os }}-${{ hashFiles('Cargo.lock') }}",
},
},
{
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c70590d61..205e5c069 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -290,7 +290,7 @@ jobs:
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
- key: '22-cargo-home-${{ matrix.os }}-${{ hashFiles(''Cargo.lock'') }}'
+ key: '23-cargo-home-${{ matrix.os }}-${{ hashFiles(''Cargo.lock'') }}'
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr)'
- name: Restore cache build output (PR)
uses: actions/cache/restore@v3
@@ -302,7 +302,7 @@ jobs:
!./target/*/*.zip
!./target/*/*.tar.gz
key: never_saved
- restore-keys: '22-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-'
+ restore-keys: '23-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-'
- name: Apply and update mtime cache
if: '!(github.event_name == ''pull_request'' && matrix.skip_pr) && (!startsWith(github.ref, ''refs/tags/''))'
uses: ./.github/mtime_cache
@@ -578,7 +578,7 @@ jobs:
!./target/*/gn_out
!./target/*/*.zip
!./target/*/*.tar.gz
- key: '22-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
+ key: '23-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-${{ github.sha }}'
publish-canary:
name: publish canary
runs-on: ubuntu-22.04
diff --git a/Cargo.lock b/Cargo.lock
index ddd92ea83..483d57340 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5678,9 +5678,9 @@ dependencies = [
[[package]]
name = "v8"
-version = "0.70.0"
+version = "0.71.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab13e022340b67561836bbb90ceeebbfca7e35fbc05471ceff5ce099e5a754a3"
+checksum = "51a173a437bebab13d587a4aaf0a1e7a49433226538c9a78ca3b4ce3b8c6aeb6"
dependencies = [
"bitflags 1.3.2",
"fslock",
diff --git a/Cargo.toml b/Cargo.toml
index 5664a69ed..4a7d051f0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -41,7 +41,7 @@ license = "MIT"
repository = "https://github.com/denoland/deno"
[workspace.dependencies]
-v8 = { version = "0.70.0", default-features = false }
+v8 = { version = "0.71.0", default-features = false }
deno_ast = { version = "0.26.0", features = ["transpiling"] }
deno_core = { version = "0.181.0", path = "./core" }
diff --git a/cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out b/cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out
index 8f03f71b8..2b1b26444 100644
--- a/cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out
+++ b/cli/tests/testdata/run/event_listener_error_immediate_exit.ts.out
@@ -3,4 +3,8 @@ error: Uncaught Error: bar
throw new Error("bar");
^
at [WILDCARD]/event_listener_error_immediate_exit.ts:4:9[WILDCARD]
+ at innerInvokeEventListeners (ext:deno_web/02_event.js:785:7)
+ at invokeEventListeners (ext:deno_web/02_event.js:825:5)
+ at dispatch (ext:deno_web/02_event.js:694:9)
+ at dispatchEvent (ext:deno_web/02_event.js:1086:12)
at [WILDCARD]/event_listener_error_immediate_exit.ts:11:1
diff --git a/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out b/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out
index 8bd312298..8ab76d6cf 100644
--- a/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out
+++ b/cli/tests/testdata/run/event_listener_error_immediate_exit_worker.ts.out
@@ -3,6 +3,10 @@ error: Uncaught (in worker "") Error: bar
throw new Error("bar");
^
at [WILDCARD]/event_listener_error_immediate_exit.ts:4:9
+ at innerInvokeEventListeners (ext:deno_web/02_event.js:785:7)
+ at invokeEventListeners (ext:deno_web/02_event.js:825:5)
+ at dispatch (ext:deno_web/02_event.js:694:9)
+ at dispatchEvent (ext:deno_web/02_event.js:1086:12)
at [WILDCARD]/event_listener_error_immediate_exit.ts:11:1
error: Uncaught (in promise) Error: Unhandled error in child worker.
at [WILDCARD]
diff --git a/core/runtime.rs b/core/runtime.rs
index d8355ae6d..be777bdf7 100644
--- a/core/runtime.rs
+++ b/core/runtime.rs
@@ -196,7 +196,6 @@ fn v8_init(
" --no-validate-asm",
" --turbo_fast_api_calls",
" --harmony-change-array-by-copy",
- " --no-harmony-rab-gsab",
);
if predictable {
@@ -1527,6 +1526,10 @@ pub(crate) fn exception_to_err_result<T>(
let state_rc = JsRuntime::state(scope);
let was_terminating_execution = scope.is_execution_terminating();
+ // Disable running microtasks for a moment. When upgrading to V8 v11.4
+ // we discovered that canceling termination here will cause the queued
+ // microtasks to run which breaks some tests.
+ scope.set_microtasks_policy(v8::MicrotasksPolicy::Explicit);
// If TerminateExecution was called, cancel isolate termination so that the
// exception can be created. Note that `scope.is_execution_terminating()` may
// have returned false if TerminateExecution was indeed called but there was
@@ -1560,6 +1563,7 @@ pub(crate) fn exception_to_err_result<T>(
// Resume exception termination.
scope.terminate_execution();
}
+ scope.set_microtasks_policy(v8::MicrotasksPolicy::Auto);
Err(js_error.into())
}
@@ -4738,25 +4742,6 @@ Deno.core.opAsync("op_async_serialize_object_with_numbers_as_keys", {
}
#[test]
- fn test_resizable_array_buffer() {
- // Verify that "resizable ArrayBuffer" is disabled
- let mut runtime = JsRuntime::new(Default::default());
- runtime
- .execute_script_static(
- "test_rab.js",
- r#"const a = new ArrayBuffer(100, {maxByteLength: 200});
- if (a.byteLength !== 100) {
- throw new Error('wrong byte length');
- }
- if (a.maxByteLength !== undefined) {
- throw new Error("ArrayBuffer shouldn't have maxByteLength");
- }
- "#,
- )
- .unwrap();
- }
-
- #[test]
fn test_non_existent_async_op_error() {
// Verify that "resizable ArrayBuffer" is disabled
let mut runtime = JsRuntime::new(Default::default());
diff --git a/serde_v8/error.rs b/serde_v8/error.rs
index aa2d92bf8..16d7882b7 100644
--- a/serde_v8/error.rs
+++ b/serde_v8/error.rs
@@ -55,6 +55,9 @@ pub enum Error {
#[error("serde_v8 error: length mismatch, got: {0}, expected: {1}")]
LengthMismatch(usize, usize),
+
+ #[error("serde_v8 error: can't create slice from resizable ArrayBuffer")]
+ ResizableBackingStoreNotSupported,
}
impl serde::ser::Error for Error {
diff --git a/serde_v8/magic/v8slice.rs b/serde_v8/magic/v8slice.rs
index 073e75235..b1dd89770 100644
--- a/serde_v8/magic/v8slice.rs
+++ b/serde_v8/magic/v8slice.rs
@@ -91,9 +91,16 @@ impl FromV8 for V8Slice {
scope: &mut v8::HandleScope,
value: v8::Local<v8::Value>,
) -> Result<Self, crate::Error> {
- to_ranged_buffer(scope, value)
- .and_then(|(b, r)| Self::from_buffer(b, r))
- .map_err(|_| crate::Error::ExpectedBuffer(value_to_type_str(value)))
+ match to_ranged_buffer(scope, value) {
+ Ok((b, r)) => {
+ if b.get_backing_store().is_resizable_by_user_javascript() {
+ return Err(crate::Error::ResizableBackingStoreNotSupported);
+ }
+ Self::from_buffer(b, r)
+ .map_err(|_| crate::Error::ExpectedBuffer(value_to_type_str(value)))
+ }
+ Err(_) => Err(crate::Error::ExpectedBuffer(value_to_type_str(value))),
+ }
}
}
diff --git a/serde_v8/tests/de.rs b/serde_v8/tests/de.rs
index 4e5e1e4b9..4c5cf7283 100644
--- a/serde_v8/tests/de.rs
+++ b/serde_v8/tests/de.rs
@@ -265,6 +265,16 @@ fn de_buffers() {
assert_eq!(&*buf, &[0x68, 0x65, 0x6C, 0x6C, 0x6F]);
},
);
+
+ dedo("(new ArrayBuffer(4))", |scope, v| {
+ let buf: ZeroCopyBuf = serde_v8::from_v8(scope, v).unwrap();
+ assert_eq!(&*buf, &[0x0, 0x0, 0x0, 0x0]);
+ });
+
+ dedo("(new ArrayBuffer(8, { maxByteLength: 16}))", |scope, v| {
+ let result: Result<ZeroCopyBuf, Error> = serde_v8::from_v8(scope, v);
+ matches!(result, Err(Error::ResizableBackingStoreNotSupported));
+ });
}
// Structs
diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json
index 8f4590183..7cff6b6eb 100644
--- a/tools/wpt/expectation.json
+++ b/tools/wpt/expectation.json
@@ -5480,18 +5480,9 @@
"Serializing a non-serializable platform object fails",
"An object whose interface is deleted from the global must still deserialize",
"A subclass instance will deserialize as its closest serializable superclass",
- "Resizable ArrayBuffer",
"Growable SharedArrayBuffer",
- "Length-tracking TypedArray",
- "Length-tracking DataView",
- "Serializing OOB TypedArray throws",
- "Serializing OOB DataView throws",
"A subclass instance will be received as its closest transferable superclass",
- "Resizable ArrayBuffer is transferable",
- "Length-tracking TypedArray is transferable",
- "Length-tracking DataView is transferable",
- "Transferring OOB TypedArray throws",
- "Transferring OOB DataView throws"
+ "Transferring OOB TypedArray throws"
],
"structured-clone.any.worker.html": [
"Blob basic",
@@ -5517,18 +5508,9 @@
"Serializing a non-serializable platform object fails",
"An object whose interface is deleted from the global must still deserialize",
"A subclass instance will deserialize as its closest serializable superclass",
- "Resizable ArrayBuffer",
"Growable SharedArrayBuffer",
- "Length-tracking TypedArray",
- "Length-tracking DataView",
- "Serializing OOB TypedArray throws",
- "Serializing OOB DataView throws",
"A subclass instance will be received as its closest transferable superclass",
- "Resizable ArrayBuffer is transferable",
- "Length-tracking TypedArray is transferable",
- "Length-tracking DataView is transferable",
- "Transferring OOB TypedArray throws",
- "Transferring OOB DataView throws"
+ "Transferring OOB TypedArray throws"
]
},
"dynamic-markup-insertion": {
@@ -5659,95 +5641,8 @@
},
"infrastructure": {
"safe-passing-of-structured-data": {
- "messagechannel.any.html": [
- "Blob basic",
- "Blob unpaired high surrogate (invalid utf-8)",
- "Blob unpaired low surrogate (invalid utf-8)",
- "Blob paired surrogates (invalid utf-8)",
- "Blob empty",
- "Blob NUL",
- "Array Blob object, Blob basic",
- "Array Blob object, Blob unpaired high surrogate (invalid utf-8)",
- "Array Blob object, Blob unpaired low surrogate (invalid utf-8)",
- "Array Blob object, Blob paired surrogates (invalid utf-8)",
- "Array Blob object, Blob empty",
- "Array Blob object, Blob NUL",
- "Array Blob object, two Blobs",
- "Object Blob object, Blob basic",
- "Object Blob object, Blob unpaired high surrogate (invalid utf-8)",
- "Object Blob object, Blob unpaired low surrogate (invalid utf-8)",
- "Object Blob object, Blob paired surrogates (invalid utf-8)",
- "Object Blob object, Blob empty",
- "Object Blob object, Blob NUL",
- "File basic",
- "FileList empty",
- "Array FileList object, FileList empty",
- "Object FileList object, FileList empty",
- "ImageData 1x1 transparent black",
- "ImageData 1x1 non-transparent non-black",
- "Array ImageData object, ImageData 1x1 transparent black",
- "Array ImageData object, ImageData 1x1 non-transparent non-black",
- "Object ImageData object, ImageData 1x1 transparent black",
- "Object ImageData object, ImageData 1x1 non-transparent non-black",
- "ImageBitmap 1x1 transparent black",
- "ImageBitmap 1x1 non-transparent non-black",
- "Array ImageBitmap object, ImageBitmap 1x1 transparent black",
- "Array ImageBitmap object, ImageBitmap 1x1 transparent non-black",
- "Object ImageBitmap object, ImageBitmap 1x1 transparent black",
- "Object ImageBitmap object, ImageBitmap 1x1 transparent non-black",
- "Serializing a non-serializable platform object fails",
- "An object whose interface is deleted from the global must still deserialize",
- "A subclass instance will deserialize as its closest serializable superclass",
- "Resizable ArrayBuffer",
- "Growable SharedArrayBuffer",
- "Length-tracking TypedArray",
- "Length-tracking DataView",
- "Serializing OOB TypedArray throws",
- "Serializing OOB DataView throws",
- "A subclass instance will be received as its closest transferable superclass",
- "Resizable ArrayBuffer is transferable",
- "Length-tracking TypedArray is transferable",
- "Length-tracking DataView is transferable",
- "Transferring OOB TypedArray throws",
- "Transferring OOB DataView throws"
- ],
- "messagechannel.any.worker.html": [
- "Blob basic",
- "Blob unpaired high surrogate (invalid utf-8)",
- "Blob unpaired low surrogate (invalid utf-8)",
- "Blob paired surrogates (invalid utf-8)",
- "Blob empty",
- "Blob NUL",
- "Array Blob object, Blob basic",
- "Array Blob object, Blob unpaired high surrogate (invalid utf-8)",
- "Array Blob object, Blob unpaired low surrogate (invalid utf-8)",
- "Array Blob object, Blob paired surrogates (invalid utf-8)",
- "Array Blob object, Blob empty",
- "Array Blob object, Blob NUL",
- "Array Blob object, two Blobs",
- "Object Blob object, Blob basic",
- "Object Blob object, Blob unpaired high surrogate (invalid utf-8)",
- "Object Blob object, Blob unpaired low surrogate (invalid utf-8)",
- "Object Blob object, Blob paired surrogates (invalid utf-8)",
- "Object Blob object, Blob empty",
- "Object Blob object, Blob NUL",
- "File basic",
- "Serializing a non-serializable platform object fails",
- "An object whose interface is deleted from the global must still deserialize",
- "A subclass instance will deserialize as its closest serializable superclass",
- "Resizable ArrayBuffer",
- "Growable SharedArrayBuffer",
- "Length-tracking TypedArray",
- "Length-tracking DataView",
- "Serializing OOB TypedArray throws",
- "Serializing OOB DataView throws",
- "A subclass instance will be received as its closest transferable superclass",
- "Resizable ArrayBuffer is transferable",
- "Length-tracking TypedArray is transferable",
- "Length-tracking DataView is transferable",
- "Transferring OOB TypedArray throws",
- "Transferring OOB DataView throws"
- ],
+ "messagechannel.any.html": false,
+ "messagechannel.any.worker.html": false,
"shared-array-buffers": {
"no-coop-coep.https.any.html": false,
"no-coop-coep.https.any.worker.html": false,