Gosub – An open-source browser engine

github.com

110 points by jaytaph 16 hours ago

Last year I wrote a post about trying to make a change in the world by writing a browser.

Today, we're excited to introduce Gosub, a new open-source browser engine that we are building from the ground up in Rust!

Gosub aims to be a modern, modular, and highly flexible browser engine. While still in the early development and experimentation phase, Gosub is shaping up nicely, and we’re looking to onboard more contributors to help us bring this project to life.

Some of the key highlights:

  * Written in Rust: We're leveraging Rust's safety and performance features to create a robust and efficient engine.
  * Modular Design: The project is organized around modules, allowing for clean separation of concerns and easier collaboration. It also allows us to easily swap components based on needs and allows more freedom for engine implementers in the future.
  * Collaborative and open source: We’re building Gosub with the intention of making it approachable and open to contributions, aiming to create a project that's easier to understand and collaborate on compared to existing browsers.
Instead of writing another shell around Chromium or WebKit, we decided to write a browser engine from scratch. We believe that having a diverse landscape of engines is the only way to defeat a monoculture that is currently threatening current browsers and by extension the internet itself. We cannot and should not let a very small number of large companies dictate the future of the web and its usage.

With Gosub, we're aiming to build something more approachable that can evolve with the latest web technologies, all while being open to contributors from day one.

We’re looking for developers with or without experience in Rust. You just need to be interested in browser technologies. There are plenty of opportunities to work on core modules, document our progress, and help shape the project's direction.

We can already render simple pages, including the hackernews front page. However, to render most sites correctly, it is still a long journey, so come and join us!

nwah1 5 hours ago

Needs an FAQ

Why isn't contributing to existing projects like Servo feasible? Do they reject the benefits of modularity?

What existing code is being leveraged, or is this entirely from scratch? Why was lifting code from Servo or elsewhere not sufficient?

Is this project intending to remain fully non-profit or is there some kind of vision for monetization to support the gargantuan amount of effort it would take?

It says writing a javascript engine is out of scope, but it still isn't clear definitively what is in-scope or out of scope.

  • jaytaph 4 hours ago

    Good points.. we will definitely set up a FAQ with these kind of questions. But to be honest, we might not have an answer for all of them. Why not use Servo's CSS system and create our own, but using v8 javascript engine is mostly a question answered by: "don't know"..

    Obviously we cannot write everything by scratch, but we don't know yet where we draw the line.. We like to keep things modular as possible so we can easily swap out the systems we use in favor of better ones in the future.

  • sharktheone 4 hours ago

    We actually kind of have a javascript engine. It is a more personal project of mine, but it is also intended to be used and intigrated into gosub. In case someone is interested, here is the repo: https://github.com/Sharktheone/yavashark

jfengel 3 hours ago

As a BASIC programmer from the 1980s, thank you for that heart attack.

  • moron4hire 3 hours ago

    They say BASIC programmers never die, the just GOSUB and never RETURN.

  • IshKebab 3 hours ago

    It's a great name!

  • sharktheone 3 hours ago

    lol GOSUB as a BASIC command, yes I can see the reference. It actually referes to the BASIC command.

    • mxuribe 3 hours ago

      Thanks for this! I didn't really use BASIC much back in the day, but I am from - ahem - an older time...and the name seemed so familiar, but quite couldn't place my finger on it. so, thanks for clarifying this! :-)

opem 2 hours ago

It's true that the complexity of these kinda projects are enormous, but considering chrome/webkit's monopoly in the browser space, I feel we should always welcome and appreciate alternative efforts...regardless of the project's outcome.

