diff options
author | Wojtek Kosior <koszko@koszko.org> | 2022-01-10 23:38:56 +0100 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2022-01-10 23:38:56 +0100 |
commit | 19304cd1ae4e4ba4f6dcf4f1db14de1e4e70c250 (patch) | |
tree | 2e7e6f904ad16f9402827a7bc215a419de5c2656 /common | |
parent | 38650a8102fe0841617cd80f3a6e45b1f5f62fd5 (diff) | |
download | browser-extension-19304cd1ae4e4ba4f6dcf4f1db14de1e4e70c250.tar.gz browser-extension-19304cd1ae4e4ba4f6dcf4f1db14de1e4e70c250.zip |
improve item list styling; add payload creation form; exend dialog mechanism
Diffstat (limited to 'common')
-rw-r--r-- | common/indexeddb.js | 4 | ||||
-rw-r--r-- | common/lock.js | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/common/indexeddb.js b/common/indexeddb.js index f9c407a..a18c9be 100644 --- a/common/indexeddb.js +++ b/common/indexeddb.js @@ -313,8 +313,8 @@ async function _save_items(resources, mappings, context) /* * Save given definition of a resource/mapping to IndexedDB. If the definition * (passed as `item`) references files that are not already present in - * IndexedDB, those files should be present as values of the `files_sha256` - * object with keys being of the form `sha256-<file's-sha256-sum>`. + * IndexedDB, those files should be provided as values of the `files' object + * used to create the transaction context. * * context should be one returned from start_items_transaction() and should be * later passed to finalize_transaction() so that files depended on are added to diff --git a/common/lock.js b/common/lock.js index 8dd2f5b..f577481 100644 --- a/common/lock.js +++ b/common/lock.js @@ -68,9 +68,20 @@ function _lock(lock, cb) { #EXPORT lock => new Promise(resolve => _lock(lock, resolve)) AS lock +function try_lock(lock) +{ + if (lock.free) { + lock.free = false; + return true; + } + + return false; +} +#EXPORT try_lock + function unlock(lock) { if (lock.free) - throw new Error("Attempting to release a free lock"); + throw new Exception("Attempting to release a free lock"); if (lock.queue.length === 0) { lock.free = true; |