mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-28 23:02:27 +01:00
Give *.penta plugins their own JS sandboxen.
--HG-- branch : key-processing
This commit is contained in:
@@ -380,15 +380,16 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
},
|
||||
|
||||
userEval: function (str, context, fileName, lineNumber) {
|
||||
let ctxt;
|
||||
if (jsmodules.__proto__ != window)
|
||||
str = "with (window) { with (modules) { (this.eval || eval)(" + str.quote() + ") } }";
|
||||
|
||||
if (fileName == null)
|
||||
if (io.sourcing && io.sourcing.file[0] !== "[")
|
||||
({ file: fileName, line: lineNumber }) = io.sourcing;
|
||||
({ file: fileName, line: lineNumber, context: ctxt }) = io.sourcing;
|
||||
else try {
|
||||
if (!context)
|
||||
context = userContext;
|
||||
context = userContext || ctxt;
|
||||
|
||||
context[EVAL_ERROR] = null;
|
||||
context[EVAL_STRING] = str;
|
||||
@@ -411,7 +412,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
}
|
||||
|
||||
if (!context)
|
||||
context = _userContext;
|
||||
context = _userContext || ctxt;
|
||||
return Cu.evalInSandbox(str, context, "1.8", fileName, lineNumber);
|
||||
},
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ var Mappings = Module("mappings", {
|
||||
description: "Accept a count before the requisite key press"
|
||||
},
|
||||
{
|
||||
names: ["-description", "-d"],
|
||||
names: ["-description", "-desc", "-d"],
|
||||
description: "A description of this mapping",
|
||||
default: "User-defined mapping",
|
||||
type: CommandOption.STRING
|
||||
|
||||
Reference in New Issue
Block a user