P.S. the website and the probably AI generated logo is giving a sketchy vibe about the project :)

  • dmz73 an hour ago

    Isn't this how generative models are supposed to be used? Instead of generating a sub-par (no pun intended) logo myself, I get a model to build one for me. It is the same as using any computer software to achieve the goal - human is providing the inputs and hardware and software are generating the output.

    • opem an hour ago

      > Isn't this how generative models are supposed to be used?

      Might be, or better just use the name as the logo. At this initial stage no one expects to see a good branding I guess.

      I've recently seen lots of low effort, sketchy looking projects using "sub-par" quality AI generated assets...and in turn when I see these kinds of images used in some project it really just shows off "put least effort to get things done" mentality...I feel.

    • Zardoz84 an hour ago

      Instead of generating a sub-par (no pun intended) logo myself, you should PAY to someone to make a logo, instead of stealing work from other people.

      • A4ET8a8uTh0 an hour ago

        I think, at this stage, logo is the least important piece in all this.

        • opem an hour ago

          That's the point. And if the maintainers still want to consider this, I feel that should be done right.

  • sharktheone 2 hours ago

    No, the website isn't AI generated. There might be some parts of it, though, like general structure of the website and structure of texts.

    Yes, the initial logo design was generated by AI, however the current logo was made by a designer from the AI's draft.

    I don't know if it is a compliment that my website design skills match the ones of AI or if it is more an insult

    • opem an hour ago

      > I don't know if it is a compliment that my website design skills match the ones of AI or if it is more an insult

      Neither, it has nothing to do with design. I just wanted to point out that putting an AI generated logo, and writing vague statements like "optimised search and unlimited browsing" seems unprofessional to me.

      • sharktheone an hour ago

        The "optimised search and unlimited browsing" isn't really a statement, it is the expanded form of the acronym gosub. As I said, I don't really like it, but this is what we have now... :/ But I can definitely see where you are coming from.

  • dullcrisp 12 minutes ago

    The viewport is very wide on mobile Safari

  • serf 2 hours ago

    >P.S. the website and the probably AI generated logo is giving a sketchy vibe about the project :)

    certainly some reasoning would be more constructive than a smiley face, because I looked at the website, I looked at the logo[0] - I didn't share the same feeling.

    Certainly it could be AI generated, but why 'sketchy'? Is it something to do with your own personal feelings on AI use, or just the aesthetic in general?

    I genuinely don't understand -- this isn't a criticism or witty comment lest it be taken that way.

    [0]: https://gosub.io/gosub-logo.svg

    • afavour 2 hours ago

      Just a personal perspective… no problem with the logo but the headline

      “The Gateway to Optimized Search and Unlimited Browsing”

      Doesn’t really mean anything to me and does sound vaguely scammy. Anyone promising me the gateway to unlimited anything gets a raised eyebrow, two if it’s something I already have unlimited access to.

      • sharktheone 2 hours ago

        Iirc that thing was also AI generated. I don't like it, but here we are and have this sentence. Imo ChatGPT is for name generation not the... best

    • opem an hour ago

      > certainly some reasoning would be more constructive than a smiley face...

      I already gave the reasons there.

      > I didn't share the same feeling.

      Just a personal opinion.

DoctorOW 4 hours ago

Why not spend this effort contributing to Servo, which is also written in Rust? It seems the two projects share similar goals but Servo has a massive headstart.

  • exe34 3 hours ago

    people really need to take a democratic vote on what they do in their free time, it's getting ridiculous, some of them are even having fun now!

    • A4ET8a8uTh0 an hour ago

      Agreed. Honestly, wasn't the whole purpose of open source to be kinda free for all ( the followers, the inventors, the grinders... you name it ). Why does everything I read lately start with a 'should'. I am making a mental note to self.

johnwbyrd 4 hours ago

Yes, but I'm concerned about the number of existing browser engines that have fallen by the wayside, as the project founders have become exhausted. The scope of such a project is incredibly easy to underestimate, and it has only ever gotten larger.

