Description
Background
Currently there is no way to terminate a running C / C++ program in WKWebView as wasm in web is single-threaded and blocking. Calling WKWebView.reload()
or releasing the reference to the existing web view doesn't do anything.
Proposal
I propose to run binaries in web workers and use SharedArrayBuffer and worker.postMessage()
to facilitate sync / async communication between native code and the web worker.
Caveat
Due to a security requirement for using SharedArrayBuffer, the following headers from the web server are required to use the API. As we are currently loading the resources using WKWebView.loadFileURL
, there doesn't seem to be a way to set custom headers. From what I've tested, the api is blocked by default when loading a local file. We probably need to serve the files with a local web server (GCDWebServer) instead.
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Metadata
Metadata
Assignees
Type
Projects
Status