mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-04 19:33:18 +00:00
Bug 1811538 - Part 2: Use Promise::CreateInfallible in dom/streams r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D167697
This commit is contained in:
parent
a98aec7bdc
commit
ea0cb48ccd
@ -1895,10 +1895,8 @@ void SetUpReadableByteStreamController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Let startPromise be a promise resolved with startResult.
|
// Let startPromise be a promise resolved with startResult.
|
||||||
RefPtr<Promise> startPromise = Promise::Create(GetIncumbentGlobal(), aRv);
|
RefPtr<Promise> startPromise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(GetIncumbentGlobal());
|
||||||
return;
|
|
||||||
}
|
|
||||||
startPromise->MaybeResolve(startResult);
|
startPromise->MaybeResolve(startResult);
|
||||||
|
|
||||||
// Step 16+17
|
// Step 16+17
|
||||||
|
@ -331,11 +331,8 @@ already_AddRefed<Promise> ReadableStreamCancel(JSContext* aCx,
|
|||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
if (aStream->State() == ReadableStream::ReaderState::Closed) {
|
if (aStream->State() == ReadableStream::ReaderState::Closed) {
|
||||||
RefPtr<Promise> promise = Promise::Create(aStream->GetParentObject(), aRv);
|
RefPtr<Promise> promise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(aStream->GetParentObject());
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
promise->MaybeResolveWithUndefined();
|
promise->MaybeResolveWithUndefined();
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
}
|
}
|
||||||
@ -387,10 +384,7 @@ already_AddRefed<Promise> ReadableStreamCancel(JSContext* aCx,
|
|||||||
|
|
||||||
// Step 8.
|
// Step 8.
|
||||||
RefPtr<Promise> promise =
|
RefPtr<Promise> promise =
|
||||||
Promise::Create(sourceCancelPromise->GetParentObject(), aRv);
|
Promise::CreateInfallible(sourceCancelPromise->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ThenWithCycleCollectedArgs will carry promise, keeping it alive until the
|
// ThenWithCycleCollectedArgs will carry promise, keeping it alive until the
|
||||||
// callback executes.
|
// callback executes.
|
||||||
@ -894,10 +888,7 @@ already_AddRefed<Promise> ReadableStream::GetNextIterationResult(
|
|||||||
MOZ_ASSERT(reader->GetStream());
|
MOZ_ASSERT(reader->GetStream());
|
||||||
|
|
||||||
// Step 3. Let promise be a new promise.
|
// Step 3. Let promise be a new promise.
|
||||||
RefPtr<Promise> promise = Promise::Create(GetParentObject(), aRv);
|
RefPtr<Promise> promise = Promise::CreateInfallible(GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 4. Let readRequest be a new read request with the following items:
|
// Step 4. Let readRequest be a new read request with the following items:
|
||||||
RefPtr<ReadRequest> request = new IteratorReadRequest(promise, reader);
|
RefPtr<ReadRequest> request = new IteratorReadRequest(promise, reader);
|
||||||
|
@ -255,10 +255,7 @@ already_AddRefed<Promise> ReadableStreamBYOBReader::Read(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 5.
|
// Step 5.
|
||||||
RefPtr<Promise> promise = Promise::Create(GetParentObject(), aRv);
|
RefPtr<Promise> promise = Promise::CreateInfallible(GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 6. Let readIntoRequest be a new read-into request with the following
|
// Step 6. Let readIntoRequest be a new read-into request with the following
|
||||||
// items:
|
// items:
|
||||||
|
@ -507,10 +507,7 @@ void SetUpReadableStreamDefaultController(
|
|||||||
|
|
||||||
// Step 10.
|
// Step 10.
|
||||||
RefPtr<Promise> startPromise =
|
RefPtr<Promise> startPromise =
|
||||||
Promise::Create(aStream->GetParentObject(), aRv);
|
Promise::CreateInfallible(aStream->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startPromise->MaybeResolve(startResult);
|
startPromise->MaybeResolve(startResult);
|
||||||
|
|
||||||
// Step 11 & 12:
|
// Step 11 & 12:
|
||||||
|
@ -67,10 +67,8 @@ bool ReadableStreamReaderGenericInitialize(ReadableStreamGenericReader* aReader,
|
|||||||
// Step 2.
|
// Step 2.
|
||||||
aStream->SetReader(aReader);
|
aStream->SetReader(aReader);
|
||||||
|
|
||||||
aReader->SetClosedPromise(Promise::Create(aReader->GetParentObject(), aRv));
|
aReader->SetClosedPromise(
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(aReader->GetParentObject()));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (aStream->State()) {
|
switch (aStream->State()) {
|
||||||
// Step 3.
|
// Step 3.
|
||||||
@ -247,7 +245,7 @@ already_AddRefed<Promise> ReadableStreamDefaultReader::Read(ErrorResult& aRv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
RefPtr<Promise> promise = Promise::Create(GetParentObject(), aRv);
|
RefPtr<Promise> promise = Promise::CreateInfallible(GetParentObject());
|
||||||
|
|
||||||
// Step 3.
|
// Step 3.
|
||||||
RefPtr<ReadRequest> request = new Read_ReadRequest(promise);
|
RefPtr<ReadRequest> request = new Read_ReadRequest(promise);
|
||||||
|
@ -941,10 +941,8 @@ already_AddRefed<Promise> ReadableStreamPipeTo(
|
|||||||
// Note: PipeToPump ensures this by construction.
|
// Note: PipeToPump ensures this by construction.
|
||||||
|
|
||||||
// Step 13. Let promise be a new promise.
|
// Step 13. Let promise be a new promise.
|
||||||
RefPtr<Promise> promise = Promise::Create(aSource->GetParentObject(), aRv);
|
RefPtr<Promise> promise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(aSource->GetParentObject());
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Steps 14-15.
|
// Steps 14-15.
|
||||||
RefPtr<PipeToPump> pump = new PipeToPump(
|
RefPtr<PipeToPump> pump = new PipeToPump(
|
||||||
|
@ -47,10 +47,7 @@ already_AddRefed<TeeState> TeeState::Create(ReadableStream* aStream,
|
|||||||
teeState->SetReader(reader);
|
teeState->SetReader(reader);
|
||||||
|
|
||||||
RefPtr<Promise> promise =
|
RefPtr<Promise> promise =
|
||||||
Promise::Create(teeState->GetStream()->GetParentObject(), aRv);
|
Promise::CreateInfallible(teeState->GetStream()->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
teeState->SetCancelPromise(promise);
|
teeState->SetCancelPromise(promise);
|
||||||
|
|
||||||
return teeState.forget();
|
return teeState.forget();
|
||||||
|
@ -178,7 +178,8 @@ class SetUpTransformWritableMessageEventListener final
|
|||||||
Promise* BackpressurePromise() { return mBackpressurePromise; }
|
Promise* BackpressurePromise() { return mBackpressurePromise; }
|
||||||
|
|
||||||
void CreateBackpressurePromise(ErrorResult& aRv) {
|
void CreateBackpressurePromise(ErrorResult& aRv) {
|
||||||
mBackpressurePromise = Promise::Create(mController->GetParentObject(), aRv);
|
mBackpressurePromise =
|
||||||
|
Promise::CreateInfallible(mController->GetParentObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -449,10 +450,7 @@ MOZ_CAN_RUN_SCRIPT static void SetUpCrossRealmTransformWritable(
|
|||||||
|
|
||||||
// Step 3: Let backpressurePromise be a new promise.
|
// Step 3: Let backpressurePromise be a new promise.
|
||||||
RefPtr<Promise> backpressurePromise =
|
RefPtr<Promise> backpressurePromise =
|
||||||
Promise::Create(aWritable->GetParentObject(), aRv);
|
Promise::CreateInfallible(aWritable->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 4: Add a handler for port’s message event with the following steps:
|
// Step 4: Add a handler for port’s message event with the following steps:
|
||||||
auto listener = MakeRefPtr<SetUpTransformWritableMessageEventListener>(
|
auto listener = MakeRefPtr<SetUpTransformWritableMessageEventListener>(
|
||||||
|
@ -517,10 +517,7 @@ void TransformStream::SetBackpressure(bool aBackpressure, ErrorResult& aRv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 3. Set stream.[[backpressureChangePromise]] to a new promise.
|
// Step 3. Set stream.[[backpressureChangePromise]] to a new promise.
|
||||||
RefPtr<Promise> promise = Promise::Create(GetParentObject(), aRv);
|
RefPtr<Promise> promise = Promise::CreateInfallible(GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mBackpressureChangePromise = promise;
|
mBackpressureChangePromise = promise;
|
||||||
|
|
||||||
// Step 4. Set stream.[[backpressure]] to backpressure.
|
// Step 4. Set stream.[[backpressure]] to backpressure.
|
||||||
@ -657,10 +654,7 @@ already_AddRefed<TransformStream> TransformStream::Constructor(
|
|||||||
|
|
||||||
// Step 9. Let startPromise be a new promise.
|
// Step 9. Let startPromise be a new promise.
|
||||||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
|
||||||
RefPtr<Promise> startPromise = Promise::Create(global, aRv);
|
RefPtr<Promise> startPromise = Promise::CreateInfallible(global);
|
||||||
if (aRv.Failed()) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 10. Perform ! InitializeTransformStream(this, startPromise,
|
// Step 10. Perform ! InitializeTransformStream(this, startPromise,
|
||||||
// writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,
|
// writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark,
|
||||||
|
@ -422,10 +422,8 @@ void WritableStream::UpdateBackpressure(bool aBackpressure, ErrorResult& aRv) {
|
|||||||
// Step 4.1. If backpressure is true, set writer.[[readyPromise]] to a new
|
// Step 4.1. If backpressure is true, set writer.[[readyPromise]] to a new
|
||||||
// promise.
|
// promise.
|
||||||
if (aBackpressure) {
|
if (aBackpressure) {
|
||||||
RefPtr<Promise> promise = Promise::Create(writer->GetParentObject(), aRv);
|
RefPtr<Promise> promise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(writer->GetParentObject());
|
||||||
return;
|
|
||||||
}
|
|
||||||
writer->SetReadyPromise(promise);
|
writer->SetReadyPromise(promise);
|
||||||
} else {
|
} else {
|
||||||
// Step 4.2. Otherwise,
|
// Step 4.2. Otherwise,
|
||||||
@ -513,10 +511,8 @@ already_AddRefed<Promise> WritableStreamAbort(JSContext* aCx,
|
|||||||
// resolved with undefined.
|
// resolved with undefined.
|
||||||
if (aStream->State() == WritableStream::WriterState::Closed ||
|
if (aStream->State() == WritableStream::WriterState::Closed ||
|
||||||
aStream->State() == WritableStream::WriterState::Errored) {
|
aStream->State() == WritableStream::WriterState::Errored) {
|
||||||
RefPtr<Promise> promise = Promise::Create(aStream->GetParentObject(), aRv);
|
RefPtr<Promise> promise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(aStream->GetParentObject());
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
promise->MaybeResolveWithUndefined();
|
promise->MaybeResolveWithUndefined();
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
}
|
}
|
||||||
@ -533,10 +529,8 @@ already_AddRefed<Promise> WritableStreamAbort(JSContext* aCx,
|
|||||||
// code and that might have changed the state.
|
// code and that might have changed the state.
|
||||||
if (aStream->State() == WritableStream::WriterState::Closed ||
|
if (aStream->State() == WritableStream::WriterState::Closed ||
|
||||||
aStream->State() == WritableStream::WriterState::Errored) {
|
aStream->State() == WritableStream::WriterState::Errored) {
|
||||||
RefPtr<Promise> promise = Promise::Create(aStream->GetParentObject(), aRv);
|
RefPtr<Promise> promise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(aStream->GetParentObject());
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
promise->MaybeResolveWithUndefined();
|
promise->MaybeResolveWithUndefined();
|
||||||
return promise.forget();
|
return promise.forget();
|
||||||
}
|
}
|
||||||
@ -565,10 +559,8 @@ already_AddRefed<Promise> WritableStreamAbort(JSContext* aCx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 9. Let promise be a new promise.
|
// Step 9. Let promise be a new promise.
|
||||||
RefPtr<Promise> promise = Promise::Create(aStream->GetParentObject(), aRv);
|
RefPtr<Promise> promise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(aStream->GetParentObject());
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 10. Set stream.[[pendingAbortRequest]] to a new pending abort request
|
// Step 10. Set stream.[[pendingAbortRequest]] to a new pending abort request
|
||||||
// whose promise is promise, reason is reason, and was already erroring is
|
// whose promise is promise, reason is reason, and was already erroring is
|
||||||
@ -628,10 +620,8 @@ already_AddRefed<Promise> WritableStreamClose(JSContext* aCx,
|
|||||||
MOZ_ASSERT(!aStream->CloseQueuedOrInFlight());
|
MOZ_ASSERT(!aStream->CloseQueuedOrInFlight());
|
||||||
|
|
||||||
// Step 5. Let promise be a new promise.
|
// Step 5. Let promise be a new promise.
|
||||||
RefPtr<Promise> promise = Promise::Create(aStream->GetParentObject(), aRv);
|
RefPtr<Promise> promise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(aStream->GetParentObject());
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 6. Set stream.[[closeRequest]] to promise.
|
// Step 6. Set stream.[[closeRequest]] to promise.
|
||||||
aStream->SetCloseRequest(promise);
|
aStream->SetCloseRequest(promise);
|
||||||
@ -742,10 +732,8 @@ already_AddRefed<Promise> WritableStreamAddWriteRequest(WritableStream* aStream,
|
|||||||
MOZ_ASSERT(aStream->State() == WritableStream::WriterState::Writable);
|
MOZ_ASSERT(aStream->State() == WritableStream::WriterState::Writable);
|
||||||
|
|
||||||
// Step 3. Let promise be a new promise.
|
// Step 3. Let promise be a new promise.
|
||||||
RefPtr<Promise> promise = Promise::Create(aStream->GetParentObject(), aRv);
|
RefPtr<Promise> promise =
|
||||||
if (aRv.Failed()) {
|
Promise::CreateInfallible(aStream->GetParentObject());
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 4. Append promise to stream.[[writeRequests]].
|
// Step 4. Append promise to stream.[[writeRequests]].
|
||||||
aStream->AppendWriteRequest(promise);
|
aStream->AppendWriteRequest(promise);
|
||||||
|
@ -184,10 +184,7 @@ void SetUpWritableStreamDefaultController(
|
|||||||
|
|
||||||
// Step 16. Let startPromise be a promise resolved with startResult.
|
// Step 16. Let startPromise be a promise resolved with startResult.
|
||||||
RefPtr<Promise> startPromise =
|
RefPtr<Promise> startPromise =
|
||||||
Promise::Create(aStream->GetParentObject(), aRv);
|
Promise::CreateInfallible(aStream->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startPromise->MaybeResolve(startResult);
|
startPromise->MaybeResolve(startResult);
|
||||||
|
|
||||||
// Step 17/18.
|
// Step 17/18.
|
||||||
|
@ -382,10 +382,7 @@ void SetUpWritableStreamDefaultWriter(WritableStreamDefaultWriter* aWriter,
|
|||||||
// Step 5. If state is "writable",
|
// Step 5. If state is "writable",
|
||||||
if (state == WritableStream::WriterState::Writable) {
|
if (state == WritableStream::WriterState::Writable) {
|
||||||
RefPtr<Promise> readyPromise =
|
RefPtr<Promise> readyPromise =
|
||||||
Promise::Create(aWriter->GetParentObject(), aRv);
|
Promise::CreateInfallible(aWriter->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 5.1 If ! WritableStreamCloseQueuedOrInFlight(stream) is false and
|
// Step 5.1 If ! WritableStreamCloseQueuedOrInFlight(stream) is false and
|
||||||
// stream.[[backpressure]] is true, set writer.[[readyPromise]] to a new
|
// stream.[[backpressure]] is true, set writer.[[readyPromise]] to a new
|
||||||
@ -401,10 +398,7 @@ void SetUpWritableStreamDefaultWriter(WritableStreamDefaultWriter* aWriter,
|
|||||||
|
|
||||||
// Step 5.3. Set writer.[[closedPromise]] to a new promise.
|
// Step 5.3. Set writer.[[closedPromise]] to a new promise.
|
||||||
RefPtr<Promise> closedPromise =
|
RefPtr<Promise> closedPromise =
|
||||||
Promise::Create(aWriter->GetParentObject(), aRv);
|
Promise::CreateInfallible(aWriter->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
aWriter->SetClosedPromise(closedPromise);
|
aWriter->SetClosedPromise(closedPromise);
|
||||||
} else if (state == WritableStream::WriterState::Erroring) {
|
} else if (state == WritableStream::WriterState::Erroring) {
|
||||||
// Step 6. Otherwise, if state is "erroring",
|
// Step 6. Otherwise, if state is "erroring",
|
||||||
@ -413,10 +407,7 @@ void SetUpWritableStreamDefaultWriter(WritableStreamDefaultWriter* aWriter,
|
|||||||
// stream.[[storedError]].
|
// stream.[[storedError]].
|
||||||
JS::Rooted<JS::Value> storedError(RootingCx(), aStream->StoredError());
|
JS::Rooted<JS::Value> storedError(RootingCx(), aStream->StoredError());
|
||||||
RefPtr<Promise> readyPromise =
|
RefPtr<Promise> readyPromise =
|
||||||
Promise::Create(aWriter->GetParentObject(), aRv);
|
Promise::CreateInfallible(aWriter->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
readyPromise->MaybeReject(storedError);
|
readyPromise->MaybeReject(storedError);
|
||||||
aWriter->SetReadyPromise(readyPromise);
|
aWriter->SetReadyPromise(readyPromise);
|
||||||
|
|
||||||
@ -425,10 +416,7 @@ void SetUpWritableStreamDefaultWriter(WritableStreamDefaultWriter* aWriter,
|
|||||||
|
|
||||||
// Step 6.3. Set writer.[[closedPromise]] to a new promise.
|
// Step 6.3. Set writer.[[closedPromise]] to a new promise.
|
||||||
RefPtr<Promise> closedPromise =
|
RefPtr<Promise> closedPromise =
|
||||||
Promise::Create(aWriter->GetParentObject(), aRv);
|
Promise::CreateInfallible(aWriter->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
aWriter->SetClosedPromise(closedPromise);
|
aWriter->SetClosedPromise(closedPromise);
|
||||||
} else if (state == WritableStream::WriterState::Closed) {
|
} else if (state == WritableStream::WriterState::Closed) {
|
||||||
// Step 7. Otherwise, if state is "closed",
|
// Step 7. Otherwise, if state is "closed",
|
||||||
@ -460,10 +448,7 @@ void SetUpWritableStreamDefaultWriter(WritableStreamDefaultWriter* aWriter,
|
|||||||
// Step 8.3. Set writer.[[readyPromise]] to a promise rejected with
|
// Step 8.3. Set writer.[[readyPromise]] to a promise rejected with
|
||||||
// storedError.
|
// storedError.
|
||||||
RefPtr<Promise> readyPromise =
|
RefPtr<Promise> readyPromise =
|
||||||
Promise::Create(aWriter->GetParentObject(), aRv);
|
Promise::CreateInfallible(aWriter->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
readyPromise->MaybeReject(storedError);
|
readyPromise->MaybeReject(storedError);
|
||||||
aWriter->SetReadyPromise(readyPromise);
|
aWriter->SetReadyPromise(readyPromise);
|
||||||
|
|
||||||
@ -473,10 +458,7 @@ void SetUpWritableStreamDefaultWriter(WritableStreamDefaultWriter* aWriter,
|
|||||||
// Step 8.5. Set writer.[[closedPromise]] to a promise rejected with
|
// Step 8.5. Set writer.[[closedPromise]] to a promise rejected with
|
||||||
// storedError.
|
// storedError.
|
||||||
RefPtr<Promise> closedPromise =
|
RefPtr<Promise> closedPromise =
|
||||||
Promise::Create(aWriter->GetParentObject(), aRv);
|
Promise::CreateInfallible(aWriter->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
closedPromise->MaybeReject(storedError);
|
closedPromise->MaybeReject(storedError);
|
||||||
aWriter->SetClosedPromise(closedPromise);
|
aWriter->SetClosedPromise(closedPromise);
|
||||||
|
|
||||||
@ -497,10 +479,7 @@ void WritableStreamDefaultWriterEnsureClosedPromiseRejected(
|
|||||||
} else {
|
} else {
|
||||||
// Step 2. Otherwise, set writer.[[closedPromise]] to a promise rejected
|
// Step 2. Otherwise, set writer.[[closedPromise]] to a promise rejected
|
||||||
// with error.
|
// with error.
|
||||||
closedPromise = Promise::Create(aWriter->GetParentObject(), aRv);
|
closedPromise = Promise::CreateInfallible(aWriter->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
closedPromise->MaybeReject(aError);
|
closedPromise->MaybeReject(aError);
|
||||||
aWriter->SetClosedPromise(closedPromise);
|
aWriter->SetClosedPromise(closedPromise);
|
||||||
}
|
}
|
||||||
@ -521,10 +500,7 @@ void WritableStreamDefaultWriterEnsureReadyPromiseRejected(
|
|||||||
} else {
|
} else {
|
||||||
// Step 2. Otherwise, set writer.[[readyPromise]] to a promise rejected with
|
// Step 2. Otherwise, set writer.[[readyPromise]] to a promise rejected with
|
||||||
// error.
|
// error.
|
||||||
readyPromise = Promise::Create(aWriter->GetParentObject(), aRv);
|
readyPromise = Promise::CreateInfallible(aWriter->GetParentObject());
|
||||||
if (aRv.Failed()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
readyPromise->MaybeReject(aError);
|
readyPromise->MaybeReject(aError);
|
||||||
aWriter->SetReadyPromise(readyPromise);
|
aWriter->SetReadyPromise(readyPromise);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user