diff options
author | Wojtek Kosior <wk@koszkonutek-tmp.pl.eu.org> | 2021-05-13 12:40:22 +0200 |
---|---|---|
committer | Wojtek Kosior <wk@koszkonutek-tmp.pl.eu.org> | 2021-05-13 12:40:22 +0200 |
commit | 31fa27e8920267e03580c94d84cb0df80440c260 (patch) | |
tree | 57e4ffb3df49cca81bb8b67e44e884e38c5d4205 | |
parent | c4ed1b8d44c37938aaa9b12674077274554742eb (diff) | |
download | browser-extension-31fa27e8920267e03580c94d84cb0df80440c260.tar.gz browser-extension-31fa27e8920267e03580c94d84cb0df80440c260.zip |
make extension work under IceCat 60
-rw-r--r-- | TODOS.org | 5 | ||||
-rw-r--r-- | common/browser.js | 9 | ||||
-rw-r--r-- | html/options_main.js | 14 | ||||
-rw-r--r-- | manifest.json | 18 |
4 files changed, 27 insertions, 19 deletions
@@ -22,7 +22,9 @@ TODO: - make script bag components re-orderable (via drag&drop in options page) -- CRUCIAL - find some way not to require each chrome user to modify manifest.json - rename the extension to something good -- port to gecko-based browsers -- CRUCIAL +- test with more browser forks (Abrowser, Parabola IceWeasel, LibreWolf) + - also see if browsers based on pre-quantum FF support enough of + WebExtensions for easy porting - make sure page's own csp doesn't block our scripts - make blocking more torough -- CRUCIAL - mind the data: urls -- CRUCIAL @@ -40,6 +42,7 @@ TODO: - perform never-ending refactoring of already-written code DONE: +- port to gecko-based browsers -- DONE 2021-05-13 - find a way to additionally block all other scripts using CSP -- DONE 2021-05-13 - only allow a single injection payload for page -- DONE 2021-05-13 - rename "bundles" to "bags" to avoid confusion with Web Bundles -- DONE 2021-05-12 diff --git a/common/browser.js b/common/browser.js index 1d9edda..d1aab82 100644 --- a/common/browser.js +++ b/common/browser.js @@ -16,12 +16,13 @@ */ (() => { - if (window.browser === undefined) { + if (typeof browser === "object") { + window.browser = browser; + window.is_chrome = false; + window.is_mozilla = true; + } else { window.browser = window.chrome; window.is_chrome = true; window.is_mozilla = false; - } else { - window.is_chrome = false; - window.is_mozilla = true; } })(); diff --git a/html/options_main.js b/html/options_main.js index c643f25..f201023 100644 --- a/html/options_main.js +++ b/html/options_main.js @@ -142,9 +142,11 @@ function reset_work_page_li(ul, item, settings) { ul.work_name_input.value = item; - page_allow_chbx.checked = !!settings?.allow; + if (settings === undefined) + settings = {allow: false, components: undefined}; + page_allow_chbx.checked = !!settings.allow; - set_page_components(settings?.components); + set_page_components(settings.components); } function work_page_li_components() @@ -240,9 +242,11 @@ function reset_work_script_li(ul, name, data) { ul.work_name_input.value = maybe_string(name); - script_url_input.value = maybe_string(data?.url); - script_sha256_input.value = maybe_string(data?.hash); - script_contents_field.value = maybe_string(data?.text); + if (data === undefined) + data = {}; + script_url_input.value = maybe_string(data.url); + script_sha256_input.value = maybe_string(data.hash); + script_contents_field.value = maybe_string(data.text); } /* Used to get edited script data for saving. */ diff --git a/manifest.json b/manifest.json index efdcba0..aade4ac 100644 --- a/manifest.json +++ b/manifest.json @@ -3,17 +3,17 @@ "name": "My extension", "short_name": "Myext", "version": "0.0.0", - /* - WARNING!!! - EACH USER SHOULD REPLACE "key" WITH UNIQUE VALUE!!! - OTHERWISE SECURITY CAN BE TRIVIALLY COMPROMISED! - A unique key can be generated with: - $ ssh-keygen -f /path/to/new/key.pem -t rsa -b 1024 + // WARNING!!! + // EACH USER SHOULD REPLACE "key" WITH UNIQUE VALUE!!! + // OTHERWISE SECURITY CAN BE TRIVIALLY COMPROMISED! + // + // A unique key can be generated with: + // $ ssh-keygen -f /path/to/new/key.pem -t rsa -b 1024 + // + // Only relevant to users of chrome-based browsers. + // Users of FireFox forks are safe. - Only relevant to users of chrome-based browsers. - Users of FireFox forks are safe. - */ "key": "b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAlwAAAAdzc2gtcnNhAAAAAwEAAQAAAIEA+0GT5WNmRRo8e5tL9+BmNtY6aBPwLIgbPnLShYBMSR40iYwLTsccrkwBXb3bs1o4p6q5WJugI8Lsia+GXZc/XHGFkq7D1aWiTxlJLs8z0JC2TQ2/yatYmBMchogYGeeUfP7aI7JJZwpATts+VhIvgga/4FYj+DijMIEpwdckqFEAAAII4Dh7HOA4exwAAAAHc3NoLXJzYQAAAIEA+0GT5WNmRRo8e5tL9+BmNtY6aBPwLIgbPnLShYBMSR40iYwLTsccrkwBXb3bs1o4p6q5WJugI8Lsia+GXZc/XHGFkq7D1aWiTxlJLs8z0JC2TQ2/yatYmBMchogYGeeUfP7aI7JJZwpATts+VhIvgga/4FYj+DijMIEpwdckqFEAAAADAQABAAAAgEHB5/MhEKMFOs8e1cMJ97ZiWubiUPlWpcqyQmauLUj1nspg3JTBh8AWJEVkaxuFgU5gYCHQmRjC6yUdywyziOEkFA4r/WpX4WmbIe+GQHRHhitLN0dgF8N6/fVNOoa5StTdfZqyl23pVXyepoDNjrJFKyupqPMmpwfH5lGr9RwBAAAAQG76HflB/5j8P2YgIYX6dQT4Ei0SqiIjNVy7jFJUQDKSJg/PYkedE02JZJBJPcMYxEJUxXtMgq+upamNILfkmY0AAABBAP4v0O5dqjy16xDDFzb4DPNAcw5Za9KJaXKVkUuKXMNZOKTR0RC/upjNTmttY980RKdIx5zA25dO8cx563bSDIsAAABBAP0MaOpBiai/eRmLqhlthHODa+Mur6W3uc9PyhWhgDBjLNMR/doaYeyfVKxtIiN3a+HkN++G+vbokRweQv++bhMAAAANdXJ6QGxvY2FsaG9zdAECAwQFBg==", "author": "various", "description": "Kill the web&js", |