Bug 1255266 - create sandbox with system principal. r=jryans,khuey.
authorShih-Chiang Chien <schien@mozilla.com>
Tue, 15 Mar 2016 19:51:02 +0800
changeset 312897 57a4d8b83db2fc938aa81fcc139786086a4263b3
parent 312896 eb4fb4fef6d483485d520e01d25ad59debfcfb48
child 312898 b569aa5415cab20998ceb7f34363e4aca14aef4c
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans, khuey
bugs1255266
milestone48.0a1
Bug 1255266 - create sandbox with system principal. r=jryans,khuey. MozReview-Commit-ID: LZRA24MRp1K
devtools/shared/Loader.jsm
--- a/devtools/shared/Loader.jsm
+++ b/devtools/shared/Loader.jsm
@@ -57,28 +57,38 @@ XPCOMUtils.defineLazyGetter(loaderModule
   };
 });
 XPCOMUtils.defineLazyGetter(loaderModules, "xpcInspector", () => {
   return Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
 });
 XPCOMUtils.defineLazyGetter(loaderModules, "indexedDB", () => {
   // On xpcshell, we can't instantiate indexedDB without crashing
   try {
-    return Cu.Sandbox(this, {wantGlobalProperties:["indexedDB"]}).indexedDB;
+    let sandbox
+      = Cu.Sandbox(CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')(),
+                   {wantGlobalProperties: ["indexedDB"]});
+    return sandbox.indexedDB;
+
   } catch(e) {
     return {};
   }
 });
 
 XPCOMUtils.defineLazyGetter(loaderModules, "CSS", () => {
-  return Cu.Sandbox(this, {wantGlobalProperties: ["CSS"]}).CSS;
+  let sandbox
+    = Cu.Sandbox(CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')(),
+                 {wantGlobalProperties: ["CSS"]});
+  return sandbox.CSS;
 });
 
 XPCOMUtils.defineLazyGetter(loaderModules, "URL", () => {
-  return Cu.Sandbox(this, {wantGlobalProperties: ["URL"]}).URL;
+  let sandbox
+    = Cu.Sandbox(CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')(),
+                 {wantGlobalProperties: ["URL"]});
+  return sandbox.URL;
 });
 
 var sharedGlobalBlocklist = ["sdk/indexed-db"];
 
 /**
  * Used when the tools should be loaded from the Firefox package itself.
  * This is the default case.
  */