Bug 1287607 - Making the stylesheets editor using the system principal to load CSS files from 'chrome://' URL. r=gl
authorTim Huang <tihuang@mozilla.com>
Tue, 19 Jul 2016 17:39:00 +0200
changeset 390599 867a287c1fe16094f69ff40fa8a1b4d77efa030d
parent 390598 4c3f8c8dbefada4e5935166c175405dde56a05f7
child 390600 fff0c4030b81ceb8b98d4db74807b746f403770c
push id23706
push users.kaspari@gmail.com
push dateThu, 21 Jul 2016 13:37:48 +0000
reviewersgl
bugs1287607
milestone50.0a1
Bug 1287607 - Making the stylesheets editor using the system principal to load CSS files from 'chrome://' URL. r=gl
devtools/server/actors/stylesheets.js
--- a/devtools/server/actors/stylesheets.js
+++ b/devtools/server/actors/stylesheets.js
@@ -455,17 +455,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;
     });