diff --git a/common/bootstrap.js b/common/bootstrap.js index 93f4d658..e029387c 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -207,6 +207,7 @@ function init() { let pref = "extensions.dactyl.cacheFlushCheck"; let val = addon.version + "-" + hardSuffix; if (!Services.prefs.prefHasUserValue(pref) || Services.prefs.getCharPref(pref) != val) { + var cacheFlush = true; Services.obs.notifyObservers(null, "startupcache-invalidate", ""); Services.prefs.setCharPref(pref, val); } @@ -244,6 +245,7 @@ function init() { JSMLoader.load(BOOTSTRAP_JSM, global); JSMLoader.init(suffix); + JSMLoader.cacheFlush = cacheFlush; JSMLoader.load("base.jsm", global); if (!(BOOTSTRAP_CONTRACT in Cc)) { diff --git a/common/content/buffer.js b/common/content/buffer.js index 156eb049..f6c8eb75 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1291,6 +1291,10 @@ var Buffer = Module("buffer", { if (!DOM(elem).isScrollable(horizontal ? "horizontal" : "vertical")) return false; + return this.canScroll(elem, dir, horizontal); + }, + + canScroll: function canScroll(elem, dir, horizontal) { let pos = "scrollTop", size = "clientHeight", max = "scrollHeight", layoutSize = "offsetHeight", overflow = "overflowX", border1 = "borderTopWidth", border2 = "borderBottomWidth"; if (horizontal) diff --git a/common/content/dactyl.js b/common/content/dactyl.js index f368786d..474f533b 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -111,6 +111,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { } }, + signals: { + "io.source": function ioSource(context, file, modTime) { + if (context.INFO) + help.flush("help/plugins.xml", modTime); + } + }, + profileName: deprecated("config.profileName", { get: function profileName() config.profileName }), /** @@ -484,8 +491,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { if (fileName && fileName[0] == "[") fileName = "dactyl://command-line/"; - - if (!context && fileName && fileName[0] !== "[") + else if (!context) context = ctxt || _userContext; if (isinstance(context, ["Sandbox"])) @@ -659,82 +665,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * @private * Initialize the help system. */ - initHelp: function initHelp(force) { + initHelp: function initHelp() { if ("noscriptOverlay" in window) noscriptOverlay.safeAllow("dactyl:", true, false); - if (!force && help.initialized) - return; - - help.initialize(force); - - // Process plugin help entries. - XML.ignoreWhiteSpace = XML.prettyPrinting = false; - - let body = XML(); - for (let [, context] in Iterator(plugins.contexts)) - try { - let info = contexts.getDocs(context); - if (info instanceof XML) { - if (info.*.@lang.length()) { - let lang = config.bestLocale(String(a) for each (a in info.*.@lang)); - - info.* = info.*.(function::attribute("lang").length() == 0 || @lang == lang); - - for each (let elem in info.NS::info) - for each (let attr in ["@name", "@summary", "@href"]) - if (elem[attr].length()) - info[attr] = elem[attr]; - } - body +=

{info.@summary}

+ - info; - } - } - catch (e) { - util.reportError(e); - } - - help.files["plugins"] = function () ['text/xml;charset=UTF-8', - '\n' + - '\n' + - '\n' + - -

{_("help.title.Using Plugins")}

- - - {body} -
.toXMLString()]; - - - default xml namespace = NS; - - help.overlays["index"] = ['text/xml;charset=UTF-8', - '\n' + - { - template.map(dactyl.indices, function ([name, iter]) -
{ - template.map(iter(), util.identity) - }
, <>{"\n\n"}) - }
]; - - help.overlays["gui"] = ['text/xml;charset=UTF-8', - '\n' + - -
{ - template.map(config.dialogs, function ([name, val]) - (!val[2] || val[2]()) - ? <>
{name}
{val[0]}
- : undefined, - <>{"\n"}) - }
-
]; - - help.tags["plugins"] = help.tags["plugins.xml"] = "plugins"; - help.tags["index"] = help.tags["index.xml"] = "index"; - - help.addTags("plugins", util.httpGet("dactyl://help/plugins").responseXML); - help.addTags("index", util.httpGet("dactyl://help-overlay/index").responseXML); + help.initialize(); }, stringifyXML: function (xml) { @@ -1280,6 +1215,73 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { }, { toolbarHidden: function hidden(elem) (elem.getAttribute("autohide") || elem.getAttribute("collapsed")) == "true" }, { + cache: function () { + cache.register("help/plugins.xml", function () { + // Process plugin help entries. + XML.ignoreWhiteSpace = XML.prettyPrinting = false; + + let body = XML(); + for (let [, context] in Iterator(plugins.contexts)) + try { + let info = contexts.getDocs(context); + if (info instanceof XML) { + if (info.*.@lang.length()) { + let lang = config.bestLocale(String(a) for each (a in info.*.@lang)); + + info.* = info.*.(function::attribute("lang").length() == 0 || @lang == lang); + + for each (let elem in info.NS::info) + for each (let attr in ["@name", "@summary", "@href"]) + if (elem[attr].length()) + info[attr] = elem[attr]; + } + body +=

{info.@summary}

+ + info; + } + } + catch (e) { + util.reportError(e); + } + + return '\n' + + '\n' + + '\n' + + +

{_("help.title.Using Plugins")}

+ + + {body} +
.toXMLString(); + }); + + cache.register("help/index.xml", function () { + default xml namespace = NS; + + return '\n' + + { + template.map(dactyl.indices, function ([name, iter]) +
{ + template.map(iter(), util.identity) + }
, <>{"\n\n"}) + }
; + }); + + cache.register("help/gui.xml", function () { + default xml namespace = NS; + + return '\n' + + +
{ + template.map(config.dialogs, function ([name, val]) + (!val[2] || val[2]()) + ? <>
{name}
{val[0]}
+ : undefined, + <>{"\n"}) + }
+
; + }); + }, events: function () { events.listen(window, dactyl, "events", true); }, diff --git a/common/content/modes.js b/common/content/modes.js index ae26b090..7443873d 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -213,57 +213,18 @@ var Modes = Module("modes", { } }); - - function makeTree() { - let list = modes.all.filter(function (m) m.name !== m.description); - - let tree = {}; - - for (let mode in values(list)) - tree[mode.name] = {}; - - for (let mode in values(list)) - for (let base in values(mode.bases)) - tree[base.name][mode.name] = tree[mode.name]; - - let roots = iter([m.name, tree[m.name]] for (m in values(list)) if (!m.bases.length)).toObject(); - - default xml namespace = NS; - function rec(obj) { - XML.ignoreWhitespace = XML.prettyPrinting = false; - - let res =