Bug 1260043 - removed `doc.hidden` check from markup/utils; r=ochameau
authorMatteo Ferretti <mferretti@mozilla.com>
Wed, 01 Jun 2016 12:32:26 +0200
changeset 339348 99dacc787a59d79c080886f46bfe8daf61c1bd0a
parent 339347 c8ca3bba2124d009256972f3b08bf5592c047005
child 339349 0e6dfa8fc2f4d513dba9f434fc3a92c32e6b9ad6
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1260043
milestone49.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 1260043 - removed `doc.hidden` check from markup/utils; r=ochameau MozReview-Commit-ID: BN2P5dfqerK
devtools/server/actors/highlighters/utils/markup.js
--- a/devtools/server/actors/highlighters/utils/markup.js
+++ b/devtools/server/actors/highlighters/utils/markup.js
@@ -260,37 +260,29 @@ CanvasFrameAnonymousContentHelper.protot
     // Insert the content node only if the page isn't in a XUL window, and if
     // the document still exists.
     if (!this.highlighterEnv.document.documentElement ||
         isXUL(this.highlighterEnv.window)) {
       return;
     }
     let doc = this.highlighterEnv.document;
 
-    // On B2G, for example, when connecting to keyboard just after startup,
-    // we connect to a hidden document, which doesn't accept
-    // insertAnonymousContent call yet.
-    if (doc.hidden) {
-      // In such scenario, just wait for the document to be visible
-      // before injecting anonymous content.
-      let onVisibilityChange = () => {
-        doc.removeEventListener("visibilitychange", onVisibilityChange);
-        this._insert();
-      };
-      doc.addEventListener("visibilitychange", onVisibilityChange);
-      return;
-    }
-
     // For now highlighters.css is injected in content as a ua sheet because
     // <style scoped> doesn't work inside anonymous content (see bug 1086532).
     // If it did, highlighters.css would be injected as an anonymous content
     // node using CanvasFrameAnonymousContentHelper instead.
     installHelperSheet(this.highlighterEnv.window,
       "@import url('" + STYLESHEET_URI + "');");
     let node = this.nodeBuilder();
+
+    // It was stated that hidden documents don't accept
+    // `insertAnonymousContent` calls yet. That doesn't seems the case anymore,
+    // at least on desktop. Therefore, removing the code that was dealing with
+    // that scenario, fixes when we're adding anonymous content in a tab that
+    // is not the active one (see bug 1260043 and bug 1260044)
     this._content = doc.insertAnonymousContent(node);
   },
 
   _onNavigate: function (e, {isTopLevel}) {
     if (isTopLevel) {
       this._removeAllListeners();
       this._insert();
       this.anonymousContentDocument = this.highlighterEnv.document;