Bug 1291321 - Use system principal to download file:// stylesheets. r=gl, a=ritu
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 02 Sep 2016 15:38:48 +0200
changeset 350207 630e64bbd358a3035ce788368a618871e6469990
parent 350206 207dc5d0e976f71dd24729dead303399984a8887
child 350208 0bfcfe38984f3ce39f46570d722d5f0cedf32801
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl, ritu
bugs1291321
milestone50.0a2
Bug 1291321 - Use system principal to download file:// stylesheets. r=gl, a=ritu MozReview-Commit-ID: Fd8RoPGbZjz
devtools/server/actors/stylesheets.js
--- a/devtools/server/actors/stylesheets.js
+++ b/devtools/server/actors/stylesheets.js
@@ -455,20 +455,19 @@ 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.
-    // 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)) {
+    // Bug 1287607, 1291321 - 'chrome' and 'file' protocols should also be handled in the
+    // same way.
+    if (!/^(chrome|file|resource):\/\//.test(this.href)) {
       options.window = this.window;
       options.principal = this.document.nodePrincipal;
     }
 
     return fetch(this.href, options).then(({ content }) => {
       this.text = content;
       return content;
     });