diff --git a/common/content/modes.js b/common/content/modes.js index 4976db15..bdac8a26 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -640,7 +640,7 @@ var Modes = Module("modes", { options.add(["showmode", "smd"], "Show the current mode in the command line when it matches this expression", - "stringlist", "!normal,base", + "stringlist", "caret,output_multiline,!normal,base", opts); }, prefs: function initPrefs() { diff --git a/common/modules/base.jsm b/common/modules/base.jsm index f39f17bf..a57f04ed 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -142,6 +142,7 @@ function defineModule(name, params, module) { use[mod].push(module); } currentModule = module; + module.startTime = Date.now(); } defineModule.loadLog = []; @@ -163,7 +164,6 @@ defineModule.dump = function dump_() { .replace(/^./gm, name + ": $&")); } defineModule.modules = []; -defineModule.times = { all: 0 }; defineModule.time = function time(major, minor, func, self) { let time = Date.now(); if (typeof func !== "function") @@ -176,13 +176,7 @@ defineModule.time = function time(major, minor, func, self) { loaded.util && util.reportError(e); } - let delta = Date.now() - time; - defineModule.times.all += delta; - defineModule.times[major] = (defineModule.times[major] || 0) + delta; - if (minor) { - defineModule.times[":" + minor] = (defineModule.times[":" + minor] || 0) + delta; - defineModule.times[major + ":" + minor] = (defineModule.times[major + ":" + minor] || 0) + delta; - } + JSMLoader.times.add(major, minor, Date.now() - time); return res; } diff --git a/common/modules/bookmarkcache.jsm b/common/modules/bookmarkcache.jsm index 8f12b6a4..e85a7c6c 100644 --- a/common/modules/bookmarkcache.jsm +++ b/common/modules/bookmarkcache.jsm @@ -151,7 +151,6 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), { return this.rootFolders.indexOf(root) >= 0; }, - // Should be made thread safe. load: function load() { let bookmarks = {}; diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index 005ba162..6945b05b 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -32,6 +32,26 @@ else manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar), stale: JSMLoader ? JSMLoader.stale : {}, suffix: "", + + times: { + all: 0, + add: function add(major, minor, delta) { + this.all += delta; + + this[major] = (this[major] || 0) + delta; + if (minor) { + minor = ":" + minor; + this[minor] = (this[minor] || 0) + delta; + this[major + minor] = (this[major + minor] || 0) + delta; + } + }, + clear: function clear() { + for (let key in this) + if (typeof this[key] !== "number") + delete this[key]; + } + }, + init: function init(suffix) { this.initialized = true; this.suffix = suffix || ""; @@ -41,6 +61,7 @@ else this.global.JSMLoader = this; base.JSMLoader = this; }, + getTarget: function getTarget(url) { if (url.indexOf(":") === -1) url = "resource://dactyl" + this.suffix + "/" + url; @@ -49,6 +70,7 @@ else chan.cancel(Components.results.NS_BINDING_ABORTED); return chan.name; }, + load: function load(name, target) { let url = name; if (url.indexOf(":") === -1) @@ -68,7 +90,12 @@ else } try { + let now = Date.now(); let global = Components.utils.import(url, target); + + if (!(name in this.globals)) + this.times.add("require", name, Date.now() - now); + return this.globals[name] = global; } catch (e) { @@ -76,11 +103,18 @@ else throw e; } }, - loadSubScript: function loadSubScript() this.loader.loadSubScript.apply(this.loader, arguments), + + loadSubScript: function loadSubScript(script) { + let now = Date.now(); + this.loader.loadSubScript.apply(this.loader, arguments); + this.times.add("loadSubScript", script, Date.now() - now); + }, + cleanup: function unregister() { for each (let factory in this.factories.splice(0)) this.manager.unregisterFactory(factory.classID, factory); }, + purge: function purge() { dump("dactyl: JSMLoader: purge\n"); diff --git a/common/modules/services.jsm b/common/modules/services.jsm index 29acc7b0..dbfe8f90 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -59,6 +59,7 @@ var Services = Module("Services", { this.add("stylesheet", "@mozilla.org/content/style-sheet-service;1", "nsIStyleSheetService"); this.add("subscriptLoader", "@mozilla.org/moz/jssubscript-loader;1", "mozIJSSubScriptLoader"); this.add("tagging", "@mozilla.org/browser/tagging-service;1", "nsITaggingService"); + this.add("tld", "@mozilla.org/network/effective-tld-service;1", "nsIEffectiveTLDService"); this.add("threading", "@mozilla.org/thread-manager;1", "nsIThreadManager"); this.add("urifixup", "@mozilla.org/docshell/urifixup;1", "nsIURIFixup"); this.add("versionCompare", "@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator");