aboutsummaryrefslogtreecommitdiff
path: root/background
diff options
context:
space:
mode:
authorWojtek Kosior <wk@koszkonutek-tmp.pl.eu.org>2021-05-13 09:27:56 +0200
committerWojtek Kosior <wk@koszkonutek-tmp.pl.eu.org>2021-05-13 11:13:11 +0200
commit57f32a269a06ec5102b08824d251afa5456d4195 (patch)
tree8ef9e47c91cf74ac47dea2e29998c4aaa7068638 /background
parentf6a7f24e61a78f197250875ac9833f497a455d20 (diff)
downloadbrowser-extension-57f32a269a06ec5102b08824d251afa5456d4195.tar.gz
browser-extension-57f32a269a06ec5102b08824d251afa5456d4195.zip
only allow a single injection payload for page, rely on script bags for complex payloads
Diffstat (limited to 'background')
-rw-r--r--background/main.js10
-rw-r--r--background/page_actions_server.js3
-rw-r--r--background/reverse_use_info.js6
3 files changed, 15 insertions, 4 deletions
diff --git a/background/main.js b/background/main.js
index 6b636c4..6656284 100644
--- a/background/main.js
+++ b/background/main.js
@@ -110,7 +110,11 @@
components.push([TYPE_PREFIX.SCRIPT, name]);
}
- await storage.set(TYPE_PREFIX.PAGE, "https://my.fsf.org/join", {components});
+ await storage.set(TYPE_PREFIX.BAG, "myfsf_join", components);
+
+ await storage.set(TYPE_PREFIX.PAGE, "https://my.fsf.org/join", {
+ components: [TYPE_PREFIX.BAG, "myfsf_join"]
+ });
let hello_script = {
text: "console.log(\"hello, every1!\");\n"
@@ -119,7 +123,7 @@
await storage.set(TYPE_PREFIX.BAG, "hello",
[[TYPE_PREFIX.SCRIPT, "hello"]]);
await storage.set(TYPE_PREFIX.PAGE, "https://my.fsf.org/", {
- components: [[TYPE_PREFIX.BAG, "hello"]],
+ components: [TYPE_PREFIX.BAG, "hello"],
allow: true
});
@@ -157,7 +161,7 @@ for (let prop of data.props.pageProps.list) {
await storage.set(TYPE_PREFIX.SCRIPT, "opencores", opencores_script);
await storage.set(TYPE_PREFIX.PAGE, "https://opencores.org/projects", {
- components: [[TYPE_PREFIX.SCRIPT, "opencores"]],
+ components: [TYPE_PREFIX.SCRIPT, "opencores"],
allow: false
});
}
diff --git a/background/page_actions_server.js b/background/page_actions_server.js
index 2a0b858..2dfcf9a 100644
--- a/background/page_actions_server.js
+++ b/background/page_actions_server.js
@@ -31,7 +31,8 @@
let components = settings.components;
let processed_bags = new Set();
- send_scripts_rec(components, port, processed_bags);
+ if (components !== undefined)
+ send_scripts_rec([components], port, processed_bags);
}
// TODO: parallelize script fetching
diff --git a/background/reverse_use_info.js b/background/reverse_use_info.js
index 688cd64..c51d06b 100644
--- a/background/reverse_use_info.js
+++ b/background/reverse_use_info.js
@@ -11,6 +11,12 @@
"use strict";
/*
+ * Warning!
+ * This script file has not been used for some time and underlying storage
+ * model has changed since then! Fix required!
+ */
+
+/*
* We want to count referenes to scripts and bags in order to know,
* for example, whether one can be safely deleted.
*/