[Pkg-mozext-commits] [requestpolicy] 174/280: wrap `gBrowser.addTab()` again. fixes #577
David Prévot
taffit at moszumanska.debian.org
Sat May 2 20:30:19 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 521ce64af4748a003b08bf0eae35a8127ef8bc66
Author: Martin Kimmerle <dev at 256k.de>
Date: Sat Jan 24 23:49:17 2015 +0100
wrap `gBrowser.addTab()` again. fixes #577
---
src/content/ui/overlay.js | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index 80a7305..dfc6ea2 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -153,6 +153,7 @@ requestpolicy.overlay = (function() {
self.onWindowUnload = function() {
RequestProcessor.removeRequestObserver(self);
+ self._unwrapAddTab();
self._removeHistoryObserver();
self._removeLocationObserver();
@@ -218,9 +219,7 @@ requestpolicy.overlay = (function() {
OverlayEnvironment.elManager.addListener(container, "TabSelect",
tabSelectCallback, false);
- // maybe it's not necessary anymore to wrap the tab. if it's needed,
- // the wrapping needs to be undone at shutdown!
- //self._wrapAddTab();
+ self._wrapAddTab();
self._addLocationObserver();
self._addHistoryObserver();
}
@@ -861,6 +860,27 @@ requestpolicy.overlay = (function() {
}
};
+
+
+ self._unwrapAddTab = function() {
+ if (gBrowser.requestpolicyAddTabModified === true) {
+ // get the addTab() function as a string
+ let addTabString = gBrowser.addTab.toString();
+
+ // define the regular expression that should find the existing code
+ // line that RequestPolicy added.
+ let codeLineRE = /(\n )?requestpolicy\.overlay\.tabAdded\(arguments\[0\], arguments\[1\]\);/
+
+ // use the regular expression
+ let newAddTabString = addTabString.replace(codeLineRE, "");
+
+ // apply the changes
+ eval("gBrowser.addTab = " + newAddTabString);
+
+ delete gBrowser.requestpolicyAddTabModified;
+ }
+ };
+
/**
* This is called by the modified addTab().
*
--
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