Page MenuHomePhabricator

Expose olm WASM to push notif service-worker on web.
ClosedPublic

Authored by marcin on Oct 30 2023, 9:07 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 9:43 PM
Unknown Object (File)
Sat, Nov 23, 8:51 AM
Unknown Object (File)
Wed, Nov 20, 7:55 AM
Unknown Object (File)
Thu, Nov 7, 2:50 PM
Unknown Object (File)
Thu, Nov 7, 8:08 AM
Unknown Object (File)
Tue, Oct 29, 10:40 AM
Unknown Object (File)
Tue, Oct 29, 7:47 AM
Unknown Object (File)
Tue, Oct 29, 7:45 AM
Subscribers

Details

Summary

This differential enables olm usage in notifications service-worker on web.

Test Plan
  1. Apply this diff (in order to actually initialize olm with WASM file since eventually it will be initialised when receiving notification in next diff): https://gist.github.com/marcinwasowicz/20ee184547487d05aa5421af8c77b107
  2. Open web app.
  3. In new tab open chrome://inspect/#workers
  4. Go to Service Workers then worker/notif and finally click inspect. This should open a console.
  5. Finally reload web app and ensure that no error is logged.

Repeat for prod and dev

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

In the past I had some issues with testing it related to caching, it might be good to repeat the test with a disabled cache.

web/database/utils/constants.js
11 ↗(On Diff #32502)

that's on me, but feel like this should be something like WORKERS_MODULE_DIR_PATH as this not lead to file and could confuse someone

web/webpack.config.cjs
172–184 ↗(On Diff #32502)

looks like this will cause downloading this file twice, once for the app and the second time for the worker but probably there is no easy and better solution, but it's downloaded only on the first time or on olm update

This revision is now accepted and ready to land.Oct 31 2023, 4:25 AM

Don't initialize olm when receiving WASM path but store it in IndexedDB. This is necessary since any global state kept within service-worker can be wiped anytime
without notice. That said we need to keep WASM path and initialize olm when receiving notification in case its state was wiped out.

Add staffCanSee to the data passed from the main app to web notification service.

Rename WORKERS_MODULES_FILE_PATH -> WORKERS_MODULES_DIR_PATH