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)
Thu, Dec 26, 4:03 AM
Unknown Object (File)
Mon, Dec 16, 6:36 AM
Unknown Object (File)
Mon, Dec 16, 6:36 AM
Unknown Object (File)
Mon, Dec 16, 6:36 AM
Unknown Object (File)
Mon, Dec 16, 6:36 AM
Unknown Object (File)
Mon, Dec 16, 6:36 AM
Unknown Object (File)
Mon, Dec 16, 6:36 AM
Unknown Object (File)
Mon, Dec 16, 6:35 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
Lint Not Applicable
Unit
Tests Not Applicable

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