From e832ae57300a87c68ae804f09e9f35c274c10fdb Mon Sep 17 00:00:00 2001 From: stoically Date: Mon, 10 Aug 2020 18:36:04 +0200 Subject: [PATCH] fix(scripts): add webNavigation listener after firefox restart --- src/background/event-listeners.ts | 19 +++++++++---------- src/background/preferences.ts | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/background/event-listeners.ts b/src/background/event-listeners.ts index b50cacc..1108b12 100644 --- a/src/background/event-listeners.ts +++ b/src/background/event-listeners.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { TemporaryContainers } from './tmp'; -import { Debug, Permissions } from '~/types'; +import { Debug } from '~/types'; // to have persistent listeners we need to register them early+sync // and wait for tmp to fully initialize before handling events @@ -166,15 +166,14 @@ export class EventListeners { this.registerPermissionedListener(); } - registerPermissionedListener(permissions?: Permissions): void { - permissions?.webNavigation && - browser.webNavigation?.onCommitted.addListener( - this.wrap( - browser.webNavigation?.onCommitted, - this.background.scripts, - 'maybeExecute' - ) - ); + registerPermissionedListener(): void { + browser.webNavigation?.onCommitted.addListener( + this.wrap( + browser.webNavigation?.onCommitted, + this.background.scripts, + 'maybeExecute' + ) + ); } wrap( diff --git a/src/background/preferences.ts b/src/background/preferences.ts index fee9259..baadfeb 100644 --- a/src/background/preferences.ts +++ b/src/background/preferences.ts @@ -153,7 +153,7 @@ export class Preferences { } if (!this.permissions.webNavigation && newPreferences.scripts.active) { this.permissions.webNavigation = true; - this.eventlisteners.registerPermissionedListener(this.permissions); + this.eventlisteners.registerPermissionedListener(); } if (