Backed out changeset 6fb622c938de (bug 884693) for crashed @mozilla::dom::XMLHttpRequestMainThread
authorIris Hsiao <ihsiao@mozilla.com>
Wed, 21 Sep 2016 13:00:50 +0800
changeset 314576 4fdb6fff42d1
parent 314575 a8648997af90
child 314577 da740b4fd484
push id81940
push userihsiao@mozilla.com
push dateWed, 21 Sep 2016 05:01:05 +0000
treeherdermozilla-inbound@4fdb6fff42d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs884693
milestone52.0a1
backs out6fb622c938de
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
Backed out changeset 6fb622c938de (bug 884693) for crashed @mozilla::dom::XMLHttpRequestMainThread CLOSED TREE
dom/base/nsIDocument.h
dom/base/test/chrome/bug884693.sjs
dom/base/test/chrome/chrome.ini
dom/base/test/chrome/test_bug884693.xul
dom/base/test/moz.build
dom/xhr/XMLHttpRequestMainThread.cpp
dom/xml/XMLDocument.cpp
dom/xml/XMLDocument.h
parser/htmlparser/nsExpatDriver.cpp
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -245,19 +245,16 @@ public:
                                      nsIStreamListener **aDocListener,
                                      bool aReset,
                                      nsIContentSink* aSink = nullptr) = 0;
   virtual void StopDocumentLoad() = 0;
 
   virtual void SetSuppressParserErrorElement(bool aSuppress) {}
   virtual bool SuppressParserErrorElement() { return false; }
 
-  virtual void SetSuppressParserErrorConsoleMessages(bool aSuppress) {}
-  virtual bool SuppressParserErrorConsoleMessages() { return false; }
-
   /**
    * Signal that the document title may have changed
    * (see nsDocument::GetTitle).
    * @param aBoundTitleElement true if an HTML or SVG <title> element
    * has just been bound to the document.
    */
   virtual void NotifyPossibleTitleChange(bool aBoundTitleElement) = 0;
 
deleted file mode 100644
--- a/dom/base/test/chrome/bug884693.sjs
+++ /dev/null
@@ -1,8 +0,0 @@
-function handleRequest(request, response)
-{
-  let [status, statusText, body] = request.queryString.split("&");
-  response.setStatusLine(request.httpVersion, status, statusText);
-  response.setHeader("Content-Type", "text/xml", false);
-  response.setHeader("Content-Length", "" + body.length, false);
-  response.write(body);
-}
--- a/dom/base/test/chrome/chrome.ini
+++ b/dom/base/test/chrome/chrome.ini
@@ -53,17 +53,16 @@ skip-if = buildapp == 'mulet'
 [test_bug752226-3.xul]
 [test_bug752226-4.xul]
 [test_bug765993.html]
 [test_bug780199.xul]
 [test_bug780529.xul]
 [test_bug800386.xul]
 [test_bug814638.xul]
 [test_bug816340.xul]
-[test_bug884693.xul]
 [test_bug914381.html]
 [test_bug990812.xul]
 [test_bug1063837.xul]
 [test_bug1139964.xul]
 [test_bug1209621.xul]
 [test_cpows.xul]
 skip-if = buildapp == 'mulet'
 [test_registerElement_content.xul]
