-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR-URL: #46802 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
- Loading branch information
1 parent
928998d
commit df14944
Showing
4 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/fixtures/wpt/encoding/streams/invalid-realm.window.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters