[Pkg-mozext-commits] [greasemonkey] 14/43: Dirty workaround which seems to function better.
David Prévot
taffit at moszumanska.debian.org
Sun Feb 22 21:56:10 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository greasemonkey.
commit b3537a34dfa71e062a02d66cabbf7b16d264c824
Author: Anthony Lieuallen <arantius at gmail.com>
Date: Tue Nov 4 14:19:12 2014 -0500
Dirty workaround which seems to function better.
---
modules/contentObserver.js | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/modules/contentObserver.js b/modules/contentObserver.js
index c56df14..cf50731 100644
--- a/modules/contentObserver.js
+++ b/modules/contentObserver.js
@@ -40,11 +40,12 @@ ContentObserver.prototype.createScriptFromObject = function(aObject) {
ContentObserver.prototype.contentLoad = function(aEvent) {
+ var contentWin = aEvent.target.defaultView;
+
// Now that we've seen any first load event, stop listening for any more.
- aEvent.target.removeEventListener("DOMContentLoaded", gContentLoad, true);
- aEvent.target.removeEventListener("load", gContentLoad, true);
+ contentWin.removeEventListener("DOMContentLoaded", gContentLoad, true);
+ contentWin.removeEventListener("load", gContentLoad, true);
- var contentWin = aEvent.target.defaultView;
this.runScripts('document-end', contentWin);
};
@@ -63,6 +64,16 @@ ContentObserver.prototype.observe = function(aSubject, aTopic, aData) {
var win = doc && doc.defaultView;
if (!doc || !win) break;
+ // Work around double-import bug. This module seems to get imported
+ // twice, though we'd expect once. One observes broken events, the other
+ // works.
+ try {
+ this.contentFrameMessageManager(win);
+ } catch (e) {
+ dump('ignoring observe of win with no contentFrameMessageManager\n');
+ return;
+ }
+
// Listen for whichever kind of load event arrives first.
win.addEventListener("DOMContentLoaded", gContentLoad, true);
win.addEventListener("load", gContentLoad, true);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git
More information about the Pkg-mozext-commits
mailing list