зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1342348 part 2 - Remove local link fix in about:reader. r=Gijs
MozReview-Commit-ID: GsEuRwj3oXV --HG-- extra : rebase_source : d574c84f422252bfed60133978cc3e66866043ad
This commit is contained in:
Родитель
4f69533cec
Коммит
588a1ebbde
|
@ -739,21 +739,6 @@ AboutReader.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_fixLocalLinks() {
|
||||
// We need to do this because preprocessing the content through nsIParserUtils
|
||||
// gives back a DOM with a <base> element. That influences how these URLs get
|
||||
// resolved, making them no longer match the document URI (which is
|
||||
// about:reader?url=...). To fix this, make all the hash URIs absolute. This
|
||||
// is hacky, but the alternative of removing the base element has potential
|
||||
// security implications if Readability has not successfully made all the URLs
|
||||
// absolute, so we pick just fixing these in-document links explicitly.
|
||||
let localLinks = this._contentElement.querySelectorAll("a[href^='#']");
|
||||
for (let localLink of localLinks) {
|
||||
// Have to get the attribute because .href provides an absolute URI.
|
||||
localLink.href = this._doc.documentURI + localLink.getAttribute("href");
|
||||
}
|
||||
},
|
||||
|
||||
_formatReadTime(slowEstimate, fastEstimate) {
|
||||
let displayStringKey = "aboutReader.estimatedReadTimeRange1";
|
||||
|
||||
|
@ -819,7 +804,6 @@ AboutReader.prototype = {
|
|||
false, articleUri, this._contentElement);
|
||||
this._contentElement.innerHTML = "";
|
||||
this._contentElement.appendChild(contentFragment);
|
||||
this._fixLocalLinks();
|
||||
this._maybeSetTextDirection(article);
|
||||
this._foundLanguage(article.language);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче