[Pkg-mozext-commits] [itsalltext] 39/459: Added cache cleaning on page deletion
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:26:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository itsalltext.
commit e38b478bcaab9d02d62830a7fda4e5c3f2209495
Author: Christian Höltje <docwhat at gerf.org>
Date: Thu Dec 28 11:34:57 2006 -0500
Added cache cleaning on page deletion
---
chrome/content/itsalltext.js | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/chrome/content/itsalltext.js b/chrome/content/itsalltext.js
index 5163cb9..cb6138a 100644
--- a/chrome/content/itsalltext.js
+++ b/chrome/content/itsalltext.js
@@ -68,7 +68,6 @@ function ItsAllTextOverlay() {
* @type Hash
*/
var cache = {};
- // @todo The cache should periodically be cleaned up.
/**
* Keeps track of all the refreshes we are running.
@@ -462,6 +461,25 @@ function ItsAllTextOverlay() {
};
/**
+ * Cleans out all old cache objects.
+ */
+ that.cleanCacheObjs = function() {
+ var count = 0;
+ for(var id in cache) {
+ var cobj = cache[id];
+ if (cobj.node.ownerDocument.location === null) {
+ that.debug('cleaning %s', id);
+ delete cobj.node;
+ delete cobj.button;
+ delete cache[id];
+ } else {
+ count += 1;
+ }
+ }
+ that.debug('cache count: %s', count);
+ };
+
+ /**
* Refresh Textarea.
* @param {Object} node A specific textarea dom object to update.
*/
@@ -598,6 +616,7 @@ function ItsAllTextOverlay() {
that.refreshDocument(doc);
} else {
that.debug('document %s (cancelled)', id);
+ that.cleanCacheObjs();
clearInterval(id);
}
}, that.getRefresh());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/itsalltext.git
More information about the Pkg-mozext-commits
mailing list