mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 05:27:03 +03:00
Use chromep in another spot
This commit is contained in:
@@ -155,16 +155,7 @@ chrome.runtime.onInstalled.addListener(function () {
|
|||||||
*/
|
*/
|
||||||
async function registerFirefoxContentScript(options: Registration) {
|
async function registerFirefoxContentScript(options: Registration) {
|
||||||
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
if ("scripting" in chrome && "getRegisteredContentScripts" in chrome.scripting) {
|
||||||
// Bug in Firefox where you need to use browser namespace for this call
|
const existingRegistrations = await chromeP.scripting.getRegisteredContentScripts({
|
||||||
const getContentScripts = async (filter: browser.scripting.ContentScriptFilter) => {
|
|
||||||
if (isFirefoxOrSafari()) {
|
|
||||||
return await browser.scripting.getRegisteredContentScripts(filter);
|
|
||||||
} else {
|
|
||||||
return await chrome.scripting.getRegisteredContentScripts(filter);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const existingRegistrations = await getContentScripts({
|
|
||||||
ids: [options.id]
|
ids: [options.id]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user