Dev log: Creating a browser
For a while now I have been thinking of writing my own browser. The reason is that nowadays, when looking for a browser for daily use, there seem to be only two alternatives: 1. Something based on Chromium and 2. Firefox.
Everything Chromium-based is out of question for obvious reasons and Firefox seem to get worse every year. Of course there are some other alternatives such as Webkit-based browsers (which is basically the same as Chromium-based), text-based browsers, dillo, netsurf, etc. However, none of these fill the role of Firefox.
Therefore I was thinking of creating my own. Of course, everyone online is convinced that this is an impossible task for one person, but that is not a valid reason to not at least try it. When planning this out, I believe it can be done in a finite amount of time.
Why not just improve netsurf/dillo/...?
Because these are written in C. I have nothing against C as a language, but I believe that I do not have the skill required to write a browser in C without introducing security issues. That is why I have settled on Rust.
Goals and non-goals
One of the biggest points of criticism for me on Firefox is that it contains lots of features that I don't need, like Pocket, that screenshot function, sync, etc. To not run into the same mistake I believe it is sensible to define what features the browser should have and which can be avoided.
- HTML support
- CSS support
- HTML audio/video playback (maybe in the beginning by utilizing mpv's feature of playing in a pre-defined X window)
- Warnings about SSL/TLS problems
- Maybe: Print support
- Maybe: Webcam/microphone support for web conferences
- Maybe: Windows support
The browser will follow the suckless principle. This means it won’t have a lot of features that other browsers have, since better solutions are already available:
- Downloads - use a download manager which fetches URLs from the clipboard (can be easily scripted)
- Torrent support (Brave has this)
- Tor support - use a proxy
- Bookmarks - there are standalone tools for this
- Tabs - use https://tools.suckless.org/tabbed/
- Password saving - use pass
- Smooth scrolling - Annoys me to no end that this is enabled by default
- Telemetry (this is not even a feature)
- Annoying notifications (this video is now fullscreen)
- A preferences dialog - use a config file; but auto-reload when the config changes.
- Mac support
Based on these lists, I think it is possible to derive the tasks that have to be completed:
- Open a X window
- Draw text in the window. Monospace without any formatting is fine at the beginning
- Fetch HTML source.
- Display it in the window.
- Implement scrolling
This would be milestone 1: An application which is capable of displaying plaintext web content. That is enough to read the US constitution or the fidonet policy. The next tasks would be:
- Implement a HTML parser
- Implement the HTML DOM tree
- Render the plain text of HTML pages, without any formatting at this point
Milestone 2: Being able to read plain-text HTML pages. This should be enough to read the essays of paul graham. The next task would be HTML and CSS:
- Render HTML elements correctly, e.g. tables - this will spawn a few subtasks
- Implement a CSS parser
- Apply CSS rules correctly - this will spawn lots of subtasks