mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 22:47:59 +01:00
Use sandboxes for all JS contexts, to fix breakage, now that we have CPG anyway.
--HG-- extra : rebase_source : 0eb9d8c6a8ee533d6e12d71372554163f9479cf2
This commit is contained in:
@@ -484,7 +484,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
if (fileName && fileName[0] == "[")
|
if (fileName && fileName[0] == "[")
|
||||||
fileName = "dactyl://command-line/";
|
fileName = "dactyl://command-line/";
|
||||||
else if (!context)
|
else if (!context)
|
||||||
context = ctxt || _userContext;
|
context = ctxt || userContext;
|
||||||
|
|
||||||
if (isinstance(context, ["Sandbox"]))
|
if (isinstance(context, ["Sandbox"]))
|
||||||
return Cu.evalInSandbox(str, context, "1.8", fileName, lineNumber);
|
return Cu.evalInSandbox(str, context, "1.8", fileName, lineNumber);
|
||||||
|
|||||||
@@ -138,8 +138,8 @@ var Contexts = Module("contexts", {
|
|||||||
completer: function (context) modules.completion.group(context)
|
completer: function (context) modules.completion.group(context)
|
||||||
});
|
});
|
||||||
|
|
||||||
memoize(modules, "userContext", () => contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules, true]));
|
memoize(modules, "userContext", () => contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules, false]));
|
||||||
memoize(modules, "_userContext", () => contexts.Context(modules.io.getRCFile("~", true), contexts.user, [modules.userContext]));
|
memoize(modules, "_userContext", () => modules.userContext);
|
||||||
},
|
},
|
||||||
|
|
||||||
cleanup: function () {
|
cleanup: function () {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ var JavaScript = Module("javascript", {
|
|||||||
|
|
||||||
lazyInit: true,
|
lazyInit: true,
|
||||||
|
|
||||||
newContext: function () this.modules.newContext(this.modules.userContext, true, "Dactyl JS Temp Context"),
|
newContext: function () this.modules.newContext(this.modules.userContext, false, "Dactyl JS Temp Context"),
|
||||||
|
|
||||||
completers: Class.Memoize(() => Object.create(JavaScript.completers)),
|
completers: Class.Memoize(() => Object.create(JavaScript.completers)),
|
||||||
|
|
||||||
|
|||||||
@@ -132,9 +132,6 @@ var Modules = function Modules(window) {
|
|||||||
if (normal)
|
if (normal)
|
||||||
return create(proto);
|
return create(proto);
|
||||||
|
|
||||||
if (services.has("dactyl") && services.dactyl.createGlobal)
|
|
||||||
var sandbox = services.dactyl.createGlobal();
|
|
||||||
else
|
|
||||||
sandbox = Components.utils.Sandbox(window, { sandboxPrototype: proto || modules,
|
sandbox = Components.utils.Sandbox(window, { sandboxPrototype: proto || modules,
|
||||||
sandboxName: name || ("Dactyl Sandbox " + ++_id),
|
sandboxName: name || ("Dactyl Sandbox " + ++_id),
|
||||||
wantXrays: false });
|
wantXrays: false });
|
||||||
@@ -143,6 +140,7 @@ var Modules = function Modules(window) {
|
|||||||
// sandbox.Object = jsmodules.Object;
|
// sandbox.Object = jsmodules.Object;
|
||||||
sandbox.File = jsmodules.File;
|
sandbox.File = jsmodules.File;
|
||||||
sandbox.Math = jsmodules.Math;
|
sandbox.Math = jsmodules.Math;
|
||||||
|
sandbox.Set = jsmodules.Set;
|
||||||
sandbox.__proto__ = proto || modules;
|
sandbox.__proto__ = proto || modules;
|
||||||
return sandbox;
|
return sandbox;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user