Use chromep in another spot

This commit is contained in:
Ajay
2023-08-25 16:03:17 -04:00
parent 3b06d72270
commit 9946bd1af2

View File

@@ -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]
}); });