Page MenuHomePhabricator

[web/native] make `overwrite` param for inbound session mandatory and unify web & native
ClosedPublic

Authored by kamil on Tue, Apr 9, 4:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 27, 11:09 PM
Unknown Object (File)
Mon, Apr 22, 6:52 PM
Unknown Object (File)
Mon, Apr 22, 10:34 AM
Unknown Object (File)
Wed, Apr 17, 8:01 AM
Unknown Object (File)
Wed, Apr 17, 3:32 AM
Unknown Object (File)
Tue, Apr 16, 8:17 AM
Unknown Object (File)
Mon, Apr 15, 2:43 PM
Unknown Object (File)
Sun, Apr 14, 1:08 PM
Subscribers

Details

Summary

When discovering the race condition we will need to sometimes overwrite the existing session. This diffs makes this param mandatory and unifies usage on native & web.

This changes the functionality of overwrite:

  • when there is no session - create it
  • when there is an existing session with a lower version - overwrite always
  • when there is an existing session with a higher version - throw an error
  • when there is an existing session with the same version - throw error (we allow JS to decide how to handle race condition
  • when there is an existing session and overwrite is set to true - create a new session (even is version is lower)

Depends on D11594

Test Plan

Tested in next diff in the stack.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
web/shared-worker/worker/worker-crypto.js
429–433 ↗(On Diff #38945)

Should we be using olmSessionErrors here?

This revision is now accepted and ready to land.Thu, Apr 11, 12:57 AM

use olmSessionErrors instead of hardcoded string

web/shared-worker/worker/worker-crypto.js
429–433 ↗(On Diff #38945)

definitely we should, thanks for catching