Hi Firefox team!
I'm a web developer that has spent the last 4 years building native applications in Rust. The desktop application development landscape is very dire.
It's my belief that this is the reason Electron and similar web-wrappers have taken over the desktop development landscape. The obvious issue there is that Electron apps frequently consume hundreds of megabytes of precious RAM (some applications use gigabytes), and despite the cost, are still sluggish.
This feature request is divided into two blocks;
Restore and fortify PWAs.
Take the example of an offline web based
Conventionally, documents would be stored in the cloud however what if I want to provide a traditional application that reads/writes to the disk, leaving backing up to the user.
I'd like to be able to create a mutli-tab PWA that has access to the filesystem (sandboxed) where the application can hold open handles to files and write/read.
This is _kind of possible_ with `SharedWorker` as a holder of said filehandles between multiple tabs, however it lacks certain sync APIs which are required by libraries like websql (should your web application store an SQL file)
WASM for high performance and memory efficient GUIs
Hypothetically, say my application uses no JavaScript - only css and wasm/rust. If the browser reads the html, understands that no JavaScript is required, and does not launch the JavaScript engine, that would unlock the ability to create very high performance, low memory applications (both conventional and PWA).
Assuming the wasi spec is implemented, a wasm binary could be embedded in the html with
<body>
<script src="./main.wasm" type="application/wasi" allow-threads allow-filesystem></script>
</body>Which automatically configures the ability to use threads and offers an FFI with dom operations. This would require no bindings/JavaScript thunking as the dom bindings would be provided by the browser. (This can be in the form of JavaScript WebAPI bindings included with the browser initially, eventually becoming a direct C++ -> wasm `import`).
example;
fn dom_document_create_element(doc: *mut c_void, tag: &str, ret: *mut c_void);
// The FFI API would be enormous, yes, but that's okayThis would allow web applications to be resource efficient and heavily multi-threaded (standard in native desktop/mobile development), while leveraging the ergonomics and cross platform support of the DOM/browser engine.
Contexts like service-worker and sharedworker could be done through html as well, where communication could be provided with message passing via a `fn document_get_element_by_id(&doc, "serviceworker")`
<body>
<script
id="serviceworker" src="./service-worker.wasm"
type="application/wasi" context="serviceworker"></script>
<script
id="sharedworker" src="./shared-worker.wasm"
type="application/wasi" context="sharedworker"></script>
</body>Downsides
Rolling something like this out would literally revolutionize web development