Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db0d81e78e |
@@ -17,12 +17,13 @@
|
||||
// move it.
|
||||
// updateState(fn) read fresh, apply fn to that fresh record, write it
|
||||
// back — all holding the lock every write of the stored
|
||||
// record takes, so no other write, by the background or a
|
||||
// page, lands in between, and the read is one storage
|
||||
// round trip ahead of the write rather than a page
|
||||
// lifetime ahead of it (which is what made the popup's
|
||||
// saveState() need a per-field merge against a baseline
|
||||
// at all).
|
||||
// record takes, so no other write lands in between, by
|
||||
// the background or by any page except a page in a
|
||||
// Firefox private window (README, "Stored state and its
|
||||
// version"). The read is one storage round trip ahead of
|
||||
// the write rather than a page lifetime ahead of it
|
||||
// (which is what made the popup's saveState() need a
|
||||
// per-field merge against a baseline at all).
|
||||
//
|
||||
// A handler that must both read and write therefore does its network work
|
||||
// against a snapshot it owns, and applies the RESULT inside updateState().
|
||||
@@ -72,7 +73,8 @@ async function updateStateOnce(mutate) {
|
||||
// src/shared/browserApi.js) is held from the read to the write: two
|
||||
// background turns, or a turn and a page's save, never interleave
|
||||
// (https://git.eeqj.de/sneak/AutistMask/issues/641). Every page's save waits
|
||||
// while it is held.
|
||||
// while it is held, except a page in a Firefox private window, which Firefox
|
||||
// gives locks of its own (README, "Stored state and its version").
|
||||
//
|
||||
// `mutate` must also not call updateState() itself, directly or through
|
||||
// anything it awaits: the inner turn waits for the lock the outer one holds,
|
||||
|
||||
+3
-1
@@ -572,7 +572,9 @@ function reportSaveFailure(err) {
|
||||
// Each save runs start to finish holding the lock every write of the stored
|
||||
// record takes (withLock() in src/shared/browserApi.js), so no write by
|
||||
// another page or the background lands between its read and its write and is
|
||||
// lost (https://git.eeqj.de/sneak/AutistMask/issues/641).
|
||||
// lost (https://git.eeqj.de/sneak/AutistMask/issues/641). A page in a Firefox
|
||||
// private window is the exception: Firefox gives it locks of its own (README,
|
||||
// "Stored state and its version").
|
||||
//
|
||||
// The same lock orders this page's own saves. showView() calls saveState() on
|
||||
// every navigation without awaiting it, so two saves from one page can be
|
||||
|
||||
Reference in New Issue
Block a user