Creating IdentityServiceClientWrapper inside of the shared worker.
Depends on D11273
Differential D11274
[web] Create identity client on shared worker michal on Mar 7 2024, 8:15 AM. Authored by Tags None Referenced Files
Details Creating IdentityServiceClientWrapper inside of the shared worker. Depends on D11273
Creation code: await sharedWorker.schedule({ type: workerRequestMessageTypes.CREATE_IDENTITY_SERVICE_CLIENT, opaqueWasmPath: opaqueWasmPath(), platformDetails: getConfig().platformDetails, authLayer, });
Diff Detail
Event Timeline
Comment Actions Response to the opaque URL comment: Below, I wrote some investigations that I did about the differences between opaque and other WASM files. But I guess if we want to treat opaque the exact same way as we treat the other WASM files it wouldn't be a problem:
The reason the differences exist in this revision of this diff is that I wanted to use the same opaqueURL for both tab-JS-context and webworker-JS-context. But the corresponding JS files for these context are hosted in different places and so have different default origins for network calls. In website-responders.js this is how we specify the URLs: olmFilename: '', commQueryExecutorFilename: '', opaqueURL: 'http://localhost:8080/opaque-ke.wasm', backupClientFilename: '', and for prod: olmFilename: manifest['olm.wasm'], commQueryExecutorFilename: webworkersManifest['comm_query_executor.wasm'], opaqueURL: `compiled/${manifest['comm_opaque2_wasm_bg.wasm']}`, backupClientFilename: webworkersManifest['backup-client-wasm_bg.wasm'], I started investigating it and I discovered some weird things with the opaque WASM file:
So it looks like webpack is automatically copying the wasm file for us but I'm not sure why. That still doesn't really explain why we use 'http://localhost:8080/opaque-ke.wasm'. Possibly just a mistake and it's not necessary? Additionally in prod version, opaqueURL has compiled/ prefix while e.g. olm doesn't. This might be a difference in how the initialization code is generated by wasm-pack and emscripten? Comment Actions Thanks @michal for this detailed research. Do we know who first introduced the opaque WASM? Was it me or @varun maybe? I think the best next step here is to create a new Linear issue with your observations as well as proposed changes to make it consistent, and then to assign to whoever introduced the opaque WASM first. If it's a former team member, then you can assign to me. Comment Actions
I think after migrating the Identity client to worker we will no longer need opaque on tab-JS-context, so it probably makes the most sense to now introduce a new CopyPlugin and match handling opaque wasm as other wasm files in our codebase, and after flipping the switch we can stop hosting this file for tab-JS-context?
Comment Actions Updated the diff to match the changes in previous diffs. Went with the approach suggested by @kamil for the WASM file -> new CopyPlugin in webpack config and added a new a webworkersOpaqueFilename global variable. @ashoat in this case I don't think we need to create a separate a task to make it consistent. If you agree I will just create a task to stop hosting the opaque WASM file for tab-JS-context (that we do in an inconsistent way).
Comment Actions Could you create a task, to after fully migrating Identitiy client to the worker to deprecate opaque on the main thread?
|