Bug 1324565 - Remove dependency to sdk/page-mod from inspector highlighter. r=pbro
MozReview-Commit-ID: 5oZI4mkDFqJ
--- a/devtools/server/actors/highlighters/utils/markup.js
+++ b/devtools/server/actors/highlighters/utils/markup.js
@@ -281,18 +281,26 @@ CanvasFrameAnonymousContentHelper.protot
if (isXUL(this.highlighterEnv.window)) {
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 + "');");
+ if (!installedHelperSheets.has(doc)) {
+ installedHelperSheets.set(doc, true);
+ let source = "@import url('" + STYLESHEET_URI + "');";
+ let url = "data:text/css;charset=utf-8," + encodeURIComponent(source);
+ let winUtils = this.highlighterEnv.window
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+ winUtils.loadSheetUsingURIString(url, winUtils.AGENT_SHEET);
+ }
+
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);