From 154957c8908bcea8eed28a20d4e37e5a053058fc Mon Sep 17 00:00:00 2001 From: Iulian Moraru Date: Sat, 25 Feb 2023 17:11:36 +0200 Subject: [PATCH] Backed out changeset 30075641dc6f (bug 1818576) for causing leaks. CLOSED TREE --- dom/streams/Transferable.cpp | 24 +++---------------- .../transform-stream-members.any.js | 16 ------------- 2 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 testing/web-platform/tests/streams/transferable/transform-stream-members.any.js diff --git a/dom/streams/Transferable.cpp b/dom/streams/Transferable.cpp index a37d4eac558d..20168a6bf944 100644 --- a/dom/streams/Transferable.cpp +++ b/dom/streams/Transferable.cpp @@ -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 »). diff --git a/testing/web-platform/tests/streams/transferable/transform-stream-members.any.js b/testing/web-platform/tests/streams/transferable/transform-stream-members.any.js deleted file mode 100644 index fca060b0c05f..000000000000 --- a/testing/web-platform/tests/streams/transferable/transform-stream-members.any.js +++ /dev/null @@ -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`); -}