Bug 1712930 - Part 2: Get rid of NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT; r=smaug
☠☠ backed out by a8c952dcf428 ☠ ☠
authorEdgar Chen <echen@mozilla.com>
Mon, 31 May 2021 12:57:16 +0000
changeset 653969 ab9bb2ee0c987f5d4580fb4b9c072c0854cdf130
parent 653968 ec01575cb276a58e7c0a419215fb109f26543e1b
child 653970 dd0ab5fc70a0dac907e535006460d5819d5a2d74
push id2623
push userffxbld-merge
push dateMon, 02 Aug 2021 14:47:51 +0000
treeherdermozilla-release@8500ce65f7c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1712930
milestone90.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1712930 - Part 2: Get rid of NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT; r=smaug Differential Revision: https://phabricator.services.mozilla.com/D116076
devtools/server/actors/network-monitor/utils/network-utils.js
dom/base/domerr.msg
dom/xhr/XMLHttpRequestMainThread.cpp
dom/xhr/XMLHttpRequestWorker.cpp
xpcom/base/ErrorList.py
--- a/devtools/server/actors/network-monitor/utils/network-utils.js
+++ b/devtools/server/actors/network-monitor/utils/network-utils.js
@@ -298,17 +298,16 @@ const ErrorCodes = {
   NS_ERROR_DOM_MALFORMED_URI: 0x805303f8,
   NS_ERROR_DOM_INVALID_HEADER_NAME: 0x805303f9,
   NS_ERROR_DOM_INVALID_STATE_XHR_HAS_INVALID_CONTEXT: 0x805303fa,
   NS_ERROR_DOM_INVALID_STATE_XHR_MUST_BE_OPENED: 0x805303fb,
   NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_SENDING: 0x805303fc,
   NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE_RESPONSE_TYPE: 0x805303fd,
   NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE_OVERRIDE_MIME_TYPE: 0x8053040d,
   NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSEXML: 0x805303fe,
-  NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT: 0x805303ff,
   NS_ERROR_DOM_JS_DECODING_ERROR: 0x80530402,
   NS_ERROR_DOM_IMAGE_INACTIVE_DOCUMENT: 0x80530403,
   NS_ERROR_DOM_IMAGE_INVALID_REQUEST: 0x80530404,
   NS_ERROR_DOM_IMAGE_BROKEN: 0x80530405,
   NS_ERROR_DOM_CORP_FAILED: 0x8053040c,
   NS_SUCCESS_DOM_NO_OPERATION: 0x530001,
   NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW: 0x530002,
   NS_SUCCESS_DOM_SCRIPT_EVALUATION_THREW_UNCATCHABLE: 0x530003,
--- a/dom/base/domerr.msg
+++ b/dom/base/domerr.msg
@@ -138,14 +138,13 @@ DOM4_MSG_DEF(SyntaxError, "Invalid heade
 
 /* XMLHttpRequest errors. */
 DOM4_MSG_DEF(InvalidStateError, "XMLHttpRequest has an invalid context.", NS_ERROR_DOM_INVALID_STATE_XHR_HAS_INVALID_CONTEXT)
 DOM4_MSG_DEF(InvalidStateError, "XMLHttpRequest state must be OPENED.", NS_ERROR_DOM_INVALID_STATE_XHR_MUST_BE_OPENED)
 DOM4_MSG_DEF(InvalidStateError, "XMLHttpRequest must not be sending.", NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_SENDING)
 DOM4_MSG_DEF(InvalidStateError, "Cannot set 'responseType' property on XMLHttpRequest after 'send()' (when its state is LOADING or DONE).", NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE_RESPONSE_TYPE)
 DOM4_MSG_DEF(InvalidStateError, "Cannot call 'overrideMimeType()' on XMLHttpRequest after 'send()' (when its state is LOADING or DONE).", NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE_OVERRIDE_MIME_TYPE)
 DOM4_MSG_DEF(InvalidStateError, "responseXML is only available if responseType is '' or 'document'.", NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSEXML)
-DOM4_MSG_DEF(InvalidStateError, "responseText is only available if responseType is '' or 'text'.", NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT)
 
 /* Image decode errors. */
 DOM4_MSG_DEF(EncodingError, "Node bound to inactive document.", NS_ERROR_DOM_IMAGE_INACTIVE_DOCUMENT)
 DOM4_MSG_DEF(EncodingError, "Invalid image request.", NS_ERROR_DOM_IMAGE_INVALID_REQUEST)
 DOM4_MSG_DEF(EncodingError, "Invalid encoded image data.", NS_ERROR_DOM_IMAGE_BROKEN)
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -565,18 +565,18 @@ void XMLHttpRequestMainThread::GetRespon
 }
 
 void XMLHttpRequestMainThread::GetResponseText(
     XMLHttpRequestStringSnapshot& aSnapshot, ErrorResult& aRv) {
   aSnapshot.Reset();
 
   if (mResponseType != XMLHttpRequestResponseType::_empty &&
       mResponseType != XMLHttpRequestResponseType::Text) {
-    aRv.Throw(
-        NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT);
+    aRv.ThrowInvalidStateError(
+        "responseText is only available if responseType is '' or 'text'.");
     return;
   }
 
   if (mState != XMLHttpRequest_Binding::LOADING &&
       mState != XMLHttpRequest_Binding::DONE) {
     return;
   }
 
--- a/dom/xhr/XMLHttpRequestWorker.cpp
+++ b/dom/xhr/XMLHttpRequestWorker.cpp
@@ -2195,18 +2195,18 @@ void XMLHttpRequestWorker::GetResponse(J
 }
 
 void XMLHttpRequestWorker::GetResponseText(DOMString& aResponseText,
                                            ErrorResult& aRv) {
   MOZ_DIAGNOSTIC_ASSERT(mResponseData);
 
   if (mResponseType != XMLHttpRequestResponseType::_empty &&
       mResponseType != XMLHttpRequestResponseType::Text) {
-    aRv.Throw(
-        NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT);
+    aRv.ThrowInvalidStateError(
+        "responseText is only available if responseType is '' or 'text'.");
     return;
   }
 
   if (!mResponseData->mResponseText.GetAsString(aResponseText)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return;
   }
 }
--- a/xpcom/base/ErrorList.py
+++ b/xpcom/base/ErrorList.py
@@ -724,21 +724,16 @@ with modules["DOM"]:
     errors[
         "NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE_OVERRIDE_MIME_TYPE"
     ] = FAILURE(
         1037
     )  # NOQA: E501
     errors[
         "NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSEXML"
     ] = FAILURE(1022)
-    errors[
-        "NS_ERROR_DOM_INVALID_STATE_XHR_HAS_WRONG_RESPONSETYPE_FOR_RESPONSETEXT"
-    ] = FAILURE(
-        1023
-    )  # NOQA: E501
 
     # When manipulating the bytecode cache with the JS API, some transcoding
     # errors, such as a different bytecode format can cause failures of the
     # decoding process.
     errors["NS_ERROR_DOM_JS_DECODING_ERROR"] = FAILURE(1026)
 
     # Image decode errors.
     errors["NS_ERROR_DOM_IMAGE_INACTIVE_DOCUMENT"] = FAILURE(1027)