mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 814104: Create the function in the right compartment. r=dcamp
This commit is contained in:
parent
439a5889fa
commit
d91ef531e3
@ -17,18 +17,20 @@ const Cu = Components.utils;
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["DebuggerServer"];
|
||||
|
||||
function loadSubScript(aURL)
|
||||
{
|
||||
try {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript(aURL, this);
|
||||
} catch(e) {
|
||||
dump("Error loading: " + aURL + ": " + e + " - " + e.stack + "\n");
|
||||
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
var loadSubScript =
|
||||
"function loadSubScript(aURL)\n" +
|
||||
"{\n" +
|
||||
"const Ci = Components.interfaces;\n" +
|
||||
"const Cc = Components.classes;\n" +
|
||||
" try {\n" +
|
||||
" let loader = Cc[\"@mozilla.org/moz/jssubscript-loader;1\"]\n" +
|
||||
" .getService(Ci.mozIJSSubScriptLoader);\n" +
|
||||
" loader.loadSubScript(aURL, this);\n" +
|
||||
" } catch(e) {\n" +
|
||||
" dump(\"Error loading: \" + aURL + \": \" + e + \" - \" + e.stack + \"\\n\");\n" +
|
||||
" throw e;\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
Cu.import("resource://gre/modules/devtools/dbg-client.jsm");
|
||||
|
||||
@ -37,7 +39,7 @@ var systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]
|
||||
.createInstance(Ci.nsIPrincipal);
|
||||
|
||||
var gGlobal = Cu.Sandbox(systemPrincipal);
|
||||
gGlobal.importFunction(loadSubScript);
|
||||
Cu.evalInSandbox(loadSubScript, gGlobal, "1.8");
|
||||
gGlobal.loadSubScript("chrome://global/content/devtools/dbg-server.js");
|
||||
|
||||
this.DebuggerServer = gGlobal.DebuggerServer;
|
||||
|
Loading…
Reference in New Issue
Block a user