[Pkg-mozext-commits] [itsalltext] 293/459: checkpoint
David Prévot
taffit at moszumanska.debian.org
Tue Feb 24 23:26:31 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 cc97e893041939945575c1e023f0ed5e088844cf
Author: Christian Höltje <docwhat at gerf.org>
Date: Fri Nov 9 23:32:06 2007 -0500
checkpoint
---
src/chrome/content/cacheobj.js | 2 +-
src/chrome/content/itsalltext.js | 9 +++++++--
src/chrome/content/monitor.js | 36 ++++++++++++++++++++++++++----------
src/install.rdf | 7 +------
4 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/src/chrome/content/cacheobj.js b/src/chrome/content/cacheobj.js
index a4e1d37..41fe9af 100644
--- a/src/chrome/content/cacheobj.js
+++ b/src/chrome/content/cacheobj.js
@@ -529,7 +529,7 @@ CacheObj.prototype.onContext = function(event) {
*
* Excuse me while I scream.
*
- * See Mozilla bugs:
+ * See Mozilla bugs:
* https://bugzilla.mozilla.org/show_bug.cgi?id=287357
* https://bugzilla.mozilla.org/show_bug.cgi?id=291083
*/
diff --git a/src/chrome/content/itsalltext.js b/src/chrome/content/itsalltext.js
index 2948970..840a002 100644
--- a/src/chrome/content/itsalltext.js
+++ b/src/chrome/content/itsalltext.js
@@ -474,12 +474,16 @@ var ItsAllText = function() {
* Creates a cache object, unless one exists already.
* Note: These UIDs are only unique for Its All Text.
* @param {DOMElement} node A dom object node or id to one.
+ * @param {Boolean} create_gumdrop Should a gumdrop be created (html).
* @returns {String} the UID or null.
*/
- that.makeCacheObj = function(node) {
+ that.makeCacheObj = function(node, create_gumdrop) {
var cobj = that.getCacheObj(node);
if (!cobj) {
cobj = new ItsAllText.CacheObj(node);
+ if (create_gumdrop) {
+ cobj.addGumDrop();
+ }
}
return cobj;
};
@@ -839,8 +843,9 @@ Line 0
that.listen(window, 'unload', function () {
var doc = event.originalTarget;
that.debug("pageunload(): A page has been unloaded", doc && doc.location);
- that.preference_observer.unregister();
that.cleanCacheObjs();
+ that.preference_observer.unregister();
+ that.new_monitor.destroy();
}, false);
};
diff --git a/src/chrome/content/monitor.js b/src/chrome/content/monitor.js
index 68ed8f2..33edf97 100644
--- a/src/chrome/content/monitor.js
+++ b/src/chrome/content/monitor.js
@@ -33,6 +33,10 @@ function new_monitor(iat) {
}
+new_monitor.destroy = function () {
+ delete this.iat;
+};
+
new_monitor.prototype.hitched_restart = function () {
var rate = this.iat.getRefresh();
var id = this.id;
@@ -61,6 +65,8 @@ new_monitor.prototype.registerPage = function (event) {
/* appContent is the browser chrome. */
var appContent = document.getElementById("appcontent");
this.iat.listen(appContent, 'DOMContentLoaded', this.startPage, true);
+ this.iat.listen(gBrowser.tabContainer, 'TabSelect', this.watcher, true);
+ this.iat.debug('RegisterPage: END');
}
};
@@ -74,13 +80,25 @@ new_monitor.prototype.unregisterPage = function (event) {
// Remove any other handlers.
var appContent = document.getElementById("appcontent");
this.iat.unlisten(appContent, 'DOMContentLoaded', this.startPage, true);
+ this.iat.unlisten(gBrowser.tabContainer, 'TabSelect', this.watcher, true);
};
-new_monitor.prototype.hitched_watcher = function (init) {
+new_monitor.prototype.hitched_watcher = function (offset, init) {
+ if (offset.type === 'TabSelect') {
+ init = true;
+ }
+ var rate = this.iat.getRefresh();
+ var now = Date.now();
+ if (!init && now - this.last_watcher_call < Math.round(rate * 0.9)) {
+ this.iat.debug('watcher(',offset,'/',(now - this.last_watcher_call),') -- skipping catchup refresh');
+ return;
+ }
+ this.last_watcher_call = now;
+
var doc = gBrowser.selectedBrowser.contentDocument;
- this.iat.debug('watcher: ', init, doc);
+ this.iat.debug('watcher: ', offset, init, doc && doc.location);
var nodes = [];
- var i, cobj;
+ var i, cobj, node;
var is_html = this.isHTML(doc);
var is_xul = this.isXUL(doc);
if (is_html) {
@@ -91,25 +109,22 @@ new_monitor.prototype.hitched_watcher = function (init) {
nodes = doc.getElementsByTagName('textbox');
} else {
this.unregisterPage(doc);
+ return;
}
for(i=0; i < nodes.length; i++) {
+ node = nodes[i];
if (init) {
- cobj = ItsAllText.makeCacheObj(node);
+ cobj = ItsAllText.makeCacheObj(node, is_html);
} else {
cobj = ItsAllText.getCacheObj(node);
}
if (cobj) {
cobj.update();
- if (init && is_html) {
- cobj.addGumDrop();
- }
}
}
};
new_monitor.prototype.hitched_startPage = function (event, force) {
- this.iat.debug('narf');
-
var doc = event.originalTarget;
this.iat.debug('startPage', doc && doc.location, force);
if (!(force || this.isHTML(doc))) {
@@ -121,7 +136,7 @@ new_monitor.prototype.hitched_startPage = function (event, force) {
this.iat.listen(unsafeWin, 'pagehide', this.iat.hitch(this, 'stopPage'));
// Kick off a watcher now...
- this.watcher();
+ this.watcher(0, true);
// Set up the future ones
this.restart();
};
@@ -132,6 +147,7 @@ new_monitor.prototype.hitched_stopPage = function (event) {
};
new_monitor.prototype.isXUL = function (doc) {
+ var contentType = doc && doc.contentType;
var is_xul=(contentType=='application/vnd.mozilla.xul+xml');
var is_my_readme;
try {
diff --git a/src/install.rdf b/src/install.rdf
index b454f39..96fe345 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -4,12 +4,8 @@
xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<RDF:Description RDF:about="rdf:#$firefox"
em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
- em:minVersion="1.5"
+ em:minVersion="2.0"
em:maxVersion="3.0a8" />
- <RDF:Description RDF:about="rdf:#$flock"
- em:id="{a463f10c-3994-11da-9945-000d60ca027b}"
- em:minVersion="0.4"
- em:maxVersion="0.8" />
<RDF:Description RDF:about="urn:mozilla:install-manifest"
em:id="itsalltext at docwhat.gerf.org"
em:version="999.@@VERSION@@"
@@ -22,6 +18,5 @@
em:aboutURL="chrome://itsalltext/content/about.xul"
em:creator="Christian Höltje">
<em:targetApplication RDF:resource="rdf:#$firefox"/>
- <em:targetApplication RDF:resource="rdf:#$flock"/>
</RDF:Description>
</RDF:RDF>
--
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