From 06e47dea17d3ffcc3c6cc1dd551a3226c1390185 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Mon, 18 Oct 2021 18:02:19 +0200 Subject: [PATCH 1/3] Added types: Use chrome.tabs instead of any --- src/background/tabs.background.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/background/tabs.background.ts b/src/background/tabs.background.ts index 8f4d4e12b1..8963f83fbe 100644 --- a/src/background/tabs.background.ts +++ b/src/background/tabs.background.ts @@ -1,24 +1,21 @@ import MainBackground from './main.background'; export default class TabsBackground { - private tabs: any; - constructor(private main: MainBackground) { - this.tabs = chrome.tabs; } async init() { - if (!this.tabs) { + if (!chrome.tabs) { return; } - this.tabs.onActivated.addListener(async (activeInfo: any) => { + chrome.tabs.onActivated.addListener(async (activeInfo: chrome.tabs.TabActiveInfo) => { await this.main.refreshBadgeAndMenu(); this.main.messagingService.send('tabActivated'); this.main.messagingService.send('tabChanged'); }); - this.tabs.onReplaced.addListener(async (addedTabId: any, removedTabId: any) => { + chrome.tabs.onReplaced.addListener(async (addedTabId: number, removedTabId: number) => { if (this.main.onReplacedRan) { return; } @@ -29,7 +26,7 @@ export default class TabsBackground { this.main.messagingService.send('tabChanged'); }); - this.tabs.onUpdated.addListener(async (tabId: any, changeInfo: any, tab: any) => { + chrome.tabs.onUpdated.addListener(async (tabId: number, changeInfo: chrome.tabs.TabChangeInfo, tab: chrome.tabs.Tab) => { if (this.main.onUpdatedRan) { return; } From bed17673a8673103448ca5849198fd4c879f5a58 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Mon, 18 Oct 2021 18:03:46 +0200 Subject: [PATCH 2/3] Reduce blinking of notificationBar when other tabs update --- src/background/tabs.background.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background/tabs.background.ts b/src/background/tabs.background.ts index 8963f83fbe..ec8c0dd6ec 100644 --- a/src/background/tabs.background.ts +++ b/src/background/tabs.background.ts @@ -31,7 +31,7 @@ export default class TabsBackground { return; } this.main.onUpdatedRan = true; - await this.main.checkNotificationQueue(); + await this.main.checkNotificationQueue(tab); await this.main.refreshBadgeAndMenu(); this.main.messagingService.send('tabUpdated'); this.main.messagingService.send('tabChanged'); From a1022c8b27556cd533e2b2775d49c6a0db900b94 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Mon, 18 Oct 2021 18:48:52 +0200 Subject: [PATCH 3/3] Set iframe.src so that the check in closeExistingAndOpenBar actually works --- src/content/notificationBar.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/content/notificationBar.ts b/src/content/notificationBar.ts index 103b819d6e..c7ba44fa60 100644 --- a/src/content/notificationBar.ts +++ b/src/content/notificationBar.ts @@ -462,6 +462,7 @@ document.addEventListener('DOMContentLoaded', event => { const iframe = document.createElement('iframe'); iframe.style.cssText = 'height: 42px; width: 100%; border: 0; min-height: initial;'; iframe.id = 'bit-notification-bar-iframe'; + iframe.src = barPageUrl; const frameDiv = document.createElement('div'); frameDiv.setAttribute('aria-live', 'polite');