Bug 1260043 - removed `doc.hidden` check from markup/utils; r=pbro
MozReview-Commit-ID: BN2P5dfqerK
--- 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;