diff options
author | Kris Maglione <maglione.k@gmail.com> | 2012-11-28 00:15:06 -0800 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2012-11-28 00:15:06 -0800 |
commit | b7fa2f904d6c6db252f0520808f4a92584942a49 (patch) | |
tree | c5565124bab04f62c8e510faadaa7be53072b395 | |
parent | 9c1dc28cc9d8c0908ac986427ff37c65ed1eb93f (diff) | |
download | pentadactyl-b7fa2f904d6c6db252f0520808f4a92584942a49.tar.gz |
Death to E4X and stuff.
-rw-r--r-- | common/modules/base.jsm | 38 | ||||
-rw-r--r-- | common/modules/bookmarkcache.jsm | 2 | ||||
-rw-r--r-- | common/modules/bootstrap.jsm | 4 | ||||
-rw-r--r-- | common/modules/buffer.jsm | 4 | ||||
-rw-r--r-- | common/modules/cache.jsm | 2 | ||||
-rw-r--r-- | common/modules/commands.jsm | 60 |
6 files changed, 47 insertions, 63 deletions
diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 89829b1b..203c1558 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -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_"))); diff --git a/common/modules/bookmarkcache.jsm b/common/modules/bookmarkcache.jsm index db2159cc..cedf7bd9 100644 --- a/common/modules/bookmarkcache.jsm +++ b/common/modules/bookmarkcache.jsm @@ -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"], diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index a672d196..4dc07382 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -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)); diff --git a/common/modules/buffer.jsm b/common/modules/buffer.jsm index 267ceed9..ff65d129 100644 --- a/common/modules/buffer.jsm +++ b/common/modules/buffer.jsm @@ -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); diff --git a/common/modules/cache.jsm b/common/modules/cache.jsm index 384e0cba..f48d22e3 100644 --- a/common/modules/cache.jsm +++ b/common/modules/cache.jsm @@ -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"], diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 48fd43e1..417d09b8 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -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>; - - if (list.*.length() === list.text().length() + 2) - dactyl.echomsg(_("command.none")); - else - commandline.commandOutput(list); + 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;" }]])]; + + // E4X-FIXME + // if (list.*.length() === list.text().length() + 2) + // dactyl.echomsg(_("command.none")); + // else + commandline.commandOutput(list); } }), |