We're building a browser when it's supposed to be impossible
awesomekling.substack.com
awesomekling.substack.com
Seems similar to how Wine is developed: instead of just going down the list of API functions to implement, the emphasis seems more on "let's get SomeProgram.exe to run" or "let's fix the graphics glitch in SomeGame.exe". Console emulators (especially of the HLE variety) seem to have a similar flow.
On the web, you may get Twitter's feed rendering acceptably, and then two days later they ship an insignificant redesign that happens to use sixteen CSS features you don't have and everything is totally broken again.
If Twitter rendered fine, chances are some other site render fine today. The same it was with Wine.
But that's not how you use web. If 90% of the pages worked in browser I wouldn't use that browser, ever, because chances are I'd hit one that didn't at least once every few days.
They don't care.
There are many grievances when using the web today, some are down to the lack of a set CSS spec. Others due to the complete and utter disregard for browser compatibility. I'm not going to tackle the monopoly of Chrome as a browser. However, there are a number of specific uses of this collection of ever changing specs and implementations that eventually lead to page-breakage in every new browser release.
The web is complex to tackle because everyone seems to think that they've a better idea of what a page is. Some of it is fair, some of it unfair. Nevertheless I would take this approach any day.
This is a fact that Microsoft understood and pushed when they tried to get people to build pages for IE instead of working across both Navigator and IE.
There's a vast difference between a page being degraded by all browsers in a consistent manner per W3C specs (especially the critical parts of a webpage such as JS execution or malformed HTML) vs the damn thing breaking in such a unique way that the web devs will never be able to fix the page for this new browser while getting it to work the same for others. Worst case would be security is compromised and that is a very long list of things to implement in both the HTTP layer and browser behavior before you even get started trying to render a page.
And for 99% of websites security doesn't matter at all because it's just a one-off visit to read an article or look at some funny pictures without any user account.
Watch this video of Andreas doing exactly this, albeit for a simpler web app https://www.youtube.com/watch?v=W4SxKWwFhA0
At one point, he deletes half the HTML file to isolate where in the site the problematic code is. In a way doing a kind of binary search. After a few iterations of this, he comes up with a very small case that exhibits the problem he's trying to solve.
It's clear he knows his way around the codebase and where to make changes, but isolating these test cases is probably as important. And presumably if you fixed enough of these issues (while following the specs), 99% of the modern web should work just fine.
however the aim to build a reasonably sized and not ossified-to-previous-spec web browser is very interesting, especially if it's well engineered and made to be portable
this is not directed at you, but at this attitude which is very common and which I see all the time: everyone is lightning fast to come up with reasons that something won't work.
why?
why do people say things without understanding that almost any given problem has subproblems, and that those can be solved.
in humans, negativity is always just under the surface, and positivity is often buried deeply, and I do not understand this. I don't think I ever will. people just love to be contrarians.
Instead of it being criticism, the commenter could've seen it as a positive. Every time a site changes, you discover functionality you haven't implemented yet. Over time, you've implemented more and more. It's progress. Progress is good. Choosing the negative interpretation is so endemic and arbitrary and simply unnecessary.
For example in a conservative corporation where a given project requires a ‘go’ from several departments were the success of the project does not give an immediate advantage to those departments, but a failure will require them to explain why they didn’t ‘catch it in review’.
Not an example to follow, but pretty common IME.
It's not negativity to point out a downside to an approach to a particular problem. It's potentially useful to get feedback on a development approach. Constructive criticism is very important in engineering projects because it encodes assumptions of limitations we all have.
A positive statement like "oh those sub problems are solvable!" doesn't really provide any help. No shit the problems are solvable in a perfect world. Such statements aren't even necessarily constructive because they don't offer any analysis or advice. It smacks of toxic positivity[0].
spouting out a problem you foresee being revealed after another problem is solved is not constructive criticism, it is reactionary and attention-seeking.
my comment is about comments like yours; unlimited time and energy to mention anything that makes what I say sound bad, improbable or difficult, and zero time or energy to even entertain the idea that my point of view is valid, and worth considering.
toxic negativity.
It all comes off as puffery to me. Though the vertical slices approach is interesting, so I salute their efforts.
It works because then your tests become the spec of the system as well, but if you only write unittests there is no spec of the system, only modules of your code. Which is not useful because if you refactor your code and change this module you need to rewrite the test. Whereas in TDD your tests should never be rewritten unless spec changes (new features added, new realization of bugs etc). This way "refactor == change code + make sure tests still pass".
You're of course free to write unittests as well, when you see fit, and there is no need to target a religious X% coverage rate at all. I think coverage targets are cargo-culted, unnecessary, time-consuming and religious. The crucial thing is, while you're writing new code (i.e. implementing a new feature or solving a bug) you need to write an automated test that says "if I do X I expect Y", see it fail, then see it pass, such that "if I do X I expect Y" is a generic claim about the system that will not change in the future unless the expectation from the system changes.
In other words, the example in this comment chain: "run a game, see 'opcode X doesn't exist', implement X, rinse repeat" is actually how TDD is supposed to work.
And emulators that have gone this path have all regretted it, because they end up making hacks to make <popular game> work, because everyone simply wants to play <popular game>. Dolphin is still paying the price of that method years down the line. Project64 took years to unfuck themselves up, ZSNES is forgotten and overtaken by many more that have done the proper thing.
So, sure, you can get some initial usage. But making a browser isn't about being able to open twitter.com
Loading Twitter (etc.) is not really the goal, it's more of a prioritisation mechanism for tackling a huge spec. Actually getting Twitter to run is a nice reward for all that hard work though, and a series of such rewards keeps the contributors motivated in the marathon that is building a browser.
By targeting a single website, you end up accidentally writing in those site-specific fixes _in_ your implementation. You only realize it's fucked up because you visited Twitter. but maybe it screws up another site. Maybe something else depends on a quarter of that functionality, and you've accidentally broken it.
Of course some errors will be made along the way. That's to be expected, regardless of the approach taken.
When ZSNES did its thing, which, just to remind people, was back when Pentium IIs ruled the roost and CPUs topped out at 450mhz, doing things the proper way was not a choice because the proper way needed 3x the CPU power of doing things the ZSNES way that worked.
Dolphin became popular because it could actually play games, and I bet if they had instead spent an extra 3 or 4 years working on code that was "correct" without releasing anything, well odds are they wouldn't have such a large following and would not have attracted so many contributors.
Users do not benefit from "perfect code" that they never get to use because it is still in development.
I did this with the CPU for my GameBoy emulator: I picked a game I wanted to work and just kept implementing opcodes each time it crashed with an “opcode not implemented” error.
Basically, you shouldn't switch from "preproduction" to "production" until you can show (A) here is actual gameplay, (B) it is, in fact, fun, and (C) you know how to actually implement it. Until you can demonstrate those things, how are you supposed to estimate how long it will take to build? Or that, once you're done, whatever gameplay mechanics you dreamed up are actually entertaining to a player?
[0] arcade game programmer, producer / studio exec who got Insomniac and Naughty Dog to scale beyond their founders, & eventual lead architect of the PS4 and PS5
[1] https://www.slideshare.net/holtt/cerny-method, https://www.youtube.com/watch?v=QOAW9ioWAvE
Oh I know, I worked in game development for years :). Was really just trying to get a short description.
Good insight.
I was going through this same spiel in my head the other day.
It's a flow that if properly managed can provide a good feedback system. It provides the developer positive feedback and at the same time successful milestones.
Say I'm building an emulator for a simple architecture with a few dozen opcodes...
"Alright. Let's start. Where do I start? How about NOP." So you implement NOP. You write some tests for it. Maybe you build a pretty printer into your opcode and you test it on disassembling a single byte file with a single NOP opcode.
Suddenly you have a working dissassembler! It's obviously an artificial toy, but it works.
Maybe next you add an INC instruction. Add some tests. You'll need registers...
Build a simple one INC opcode binary file. Maybe add an executor in addition to a dissassembler. Suddenly you've got registers working. And if if add another INC opcode byte, you can see your emulator changing behavior based on real external input!
And so on. It's an interesting flow, you're right.
Given that he omitted huge specs like WebGL etc. I wouldn't say it's wildly wrong. But I'd love to somehow arrive at a better estimate.
If you don't think the estimate from Reckless, Infinite Scope is wildly off, then you either didn't read the methodology and do a spot-check of the dataset, or you really don't understand the scope of what gets published by W3C and how little much of it has to do with Web browsers or how many revisions of them there are.
Define "reasonable" then, when talking about the web.
Aside from that, given how many logical errors and weird counterconclusions[1] you've managed to stuff into this discussion, though (and to have been able to do so economically[2]), I'm going to go ahead and say this is my last response to you that I spend more than 10 seconds writing out.
1. e.g. <https://news.ycombinator.com/item?id=35521704#35524952>
2. wrt number of words, fittingly
As for WebGL, the WebGL parts are actually quite little. https://registry.khronos.org/webgl/specs/latest/1.0/ is only about 20,000 words. I gather it defers significantly to GLES20 (PDF, 204 pages, ~60,000 words), and GLES20GLSL (PDF, 119 pages, ~30,000 words), and it has GL32CORE in its references (PDF, 404 pages, ~125,000 words), but doesn’t actually use cite it in the text and I don’t know if it’s relevant. There doesn’t look to be anything else significant that wouldn’t already be included.
But really, WebGL is a fairly thin layer atop OpenGL ES 2.0, just removing some functionality and applying some restrictions. I believe you would reasonably expect a browser to use an existing OpenGL ES 2.0 implementation, so I’d be quite content to exclude the 90,000 (or perhaps it’s ~215,000?) words of that, just like it’s common to reuse an existing JavaScript engine (though you also don’t have to). Yet note this: it seems that even if we include it all (and presuming I haven’t missed anything, which I admit I could easily have done, I’m not conversant with these specs like I am with HTML/CSS/JS specs), it’s still under 0.2% of Drew’s massively-inflated figure.
—⁂—
¹ Whew, https://262.ecma-international.org/ took me several minutes to download, despite being only 7MB. Sigh; the trials of being in Australia, where things hosted in the USA are often inexplicably painfully slow—like, sub-256kbps. When already downloaded, it renders in under four seconds, which is really fairly impressive when it’s doing all that layout on a document a million pixels tall—this ain’t a PDF where you can only render one page at a time. The HTML Standard is almost two million pixels tall, and also loads completely in under four seconds—simpler styles, perhaps? I refer to it often enough that I build it locally so I don’t have to download its 13MB all the time, or compromise with the multipage version that you can’t search through as easily.
The thing is, it's not just the HTML standard. It's also all the standards it references. And all the standards they reference, and all the standards those standards reference, ad infinitum.
For example, HTML 5 references SVG 2 which references CSS 2 which references Unicode and XML 11. Or, to go the same route, HTML 5 references SVG 2 which references CSS 2 which references CC.1:2004-10 (Profile version 4.2.0.0) Image technology colour management which references (normative) ISO/IEC 646:1991, Information technology — ISO 7-bit coded character set for information interchange, IEC 61966-2-1 (1999-10), Multimedia systems and equipment — Colour measurement and management — Part 2-1: Colour management — Default RGB colour space — sRGB and TIFF 6.0 Specification, Adobe Systems Incorporated among other things.
Yes, some of those overlap (as many standards will reference many the same standards), but the number of those standards is definitely non-trivial. Some of them you can probably pull in as system libraries or external libraries. The question is, how many?
Edit: and some of them are definitely not relevant to the web, but how would you know until you read through the spec that references it, and through the referenced spec to find and understand the relevant bits?
Indeed they did. Here's what author of KHTML said, https://twitter.com/LarsKnoll/status/1421121639845187585
--- start quote ---
Implementing a browser engine from scratch was a lot of work in 1999/2000, it’s close to impossible today.
--- end quote ---
[1] https://www.cs.auckland.ac.nz/~pgut001/pubs/x509guide.txt
[2] https://photosauce.net/blog/post/what-makes-srgb-a-special-c...
The entire premise given in Reckless, Infinite Scope is that the number of words in the specification is positively correlated with the intractability of implementing a given thing. From this foregone conclusion, it tries to quantify how much worse the task of implementing a Web browser is. The problem is that that the premise is a bad one; even if it takes more time to read a wordier spec, it is easier to implement one that describes well-defined behavior than a terse one that glosses over things and leaves huge gaps of undefined behavior. This is not just conjecture—it tracks with the development and progress of implementing, say, the HTML parsing algorithm; it is easier to implement a correct and acceptable HTML reader in 2023 armed with only the spec than it was to try to do the same thing in 2003 which involved reading the spec and also reverse engineering how other (esp. proprietary) browsers deal with the pages that you find authors actually publishing in the wild. This is a task that was made easier because the standard got bigger.
The point is that its broken methodology doesn't even matter; we don't have to try to come up with better ways of evaluating whether a spec should be included or not because its whole premise is flawed to begin with. Any attempt to produce an input set that you can then use to run a word count analysis is a moot academic exercise at best that will only tell you how many words it contains.
No, it doesn't. A detailed spec has the same amount of code to write as a spec for the same thing with less detail; for the types of specs relevant to this discussion, the primary requirement of "does what the other browsers do" exists whether the details are made explicit in the spec or not. More code is a consequence of an increase in requirements, not detail.
In any case, neither circumstance is I/O bound to begin with.
You don't, in reality, have the latitude to do "anything from a no-op to some quirks mode" of your choice. The requirement is absolutely the one stated: to be compatible with what other browsers are doing. If your browser doesn't satisfy that requirement, then you break the Web, regardless of whether the spec is a hundred words or a hundred million. No amount of pointing at a standard and arguing that it doesn't specify clearly defined behavior in some area will ever be enough to teach a site to be able to say, "Oh, I'll just unbreak myself then so you can go ahead and view/use this page on your computer."
Besides that, even if you were right—and to be clear, you aren't—that doesn't change the fact that, again, arguing for underspecification because "a couple defined values" isn't as much "actual code" that "still needs to be written" is an argument that approaches a problem that isn't I/O bound as if it is.
I implemented a few specs in my short career but nothing even close to that. It's actually mind boggling that we manage to have all those moving parts fit together.
Take a look through https://html.spec.whatwg.org/multipage/parsing.html. It’s verbose but very approachable, very implementable.
Is WebGL needed? I've browsed the web for years with it disabled and have not suffered any inconvenience. I'd probably say it's not needed, but I'm a bit on the fence about it and can understand if people would disagree. All browsers implement XSLT, but is that actually needed for a functional modern browser? Maybe not? I can't remember the last time I've seen it used, but perhaps it is. And do you include HTTP? Or is that too low-level? Do you include PNG and SVG or just PNG? If you include SVG then why not PNG?
There are some obvious "we need this", some obvious "we don't need this", and a lot of unclear and somewhat subjective area. I do know that you can't really say "yes there's bad data, but it probably cancels out against stuff omitted"; if anything, it only underscored my point that the list is not good.
An uncurated or minimally curated document dump is not the correct approach in the first place, if you do that for SMTP you'd end up with a lot of irrelevant documents too simply because the specification is a few decades old and stuff gets superseded, some things never sees real-world implementations, things no one uses any more, etc.
I started making a better list when the article was originally posted, starting from "okay, let's just check what you need for a useful browser normal people can use every day" and ended up with a few dozen things, but I never really posted it as I wasn't quite sure that was fully correct either and because I never really figured out some of the questions above.
I think most of the complexity stem not just from the word count, but rather that everything interacts with everything else. Consider the relatively new "position: sticky" in CSS. Okay, great. But it doesn't work well with flexboxes, or RTL, or negative margins, or z-index, etc. etc. [1] Adding what seems like a fairly simple feature is quite complex because it interacts with so many things. It's not hard to imagine a fresh new HTML and CSS which allows all the features the current does but does so in a much simpler and orthogonal way, which would of course break backward compatibility and every website.
[1]: In 2020 anyway; I'm not sure on the current state; here are some of the links of my post from 2020 which like most of my posts I never finished:
https://bugzilla.mozilla.org/show_bug.cgi?id=1488080 https://bugzilla.mozilla.org/show_bug.cgi?id=1498772 https://bugzilla.mozilla.org/show_bug.cgi?id=1519600 https://bugzilla.mozilla.org/show_bug.cgi?id=1490487 https://bugzilla.mozilla.org/show_bug.cgi?id=1488950 https://bugzilla.mozilla.org/show_bug.cgi?id=1514291 https://bugzilla.mozilla.org/show_bug.cgi?id=1528957 https://bugzilla.mozilla.org/show_bug.cgi?id=1472602 https://bugzilla.mozilla.org/show_bug.cgi?id=1455660 https://bugzilla.mozilla.org/show_bug.cgi?id=1450601 https://bugzilla.mozilla.org/show_bug.cgi?id=1424384 https://bugzilla.mozilla.org/show_bug.cgi?id=1341643 https://bugzilla.mozilla.org/show_bug.cgi?id=1526342 https://bugzilla.mozilla.org/show_bug.cgi?id=1519073 https://bugzilla.mozilla.org/show_bug.cgi?id=1414874
That is definitely the main issue.
And you're completely correct on the needed/non-needed/subjective front. Many of the standards reference (in a recursive manner) a lot of other standards. A listed some here: https://news.ycombinator.com/item?id=35524018 As an outsider it's impossible to know whether TIFF spec or ISO 7-bit coded character set for information interchange are relevant, an need to be studied, or are there just because they define some minor values referenced in some more higher-level spec.
And most specifically in layout and rendering. HTML, JavaScript and the parts of CSS that aren’t, y’know, doing anything, are all very straightforward, despite having the significant majority of the word count. If anything, I’d say that in web matters implementation difficulty is inversely proportional to word count, because its verbosity pretty consistently comes from precision (which makes implementation easy). Layout stuff would be much harder to define exhaustively in that fashion, nor is it done so in most places.
Is this not the corporate equivalent of creating a walled garden (perhaps not the right phrase here, gastric moat sounds more apt), by exhausting the resources of all that should choose to attempt to scale this mountain of junk?
That being said, I can't make any suggestions as to how you could shortcut through that other than just having decades of experience in the field.
The current edition of those can be found in XEP-0459: https://xmpp.org/extensions/xep-0459.html
So the web is maybe only 1.2 specs with 114,000 words? I think it's considerably more than that. If that estimate is off, it's by no more than a factor of 10, IMO. No need to exaggerate.
For example, changing "greater than" to "greater than or equal to" might require only a single bit of change in the machine code.
But we don't, really. Example:
Write a function that keeps track of the name and weight of each person added, then prints the list, sorted by weight, lightest to heaviest.
I asked GPT this. My 140 character, unoptimized query resulted in 816 characters of c++ code.
The HTML and ECMAScript specs that comprise most of what we’re talking about are very much closer to line-by-line, because they’re designed to be both implementable and completely specified.
Write a program that keeps track of the name and weight of each person added, sorted by weight, lightest to heaviest. The input should be a command line prompt asking for input in 3 fields - first name, last name, weight. If two people have the same weight, order them alphabetically by last name. At the end, when a blank line is entered, print the list with headings first name, last name, weight. Check the input, if it's not 3 sections or empty, print an error explaining the input format.
497 input characters, 1317 output characters.
In the case of a detailed or verbose spec, you're probably right. I'm just replying to the assertion that it generally takes many words of English to equal little code. If that were true, nobody would be using ChatGPT to scaffold.
Now, if you're going to be detailed about -how- each line should look, I'd agree that English would be more verbose than code.
Web specs need to consider all of these sorts of things. That’s why they’re verbose—they’re designed to be implementable and complete.
I'm not really sure if "you need to be bug-compatible" is still true; it probably was 15 years ago, but Chrome, Firefox, and WebKit tend to be pretty decent these days.
Don't know if this is everything, but there are a bunch of specific websites mentioned in here.
Nowadays, HTML parsing is exhaustively defined in the form of a couple of state machines, so it’ll behave the same everywhere. It’s genuinely easy to implement perfectly (though it’ll still take a while because there is quite a bit of it).
The end result is that validation is not that much interesting anymore, because the idea was that valid (X)HTML document should parse the same accross all browsers (which it mostly did, but that did not say much about how it was actually rendered).
The validator badges were kind of a backlash against the tag soup of the day; part of the reason for that was that everyone who knew how to program a VCR could get employed as a "webmaster" in those days, but also because the authoring tools for non-tech authors weren't as good. HN sees a lot of posts from non-tech people, often written on WordPress, Medium, or whatnot. 25 years ago it would more likely have been "tag-soup'd" by some non-tech person who just learned a bit of HTML.
The way that web specs are handled means that better specs actually bring a lot of those things into the spec. i.e. browser implementers will define a new spec that clearly explains the quirk, and then align on the implementation. There is also a huge test suite which can be used to test conformance.
It's not perfect, but it's definitely a significantly better situation than we had.
Used to be true, I doubt that it is anymore.
There are too few (I could find exactly none, to be honest) sites are around these days that are unreadable when rendered strictly according to a newish (say, 2019) HTML/Javascript spec.
The proliferation of front-end frameworks means that almost no site is going out of spec, and because any site that doesn't meet a large portion of the spec is invisible to search engines, having the site be broken when sticking to the various specs is no issue.
In short:
1. With practically all large-traffic sites using a framwork, a browser that strictly sticks to the specs and the specs alone is not at a disadvantage.
2. With important on SEO, a site that is unreadable on a recent spec is not going to be found anyway by the large body of traffic.
Conclusion: a browser that sticks to the spec and the spec alone has a fighting chance.
It's the complexity and edge-cases of an exceptionally large, complicated and self-contradictory spec with thousands of edge-case when different parts of the spec are combined that's the problem.
The version of the browser native to SerenityOS hopefully still uses the SerenityOS GUI libraries
WebKit and Blink are similar in how they have their different counterparts like QtWebEngine or WebKitGTK. The equivalent to WebKit and Blink in SerenityOS is called LibWeb.
For me iteration speed's a big selling point that (plus the fact that's easier to find contributors) might also be important for projects like these.
Rust seems to me far easier to learn and get going in due in major part to its incontrovertibly superior standard tooling.
I can’t see any place for any meaningful difference in iteration speed between the two, save that you may well have to iterate more in C++ due to memory safety bugs the compiler doesn’t catch.
As for finding contributors, I get the impression that Rust is considerably more accessible, and thus will increasingly find contributors more easily, as people that just love programming will actively choose to learn Rust far more often than C++. (For the current state of affairs, I think it’ll depend on what sort of contributor you’re looking for, in skill, industry, paidness, &c. Some segments will certainly go one way, and others certainly the other.)
With Rust, though, it's as if someone looked at C++ compilation times (not to mention resource requirements) and said, "I think we can find a way to make it worse."
But I still really like Crystal.
So maybe, Jakt will get used as well.
https://4e6.github.io/firefox-lang-stats/
I don't have an over-time series, but if you're willing to take my memory at its word Rust's percentage has hovered at around 10% for a while now. It seems to have actually gone down recently. Combine that with efforts like Servo being wound down and their team being let go, and it makes me wonder what the future of Rust looks like in Firefox.
If anyone can shed some light on this I'd be interesting to know.
Maybe, but the speed with which SerenityOS, its programs and the browser has been implemented, with so few man-hours thrown at it kinda displays why C++ was chosen over Rust.
There is no comparable project in Rust that demonstrates just how quick you can go from "nothing" to Full-Fledged OS, with applications, with a browser.
Just from the Serenity project (if you've been following it), it looks like C++ is about 10x faster to write performant and safe code in than Rust.
Doesn't that sort of prove my point?
I dunno if you've tried both SerenityOS and Redox - I have, and SerenityOS is just more complete and usable as a daily driver than Redox[1].
Redox developed over 7 years has less functionality than SerenityOS developed over 4 years.
[1] They both have a long way to go before being completely usable as a daily driver, but Redox has a longer way to go than SerenityOS.
Formal verification is a complete pain in the ass to do and there's a reason it's mostly done only in the most critical of systems, but if a program passes 100% formal validation, you're as close to crash free as you can possibly be.
I believe Ada and some other lesser used language sport well supported formal verification methods. You won't be able to use C/C++/Java/Rust it you're going for 100% formal verification though. There are attempts to bring the concepts to more commonly used languages (Frama-C, for example) but in my experience they're stuck in PhD-ware hell, great for writing papers but terrible for writing actual software.
But there are actually other languages that are better suited to such methods: More or less everything from the functional space is quite well applicable to those.
I don't think I've ever seen a crash in either Serenity or Ladybird that I could attribute directly to memory management. For volunteer C++ projects, their memory management seems to have been done excellently. Using modern C++ features and things like error return types instead of null seems to be a key part in making the browser this good.
It's also worth mentioning that as far as I know Ladybird doesn't implement a JIT engine, using bytecode to execute Javascript instead. That should also make life significantly easier for memory management.
It's still a young browser and I'm sure there are some nasty memory corruption bugs lurking in the depths, but I haven't seen those yet.
and their goal is to use it to incrementally rewrite SerenityOS
The rendering was done into a pixel buffer with inputs being passed though a few relatively simple C++ classes.
I think that a small embedded version would make for a great UI framework with minimal dependencies.
There used to be Gecko as an option here too, but Mozilla decided that it shouldn’t be usable outside of XULRunner and made it effectively unembeddable unless you’re willing to commit to XUL.
From this perspective, not focussing on documentation and making components usable externally is pretty short sighted.
> browsers were only topped by a few things like major operating systems
And they're even closer once you subtract out things like device drivers.
Most sites still don't have valid HTML.
EDIT: my link is old. 98% of the top 100 sites had invalid HTML in 2021, in 2022 we've managed to hit 100%, great job everyone!
For example, Wikipedia doesn't validate [0] because its CSS has "aspect-ratio: 1" which looks ok to me regarding the spec [1].
[0]: https://jigsaw.w3.org/css-validator/validator?profile=css3sv...
[1]: https://w3c.github.io/csswg-drafts/css-values-4/#ratio-value
IMO the validator's definition of "invalid HTML" is just too strict; it should only count parse errors and completely non-sensible things. And the specification is also too strict at times; on my own website I have "Element style not allowed as child of element div in this context." This is because on some pages it adds a few rules that apply only to that page and this is easiest with Jekyll. I suppose I could hack around things to "properly" insert it in the head, but this works for all browsers and has for decades and why shouldn't it, so why bother?
If the specification doesn't match reality, then maybe the specification should change...
Today the complexity lies not in the robustness of the specs, but in the sheer number of of them, and their many interactions. I mean, just distance units... There are over forty of them
> Not Ready For Implementation
> This spec is not yet ready for implementation. It exists in this repository to record the ideas and promote discussion.
> Before attempting to implement this spec, please contact the CSSWG at www-style@w3.org.If you work in the web space you quickly learn to shrug, double check that browsers do actually implement this version, and proceed.
people often discourage building web browser engine because it is "hard" or something like that
like... how is it different from building a compiler?
You gotta build HTML parser, CSS parser, figure out a fancy structure to represent those concepts and modify at fly.
Also there's difference between making it work and making state of the art.
That persons says that there's shitton of RFCs - yea sure, but you don't aim to support everything from the beginning.
Let's start with HTML + CSS, then build basic js interpreter
I’m only half joking but I’m pretty sure there are some PR companies pushing “trends” on the behalf of big corps.
It would be stupid and uncapitalist not too…
A browser that's unfinished really cant be used by users at all. Either it lacks security, so nobody should use it, or it lacks vital features (of the spec, not end-user features), so nobody can really use it because every time a website relies on that API something doesn't work.
Most new compilers are somebody’s hobby project that will never see the light of day, I have like four of them in various states of unfinishedness.
But that's just one aspect, next you need to add support for CSS [1] and Javascript [2], each of which has had lifetimes of work invested in the standards and implementations.
So yeah, while it's doable to build a new browser, if you want to build a big one that has feature parity or is on-par with the existing browser landscape, you need a large team and many years of work. And that's just the practical aspect, the other one is, would a new browser actually be better? Could it compete with the existing market? So many players have just given up over time.
The difficulty of building a state-of-the-art browser is almost entirely about performance. Everything else is straightforward by comparison.
Many of them are just as ad-hoc, even if they are better defined, and meant to cover some holes in previous ad-hoc specifications. For example, the entire `subgrid` spec is patching one specific hole which actually has a proper general definition: "These <children> however are independent of the parent and of each other, meaning that they do not take their track sizing from the parent. " [1]
So instead of solving that general problem, we have a hyper-specific patch for a single feature. Which will definitely clash with something else in the future.
I mean, the entire web components saga is browser developers patching one hole after another that exist only because the original implementation was just so appalling.
> The difficulty of building a state-of-the-art browser is almost entirely about performance.
But that performance is directly affected by the numbe rof specs and features.
[1] https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_La...
The former is 100x harder than the latter, and the prior statement that new CSS/JS features are a burden to keep up with is patently absurd. Because it's a tiny amount of work relative to the total work required to make a browser. (But still hard in the absolute sense, because browser engines are among the most complicated software projects.)
Chrome ships up to 400 new APIs a year (that is JS, CSS etc.)
Safari and Firefox ship 150 to 200 new APIs a year. [1]
Even Microsoft gave up on trying to keep up with browser development and switched to Chromium.
> Because it's a tiny amount of work relative to the total work required to make a browser.
That is, like, the primary work required. And many of those things often don't even have a solution until someone finally figures them out in a performant manner (like CSS's :has)
Yeah it's "just" building some parsers and figuring out live updates, but you have to keep in mind that this is ~the internet~. People have been uploading broken, against spec, webpages since forever. Coding a web browser as a serious project (so not as a flight of fancy) borders on the impossible mostly because of that.
The main sites people test against/use aren't the "simple" CSS/JS/HTML sites from the past. Few people will care for a browser whose main job is to be able to render a neocities website. People want their popular sites working - Discord, Facebook, reddit, twitter. All of those are big JS apps.
The real bugbear here is JS though, HTML and CSS are complex but workable. JS is an ever-moving target as spec implementers (mostly Chrome) dump more and more of the jobs a browser was meant to do as the user agent into JS[0]. (And that's without delving into how widevine became part of the spec, which means it's legally impossible to make a fully spec compliant browser.)
Polyfills can offer a lot of fallback/lenience, but polyfills are a moving target too - older browsers get deprecated, polyfills get removed for performance/optimization reasons, so your baseline spec for functional JS becomes ever-increasing unless you somehow get the people making popular JS libraries to accept that your browser project is important enough to keep the necessary polyfills around for.
[0]: Presumably so that Google can take away the User part from the browsers job as the User Agent, but typically covered up as a poorly defined "privacy problem".
> The real bugbear here is JS though, HTML and CSS are complex but workable. JS is an ever-moving target
What you characterize as "JS" is, in reality, more HTML and CSS than JS. JS is a language. The fact that all the behavioral details of the HTML and CSS objects and related host objects have bindings available to JS programs does not make those things "JS"...
Doing a new JS engine from scratch is an order of magnitude easier than doing a browser engine. It is directly analogous to the eminently tractable "building a compiler" problem that the other commenter mentioned.
That's still wrong.
s/DOM//
s/JS/DOM/
Continuing to say JS when you're really talking about what is, again, still in the land of HTML, CSS, etc just confuses things. Viz:
> to make [a JS engine] that's usable in situations that aren't things like node or as a sub-language in a different project... that's far more difficult
It's really, really not about JS. You don't make a browser that's compatible with the Wild Wild Web by adding stuff to the JS engine. You do it by implementing moar browser.
- the web is numerous specifications: HTTP, HTML, CSS, JS, SVG. At worst, a regular compiler needs to worry about macros and the language syntax
- each of those specifications has numerous versions which, in some cases, can be significantly different from other versions of the same language or protocol. A language compiler generally only focuses on one version of that language
- A browser needs to support broken websites. A compiler only needs to fail gracefully
- A browsers output is graphical, which is much harder to unit test
In short, you’re dealing with a harder problem across a broader number of specifications. I would liken writing a browser more closely to writing a new graphical OS than writing a compiler.
(“Browser” here means “browser + engine et al” and not just a reskin of Chromium).
In fact there's a good reason to keep graphical tests to a minimum: web specs do not dictate things down to the pixel level, so pixels can shift around from version to version, requiring the occasional golden data rebase.
Fun aside: Chrome's test suite contains a font named ahem.ttf where (almost) every character is an identical black rectangle. This allows tests to include text without relying too much on the details of a particular font.
Our two posts aren’t mutually exclusive.
A conformant C++ compiler is in the same ballpark as a browser, but a naive C compiler is orders of magnitudes simpler.
Recreating the Windows OS is in the same ballpark as a browser, but a simple OS that boots and runs command-line apps is orders of magnitudes simpler.
People don't casually start new C++ compilers or projects such as WINE, but they do start toy compilers and OS all the time.
Because that way any one wanting to build a new one can starting by pulling in a bunch of libraries (layout, rendering, etc), and then just customise the bits they need (ideally publishing them as a new iteroperable library that others can also use).
We would like to run the Web Platform Test suite [3] against Taffy, however these are not in a standard format and many of the tests require JavaScript so we are not currently able to do that.
[0]: https://github.com/facebook/yoga
[1]: https://github.com/DioxusLabs/taffy/tree/main/test_fixtures
[2]: https://github.com/DioxusLabs/taffy/tree/main/scripts/gentes...
[3]: https://github.com/web-platform-tests/wpt/tree/master/css/cs...
I think that you are right; this is what will be needed. However, that alone won't do because it is also needing to write them to be good, and not too slow/inefficient and not too incapable of doing many customization stuff.
And, ensure things are properly separated. (Looking at your examples, it seems like it is properly separated, to me. You can define styles independently of parsing them, which improves efficiency as well as allowing adding other steps in between such as "meta-CSS" if desirable.)
In some cases, it may be desirable to modify parts of the libraries, although then it may be necessary to maintain a fork of that library, which is not always desirable.
(For example, I may want to add proper support for non-Unicode text, and being able to customize text layout functions, including all possible text directions (vertical, horizontal, boustrophedon, etc). Adding other CSS rules might also be needed for some other purposes, too. And then, we will also need to do accessibility features.)
(I like to use C programming; looking in issues, it look like they might be added, so that can be good; unfortunately, Rust has a Unicode string type and this can be problematic even if using C, unless the Rust programming is done very carefully to avoid this problem.)
- https://github.com/pop-os/cosmic-text does text layout (which Taffy explicitly considers out of scope)
- https://github.com/AccessKit/accesskit does accessibility
- https://github.com/servo/rust-cssparser does value-agnostic CSS parsing (it will parse the general syntax but leaves value parsing up to the user, meaning you can easily add support for whatever properties you what). Libraries like https://github.com/parcel-bundler/lightningcss implement parsing for the standard css properties.
- There are crates like https://github.com/BurntSushi/bstr and https://docs.rs/wtf8/latest/wtf8/ for working with non-unicode text
We are planning to add a C API to Taffy, but tbh I feel like C is not very good for this kind of modularised approach. You really want to be able to expose complex APIs with enforced type safety and this isn't possible with C.
And this is much more than that: custom JS interpreter, SVG, CSS renderers and so on...
Another aspect is that for any complex, large-scale project like browser, lots of, if not most of, effort is actually in the long tail: to make 90% or even 99% websites work probably is as hard as making the rest 1%.
So while the team probably could cruise through when working on current gen spec and popular sites like Discord/Twitter, it's what left is going to be a nightmare to manage at the end.
But again, nothing is impossible, and I really look forward to having a new browser engine in the wild.
If I recall correctly, the work Andreas did at Apple was mostly focused on performance, and Safari has long had a reputation for excellent performance. Maybe you’ve also done that type of work, but otherwise I’ll trust his judgement.
And there are a hell lot of details with the plattform called the web.
But I would think in this case here, they have no intention of going to 100% by all means, to support all the broken pieces of web garbage out there. The goal is to implement the W3C specs. (they are even working on fixing the specs)
Oh and Kling specifically worked on browsers before, so that is a good base.
"I've had the opportunity to work on production browsers for many years (at Apple and Nokia)"
I made a comment about why browser is hard in general. I don't in anyway suggest or imply this team would struggle with performance, so not sure why their (amazing) background would be relevant.
And I mention these two things because the article itself said they're going to "[f]ocus on vertical slices" first and "[d]eferring on performance work". So I was pointing out that it basically means they started with easy part (nothing wrong with it).
I still failed to see what point I said you didn't agree with, other than argumentum ad verecundiam.
The two most important keywords in Drew's blogpost is *serious* and *security*. There is not one mention of either of those words in this blog post; hence Drew's points still stands unchallenged.
You can try, but so did Servo which was a 'serious attempt' and not even the Rust hype could convince the masses that it was better than Chrome.
Even Mozilla can't do it.
Chrome is the sole benchmark. If it works in Chrome, it's fine, if it doesn't the site is broken. Standards never enter the discussion.
It moves slower than people assume; I installed Opera 12 last year for the craic – the last version built on their Presto engine, released almost ten years ago – and it works surprisingly well with many sites. I did have to use mitmproxy to rewrite some trivial stuff like some CSS prefixes and s/(let|const)/var/ in JS. Flexboxes are supported, but grid isn't so that failed for some sites.
> Drew's points still stands unchallenged
His points are based on a faulty assumption to start with: he counts all sorts of documents, but that count is spectacularly wrong as it counts many things it shouldn't. I mentioned this at the time: https://news.ycombinator.com/item?id=22617721
Is it a large project? Sure, as many software projects are. But "impossible" and "comparable to the Manhattan project"? Certainly not; it's just that there's not a whole lot of money to be made with a new browser engine or other broadly shared motivation.
And Drew himself answered you at the time on points made to your comment, that is things you said shouldn't be included that should and others you said were incorrectly included but were instead excluded in first place.
Whether the web is "too complex" is a different matter and open to interpretation as "too complex" is subjective. But the data very wrong and therefore the article is wrong. A "correct" conclusion with faulty arguments is just as worthless as an incorrect conclusion: any possible solution depends on a correct understanding of the situation. "Global warming happens because of pornography, therefore we must ban pornography" is just as useless as "global warming is a fake fraud" even though the conclusion of the first is correct.
Why not post this list for the rest of us to see (and check) then? But beforehand those "outdated" stuff (such as your HTML 3.1 example) may still be applicable and excluding them means your approach is incorrect right off the bat.
It takes a minute to spot-check; some specific examples were provided in the previous thread. I don't have the list any more and can't be bothered to recreate it; what value is there if you can just check Drew's list – which is really not that hard? I also have no idea how correct it is, exactly; I suspect the actual number would be even lower still.
1. A unique use case or feature that cannot be easily implemented in the existing browsers. Something that breaks the current architecture and turns the current use cases into afterthoughts. ("oh, yeah, right we actually need to render html somehow at some point, can the intern do it?")
2. A significant breakthrough in software engineering productivity, a major step in terms of abstraction and safety. Something like the combination of a LLM and formal methods.
This browser does not check these two boxes (using C++, albeit hopefully a more modern dialect, and targeting plain old browsing). So it is certainly great for the spec - and should be paid for by the W3C, IMO, great for the people developing this as an exercise, but it will never dethrone Chrome.
(To be fair, the tech landscape may be sufficiently different that the same won't happen again, too.)
Having to only target one rendering engine when developing a rich text editor would be much better than the current nightmare it is.
(There would be an accessibility problem to solve, we need some new APIs for screen readers and canvas)
It's a lot of fun to watch them build Ladybird, and a testament to what a small passionate team can do.
Google Docs used to be contenteditable based, but moved to a custom rendering engine. They are a large enough company to be able to invest in that. Small businesses aren't, and have to rely on content editable.
Ladybird as a contenteditable polyfill would help smaller teams, or single developers, achieve the same, while also building on the existing tooling and APIs for contenteditable.
It's an HTML attribute that makes content (mainly text) editable by end users.
Basically if you set the content editable attribute on an element then the user can edit the content of the element directly
Here is an example using it:
Is THAT why you can't cut & paste with the mouse in google docs like you can on every other site? Take me back to the old way then please.
https://workspaceupdates.googleblog.com/2021/05/Google-Docs-...
Isn't this actually prove that creating desktop grate applications, like a graphical word processor form the late 90's & some colab backend, is still infeasible with web tech?
Doesn't it also prove that it's still easier and faster to create a proper app and GUI toolkit yourself and just render pixels to the screen (as all desktop GUI toolkits do these days) instead of fighting the browser tech idiosyncrasies, even a proper app and GUI stack isn't trivial in itself?
> Doesn't it also prove that it's still easier and faster to create a proper app and GUI toolkit yourself and just render pixels to the screen (as all desktop GUI toolkits do these days) instead of fighting the browser tech idiosyncrasies, even a proper app and GUI stack isn't trivial in itself?
jmo, but i think so as well....tho i wonder what the performance/battery-life implications of everything doing that might be... perhaps you could have an 'libhtml' for static sites and documents, and different ones for more interactive apps etc
You mean, like a web-browser from the late 90's + Java WebStart?
The point is: We had much saner tech. Now it's just complete craziness, and still you can't even build a word processor like the one that run on Windows 95. This says just everything about the state of web tech for application development. (And no, this tech is rotten from the roots, so you can't improve on it. It'll get only more crazy and shitty if you try further.)
While it’s easy to take shots at the current state, I find it hard to imagine another path to delivering a cross platform application over the network. What we have now is actually pretty rad.
We built it stone by stone, incrementally, and now I don’t have to package my application for N platforms unless I want to meet users in their app stores.
If we spent all the effort we used up on making JavaScript work on Java instead, I’d be typing this from my Moon habitat.
But we instead chose a pig, buried it under layers of lipstick, and strapped a jet engine onto it. Sure, it’s airworthy, but was it the best way to allocate resources?
1) You could deliver software via a browser with some clever hacking
2) That delivering software via a browser had some extremely attractive properties compared to other approaches
Those clever hacks turned into real applications and those became real products. As people built applications on top of browsers, the browsers evolved to be a better environment for building applications. It was very organic.
The actual language we ended up using is just a byproduct IMO. I don't think people chose JavaScript, they chose the browser and the browser had JavaScript. And since the browser had JavaScript, we kept pushing the limits of JavaScript because we needed to deliver applications to the browser.
Honestly hard to see this happening efficiently in any other way. All things considered, the web platform is pretty fantastic compared to the software distribution story in every other ecosystem. I'd argue that we allocated resources pretty well on this one!
The web browser is still the most terrible "application platform" as it's at its core still a document viewer, and not an application platform at all.
The pic with a lot of lipstick analogy is pretty to the spot, imho.
You can abuse any Turing-complete environment any way you like. But this doesn't make it a good idea in the first place.
There are two use cases for the web. There is the document web and the application web. Both are equally valid. It is absolutely an application platform, as evidence by the fact people use it to deliver applications. An ever increasing percentage of desktop software is moving to the browser, to the point where many users only need a web browser. I'd argue the only reason mobile hasn't followed suite is the non-market forces behind the app store model.
It is one of the best application platforms for both users and developers. I can write my software exactly one time and it will run on every platform, instead of separate applications for Android, iOS, Mac, Windows, FreeBSD, Linux, etc. etc.
I can assume my users have a web browser - because they do. For interpreted languages (and VMs) I either have to walk my users through setting up the interpreter or bundle it into the distributable.
Compared to everything else I've worked with, the web as an application delivery platform is great. I write my code, send someone a link, and they are running my app.
And yet, what?
But the actual question is: Why? ;-)
> There is the document web and the application web. Both are equally valid.
No, they aren't. The tech was build to support only a lightweight version of the first one. Everything on top is just a great hack, and pure insanity form the technical viewpoint!
> It is absolutely an application platform, as evidence by the fact people use it to deliver applications.
People do a lot of very stupid things. That's not evidence that doing stupid things is a good idea…
> An ever increasing percentage of desktop software is moving to the browser
Nobody is doing that because web-tech is a great application platform. It's actually exactly the other way around: Most people complain about the extremely crappy tech, but still do it for other reasons.
> I'd argue the only reason mobile hasn't followed suite is the non-market forces behind the app store model.
This makes no sense.
It would be much cheaper for the developers to not pay road toll to the app-store owners (-30%!), and they would at the same time remain in control over their own products, if they "delivered" web-apps. But most mobile developers don't do that, for technical reasons: Web apps are just crap and especially on mobile it glaringly shows.
> I can write my software exactly one time and it will run on every platform
You mean, like JVM applications already did 25 years ago?
> Compared to everything else I've worked with, the web as an application delivery platform is great. I write my code, send someone a link, and they are running my app.
What's again the difference here to Java WebStart?
BTW: Installing a JRE is exactly the same one-off effort like installing a web-browser…
---
We lost between 20 and 30 years once again just for political reasons!
Only to arrive at the worst rip-off of some concepts which were already almost "working fine".
I admit that's a recurring pattern. It's always the most terrible tech that will come out on top in the end, for completely insane "reasons". The market just always favors the cheapest shit that can be rolled out with least effort. It was like that for example with things like C or UNIX. Now "worse is better" became a kind of proverb in some circles…
To be of the opinion that the technical best solutions win in the market is imho a sign of not much experience in this world. It was until now the exact opposite in almost all relevant cases, because most of the time the cheapest shit wins on the market.
Failing that, an optimized binary blob that could achieve the same using training data over modern browser specifications. If you go to ChatGPT and start talking about ISO32000-compliant implementations and poke at the edges, you can get it to start writing a PDF engine pretty quickly.
I'll be curious to see how this plays out. History seems to show that boosting performance later is a monumental challenge.
Early Chrome showed that Firefox was leaving a lot of performance on the table, and it took Firefox a long time to catch up.
In a lot of projects, early optimization hurt the development speed and maintainability, sometimes killing the product.
It is easier to see performance bottlenecks once a product is wildly used than adding optimizations everywhere we suspect it might become a problem later.
edit: clarify
The real difficulty with browsers is building a better one than the existing ones. If you make a new browser. It does exactly the same thing as the other ones. It's a great technical accomplishment but it has a very low value. Which is why nobody bothers at this point.
At this point there are only three browser engines with any audience still worth talking about: chromium, safari/webkit, and firefox/gecko. Obviously the first two are related but they forked so long ago that they are quite different at this point. In terms of what they do there are some minor differences but they basically render the same websites in more or less the same ways. There is very little point in picking one over the other at this point.
I actually use Firefox and I'm pretty happy with it. I don't think it does a lot better/different than the other two at this point but I like not selling out completely to Apple/Google. Google treats me like a product rather than a user and Apple seems more interested in telling me what I can't do rather than enabling me to do things I want to do. But objectively, both do a fine job of rendering websites and allowing me to browse the web. Just like Firefox does. And given that there is no practical difference, I choose to use Firefox.
I wish them luck, though. We could use some real competition in the web browser space again.
i dont want to consent to be tracked, i dont want to login, i dont want a presonalized feed, i dont want to subscribe to your news letter, i dont want your ads, ethical or not
js is still an issue, but maybe a day will come when i can say to the model 'pretend you are js interpreter; what is text the output of this minified react garbage and show it as markdown' and just pipe it to lynx or w3m or worse case eww
A) Document-oriented standard. Perhaps HTML standards are "good enough" for this?
B) Media/Art/Gaming.
C) Business & Data CRUD/GUI
(And don't link that XKCD cartoon about 15 standards. There are zero for these categories.)
· uMatrix : A version with even more extended filtering characteristics. With special attention to javascript calls/loads control.
· uBlockOrigin.
· DecentralEyes.
· CookieAutodelete: Special attention to cached content deletion after leave an specific site and to add previous write permissions.
These are essential and needed features within any browser.
https://www.reddit.com/r/CRUDology/comments/10ze9hu/missing_...
GUI's, desktops, and mice are still needed for biz and productivity. HTML browsers have been a goofy mess for this, requiring bloated buggy JS libraries with long learning curves. Let's Make Gui's Great Again! (No, I'm not a Don fan, BTW, but his trollisms are catchy.)
ECMAScript conformance test results looking good, 87-88% passing at the moment: https://libjs.dev/test262/
I see weekly summary articles about Ladybird development are now being published: https://linus.dev/posts
But I was disappointed that it just crashes on any github page... and SerenityOS github is literally the first link on the Ladybird default homepage :)
edit: oh it doesn't crash on github page, it crashes on the github issues page.
From Serenity OS page [0]:
> This is a system by us, for us, based on the things we like.
Really wonder where the event horizon for really functional programming is.
And that's not meant to be a pithy response. That's the Serenity culture.
https://github.com/WebKit/WebKit/search?q=Andreas+Kling&type...
From the article.
The goal is not to have a browser, but to build one. This browser is affiliated with the SerenityOS project, which is reimplementing an entire desktop OS and all applications from scratch.