QuickJS Running in WebAssembly

by angrygoaton 11/20/22, 5:40 AMwith 26 comments
by dangon 11/20/22, 8:04 AM

Related:

QuickJS JavaScript Engine - https://news.ycombinator.com/item?id=30598026 - March 2022 (67 comments)

A small but complete JavaScript engine - https://news.ycombinator.com/item?id=24867103 - Oct 2020 (146 comments)

QuickJS JavaScript Engine - https://news.ycombinator.com/item?id=20411154 - July 2019 (261 comments)

QuickJS JavaScript Engine - https://news.ycombinator.com/item?id=20404503 - July 2019 (3 comments)

by pyrolisticalon 11/20/22, 7:13 AM

Running user provided js in quickjs in webassembly in a worker in an sandboxed iframe on a different domain would offer many layers of security

by Arathornon 11/20/22, 9:15 AM

This is very similar to how Third Room’s user generated content engine is being implemented (supporting C, Rust and Zig alongside QuickJS though): https://thenewstack.io/third-room-teases-user-generated-cont...

by lioeterson 11/20/22, 11:30 AM

Another library I found recently, which has a different take (simpler API) for using QuickJS compiled to WASM:

https://github.com/taowen/define-function

by vbezhenaron 11/20/22, 8:24 AM

Imagine something like "base system" with WebAssembly, bare bones HTML engine with canvas support and no CSS. So now you can just download your favourite JS engine, your favourite HTML, CSS engines. But browser does not necessarily need to sheep those. It would allow to lower the bar for entry into browser market. I think that even a single person could implement that kind of base browser.

Of course there're many hard questions. For example downloading an entire JS+HTML+CSS engine with every website is not a good approach, some caching must be done. There should not be version hell with every website asking for a different version of engine. But those questions could be approached as a more general web library issues.

by jitlon 11/20/22, 6:13 PM

Hello, library author here. Happy to answer whatever questions you have.

by jensneuseon 11/20/22, 8:35 AM

Is this also possible with Go as the host instead of TypeScript?

by anderspitmanon 11/20/22, 5:29 PM

Because it wouldn't be HN if someone didn't: https://www.destroyallsoftware.com/talks/the-birth-and-death...

by Kiroon 11/20/22, 12:56 PM

Would you use this to run untrusted JS on the server?