summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2014-02-17 14:33:00 -0800
committerKris Maglione <maglione.k@gmail.com>2014-02-17 14:33:00 -0800
commit512b01d57468d990305b369a794ff0564806285f (patch)
tree9906c31420016a81033b29e3498a465d205bc5ad /common
parent48177b740568ffc9a891b2e0699ee59178072034 (diff)
downloadpentadactyl-512b01d57468d990305b369a794ff0564806285f.tar.gz
Flush literals from cache on :rehash.
Diffstat (limited to 'common')
-rw-r--r--common/modules/base.jsm10
-rw-r--r--common/modules/cache.jsm12
-rw-r--r--common/modules/util.jsm1
3 files changed, 19 insertions, 4 deletions
diff --git a/common/modules/base.jsm b/common/modules/base.jsm
index b8e0cedc..58e1744e 100644
--- a/common/modules/base.jsm
+++ b/common/modules/base.jsm
@@ -972,8 +972,16 @@ Class.prototype = {
util.rehashing && !isinstance(Cu.getGlobalForObject(callback), ["BackstagePass"]))
return;
this.timeouts.splice(this.timeouts.indexOf(timer), 1);
- util.trapErrors(callback, this);
+ try {
+ callback.call(this);
+ }
+ catch (e) {
+ util.dump("Error invoking timer callback registered at " +
+ [frame.filename, frame.lineNumber, ""].join(":"));
+ Cu.reportError(e);
+ }
};
+ let frame = Cs.caller;
let timer = services.Timer(timeout_notify, timeout || 0, services.Timer.TYPE_ONE_SHOT);
this.timeouts.push(timer);
return timer;
diff --git a/common/modules/cache.jsm b/common/modules/cache.jsm
index ca5d6dd6..25bbdf12 100644
--- a/common/modules/cache.jsm
+++ b/common/modules/cache.jsm
@@ -138,9 +138,15 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
}
}),
- flush: function flush() {
- this.storage.clear();
- this.flushDiskCache();
+ flush: function flush(filter) {
+ if (filter) {
+ this.storage.keys().filter(filter)
+ .forEach(bind("remove", this.storage));
+ }
+ else {
+ this.storage.clear();
+ this.flushDiskCache();
+ }
},
flushDiskCache: function flushDiskCache() {
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index beab864d..cc7a10e9 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -1366,6 +1366,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
storage.storeForSession("commandlineArgs", args);
this.timeout(function () {
this.flushCache();
+ cache.flush(bind("test", /^literal:/));
this.rehashing = true;
let addon = config.addon;
addon.userDisabled = true;