[Pkg-mozext-commits] [requestpolicy] 08/65: [fix] missing image placeholder on URIs with fragment

David Prévot taffit at moszumanska.debian.org
Fri Mar 25 22:59:46 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 41deb5f7d5d6a705ea34f2881fbfe1c2fc555a88
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Jan 5 17:29:18 2016 +0100

    [fix] missing image placeholder on URIs with fragment
    
    Fixes #747
---
 src/content/ui/overlay.js                          |  4 +++-
 tests/content/img_1.html                           |  3 ++-
 .../marionette/tests/blocked_content/manifest.ini  |  1 +
 .../blocked_content/test_image_placeholder.py      | 24 ++++++++++++++++++++++
 tests/marionette/tests/manifest.ini                |  1 +
 5 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index 684c04b..e595feb 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -226,6 +226,8 @@ window.rpcontinued.overlay = (function() {
 
   mlManager.addListener("notifyDocumentLoaded", function(message) {
     let {documentURI} = message.data;
+    // The document URI could contain a "fragment" part.
+    let originURI = DomainUtil.getUriObject(documentURI).specIgnoringRef;
 
     let blockedURIs = {};
 
@@ -233,7 +235,7 @@ window.rpcontinued.overlay = (function() {
       var indicateBlacklisted = Prefs.get("indicateBlacklistedObjects");
 
       var rejectedRequests = RequestProcessor._rejectedRequests
-          .getOriginUri(documentURI);
+          .getOriginUri(originURI);
       for (var destBase in rejectedRequests) {
         for (var destIdent in rejectedRequests[destBase]) {
           for (var destUri in rejectedRequests[destBase][destIdent]) {
diff --git a/tests/content/img_1.html b/tests/content/img_1.html
index cfa9ee9..646200b 100644
--- a/tests/content/img_1.html
+++ b/tests/content/img_1.html
@@ -6,7 +6,8 @@
 <body>
 
 <p>
-  cross-site image: <img src="http://www.otherdomain.test/subdirectory/flag-gray.png" />
+  cross-site image: <img src="http://www.otherdomain.test/subdirectory/flag-gray.png"
+                         id="cross-site-image"/>
 </p>
 
 <p>
diff --git a/tests/marionette/tests/blocked_content/manifest.ini b/tests/marionette/tests/blocked_content/manifest.ini
new file mode 100644
index 0000000..33f62b9
--- /dev/null
+++ b/tests/marionette/tests/blocked_content/manifest.ini
@@ -0,0 +1 @@
+[test_image_placeholder.py]
diff --git a/tests/marionette/tests/blocked_content/test_image_placeholder.py b/tests/marionette/tests/blocked_content/test_image_placeholder.py
new file mode 100644
index 0000000..113831d
--- /dev/null
+++ b/tests/marionette/tests/blocked_content/test_image_placeholder.py
@@ -0,0 +1,24 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from rp_ui_harness import RequestPolicyTestCase
+
+
+class TestImagePlaceholder(RequestPolicyTestCase):
+
+    def test_normal(self):
+        self._test("http://www.maindomain.test/img_1.html")
+
+    def test_fragment(self):
+        with self.marionette.using_context("content"):
+            # First load a blank page to ensure the URL is not
+            # "http://www.maindomain.test/img_1.html".
+            self.marionette.navigate("about:blank")
+        self._test("http://www.maindomain.test/img_1.html#fragment-part")
+        
+    def _test(self, test_url):
+        with self.marionette.using_context("content"):
+            self.marionette.navigate(test_url)
+            image = self.marionette.find_element("id", "cross-site-image")
+            self.assertTrue(image.get_attribute("rpcontinuedIdentified"))
diff --git a/tests/marionette/tests/manifest.ini b/tests/marionette/tests/manifest.ini
index f8245ef..9365dd6 100644
--- a/tests/marionette/tests/manifest.ini
+++ b/tests/marionette/tests/manifest.ini
@@ -1,4 +1,5 @@
 [include:addon_install_and_upgrade/manifest.ini]
+[include:blocked_content/manifest.ini]
 [include:links/manifest.ini]
 [include:menu/manifest.ini]
 [include:policy/manifest.ini]

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