Some examples: https://www.reddit.com/r/browsers/comments/124kphe/what_do_y...

  • zamadatix 4 hours ago

    Servo and Ladybird are more active than ever, each having fresh funding and ramping up focused development. Flow is a commercial project for embedded media devices (not just available on rpi, it actually came there later) and seems to be doing well? Sciter I don't know one way or the other about, it seems to have a few popular apps using it but I don't know if it died off since then or is just going strong. Netsurf has always been a bit by the wayside but it doesn't seem like founders getting exhausted has much to do with that.

    There are plenty of browser engines that have fallen by the wayside, often for reasons unrelated to the founders, but that particular list actually paints a surprising amount of the opposite to me. For once since Chrome came out (it at least introduced v8 even if it started with webkit) I have the feeling there are browsers engines in development that can actually attempt to load the modern web and will actually have products for general use cases (instead of specialized ones) in the coming years.

    • throwup238 3 hours ago

      I wouldn’t call Sciter a browser engine. The CSS syntax is similar and some properties behave the same, but it doesn’t implement web standards by design.

  • mjrpes 4 hours ago

    All I have to do is stumble upon a heated 100+ post discussion on the implementation details of an arcane feature of CSS to understand how mammoth an undertaking it must be to develop a fully compatible browser engine.

    • diggan 3 hours ago

      > develop a fully compatible browser engine

      Do we need more "fully compatible" engines? I could imagine there are use cases for browser engines that work with just parts of the specification, particularly the most common ones used in the wild.

      • pests 3 hours ago

        Just as a data point, the YouTube app on most TVs and devices is a stripped down browser only supporting exactly the HTML/CSS/JS needed to run the big picture client.

        By tighter integration with the final product, the browser can provide specialized elements or APIs to simplify the actual application code.

        I think it's used a few other places as well.

        • madeofpalk an hour ago

          Most smart tv apps are just web apps. YouTube isn’t particularly unique in that regard.

          Even the old pre-tvOS Apple TV apps were kinda web apps - XML and JavaScript delivered over HTTP

          • pests an hour ago

            I do agree TV apps are mostly web apps, but most of them did not run in a browser that was specifically designed for that single app.

      • roywashere 3 hours ago

        Google tried a browser that only supported <div> and limited CSS for embedded purposes and it went nowhere

        • airstrike 2 hours ago

          That just means that specific subset of features wasn't lucky enough to make it compelling at that particular point in time for the markets it meant to address.

          Change any of those variables and you may have a winning proposition.

  • hypeatei 4 hours ago

    The various web specifications are insanely complex (e.g. navigables) so I can see how people burn out from it. To add onto that, a browser operates in an extremely hostile space security wise; to be a serious competitor, you'll need to be on top of your game in that regard which maybe Rust will help with.

    • bee_rider 4 hours ago

      Something very silly has happened, where the thing that most non-technical people have which is most exposed to hackers is also incredibly complex and requires high performance for some reason.

      • hypeatei 4 hours ago

        Yeah it's a real shame. The complex (and ever expanding) nature of the web is the real thing entrenching incumbents like Google. They have the existing codebase and resources to handle the complexity.

      • josephg 3 hours ago

        Yeah. I still hope at some stage we build something much simpler that maintains the same security boundary.

        Like an application platform (forget documents) built entirely on wasm, and with capability based security. That would let you launch apps made within the platform just as easily as you currently open a website.

        The platform would need some primitives for rendering, UI, accessibility and input handling. But hopefully a lot of those APIs could be much lower level than the web provides today. Move all the high level abstractions into library code that developers link into their wasm bundles. (For example, I’m thinking about most of what css does today.)

        That would allow much faster innovation in layout engines and other things the web does today, and a smaller api surface area should lead to better security.

        It’s quite possible to build something like this today. It’s just a lot of work.

        Maybe when chatgpt is a bit smarter, it might be able to do the lion’s share of the work to make this happen.

        • FpUser 3 hours ago

          >"Like an application platform (forget documents) built entirely on wasm, and with capability based security. That would let you launch apps made within the platform just as easily as you currently open a website."

          In the end you will end up with the platform / OS which will lose to competitors because of performance and lack of features and do not expect it to be secure. Developers will manage to leave some holes and hackers will find their way.

          • josephg 12 minutes ago

            Disagree. The web wouldn't be anywhere near as successful if you needed to trust & "install" websites before you could visit them. How does that work? Why don't you need to install / trust a website to use it? Well, because it has this kind of security model. Websites are sandboxed.

            The web's sandboxed security model makes it better for users. And that in turn drives popularity.

            I think the same could be true for a good application platform. The trick is using the sandboxing + capability based security model to enable "new" usability features that traditional applications can never deliver.

            • bee_rider 4 minutes ago

              Sandboxing has to be the funniest bit of wordplay anyone has ever made in tech. Sand is, of course, notoriously impossible to contain and never stays in the box. And it is not nearly as clever as an attacker!

      • FpUser 3 hours ago

        Because the complexity and functionality of the modern (whatever the fuck this means) browser basically approaches one of the OS with all the consequences.

  • 999900000999 4 hours ago

    Honestly, I view projects like this as more of an intellectual curiosity than anything which seeks to become useful .

    The Firefox engine is great if you don't want something controlled by Google. And it's going to be much easier to develop plugins or extensions for that versus trying to write your own browser from scratch, which to be honest will probably cost hundreds of millions of dollars. If not more.

    I do imagine tools like this being useful for something like web scraping, but it's never going to be an end user product.

    • codetrotter 4 hours ago

      > more of an intellectual curiosity than anything which seeks to become useful

      I am reminded of this:

      “I’m doing a (free) operating system (just a hobby, won’t be big and professional like gnu) for 386(486) AT clones.”

      – Linus Torvalds, announcing the software that became what we now know as Linux

      • qzw 3 hours ago

        One can only hope we can get a browser the same way we got Linux, but as RMS was fond of pointing out, Linux’s success had a lot to do with the existence of a full suite of GNU software that could run on top of a new kernel. If only we had something like GNU with browser engines, I’d be more optimistic about the chances for success of many new entrants.

      • ZeroGravitas 3 hours ago

        Or khtml which became the basis of WebKit and later Blink.

      • MYEUHD 3 hours ago

        He ended up only writing the kernel though.

    • rustdeveloper 4 hours ago

      For web scraping at scale you want to get lost in the crowd. This usually means being (or pretending to be) chromium on windows. Unusual browsers are suspicious, detected or have very distinct fingerprint.

      • KPGv2 3 hours ago

        Indeed. I heard about a browser called Zen a couple weeks ago and installed it. Just took it for a drive yesterday, and by the end of the day, Reddit had blocked me just based on my sporadic, normal use of the site for about two hours here and there while I did other things.

        I switched back to Safari and it worked normal immediately.

