test: update encoding WPTs
PR-URL: https://github.com/nodejs/node/pull/46802 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
parent
2e5cb5b1f7
commit
31e046b9dd
2
test/fixtures/wpt/README.md
vendored
2
test/fixtures/wpt/README.md
vendored
@ -14,7 +14,7 @@ Last update:
|
||||
- console: https://github.com/web-platform-tests/wpt/tree/767ae35464/console
|
||||
- dom/abort: https://github.com/web-platform-tests/wpt/tree/8fadb38120/dom/abort
|
||||
- dom/events: https://github.com/web-platform-tests/wpt/tree/ab8999891c/dom/events
|
||||
- encoding: https://github.com/web-platform-tests/wpt/tree/779d175c40/encoding
|
||||
- encoding: https://github.com/web-platform-tests/wpt/tree/0c1b9d1622/encoding
|
||||
- fetch/data-urls/resources: https://github.com/web-platform-tests/wpt/tree/7c79d998ff/fetch/data-urls/resources
|
||||
- FileAPI: https://github.com/web-platform-tests/wpt/tree/3b279420d4/FileAPI
|
||||
- FileAPI/file: https://github.com/web-platform-tests/wpt/tree/c01f637cca/FileAPI/file
|
||||
|
37
test/fixtures/wpt/encoding/streams/invalid-realm.window.js
vendored
Normal file
37
test/fixtures/wpt/encoding/streams/invalid-realm.window.js
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
// Text*Stream should still work even if the realm is detached.
|
||||
|
||||
// Adds an iframe to the document and returns it.
|
||||
function addIframe() {
|
||||
const iframe = document.createElement('iframe');
|
||||
document.body.appendChild(iframe);
|
||||
return iframe;
|
||||
}
|
||||
|
||||
promise_test(async t => {
|
||||
const iframe = addIframe();
|
||||
const stream = new iframe.contentWindow.TextDecoderStream();
|
||||
const readPromise = stream.readable.getReader().read();
|
||||
const writer = stream.writable.getWriter();
|
||||
await writer.ready;
|
||||
iframe.remove();
|
||||
return Promise.all([writer.write(new Uint8Array([65])),readPromise]);
|
||||
}, 'TextDecoderStream: write in detached realm should succeed');
|
||||
|
||||
promise_test(async t => {
|
||||
const iframe = addIframe();
|
||||
const stream = new iframe.contentWindow.TextEncoderStream();
|
||||
const readPromise = stream.readable.getReader().read();
|
||||
const writer = stream.writable.getWriter();
|
||||
await writer.ready;
|
||||
iframe.remove();
|
||||
return Promise.all([writer.write('A'), readPromise]);
|
||||
}, 'TextEncoderStream: write in detached realm should succeed');
|
||||
|
||||
for (const type of ['TextEncoderStream', 'TextDecoderStream']) {
|
||||
promise_test(async t => {
|
||||
const iframe = addIframe();
|
||||
const stream = new iframe.contentWindow[type]();
|
||||
iframe.remove();
|
||||
return stream.writable.close();
|
||||
}, `${type}: close in detached realm should succeed`);
|
||||
}
|
2
test/fixtures/wpt/versions.json
vendored
2
test/fixtures/wpt/versions.json
vendored
@ -16,7 +16,7 @@
|
||||
"path": "dom/events"
|
||||
},
|
||||
"encoding": {
|
||||
"commit": "779d175c40efcb8f2c9512bebe25ffbeda485708",
|
||||
"commit": "0c1b9d1622ae0f27f82d7f7d7a1e9e69d410a3ca",
|
||||
"path": "encoding"
|
||||
},
|
||||
"fetch/data-urls/resources": {
|
||||
|
@ -48,6 +48,9 @@
|
||||
"streams/decode-ignore-bom.any.js": {
|
||||
"requires": ["small-icu"]
|
||||
},
|
||||
"streams/invalid-realm.window.js": {
|
||||
"skip": "document is not defined"
|
||||
},
|
||||
"streams/realms.window.js": {
|
||||
"skip": "window is not defined"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user