Backed out changeset 126368a5c3ec (bug 1465388) for causing topcrash bug 1487004 a=backout
authorAndreea Pavel <apavel@mozilla.com>
Wed, 29 Aug 2018 11:39:19 +0300
changeset 482026 a33ef251cb467a34aad71b0d94a4289addc9590f
parent 481967 3205543f957cd2a6905486d73aa897535fdd9825
child 482069 56cfcee29fbc4f0816c5d5dedbaf0136b5e84773
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersbackout
bugs1465388, 1487004
milestone63.0a1
backs out126368a5c3ec8880f748a8bb91844048f67922b6
Backed out changeset 126368a5c3ec (bug 1465388) for causing topcrash bug 1487004 a=backout
dom/base/nsDocument.cpp
dom/html/nsHTMLContentSink.cpp
toolkit/components/extensions/test/xpcshell/test_ext_contentscript_about_blank_start.js
toolkit/components/extensions/test/xpcshell/xpcshell-content.ini
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -10037,17 +10037,16 @@ public:
                                         const BlockParsingOptions& aOptions)
     : mPromise(aPromise)
   {
     nsCOMPtr<nsIParser> parser = aDocument->CreatorParserOrNull();
     if (parser && (aOptions.mBlockScriptCreated || !parser->IsScriptCreated())) {
       parser->BlockParser();
       mParser = do_GetWeakReference(parser);
       mDocument = aDocument;
-      mDocument->BlockOnload();
     }
   }
 
   void
   ResolvedCallback(JSContext* aCx, JS::Handle<JS::Value> aValue) override
   {
     MaybeUnblockParser();
 
@@ -10076,17 +10075,16 @@ private:
   void MaybeUnblockParser() {
     nsCOMPtr<nsIParser> parser = do_QueryReferent(mParser);
     if (parser) {
       MOZ_DIAGNOSTIC_ASSERT(mDocument);
       nsCOMPtr<nsIParser> docParser = mDocument->CreatorParserOrNull();
       if (parser == docParser) {
         parser->UnblockParser();
         parser->ContinueInterruptedParsingAsync();
-        mDocument->UnblockOnload(false);
       }
     }
     mParser = nullptr;
     mDocument = nullptr;
   }
 
   nsWeakPtr mParser;
   RefPtr<Promise> mPromise;
--- a/dom/html/nsHTMLContentSink.cpp
+++ b/dom/html/nsHTMLContentSink.cpp
@@ -126,17 +126,16 @@ public:
   NS_IMETHOD DidBuildModel(bool aTerminated) override;
   NS_IMETHOD WillInterrupt(void) override;
   NS_IMETHOD WillResume(void) override;
   NS_IMETHOD SetParser(nsParserBase* aParser) override;
   virtual void FlushPendingNotifications(FlushType aType) override;
   virtual void SetDocumentCharset(NotNull<const Encoding*> aEncoding) override;
   virtual nsISupports *GetTarget() override;
   virtual bool IsScriptExecuting() override;
-  virtual void ContinueInterruptedParsingAsync() override;
 
   // nsIHTMLContentSink
   NS_IMETHOD OpenContainer(ElementType aNodeType) override;
   NS_IMETHOD CloseContainer(ElementType aTag) override;
 
 protected:
   virtual ~HTMLContentSink();
 
@@ -171,19 +170,16 @@ protected:
   void CloseHeadContext();
 
   // nsContentSink overrides
   void UpdateChildCounts() override;
 
   void NotifyInsert(nsIContent* aContent,
                     nsIContent* aChildContent);
   void NotifyRootInsertion();
-
-private:
-  void ContinueInterruptedParsingIfEnabled();
 };
 
 class SinkContext
 {
 public:
   explicit SinkContext(HTMLContentSink* aSink);
   ~SinkContext();
 
@@ -1046,28 +1042,8 @@ HTMLContentSink::GetTarget()
   return mDocument;
 }
 
 bool
 HTMLContentSink::IsScriptExecuting()
 {
   return IsScriptExecutingImpl();
 }
