Bug 1263628 - Ignore fragments when comparing URLs during reader view caching r?gijs draft
authorAndrzej Hunt <ahunt@mozilla.com>
Fri, 15 Apr 2016 11:17:36 -0700
changeset 352169 ac96a0a5e09c2cc60644a23cdbe8e72e94c1fcc9
parent 352168 95c9c060c1b96be7e9d95eab22b9b8ffebdbbc69
child 518598 692301da8929ef64992944ff1d01b2640c242c94
push id15636
push userahunt@mozilla.com
push dateFri, 15 Apr 2016 20:54:00 +0000
reviewersgijs
bugs1263628
milestone48.0a1
Bug 1263628 - Ignore fragments when comparing URLs during reader view caching r?gijs This seems to be a common issue with medium.com articles, but affects any page which was opened using a fragment in the URL (e.g. foo.com/bar#baz is the same page as foo.com/bar, however our reader view caching code didn't recognise the former as being equivalent to the latter). MozReview-Commit-ID: BtRmHq3sD9z
toolkit/components/reader/ReaderMode.jsm
--- a/toolkit/components/reader/ReaderMode.jsm
+++ b/toolkit/components/reader/ReaderMode.jsm
@@ -233,20 +233,20 @@ this.ReaderMode = {
             }
           }
         }
         let responseURL = xhr.responseURL;
         let givenURL = url;
         // Convert these to real URIs to make sure the escaping (or lack
         // thereof) is identical:
         try {
-          responseURL = Services.io.newURI(responseURL, null, null).spec;
+          responseURL = Services.io.newURI(responseURL, null, null).specIgnoringRef;
         } catch (ex) { /* Ignore errors - we'll use what we had before */ }
         try {
-          givenURL = Services.io.newURI(givenURL, null, null).spec;
+          givenURL = Services.io.newURI(givenURL, null, null).specIgnoringRef;
         } catch (ex) { /* Ignore errors - we'll use what we had before */ }
 
         if (responseURL != givenURL) {
           // We were redirected without a meta refresh tag.
           // Force redirect to the correct place:
           reject({newURL: xhr.responseURL});
           return;
         }