[Pkg-mozext-commits] [requestpolicy] 248/257: [fix] r21n: include the "URI fragment"

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:19 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 04a4efe726863fd6f7dd1e95a4af467e54fd2580
Author: Martin Kimmerle <dev at 256k.de>
Date:   Sat Jan 2 16:46:29 2016 +0100

    [fix] r21n: include the "URI fragment"
    
    Fixes #681
---
 src/content/lib/request-processor.jsm                |  2 +-
 src/content/lib/request-processor.redirects.js       |  3 ++-
 src/content/lib/request.jsm                          | 15 +++++++++++++++
 src/content/ui/overlay.js                            |  2 +-
 tests/marionette/rp_ui_harness/utils/redirections.py |  7 +++++++
 5 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/content/lib/request-processor.jsm b/src/content/lib/request-processor.jsm
index e9d9ce7..ca105a1 100644
--- a/src/content/lib/request-processor.jsm
+++ b/src/content/lib/request-processor.jsm
@@ -183,7 +183,7 @@ var RequestProcessor = (function() {
             "about the blocked top-level document request!");
       } else {
         window.rpcontinued.overlay.observeBlockedTopLevelDocRequest(
-            browser, request.originURI, request.destURI);
+            browser, request.originURI, request.destURIWithRef);
       }
     }
 
diff --git a/src/content/lib/request-processor.redirects.js b/src/content/lib/request-processor.redirects.js
index ea35178..357e7ef 100644
--- a/src/content/lib/request-processor.redirects.js
+++ b/src/content/lib/request-processor.redirects.js
@@ -313,7 +313,8 @@ RequestProcessor = (function(self) {
       if (!showNotification) {
         return false;
       }
-      return showNotification(browser, request.destURI, 0, request.originURI);
+      return showNotification(browser, request.destURIWithRef, 0,
+          request.originURI);
     });
     return true;
   }
diff --git a/src/content/lib/request.jsm b/src/content/lib/request.jsm
index d80f61d..a73a1bc 100644
--- a/src/content/lib/request.jsm
+++ b/src/content/lib/request.jsm
@@ -116,6 +116,12 @@ NormalRequest.prototype.setDestURI = function(destURI) {
   this.aContentLocation = DomainUtil.getUriObject(destURI);
 };
 
+Object.defineProperty(NormalRequest.prototype, "destURIWithRef", {
+  get: function() {
+    return this.aContentLocation.spec;
+  }
+});
+
 NormalRequest.prototype.detailsToString = function() {
   // Note: try not to cause side effects of toString() during load, so "<HTML
   // Element>" is hard-coded.
@@ -286,3 +292,12 @@ function RedirectRequest(httpResponse) {
 }
 RedirectRequest.prototype = Object.create(Request.prototype);
 RedirectRequest.prototype.constructor = Request;
+
+Object.defineProperty(RedirectRequest.prototype, "destURIWithRef", {
+  get: function() {
+    if (!this.hasOwnProperty("_destURIWithRef")) {
+      this._destURIWithRef = this.httpResponse.destURI.spec;
+    }
+    return this._destURIWithRef;
+  }
+});
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index 52fc77c..42a6411 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -672,7 +672,7 @@ window.rpcontinued.overlay = (function() {
    * blocked, it's better to set a timeout here.
    */
   self.observeBlockedTopLevelDocRequest = function(browser, originUri,
-                                                    destUri) {
+                                                   destUri) {
     // This function is called during shouldLoad() so set a timeout to
     // avoid blocking shouldLoad.
     window.setTimeout(function() {
diff --git a/tests/marionette/rp_ui_harness/utils/redirections.py b/tests/marionette/rp_ui_harness/utils/redirections.py
index 9d2ff04..677373e 100644
--- a/tests/marionette/rp_ui_harness/utils/redirections.py
+++ b/tests/marionette/rp_ui_harness/utils/redirections.py
@@ -180,6 +180,13 @@ def for_each_possible_redirection_scenario(callback, uri_type):
         dest_pre_path="http://www.otherdomain.test/",
         dest_path="subdirectory/flag-gray.png")
 
+    # destination URI with "fragment" part
+    for_each(callback_wrapper,
+        base_info={"is_same_host": False, "is_relative_dest": False},
+        origin_pre_path="http://www.maindomain.test/",
+        dest_pre_path="http://www.otherdomain.test/",
+        dest_path="#this-is-a-fragment")
+
     #---------------------------------------------------------------------------
     # same-site redirections
     #---------------------------------------------------------------------------

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