Repository navigation
release: Bump version to 0.8.0 - #49467
Merged
Merged
Conversation
Produced by running ./mach release 0.8.0 Signed-off-by: Jonathan Schwender <[email protected]>
TimvdLippe
approved these changes
Nov 1, 2026
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
Add ports/arkweb, a self-contained cdylib (libservo_arkweb.so) that implements ArkWeb's NWeb C++ interfaces on top of libservo, so a stock ArkTS `Web` component renders with Servo instead of the Chromium-based engine. NWeb entry points arrive on ACE threads and are forwarded as actions to a Servo event-loop thread (src/runtime.rs, cxx bridge in src/bridge.rs). The hand-written NWeb subclasses in cpp/ sit on generated no-op stub bases, over NWeb headers vendored in vendor/ohos_nweb (tools/sync-headers.sh, tools/gen_stubs.py). ohos-patches/ holds the OpenHarmony webview diff that makes nweb_helper.cpp dlopen the library when the system parameter web.engine.enforce is 100, with apply/build instructions, and tools/deploy.py (hdc-py based) installs the library on a device. Bringing the shim up on an rk3568 needed: - starting the servo thread in LibraryLoaded (CreateNWeb can precede InitializeWebEngine); - setting opts.config_dir from --user-data-dir (the OHOS font cache unwraps it); - buffering the initial load until the browsing context is registered; - deferring WebView creation until the first real Resize, and setting the OHNativeWindow buffer geometry before creating the surfman surface (otherwise WebRender OOMs into ACE's 1x1/producer surface); - letting WebView::resize own the rendering-context resize. Resizing the context directly first makes Painter::resize_rendering_context early-return (it is already at the target size), which skips the WebRender document-view update, the display-list resend and set_needs_repaint -- no new frame is scheduled and the old one persists until an unrelated event (a tap) forces a repaint. Most visible as a half-height page after the soft keyboard closes, once the IME is wired. Buffer geometry is still set first, before the surfman resize that resize() performs. With the context no longer held for that direct resize, BuiltWebView does not keep one: the painter and the delegate hold their own. ACE's `OnPause`/`OnOccluded` hide the WebView and `OnContinue`/`OnUnoccluded` show it again; a hidden WebView is neither painted nor animated. Focusing a web component, and building its WebView, gives that WebView system focus (`WebView::set_focused`) and takes it from the other WebViews of the process. Move the port from OpenHarmony-7.0-Beta1 to OpenHarmony-v7.0-Release. The NWeb headers are re-synced from web_webview 12cb9a37bbba. The release inserts new virtuals in the middle of NWeb (GetSurfaceNodeId, GetSurfaceRSHandle, ...) and removes OnTouchCancelById, so a shim built against the Beta1 headers no longer matches the vtable of the 7.0 libraries. The stub bases are regenerated from the new headers. The new ohos-patches/0002 fixes base/startup/init, which tests the undefined macro __LP__ instead of __LP64__ and therefore looks up seccomp filters under lib/seccomp on 64-bit builds: appspawn fails to install its filter and exits, and init reboots the device in a loop. Every 64-bit 7.0-Release image needs it, with or without Servo. The rebase of 0001 is in the RTLD_LOCAL patch, which edits that file later in the stack. Validation: Test by building with ./mach check --ohos -p arkweb, then deploy (ports/arkweb/tools/deploy.py) and run uv run ports/arkweb/tools/test_render.py on a device; a webview resize must repaint immediately rather than leaving the previous frame. Move to OpenHarmony-v7.0-Release: Built a full rk3568 arm64 image from OpenHarmony-v7.0-Release with ohos-patches/0001 and 0002 applied (without 0002 it boot-loops on appspawn) and flashed a HiHope DAYU200 (OpenHarmony 7.0, API 26); `./mach build --ohos --release --no-package -p arkweb`, deployed with `tools/deploy.py`, test app installed with `tools/build_test_app.py`; `HDC_TARGET=<serial> uv run --with pytest --with hdc-py --with pillow python -m pytest ports/arkweb/tools`: 35 passed, 1 xfailed. `tools/gen_stubs.py --check` is clean. 2026-11-09 sync: `./mach build --ohos --release --no-package -p arkweb`; on a DAYU200 (OpenHarmony 7.0), deploy.py with this sync's library returned 67 s after it rebooted the board, with the board listed and booted, without a manual `hdc kill -r`; the arkweb-test suite of `ports/arkweb/tools` then passed (37 tests) once the board's hdcd had restarted on its own, between 403 and 470 s after boot, which a run at 403 s met as disconnects. AI-assisted: Yes (agent session; implementation and on-device testing) AI-assisted: Yes (agent session; 2026-10-08 sync -- adapted to upstream API removals: `WebView::set_throttled` (c974e3c) -> `hide()`/`show()` for OnPause/OnOccluded, `WebView::focus` (15aa067) -> `set_focused`, focusing one WebView and unfocusing the others; Cargo.lock regenerated from upstream's so that `cargo metadata --locked` passes at this commit) AI-assisted: Yes (agent session; 2026-10-08 sync -- carried the focus change of the backend commit over to the deferred WebView: `focus_webview` reaches it through `entry.built`, and a new WebView takes focus once built) AI-assisted: Yes (agent session; 2026-10-09 restack -- folded in "ports/arkweb: on-device render fixes, deploy.py, OHOS patches" and wrote the description of the port from its README) AI-assisted: Yes (agent session; header sync, OpenHarmony image build and boot-loop fix, on-device testing) AI-assisted: Yes (agent session; 2026-10-13 sync -- folded in "squash! ports/arkweb: Servo as an alternative ArkWeb webview backend" (the move to OpenHarmony-v7.0-Release)) AI-assisted: Yes (agent session; 2026-11-09 sync -- Cargo.lock: arkweb takes the workspace version, now 0.8.0 (servo#49467); seven Windows-only windows-sys edges back to upstream's resolution, found by the independent review) AI-assisted: Yes (agent session; 2026-11-09 sync -- upstream added `LoadStatus::Stopped` (servo#49427): a stopped load finishes like a completed one, as a WebView reports `stop()` with a page-finished callback, found by the drift review; deploy.py waits after its reboot until the device is listed again and has finished booting, restarting the hdc server while the device is not listed, which the hdc server needs to enumerate a rebooted device again; the usage example names the OpenHarmony checkout with a placeholder) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
pushed a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
…ndexeddb
Add an OpenHarmony RDB backend behind the `ohos-rdb-backend` feature: OHOS
builds can use the system database through ohos-rdb-sys C FFI instead of the
bundled sqlite3. The sqlite modules keep their upstream logic; the RDB
implementation lives in new files with its own copy of the schema and CRUD, a
deliberate duplication that keeps rebases trivial, wired in through a small set
of cfg hooks. The FFI wrappers free their native handles on drop. A cursor
borrows its transaction, so the compiler rejects reads after commit. Strings
with interior NUL bytes are stored as blobs and read back unchanged.
Backend selection is a feature choice rather than a target choice, so a plain
`./mach build --ohos` keeps the upstream SQLite behaviour and no configuration
fails to compile:
./mach build --ohos # SQLite, as before
./mach build --ohos --features ohos-rdb-backend
# both, chosen at runtime
./mach build --ohos --no-default-features \
--features "base,ohos-rdb-backend"
# RDB only
Dropping sqlite is what makes the third configuration worth having: when
first measured (base 79e2c7a) the stripped aarch64 release
`libservoshell.so` went from 127,736,736 to 125,736,080 bytes, 1.91 MiB
less. Since the 2026-08-29 sync this no longer holds: upstream fb04f8f
(servo#43819, on-disk HTTP cache) makes rusqlite an unconditional dependency of
components/net, so the RDB-only configuration still links sqlite. The saving
needs remeasuring, and the configuration is only worth keeping if servo#43819's
sqlite use becomes optional.
With both backends compiled in, `storage_ohos_rdb_backend_enabled` (default
true) picks one per store as it is opened, so a single binary can A/B them
without reinstalling. The two backends keep disjoint on-disk stores — sqlite
files versus RDB's nested `rdb/<store>` — so flipping the pref switches to the
other backend's data, which starts out empty. That is intended for A/B
comparison; there is no migration between them.
Deliberate difference from the SQLite twin: RDB delivers the callbacks of a
batch after its commit, so the whole batch lands or errors together (SQLite
reports each operation in autocommit). Schema operations join that batch
transaction and follow the same rule. A second deliberate difference: after a
failed webstorage load on OHOS the session's final save is skipped, so a
partially loaded state cannot overwrite the store.
On a HarmonyOS phone the two legs of the pref agree exactly. One signed HAP,
`storage_ohos_rdb_backend_enabled` flipped between runs, over the ten WPT
storage tests the backend touches: 1188 subtests pass and 37 fail on each
side, test for test, and the failures are the ones tests/wpt/meta already
expects. The stores confirm the switch rather than assuming it — with the pref
on the app writes only `rdb/reg.rdb` and `rdb/webstorage.rdb`, with it off only
`reg.sqlite` and `webstorage.sqlite`.
One RDB limitation is worth recording. Opening a second client_storage registry
fails (14800001 / 14800011) about two runs in three, on DAYU200 and a HarmonyOS phone
alike, when the process is not an application: `new_storage_threads` with no
`config_dir` falls back to `tempfile::tempdir()`, which outside an application
sandbox is `/data/local/tmp`. Neither half alone is enough — a single registry
under `/data/local/tmp` is reliable, and so are two registries inside the
application, which a phone confirmed over ten launches of the default
configuration and five of `--temporary-storage`, the latter being the same
two-registry shape that fails in a bare process. Servo always passes the
application's cache dir, so it never meets the condition;
`test_new_storage_threads_create_independent_groups`, which does, is ignored
when the RDB backend is compiled in.
The RDB copies of the IndexedDB and client-storage schemas are checked
against the SQLite ones by `tests/schema_parity.rs`, a host test that builds
both in an in-memory SQLite database and compares tables, columns, keys,
foreign keys and indexes, so an upstream schema change that is not mirrored
fails on the host instead of diverging on devices. The webstorage `data`
tables differ on purpose and are not compared.
Validation: Parallel twin of the sqlite backend — revalidate on every rebase even when it merges cleanly, since upstream storage changes never conflict with the RDB engine files. (1) `./mach check --ohos -- -p servo-storage --all-targets --features ohos-rdb-backend` must pass warning-free, as must the plain and the `--no-default-features --features ohos-rdb-backend` configurations; a new `AsyncOperation`/engine-trait variant fails here loudly and must be implemented in the RDB twins, not wildcarded. (2) Diff upstream changes since the previous base with `git log -p <old-base>..<new-base> -- components/storage` and mirror any sqlite-engine semantics changes into `engines/ohos_rdb.rs` / `webstorage/engines/ohos_rdb.rs` / `client_storage_ohos_rdb.rs`. (3) Host `./mach test-unit -p servo-storage` pins the sqlite reference behaviour. (4) On a device, run the same suite against both backends with `CARGO_TARGET_AARCH64_UNKNOWN_LINUX_OHOS_RUNNER=ohos-test-runner cargo nextest run -p servo-storage --target aarch64-unknown-linux-ohos [--no-default-features --features ohos-rdb-backend]` (raise nextest's slow-timeout: every test is pushed to the device), then the same-HAP A/B: build servoshell with `--features ohos-rdb-backend` (flavor and signing per the device: `harmonyos`/`hos` for a phone whose UDID is in the profile, default/OpenHarmony for the DAYU200), install it, and run `./mach test-wpt --ohos --release --no-headless --ohos-device <serial> --pref dom_indexeddb_enabled=true --pref storage_ohos_rdb_backend_enabled=<bool> --log-wptreport <leg>.json <subset>` (the `servo_ohos` wptrunner product of the `wpt-ohos` runner branch, cherry-picked onto the stack) once per pref value with `bm clean -n org.servo.servo -d` before each leg. Subset = all of `webstorage/` plus `IndexedDB/{idbobjectstore_put,idbobjectstore_get,idbobjectstore_delete,idbobjectstore_createIndex,idbindex_get,idbcursor_continue_objectstore,keypath,key_valid,transaction-abort-generator-revert,upgrade-transaction-lifecycle-committed,idbfactory_open,idbfactory_deleteDatabase}.any.{html,worker.html}` (78 tests). Compare the two wptreports subtest by subtest: no subtest may differ (crash/timeout-truncated tests are re-run in isolation on both legs), and the app data dir must contain only `*.rdb` stores after the true leg and only `*.sqlite` after the false leg (a lone `reg.rdb` from the runner's pref-less first launch and the HTTP cache's `cache.sqlite3` are expected). (5) Host `cargo nextest run -p servo-storage schema_parity` must pass; it fails when an upstream schema change is not mirrored into `indexeddb/engines/shared.rs` or `client_storage_shared.rs`. `./mach clippy --locked -- -- --deny warnings` must pass.
AI-assisted: Yes (agent session; implementation and on-device testing)
AI-assisted: Yes (agent session; 2026-08-29 rebase conflict resolution -- components/servo/Cargo.toml and components/storage/Cargo.toml resolved to the upstream side with only the fork's `ohos-rdb-backend` feature and optional-dependency markers re-added: upstream's `no-wgl = ["dep:mozangle", ...]` (servo#47198) is kept and `ohos-rdb-backend = ["storage/ohos-rdb-backend"]` re-added after it, and servo#43819 moved rusqlite's `bundled` feature onto the workspace dependency, so components/storage now carries only `rusqlite = { workspace = true, optional = true }`. Validation step (2): of the three upstream commits touching components/storage, only 7bea9ed (`ImmutableOrigin::ascii_serialization` now returns `Cow<'_, str>`) reaches the RDB twins, and it is a type change with no behaviour change; mirrored into `client_storage_shared.rs`, whose `create_a_storage_shelf` now hands the `Cow` to `push_text` by deref instead of the gone `as_str()`; `indexeddb/engines/shared.rs` already coerced, and no other twin site serializes an origin. fb04f8f touches only the Cargo.toml line above and 39f05ac only sqlite-side destructuring, so no semantics were mirrored into `engines/ohos_rdb.rs`, `webstorage/engines/ohos_rdb.rs` or `client_storage_ohos_rdb.rs`. Note: fb04f8f gave components/net an unconditional rusqlite dependency, so the 1.91 MiB saving quoted above for the RDB-only configuration no longer holds and needs remeasuring)
AI-assisted: Yes (agent session; 2026-10-08 sync -- conflict resolution in Cargo.toml, components/servo/Cargo.toml and components/storage/Cargo.toml: upstream's 0.7.0 versions with the fork's `default-features = false` re-added, upstream's new `multiprocess` default kept in servo's `default` and servoshell's `base` group, the fork's `[lints.rust]` table dropped for upstream's `[lints] workspace = true`; mirrored servo#47936 (index names unique per object store) into the RDB schema copy, adapted the tests to servo#48037's `GenericCallback::new`, added tests/schema_parity.rs and Validation step (5), updated step (4) for the current WPT runner, folded the clippy `duplicate_mod` squash commit; Cargo.lock regenerated from upstream's so that `cargo metadata --locked` passes at this commit)
AI-assisted: Yes (agent session; 2026-10-13 sync -- upstream servo#47255 added the default_tooling feature group: kept it in servo's default set and servoshell's base group next to the storage backend features)
AI-assisted: Yes (agent session; 2026-10-22 sync -- upstream servo#48934 and servo#49065 renamed servoshell's `default_without_allocator` group to `default_base` (which mach selects with `--no-default-features` for dummy-media builds) and moved jemalloc into it: `default_base` = `base` + `sqlite-backend`, and `base` takes upstream's list including `jemalloc`, so the RDB-only command above no longer names the allocator; servo's `default` merged next to upstream's blank line)
AI-assisted: Yes (agent session; 2026-11-09 sync -- the storage crate joins upstream's 0.8.0 workspace version block (servo#49467), keeping default-features = false; the sqlite-backend feature next to upstream's subtlecrypto (servo#48860))
Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 9, 2026
Nothing caches media in Servo apart from the backends' own buffers: every loop, seek back, replay, second element and reload downloads the resource again, and the media element manages each player's fetch, with its own backoff, suspension and restarts. Add the crate servo-media-cache, a process-wide cache that fetches media resources on behalf of their readers and keeps them in blocks of 64 KiB, as Gecko's MediaCache and Chromium's MultiBuffer do. A resource is identified by its URL, CORS mode and the origin of the document, is shared by every reader that opens it, and is reused for 300 s after its last reader is gone. Storage: a resource of known length up to 8 MiB keeps its blocks in memory, all of them together within 32 MiB, beyond which unused ones go first and then new ones use the file. Every other resource uses slots of one anonymous temporary file in the directory of the pref media_cache_directory, or the system temporary directory, so that its data is page cache that the kernel can reclaim. If the file cannot be created, read or written, blocks stay in memory within 32 MiB. When the budget is used up, the block whose next use is predicted latest goes first, as with Gecko's PredictNextUse; the read-ahead of the readers is protected, up to half of the budget, and blocks read for metadata go by their last use. Fetching: a resource has at most two fetches, started through a Fetcher that the media element implements, for the readers that still need them. The main fetch loads 30 s ahead of each reader at its rate, else 8 MiB, is suspended there and resumes below 10 s, else 2 MiB. A reader that only needs metadata loads 1 MiB ahead, and an idle one nothing. A read more than 1 MiB from every fetch starts a second fetch at its block, so that the probe of an index at the end of a file costs one small request; the last few read positions of a reader keep their fetches, but only the current one starts fetches. A fetch that reaches cached data stops unless the next missing byte is within 1 MiB. A declined suspension cancels a fetch with range support, which restarts at the first missing byte once it is needed, and so does a suspension that lasts 30 s; without range support, the fetch keeps loading within its share of the protected read-ahead, since a restart fetches the resource from its start again and discards what lies before the read. Requests after the first carry If-Range. Each response is verified as HTML's "verify a media response" asks: a CORS-cross-origin response from another origin than the earlier ones fails the load, and any CORS-cross-origin response taints the media data. A 200 to a range request with the same validator and length makes the resource sequential; a differing validator or length fails the readers with ResourceChanged instead of splicing two versions of the resource. A fetch that ends early is restarted where it stopped while it stores new data, and otherwise the readers fail with a network error; a 416 ends the resource. Reading: readers never block. A read returns the cached bytes at a position, or Pending, and the reader's waker is called once data is there. An observer hears of the metadata, progress at most every 350 ms, suspension, resumption and completion of the download, and of errors. The cache queues its calls of fetchers, wakers and observers, and the user objects it drops, under its lock, and one thread at a time makes them once the lock is released; file I/O also happens without the lock, on pinned slots. Time comes from a clock that tests replace. A reader that a player still holds can be closed, which detaches it as dropping it does and fails its later reads; a reader also tells whether the resource is tainted, before its metadata event arrives. New prefs set the directory, budgets and thresholds: media_cache_directory, media_cache_file_budget_mb (128 on OpenHarmony and Android, 512 elsewhere), media_cache_memory_resource_limit_kb, media_cache_memory_fallback_mb, media_cache_readahead_seconds, media_cache_resume_seconds, media_cache_suspend_seconds and media_cache_reuse_seconds. `./mach test-unit -p servo-media-cache` runs the tests of the crate. Players may read a reader directly through the new Player::set_data_source, which backends that cannot refuse with PlayerError::NotSupported. Fork note: meant for upstream. Drop once upstream has it. Testing: 54 unit tests with a fake fetcher and a fake clock, which cover sharing, suspension and resumption, gap and probe fetches, resources without range support or of unknown length, validators and 200s to range requests, origin verification and taint, recovery from early ends, 416, eviction, memory and file backing and their I/O errors, the reuse window, trimming, activities, wakers and observers called without the lock and dropped from inside callbacks, and readers on other threads, and closing a reader that a player holds. Validation: `./mach test-unit -p servo-media-cache` passes ten runs in a row; each of 22 deliberate breaks makes at least one test fail. Two independent reviews of the crate; their findings are fixed. `./mach check`, `cargo clippy -p servo-media-cache --tests` and `./mach fmt` pass. AI-assisted: Yes (agent session; implemented, reviewed, tested and mutation-checked by agents) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the media cache prefs where upstream removed the `layout_unimplemented`, variable-fonts and writing-mode prefs (servo#48915)) AI-assisted: Yes (agent session; 2026-10-29 sync -- mechanical conflict resolution, no semantic change: the prefs next to upstream's `mathml_core_enabled` (servo#48631)) AI-assisted: Yes (agent session; 2026-11-09 sync -- the media cache crate joins upstream's 0.8.0 workspace version block (servo#49467), and Cargo.lock gives it that version) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
Add ports/arkweb, a self-contained cdylib (libservo_arkweb.so) that implements ArkWeb's NWeb C++ interfaces on top of libservo, so a stock ArkTS `Web` component renders with Servo instead of the Chromium-based engine. NWeb entry points arrive on ACE threads and are forwarded as actions to a Servo event-loop thread (src/runtime.rs, cxx bridge in src/bridge.rs). The hand-written NWeb subclasses in cpp/ sit on generated no-op stub bases, over NWeb headers vendored in vendor/ohos_nweb (tools/sync-headers.sh, tools/gen_stubs.py). ohos-patches/ holds the OpenHarmony webview diff that makes nweb_helper.cpp dlopen the library when the system parameter web.engine.enforce is 100, with apply/build instructions, and tools/deploy.py (hdc-py based) installs the library on a device. Bringing the shim up on an rk3568 needed: - starting the servo thread in LibraryLoaded (CreateNWeb can precede InitializeWebEngine); - setting opts.config_dir from --user-data-dir (the OHOS font cache unwraps it); - buffering the initial load until the browsing context is registered; - deferring WebView creation until the first real Resize, and setting the OHNativeWindow buffer geometry before creating the surfman surface (otherwise WebRender OOMs into ACE's 1x1/producer surface); - letting WebView::resize own the rendering-context resize. Resizing the context directly first makes Painter::resize_rendering_context early-return (it is already at the target size), which skips the WebRender document-view update, the display-list resend and set_needs_repaint -- no new frame is scheduled and the old one persists until an unrelated event (a tap) forces a repaint. Most visible as a half-height page after the soft keyboard closes, once the IME is wired. Buffer geometry is still set first, before the surfman resize that resize() performs. With the context no longer held for that direct resize, BuiltWebView does not keep one: the painter and the delegate hold their own. ACE's `OnPause`/`OnOccluded` hide the WebView and `OnContinue`/`OnUnoccluded` show it again; a hidden WebView is neither painted nor animated. Focusing a web component, and building its WebView, gives that WebView system focus (`WebView::set_focused`) and takes it from the other WebViews of the process. Move the port from OpenHarmony-7.0-Beta1 to OpenHarmony-v7.0-Release. The NWeb headers are re-synced from web_webview 12cb9a37bbba. The release inserts new virtuals in the middle of NWeb (GetSurfaceNodeId, GetSurfaceRSHandle, ...) and removes OnTouchCancelById, so a shim built against the Beta1 headers no longer matches the vtable of the 7.0 libraries. The stub bases are regenerated from the new headers. The new ohos-patches/0002 fixes base/startup/init, which tests the undefined macro __LP__ instead of __LP64__ and therefore looks up seccomp filters under lib/seccomp on 64-bit builds: appspawn fails to install its filter and exits, and init reboots the device in a loop. Every 64-bit 7.0-Release image needs it, with or without Servo. The rebase of 0001 is in the RTLD_LOCAL patch, which edits that file later in the stack. Validation: Test by building with ./mach check --ohos -p arkweb, then deploy (ports/arkweb/tools/deploy.py) and run uv run ports/arkweb/tools/test_render.py on a device; a webview resize must repaint immediately rather than leaving the previous frame. Move to OpenHarmony-v7.0-Release: Built a full rk3568 arm64 image from OpenHarmony-v7.0-Release with ohos-patches/0001 and 0002 applied (without 0002 it boot-loops on appspawn) and flashed a HiHope DAYU200 (OpenHarmony 7.0, API 26); `./mach build --ohos --release --no-package -p arkweb`, deployed with `tools/deploy.py`, test app installed with `tools/build_test_app.py`; `HDC_TARGET=<serial> uv run --with pytest --with hdc-py --with pillow python -m pytest ports/arkweb/tools`: 35 passed, 1 xfailed. `tools/gen_stubs.py --check` is clean. 2026-11-09 sync: `./mach build --ohos --release --no-package -p arkweb`; on a DAYU200 (OpenHarmony 7.0), deploy.py with this sync's library returned 67 s after it rebooted the board, with the board listed and booted, without a manual `hdc kill -r`; the arkweb-test suite of `ports/arkweb/tools` then passed (37 tests) once the board's hdcd had restarted on its own, between 403 and 470 s after boot, which a run at 403 s met as disconnects. AI-assisted: Yes (agent session; implementation and on-device testing) AI-assisted: Yes (agent session; 2026-10-08 sync -- adapted to upstream API removals: `WebView::set_throttled` (c974e3c) -> `hide()`/`show()` for OnPause/OnOccluded, `WebView::focus` (15aa067) -> `set_focused`, focusing one WebView and unfocusing the others; Cargo.lock regenerated from upstream's so that `cargo metadata --locked` passes at this commit) AI-assisted: Yes (agent session; 2026-10-08 sync -- carried the focus change of the backend commit over to the deferred WebView: `focus_webview` reaches it through `entry.built`, and a new WebView takes focus once built) AI-assisted: Yes (agent session; 2026-10-09 restack -- folded in "ports/arkweb: on-device render fixes, deploy.py, OHOS patches" and wrote the description of the port from its README) AI-assisted: Yes (agent session; header sync, OpenHarmony image build and boot-loop fix, on-device testing) AI-assisted: Yes (agent session; 2026-10-13 sync -- folded in "squash! ports/arkweb: Servo as an alternative ArkWeb webview backend" (the move to OpenHarmony-v7.0-Release)) AI-assisted: Yes (agent session; 2026-11-09 sync -- Cargo.lock: arkweb takes the workspace version, now 0.8.0 (servo#49467); seven Windows-only windows-sys edges back to upstream's resolution, found by the independent review) AI-assisted: Yes (agent session; 2026-11-09 sync -- upstream added `LoadStatus::Stopped` (servo#49427): a stopped load finishes like a completed one, as a WebView reports `stop()` with a page-finished callback, found by the drift review; deploy.py waits after its reboot until the device is listed again and has finished booting, restarting the hdc server while the device is not listed, which the hdc server needs to enumerate a rebooted device again; the usage example names the OpenHarmony checkout with a placeholder) Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
pushed a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
…ndexeddb
Add an OpenHarmony RDB backend behind the `ohos-rdb-backend` feature: OHOS
builds can use the system database through ohos-rdb-sys C FFI instead of the
bundled sqlite3. The sqlite modules keep their upstream logic; the RDB
implementation lives in new files with its own copy of the schema and CRUD, a
deliberate duplication that keeps rebases trivial, wired in through a small set
of cfg hooks. The FFI wrappers free their native handles on drop. A cursor
borrows its transaction, so the compiler rejects reads after commit. Strings
with interior NUL bytes are stored as blobs and read back unchanged.
Backend selection is a feature choice rather than a target choice, so a plain
`./mach build --ohos` keeps the upstream SQLite behaviour and no configuration
fails to compile:
./mach build --ohos # SQLite, as before
./mach build --ohos --features ohos-rdb-backend
# both, chosen at runtime
./mach build --ohos --no-default-features \
--features "base,ohos-rdb-backend"
# RDB only
Dropping sqlite is what makes the third configuration worth having: when
first measured (base 79e2c7a) the stripped aarch64 release
`libservoshell.so` went from 127,736,736 to 125,736,080 bytes, 1.91 MiB
less. Since the 2026-08-29 sync this no longer holds: upstream fb04f8f
(servo#43819, on-disk HTTP cache) makes rusqlite an unconditional dependency of
components/net, so the RDB-only configuration still links sqlite. The saving
needs remeasuring, and the configuration is only worth keeping if servo#43819's
sqlite use becomes optional.
With both backends compiled in, `storage_ohos_rdb_backend_enabled` (default
true) picks one per store as it is opened, so a single binary can A/B them
without reinstalling. The two backends keep disjoint on-disk stores — sqlite
files versus RDB's nested `rdb/<store>` — so flipping the pref switches to the
other backend's data, which starts out empty. That is intended for A/B
comparison; there is no migration between them.
Deliberate difference from the SQLite twin: RDB delivers the callbacks of a
batch after its commit, so the whole batch lands or errors together (SQLite
reports each operation in autocommit). Schema operations join that batch
transaction and follow the same rule. A second deliberate difference: after a
failed webstorage load on OHOS the session's final save is skipped, so a
partially loaded state cannot overwrite the store.
On a HarmonyOS phone the two legs of the pref agree exactly. One signed HAP,
`storage_ohos_rdb_backend_enabled` flipped between runs, over the ten WPT
storage tests the backend touches: 1188 subtests pass and 37 fail on each
side, test for test, and the failures are the ones tests/wpt/meta already
expects. The stores confirm the switch rather than assuming it — with the pref
on the app writes only `rdb/reg.rdb` and `rdb/webstorage.rdb`, with it off only
`reg.sqlite` and `webstorage.sqlite`.
One RDB limitation is worth recording. Opening a second client_storage registry
fails (14800001 / 14800011) about two runs in three, on DAYU200 and a HarmonyOS phone
alike, when the process is not an application: `new_storage_threads` with no
`config_dir` falls back to `tempfile::tempdir()`, which outside an application
sandbox is `/data/local/tmp`. Neither half alone is enough — a single registry
under `/data/local/tmp` is reliable, and so are two registries inside the
application, which a phone confirmed over ten launches of the default
configuration and five of `--temporary-storage`, the latter being the same
two-registry shape that fails in a bare process. Servo always passes the
application's cache dir, so it never meets the condition;
`test_new_storage_threads_create_independent_groups`, which does, is ignored
when the RDB backend is compiled in.
The RDB copies of the IndexedDB and client-storage schemas are checked
against the SQLite ones by `tests/schema_parity.rs`, a host test that builds
both in an in-memory SQLite database and compares tables, columns, keys,
foreign keys and indexes, so an upstream schema change that is not mirrored
fails on the host instead of diverging on devices. The webstorage `data`
tables differ on purpose and are not compared.
Validation: Parallel twin of the sqlite backend — revalidate on every rebase even when it merges cleanly, since upstream storage changes never conflict with the RDB engine files. (1) `./mach check --ohos -- -p servo-storage --all-targets --features ohos-rdb-backend` must pass warning-free, as must the plain and the `--no-default-features --features ohos-rdb-backend` configurations; a new `AsyncOperation`/engine-trait variant fails here loudly and must be implemented in the RDB twins, not wildcarded. (2) Diff upstream changes since the previous base with `git log -p <old-base>..<new-base> -- components/storage` and mirror any sqlite-engine semantics changes into `engines/ohos_rdb.rs` / `webstorage/engines/ohos_rdb.rs` / `client_storage_ohos_rdb.rs`. (3) Host `./mach test-unit -p servo-storage` pins the sqlite reference behaviour. (4) On a device, run the same suite against both backends with `CARGO_TARGET_AARCH64_UNKNOWN_LINUX_OHOS_RUNNER=ohos-test-runner cargo nextest run -p servo-storage --target aarch64-unknown-linux-ohos [--no-default-features --features ohos-rdb-backend]` (raise nextest's slow-timeout: every test is pushed to the device), then the same-HAP A/B: build servoshell with `--features ohos-rdb-backend` (flavor and signing per the device: `harmonyos`/`hos` for a phone whose UDID is in the profile, default/OpenHarmony for the DAYU200), install it, and run `./mach test-wpt --ohos --release --no-headless --ohos-device <serial> --pref dom_indexeddb_enabled=true --pref storage_ohos_rdb_backend_enabled=<bool> --log-wptreport <leg>.json <subset>` (the `servo_ohos` wptrunner product of the `wpt-ohos` runner branch, cherry-picked onto the stack) once per pref value with `bm clean -n org.servo.servo -d` before each leg. Subset = all of `webstorage/` plus `IndexedDB/{idbobjectstore_put,idbobjectstore_get,idbobjectstore_delete,idbobjectstore_createIndex,idbindex_get,idbcursor_continue_objectstore,keypath,key_valid,transaction-abort-generator-revert,upgrade-transaction-lifecycle-committed,idbfactory_open,idbfactory_deleteDatabase}.any.{html,worker.html}` (78 tests). Compare the two wptreports subtest by subtest: no subtest may differ (crash/timeout-truncated tests are re-run in isolation on both legs), and the app data dir must contain only `*.rdb` stores after the true leg and only `*.sqlite` after the false leg (a lone `reg.rdb` from the runner's pref-less first launch and the HTTP cache's `cache.sqlite3` are expected). (5) Host `cargo nextest run -p servo-storage schema_parity` must pass; it fails when an upstream schema change is not mirrored into `indexeddb/engines/shared.rs` or `client_storage_shared.rs`. `./mach clippy --locked -- -- --deny warnings` must pass.
AI-assisted: Yes (agent session; implementation and on-device testing)
AI-assisted: Yes (agent session; 2026-08-29 rebase conflict resolution -- components/servo/Cargo.toml and components/storage/Cargo.toml resolved to the upstream side with only the fork's `ohos-rdb-backend` feature and optional-dependency markers re-added: upstream's `no-wgl = ["dep:mozangle", ...]` (servo#47198) is kept and `ohos-rdb-backend = ["storage/ohos-rdb-backend"]` re-added after it, and servo#43819 moved rusqlite's `bundled` feature onto the workspace dependency, so components/storage now carries only `rusqlite = { workspace = true, optional = true }`. Validation step (2): of the three upstream commits touching components/storage, only 7bea9ed (`ImmutableOrigin::ascii_serialization` now returns `Cow<'_, str>`) reaches the RDB twins, and it is a type change with no behaviour change; mirrored into `client_storage_shared.rs`, whose `create_a_storage_shelf` now hands the `Cow` to `push_text` by deref instead of the gone `as_str()`; `indexeddb/engines/shared.rs` already coerced, and no other twin site serializes an origin. fb04f8f touches only the Cargo.toml line above and 39f05ac only sqlite-side destructuring, so no semantics were mirrored into `engines/ohos_rdb.rs`, `webstorage/engines/ohos_rdb.rs` or `client_storage_ohos_rdb.rs`. Note: fb04f8f gave components/net an unconditional rusqlite dependency, so the 1.91 MiB saving quoted above for the RDB-only configuration no longer holds and needs remeasuring)
AI-assisted: Yes (agent session; 2026-10-08 sync -- conflict resolution in Cargo.toml, components/servo/Cargo.toml and components/storage/Cargo.toml: upstream's 0.7.0 versions with the fork's `default-features = false` re-added, upstream's new `multiprocess` default kept in servo's `default` and servoshell's `base` group, the fork's `[lints.rust]` table dropped for upstream's `[lints] workspace = true`; mirrored servo#47936 (index names unique per object store) into the RDB schema copy, adapted the tests to servo#48037's `GenericCallback::new`, added tests/schema_parity.rs and Validation step (5), updated step (4) for the current WPT runner, folded the clippy `duplicate_mod` squash commit; Cargo.lock regenerated from upstream's so that `cargo metadata --locked` passes at this commit)
AI-assisted: Yes (agent session; 2026-10-13 sync -- upstream servo#47255 added the default_tooling feature group: kept it in servo's default set and servoshell's base group next to the storage backend features)
AI-assisted: Yes (agent session; 2026-10-22 sync -- upstream servo#48934 and servo#49065 renamed servoshell's `default_without_allocator` group to `default_base` (which mach selects with `--no-default-features` for dummy-media builds) and moved jemalloc into it: `default_base` = `base` + `sqlite-backend`, and `base` takes upstream's list including `jemalloc`, so the RDB-only command above no longer names the allocator; servo's `default` merged next to upstream's blank line)
AI-assisted: Yes (agent session; 2026-11-09 sync -- the storage crate joins upstream's 0.8.0 workspace version block (servo#49467), keeping default-features = false; the sqlite-backend feature next to upstream's subtlecrypto (servo#48860))
Signed-off-by: Jonathan Schwender <[email protected]>
jschwe
added a commit
to openharmony-rs/servo-ohos
that referenced
this pull request
Nov 10, 2026
Nothing caches media in Servo apart from the backends' own buffers: every loop, seek back, replay, second element and reload downloads the resource again, and the media element manages each player's fetch, with its own backoff, suspension and restarts. Add the crate servo-media-cache, a process-wide cache that fetches media resources on behalf of their readers and keeps them in blocks of 64 KiB, as Gecko's MediaCache and Chromium's MultiBuffer do. A resource is identified by its URL, CORS mode and the origin of the document, is shared by every reader that opens it, and is reused for 300 s after its last reader is gone. Storage: a resource of known length up to 8 MiB keeps its blocks in memory, all of them together within 32 MiB, beyond which unused ones go first and then new ones use the file. Every other resource uses slots of one anonymous temporary file in the directory of the pref media_cache_directory, or the system temporary directory, so that its data is page cache that the kernel can reclaim. If the file cannot be created, read or written, blocks stay in memory within 32 MiB. When the budget is used up, the block whose next use is predicted latest goes first, as with Gecko's PredictNextUse; the read-ahead of the readers is protected, up to half of the budget, and blocks read for metadata go by their last use. Fetching: a resource has at most two fetches, started through a Fetcher that the media element implements, for the readers that still need them. The main fetch loads 30 s ahead of each reader at its rate, else 8 MiB, is suspended there and resumes below 10 s, else 2 MiB. A reader that only needs metadata loads 1 MiB ahead, and an idle one nothing. A read more than 1 MiB from every fetch starts a second fetch at its block, so that the probe of an index at the end of a file costs one small request; the last few read positions of a reader keep their fetches, but only the current one starts fetches. A fetch that reaches cached data stops unless the next missing byte is within 1 MiB. A declined suspension cancels a fetch with range support, which restarts at the first missing byte once it is needed, and so does a suspension that lasts 30 s; without range support, the fetch keeps loading within its share of the protected read-ahead, since a restart fetches the resource from its start again and discards what lies before the read. Requests after the first carry If-Range. Each response is verified as HTML's "verify a media response" asks: a CORS-cross-origin response from another origin than the earlier ones fails the load, and any CORS-cross-origin response taints the media data. A 200 to a range request with the same validator and length makes the resource sequential; a differing validator or length fails the readers with ResourceChanged instead of splicing two versions of the resource. A fetch that ends early is restarted where it stopped while it stores new data, and otherwise the readers fail with a network error; a 416 ends the resource. Reading: readers never block. A read returns the cached bytes at a position, or Pending, and the reader's waker is called once data is there. An observer hears of the metadata, progress at most every 350 ms, suspension, resumption and completion of the download, and of errors. The cache queues its calls of fetchers, wakers and observers, and the user objects it drops, under its lock, and one thread at a time makes them once the lock is released; file I/O also happens without the lock, on pinned slots. Time comes from a clock that tests replace. A reader that a player still holds can be closed, which detaches it as dropping it does and fails its later reads; a reader also tells whether the resource is tainted, before its metadata event arrives. New prefs set the directory, budgets and thresholds: media_cache_directory, media_cache_file_budget_mb (128 on OpenHarmony and Android, 512 elsewhere), media_cache_memory_resource_limit_kb, media_cache_memory_fallback_mb, media_cache_readahead_seconds, media_cache_resume_seconds, media_cache_suspend_seconds and media_cache_reuse_seconds. `./mach test-unit -p servo-media-cache` runs the tests of the crate. Players may read a reader directly through the new Player::set_data_source, which backends that cannot refuse with PlayerError::NotSupported. Fork note: meant for upstream. Drop once upstream has it. Testing: 54 unit tests with a fake fetcher and a fake clock, which cover sharing, suspension and resumption, gap and probe fetches, resources without range support or of unknown length, validators and 200s to range requests, origin verification and taint, recovery from early ends, 416, eviction, memory and file backing and their I/O errors, the reuse window, trimming, activities, wakers and observers called without the lock and dropped from inside callbacks, and readers on other threads, and closing a reader that a player holds. Validation: `./mach test-unit -p servo-media-cache` passes ten runs in a row; each of 22 deliberate breaks makes at least one test fail. Two independent reviews of the crate; their findings are fixed. `./mach check`, `cargo clippy -p servo-media-cache --tests` and `./mach fmt` pass. AI-assisted: Yes (agent session; implemented, reviewed, tested and mutation-checked by agents) AI-assisted: Yes (agent session; 2026-10-22 sync -- mechanical conflict resolution: the media cache prefs where upstream removed the `layout_unimplemented`, variable-fonts and writing-mode prefs (servo#48915)) AI-assisted: Yes (agent session; 2026-10-29 sync -- mechanical conflict resolution, no semantic change: the prefs next to upstream's `mathml_core_enabled` (servo#48631)) AI-assisted: Yes (agent session; 2026-11-09 sync -- the media cache crate joins upstream's 0.8.0 workspace version block (servo#49467), and Cargo.lock gives it that version) Signed-off-by: Jonathan Schwender <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Monthly release bump, produced by running ./mach release 0.8.0
Testing: Not required, just a version number bump.