aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-15 14:22:09 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-15 14:22:09 +0100
commit5ed09841865eb0c309f1501c6de15fc454478db7 (patch)
tree256c04d3680245a3a1e67ceedda30339568eeddb /common
parent92fc67cfa135526cef75311c3ee1a14e248c3060 (diff)
downloadbrowser-extension-5ed09841865eb0c309f1501c6de15fc454478db7.tar.gz
browser-extension-5ed09841865eb0c309f1501c6de15fc454478db7.zip
fix loading initial data and verify it in automated tests
Diffstat (limited to 'common')
-rw-r--r--common/indexeddb.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/common/indexeddb.js b/common/indexeddb.js
index cf38d23..1c6244b 100644
--- a/common/indexeddb.js
+++ b/common/indexeddb.js
@@ -111,7 +111,8 @@ async function perform_upgrade(event) {
store = opened_db.createObjectStore(store_name, key_mode);
const ctx = make_context(store.transaction, initial_data.file);
- await _save_items(initial_data.resource, initial_data.mapping, [], ctx);
+ await _save_items(initial_data.resource, initial_data.mapping,
+ initial_data.repo || [], ctx);
return opened_db;
}
@@ -312,8 +313,10 @@ async function _save_items(resources, mappings, repos, context)
for (const item of resources.concat(mappings))
await save_item(item, context);
- for (const repo_url of repos)
+ for (const repo_url of repos) {
+ broadcast.prepare(context.sender, "idb_changes_repo", repo_url);
await idb_put(context.transaction, "repo", {url: repo_url});
+ }
await finalize_transaction(context);
}