mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Fix for Firefox not offering promise based APIs in mv2
This commit is contained in:
Submodule maze-utils updated: d23dbf3add...d583d2d627
@@ -16,6 +16,7 @@ import { getExtensionIdsToImportFrom } from "./utils/crossExtension";
|
|||||||
import { isFirefoxOrSafari } from "../maze-utils/src";
|
import { isFirefoxOrSafari } from "../maze-utils/src";
|
||||||
import { injectUpdatedScripts } from "../maze-utils/src/cleanup";
|
import { injectUpdatedScripts } from "../maze-utils/src/cleanup";
|
||||||
import { logWarn } from "./utils/logger";
|
import { logWarn } from "./utils/logger";
|
||||||
|
import { chromeP } from "../maze-utils/src/browserApi";
|
||||||
const utils = new Utils({
|
const utils = new Utils({
|
||||||
registerFirefoxContentScript,
|
registerFirefoxContentScript,
|
||||||
unregisterFirefoxContentScript
|
unregisterFirefoxContentScript
|
||||||
@@ -177,7 +178,7 @@ async function registerFirefoxContentScript(options: Registration) {
|
|||||||
await unregisterFirefoxContentScript(options.id);
|
await unregisterFirefoxContentScript(options.id);
|
||||||
|
|
||||||
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
||||||
await chrome.scripting.registerContentScripts([{
|
await chromeP.scripting.registerContentScripts([{
|
||||||
id: options.id,
|
id: options.id,
|
||||||
runAt: "document_start",
|
runAt: "document_start",
|
||||||
matches: options.matches,
|
matches: options.matches,
|
||||||
@@ -203,7 +204,7 @@ async function registerFirefoxContentScript(options: Registration) {
|
|||||||
*/
|
*/
|
||||||
async function unregisterFirefoxContentScript(id: string) {
|
async function unregisterFirefoxContentScript(id: string) {
|
||||||
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
||||||
await chrome.scripting.unregisterContentScripts({
|
await chromeP.scripting.unregisterContentScripts({
|
||||||
ids: [id]
|
ids: [id]
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user