fune/testing/web-platform/tests/streams/transferable/transform-stream-members.any.js
Kagami Sascha Rosylight 17f87db988 Bug 1818576 - Double check whether the streams are locked before transfer r=evilpie
Status checks are done in batch before any transfer, but transferring streams can change the status of parent/child of TransformStream and cause an assertion failure.

Differential Revision: https://phabricator.services.mozilla.com/D170897
2023-02-25 07:04:33 +00:00

16 lines
491 B
JavaScript

const combinations = [
(t => [t, t.readable])(new TransformStream()),
(t => [t.readable, t])(new TransformStream()),
(t => [t, t.writable])(new TransformStream()),
(t => [t.writable, t])(new TransformStream()),
];
for (const combination of combinations) {
test(() => {
assert_throws_dom(
"DataCloneError",
() => structuredClone(combination, { transfer: combination }),
"structuredClone should throw"
);
}, `Transferring ${combination} should fail`);
}