Wren a web browser where WebAssembly runs everything, JavaScript included

Wren 0.2.0

Wren 0.2.0 runs JavaScript, without giving up its one rule: WebAssembly is still the only execution engine. The scripts of a page run in QuickJS-ng compiled to a WebAssembly module, inside the same Wasmtime sandbox, memory limits and interruption as every other module. Pages written directly in Wasm work as before.

This is still a prototype: JavaScript is interpreted (no JIT), part of the web platform is missing, and Wren is Windows-only.

Highlights

  • JavaScript inside WebAssembly. QuickJS-ng 0.17.0, compiled by a pinned Zig to a WASI module, pre-initialized at build time and embedded in wren.exe: a new page's realm starts in about 0.5 ms. Each page and each JavaScript worker has its own instance, with a heap cap, a clean stop for scripts that run too long and a hard deadline behind it; a crash of the engine loses that page's scripts, never the browser. JavaScript can be turned off globally (javascript.enabled) or per site (javascript.sites.disabled, javascript.sites.enabled). The engine passes 99.92 % of test262; it runs about 0.77 times as fast as the same engine compiled natively, and about 55 times slower than Edge on Octane.
  • The web platform for scripts, generated from the specifications. The bindings are generated from the official Web IDL (webref), with Web IDL's conversion rules; 2,630 of the 4,991 members of the specifications are implemented, and those that are not are absent, so feature detection works (docs/js/coverage.md). The DOM (tree, selectors, innerHTML, CSSOM, geometry, events, observers, ranges), script loading as HTML specifies it (defer / async, document.write, ES modules and import maps, inline handlers, <noscript>, CSP), custom elements, IntersectionObserver, PerformanceObserver, fetch, XMLHttpRequest, streams, Blob, URL, encoding, storage, history, crypto.subtle, WebSocket, EventSource, workers and a minimal Intl. About 106,000 web-platform-tests subtests pass, and every regression fails the test suite.
  • Shadow DOM. attachShadow and declarative shadow roots, which render even with JavaScript off; named and manual slots; encapsulated styles with :host, ::slotted(), ::part() and :state(); constructable stylesheets; event retargeting and delegatesFocus. Sites built from web components, such as MDN, now show their header bar and their theme, language and filter controls.
  • Pages closer to Chromium. Text is placed vertically as Chromium places it (font metrics rounded the same way, half-leading, vertical-align, flex and button centering, table cells, form controls). Old-style HTML attributes (bgcolor, align, <font>, table attributes) and quirks mode are honoured, image sizes follow the decoded image, and synthetic italics work for web fonts.
  • A more complete browser. Tabs with favicons, loading indicators and drag to reorder; error pages by cause; downloads with the Windows Save dialog; optional session restore; Windows paths in the address bar, files and folders dropped on the window, folders opening their index.html or a list of their files; about:demos grouped by theme, JavaScript included.
  • Faster and safer. Shaders are precompiled, so the start page is drawn about 0.3 s after launch instead of 1.8 s; resizing no longer reallocates the swap chain and media queries only restyle when their answer changes. A review of the whole engine fixed about 90 problems, among them use-after-frees, ways for a file: page to leave its folder, content that could crash or freeze the browser, and CORS on redirects; flaky tests were fixed at their cause rather than retried. Closing a WebSocket from a message handler no longer ends in an error, and a page that floods timers no longer stalls the interface.

Download

wren-0.2.0-windows-x64.zip: unzip, run wren.exe (Windows 10 or 11 x64, Direct3D 11). The demo pages are in demos\ (open demos\index.html or about:demos); demo.bat starts the small server some of them need. Check the download against SHA256SUMS.txt.

Edit this page on GitHub