[Pkg-mozext-commits] [requestpolicy] 222/257: [fix] overlay: fix one "unsafe CPOW usage"

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:15 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 e15d3d0a806ec0334237803f72f89821596de31d
Author: Martin Kimmerle <dev at 256k.de>
Date:   Fri Dec 18 15:18:53 2015 +0100

    [fix] overlay: fix one "unsafe CPOW usage"
---
 src/content/ui/overlay.js | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index 2db7286..9f325a9 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -726,6 +726,17 @@ window.rpcontinued.overlay = (function() {
   };
 
   /**
+   * @this {nsContextMenu}
+   */
+  function onOpenLinkViaContextMenu() {
+    let origin = window.gContextMenuContentData ?
+        window.gContextMenuContentData.docLocation :
+        this.target.ownerDocument.URL;
+    let dest = this.linkURL;
+    RequestProcessor.registerLinkClicked(origin, dest);
+  }
+
+  /**
    * Wraps (overrides) the following methods of gContextMenu
    * - openLink()
    * - openLinkInPrivateWindow()
@@ -745,21 +756,12 @@ window.rpcontinued.overlay = (function() {
    *       the subsequent shouldLoad() call.
    */
   self._wrapOpenLink = function() {
-    Utils.wrapFunction(window.gContextMenu, "openLink", function() {
-      RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
-                                           this.linkURL);
-    });
-
+    Utils.wrapFunction(window.gContextMenu, "openLink",
+        onOpenLinkViaContextMenu);
     Utils.wrapFunction(window.gContextMenu, "openLinkInPrivateWindow",
-        function() {
-      RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
-                                           this.linkURL);
-    });
-
-    Utils.wrapFunction(window.gContextMenu, "openLinkInCurrent", function() {
-      RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
-                                           this.linkURL);
-    });
+        onOpenLinkViaContextMenu);
+    Utils.wrapFunction(window.gContextMenu, "openLinkInCurrent",
+        onOpenLinkViaContextMenu);
   };
 
   /**

-- 
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