[Pkg-mozext-commits] [wot] 185/226: Fixes #74 donuts disappear when switching results pages after coming back from found website
David Prévot
taffit at moszumanska.debian.org
Fri May 1 00:35:49 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository wot.
commit 720a339110dd964063dce5e78dd55d94d8fdd6b0
Author: Sergey Andryukhin <sorgoz at yandex.com>
Date: Mon Oct 28 15:20:04 2013 +0200
Fixes #74 donuts disappear when switching results pages after coming back from found website
---
content/core.js | 22 ++++++++++++++++++----
content/search.js | 38 +++++++++++++++++++++++++++++++-------
2 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/content/core.js b/content/core.js
index 77c5f40..08e98c4 100644
--- a/content/core.js
+++ b/content/core.js
@@ -133,10 +133,9 @@ var wot_core =
this.browser = document.getElementById("appcontent");
if (this.browser) {
- this.browser.addEventListener("DOMContentLoaded",
- wot_core.domcontentloaded, false);
- this.browser.addEventListener("click",
- wot_core.click, false);
+ this.browser.addEventListener("DOMContentLoaded", wot_core.domcontentloaded, false);
+ this.browser.addEventListener("pageshow", wot_core.pageshow, false); // the fix for the issue with Back/Forward buttons
+ this.browser.addEventListener("click", wot_core.click, false);
}
} catch (e) {
dump("wot_core.init: failed with " + e + "\n");
@@ -263,6 +262,21 @@ var wot_core =
}
},
+ pageshow: function(event, retry)
+ {
+ if (!wot_core.loaded && !retry) {
+ window.setTimeout(function() {
+ wot_core.pageshow(event, true);
+ }, 500);
+ }
+
+ for (var i in wot_modules) {
+ if (typeof(wot_modules[i].obj.pageshow) == "function") {
+ wot_modules[i].obj.pageshow(event);
+ }
+ }
+ },
+
click: function(event)
{
for (var i in wot_modules) {
diff --git a/content/search.js b/content/search.js
index 76da492..5404b95 100644
--- a/content/search.js
+++ b/content/search.js
@@ -412,7 +412,7 @@ var wot_search =
this.rules[name][attr] = wot_prefs.getBool(pref, true);
}
} catch (e) {
- dump("wot_search.loadrule: failed with " + e + "\n");
+ wdump("wot_search.loadrule: failed with " + e);
}
},
@@ -428,7 +428,7 @@ var wot_search =
this.loadrule(children[i]);
}
} catch (e) {
- dump("wot_search.sync: failed with " + e + "\n");
+ wdump("wot_search.sync: failed with " + e);
}
},
@@ -436,15 +436,39 @@ var wot_search =
domcontentloaded: function(event)
{
-
try { // Workaround to resolve "TypeError: can't access dead object" at start of the browser
- if (!event.originalTarget) return;
- } catch (e) { return; } // do nothing
+ if (!event.originalTarget) {
+ wdump("event.originalTarget is undefined");
+ return;
+ }
+ } catch (e) {
+ return; } // do nothing
try {
+ event.originalTarget.wot_domloaded = Date.now();
wot_search.watch(event.originalTarget);
} catch (e) {
- dump("wot_search.domcontentloaded: failed with " + e + "\n");
+ wdump("wot_search.domcontentloaded: failed with " + e);
+ }
+ },
+
+ pageshow: function(event)
+ {
+ try { // Workaround to resolve "TypeError: can't access dead object" at start of the browser
+ if (!event.originalTarget) {
+ wdump("event.originalTarget is undefined");
+ return;
+ }
+ } catch (e) {
+ return; } // do nothing
+
+ if (event.originalTarget) {
+ var wot_domloaded = event.originalTarget.wot_domloaded || 0;
+ // check when the last domcontentloaded event was raised,
+ // and if it was long ago, force to watch the DOM again (workaround for caching issue #74)
+ if (Date.now() - wot_domloaded > 800) {
+ wot_search.watch(event.originalTarget);
+ }
}
},
@@ -474,7 +498,7 @@ var wot_search =
attributes: true, childList: true, subtree: true
});
} catch (e) {
- dump("wot_search.watch: failed with " + e + "\n");
+ wdump("wot_search.watch: failed with " + e);
}
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/wot.git
More information about the Pkg-mozext-commits
mailing list