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