[Pkg-mozext-commits] [requestpolicy] 170/257: [ref] overlay: wrap ctx-menu functions using Utils.wrapFunction
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:20:09 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit d9988415500f4b413031fb4a026ccd15b09e752e
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Dec 1 14:33:16 2015 +0100
[ref] overlay: wrap ctx-menu functions using Utils.wrapFunction
---
src/content/ui/overlay.js | 35 ++++++++++++-----------------------
1 file changed, 12 insertions(+), 23 deletions(-)
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index 83eb858..c457cdc 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -772,31 +772,20 @@ window.rpcontinued.overlay = (function () {
* the subsequent shouldLoad() call.
*/
self._wrapOpenLink = function() {
- if (!gContextMenu.rpcontinuedMethodsOverridden) {
- gContextMenu.rpcontinuedMethodsOverridden = true;
-
- gContextMenu.openLink = function() {
- RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
- return this.__proto__.openLink.call(this); // call the overridden method
- };
-
- // Below, we check whether the functions exist before overriding it, because
- // those functions have been introduced in later versions of Firefox than openLink().
+ Utils.wrapFunction(window.gContextMenu, "openLink", function () {
+ RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
+ this.linkURL);
+ });
- if (gContextMenu.openLinkInPrivateWindow) {
- gContextMenu.openLinkInPrivateWindow = function() {
- RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
- return this.__proto__.openLinkInPrivateWindow.call(this);
- };
- }
+ Utils.wrapFunction(window.gContextMenu, "openLinkInPrivateWindow", function () {
+ RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
+ this.linkURL);
+ });
- if (gContextMenu.openLinkInCurrent) {
- gContextMenu.openLinkInCurrent = function() {
- RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL, this.linkURL);
- return this.__proto__.openLinkInCurrent.call(this);
- };
- }
- }
+ Utils.wrapFunction(window.gContextMenu, "openLinkInCurrent", function () {
+ RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
+ this.linkURL);
+ });
};
/**
--
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