From b7fa2f904d6c6db252f0520808f4a92584942a49 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 28 Nov 2012 00:15:06 -0800 Subject: [PATCH] Death to E4X and stuff. --- common/modules/base.jsm | 38 +++++++-------------- common/modules/bookmarkcache.jsm | 2 +- common/modules/bootstrap.jsm | 4 +-- common/modules/buffer.jsm | 4 +-- common/modules/cache.jsm | 2 +- common/modules/commands.jsm | 58 +++++++++++++++----------------- 6 files changed, 46 insertions(+), 62 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(, 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(, + 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(
, 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(, + 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 = - - - - - - - - - - { - template.map(hives, function ([hive, cmds]) let (i = 0) - + - template.map(cmds, function (cmd) - - - - - - - - - ) + - ) - } -
- {_("title.Name")}{_("title.Args")}{_("title.Range")}{_("title.Complete")}{_("title.Definition")}
{!i++ ? hive.name : ""}{cmd.bang ? "!" : " "}{cmd.name}{cmd.argCount}{cmd.count ? "0c" : ""}{completerToString(cmd.completer)}{cmd.replacementText || "function () { ... }"}
; + 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); } }),