diff --git a/browser/actors/AboutReaderChild.jsm b/browser/actors/AboutReaderChild.jsm index 7f247418a400..950710fa8550 100644 --- a/browser/actors/AboutReaderChild.jsm +++ b/browser/actors/AboutReaderChild.jsm @@ -23,6 +23,7 @@ ChromeUtils.defineModuleGetter( ); var gUrlsToDocContentType = new Map(); +var gUrlsToDocTitle = new Map(); class AboutReaderChild extends JSWindowActorChild { constructor() { @@ -53,6 +54,7 @@ class AboutReaderChild extends JSWindowActorChild { this.document.URL, this.document.contentType ); + gUrlsToDocTitle.set(this.document.URL, this.document.title); this._articlePromise = ReaderMode.parseDocument(this.document).catch( Cu.reportError ); @@ -133,10 +135,12 @@ class AboutReaderChild extends JSWindowActorChild { ? "text/plain" : "document"; + let docTitle = gUrlsToDocTitle.get(url); this._reader = new AboutReader( this, this._articlePromise, - docContentType + docContentType, + docTitle ); this._articlePromise = null; } diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index c50920d58bca..aa72c18f3dfb 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -1595,7 +1595,7 @@ }, _setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle } = {}) { - if (!aLabel) { + if (!aLabel || aLabel.includes("about:reader?")) { return false; } diff --git a/toolkit/components/reader/AboutReader.jsm b/toolkit/components/reader/AboutReader.jsm index a5e9e942d089..7bf4e95eec93 100644 --- a/toolkit/components/reader/AboutReader.jsm +++ b/toolkit/components/reader/AboutReader.jsm @@ -47,7 +47,12 @@ const zoomOnMeta = Services.prefs.getIntPref("mousewheel.with_meta.action", 1) == 3; const isAppLocaleRTL = Services.locale.isAppLocaleRTL; -var AboutReader = function(actor, articlePromise, docContentType = "document") { +var AboutReader = function( + actor, + articlePromise, + docContentType = "document", + docTitle = "" +) { let win = actor.contentWindow; let url = this._getOriginalUrl(win); if ( @@ -73,6 +78,8 @@ var AboutReader = function(actor, articlePromise, docContentType = "document") { } doc.documentElement.setAttribute("platform", AppConstants.platform); + doc.title = docTitle; + this._actor = actor; this._isLoggedInPocketUser = undefined; @@ -1074,7 +1081,12 @@ AboutReader.prototype = { article.readingTimeMinsSlow, article.readingTimeMinsFast ); - this._doc.title = article.title; + + // If a document title was not provided in the constructor, we'll fall back + // to using the article title. + if (!this._doc.title) { + this._doc.title = article.title; + } this._containerElement.setAttribute("lang", article.lang);