mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 07:28:00 +01:00
Flush the startup cache when re-sourcing a JS file.
This commit is contained in:
@@ -1756,6 +1756,11 @@ var Buffer = Module("buffer", {
|
||||
if (isinstance(services.focus.activeWindow.document.activeElement,
|
||||
[HTMLInputElement, HTMLButtonElement, Ci.nsIDOMXULButtonElement]))
|
||||
return Events.PASS;
|
||||
|
||||
if (isinstance(buffer.focusedFrame.document.activeElement,
|
||||
[HTMLInputElement, HTMLButtonElement, Ci.nsIDOMXULButtonElement]))
|
||||
return Events.PASS;
|
||||
|
||||
buffer.scrollVertical("pages", Math.max(args.count, 1));
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
@@ -170,6 +170,9 @@ var IO = Module("io", {
|
||||
if (/\.js$/.test(filename)) {
|
||||
try {
|
||||
var context = contexts.Script(file, params.group);
|
||||
if (Set.has(this._scriptNames, file.path))
|
||||
util.flushCache();
|
||||
|
||||
dactyl.loadScript(uri.spec, context);
|
||||
dactyl.helpInitialized = false;
|
||||
}
|
||||
@@ -198,8 +201,7 @@ var IO = Module("io", {
|
||||
});
|
||||
}
|
||||
|
||||
if (this._scriptNames.indexOf(file.path) == -1)
|
||||
this._scriptNames.push(file.path);
|
||||
Set.add(this._scriptNames, file.path);
|
||||
|
||||
dactyl.echomsg(_("io.sourcingEnd", filename.quote()), 2);
|
||||
dactyl.log(_("dactyl.sourced", filename), 3);
|
||||
@@ -780,12 +782,13 @@ unlet s:cpo_save
|
||||
commands.add(["scrip[tnames]"],
|
||||
"List all sourced script names",
|
||||
function () {
|
||||
if (!io._scriptNames.length)
|
||||
let names = Object.keys(io._scriptNames);
|
||||
if (!names.length)
|
||||
dactyl.echomsg(_("command.scriptnames.none"));
|
||||
else
|
||||
modules.commandline.commandOutput(
|
||||
template.tabular(["<SNR>", "Filename"], ["text-align: right; padding-right: 1em;"],
|
||||
([i + 1, file] for ([i, file] in Iterator(io._scriptNames)))));
|
||||
([i + 1, file] for ([i, file] in Iterator(names)))));
|
||||
|
||||
},
|
||||
{ argCount: "0" });
|
||||
|
||||
@@ -1652,6 +1652,13 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
}())
|
||||
}),
|
||||
|
||||
/**
|
||||
* Flushes the startup cache.
|
||||
*/
|
||||
flushCache: function flushCache() {
|
||||
services.observer.notifyObservers(null, "startupcache-invalidate", "");
|
||||
},
|
||||
|
||||
/**
|
||||
* Reloads dactyl in entirety by disabling the add-on and
|
||||
* re-enabling it.
|
||||
@@ -1659,7 +1666,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
rehash: function (args) {
|
||||
storage.session.commandlineArgs = args;
|
||||
this.timeout(function () {
|
||||
services.observer.notifyObservers(null, "startupcache-invalidate", "");
|
||||
this.flushCache();
|
||||
this.rehashing = true;
|
||||
let addon = config.addon;
|
||||
addon.userDisabled = true;
|
||||
|
||||
Reference in New Issue
Block a user