diff --git a/dom/fs/api/FileSystemWritableFileStream.cpp b/dom/fs/api/FileSystemWritableFileStream.cpp index 69d1181c16da..eddd60cade66 100644 --- a/dom/fs/api/FileSystemWritableFileStream.cpp +++ b/dom/fs/api/FileSystemWritableFileStream.cpp @@ -382,10 +382,7 @@ already_AddRefed FileSystemWritableFileStream::Write( RefPtr promise = writer->Write(cx, val, aError); // Step 3. Release writer. - { - IgnoredErrorResult error; - writer->ReleaseLock(cx, error); - } + writer->ReleaseLock(cx); // Step 4. Return result. return promise.forget(); @@ -423,10 +420,7 @@ already_AddRefed FileSystemWritableFileStream::Seek( RefPtr promise = writer->Write(cx, val, aError); // Step 3. Release writer. - { - IgnoredErrorResult error; - writer->ReleaseLock(cx, error); - } + writer->ReleaseLock(cx); // Step 4. Return result. return promise.forget(); @@ -464,10 +458,7 @@ already_AddRefed FileSystemWritableFileStream::Truncate( RefPtr promise = writer->Write(cx, val, aError); // Step 3. Release writer. - { - IgnoredErrorResult error; - writer->ReleaseLock(cx, error); - } + writer->ReleaseLock(cx); // Step 4. Return result. return promise.forget(); diff --git a/dom/streams/ReadableStreamBYOBReader.cpp b/dom/streams/ReadableStreamBYOBReader.cpp index 6c615e03404d..27ca8ce9673b 100644 --- a/dom/streams/ReadableStreamBYOBReader.cpp +++ b/dom/streams/ReadableStreamBYOBReader.cpp @@ -60,10 +60,7 @@ void SetUpReadableStreamBYOBReader(ReadableStreamBYOBReader* reader, } // Step 3. Perform ! ReadableStreamReaderGenericInitialize(reader, stream). - ReadableStreamReaderGenericInitialize(reader, &stream, rv); - if (rv.Failed()) { - return; - } + ReadableStreamReaderGenericInitialize(reader, &stream); // Step 4. Set reader.[[readIntoRequests]] to a new empty list. reader->ReadIntoRequests().clear(); diff --git a/dom/streams/ReadableStreamDefaultReader.cpp b/dom/streams/ReadableStreamDefaultReader.cpp index 014aca9652b7..c574e4019005 100644 --- a/dom/streams/ReadableStreamDefaultReader.cpp +++ b/dom/streams/ReadableStreamDefaultReader.cpp @@ -59,8 +59,7 @@ JSObject* ReadableStreamDefaultReader::WrapObject( // https://streams.spec.whatwg.org/#readable-stream-reader-generic-initialize bool ReadableStreamReaderGenericInitialize(ReadableStreamGenericReader* aReader, - ReadableStream* aStream, - ErrorResult& aRv) { + ReadableStream* aStream) { // Step 1. aReader->SetStream(aStream); @@ -121,7 +120,7 @@ ReadableStreamDefaultReader::Constructor(const GlobalObject& aGlobal, // Step 2. RefPtr streamPtr = &aStream; - if (!ReadableStreamReaderGenericInitialize(reader, streamPtr, aRv)) { + if (!ReadableStreamReaderGenericInitialize(reader, streamPtr)) { return nullptr; } @@ -407,7 +406,7 @@ void SetUpReadableStreamDefaultReader(ReadableStreamDefaultReader* aReader, } // Step 2. - if (!ReadableStreamReaderGenericInitialize(aReader, aStream, aRv)) { + if (!ReadableStreamReaderGenericInitialize(aReader, aStream)) { return; } diff --git a/dom/streams/ReadableStreamGenericReader.h b/dom/streams/ReadableStreamGenericReader.h index 8b800fa4ac3b..f85cde59f76e 100644 --- a/dom/streams/ReadableStreamGenericReader.h +++ b/dom/streams/ReadableStreamGenericReader.h @@ -63,8 +63,7 @@ class ReadableStreamGenericReader : public nsISupports { }; bool ReadableStreamReaderGenericInitialize(ReadableStreamGenericReader* aReader, - ReadableStream* aStream, - ErrorResult& aRv); + ReadableStream* aStream); void ReadableStreamReaderGenericRelease(ReadableStreamGenericReader* aReader, ErrorResult& aRv); diff --git a/dom/streams/ReadableStreamPipeTo.cpp b/dom/streams/ReadableStreamPipeTo.cpp index 71ddf6d190fe..40e765f9f27f 100644 --- a/dom/streams/ReadableStreamPipeTo.cpp +++ b/dom/streams/ReadableStreamPipeTo.cpp @@ -538,9 +538,7 @@ void PipeToPump::Finalize(JSContext* aCx, JS::Handle> aError) { IgnoredErrorResult rv; // Step 1. Perform ! WritableStreamDefaultWriterRelease(writer). - WritableStreamDefaultWriterRelease(aCx, mWriter, rv); - NS_WARNING_ASSERTION(!rv.Failed(), - "WritableStreamDefaultWriterRelease should not fail."); + WritableStreamDefaultWriterRelease(aCx, mWriter); // Step 2. If reader implements ReadableStreamBYOBReader, // perform ! ReadableStreamBYOBReaderRelease(reader). diff --git a/dom/streams/Transferable.cpp b/dom/streams/Transferable.cpp index c3aaa93a4be1..41b9256c08fd 100644 --- a/dom/streams/Transferable.cpp +++ b/dom/streams/Transferable.cpp @@ -177,7 +177,7 @@ class SetUpTransformWritableMessageEventListener final // Note: This promise field is shared with the sink algorithms. Promise* BackpressurePromise() { return mBackpressurePromise; } - void CreateBackpressurePromise(ErrorResult& aRv) { + void CreateBackpressurePromise() { mBackpressurePromise = Promise::CreateInfallible(mController->GetParentObject()); } @@ -317,10 +317,7 @@ class CrossRealmWritableUnderlyingSinkAlgorithms final // promise resolved with undefined. // Note: This promise field is shared with the message event listener. if (!mListener->BackpressurePromise()) { - mListener->CreateBackpressurePromise(aRv); - if (aRv.Failed()) { - return nullptr; - } + mListener->CreateBackpressurePromise(); mListener->BackpressurePromise()->MaybeResolveWithUndefined(); } @@ -333,11 +330,7 @@ class CrossRealmWritableUnderlyingSinkAlgorithms final MessagePort* aPort, JS::Handle aChunk) -> already_AddRefed { // Step 2.1: Set backpressurePromise to a new promise. - aListener->CreateBackpressurePromise(aRv); - if (aRv.Failed()) { - aPort->Close(); - return nullptr; - } + aListener->CreateBackpressurePromise(); // Step 2.2: Let result be PackAndPostMessageHandlingError(port, // "chunk", chunk). diff --git a/dom/streams/TransformStream.cpp b/dom/streams/TransformStream.cpp index 6ec994529d2c..b68e2fa89ccd 100644 --- a/dom/streams/TransformStream.cpp +++ b/dom/streams/TransformStream.cpp @@ -137,7 +137,7 @@ void TransformStreamErrorWritableAndUnblockWrite(JSContext* aCx, // Step 3: If stream.[[backpressure]] is true, perform ! // TransformStreamSetBackpressure(stream, false). if (aStream->Backpressure()) { - aStream->SetBackpressure(false, aRv); + aStream->SetBackpressure(false); } } @@ -460,7 +460,7 @@ class TransformStreamUnderlyingSourceAlgorithms final MOZ_ASSERT(mStream->BackpressureChangePromise()); // Step 3: Perform ! TransformStreamSetBackpressure(stream, false). - mStream->SetBackpressure(false, aRv); + mStream->SetBackpressure(false); // Step 4: Return stream.[[backpressureChangePromise]]. return do_AddRef(mStream->BackpressureChangePromise()); @@ -506,7 +506,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION( NS_INTERFACE_MAP_END_INHERITING(UnderlyingSourceAlgorithmsBase) // https://streams.spec.whatwg.org/#transform-stream-set-backpressure -void TransformStream::SetBackpressure(bool aBackpressure, ErrorResult& aRv) { +void TransformStream::SetBackpressure(bool aBackpressure) { // Step 1. Assert: stream.[[backpressure]] is not backpressure. MOZ_ASSERT(Backpressure() != aBackpressure); @@ -569,7 +569,7 @@ void TransformStream::Initialize(JSContext* aCx, Promise* aStartPromise, mBackpressureChangePromise = nullptr; // Step 10. Perform ! TransformStreamSetBackpressure(stream, true). - SetBackpressure(true, aRv); + SetBackpressure(true); if (aRv.Failed()) { return; } diff --git a/dom/streams/TransformStream.h b/dom/streams/TransformStream.h index 178a04388ab8..453c9de5527e 100644 --- a/dom/streams/TransformStream.h +++ b/dom/streams/TransformStream.h @@ -40,7 +40,7 @@ class TransformStream final : public nsISupports, public nsWrapperCache { // Internal slot accessors bool Backpressure() const { return mBackpressure; } Promise* BackpressureChangePromise() { return mBackpressureChangePromise; } - void SetBackpressure(bool aBackpressure, ErrorResult& aRv); + void SetBackpressure(bool aBackpressure); MOZ_KNOWN_LIVE TransformStreamDefaultController* Controller() { return mController; } diff --git a/dom/streams/TransformStreamDefaultController.cpp b/dom/streams/TransformStreamDefaultController.cpp index a75a69bd5885..80a8f702a247 100644 --- a/dom/streams/TransformStreamDefaultController.cpp +++ b/dom/streams/TransformStreamDefaultController.cpp @@ -140,7 +140,7 @@ void TransformStreamDefaultController::Enqueue(JSContext* aCx, MOZ_ASSERT(backpressure); // Step 7.2: Perform ! TransformStreamSetBackpressure(true). - stream->SetBackpressure(true, aRv); + stream->SetBackpressure(true); } } diff --git a/dom/streams/WritableStream.cpp b/dom/streams/WritableStream.cpp index 9cd427797374..dec167ef03c4 100644 --- a/dom/streams/WritableStream.cpp +++ b/dom/streams/WritableStream.cpp @@ -392,10 +392,7 @@ void WritableStream::StartErroring(JSContext* aCx, // Step 8. If writer is not undefined, perform ! // WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason). if (writer) { - WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, aReason, aRv); - if (aRv.Failed()) { - return; - } + WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, aReason); } // Step 9. If ! WritableStreamHasOperationMarkedInFlight(stream) is false @@ -407,7 +404,7 @@ void WritableStream::StartErroring(JSContext* aCx, } // https://streams.spec.whatwg.org/#writable-stream-update-backpressure -void WritableStream::UpdateBackpressure(bool aBackpressure, ErrorResult& aRv) { +void WritableStream::UpdateBackpressure(bool aBackpressure) { // Step 1. Assert: stream.[[state]] is "writable". MOZ_ASSERT(mState == WriterState::Writable); // Step 2. Assert: ! WritableStreamCloseQueuedOrInFlight(stream) is false. @@ -723,8 +720,8 @@ already_AddRefed WritableStream::GetWriter( } // https://streams.spec.whatwg.org/#writable-stream-add-write-request -already_AddRefed WritableStreamAddWriteRequest(WritableStream* aStream, - ErrorResult& aRv) { +already_AddRefed WritableStreamAddWriteRequest( + WritableStream* aStream) { // Step 1. Assert: ! IsWritableStreamLocked(stream) is true. MOZ_ASSERT(IsWritableStreamLocked(aStream)); diff --git a/dom/streams/WritableStream.h b/dom/streams/WritableStream.h index 6797cc04c9f6..4308eb854501 100644 --- a/dom/streams/WritableStream.h +++ b/dom/streams/WritableStream.h @@ -142,7 +142,7 @@ class WritableStream : public nsISupports, public nsWrapperCache { ErrorResult& aRv); // WritableStreamUpdateBackpressure - void UpdateBackpressure(bool aBackpressure, ErrorResult& aRv); + void UpdateBackpressure(bool aBackpressure); // [Transferable] // https://html.spec.whatwg.org/multipage/structured-data.html#transfer-steps @@ -215,8 +215,8 @@ MOZ_CAN_RUN_SCRIPT already_AddRefed WritableStreamAbort( MOZ_CAN_RUN_SCRIPT already_AddRefed WritableStreamClose( JSContext* aCx, WritableStream* aStream, ErrorResult& aRv); -already_AddRefed WritableStreamAddWriteRequest(WritableStream* aStream, - ErrorResult& aRv); +already_AddRefed WritableStreamAddWriteRequest( + WritableStream* aStream); already_AddRefed AcquireWritableStreamDefaultWriter(WritableStream* aStream, ErrorResult& aRv); diff --git a/dom/streams/WritableStreamDefaultController.cpp b/dom/streams/WritableStreamDefaultController.cpp index 2f0964bc8f24..45cbf553c4be 100644 --- a/dom/streams/WritableStreamDefaultController.cpp +++ b/dom/streams/WritableStreamDefaultController.cpp @@ -168,10 +168,7 @@ void SetUpWritableStreamDefaultController( bool backpressure = aController->GetBackpressure(); // Step 14. Perform ! WritableStreamUpdateBackpressure(stream, backpressure). - aStream->UpdateBackpressure(backpressure, aRv); - if (aRv.Failed()) { - return; - } + aStream->UpdateBackpressure(backpressure); // Step 15. Let startResult be the result of performing startAlgorithm. (This // may throw an exception.) @@ -342,10 +339,7 @@ MOZ_CAN_RUN_SCRIPT static void WritableStreamDefaultControllerProcessWrite( bool backpressure = aController->GetBackpressure(); // Step 4.5.2. Perform ! WritableStreamUpdateBackpressure(stream, // backpressure). - stream->UpdateBackpressure(backpressure, aRv); - if (aRv.Failed()) { - return; - } + stream->UpdateBackpressure(backpressure); } // Step 4.6. Perform ! @@ -483,10 +477,7 @@ void WritableStreamDefaultControllerWrite( // Step 4.2. Perform ! WritableStreamUpdateBackpressure(stream, // backpressure). - stream->UpdateBackpressure(backpressure, aRv); - if (aRv.Failed()) { - return; - } + stream->UpdateBackpressure(backpressure); } // Step 5. Perform diff --git a/dom/streams/WritableStreamDefaultWriter.cpp b/dom/streams/WritableStreamDefaultWriter.cpp index b3728420e890..01bdabafe53f 100644 --- a/dom/streams/WritableStreamDefaultWriter.cpp +++ b/dom/streams/WritableStreamDefaultWriter.cpp @@ -206,8 +206,7 @@ already_AddRefed WritableStreamDefaultWriter::Close(JSContext* aCx, // https://streams.spec.whatwg.org/#writable-stream-default-writer-release void WritableStreamDefaultWriterRelease(JSContext* aCx, - WritableStreamDefaultWriter* aWriter, - ErrorResult& aRv) { + WritableStreamDefaultWriter* aWriter) { // Step 1. Let stream be writer.[[stream]]. RefPtr stream = aWriter->GetStream(); @@ -229,20 +228,13 @@ void WritableStreamDefaultWriterRelease(JSContext* aCx, // Step 5. Perform ! // WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, // releasedError). - WritableStreamDefaultWriterEnsureReadyPromiseRejected(aWriter, releasedError, - aRv); - if (aRv.Failed()) { - return; - } + WritableStreamDefaultWriterEnsureReadyPromiseRejected(aWriter, releasedError); // Step 6. Perform ! // WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, // releasedError). - WritableStreamDefaultWriterEnsureClosedPromiseRejected(aWriter, releasedError, - aRv); - if (aRv.Failed()) { - return; - } + WritableStreamDefaultWriterEnsureClosedPromiseRejected(aWriter, + releasedError); // Step 7. Set stream.[[writer]] to undefined. stream->SetWriter(nullptr); @@ -252,8 +244,7 @@ void WritableStreamDefaultWriterRelease(JSContext* aCx, } // https://streams.spec.whatwg.org/#default-writer-release-lock -void WritableStreamDefaultWriter::ReleaseLock(JSContext* aCx, - ErrorResult& aRv) { +void WritableStreamDefaultWriter::ReleaseLock(JSContext* aCx) { // Step 1. Let stream be this.[[stream]]. RefPtr stream = mStream; @@ -267,7 +258,7 @@ void WritableStreamDefaultWriter::ReleaseLock(JSContext* aCx, // Step 4. Perform ! WritableStreamDefaultWriterRelease(this). RefPtr thisRefPtr = this; - return WritableStreamDefaultWriterRelease(aCx, thisRefPtr, aRv); + return WritableStreamDefaultWriterRelease(aCx, thisRefPtr); } // https://streams.spec.whatwg.org/#writable-stream-default-writer-write @@ -329,10 +320,7 @@ already_AddRefed WritableStreamDefaultWriterWrite( MOZ_ASSERT(state == WritableStream::WriterState::Writable); // Step 11. Let promise be ! WritableStreamAddWriteRequest(stream). - RefPtr promise = WritableStreamAddWriteRequest(stream, aRv); - if (aRv.Failed()) { - return nullptr; - } + RefPtr promise = WritableStreamAddWriteRequest(stream); // Step 12. Perform ! WritableStreamDefaultControllerWrite(controller, chunk, // chunkSize). @@ -469,8 +457,7 @@ void SetUpWritableStreamDefaultWriter(WritableStreamDefaultWriter* aWriter, // https://streams.spec.whatwg.org/#writable-stream-default-writer-ensure-closed-promise-rejected void WritableStreamDefaultWriterEnsureClosedPromiseRejected( - WritableStreamDefaultWriter* aWriter, JS::Handle aError, - ErrorResult& aRv) { + WritableStreamDefaultWriter* aWriter, JS::Handle aError) { RefPtr closedPromise = aWriter->ClosedPromise(); // Step 1. If writer.[[closedPromise]].[[PromiseState]] is "pending", reject // writer.[[closedPromise]] with error. @@ -490,8 +477,7 @@ void WritableStreamDefaultWriterEnsureClosedPromiseRejected( // https://streams.spec.whatwg.org/#writable-stream-default-writer-ensure-ready-promise-rejected void WritableStreamDefaultWriterEnsureReadyPromiseRejected( - WritableStreamDefaultWriter* aWriter, JS::Handle aError, - ErrorResult& aRv) { + WritableStreamDefaultWriter* aWriter, JS::Handle aError) { RefPtr readyPromise = aWriter->ReadyPromise(); // Step 1. If writer.[[readyPromise]].[[PromiseState]] is "pending", reject // writer.[[readyPromise]] with error. diff --git a/dom/streams/WritableStreamDefaultWriter.h b/dom/streams/WritableStreamDefaultWriter.h index 0dc60ed6e72c..e9307c6c4586 100644 --- a/dom/streams/WritableStreamDefaultWriter.h +++ b/dom/streams/WritableStreamDefaultWriter.h @@ -66,7 +66,7 @@ class WritableStreamDefaultWriter final : public nsISupports, MOZ_CAN_RUN_SCRIPT already_AddRefed Close(JSContext* aCx, ErrorResult& aRv); - void ReleaseLock(JSContext* aCx, ErrorResult& aRv); + void ReleaseLock(JSContext* aCx); MOZ_CAN_RUN_SCRIPT already_AddRefed Write( JSContext* aCx, JS::Handle aChunk, ErrorResult& aRv); @@ -84,19 +84,16 @@ void SetUpWritableStreamDefaultWriter(WritableStreamDefaultWriter* aWriter, ErrorResult& aRv); void WritableStreamDefaultWriterEnsureClosedPromiseRejected( - WritableStreamDefaultWriter* aWriter, JS::Handle aError, - ErrorResult& aRv); + WritableStreamDefaultWriter* aWriter, JS::Handle aError); void WritableStreamDefaultWriterEnsureReadyPromiseRejected( - WritableStreamDefaultWriter* aWriter, JS::Handle aError, - ErrorResult& aRv); + WritableStreamDefaultWriter* aWriter, JS::Handle aError); Nullable WritableStreamDefaultWriterGetDesiredSize( WritableStreamDefaultWriter* aWriter); void WritableStreamDefaultWriterRelease(JSContext* aCx, - WritableStreamDefaultWriter* aWriter, - ErrorResult& aRv); + WritableStreamDefaultWriter* aWriter); MOZ_CAN_RUN_SCRIPT already_AddRefed WritableStreamDefaultWriterWrite( JSContext* aCx, WritableStreamDefaultWriter* aWriter, diff --git a/dom/webidl/WritableStreamDefaultWriter.webidl b/dom/webidl/WritableStreamDefaultWriter.webidl index 301d8c861f95..e033079f0441 100644 --- a/dom/webidl/WritableStreamDefaultWriter.webidl +++ b/dom/webidl/WritableStreamDefaultWriter.webidl @@ -22,7 +22,6 @@ interface WritableStreamDefaultWriter { [NewObject] Promise close(); - [Throws] undefined releaseLock(); [NewObject]