diff options
author | Ajay <[email protected]> | 2023-08-14 09:28:56 -0400 |
---|---|---|
committer | Ajay <[email protected]> | 2023-08-14 09:28:56 -0400 |
commit | d8cc93c841a0cb23d1ed10f36b6b5cc87aae71b7 (patch) | |
tree | 6de33706fd21297d3a7b48b3a970cd702c9e1538 | |
parent | 3dde05eda2f8135ead52504f6384bdff29328819 (diff) | |
download | SponsorBlock-d8cc93c841a0cb23d1ed10f36b6b5cc87aae71b7.tar.gz SponsorBlock-d8cc93c841a0cb23d1ed10f36b6b5cc87aae71b7.zip |
Fix for Firefox not offering promise based APIs in mv2
m--------- | maze-utils | 0 | ||||
-rw-r--r-- | src/background.ts | 5 |
2 files changed, 3 insertions, 2 deletions
diff --git a/maze-utils b/maze-utils -Subproject d23dbf3add5c6b64b837da4bc01672a6ee75fb4 +Subproject d583d2d6278ca4d6c0fc70d7276925b73f6446a diff --git a/src/background.ts b/src/background.ts index 10e98354..ac3847e9 100644 --- a/src/background.ts +++ b/src/background.ts @@ -16,6 +16,7 @@ import { getExtensionIdsToImportFrom } from "./utils/crossExtension"; import { isFirefoxOrSafari } from "../maze-utils/src"; import { injectUpdatedScripts } from "../maze-utils/src/cleanup"; import { logWarn } from "./utils/logger"; +import { chromeP } from "../maze-utils/src/browserApi"; const utils = new Utils({ registerFirefoxContentScript, unregisterFirefoxContentScript @@ -177,7 +178,7 @@ async function registerFirefoxContentScript(options: Registration) { await unregisterFirefoxContentScript(options.id); if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) { - await chrome.scripting.registerContentScripts([{ + await chromeP.scripting.registerContentScripts([{ id: options.id, runAt: "document_start", matches: options.matches, @@ -203,7 +204,7 @@ async function registerFirefoxContentScript(options: Registration) { */ async function unregisterFirefoxContentScript(id: string) { if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) { - await chrome.scripting.unregisterContentScripts({ + await chromeP.scripting.unregisterContentScripts({ ids: [id] }); } else { |