mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 10:07:59 +01:00
Manually add list of global object properties to global objects.
--HG-- extra : rebase_source : 53318cbfe4a044e6bbf9facb1ce6bc5933ba6fd9
This commit is contained in:
@@ -347,9 +347,15 @@ const CompletionContext = Class("CompletionContext", {
|
|||||||
this.lastActivated = this.top.runCount;
|
this.lastActivated = this.top.runCount;
|
||||||
}
|
}
|
||||||
if (!this.itemCache[this.key]) {
|
if (!this.itemCache[this.key]) {
|
||||||
let res = this._generate.call(this);
|
try {
|
||||||
if (res != null)
|
let res = this._generate.call(this);
|
||||||
this.itemCache[this.key] = res;
|
if (res != null)
|
||||||
|
this.itemCache[this.key] = res;
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
dactyl.reportError(e);
|
||||||
|
this.message = "Error: " + e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return this.itemCache[this.key];
|
return this.itemCache[this.key];
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
const modules = {};
|
const jsmodules = {}
|
||||||
|
const modules = { __proto__: jsmodules };
|
||||||
const BASE = "chrome://dactyl/content/";
|
const BASE = "chrome://dactyl/content/";
|
||||||
|
|
||||||
modules.modules = modules;
|
modules.modules = modules;
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Components.utils.import("resource://dactyl/" + script + ".jsm", modules);
|
Components.utils.import("resource://dactyl/" + script + ".jsm", jsmodules);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dump("dactyl: Loading script " + script + ": " + e.result + " " + e + "\n");
|
dump("dactyl: Loading script " + script + ": " + e.result + " " + e + "\n");
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ const JavaScript = Module("javascript", {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
let seen = {};
|
let seen = {};
|
||||||
for (let key in properties(obj, !toplevel)) {
|
let globals = values(toplevel && Class.objectGlobal(obj) === obj ? JavaScript.globalNames : []);
|
||||||
|
for (let key in iterAll(globals, properties(obj, !toplevel))) {
|
||||||
set.add(seen, key);
|
set.add(seen, key);
|
||||||
yield key;
|
yield key;
|
||||||
}
|
}
|
||||||
@@ -587,6 +588,17 @@ const JavaScript = Module("javascript", {
|
|||||||
*/
|
*/
|
||||||
completers: {},
|
completers: {},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of properties of the global object which are not
|
||||||
|
* enumerable by any standard method.
|
||||||
|
*/
|
||||||
|
globalNames: ["Array", "Boolean", "Date", "Error", "EvalError",
|
||||||
|
"Function", "Infinity", "Math", "NaN", "Number", "Object",
|
||||||
|
"RangeError", "ReferenceError", "RegExp", "String",
|
||||||
|
"SyntaxError", "TypeError", "URIError", "decodeURI",
|
||||||
|
"decodeURIComponent", "encodeURI", "encodeURIComponent", "eval",
|
||||||
|
"isFinite", "isNaN", "parseFloat", "parseInt", "undefined"],
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs argument string completers for a set of functions.
|
* Installs argument string completers for a set of functions.
|
||||||
* The second argument is an array of functions (or null
|
* The second argument is an array of functions (or null
|
||||||
|
|||||||
@@ -734,8 +734,9 @@ function Module(name, prototype) {
|
|||||||
defineModule.modules.push(instance);
|
defineModule.modules.push(instance);
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Cu.getGlobalForObject)
|
if (Cu.getGlobalForObject)
|
||||||
Module.callerGlobal = function (caller) {
|
Class.objectGlobal = function (caller) {
|
||||||
try {
|
try {
|
||||||
return Cu.getGlobalForObject(caller);
|
return Cu.getGlobalForObject(caller);
|
||||||
}
|
}
|
||||||
@@ -744,7 +745,7 @@ if (Cu.getGlobalForObject)
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
else
|
else
|
||||||
Module.callerGlobal = function (caller) {
|
Class.objectGlobal = function (caller) {
|
||||||
while (caller.__parent__)
|
while (caller.__parent__)
|
||||||
caller = caller.__parent__;
|
caller = caller.__parent__;
|
||||||
return caller;
|
return caller;
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ const Sanitizer = Module("sanitizer", tmp.Sanitizer, {
|
|||||||
function (key, event, arg) {
|
function (key, event, arg) {
|
||||||
if (event == name)
|
if (event == name)
|
||||||
params.action.apply(params, arg);
|
params.action.apply(params, arg);
|
||||||
}, Module.callerGlobal(params.action));
|
}, Class.objectGlobal(params.action));
|
||||||
|
|
||||||
if (params.privateEnter || params.privateLeave)
|
if (params.privateEnter || params.privateLeave)
|
||||||
storage.addObserver("private-mode",
|
storage.addObserver("private-mode",
|
||||||
@@ -111,7 +111,7 @@ const Sanitizer = Module("sanitizer", tmp.Sanitizer, {
|
|||||||
let meth = params[arg ? "privateEnter" : "privateLeave"];
|
let meth = params[arg ? "privateEnter" : "privateLeave"];
|
||||||
if (meth)
|
if (meth)
|
||||||
meth.call(params);
|
meth.call(params);
|
||||||
}, Module.callerGlobal(params.action));
|
}, Class.objectGlobal(params.action));
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: {
|
observe: {
|
||||||
|
|||||||
Reference in New Issue
Block a user