skyfaller 4 hours ago

Why Gosub if it isn't written in Go? Should have been called Rustsub ;-)

  • cyberax 3 hours ago

    Personally, it reminded me of BASIC, not go.

  • thwg 3 hours ago

    Someone else should write a browser engine called “Godom”. Which honestly would be a great name. A good browser will handle sessions and DOM.

    • mxuribe 3 hours ago

      Would someone please fix this GODOM browser that keeps crashing... Lol

      Ok, I'll see myself out now. ;-)

  • sharktheone 4 hours ago

    Gosub is kind of an acronym. I don't really like it, but yeah Gosub and go would be more similar than to Rust

ricardobeat an hour ago

I was hoping for a small embeddable engine to finally replace Electron. The build on Windows ends up being 55MB, not too bad but still too large for simple apps.

Is anyone working on something like that?

  • nicoburns an hour ago

    Yes, we're working on that over at https://github.com/DioxusLabs/blitz (alpha release imminent). Our TodoMVC example is current ~20mb with a standard release builds, but comes down to 7.2mb with some compiler flags like -Oz and LTO enabled (these numbers of from macOS).

    And we plan to allow fine grained configuration of the feature set, so if you don't need certain image formats or layout algorithms or networking support, then you can disable them and save on binary size.

  • sharktheone an hour ago

    Well, the application is basically unoptimized. However, we also don't have many components yet that can eat up your memory. But we try to keep the memory usage as low as possible. We also thought about integrating it into something like Electron, and for something like that it is important to have a low memory usage.

    Lateron, we might have some compile time flags to reduce memory usage in cost of a bit of speed. Most Electron apps don't require that big oomf performance on the startup, since everything is locally and can be cached in a better way.

  • flaburgan an hour ago

    That's now one of the goal of Servo. Also, did you look at Tauri?

    • sharktheone an hour ago

      Servo and Tauri still let the Application use JavaScript, which is just very wasteful. I was thinking about making it possible to write dynamic websites completely without JavaScript, by building up WASM support and making that even faster. But that's a not the goal for now. Indeed, we don't even have a JS API for websites yet...

chasil 4 hours ago

Would a fork of Chromium that was restricted to MISRA-C/C++ offer any real security advantages?

Would parts of Chromium be fundamentally incompatible with these standards?

https://en.wikipedia.org/wiki/MISRA_C

  • porphyra 3 hours ago

    Sounds very hard. For example, Rule 21.3 in MISRA C 2012 basically prohibits dynamic memory allocation (e.g. malloc, calloc, realloc, free). Implementing a browser with such restrictions would be quite misrable.

  • ratmice 3 hours ago

    I would think the MISRA rules against dynamic memory allocation would present serious difficulty if not fundamental incompatibility when trying to implement web standards.

    • chasil 3 hours ago

      It is against the rules to call malloc, yes.

      However, it is not against the rules to launch another process with a static amount of declared memory, then access it over shmat().

      This is cheating, but could it be safer?

thawab 3 hours ago

I would recommend to focus on a niche like browser automation/QA with puppeter specially after they released the webdriver bidi[0]. There is a market for this kind of product if it's lighter/faster than chrome.

[0] https://developer.chrome.com/blog/webdriver-bidi

  • KPGv2 3 hours ago

    > there is a market

    OP is not trying to find a market.

