Bug 1263628 - Ignore fragments when comparing URLs during reader view caching r=gijs
authorAndrzej Hunt <ahunt@mozilla.com>
Fri, 15 Apr 2016 11:17:36 -0700
changeset 333604 4992cef658a669d514b3469c4b4449ac5826359d
parent 333603 79ea010e10cd2c07c9a16700c85763d1346364ff
child 333605 15a5be62efb9e92ae780456a5dba79bef83b5035
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1263628
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;
         }