Add IDBFS.onAutoPersistStateChanged callback. Fixes flakiness in browser.test_fs_idbfs_sync_autopersist#26895
Conversation
sbc100
left a comment
There was a problem hiding this comment.
lgtm.
I think a public callback for "sync is now complete" might be a good thing to add at some point, but no need to block this PR on that.
|
On further thought, I added a callback to |
|
Does this look good to go? |
sbc100
left a comment
There was a problem hiding this comment.
Nice.
I wonder if you should maybe try to be modern and use a promise here instead of a callback?
e.g. the user would write IDBFS.autoPersistComplete().then(...)
Or
...
await IDBFS.autoPersistComplete();
doCleanUp();
...
| callUserCallback(_finish); | ||
| } | ||
| } | ||
| }); |
There was a problem hiding this comment.
So this would just be EM_ASM(IDBFS.autoPersistComplete().then(finish));
Then no auto-persist is outstanding the promise would just resolve right away.
Promise only resolves once, but this callback fires every time there is an autopersist start or end. So caller would have to juggle repeat promise registrations after every time their callback fires, and there would have to be a mechanism to pregenerate those promises. I don't think that would work too well? |
Fair enough. |
…ence logic time to complete before quitting the test.
Add IDBFS.onAutoPersistStateChanged callback that can be used to detect when IDBFS autopersistence operations start and finish.
Fixes test failures in test browser.test_test_fs_idbfs_sync_autopersist, by giving the persistence logic time to complete before quitting the first phase of test.