aboutsummaryrefslogtreecommitdiff
path: root/background
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-09 18:29:49 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-09 18:29:49 +0100
commit3d6ffa57e8a901bd61c2d95fbb6d1ca16d811898 (patch)
tree71878aacd7dae3dab9150f3f34f8256f92c95480 /background
parent1c65dd5ca24052ccf9a92939eecd0966c9635c50 (diff)
downloadbrowser-extension-3d6ffa57e8a901bd61c2d95fbb6d1ca16d811898.tar.gz
browser-extension-3d6ffa57e8a901bd61c2d95fbb6d1ca16d811898.zip
make resource dependency specifier an object
Diffstat (limited to 'background')
-rw-r--r--background/indexeddb_files_server.js4
-rw-r--r--background/patterns_query_manager.js4
2 files changed, 4 insertions, 4 deletions
diff --git a/background/indexeddb_files_server.js b/background/indexeddb_files_server.js
index 0c3f7d8..24fa700 100644
--- a/background/indexeddb_files_server.js
+++ b/background/indexeddb_files_server.js
@@ -62,7 +62,7 @@ async function get_resource_files(getting, id) {
.map(s => haketilodb.idb_get(getting.tx, "files", s.sha256));
const deps_proms = (definition.dependencies || [])
- .map(dep_id => get_resource_files(getting, dep_id));
+ .map(res_ref => get_resource_files(getting, res_ref.identifier));
const files = (await Promise.all(file_proms)).map(f => f.contents);
getting.files_by_res_id.set(id, files);
@@ -93,7 +93,7 @@ function get_files_list(defs_by_res_id, files_by_res_id, root_id) {
processed.add(id);
const ds = (defs_by_res_id.get(id).dependencies || []).reverse();
- ds.forEach(dep_id => to_process.push(["start", dep_id]));
+ ds.forEach(res_ref => to_process.push(["start", res_ref.identifier]));
}
return files;
diff --git a/background/patterns_query_manager.js b/background/patterns_query_manager.js
index 9de9d35..3e2953f 100644
--- a/background/patterns_query_manager.js
+++ b/background/patterns_query_manager.js
@@ -99,7 +99,7 @@ if (this.haketilo_content_script_main)
function register(kind, object) {
if (kind === "mappings") {
- for (const [pattern, resource] of Object.entries(object.payloads))
+ for (const [pattern, resource] of Object.entries(object.payloads || {}))
pqt.register(tree, pattern, object.identifier, resource);
} else /* if (kind === "blocking") */ {
/*
@@ -120,7 +120,7 @@ function changed(kind, change) {
const old_version = currently_registered.get(change.key);
if (old_version !== undefined) {
if (kind === "mappings") {
- for (const pattern in old_version.payloads)
+ for (const pattern in old_version.payloads || {})
pqt.deregister(tree, pattern, change.key);
} else /* if (kind === "blocking") */ {
pqt.deregister(tree, change.key, "~allow");