dustedcodes 3 hours ago

Why does it matter if it’s written in Rust?

  • smt88 3 hours ago

    Rust was invented to make it easier to write a secure, performant browser engine

  • IshKebab 3 hours ago

    Projects written in Rust tend to be very fast - as fast as C++ or C code - but without the endless security issues.

    You may as well ask "why does it matter if this bridge is made of iron".

  • pessimizer 3 hours ago

    1) I suspect that it's important for potential contributors to know what language it's written in.

    2) It mattered enough for you to complain about it for some reason, so look at that reason, then look at its reflection.

  • spoiler 3 hours ago

    A few thing from the top of my head:

    - Might be interesting to integretors (FFI, dylib, Rust projects)

    - Signals some characters: that it's probably safer than alternatives written in non memory safe languages in same class, has good performance

    - Might attract contributors (ie I'm sure there's an intersection of people passionate abou the web and Rust)

    - This is hacker news, so it might earn a few extra +1s :P

    Edit: formatting

thwg 3 hours ago

I'm confused. Why do you name it “go”-something when it is not implemented in Go... I have a more catchy name for you, Rub, which stands for route to unlimited browsing.

  • thesuperbigfrog 3 hours ago

    "GOSUB" is the syntax used to call subroutines (functions) in BASIC:

    http://retro-basic.com/manual/GOSUB.html

    • thwg 3 hours ago

      Thanks for the pointer. And it makes it doubly confusing. Doesn't a reference to an obsolete, pre-modern language tarnish the reputation of Rust? Doesn't the creator of this project fear lawsuits from the legal team at The Basic Foundation?

      • tadfisher 3 hours ago

        1. No, unless you actively disable your brain's pleasure center

        2. No, because GOSUB (the Basic keyword) is not a trademarked term owned by The Basic Foundation

      • Y_Y an hour ago

        Oh no! Don't tarnish the rust!

      • KPGv2 3 hours ago

        > obsolete, pre-modern language

        but enough about Visual Basic (which still has gosub)

favorited 3 hours ago

I'm always disappointed when conversations here are full of "why don't you just contribute to <other project> instead?" Have you never simply desired to do something yourself?

  • the__alchemist 3 hours ago

    I suspect people who post these whys haven't actually tried that.

    Contributor: Hey, can we add this? Maintainer: No.

  • thwg 3 hours ago

    Yes I have. But not this.

joshmarinacci 3 hours ago

Former Mozilla employee here.

The fact that they are writing their own bytestream abstraction does not bode well.

That said, I hope they succeed at shipping something, even if it’s not competitive with Chrome.

My previous thoughts on the topic: Why you can’t build a web browser and why you should anyway.

https://joshondesign.com/2022/12/14/browser_1000_loc

  • sharktheone 3 hours ago

    The byte stream is one of the first components that was written. Probably It wouldn't be written nowadays. The browser is quite modular, so in the end you can completely out out of that system.

    • joshmarinacci 2 hours ago

      That’s good to hear. I’m excited to see you’ve got a good html parser. That’s worth a lot just by itself.

      • sharktheone an hour ago

        Yes, the HTML parser, probably the component that is the most spec compliant. I think the CSS parser also is. For the initial phase, I think it is more important to get something working. For a later implementation, the spec should dictate what we do and what not. But with a small team, it is just not feasible.

  • diggan 3 hours ago

    > The fact that they are writing their own bytestream abstraction does not bode well.

    You want to elaborate on why exactly? Seems like a kind of shallow dismissal, but then I'm no browser engine developer exactly, maybe it's obvious.

    • joshmarinacci 3 hours ago

      You can only do so much, so success depends on which components you decide to reuse. I wouldn’t build a new database or filesystem abstraction from scratch, for example.

      Rust has lots of bytestream abstractions already with a ton of work put into them. Maybe they have a valid reason for going their own way. I’d like to know.

A4ET8a8uTh0 5 hours ago

I applaud the project espoused spirit, because, similarly to the author(s)' webpage, i don't think we should have a monopoly in this space ( especially given recent moves by Google ).

Small things to be noted ( in the small, but noticeable category):

- repeated paragraph ( https://gosub.io/learn-more/ )from 'Gosub started' to 'open and free' - that is it for now:D.. I will be personally watching it with some interest

edit: some grammar

  • sharktheone 5 hours ago

    I think I fixed this a while ago, but we didn't update the website deployment