diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index e9864c01..3b29b7b2 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 @@ -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" @@ -38,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 }} @@ -58,37 +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: 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' }} + - name: hmtl5ever release + if: ${{ inputs.mode == 'release' }} shell: bash - run: make download-libiconv + run: zig build -Doptimize=ReleaseFast html5ever - - name: build libiconv + - name: hmtl5ever debug + if: ${{ inputs.mode == 'debug' }} shell: bash - run: make build-libiconv - - - name: build mimalloc - shell: bash - run: make install-mimalloc - - - name: build netsurf - shell: bash - run: make install-netsurf + 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 919a9a65..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 && \ @@ -40,9 +40,7 @@ WORKDIR /browser RUN git submodule init && \ git submodule update --recursive -RUN make install-libiconv && \ - make install-netsurf && \ - make install-mimalloc +RUN zig build -Doptimize=ReleaseFast html5ever # download and install v8 RUN case $TARGETPLATFORM in \ diff --git a/README.md b/README.md index 87c393a5..5e25926a 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,37 +215,15 @@ To init or update the submodules in the `vendor/` directory: make install-submodule ``` -**iconv** +**html5ever** -libiconv is an internationalization library used by Netsurf. +[html5ver](https://github.com/servo/html5ever) is high-performance browser-grade HTML5 parser. ``` -make install-libiconv +zig build html5ever ``` -**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). +For a release build, use `zig build -Doptimize=ReleaseFast html5ever`. **v8** diff --git a/src/browser/js/bridge.zig b/src/browser/js/bridge.zig index 73b588a1..026ccffa 100644 --- a/src/browser/js/bridge.zig +++ b/src/browser/js/bridge.zig @@ -493,7 +493,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 595d25fd..8836770a 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 84fae9f8..67093579 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");