Backed out changeset 30075641dc6f (bug 1818576) for causing leaks. CLOSED TREE

This commit is contained in:
Iulian Moraru 2023-02-25 17:11:36 +02:00
parent dc983a3189
commit 154957c890
2 changed files with 3 additions and 37 deletions

View File

@ -809,13 +809,7 @@ MOZ_CAN_RUN_SCRIPT static void SetUpCrossRealmTransformReadable(
bool ReadableStream::Transfer(JSContext* aCx, UniqueMessagePortId& aPortId) {
// Step 1: If ! IsReadableStreamLocked(value) is true, throw a
// "DataCloneError" DOMException.
// (Implemented in StructuredCloneHolder::CustomCanTransferHandler, but double
// check here as the state might have changed in case this ReadableStream is
// created by a TransferStream and being transferred together with the
// parent.)
if (IsReadableStreamLocked(this)) {
return false;
}
// (Implemented in StructuredCloneHolder::CustomCanTransferHandler)
// Step 2: Let port1 be a new MessagePort in the current Realm.
// Step 3: Let port2 be a new MessagePort in the current Realm.
@ -901,13 +895,7 @@ bool ReadableStream::ReceiveTransfer(
bool WritableStream::Transfer(JSContext* aCx, UniqueMessagePortId& aPortId) {
// Step 1: If ! IsWritableStreamLocked(value) is true, throw a
// "DataCloneError" DOMException.
// (Implemented in StructuredCloneHolder::CustomCanTransferHandler, but double
// check here as the state might have changed in case this WritableStream is
// created by a TransferStream and being transferred together with the
// parent.)
if (IsWritableStreamLocked(this)) {
return false;
}
// (Implemented in StructuredCloneHolder::CustomCanTransferHandler)
// Step 2: Let port1 be a new MessagePort in the current Realm.
// Step 3: Let port2 be a new MessagePort in the current Realm.
@ -998,13 +986,7 @@ bool TransformStream::Transfer(JSContext* aCx, UniqueMessagePortId& aPortId1,
// "DataCloneError" DOMException.
// Step 4: If ! IsWritableStreamLocked(writable) is true, throw a
// "DataCloneError" DOMException.
// (Implemented in StructuredCloneHolder::CustomCanTransferHandler, but double
// check here as the state might have changed by
// Readable/WritableStream::Transfer in case the stream members of this
// TransformStream are being transferred together.)
if (IsReadableStreamLocked(mReadable) || IsWritableStreamLocked(mWritable)) {
return false;
}
// (Implemented in StructuredCloneHolder::CustomCanTransferHandler)
// Step 5: Set dataHolder.[[readable]] to !
// StructuredSerializeWithTransfer(readable, « readable »).

View File

@ -1,16 +0,0 @@
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`);
}