deleted file mode 100644
--- a/dom/base/test/chrome/test_bug884693.xul
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=884693
--->
-<window title="Mozilla Bug 884693"
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
-  <!-- test results are displayed in the html:body -->
-  <body xmlns="http://www.w3.org/1999/xhtml">
-  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=884693"
-     target="_blank">Mozilla Bug 884693</a>
-  </body>
-
-  <!-- test code goes here -->
-  <script type="application/javascript"><![CDATA[
-
-    const SERVER_URL = "http://mochi.test:8888/tests/dom/base/test/chrome/bug884693.sjs";
-    const INVALID_XML = "InvalidXML";
-
-    var { classes: Cc, interfaces: Ci } = Components;
-
-    let consoleService = Cc["@mozilla.org/consoleservice;1"].
-                         getService(Ci.nsIConsoleService)
-
-    function runTest(status, statusText, body, expectedResponse, expectedMessages)
-    {
-      return new Promise((resolve, reject) => {
-        consoleService.reset();
-
-        let xhr = new XMLHttpRequest();
-
-        xhr.onload = () => {
-          is(xhr.responseText, expectedResponse, "Correct responseText returned");
-
-          let messages = consoleService.getMessageArray() || [];
-          is(messages.length, expectedMessages.length, "Got expected message count");
-          messages = messages.map(m => m.message).join(",");
-          for(let message of expectedMessages) {
-            ok(messages.indexOf(message) >= 0, "Got expected message: " + message);
-          }
-
-          resolve();
-        };
-
-        xhr.onerror = e => {
-          reject(e);
-        };
-
-        xhr.open("GET", `${SERVER_URL}?${status}&${statusText}&${body}`);
-        xhr.send();
-      });
-    }
-
-    SimpleTest.waitForExplicitFinish();
-    runTest(204, "No content", "", "", []).
-      then(() => { return runTest(204, "No 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"]); }).
-      then(() => { return runTest(200, "OK", INVALID_XML, INVALID_XML, ["syntax error"]); }).
-      then(SimpleTest.finish);
-
-  ]]></script>
-</window>
--- a/dom/base/test/moz.build
+++ b/dom/base/test/moz.build
@@ -31,13 +31,12 @@ BROWSER_CHROME_MANIFESTS += [
 
 TEST_DIRS += [
     'gtest',
     'jsmodules'
 ]
 
 TEST_HARNESS_FILES.testing.mochitest.tests.dom.base.test.chrome += [
     'chrome/bug421622-referer.sjs',
-    'chrome/bug884693.sjs',
     'chrome/nochrome_bug765993.html',
     'chrome/nochrome_bug765993.js',
     'chrome/nochrome_bug765993.js^headers^',
 ]
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -1995,23 +1995,16 @@ XMLHttpRequestMainThread::OnStopRequest(
   mWaitingForOnStopRequest = false;
 
   if (mRequestObserver) {
     NS_ASSERTION(mFirstStartRequestSeen, "Inconsistent state!");
     mFirstStartRequestSeen = false;
     mRequestObserver->OnStopRequest(request, ctxt, status);
   }
 
-  // suppress parsing failure messages to console for status 204/304 (see bug 884693).
-  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.
   if (mState == State::unsent || mFlagTimedOut) {
     if (mXMLParserStreamListener)
       (void) mXMLParserStreamListener->OnStopRequest(request, ctxt, status);
     return NS_OK;
   }
--- a/dom/xml/XMLDocument.cpp
+++ b/dom/xml/XMLDocument.cpp
@@ -494,28 +494,16 @@ XMLDocument::SetSuppressParserErrorEleme
 }
 
 bool
 XMLDocument::SuppressParserErrorElement()
 {
   return mSuppressParserErrorElement;
 }
 
-void
-XMLDocument::SetSuppressParserErrorConsoleMessages(bool aSuppress)
-{
-  mSuppressParserErrorConsoleMessages = aSuppress;
-}
-
-bool
-XMLDocument::SuppressParserErrorConsoleMessages()
-{
-  return mSuppressParserErrorConsoleMessages;
-}
-
 nsresult
 XMLDocument::StartDocumentLoad(const char* aCommand,
                                nsIChannel* aChannel,
                                nsILoadGroup* aLoadGroup,
                                nsISupports* aContainer,
                                nsIStreamListener **aDocListener,
                                bool aReset,
                                nsIContentSink* aSink)
--- a/dom/xml/XMLDocument.h
+++ b/dom/xml/XMLDocument.h
@@ -27,19 +27,16 @@ public:
 
   virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) override;
   virtual void ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
                           nsIPrincipal* aPrincipal) override;
 
   virtual void SetSuppressParserErrorElement(bool aSuppress) override;
   virtual bool SuppressParserErrorElement() override;
 
-  virtual void SetSuppressParserErrorConsoleMessages(bool aSuppress) override;
-  virtual bool SuppressParserErrorConsoleMessages() override;
-
   virtual nsresult StartDocumentLoad(const char* aCommand, nsIChannel* channel,
                                      nsILoadGroup* aLoadGroup,
                                      nsISupports* aContainer,
                                      nsIStreamListener **aDocListener,
                                      bool aReset = true,
                                      nsIContentSink* aSink = nullptr) override;
 
   virtual void EndLoad() override;
@@ -90,17 +87,14 @@ protected:
   bool mLoopingForSyncLoad;
 
   // If true. we're really a Document, not an XMLDocument
   bool mIsPlainDocument;
 
   // If true, do not output <parsererror> elements. Per spec, XMLHttpRequest
   // shouldn't output them, whereas DOMParser/others should (see bug 918703).
   bool mSuppressParserErrorElement;
-
-  // If true, do not log parsing errors to the web console (see bug 884693).
-  bool mSuppressParserErrorConsoleMessages;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_XMLDocument_h
--- a/parser/htmlparser/nsExpatDriver.cpp
+++ b/parser/htmlparser/nsExpatDriver.cpp
@@ -964,21 +964,16 @@ nsExpatDriver::HandleError()
                             sourceText.get(), 
                             serr, 
                             &shouldReportError);
     if (NS_FAILED(rv)) {
       shouldReportError = true;
     }
   }
 
-  nsCOMPtr<nsIDocument> doc = do_QueryInterface(mOriginalSink->GetTarget());
-  if (doc && doc->SuppressParserErrorConsoleMessages()) {
-    shouldReportError = false;
-  }
-
   if (shouldReportError) {
     nsCOMPtr<nsIConsoleService> cs
       (do_GetService(NS_CONSOLESERVICE_CONTRACTID));  
     if (cs) {
       cs->LogMessage(serr);
     }
   }