-
-void
-HTMLContentSink::ContinueInterruptedParsingIfEnabled()
-{
-  if (mParser->IsParserEnabled()) {
-    static_cast<nsIParser*>(mParser.get())->ContinueInterruptedParsing();
-  }
-}
-
-void
-HTMLContentSink::ContinueInterruptedParsingAsync()
-{
-  nsCOMPtr<nsIRunnable> ev =
-    NewRunnableMethod("HTMLContentSink::ContinueInterruptedParsingIfEnabled",
-                      this,
-                      &HTMLContentSink::ContinueInterruptedParsingIfEnabled);
-
-  nsCOMPtr<nsIDocument> doc = do_QueryInterface(mHTMLDocument);
-  doc->Dispatch(mozilla::TaskCategory::Other, ev.forget());
-}
deleted file mode 100644
--- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_about_blank_start.js
+++ /dev/null
@@ -1,69 +0,0 @@
-"use strict";
-
-const server = createHttpServer({hosts: ["example.com"]});
-
-server.registerPathHandler("/blank-iframe.html", (request, response) => {
-  response.setStatusLine(request.httpVersion, 200, "OK");
-  response.setHeader("Content-Type", "text/html; charset=utf-8", false);
-  response.write("<iframe></iframe>");
-});
-
-add_task(async function content_script_at_document_start() {
-  let extensionData = {
-    manifest: {
-      content_scripts: [{
-        "matches": ["<all_urls>"],
-        "js": ["start.js"],
-        "run_at": "document_start",
-        "match_about_blank": true,
-      }],
-    },
-
-    files: {
-      "start.js": function() {
-        browser.test.sendMessage("content-script-done");
-      },
-    },
-  };
-
-  let extension = ExtensionTestUtils.loadExtension(extensionData);
-  await extension.startup();
-  let contentPage = await ExtensionTestUtils.loadContentPage(`about:blank`);
-  await extension.awaitMessage("content-script-done");
-  await contentPage.close();
-  await extension.unload();
-});
-
-add_task(async function content_style_at_document_start() {
-  let extensionData = {
-    manifest: {
-      content_scripts: [{
-        "matches": ["<all_urls>"],
-        "css": ["start.css"],
-        "run_at": "document_start",
-        "match_about_blank": true,
-      }, {
-        "matches": ["<all_urls>"],
-        "js": ["end.js"],
-        "run_at": "document_end",
-        "match_about_blank": true,
-      }],
-    },
-
-    files: {
-      "start.css": "body { background: red; }",
-      "end.js": function() {
-        let style = window.getComputedStyle(document.body);
-        browser.test.assertEq("rgb(255, 0, 0)", style.backgroundColor, "document_start style should have been applied");
-        browser.test.sendMessage("content-script-done");
-      },
-    },
-  };
-
-  let extension = ExtensionTestUtils.loadExtension(extensionData);
-  await extension.startup();
-  let contentPage = await ExtensionTestUtils.loadContentPage(`about:blank`);
-  await extension.awaitMessage("content-script-done");
-  await contentPage.close();
-  await extension.unload();
-});
--- a/toolkit/components/extensions/test/xpcshell/xpcshell-content.ini
+++ b/toolkit/components/extensions/test/xpcshell/xpcshell-content.ini
@@ -1,13 +1,13 @@
 [test_ext_i18n.js]
 skip-if = os == "android" || (os == "win" && debug) || (os == "linux")
 [test_ext_i18n_css.js]
 [test_ext_contentscript.js]
-[test_ext_contentscript_about_blank_start.js]
 [test_ext_contentscript_scriptCreated.js]
+skip-if = debug # Bug 1407501
 [test_ext_contentscript_triggeringPrincipal.js]
 skip-if = (os == "android" && debug) || (os == "win" && debug) # Windows: Bug 1438796
 [test_ext_contentscript_xrays.js]
 [test_ext_contentScripts_register.js]
 [test_ext_contexts_gc.js]
 [test_ext_adoption_with_xrays.js]
 [test_ext_shadowdom.js]