зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1329365 - Follow-up adding 201, 202, and 205 to the list of response codes which suppress XML parsing errors. r=bz
This commit is contained in:
Родитель
40bcddbe8a
Коммит
c6aea6cc68
|
@ -55,8 +55,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=884693
|
|||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
runTest(204, "No content", "", "", []).
|
||||
then(() => { return runTest(204, "No content", INVALID_XML, "", []); }).
|
||||
runTest(201, "Created", "", "", []).
|
||||
then(() => { return runTest(201, "Created", INVALID_XML, INVALID_XML, []); }).
|
||||
then(() => { return runTest(202, "Accepted", "", "", []); }).
|
||||
then(() => { return runTest(202, "Accepted", INVALID_XML, INVALID_XML, []); }).
|
||||
then(() => { return runTest(204, "No Content", "", "", []); }).
|
||||
then(() => { return runTest(204, "No Content", INVALID_XML, "", []); }).
|
||||
then(() => { return runTest(205, "Reset Content", "", "", []); }).
|
||||
then(() => { return runTest(205, "Reset Content", INVALID_XML, "", []); }).
|
||||
then(() => { return runTest(304, "Not modified", "", "", []); }).
|
||||
then(() => { return runTest(304, "Not modified", INVALID_XML, "", []); }).
|
||||
then(() => { return runTest(200, "OK", "", "", ["no root element found"]); }).
|
||||
|
|
|
@ -2012,6 +2012,16 @@ XMLHttpRequestMainThread::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
|||
mResponseXML->SetChromeXHRDocURI(chromeXHRDocURI);
|
||||
mResponseXML->SetChromeXHRDocBaseURI(chromeXHRDocBaseURI);
|
||||
|
||||
// suppress parsing failure messages to console for statuses which
|
||||
// can have empty bodies (see bug 884693).
|
||||
uint32_t responseStatus;
|
||||
if (NS_SUCCEEDED(GetStatus(&responseStatus)) &&
|
||||
(responseStatus == 201 || responseStatus == 202 ||
|
||||
responseStatus == 204 || responseStatus == 205 ||
|
||||
responseStatus == 304)) {
|
||||
mResponseXML->SetSuppressParserErrorConsoleMessages(true);
|
||||
}
|
||||
|
||||
if (nsContentUtils::IsSystemPrincipal(mPrincipal)) {
|
||||
mResponseXML->ForceEnableXULXBL();
|
||||
}
|
||||
|
@ -2077,15 +2087,6 @@ XMLHttpRequestMainThread::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
|
|||
mRequestObserver->OnStopRequest(request, ctxt, status);
|
||||
}
|
||||
|
||||
// suppress parsing failure messages to console for status 204/304 (see bug 884693).
|
||||
if (mResponseXML) {
|
||||
uint32_t responseStatus;
|
||||
if (NS_SUCCEEDED(GetStatus(&responseStatus)) &&
|
||||
(responseStatus == 204 || responseStatus == 304)) {
|
||||
mResponseXML->SetSuppressParserErrorConsoleMessages(true);
|
||||
}
|
||||
}
|
||||
|
||||
// make sure to notify the listener if we were aborted
|
||||
// XXX in fact, why don't we do the cleanup below in this case??
|
||||
// State::unsent is for abort calls. See OnStartRequest above.
|
||||
|
|
Загрузка…
Ссылка в новой задаче