From 0bc0a38704113b61c68e20212ab704d76df81bc0 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 25 Nov 2025 12:21:28 +0100 Subject: [PATCH 01/12] ci: update installation workflow --- .github/actions/install/action.yml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index e9864c01..d347f11b 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -66,29 +66,3 @@ runs: mkdir -p v8/out/${{ inputs.os }}/release/obj/zig/ ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/release/obj/zig/libc_v8.a - - - name: Cache libiconv - id: cache-libiconv - uses: actions/cache@v4 - env: - cache-name: cache-libiconv - with: - path: ${{ inputs.cache-dir }}/libiconv - key: vendor/libiconv/libiconv-1.17 - - - name: download libiconv - if: ${{ steps.cache-libiconv.outputs.cache-hit != 'true' }} - shell: bash - run: make download-libiconv - - - name: build libiconv - shell: bash - run: make build-libiconv - - - name: build mimalloc - shell: bash - run: make install-mimalloc - - - name: build netsurf - shell: bash - run: make install-netsurf From dbd500cab913f027194e26e5e67d150fe8cc912f Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 25 Nov 2025 12:24:28 +0100 Subject: [PATCH 02/12] update docker file --- Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 919a9a65..24936ffb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,10 +40,6 @@ WORKDIR /browser RUN git submodule init && \ git submodule update --recursive -RUN make install-libiconv && \ - make install-netsurf && \ - make install-mimalloc - # download and install v8 RUN case $TARGETPLATFORM in \ "linux/arm64") ARCH="aarch64" ;; \ From a1064a54cc331687ccc69f59ce20772fe8baf311 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 25 Nov 2025 12:24:41 +0100 Subject: [PATCH 03/12] cleanup README --- README.md | 41 +++++------------------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 87c393a5..a51ba298 100644 --- a/README.md +++ b/README.md @@ -140,13 +140,14 @@ You may still encounter errors or crashes. Please open an issue with specifics i Here are the key features we have implemented: -- [x] HTTP loader (based on Libcurl) -- [x] HTML parser and DOM tree (based on Netsurf libs) -- [x] Javascript support (v8) +- [x] HTTP loader ([Libcurl](https://curl.se/libcurl/)) +- [x] HTML parser ([html5ever](https://github.com/servo/html5ever)) +- [x] DOM tree +- [x] Javascript support ([v8](https://v8.dev/)) - [x] DOM APIs - [x] Ajax - [x] XHR API - - [x] Fetch API (polyfill) + - [x] Fetch API - [x] DOM dump - [x] CDP/websockets server - [x] Click @@ -214,38 +215,6 @@ To init or update the submodules in the `vendor/` directory: make install-submodule ``` -**iconv** - -libiconv is an internationalization library used by Netsurf. - -``` -make install-libiconv -``` - -**Netsurf libs** - -Netsurf libs are used for HTML parsing and DOM tree generation. - -``` -make install-netsurf -``` - -For dev env, use `make install-netsurf-dev`. - -**Mimalloc** - -Mimalloc is used as a C memory allocator. - -``` -make install-mimalloc -``` - -For dev env, use `make install-mimalloc-dev`. - -Note: when Mimalloc is built in dev mode, you can dump memory stats with the -env var `MIMALLOC_SHOW_STATS=1`. See -[https://microsoft.github.io/mimalloc/environment.html](https://microsoft.github.io/mimalloc/environment.html). - **v8** First, get the tools necessary for building V8, as well as the V8 source code: From 1e090f9d30184b96bded56b2c64ea101c027f29e Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 25 Nov 2025 12:39:40 +0100 Subject: [PATCH 04/12] add html5ever install method --- .github/actions/install/action.yml | 4 ++++ Dockerfile | 2 ++ README.md | 10 ++++++++++ 3 files changed, 16 insertions(+) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index d347f11b..2acb71b8 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -66,3 +66,7 @@ runs: mkdir -p v8/out/${{ inputs.os }}/release/obj/zig/ ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/release/obj/zig/libc_v8.a + + - name: build html5ever + shell: bash + run: make install-html5ever diff --git a/Dockerfile b/Dockerfile index 24936ffb..76531df7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,6 +40,8 @@ WORKDIR /browser RUN git submodule init && \ git submodule update --recursive +RUN make install-html5ever + # download and install v8 RUN case $TARGETPLATFORM in \ "linux/arm64") ARCH="aarch64" ;; \ diff --git a/README.md b/README.md index a51ba298..f40eab57 100644 --- a/README.md +++ b/README.md @@ -215,6 +215,16 @@ To init or update the submodules in the `vendor/` directory: make install-submodule ``` +**html5ever** + +[html5ver](https://github.com/servo/html5ever) is high-performance browser-grade HTML5 parser. + +``` +make install-html5ever +``` + +For dev env, use `make install-html5ever-dev`. + **v8** First, get the tools necessary for building V8, as well as the V8 source code: From e74a286d7053e2240e2452cde62f17516d929913 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Tue, 25 Nov 2025 12:50:01 +0100 Subject: [PATCH 05/12] ci: add install-html5ever-dev --- .github/actions/install/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 2acb71b8..db615ed4 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -70,3 +70,7 @@ runs: - name: build html5ever shell: bash run: make install-html5ever + + - name: build html5ever dev + shell: bash + run: make install-html5ever-dev From bde8b64ba3ebfe803693bd0d452afddc1e73fc76 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Wed, 26 Nov 2025 16:19:16 +0100 Subject: [PATCH 06/12] update html5ever instructions --- .github/actions/install/action.yml | 27 +++++++++++++++++++-------- .github/workflows/build.yml | 4 ++++ .github/workflows/e2e-test.yml | 2 ++ Dockerfile | 2 +- README.md | 4 ++-- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index db615ed4..258170c7 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -26,6 +26,10 @@ inputs: description: 'cache dir to use' required: false default: '~/.cache' + mode: + description: 'debug or release' + required: false + default: 'debug' runs: using: "composite" @@ -58,19 +62,26 @@ runs: wget -O ${{ inputs.cache-dir }}/v8/libc_v8.a https://github.com/lightpanda-io/zig-v8-fork/releases/download/${{ inputs.zig-v8 }}/libc_v8_${{ inputs.v8 }}_${{ inputs.os }}_${{ inputs.arch }}.a - - name: install v8 + - name: install v8 release + if: ${{ inputs.mode == 'release' }} + shell: bash + run: | + mkdir -p v8/out/${{ inputs.os }}/release/obj/zig/ + ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/release/obj/zig/libc_v8.a + + - name: install v8 debug + if: ${{ inputs.mode == 'debug' }} shell: bash run: | mkdir -p v8/out/${{ inputs.os }}/debug/obj/zig/ ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/debug/obj/zig/libc_v8.a - mkdir -p v8/out/${{ inputs.os }}/release/obj/zig/ - ln -s ${{ inputs.cache-dir }}/v8/libc_v8.a v8/out/${{ inputs.os }}/release/obj/zig/libc_v8.a - - - name: build html5ever + - name: hmtl5ever release + if: ${{ inputs.mode == 'release' }} shell: bash - run: make install-html5ever + run: zig -Doptimize=ReleaseSafe build html5ever - - name: build html5ever dev + - name: hmtl5ever debug + if: ${{ inputs.mode == 'debug' }} shell: bash - run: make install-html5ever-dev + run: zig build html5ever diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df16af4c..0ab034e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,6 +36,7 @@ jobs: with: os: ${{env.OS}} arch: ${{env.ARCH}} + mode: 'release' - name: zig build run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) @@ -74,6 +75,7 @@ jobs: with: os: ${{env.OS}} arch: ${{env.ARCH}} + mode: 'release' - name: zig build run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=generic -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) @@ -114,6 +116,7 @@ jobs: with: os: ${{env.OS}} arch: ${{env.ARCH}} + mode: 'release' - name: zig build run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) @@ -157,6 +160,7 @@ jobs: with: os: ${{env.OS}} arch: ${{env.ARCH}} + mode: 'release' - name: zig build run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index fb295246..992c8b2a 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -56,6 +56,8 @@ jobs: submodules: recursive - uses: ./.github/actions/install + with: + mode: 'release' - name: zig build release run: zig build -Doptimize=ReleaseFast -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }}) diff --git a/Dockerfile b/Dockerfile index 76531df7..6f0b2936 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,7 +40,7 @@ WORKDIR /browser RUN git submodule init && \ git submodule update --recursive -RUN make install-html5ever +RUN zig build -Doptimize=ReleaseFast html5ever # download and install v8 RUN case $TARGETPLATFORM in \ diff --git a/README.md b/README.md index f40eab57..5e25926a 100644 --- a/README.md +++ b/README.md @@ -220,10 +220,10 @@ make install-submodule [html5ver](https://github.com/servo/html5ever) is high-performance browser-grade HTML5 parser. ``` -make install-html5ever +zig build html5ever ``` -For dev env, use `make install-html5ever-dev`. +For a release build, use `zig build -Doptimize=ReleaseFast html5ever`. **v8** From 92572c977be2f10550c31f7d9df51d4f28fd91a6 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Sat, 29 Nov 2025 15:11:15 +0100 Subject: [PATCH 07/12] update zig-v8 version --- .github/actions/install/action.yml | 2 +- Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 258170c7..9f73944e 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -17,7 +17,7 @@ inputs: zig-v8: description: 'zig v8 version to install' required: false - default: 'v0.1.33' + default: 'v0.1.35' v8: description: 'v8 version to install' required: false diff --git a/Dockerfile b/Dockerfile index 6f0b2936..a405a057 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ARG MINISIG=0.12 ARG ZIG=0.15.2 ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U ARG V8=14.0.365.4 -ARG ZIG_V8=v0.1.33 +ARG ZIG_V8=v0.1.35 ARG TARGETPLATFORM RUN apt-get update -yq && \ From f968db63e9507d1bda84030f7f0ef9685a13c307 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Sat, 29 Nov 2025 15:25:19 +0100 Subject: [PATCH 08/12] ci: use setup-zig v2.0.5 --- .github/actions/install/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 9f73944e..1d300641 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -42,7 +42,7 @@ runs: sudo apt-get update sudo apt-get install -y wget xz-utils python3 ca-certificates git pkg-config libglib2.0-dev gperf libexpat1-dev cmake clang - - uses: mlugg/setup-zig@v2 + - uses: mlugg/setup-zig@v2.0.5 with: version: ${{ inputs.zig }} From c9b9ef993411705aa3dbd6979553f0be4163af98 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 1 Dec 2025 08:38:56 +0100 Subject: [PATCH 09/12] ci: build html5ever typo --- .github/actions/install/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 1d300641..e0ca3c02 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -79,7 +79,7 @@ runs: - name: hmtl5ever release if: ${{ inputs.mode == 'release' }} shell: bash - run: zig -Doptimize=ReleaseSafe build html5ever + run: zig build -Doptimize=ReleaseSafe html5ever - name: hmtl5ever debug if: ${{ inputs.mode == 'debug' }} From d18253d50b2c4fe9153bff3aacd037c68a0032f3 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 1 Dec 2025 08:42:42 +0100 Subject: [PATCH 10/12] fix import for rename CSS.zig insto css.zig --- src/browser/js/bridge.zig | 2 +- src/browser/webapi/Element.zig | 2 +- src/browser/webapi/Window.zig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/browser/js/bridge.zig b/src/browser/js/bridge.zig index d3d983d4..748dbc8e 100644 --- a/src/browser/js/bridge.zig +++ b/src/browser/js/bridge.zig @@ -485,7 +485,7 @@ pub const JsApis = flattenTypes(&.{ @import("../webapi/collections.zig"), @import("../webapi/Console.zig"), @import("../webapi/Crypto.zig"), - @import("../webapi/CSS.zig"), + @import("../webapi/css.zig"), @import("../webapi/css/CSSRule.zig"), @import("../webapi/css/CSSRuleList.zig"), @import("../webapi/css/CSSStyleDeclaration.zig"), diff --git a/src/browser/webapi/Element.zig b/src/browser/webapi/Element.zig index 36215d47..dddb5655 100644 --- a/src/browser/webapi/Element.zig +++ b/src/browser/webapi/Element.zig @@ -32,7 +32,7 @@ pub const Attribute = @import("element/Attribute.zig"); const CSSStyleProperties = @import("css/CSSStyleProperties.zig"); pub const DOMStringMap = @import("element/DOMStringMap.zig"); const DOMRect = @import("DOMRect.zig"); -const CSS = @import("CSS.zig"); +const CSS = @import("css.zig"); const ShadowRoot = @import("ShadowRoot.zig"); pub const Svg = @import("element/Svg.zig"); diff --git a/src/browser/webapi/Window.zig b/src/browser/webapi/Window.zig index ba3683b6..16c553c4 100644 --- a/src/browser/webapi/Window.zig +++ b/src/browser/webapi/Window.zig @@ -25,7 +25,7 @@ const Page = @import("../Page.zig"); const Console = @import("Console.zig"); const History = @import("History.zig"); const Crypto = @import("Crypto.zig"); -const CSS = @import("CSS.zig"); +const CSS = @import("css.zig"); const Navigator = @import("Navigator.zig"); const Screen = @import("Screen.zig"); const Performance = @import("Performance.zig"); From ee7c38045f127ec03d0a392f0fc94c17c84dfb1f Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 1 Dec 2025 08:43:42 +0100 Subject: [PATCH 11/12] zig fmt --- src/browser/webapi/Window.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/browser/webapi/Window.zig b/src/browser/webapi/Window.zig index 16c553c4..67093579 100644 --- a/src/browser/webapi/Window.zig +++ b/src/browser/webapi/Window.zig @@ -265,13 +265,12 @@ pub fn postMessage(self: *Window, message: js.Object, target_origin: ?[]const u8 const origin = try self._location.getOrigin(page); const callback = try page._factory.create(PostMessageCallback{ .window = self, - .message = try message.persist() , + .message = try message.persist(), .origin = try page.arena.dupe(u8, origin), .page = page, }); errdefer page._factory.destroy(callback); - try page.scheduler.add(callback, PostMessageCallback.run, 0, .{ .name = "postMessage", .low_priority = false, From 4b60f56e5f573443fd9d1f405aa4169739fccc76 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 1 Dec 2025 09:06:52 +0100 Subject: [PATCH 12/12] ci: use releaseFast for hmtl5ever release mode --- .github/actions/install/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index e0ca3c02..3b29b7b2 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -79,7 +79,7 @@ runs: - name: hmtl5ever release if: ${{ inputs.mode == 'release' }} shell: bash - run: zig build -Doptimize=ReleaseSafe html5ever + run: zig build -Doptimize=ReleaseFast html5ever - name: hmtl5ever debug if: ${{ inputs.mode == 'debug' }}