diff --git a/Safari Shared/Resources/service_worker.js b/Safari Shared/Resources/service_worker.js index 70db43fb..d04c051f 100644 --- a/Safari Shared/Resources/service_worker.js +++ b/Safari Shared/Resources/service_worker.js @@ -151,13 +151,7 @@ function mobileRedirectFor(request, sendResponse) { const query = encodeURIComponent(JSON.stringify(request)); browser.tabs.getCurrent((tab) => { if (tab) { - browser.scripting.executeScript({ - target: { tabId: tab.id }, - func: (query) => { - window.location.href = `https://tokenary.io/extension?query=${query}`; - }, - args: [query] - }).then(() => {}).catch(() => {}); + browser.tabs.executeScript(tab.id, { code: 'window.location.href = `https://tokenary.io/extension?query=' + query + '`;' }); sendResponse(); } }); @@ -171,7 +165,7 @@ function genId() { function addListeners() { browser.runtime.onMessage.addListener(handleOnMessage); - browser.action.onClicked.addListener(handleOnClick); + browser.browserAction.onClicked.addListener(handleOnClick); } addListeners(); diff --git a/Safari iOS/Resources/manifest.json b/Safari iOS/Resources/manifest.json index 8ea544de..87804c49 100644 --- a/Safari iOS/Resources/manifest.json +++ b/Safari iOS/Resources/manifest.json @@ -1,5 +1,5 @@ { - "manifest_version": 3, + "manifest_version": 2, "default_locale": "en", "name": "__MSG_extension_name__", @@ -15,7 +15,8 @@ }, "background": { - "service_worker": "service_worker.js" + "scripts": [ "service_worker.js" ], + "persistent": false }, "content_scripts": [{ @@ -25,7 +26,7 @@ "js": [ "ios_specific_content.js", "content.js" ] }], - "action": { + "browser_action": { "default_icon": { "16": "images/toolbar-icon-16.png", "19": "images/toolbar-icon-19.png", @@ -35,7 +36,6 @@ }, "permissions": [ - "scripting", "nativeMessaging", "storage", "activeTab", @@ -49,8 +49,5 @@ "tokenary://*" ], - "web_accessible_resources": [{ - "resources": [ "inpage.js" ], - "matches": [""] - }] + "web_accessible_resources": [ "inpage.js" ] } diff --git a/Safari macOS/Resources/manifest.json b/Safari macOS/Resources/manifest.json index ed1769d2..74abc8ed 100644 --- a/Safari macOS/Resources/manifest.json +++ b/Safari macOS/Resources/manifest.json @@ -1,5 +1,5 @@ { - "manifest_version": 3, + "manifest_version": 2, "default_locale": "en", "name": "__MSG_extension_name__", @@ -15,7 +15,8 @@ }, "background": { - "service_worker": "service_worker.js" + "scripts": [ "service_worker.js" ], + "persistent": false }, "content_scripts": [{ @@ -25,7 +26,7 @@ "js": [ "macos_specific_content.js", "content.js" ] }], - "action": { + "browser_action": { "default_icon": { "16": "images/toolbar-icon-16.png", "19": "images/toolbar-icon-19.png", @@ -37,7 +38,8 @@ "permissions": [ "nativeMessaging", "storage", - "activeTab" + "activeTab", + "tabs" ], "host_permissions": [ @@ -46,8 +48,5 @@ "https://tokenary.io/*" ], - "web_accessible_resources": [{ - "resources": [ "inpage.js" ], - "matches": [""] - }] + "web_accessible_resources": [ "inpage.js" ] }