mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-07 00:04:12 +01:00
Death to E4X and stuff.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
var { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
|
||||
@@ -146,7 +146,7 @@ defineModule("base", {
|
||||
"debuggerProperties", "defineModule", "deprecated", "endModule", "forEach", "isArray",
|
||||
"isGenerator", "isinstance", "isObject", "isString", "isSubclass", "isXML", "iter", "iterAll",
|
||||
"iterOwnProperties", "keys", "memoize", "octal", "properties", "require", "set", "update",
|
||||
"values", "withCallerGlobal"
|
||||
"values"
|
||||
]
|
||||
});
|
||||
|
||||
@@ -573,18 +573,6 @@ function memoize(obj, key, getter) {
|
||||
|
||||
let sandbox = Cu.Sandbox(Cu.getGlobalForObject(this));
|
||||
sandbox.__proto__ = this;
|
||||
/**
|
||||
* Wraps a function so that when called, the global object of the caller
|
||||
* is prepended to its arguments.
|
||||
*/
|
||||
// Hack to get around lack of access to caller in strict mode.
|
||||
var withCallerGlobal = Cu.evalInSandbox(<![CDATA[
|
||||
(function withCallerGlobal(fn)
|
||||
function withCallerGlobal_wrapped()
|
||||
fn.apply(this,
|
||||
[Class.objectGlobal(withCallerGlobal_wrapped.caller)]
|
||||
.concat(Array.slice(arguments))))
|
||||
]]>, Cu.Sandbox(Cu.getGlobalForObject(this)), "1.8");
|
||||
|
||||
/**
|
||||
* Updates an object with the properties of another object. Getters
|
||||
@@ -677,17 +665,17 @@ function Class() {
|
||||
return res !== undefined ? res : self;
|
||||
};
|
||||
else
|
||||
var Constructor = eval(String.replace(<![CDATA[
|
||||
(function constructor(PARAMS) {
|
||||
var self = Object.create(Constructor.prototype);
|
||||
self.instance = self;
|
||||
|
||||
if ("_metaInit_" in self && self._metaInit_)
|
||||
self._metaInit_.apply(self, arguments);
|
||||
|
||||
var res = self.init.apply(self, arguments);
|
||||
return res !== undefined ? res : self;
|
||||
})]]>,
|
||||
var Constructor = eval(String.replace('\n\
|
||||
(function constructor(PARAMS) { \n\
|
||||
var self = Object.create(Constructor.prototype); \n\
|
||||
self.instance = self; \n\
|
||||
\n\
|
||||
if ("_metaInit_" in self && self._metaInit_) \n\
|
||||
self._metaInit_.apply(self, arguments); \n\
|
||||
\n\
|
||||
var res = self.init.apply(self, arguments); \n\
|
||||
return res !== undefined ? res : self; \n\
|
||||
})',
|
||||
"constructor", (name || superclass.className).replace(/\W/g, "_"))
|
||||
.replace("PARAMS", /^function .*?\((.*?)\)/.exec(args[0] && args[0].init || Class.prototype.init)[1]
|
||||
.replace(/\b(self|res|Constructor)\b/g, "$1_")));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
defineModule("bookmarkcache", {
|
||||
exports: ["Bookmark", "BookmarkCache", "Keyword", "bookmarkcache"],
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["require"];
|
||||
|
||||
// Deal with cross-compartment XML passing issues.
|
||||
function create(proto) Object.create(proto);
|
||||
function import(obj) {
|
||||
this["import"] = function import_(obj) {
|
||||
let res = {};
|
||||
for each (let key in Object.getOwnPropertyNames(obj))
|
||||
Object.defineProperty(res, key, Object.getOwnPropertyDescriptor(obj, key));
|
||||
|
||||
@@ -868,7 +868,7 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
// add the frame indicator
|
||||
let doc = frames[next].document;
|
||||
let indicator = DOM(<div highlight="FrameIndicator"/>, doc)
|
||||
let indicator = DOM(["div", { highlight: "FrameIndicator" }], doc)
|
||||
.appendTo(doc.body || doc.documentElement || doc);
|
||||
|
||||
util.timeout(function () { indicator.remove(); }, 500);
|
||||
@@ -1533,7 +1533,7 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
_exWidth: function _exWidth(elem) {
|
||||
try {
|
||||
let div = DOM(<elem style="width: 1ex !important; position: absolute !important; padding: 0 !important; display: block;"/>,
|
||||
let div = DOM(["elem", { style: "width: 1ex !important; position: absolute !important; padding: 0 !important; display: block;" }],
|
||||
elem.ownerDocument).appendTo(elem.body || elem);
|
||||
try {
|
||||
return parseFloat(div.style.width);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
/* use strict */
|
||||
"use strict";
|
||||
|
||||
defineModule("cache", {
|
||||
exports: ["Cache", "cache"],
|
||||
|
||||
@@ -753,38 +753,34 @@ var Commands = Module("commands", {
|
||||
|
||||
let hives = (hives || this.userHives).map(function (h) [h, cmds(h)]).filter(function ([h, c]) c.length);
|
||||
|
||||
let list = <table>
|
||||
<tr highlight="Title">
|
||||
<td/>
|
||||
<td style="padding-right: 1em;"></td>
|
||||
<td style="padding-right: 1ex;">{_("title.Name")}</td>
|
||||
<td style="padding-right: 1ex;">{_("title.Args")}</td>
|
||||
<td style="padding-right: 1ex;">{_("title.Range")}</td>
|
||||
<td style="padding-right: 1ex;">{_("title.Complete")}</td>
|
||||
<td style="padding-right: 1ex;">{_("title.Definition")}</td>
|
||||
</tr>
|
||||
<col style="min-width: 6em; padding-right: 1em;"/>
|
||||
{
|
||||
template.map(hives, function ([hive, cmds]) let (i = 0)
|
||||
<tr style="height: .5ex;"/> +
|
||||
template.map(cmds, function (cmd)
|
||||
<tr>
|
||||
<td highlight="Title">{!i++ ? hive.name : ""}</td>
|
||||
<td>{cmd.bang ? "!" : " "}</td>
|
||||
<td>{cmd.name}</td>
|
||||
<td>{cmd.argCount}</td>
|
||||
<td>{cmd.count ? "0c" : ""}</td>
|
||||
<td>{completerToString(cmd.completer)}</td>
|
||||
<td>{cmd.replacementText || "function () { ... }"}</td>
|
||||
</tr>) +
|
||||
<tr style="height: .5ex;"/>)
|
||||
}
|
||||
</table>;
|
||||
let list = ["table", {},
|
||||
["tr", { highlight: "Title" },
|
||||
["td"],
|
||||
["td", { style: "padding-right: 1em;" }],
|
||||
["td", { style: "padding-right: 1ex;" }, _("title.Name")],
|
||||
["td", { style: "padding-right: 1ex;" }, _("title.Args")],
|
||||
["td", { style: "padding-right: 1ex;" }, _("title.Range")],
|
||||
["td", { style: "padding-right: 1ex;" }, _("title.Complete")],
|
||||
["td", { style: "padding-right: 1ex;" }, _("title.Definition")]],
|
||||
["col", { style: "min-width: 6em; padding-right: 1em;" }],
|
||||
hives.map(function ([hive, cmds]) let (i = 0) [
|
||||
["tr", { style: "height: .5ex;" }],
|
||||
cmds.map(function (cmd)
|
||||
["tr", {},
|
||||
["td", { highlight: "Title" }, !i++ ? hive.name : ""],
|
||||
["td", {}, cmd.bang ? "!" : " "],
|
||||
["td", {}, cmd.name],
|
||||
["td", {}, cmd.argCount],
|
||||
["td", {}, cmd.count ? "0c" : ""],
|
||||
["td", {}, completerToString(cmd.completer)],
|
||||
["td", {}, cmd.replacementText || "function () { ... }"]]),
|
||||
["tr", { style: "height: .5ex;" }]])];
|
||||
|
||||
if (list.*.length() === list.text().length() + 2)
|
||||
dactyl.echomsg(_("command.none"));
|
||||
else
|
||||
commandline.commandOutput(list);
|
||||
// E4X-FIXME
|
||||
// if (list.*.length() === list.text().length() + 2)
|
||||
// dactyl.echomsg(_("command.none"));
|
||||
// else
|
||||
commandline.commandOutput(list);
|
||||
}
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user