зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1496621 - reject Fetch promises with (informative) TypeErrors when decoding fails, per spec; r=baku
reject Fetch promises with (informative) TypeErrors when decoding fails, per spec Differential Revision: https://phabricator.services.mozilla.com/D7970 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1b619b4d1e
Коммит
ba1f0dc311
|
@ -767,7 +767,15 @@ FetchBodyConsumer<Derived>::ContinueConsumeBody(nsresult aStatus,
|
|||
}
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(aStatus))) {
|
||||
localPromise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
|
||||
// Per https://fetch.spec.whatwg.org/#concept-read-all-bytes-from-readablestream
|
||||
// Decoding errors should reject with a TypeError
|
||||
if (aStatus == NS_ERROR_INVALID_CONTENT_ENCODING) {
|
||||
IgnoredErrorResult rv;
|
||||
rv.ThrowTypeError<MSG_DOM_DECODING_FAILED>();
|
||||
localPromise->MaybeReject(rv);
|
||||
} else {
|
||||
localPromise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't warn here since we warned above.
|
||||
|
|
|
@ -1221,7 +1221,7 @@ FetchDriver::OnStopRequest(nsIRequest* aRequest,
|
|||
if (NS_FAILED(aStatusCode) || !mObserver) {
|
||||
nsCOMPtr<nsIAsyncOutputStream> outputStream = do_QueryInterface(mPipeOutputStream);
|
||||
if (outputStream) {
|
||||
outputStream->CloseWithStatus(NS_BINDING_FAILED);
|
||||
outputStream->CloseWithStatus(NS_FAILED(aStatusCode) ? aStatusCode : NS_BINDING_FAILED);
|
||||
}
|
||||
if (altDataListener) {
|
||||
altDataListener->Cancel();
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
[bad-gzip-body.any.html]
|
||||
[Consuming the body of a resource with bad gzip content with arrayBuffer() should reject]
|
||||
expected: FAIL
|
||||
|
||||
[Consuming the body of a resource with bad gzip content with blob() should reject]
|
||||
expected: FAIL
|
||||
|
||||
[Consuming the body of a resource with bad gzip content with formData() should reject]
|
||||
expected: FAIL
|
||||
|
||||
[Consuming the body of a resource with bad gzip content with json() should reject]
|
||||
expected: FAIL
|
||||
|
||||
[Consuming the body of a resource with bad gzip content with text() should reject]
|
||||
expected: FAIL
|
||||
|
||||
|
||||
[bad-gzip-body.any.worker.html]
|
||||
[Consuming the body of a resource with bad gzip content with arrayBuffer() should reject]
|
||||
expected: FAIL
|
||||
|
||||
[Consuming the body of a resource with bad gzip content with blob() should reject]
|
||||
expected: FAIL
|
||||
|
||||
[Consuming the body of a resource with bad gzip content with formData() should reject]
|
||||
expected: FAIL
|
||||
|
||||
[Consuming the body of a resource with bad gzip content with json() should reject]
|
||||
expected: FAIL
|
||||
|
||||
[Consuming the body of a resource with bad gzip content with text() should reject]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче