Bug 1362354 - Handle XHRs with aborted bindings as aborted rather than network errors. r?baku
MozReview-Commit-ID: 86e00dRe6qc
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -2095,16 +2095,24 @@ XMLHttpRequestMainThread::OnStopRequest(
// Is this good enough here?
if (mXMLParserStreamListener && mFlagParseBody) {
mXMLParserStreamListener->OnStopRequest(request, ctxt, status);
}
mXMLParserStreamListener = nullptr;
mContext = nullptr;
+ // If window.stop() or other aborts were issued, handle as an abort
+ if (status == NS_BINDING_ABORTED) {
+ mFlagParseBody = false;
+ IgnoredErrorResult rv;
+ RequestErrorSteps(ProgressEventType::abort, NS_OK, rv);
+ return NS_OK;
+ }
+
bool waitingForBlobCreation = false;
// If we have this error, we have to deal with a file: URL + responseType =
// blob. We have this error because we canceled the channel. The status will
// be set to NS_OK.
if (status == NS_ERROR_FILE_ALREADY_EXISTS &&
mResponseType == XMLHttpRequestResponseType::Blob) {
nsCOMPtr<nsIFile> file;
deleted file mode 100644
--- a/testing/web-platform/meta/xhr/abort-after-stop.htm.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[abort-after-stop.htm]
- [XMLHttpRequest: abort event should fire when stop() method is used]
- expected: FAIL
-