Aurora browser engine made in rust programming language | The quest for youtube

109 points Inevitable_Back3319 69 comments

Youtube current status

Hiii , trying out a more detailed and technical post this time that will be more interesting to the rust crowd.

Source code:
https://github.com/JohannaWeb/Aurora

Aurora is a browser engine I am writing from scratch in Rust.

It is not Chromium, not WebKit, and not a wrapper. It parses HTML, runs JavaScript, resolves CSS, lays out boxes, and paints pixels. The browser UI itself is also rendered by Aurora.

It is not fully from scratch in the purist sense. JavaScript runs on V8, CSS uses Stylo through blitz-dom, and painting goes through Vello. Aurora is the part that ties all of that together into a working engine, with capability gating as one of its core design ideas.

For a while, my test has been simple:

Can it render YouTube?

YouTube is a brutal target. It is a huge SPA built on Polymer and ShadyDOM, with tons of custom elements, shadow DOM behavior, template stamping, timers, mutation observers, private navigation code, and a massive minified JS bundle.

Getting it this far meant fixing a lot of boring but important browser things.

Custom elements had to define and upgrade correctly. Events had to actually propagate. MutationObserver, AbortController, and delayed timers had to work. I also hit bugs like double-parented nodes that made YouTube spin forever in its own cleanup logic.

The biggest recent win was the masthead logo.

It kept laying out as 0x0. The issue ended up being ShadyDOM composition. Polymer was stamping content into detached logical fragments, but Aurora was not composing those fragments back into the connected tree properly. That meant connected callbacks did not fire, so the logo never rendered.

After fixing that, there was one more bug: Aurora’s parent validation code was treating a shadow root as stale and disconnecting it from its host. Shadow roots live on a dedicated field, not in the normal child list, so the check was wrong.

Fixing that made the logo render at a real size, and the paint path count jumped from under 300 to over 400.

Watch pages also render the player frame now. A blank video I chased for a while turned out to be a removed YouTube video, not an Aurora bug. Live videos return real player data, and the black player box with the red play button now paints.

There is still a lot broken. The current blocker is a Stylo panic that happens when style invalidation reaches an element without computed style. The maintainers confirmed it is already fixed upstream, but not yet released, so for now I am working around it and trying to make Aurora fail more gracefully.

YouTube is nowhere near done.

But the masthead paints. The player frame paints. The feed instantiates. More of the page survives every week.