[PM-5882] Adjust usage of `chrome.extension.getBackgroundPage` to ensure no conflicts exist due to the service worker (#8054)

This commit is contained in:
Cesar Gonzalez 2024-02-27 16:01:00 -06:00 committed by GitHub
parent 87c75e5ac8
commit d176a678e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -306,7 +306,7 @@ export class BrowserApi {
) {
event.addListener(callback);
if (BrowserApi.isSafariApi && !BrowserApi.isBackgroundPage(window)) {
if (BrowserApi.isSafariApi && !BrowserApi.isBackgroundPage(self)) {
BrowserApi.trackedChromeEventListeners.push([event, callback]);
BrowserApi.setupUnloadListeners();
}
@ -323,7 +323,7 @@ export class BrowserApi {
) {
event.removeListener(callback);
if (BrowserApi.isSafariApi && !BrowserApi.isBackgroundPage(window)) {
if (BrowserApi.isSafariApi && !BrowserApi.isBackgroundPage(self)) {
const index = BrowserApi.trackedChromeEventListeners.findIndex(([_event, eventListener]) => {
return eventListener == callback;
});