Bug 1564930 - Improve "XHR must not be LOADING or DONE" error messages. r=baku
The previous error message suggested that this is an internal error message pointing out a bad state in the XHR state machine, when in fact this is a user error (calling `overrideMimeType()` or setting `responseType()` after `send()`). This commit improves and disambiguates the error messages, pointing out to the user what they did wrong, like other browsers do. Differential Revision: https://phabricator.services.mozilla.com/D37659
This commit is contained in:
@@ -632,7 +632,7 @@ void XMLHttpRequestMainThread::SetResponseType(
|
||||
|
||||
if (mState == XMLHttpRequest_Binding::LOADING ||
|
||||
mState == XMLHttpRequest_Binding::DONE) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE);
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE_RESPONSE_TYPE);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3101,7 +3101,7 @@ void XMLHttpRequestMainThread::OverrideMimeType(const nsAString& aMimeType,
|
||||
|
||||
if (mState == XMLHttpRequest_Binding::LOADING ||
|
||||
mState == XMLHttpRequest_Binding::DONE) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE);
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_XHR_MUST_NOT_BE_LOADING_OR_DONE_OVERRIDE_MIME_TYPE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user