Bug 1287607 - Make the stylesheets editor using the system principal to load CSS files from 'chrome://' URL. r=gl, a=sledru
authorTim Huang <tihuang@mozilla.com>
Tue, 19 Jul 2016 17:39:00 +0200
changeset 340089 15a01def6b14b99b52b489eb1c67bacf1e73bd27
parent 340088 23b42c01eba2c9979a0b75327648033553b3df17
child 340090 e68714c0861aa70d091066e9dc358dce651d4a62
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)
reviewersgl, sledru
bugs1287607
milestone49.0a2
Bug 1287607 - Make the stylesheets editor using the system principal to load CSS files from 'chrome://' URL. r=gl, a=sledru
devtools/server/actors/stylesheets.js
--- a/devtools/server/actors/stylesheets.js
+++ b/devtools/server/actors/stylesheets.js
@@ -444,17 +444,20 @@ var StyleSheetActor = protocol.ActorClas
       charset: this._getCSSCharset()
     };
 
     // Bug 1282660 - We use the system principal to load the default internal
     // stylesheets instead of the content principal since such stylesheets
     // require system principal to load. At meanwhile, we strip the loadGroup
     // for preventing the assertion of the userContextId mismatching.
     // The default internal stylesheets load from the 'resource:' URL.
-    if (!/^resource:\/\//.test(this.href)) {
+    // Bug 1287607 - The 'chrome:' URL will be also loaded from here, so we do
+    // the same thing for such URLs as well.
+    if (!/^resource:\/\//.test(this.href) &&
+        !/^chrome:\/\//.test(this.href)) {
       options.window = this.window;
       options.principal = this.document.nodePrincipal;
     }
 
     return fetch(this.href, options).then(({ content }) => {
       this.text = content;
       return content;
     });