Bug 1324565 - Remove dependency to sdk/page-mod from inspector highlighter. r=pbro
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 19 Dec 2016 11:07:11 -0800
changeset 328848 5fbf1ba06cace4c10fbde0805b4da66931bae769
parent 328847 8e5f0fda8a89bf8049f63fb3b5ec1a9ee6482fbe
child 328849 21f392a1ac51f38dbb4e9aaa97442bb6f619bcb5
push id31190
push usercbook@mozilla.com
push dateWed, 11 Jan 2017 15:21:29 +0000
treeherdermozilla-central@5493551203ed [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1324565
milestone53.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 1324565 - Remove dependency to sdk/page-mod from inspector highlighter. r=pbro MozReview-Commit-ID: 5oZI4mkDFqJ
devtools/server/actors/highlighters/utils/markup.js
--- 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);