diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-02-03 09:06:52 -0500 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-02-03 09:06:52 -0500 |
commit | e470de350c95c62ce0a7e15fd0e043445d448556 (patch) | |
tree | f0f6672c35d09afe4d04bbe20190db879a6f16bc | |
parent | 4a09c97eb1dd5db2d300e17bde15bd88563616f9 (diff) | |
download | pentadactyl-e470de350c95c62ce0a7e15fd0e043445d448556.tar.gz |
Revert last revision.
-rw-r--r-- | common/content/buffer.js | 6 | ||||
-rw-r--r-- | common/content/commands.js | 36 | ||||
-rw-r--r-- | common/content/mappings.js | 6 | ||||
-rw-r--r-- | common/content/marks.js | 2 | ||||
-rw-r--r-- | common/content/options.js | 4 | ||||
-rw-r--r-- | common/content/tabs.js | 2 | ||||
-rw-r--r-- | common/modules/base.jsm | 3 | ||||
-rw-r--r-- | common/modules/completion.jsm | 2 | ||||
-rw-r--r-- | common/modules/finder.jsm | 2 | ||||
-rw-r--r-- | common/modules/overlay.jsm | 42 |
10 files changed, 39 insertions, 66 deletions
diff --git a/common/content/buffer.js b/common/content/buffer.js index 1357afd6..9c5f3031 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1640,9 +1640,9 @@ var Buffer = Module("buffer", { }; }, events: function () { - events.addSessionListener(config.browser, "DOMContentLoaded", buffer.closure.onDOMContentLoaded, true); - events.addSessionListener(config.browser, "load", buffer.closure.onPageLoad, true); - events.addSessionListener(config.browser, "scroll", buffer.closure._updateBufferPosition, false); + events.addSessionListener(config.browser, "DOMContentLoaded", this.closure.onDOMContentLoaded, true); + events.addSessionListener(config.browser, "load", this.closure.onPageLoad, true); + events.addSessionListener(config.browser, "scroll", this.closure._updateBufferPosition, false); }, mappings: function () { var myModes = config.browserModes; diff --git a/common/content/commands.js b/common/content/commands.js index fcb19500..095f9e4b 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -468,7 +468,7 @@ var Commands = Module("commands", { _addCommand: function (args, replace) { if (!args[3]) args[3] = {}; - args[3].definedAt = Commands.getCaller(Components.stack.caller.caller); + args[3].definedAt = commands.getCaller(Components.stack.caller.caller); let names = array.flatten(Command.parseSpecs(args[0])); args.parsedSpecs = names; @@ -660,6 +660,23 @@ var Commands = Module("commands", { }, /** + * Returns a frame object describing the currently executing + * command, if applicable, otherwise returns the passed frame. + * + * @param {nsIStackFrame} frame + */ + getCaller: function (frame) { + if (io.sourcing) + return { + __proto__: frame, + filename: io.sourcing.file[0] == "[" ? io.sourcing.file : + services.io.newFileURI(File(io.sourcing.file)).spec, + lineNumber: io.sourcing.line + }; + return frame; + }, + + /** * Returns true if a command invocation contains a URL referring to the * domain *host*. * @@ -1162,23 +1179,6 @@ var Commands = Module("commands", { delete this._exMap[name]; } }, { - /** - * Returns a frame object describing the currently executing - * command, if applicable, otherwise returns the passed frame. - * - * @param {nsIStackFrame} frame - */ - getCaller: function (frame) { - if (io.sourcing) - return { - __proto__: frame, - filename: io.sourcing.file[0] == "[" ? io.sourcing.file : - services.io.newFileURI(File(io.sourcing.file)).spec, - lineNumber: io.sourcing.line - }; - return frame; - }, - // returns [count, parsed_argument] parseArg: function parseArg(str, sep, keepQuotes) { let arg = ""; diff --git a/common/content/mappings.js b/common/content/mappings.js index dd19bda4..02bd1847 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -172,7 +172,7 @@ var MapHive = Class("MapHive", { extra = extra || {}; let map = Map(modes, keys, description, action, extra); - map.definedAt = Commands.getCaller(Components.stack.caller); + map.definedAt = commands.getCaller(Components.stack.caller); map.hive = this; if (this.name !== "builtin") @@ -344,7 +344,7 @@ var Mappings = Module("mappings", { */ add: function () { let map = this.builtin.add.apply(this.builtin, arguments); - map.definedAt = Commands.getCaller(Components.stack.caller); + map.definedAt = commands.getCaller(Components.stack.caller); return map; }, @@ -361,7 +361,7 @@ var Mappings = Module("mappings", { */ addUserMap: function () { let map = this.user.add.apply(this.user, arguments); - map.definedAt = Commands.getCaller(Components.stack.caller); + map.definedAt = commands.getCaller(Components.stack.caller); return map; }, diff --git a/common/content/marks.js b/common/content/marks.js index 729e23ac..30dcedbb 100644 --- a/common/content/marks.js +++ b/common/content/marks.js @@ -208,7 +208,7 @@ var Marks = Module("marks", { events: function () { let appContent = document.getElementById("appcontent"); if (appContent) - events.addSessionListener(appContent, "load", marks.closure._onPageLoad, true); + events.addSessionListener(appContent, "load", this.closure._onPageLoad, true); }, mappings: function () { var myModes = config.browserModes; diff --git a/common/content/options.js b/common/content/options.js index 18aa4097..9c691d5a 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -660,7 +660,7 @@ var Options = Module("options", { if (!extraInfo) extraInfo = {}; - extraInfo.definedAt = Commands.getCaller(Components.stack.caller); + extraInfo.definedAt = commands.getCaller(Components.stack.caller); let name = names[0]; if (name in this._optionMap) { @@ -973,7 +973,7 @@ var Options = Module("options", { } if (res) dactyl.echoerr(res); - option.setFrom = Commands.getCaller(null); + option.setFrom = commands.getCaller(null); } } flushList(); diff --git a/common/content/tabs.js b/common/content/tabs.js index b366c51e..49add59a 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -875,7 +875,7 @@ var Tabs = Module("tabs", { } for (let event in values(["TabMove", "TabOpen", "TabClose"])) events.addSessionListener(tabContainer, event, callback, false); - events.addSessionListener(tabContainer, "TabSelect", tabs.closure._onTabSelect, false); + events.addSessionListener(tabContainer, "TabSelect", this.closure._onTabSelect, false); }, mappings: function () { mappings.add([modes.NORMAL], ["g0", "g^"], diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 020fbbb5..92f8655a 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -147,9 +147,6 @@ defineModule.modules = []; defineModule.times = { all: 0 }; defineModule.time = function time(major, minor, func, self) { let time = Date.now(); - if (typeof func !== "function") - func = self[func]; - try { var res = func.apply(self, Array.slice(arguments, 4)); } diff --git a/common/modules/completion.jsm b/common/modules/completion.jsm index 1b788d4d..ab2a8a74 100644 --- a/common/modules/completion.jsm +++ b/common/modules/completion.jsm @@ -844,7 +844,7 @@ var Completion = Module("completion", { get setFunctionCompleter() JavaScript.setCompleter, // Backward compatibility Local: function (dactyl, modules, window) ({ - get options() modules.options, + options: modules.options, // FIXME _runCompleter: function _runCompleter(name, filter, maxItems) { diff --git a/common/modules/finder.jsm b/common/modules/finder.jsm index a5b9280d..45d98e24 100644 --- a/common/modules/finder.jsm +++ b/common/modules/finder.jsm @@ -162,7 +162,7 @@ var RangeFinder = Module("rangefinder", { }, { }, { modes: function (dactyl, modules, window) { - const { modes } = modules; + const { commandline, modes } = modules; modes.addMode("FIND", { extended: true, description: "Find mode, active when typing search input", diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm index e7dd2afe..d9165085 100644 --- a/common/modules/overlay.jsm +++ b/common/modules/overlay.jsm @@ -246,11 +246,9 @@ var Overlay = Module("Overlay", { defineModule.loadLog.push(" from: " + util.fixURI(frame.filename) + ":" + frame.lineNumber); delete modules[module.className]; - // util.dump("INIT: " + module.className); modules[module.className] = defineModule.time(module.className, "init", module); - frob(module.className); - // init(modules[module.className]); + init(modules[module.className]); } catch (e) { util.dump("Loading " + (module && module.className) + ":"); @@ -259,38 +257,16 @@ var Overlay = Module("Overlay", { return modules[module.className]; } - Module.list.forEach(function (mod) { - Object.keys(mod.prototype.INIT).forEach(function (name) { - deferredInit[name] = deferredInit[name] || []; - deferredInit[name].push(function () { - // util.dump("INIT: " + mod.className + ":" + name); - defineModule.time(mod.className, name, - name, mod.prototype.INIT, - modules.dactyl, modules, window); - }); - }); - }); - defineModule.modules.forEach(function (mod) { - Object.keys(mod.INIT).forEach(function (name) { - deferredInit[name] = deferredInit[name] || []; - deferredInit[name].push(function () { - // util.dump("INIT: " + mod.constructor.className + ":" + name); - defineModule.time(mod.constructor.className, name, - mod.INIT[name], mod, - modules.dactyl, modules, window); - }); - }); - }); - - function frob(name) { - (deferredInit[name] || []).forEach(call); - } + for each (let module in defineModule.modules) + if (module.INIT.init) + defineModule.time(module.constructor.className, "init", + module.INIT.init, module, + modules.dactyl, modules, window); - frob("init"); - defineModule.modules.forEach(function (mod) { frob(mod.className); }); + defineModule.modules.map(init); - // Module.list.forEach(load); - frob("load"); + Module.list.forEach(load); + deferredInit["load"].forEach(call); modules.times = update({}, defineModule.times); defineModule.loadLog.push("Loaded in " + (Date.now() - start) + "ms"); |