Half of the websites using WebAssembly use it for malicious purposes
zdnet.com
zdnet.com
No, because that's not the same thing:
1) JS opt-in is an advanced setting, not a prompt dialog that appears when a page tries to run it and gets remembered on a site-by-site basis.
2) Until (unless) WASM gets full reign of web APIs, which is a long way off, it will continue to have very sparse legitimate use-cases. Are you trying to play a game, use Photoshop-the-web-app, or use an encrypted messaging service? Click "Yes". Otherwise, it's probably safe to say you don't want whatever-it-is running. It's rare that the average user would want to disable JS on a given site. It's much more likely that they'd want to disable WASM (just like it's much more likely that they'd want to disable geolocation, or push notifications).
It's just a bytecode spec, it wasn't created by the mafia or anything. Many people have already used it for porting software to the web, and for math-intensive operations. You can see plenty of such projects by searching HN.
>What wide and varied legitimate uses to we see for JS now?
Are you implying that most JS is currently used for malicious purposes?
I would guess the vast majority of JS is currently used to render content in the browser as part of a frontend framework, or JQuery, which is probably still widely in use in legacy sites. Also for Google Analytics, which I suppose some people might consider malicious. But then half of HN considers javascript illegitimate and malicious by default anyway.
I classify most ads as malicious, so yes.
Games and cryptography are the only big ones that come to mind right now (for example, services like ProtonMail that do client-side decryption).
Hopefully the DOM limitation (and general API limitations) will be lifted over time, in which case there could be a huge use-case for client-side rendering which can be a bottleneck right now.
Lifting the API limitations could also allow the web to become truly multi-lingual; you could ditch JS entirely.
But other than the above, you still have the question of "what computation really needs to be done in the web client when you have a server on-hand?" Even in Electron, you have the ability to spin up other processes on the host machine.
I think WebAssembly is super cool but it still needs a killer-app. Ironically, one of the places it's really getting some interesting traction is on the server. It's like a JVM without a garbage collector. I look forward to seeing where that goes.
For one, I'm currently experimenting with compiling Kaldi to WebAssembly for local (in-browser) speech recognition.
I'm fully behind WASM - I think it will serve as the backbone for the next generation of web apps for a decade or two.
But the downside to its flexibility is that it is far easier to use for nefarious purposes. I don't think that should poison the well for legitimate use-cases though.
What I'm more excited for, is it also lets you write highly-optimized apps which would use less power, and possibly be served in smaller filesizes. This is great for mobile devices. e.g. managing and comparing 128-bit uints is a big headache in JS, so you rarely see UUIDs handled as anything but strings. There are a few optimizations around that, but ultimately it's going to be a lot easier on memory and run faster matching if you can store it directly as 16-bytes. Trivial in rust compiled to wasm, but not worth your time in JS.
There are also still a lot of programs being compiled to windows/osx/linux target binaries, that could run just as well in a browser with wasm. It's easier to picture what you _don't_ run in browser now as a possibility, instead of simply imagining how the current web will look in wasm.
WebAssembly = undefined;
is all you need.Have you looked at HN lately, or read any of the submissions? Shit, we'd go back to using Gopher if possible.
Static sites with a sprinkle of optional JS to enhance usage (votes in HNs case, although inline JS replies would be a good idea as well) is the way to go for most sites.
SPAs are meant for _large applications_, where the majority of functionality derives from JS, and would be cumbersome to manage otherwise. There are very few of these in comparison.
WebAssembly = undefined;
inside `run_at` `document_start` extension does it for Chrome.