[Pkg-mozext-commits] [tabmixplus] 25/107: Update content.js with changes from browser/base/content/content.js

David Prévot taffit at moszumanska.debian.org
Tue Dec 29 19:02:46 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository tabmixplus.

commit 0ddd8332c5d890435a930313df84d01c78bfde94
Author: onemen <tabmix.onemen at gmail.com>
Date:   Fri Oct 23 23:53:44 2015 +0300

    Update content.js with changes from browser/base/content/content.js
---
 chrome/content/content.js | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/chrome/content/content.js b/chrome/content/content.js
index f0b9d14..884cd6b 100644
--- a/chrome/content/content.js
+++ b/chrome/content/content.js
@@ -167,13 +167,24 @@ var TabmixClickEventHandler = {
 
     let [href, node] = this._hrefAndLinkNodeForClickEvent(event);
 
-    let json = {button: event.button, shiftKey: event.shiftKey,
-                 ctrlKey: event.ctrlKey, metaKey: event.metaKey,
-                 altKey: event.altKey, href: null, title: null,
-                 bookmark: false};
+    // get referrer attribute from clicked link and parse it
+    // if per element referrer is enabled, the element referrer overrules
+    // the document wide referrer
+    let referrerPolicy = TabmixSvc.version(380) ? ownerDoc.referrerPolicy : null;
+    if (TabmixSvc.version(420) &&
+        Services.prefs.getBoolPref("network.http.enablePerElementReferrer") &&
+        node) {
+      let referrerAttrValue = Services.netUtils.parseAttributePolicyString(node.
+                              getAttribute("referrer"));
+      if (referrerAttrValue !== Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT) {
+        referrerPolicy = referrerAttrValue;
+      }
+    }
 
-    if (TabmixSvc.version(380))
-      json.referrerPolicy = ownerDoc.referrerPolicy;
+    let json = {button: event.button, shiftKey: event.shiftKey,
+                ctrlKey: event.ctrlKey, metaKey: event.metaKey,
+                altKey: event.altKey, href: null, title: null,
+                bookmark: false, referrerPolicy: referrerPolicy};
 
     if (typeof event.tabmix_openLinkWithHistory == "boolean")
       json.tabmix_openLinkWithHistory = true;
@@ -202,6 +213,14 @@ var TabmixClickEventHandler = {
     href = data._href;
 
     if (href) {
+      if (TabmixSvc.version(410)) {
+        try {
+          BrowserUtils.urlSecurityCheck(href, node.ownerDocument.nodePrincipal);
+        } catch (e) {
+          return;
+        }
+      }
+
       json.href = href;
       if (node) {
         json.title = node.getAttribute("title");
@@ -213,8 +232,7 @@ var TabmixClickEventHandler = {
           }
         }
       }
-      if (TabmixSvc.version(370))
-        json.noReferrer = BrowserUtils.linkHasNoReferrer(node);
+      json.noReferrer = TabmixSvc.version(370) && BrowserUtils.linkHasNoReferrer(node);
 
       sendAsyncMessage("Content:Click", json);
       return;
@@ -267,7 +285,7 @@ var TabmixClickEventHandler = {
     // In case of XLink, we don't return the node we got href from since
     // callers expect <a>-like elements.
     // Note: makeURI() will throw if aUri is not a valid URI.
-    return [href ? makeURI(href, null, baseURI).spec : null, null];
+    return [href ? BrowserUtils.makeURI(href, null, baseURI).spec : null, null];
   },
 
   get _focusedWindow() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git



More information about the Pkg-mozext-commits mailing list