зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1134363 - Have Reader Mode use the same tab title as the normal browser view. r=niklas,mtigley
Differential Revision: https://phabricator.services.mozilla.com/D142281
This commit is contained in:
Родитель
9fa173af5f
Коммит
0736faf568
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1595,7 +1595,7 @@
|
|||
},
|
||||
|
||||
_setTabLabel(aTab, aLabel, { beforeTabOpen, isContentTitle } = {}) {
|
||||
if (!aLabel) {
|
||||
if (!aLabel || aLabel.includes("about:reader?")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
||||
// 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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче