瓢虫浏览器展翅欲飞
Ladybird browser spreads its wings

原始链接: https://lwn.net/Articles/976822/

LWN.net 是一家由订阅者支持的技术出版物,它表示开源网络浏览器项目“Ladybird”的目标是独立,而不是加入 Chrome 或 Firefox 之类的行列。 这个 BSD 许可的项目用 C++ 编写,起源于 SerenityOS 项目,但由于其创建者 Andreas Kling 的唯一贡献而分叉。 Ladybird 最初是为 SerenityOS 的浏览器引擎创建 UI,后来与 SerenityOS 一起瞄准了 Linux。 Kling 不再是 SerenityOS 的仁慈独裁者,而是完全专注于 Ladybird。 Ladybird 最初被认为是一个不受第三方依赖的 Web 浏览器,现在专注于构建基于 Web 标准的独特引擎。 渲染图形、处理档案、解码媒体、密码学和 TLS 等核心功能目前都是自主开发的。 虽然主要活跃在 Linux、macOS 和 UNIX 系统上,但 Ladybird 也可以在 WSL(适用于 Linux 的 Windows 子系统)v2 上运行。 尽管取得了进步,Ladybird 仍处于起步阶段,缺乏完善的性能和广泛的功能。

在本文中,作者表达了他们对通过限制特定 JavaScript 和浏览器 API 来限制浏览器功能来简化浏览器的好奇心。 他们认为,现有的纯 HTML 浏览器仍然可以充分执行诸如查看文档或访问简单网站之类的任务,但这种浏览器正在变得越来越少。 尽管他们对允许使用脚本持怀疑态度,但作者承认在该领域创建最小可行产品 (MVP) 所需的初始投资是巨大的。 或者,他们提出了一种方法,涉及创建独立的文档库和模块化浏览器架构,从而实现服务器端和客户端应用程序之间的无缝转换。 他们钦佩 Andreas Kling 等开发人员的努力,但也承认挑战在于摆脱目前主导该领域的单一设计。 他们批评火狐等流行浏览器尽管获得了相关技术,却忽视了核心软件的进步,导致对外部工具的持续依赖和依赖。 在讨论 Discord 作为一个根据视角不同程度的可访问性的平台的例子时,他们建议将基本的、有据可查的、委托的浏览器设计作为潜在的解决方案。
相关文章

原文
Did you know...?

LWN.net is a subscriber-supported publication; we rely on subscribers to keep the entire operation going. Please help out by buying a subscription and keeping LWN on the net.

By Joe Brockmeier
June 7, 2024

Ladybird is an open-source project aimed at building an independent web browser, rather than yet another browser based on Chrome. It is written in C++ and licensed under a two-clause BSD license. The effort began as part of the SerenityOS project, but developer Andreas Kling announced on June 3 that he was "forking" Ladybird as a separate project and stepping away from SerenityOS to focus his attention on the browser completely. Ladybird is not ready to replace Firefox or Chrome for regular use, but it is showing great promise.

Kling started working on SerenityOS in 2018 as a therapy project after completing a substance-abuse rehabilitation program. The SerenityOS name is a nod to the serenity prayer. Prior to working on the project, he had worked on WebKit-based browsers at Apple and Nokia. Eventually he made SerenityOS his full-time job, and funded the work through donations, sales of SerenityOS merchandise, and income from YouTube. (Kling posts monthly updates to his YouTube channel about Ladybird, as well as hacking videos where he walks through working on various components in the browser, such as the JavaScript JIT compiler.)

Taking flight

Kling announced the Ladybird project in September 2022. He said that the project started while creating a Qt GUI for SerenityOS's LibWeb browser engine. He decided to target Linux as well as SerenityOS so it would be easier for people to work on and debug while in Linux. In the post announcing his intent to work solely on Ladybird, he noted that he had been focusing all of his attention on the Linux version of Ladybird. With that realization, he decided to step down as "benevolent dictator for life" (BDFL) of SerenityOS so its development would not be held back:

Before anyone asks, there is no drama behind this change. It's simply recognizing that there have been two big projects packed uncomfortably into a single space for too long, and I'm doing what I believe will make life better for everyone involved.

Ladybird's governance is similar to SerenityOS. Kling is the BDFL, with a group of maintainers (currently ten) who can approve and merge pull requests. The contributing guide notes that maintainership is "by invitation only and does not correlate with any particular metric". Project development discussions are held on a Discord server (account required).

Now independent, Ladybird has dropped SerenityOS as a development target, and has moved to its own GitHub repository. In addition, Kling has relaxed his self-imposed policy of excluding "not invented here" (NIH) code that had applied to SerenityOS, which means that the Ladybird project will be able to make use of existing libraries rather than writing from scratch.

Comparing the README file in the standalone Ladybird repository against the README file in the SerenityOS repository, the goal has evolved from creating "a standards-compliant, independent web browser with no third-party dependencies" to developing an independent browser "using a novel engine based on web standards".

The changes to the section that enumerates the core libraries for Ladybird provide some hints about Kling's plans to use existing libraries rather than continuing to reinvent the wheel. The core support libraries for the project include homegrown libraries for cryptography, TLS, 2D-graphics rendering, archive-file format support, Unicode, as well as audio and video playback. In the pre-fork documentation, they are described as alternatives to other software. For example, Ladybird's TLS (LibTLS) and cryptography (LibCrypto) libraries are "Cryptography primitives and Transport Layer Security (rather than OpenSSL)". The "rather than" language has been removed in the journey to the standalone repository, and the LibSQL library from SerenityOS has already been stripped out in favor of sqlite3.

In a discussion in the project's Discord instance on June 5, Kling indicated that font rendering would likely be replaced with a third-party library. A user asked on June 6 what would determine whether a component would be developed in-house versus using a third-party library. Kling responded that if it implements a web standard, "i.e DOM, HTML, JavaScript, CSS, Wasm, etc. then we build it in house." Otherwise, the project would look to alternatives "unless we believe we can build something better ourselves".

Status

Ladybird is still in early development ("pre-alpha") today. It currently runs on Linux, macOS, and other UNIX-like operating systems. It's also possible to use on Windows with Windows Subsystem for Linux (WSL) version 2, but there appears to be no effort to target Windows independently at this time. At the moment, the project does not provide binaries for any platform. Interested users will need to grab the source and follow the build instructions. Users will need GCC 13+ or Clang 17, and Qt6 development packages to play along at home. Ladybird compiles and runs on, for example, Fedora 40 without a problem, but it is a long way from being suitable for regular use.

[Ladybird browser with inspector]

One might expect that the browser would be more usable with sites with simpler layouts and little to no JavaScript (e.g. LWN) than those with complex layouts and a fair amount of JavaScript (e.g. GitHub). However, this isn't always the case—Ladybird rendered GitHub and many other sites well, if slowly. Browsing LWN anonymously worked well, but logging into LWN, however, consistently proved to be too much for the application. Each time, it basically froze on the front page and clicking links to articles did nothing.

Somewhat ironically, it was not possible to log into Discord using Ladybird. It does a fair job of rendering pages, but speed and stability are still wanting. Each Ladybird tab has its own render process, which is sandboxed as a security measure to prevent any malicious pages from affecting the rest of the system. However, it doesn't seem to suffice to keep a single page from crashing the browser entirely. That's to be expected from a project that's still considered pre-alpha, though.

The current feature set is, not surprisingly, minimal. Ladybird has a URL/search bar, reload, tabs, can zoom in/out on content, take screenshots, and (of course) has backward and forward navigation. It does not, however, have bookmarks, a history display, extensions, password management, printing, or even the ability to save an image. WebRTC does not seem to be supported yet. CSS support seems relatively robust. Ladybird passes 100% of the CSS Selectors tests for levels 1-3, for example, using this test. It gets a 53% score for level 4, while Firefox gets 71%, so not a terrible showing at all. JavaScript support seems solid, but slow: the examples here work, but they load slowly.

On the other hand, Ladybird does have tools for developers, such as inspectors for the document object model (DOM) tree and accessibility trees, as well as the ability to create dumps of various things: the DOM tree and layout tree, computed styles, and so forth. It also has the ability to spoof the User-Agent sent by the browser so that testers can try to get around sites that refuse to work with "unknown" browsers. However, toggling the User-Agent wasn't enough to get past Google's gatekeeping to sign into Gmail—but it's unclear if that meant Ladybird wasn't sending the string correctly or if Google is using other means to fingerprint non-approved browsers.

Suffice it to say, Ladybird is not ready for mainstream use but it does show potential. In the past month, the project has had more than 880 commits from 49 authors. If the project maintains that kind of momentum, or picks up steam, it could become a usable alternative to mainstream browsers before too long.



(Log in to post comments)
联系我们 contact @ memedata.com