[Pkg-mozext-commits] [nosquint] 15/47: Import of 2.0.2b1 release into git
David Prévot
taffit at moszumanska.debian.org
Tue Apr 28 01:41:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 2.1.6
in repository nosquint.
commit ad3c039815182552bfc429cc3b5a6499bc5706cc
Author: Jason Tackaberry <tack at urandom.ca>
Date: Fri Jan 13 19:41:13 2012 -0500
Import of 2.0.2b1 release into git
---
src/content/browser.js | 21 +++++++++++++++++++--
src/content/interfaces.js | 42 +++++++++++++++++++++++++++++++++++++++++-
src/content/lib.js | 2 +-
src/install.rdf | 2 +-
4 files changed, 62 insertions(+), 5 deletions(-)
diff --git a/src/content/browser.js b/src/content/browser.js
index 7cf85f4..8d1c075 100644
--- a/src/content/browser.js
+++ b/src/content/browser.js
@@ -54,11 +54,17 @@ NoSquint.browser = NoSquint.ns(function() { with (NoSquint) {
gBrowser.tabContainer.addEventListener('TabClose', this.handleTabClose, false);
this.zoomAll(null, true);
+ this.styleAll(null);
};
this.destroy = function() {
if (NSQ.storage.dialogs.site)
NSQ.storage.dialogs.site.die();
+
+ gBrowser.tabContainer.removeEventListener('TabOpen', this.handleTabOpen, false);
+ gBrowser.tabContainer.removeEventListener('TabSelect', this.handleTabSelect, false);
+ gBrowser.tabContainer.removeEventListener('TabClose', this.handleTabClose, false);
+ window.removeEventListener('DOMMouseScroll', this.handleMouseScroll, false);
};
@@ -264,8 +270,10 @@ NoSquint.browser = NoSquint.ns(function() { with (NoSquint) {
* site name user data attached to the browser.
*/
this.getSiteFromBrowser = function(browser) {
- if (isChrome(browser))
+ if (isChrome(browser)) {
+ debug('getSiteFromBrowser(): isChrome=true, url=' + browser.docShell.document.URL);
return null;
+ }
return NSQ.prefs.getSiteFromURI(browser.currentURI);
};
@@ -274,9 +282,11 @@ NoSquint.browser = NoSquint.ns(function() { with (NoSquint) {
*/
this.getZoomForBrowser = function(browser) {
var site = browser.getUserData('nosquint').site;
- if (site === null) {
+ debug('getZoomForBrowser(): site=' + site);
+ if (site === undefined) {
site = this.getSiteFromBrowser(browser);
browser.getUserData('nosquint').site = site;
+ debug('getZoomForBrowser(): after getSiteFromBrowser(), site=' + site);
}
var [text, full] = NSQ.prefs.getZoomForSite(site);
@@ -303,6 +313,13 @@ NoSquint.browser = NoSquint.ns(function() { with (NoSquint) {
this.attach = function(browser) {
var listener = new NSQ.interfaces.ProgressListener(browser);
browser.addProgressListener(listener, CI.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
+ debug('attach(): attached browser URI=' + browser.docShell.document.URL);
+ function foo() {
+ debug('BROWSER URI: ' + browser.currentURI.spec);
+ setTimeout(foo, 1000);
+ }
+ //foo();
+
var userData = {
listener: listener,
stylers: []
diff --git a/src/content/interfaces.js b/src/content/interfaces.js
index c999383..5d56f5f 100644
--- a/src/content/interfaces.js
+++ b/src/content/interfaces.js
@@ -50,7 +50,7 @@ NoSquint.interfaces = NoSquint.ns(function() { with (NoSquint) {
// New document on the same site.
return;
- debug("onLocationChange(): old=" + userData.site + "new=" + site + ", uri=" + uri.spec);
+ debug("onLocationChange(): old=" + userData.site + ", new=" + site + ", uri=" + uri.spec);
/* Update timestamp for site. This isn't _quite_ perfect because
* the timestamp is only updated for the first page load on that site
* rather than the last. But it should be good enough in practice, and
@@ -102,7 +102,47 @@ NoSquint.interfaces = NoSquint.ns(function() { with (NoSquint) {
else
this.styleApplied = true;
}
+ } else if (state & Components.interfaces.nsIWebProgressListener.STATE_IS_DOCUMENT &&
+ this.browser.getUserData('nosquint').site == null && !is30()) {
+ /* Kludge: when moving a tab from one window to another, the
+ * listener previously created and attached in
+ * NSQ.browser.attach() seems to either stop working or gets
+ * implicitly detached somewhere afterward. The tab gets
+ * created initially as about:blank, so NoSquint thinks it's
+ * chrome. The tab gets updated for the proper site, but since
+ * the listener isn't working, NoSquint doesn't hear about it.
+ *
+ * The specific magical incantation to deal with this seems to
+ * be handling STATE_IS_DOCUMENT when site=null. After a 0ms
+ * timer, we try to readd the listener that was previously
+ * added in NSQ.browser.attach(). If it fails, we assume the
+ * listener from attach() is still there and everything is cool
+ * after all. Otherwise, regenerate the site name and
+ * rezooms/style.
+ *
+ * This seems to solve the problem, but feels like a nasty volatile
+ * hack to work around what is probably a firefox bug, and will
+ * likely break in the future. It doesn't seem to be necessary
+ * with 3.0, but is with 3.5+.
+ */
+ var browser = this.browser;
+ var listener = this;
+ setTimeout(function() {
+ try {
+ browser.addProgressListener(listener, CI.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
+ } catch (err) {
+ // Assume ProgressListener was already attached after all, so
+ // we don't need to do anything.
+ return;
+ }
+ browser.getUserData('nosquint').listener = listener;
+ // Forces getZoomForBrowser() (via zoom()) to redetermine site name.
+ delete browser.getUserData('nosquint').site;
+ NSQ.browser.zoom(browser);
+ NSQ.browser.style(browser);
+ }, 0);
}
+
},
onProgressChange: function() 0,
diff --git a/src/content/lib.js b/src/content/lib.js
index 1163140..8669c6b 100644
--- a/src/content/lib.js
+++ b/src/content/lib.js
@@ -97,7 +97,7 @@
// XXX: don't forget to disable this for releases.
this.debug = function(msg) {
- //dump("[nosquint] " + msg + "\n");
+ dump("[nosquint] " + msg + "\n");
};
/* This function is called a lot, so we take some care to optimize for the
diff --git a/src/install.rdf b/src/install.rdf
index 26eac71..359c2bb 100644
--- a/src/install.rdf
+++ b/src/install.rdf
@@ -6,7 +6,7 @@
<em:id>nosquint at urandom.ca</em:id>
<em:name>NoSquint</em:name>
- <em:version>2.0.1</em:version>
+ <em:version>2.0.2b1</em:version>
<em:description>Manage site-specific zoom levels and color settings</em:description>
<em:creator>Jason Tackaberry</em:creator>
<!-- optional items -->
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/nosquint.git
More information about the Pkg-mozext-commits
mailing list