From 91fec9024cb283f207daba798f394834f9d57582 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Thu, 25 May 2023 09:05:19 +0300 Subject: [PATCH] Bidi: Fix control characters appearing in reader window titles on Windows Fix in 6d5ce578e430380b633c4e8a32898ab4975dfa2e only affected tabs. Fixes #3135 --- chrome/content/zotero/tabs.js | 8 +------- chrome/content/zotero/xpcom/reader.js | 5 +++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/tabs.js b/chrome/content/zotero/tabs.js index 727aba2913..8aa3a4ccd1 100644 --- a/chrome/content/zotero/tabs.js +++ b/chrome/content/zotero/tabs.js @@ -80,13 +80,7 @@ var Zotero_Tabs = new function () { iconBackgroundImage: tab.iconBackgroundImage }))); var { tab } = this._getTab(this._selectedID); - let tabTitle = tab.title; - if (Zotero.isWin) { - // Windows displays bidi control characters as placeholders in window titles, so strip them - // See https://github.com/mozilla-services/screenshots/issues/4863 - tabTitle = tabTitle.replace(/[\u2068\u2069]/g, ''); - } - document.title = (tabTitle.length ? tabTitle + ' - ' : '') + 'Zotero'; + document.title = (tab.title.length ? tab.title + ' - ' : '') + 'Zotero'; this._updateTabBar(); // Hide any tab `title` tooltips that might be open window.Zotero_Tooltip.stop(); diff --git a/chrome/content/zotero/xpcom/reader.js b/chrome/content/zotero/xpcom/reader.js index 5c6d67f228..b87fbd926d 100644 --- a/chrome/content/zotero/xpcom/reader.js +++ b/chrome/content/zotero/xpcom/reader.js @@ -198,6 +198,11 @@ class ReaderInstance { readerTitle = parts.filter(x => x).join(' - '); } } + if (Zotero.isWin) { + // Windows displays bidi control characters as placeholders in window titles, so strip them + // See https://github.com/mozilla-services/screenshots/issues/4863 + readerTitle = readerTitle.replace(/[\u2068\u2069]/g, ''); + } this._title = readerTitle; this._setTitleValue(readerTitle); }