← Back to context

Comment by Matthyze

1 day ago

Out of curiosity, what is the most difficult thing about building a browser?

The very long task list.

Browsers contain several high complexity pieces each of could take a while to build on its own, and interconnect them with reasonably verbose APIs that need to be implemented or at least stubbed out for code to not crash. There is also the difficulty of matching existing implementations quirk for quirk.

I guess the complexity is on-par with operating systems, but with the added compatibility problems that in order to be useful it doesn't just have to load sites intended to be compatible with it, it has to handle sites people actually use on the internet, and those are both a moving target, and tend to use lots of high complexity features that you have to build or at least stub out before the site will even work.

In all sincerity, this question is almost identical to "what's the most difficult thing about building an operating system" as a modern browser is tens of millions of lines of code that can run sophisticated applications. It has a network stack, half a dozen parsers, frame construction and reflow modules, composite, render and paint components, front end UI components, an extensibility framework, and more. Each one of these must enable supporting backward compatibility for 30 year old content as well as ridiculously complex contemporary web apps. And it has to load and render sites that a completely programming illiterate fool like me wrote. It must do this all in a performant and secure way using minimal system resources. Also, it probably also must run on Mac, Windows, Linux, Android, iOS, and maybe more.

Check out the list of all CSS specifications [1], and then open any one of them and see how lengthy and elaborate each is. Then do the same for each version of the spec published over the last thirty years. Before you can start, you must read and understand all of this at a great level of depth. Still, specifications never tell the complete story. You must be aware of all the nuances that are implied by each requirement in the spec and know how to handle the zillion corner cases that will crop up inevitably.

And this is just one part. Not even considering the fully sandboxed, mini operating system for running webapps.

[1] https://www.w3.org/Style/CSS/specs.en.html