[Pkg-mozext-commits] [requestpolicy] 193/280: solve the gBrowser problem in SeaMonkey
David Prévot
taffit at moszumanska.debian.org
Sat May 2 20:30:24 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 2537f8a5162d010dfe5cf87c8a3b76bffe80c3de
Author: Martin Kimmerle <dev at 256k.de>
Date: Sat Jan 31 15:31:35 2015 +0100
solve the gBrowser problem in SeaMonkey
revert commit bc6dc4f and solve the problem with gBrowser in
SeaMonkey differently. The AddOn SDK solves it similarly. See
https://bugzilla.mozilla.org/show_bug.cgi?id=1009938
Part of #502.
---
src/content/lib/utils/windows.jsm | 8 +++++++-
src/content/ui/menu.js | 2 ++
src/content/ui/overlay.js | 17 +++--------------
3 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/content/lib/utils/windows.jsm b/src/content/lib/utils/windows.jsm
index 00bd426..8e76693 100644
--- a/src/content/lib/utils/windows.jsm
+++ b/src/content/lib/utils/windows.jsm
@@ -46,7 +46,8 @@ let WindowUtils = (function() {
self.getBrowserForWindow = function(aContentWindow) {
let win = self.getChromeWindow(aContentWindow);
- let tab = win.gBrowser._getTabForContentWindow(aContentWindow.top);
+ let tab = self.getTabBrowser(win)
+ ._getTabForContentWindow(aContentWindow.top);
return tab.linkedBrowser;
}
@@ -57,6 +58,11 @@ let WindowUtils = (function() {
.getInterface(Ci.nsIDOMWindow);
};
+ self.getTabBrowser = function(window) {
+ // bug 1009938 - may be null in SeaMonkey
+ return window.gBrowser || window.getBrowser();
+ };
+
//
// Private Browsing
//
diff --git a/src/content/ui/menu.js b/src/content/ui/menu.js
index 1ba41b6..3dd76a5 100644
--- a/src/content/ui/menu.js
+++ b/src/content/ui/menu.js
@@ -49,6 +49,8 @@ requestpolicy.menu = (function() {
let {WindowUtils} = iMod("lib/utils/windows");
let {C} = iMod("lib/utils/constants");
+ let gBrowser = WindowUtils.getTabBrowser(window);
+
let $id = document.getElementById.bind(document);
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index ce16888..bd6cf87 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -53,6 +53,8 @@ requestpolicy.overlay = (function() {
let {WindowUtils} = iMod("lib/utils/windows");
let {C} = iMod("lib/utils/constants");
+ let gBrowser = WindowUtils.getTabBrowser(window);
+
let $id = document.getElementById.bind(document);
//let _extensionConflictInfoUri = "http://www.requestpolicy.com/conflict?ext=";
@@ -139,10 +141,8 @@ requestpolicy.overlay = (function() {
//self.setContextMenuEnabled(rpPrefBranch.getBoolPref("contextMenu"));
-
- OverlayEnvironment.elManager.addListener(window, "load",
- self.onWindowLoad);
OverlayEnvironment.shutdownOnUnload(window);
+ OverlayEnvironment.startup();
}
} catch (e) {
Logger.severe(Logger.TYPE_ERROR,
@@ -168,17 +168,6 @@ requestpolicy.overlay = (function() {
}
};
- /**
- * Perform the actions required once the window has loaded. This just sets a
- * listener for when the content of the window has changed (a page is loaded).
- *
- * @param {Event}
- * event
- */
- self.onWindowLoad = function() {
- OverlayEnvironment.startup();
- };
-
function addAppcontentTabSelectListener() {
// Info on detecting page load at:
// http://developer.mozilla.org/En/Code_snippets/On_page_load
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list