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