Bug 1255266 - create sandbox with system principal. r=khuey, jryans.
MozReview-Commit-ID: LZRA24MRp1K
--- 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.
*/