Skip to content

Commit

Permalink
Enable additional encoding tests in ShadowRealms
Browse files Browse the repository at this point in the history
These seem to have been missed in web-platform-tests#41968.

Includes ensuring that exports from any support files are defined on the
global object, and that support scripts are referred to with their
absolute paths from the root.
  • Loading branch information
ptomato committed Nov 27, 2024
1 parent eaeff8d commit 231112f
Show file tree
Hide file tree
Showing 20 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions encoding/api-invalid-label.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// META: title=Encoding API: invalid label
// META: global=window,dedicatedworker,shadowrealm
// META: timeout=long
// META: variant=?1-1000
// META: variant=?1001-2000
Expand Down
1 change: 1 addition & 0 deletions encoding/api-replacement-encodings.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// META: title=Encoding API: replacement encoding
// META: global=window,dedicatedworker,shadowrealm
// META: script=resources/encodings.js

encodings_table.forEach(function(section) {
Expand Down
2 changes: 1 addition & 1 deletion encoding/encodeInto.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=/common/sab.js

[
Expand Down
2 changes: 1 addition & 1 deletion encoding/resources/encodings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Straight from https://encoding.spec.whatwg.org/encodings.json
const encodings_table =
globalThis.encodings_table =
[
{
"encodings": [
Expand Down
2 changes: 2 additions & 0 deletions encoding/sharedarraybuffer.https.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(() => {
const decoder = new TextDecoder('utf-8');
const buffer = new SharedArrayBuffer(4);
Expand Down
1 change: 1 addition & 0 deletions encoding/single-byte-textdecoder.any.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion encoding/streams/decode-ignore-bom.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=resources/readable-stream-from-array.js
// META: script=resources/readable-stream-to-array.js

Expand Down
2 changes: 1 addition & 1 deletion encoding/streams/decode-incomplete-input.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=resources/readable-stream-from-array.js
// META: script=resources/readable-stream-to-array.js

Expand Down
2 changes: 1 addition & 1 deletion encoding/streams/decode-split-character.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=resources/readable-stream-from-array.js
// META: script=resources/readable-stream-to-array.js

Expand Down
2 changes: 1 addition & 1 deletion encoding/streams/decode-utf8.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=resources/readable-stream-from-array.js
// META: script=resources/readable-stream-to-array.js
// META: script=/common/sab.js
Expand Down
2 changes: 1 addition & 1 deletion encoding/streams/encode-bad-chunks.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=resources/readable-stream-from-array.js
// META: script=resources/readable-stream-to-array.js

Expand Down
2 changes: 1 addition & 1 deletion encoding/streams/encode-utf8.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=resources/readable-stream-from-array.js
// META: script=resources/readable-stream-to-array.js

Expand Down
1 change: 1 addition & 0 deletions encoding/streams/resources/readable-stream-from-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ function readableStreamFromArray(array) {
}
});
}
globalThis.readableStreamFromArray = readableStreamFromArray;
1 change: 1 addition & 0 deletions encoding/streams/resources/readable-stream-to-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ function readableStreamToArray(stream) {
});
return stream.pipeTo(writable).then(() => array);
}
globalThis.readableStreamToArray = readableStreamToArray;
2 changes: 1 addition & 1 deletion encoding/textdecoder-copy.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=/common/sab.js

["ArrayBuffer", "SharedArrayBuffer"].forEach(arrayBufferOrSharedArrayBuffer => {
Expand Down
2 changes: 2 additions & 0 deletions encoding/textdecoder-eof.any.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// META: global=window,dedicatedworker,shadowrealm

test(() => {
// Truncated sequences
assert_equals(new TextDecoder().decode(new Uint8Array([0xF0])), "\uFFFD");
Expand Down
2 changes: 1 addition & 1 deletion encoding/textdecoder-fatal-single-byte.any.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// META: timeout=long
// META: title=Encoding API: Fatal flag for single byte encodings
// META: timeout=long
// META: global=window,dedicatedworker,shadowrealm
// META: variant=?1-1000
// META: variant=?1001-2000
// META: variant=?2001-3000
Expand Down
1 change: 1 addition & 0 deletions encoding/textdecoder-labels.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// META: title=Encoding API: Encoding labels
// META: global=window,dedicatedworker,shadowrealm
// META: script=resources/encodings.js
// META: timeout=long

Expand Down
2 changes: 1 addition & 1 deletion encoding/textdecoder-streaming.any.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// META: title=Encoding API: Streaming decode
// META: global=window,worker
// META: global=window,worker,shadowrealm
// META: script=resources/encodings.js
// META: script=/common/sab.js

Expand Down
1 change: 1 addition & 0 deletions encoding/textencoder-constructor-non-utf.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// META: title=Encoding API: Legacy encodings
// META: global=window,dedicatedworker,shadowrealm
// META: script=resources/encodings.js

encodings_table.forEach(function(section) {
Expand Down

0 comments on commit 231112f

Please sign in to comment.