Compare commits
136
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c8842355fb | ||
|
|
e9c888d8e8 | ||
|
|
c7c7285557 | ||
|
|
da503f254a | ||
|
|
43a3197d89 | ||
|
|
ce79a51417 | ||
|
|
d9c21dd67b | ||
|
|
64f76b2d94 | ||
|
|
808c8f8c97 | ||
|
|
a42d863e48 | ||
|
|
f62bf3f6dc | ||
|
|
eadf95b90a | ||
|
|
b81f1561c5 | ||
|
|
61d2ee29d5 | ||
|
|
882c0f3a0e | ||
|
|
dde60415d7 | ||
|
|
be60e4d7e4 | ||
|
|
8c2dcbf570 | ||
|
|
4fddee2d46 | ||
|
|
87f48c9b8a | ||
|
|
7d702fb188 | ||
|
|
42cbc45da2 | ||
|
|
97faaa84f2 | ||
|
|
e5cb8934a2 | ||
|
|
16abec2c09 | ||
|
|
742281ec3a | ||
|
|
c5e89a85d2 | ||
|
|
a8da4b117f | ||
|
|
4ba1cefcdd | ||
|
|
3378b8f3e2 | ||
|
|
07a03e41e9 | ||
|
|
22a098843a | ||
|
|
e76c63a6cb | ||
|
|
caae1ea0aa | ||
|
|
acb073dda7 | ||
|
|
081b3a1aa0 | ||
|
|
9460e8eb86 | ||
|
|
3abd710393 | ||
|
|
80034c9c84 | ||
|
|
820d88e8eb | ||
|
|
558a402fa9 | ||
|
|
2b3cbe0795 | ||
|
|
3dd1424a0a | ||
|
|
5847dfe87a | ||
|
|
622b6e82a7 | ||
|
|
4355274838 | ||
|
|
97f8663ec6 | ||
|
|
ce68aea668 | ||
|
|
dab71bd637 | ||
|
|
0c043d580e | ||
|
|
0421f95adf | ||
|
|
284a840ebe | ||
|
|
eb8b415635 | ||
|
|
e508c10e9d | ||
|
|
7a4e7c4d0a | ||
|
|
3824a2e03e | ||
|
|
fb5c3a403c | ||
|
|
eb2be0e88d | ||
|
|
621a396def | ||
|
|
2afb1cc349 | ||
|
|
b0dc24031c | ||
|
|
d87cc4e3b6 | ||
|
|
8eb28c2ada | ||
|
|
09eeb004d1 | ||
|
|
632490aa50 | ||
|
|
6c0cfdb610 | ||
|
|
9a98c0060b | ||
|
|
4b9e28a879 | ||
|
|
6383f21dbb | ||
|
|
6080c06bd9 | ||
|
|
ae947139d8 | ||
|
|
e1f1659776 | ||
|
|
02bd688896 | ||
|
|
c6dca80401 | ||
|
|
f03164e7e0 | ||
|
|
0236afb11d | ||
|
|
af932640b8 | ||
|
|
fd22249b65 | ||
|
|
c84c8c32a5 | ||
|
|
a5ad308e4a | ||
|
|
c30e07ee9f | ||
|
|
85cc5d10e6 | ||
|
|
7c23e4377d | ||
|
|
0418f37dbb | ||
|
|
0dc42b6380 | ||
|
|
f4381155bd | ||
|
|
bec6e5f835 | ||
|
|
d9dca5b498 | ||
|
|
469e1692a7 | ||
|
|
44a3eed971 | ||
|
|
77b192eba5 | ||
|
|
49e4e3a133 | ||
|
|
4a0bd76768 | ||
|
|
6de45423d1 | ||
|
|
20f8a43693 | ||
|
|
00d8154ef8 | ||
|
|
12d1cc7308 | ||
|
|
2e1b91b196 | ||
|
|
c11c04b30e | ||
|
|
29a5c7a516 | ||
|
|
00ad6d702f | ||
|
|
9fb0f20dbc | ||
|
|
254b2dce1d | ||
|
|
2ee9f100bf | ||
|
|
d5a50275ea | ||
|
|
b02c79f279 | ||
|
|
4a69d25254 | ||
|
|
7b783cf892 | ||
|
|
455f0cf0e1 | ||
|
|
655d99020a | ||
|
|
4b61bea3fa | ||
|
|
ffad787af9 | ||
|
|
cc3bce2f58 | ||
|
|
33940459f7 | ||
|
|
dc9ff53e78 | ||
|
|
4ad30e5079 | ||
|
|
e94863c79d | ||
|
|
151c314c05 | ||
|
|
8bbc41162b | ||
|
|
58fd0c8d93 | ||
|
|
edaf224417 | ||
|
|
07a55bfc85 | ||
|
|
1bac4b6f8b | ||
|
|
47dabed289 | ||
|
|
a1312941eb | ||
|
|
5b762bab65 | ||
|
|
920292760a | ||
|
|
0afe5737fa | ||
|
|
9a1501af7a | ||
|
|
fb56fde88d | ||
|
|
88d3f7a513 | ||
|
|
1504d95ed3 | ||
|
|
9927c974da | ||
|
|
632f023b8c | ||
|
|
0dd99b7638 | ||
|
|
0433b18aa7 |
No files matched your search
@@ -42,7 +42,7 @@ body:
|
||||
id: install_cmd
|
||||
attributes:
|
||||
label: How you installed
|
||||
placeholder: pip install invisible_playwright
|
||||
placeholder: uv add invisible-playwright
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# counters.yml - the daily snapshot of the launch counter, and the README badges.
|
||||
#
|
||||
# GitHub keeps only the running total of a release asset's downloads, so the
|
||||
# launches of a day exist only if someone records the total every day. This is
|
||||
# that someone: no machine and no personal token, just the scheduler and the
|
||||
# built-in GITHUB_TOKEN. A run that fails sends GitHub's failure mail, and the
|
||||
# run's log warns when a day between two snapshots is missing.
|
||||
#
|
||||
# Everything it writes lives on the `badges` branch, which is not protected:
|
||||
# counters/history.csv date,key,value - every counter, once a day
|
||||
# counters/launches_daily.csv day_utc,launches - one row per measured day
|
||||
# docs/badges/launches.svg, docs/badges/stars.svg
|
||||
#
|
||||
# 00:10 UTC, so the snapshot dated D closes calendar day D-1.
|
||||
name: counters
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "10 0 * * *"
|
||||
workflow_dispatch: {}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: counters
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
snapshot:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Check out the script (main)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
path: main
|
||||
|
||||
- name: Check out the badges branch
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: badges
|
||||
path: badges
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Self-test
|
||||
run: python main/scripts/launch_counters.py --selftest
|
||||
|
||||
- name: Record today's counters and redraw the badges
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: >
|
||||
python main/scripts/launch_counters.py
|
||||
--history badges/counters/history.csv
|
||||
--daily badges/counters/launches_daily.csv
|
||||
--badges badges/docs/badges
|
||||
|
||||
- name: Commit to the badges branch
|
||||
working-directory: badges
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name "feder-cr"
|
||||
git config user.email "85809106+feder-cr@users.noreply.github.com"
|
||||
git add counters docs/badges
|
||||
if git diff --cached --quiet; then
|
||||
echo "nothing changed"
|
||||
exit 0
|
||||
fi
|
||||
total=$(awk -F, '$2=="launches_total"{v=$3} END{print v}' counters/history.csv)
|
||||
git commit -q -m "counters: $(date -u +%F), browser launches at ${total}"
|
||||
git push origin HEAD:badges
|
||||
@@ -50,6 +50,14 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Engine and GeoIP downloads go through the release API with this token.
|
||||
# Anonymous requests share a 60-an-hour limit per runner address and are the
|
||||
# ones GitHub drops first when it is degraded (2026-11-08: timeouts for
|
||||
# unauthenticated users failed the gates three times). user-install.yml stays
|
||||
# anonymous on purpose: it is the user's path.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
hunt:
|
||||
name: hunt (${{ inputs.os }})
|
||||
|
||||
@@ -47,6 +47,14 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Engine and GeoIP downloads go through the release API with this token.
|
||||
# Anonymous requests share a 60-an-hour limit per runner address and are the
|
||||
# ones GitHub drops first when it is degraded (2026-11-08: timeouts for
|
||||
# unauthenticated users failed the gates three times). user-install.yml stays
|
||||
# anonymous on purpose: it is the user's path.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
# The install below resolves `invisible-core==N.M.0` from the package index,
|
||||
# and the core is published BEFORE this package. This gate answers whether it
|
||||
|
||||
@@ -28,6 +28,14 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# Engine and GeoIP downloads go through the release API with this token.
|
||||
# Anonymous requests share a 60-an-hour limit per runner address and are the
|
||||
# ones GitHub drops first when it is degraded (2026-11-08: timeouts for
|
||||
# unauthenticated users failed the gates three times). user-install.yml stays
|
||||
# anonymous on purpose: it is the user's path.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
# `pip install .` below resolves `invisible-core==N.M.0` from the package
|
||||
# index, and the core is published BEFORE this package. This gate answers
|
||||
|
||||
@@ -30,6 +30,26 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# One publish at a time per repository, whatever started it and on whatever
|
||||
# ref. Two runs of one tag (a delayed delivery, or a dispatch plus the push)
|
||||
# would both pass the already-published check before either had uploaded, and
|
||||
# both would upload. Keyed on the ref, a dispatch on a branch and a push of the
|
||||
# tag would not wait for each other, so the group is the workflow alone.
|
||||
# Serialised, the second run waits for the first and then finds the version on
|
||||
# the index, so it ends as a no-op. Never cancelled in progress: an upload that
|
||||
# has started must be allowed to finish.
|
||||
concurrency:
|
||||
group: publish
|
||||
cancel-in-progress: false
|
||||
|
||||
# Engine and GeoIP downloads go through the release API with this token.
|
||||
# Anonymous requests share a 60-an-hour limit per runner address and are the
|
||||
# ones GitHub drops first when it is degraded (2026-11-08: timeouts for
|
||||
# unauthenticated users failed the gates three times). user-install.yml stays
|
||||
# anonymous on purpose: it is the user's path.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
# Asked of the INDEX, first, because a tag can legitimately name a version that
|
||||
# is already published: a tag backfilled for a hand-published release, a tag
|
||||
@@ -153,6 +173,19 @@ jobs:
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e ".[dev]"
|
||||
|
||||
- name: version gate
|
||||
# The version and the ledger against what the index serves, as the
|
||||
# pre-push hook checks them: in layers, not as alternatives, because the
|
||||
# hook is per clone and can be missing or skipped, and this cannot
|
||||
# ([B353]). Exit codes: 0 pass, 1 refused, 2 gate broken, 4 no usable
|
||||
# ledger; only 0 continues. The check builds the package to compare
|
||||
# it, without isolation, so the build backend is installed here: the
|
||||
# dev extra carries `build` and not `hatchling`, and without it the
|
||||
# check stopped as "gate broken" on the first tag (v0.40.0).
|
||||
run: |
|
||||
python -m pip install build hatchling
|
||||
python -m invisible_core.release check --verify-index
|
||||
|
||||
- name: arm the pre-push gates
|
||||
# The suite asserts core.hooksPath is set and a fresh checkout has none.
|
||||
run: python scripts/install_hooks.py
|
||||
|
||||
@@ -19,6 +19,14 @@ concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# Engine and GeoIP downloads go through the release API with this token.
|
||||
# Anonymous requests share a 60-an-hour limit per runner address and are the
|
||||
# ones GitHub drops first when it is degraded (2026-11-08: timeouts for
|
||||
# unauthenticated users failed the gates three times). user-install.yml stays
|
||||
# anonymous on purpose: it is the user's path.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
# The gate was written FOR this repository on 2026-08-27, after 549 lines of
|
||||
# Italian shipped here in one subsystem and 852 more were found in 33 files
|
||||
@@ -86,6 +94,57 @@ jobs:
|
||||
python -m invisible_core.claims --selftest
|
||||
python -m invisible_core.claims
|
||||
|
||||
# The way in is uv (the owner, 2026-09-06 and "uv everywhere" on 2026-10-17),
|
||||
# and on that day this repository still taught pip in its README, its
|
||||
# CONTRIBUTING, its docs and the messages its code prints, with nothing
|
||||
# comparing any of them with the decision. `invisible_core.way_in` since core
|
||||
# 49.45.0 refuses an install instruction that is not uv, in the tracked
|
||||
# Markdown, the issue templates and the string literals of src/.
|
||||
way-in:
|
||||
name: every install instruction is uv
|
||||
needs: core-on-index
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: install the pinned core, which carries the gate
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
- name: check the way in
|
||||
# --selftest first: a check that has only ever printed "clean" may
|
||||
# have gone blind.
|
||||
run: |
|
||||
python -m invisible_core.way_in --selftest
|
||||
python -m invisible_core.way_in
|
||||
|
||||
# The user-install job installs what was published, as a user would. It ran
|
||||
# on `release: published`, which never fires: the Release is created with
|
||||
# GITHUB_TOKEN, and an event that token causes starts no other workflow
|
||||
# ([B347], core 50.48.0). `invisible_core.install_job` judges this tree: the
|
||||
# job runs on the ledger pull request, its wait for the index is scoped to it
|
||||
# and bounded, and every test file it runs keeps out, in a `_LEAKS`, every
|
||||
# variable the pinned core's library reads.
|
||||
install-job:
|
||||
name: the user-install job runs on the ledger pull request
|
||||
needs: core-on-index
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- name: install the pinned core, which carries the gate
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -e .
|
||||
- name: check the install job
|
||||
run: |
|
||||
python -m invisible_core.install_job --selftest
|
||||
python -m invisible_core.install_job
|
||||
|
||||
# `pip install -e ".[dev]"` below resolves `invisible-core==N.M.0` from the
|
||||
# package index. The core is published BEFORE this package, so between the
|
||||
# first push of this repo and that upload there is a window in which no
|
||||
@@ -266,7 +325,7 @@ jobs:
|
||||
# exits 1 without saying which of five inputs went red is a gate somebody has
|
||||
# to open five tabs to read.
|
||||
gate:
|
||||
needs: [core-on-index, unit, docs-api, english, claims, version]
|
||||
needs: [core-on-index, unit, docs-api, english, claims, version, way-in, install-job]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -277,7 +336,9 @@ jobs:
|
||||
echo "docs-api: ${{ needs.docs-api.result }}"
|
||||
echo "english: ${{ needs.english.result }}"
|
||||
echo "claims: ${{ needs.claims.result }}"
|
||||
echo "way-in: ${{ needs.way-in.result }}"
|
||||
echo "version: ${{ needs.version.result }}"
|
||||
echo "install-job: ${{ needs.install-job.result }}"
|
||||
case "${{ needs.unit.result }}" in
|
||||
failure|cancelled) echo "the suite did not pass"; exit 1 ;;
|
||||
esac
|
||||
@@ -293,9 +354,15 @@ jobs:
|
||||
case "${{ needs.claims.result }}" in
|
||||
failure|cancelled) echo "the README promises what no measurement supports"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.way-in.result }}" in
|
||||
failure|cancelled) echo "an install instruction is not uv"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.version.result }}" in
|
||||
failure|cancelled) echo "the version this change proposes is already taken"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.install-job.result }}" in
|
||||
failure|cancelled) echo "the user-install job would not run on a release, or leaks"; exit 1 ;;
|
||||
esac
|
||||
echo "ok"
|
||||
|
||||
# Measured 2026-09-04: 0.10.0 was on the index while main sat on 0.10.0 with
|
||||
|
||||
@@ -15,12 +15,16 @@
|
||||
# * installing a blessed `playwright==<pin>` afterwards REPAIRS the venv. If
|
||||
# the declared range resolves to a client the shipped Juggler cannot speak,
|
||||
# that manual line turns the job green while every fresh install is broken.
|
||||
# What a user gets is what pip resolves from the declaration, and that is
|
||||
# what has to be under test.
|
||||
# What a user gets is what the installer resolves from the declaration,
|
||||
# and that is what has to be under test.
|
||||
#
|
||||
# So this workflow installs nothing from the checkout except the test files. It
|
||||
# takes `pip install invisible-playwright` from the index, in an empty venv, and
|
||||
# runs it the way somebody's first script would.
|
||||
# So this workflow installs nothing from the checkout except the test files.
|
||||
# test_release_e2e.py runs the README's install block for the runner's system
|
||||
# as written - uv from its own installer, `uv init`, `uv add
|
||||
# invisible-playwright` from the index, `fetch` - and then drives the browser
|
||||
# from the project it made, the way somebody's first script would.
|
||||
# test_upgrade_e2e.py stays on pip on purpose: it is the path of the people who
|
||||
# installed before the README said uv, and they are still there.
|
||||
#
|
||||
# WHY IT MUST NOT BE MADE TOLERANT.
|
||||
# There is a real window in which this cannot pass: between publishing the core
|
||||
@@ -54,8 +58,16 @@ on:
|
||||
# here, so a run triggered only by pushes would never see them. Weekly is
|
||||
# enough to catch that drift without adding a Windows job to the queue daily.
|
||||
- cron: "17 6 * * 1"
|
||||
release:
|
||||
types: [published]
|
||||
# ⛔ THE LEDGER PULL REQUEST, not `release: published` ([B347], core
|
||||
# 50.48.0). The Release is created by the publish workflow with GITHUB_TOKEN,
|
||||
# and an event that token causes starts no other workflow: on `release:` this
|
||||
# job had never run at release time. The ledger PR exists only after the
|
||||
# upload and `record`, and merging it waits for this run, so a release does
|
||||
# not close before what it published installs. `python -m
|
||||
# invisible_core.install_job` checks the wiring (tests.yml).
|
||||
pull_request:
|
||||
paths:
|
||||
- PUBLISHED.json
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -88,7 +100,8 @@ jobs:
|
||||
run: python -m pip install --upgrade pip pytest packaging
|
||||
|
||||
# PyPI does not serve a new version to pip the instant twine finishes, and
|
||||
# this workflow runs on `release:` - which fires seconds after the upload.
|
||||
# this workflow runs on the ledger pull request, which the publish run
|
||||
# opens seconds after the upload (it ran on `release:`, just as soon).
|
||||
# MEASURED 2026-07-28: invisible-firefox 0.2.6 was uploaded, the release was
|
||||
# created about forty seconds later, and the pip install below still resolved
|
||||
# 0.2.5. The job reported a forgotten publish that had happened two minutes
|
||||
@@ -99,10 +112,11 @@ jobs:
|
||||
# PER-VERSION endpoint is the authority; the aggregate `info.version` lags it
|
||||
# by minutes and has its own trap, so this asks for the exact URL.
|
||||
#
|
||||
# Only on `release:`. A scheduled or dispatched run is not racing anything,
|
||||
# and a wait there would hide a real absence behind five minutes of polling.
|
||||
# Only on the ledger pull request. A scheduled or dispatched run is not
|
||||
# racing anything, and a wait there would hide a real absence behind five
|
||||
# minutes of polling.
|
||||
- name: wait for the index to serve this version
|
||||
if: github.event_name == 'release'
|
||||
if: github.event_name == 'pull_request'
|
||||
shell: bash
|
||||
run: |
|
||||
python - <<'PY'
|
||||
|
||||
@@ -22,6 +22,14 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# Engine and GeoIP downloads go through the release API with this token.
|
||||
# Anonymous requests share a 60-an-hour limit per runner address and are the
|
||||
# ones GitHub drops first when it is degraded (2026-11-08: timeouts for
|
||||
# unauthenticated users failed the gates three times). user-install.yml stays
|
||||
# anonymous on purpose: it is the user's path.
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
# `pip install -e ".[dev]"` below resolves `invisible-core==N.M.0` from the
|
||||
# package index, and the core is published BEFORE this package. This gate
|
||||
|
||||
+434
@@ -6,6 +6,440 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.47.1] - 2026-11-08
|
||||
|
||||
### Changed
|
||||
- invisible-core 58.56.0, which this version pins. A persona has the keyboards
|
||||
Windows installs with its language and country, read from Windows'
|
||||
locale.nls (English US besides Persian, Azerbaijani, Bashkir, Cherokee and
|
||||
Sakha; Russian besides Belarusian, Tatar and Armenian; Hindi Traditional for
|
||||
Hindi), and switches as a user does: left Alt + Shift to the next language,
|
||||
Ctrl + Shift to the next keyboard of the same language. The keyboard pref
|
||||
carries Windows' own form (LANGID:KLID joined by semicolons).
|
||||
|
||||
## [0.47.0] - 2026-11-08
|
||||
|
||||
### Changed
|
||||
- Engine firefox-58 (Firefox 159.0), through invisible-core 58.55.0, which
|
||||
this version pins.
|
||||
- A persona has the keyboards Windows installs with its language: the
|
||||
language's, and the second one (English US with Russian, Greek, Arabic,
|
||||
Hebrew and most languages not written in Latin letters). A character the
|
||||
active keyboard lacks is typed on the other one, after left Alt + left
|
||||
Shift, Windows' default switch; `press("x")` on a Russian or Greek session
|
||||
no longer raises "unknown key". Only a character no keyboard has is inserted
|
||||
as text.
|
||||
- `scroll_into_view_if_needed()` is the engine's own scroll, only when needed.
|
||||
|
||||
### Fixed
|
||||
- In the engine: a navigation Firefox refuses before any channel (a
|
||||
restricted port) ends with its error instead of never; a request held by
|
||||
`route()` that the page cancels is no longer held; `unroute` with a request
|
||||
that can no longer be resumed no longer fails; a session cookie set with
|
||||
`expires: -1` is kept, `sameSite: "None"` is SameSite=None, and a cookie
|
||||
Firefox refuses fails `add_cookies()` with Firefox's reason.
|
||||
|
||||
## [0.46.4] - 2026-11-08
|
||||
|
||||
### Fixed
|
||||
- The engine and the GeoIP database install when GitHub's direct release
|
||||
links fail. Through invisible-core 57.54.0, which this version pins: each
|
||||
release file is fetched from the API route first and from the direct link
|
||||
second, and one download attempt tries both, so a 504 on one route is
|
||||
served by the other at once. On 2026-11-08 every direct link answered 504
|
||||
while the API route served the same files.
|
||||
|
||||
## [0.46.3] - 2026-11-08
|
||||
|
||||
### Changed
|
||||
- Engine firefox-57 (Firefox 159.0), through invisible-core 57.53.0, which
|
||||
this version pins. The WebGL extensions a page sees are decided once, by
|
||||
the engine's WebGL host, from the persona's declared list: the content
|
||||
process no longer has a list of its own, an extension the host's GPU
|
||||
cannot serve is never created (its calls stay harmless), and
|
||||
`getSupportedExtensions()` lists them in Firefox's own order, the only
|
||||
order a retail Firefox gives (the WebGL 1 list had `EXT_sRGB` before
|
||||
`EXT_shader_texture_lod`).
|
||||
|
||||
## [0.46.2] - 2026-11-07
|
||||
|
||||
### Changed
|
||||
- The persona types on the keyboard a Windows install gives its language in
|
||||
its country, for every language: German in Switzerland on the Swiss
|
||||
keyboard, Dutch on US-International, Polish, Czech, Turkish, Greek, Hebrew,
|
||||
Arabic and the rest on their own keyboards; a language Windows has no
|
||||
profile for takes the keyboard of the country's main language; Japanese and
|
||||
Korean type on the keyboard under the IME. The session passes its country to
|
||||
the server, which only had the language list before. The tables come from
|
||||
invisible-core 56.53.0, which this version pins, read from the bytes of the
|
||||
Windows layout files rather than from the machine.
|
||||
|
||||
## [0.46.1] - 2026-11-07
|
||||
|
||||
### Fixed
|
||||
- The typing rhythm uses the hand of the key on the persona's keyboard, through
|
||||
invisible-core 56.52.0, which this version pins: on a German keyboard `z`
|
||||
was counted as a left-hand key and an Italian `ò` had no hand, so the
|
||||
same-hand and alternate-hand timings were applied to the wrong pairs. The
|
||||
US keyboard is unchanged.
|
||||
- The pyproject comment on the dependencies names the server that exists
|
||||
(`_juggler/`), not a Node driver (`tests/test_pyproject_names_real_paths.py`).
|
||||
|
||||
## [0.46.0] - 2026-11-07
|
||||
|
||||
### Changed
|
||||
- Engine firefox-56 (Firefox 159.0), through invisible-core 56.51.0. A WebGL
|
||||
extension the persona declares can now be called without killing the
|
||||
browser: the host serves every declared extension wherever its GL can, and
|
||||
an entry point whose extension is off returns instead of asserting. Until
|
||||
now one `provokingVertexWEBGL()` call on Linux took the main process down,
|
||||
one page in 5,000 (`tests/test_a_declared_webgl_extension_survives_its_use_e2e.py`).
|
||||
- The persona types on the keyboard of its language. The server reads the
|
||||
language the launcher decided for the session (`intl.accept_languages`) and
|
||||
hands the matching layout to every page's hands: Italian, German, French,
|
||||
Spanish, Brazilian (ABNT2) and British keyboards, read from the layouts
|
||||
Windows ships, with Firefox's own `keyCode`s on Windows; everything else
|
||||
stays on the US keyboard. Until now every persona typed on one US table with
|
||||
Chromium's key codes: an Italian persona typed `ò` with no key event at all
|
||||
and `@` as Shift+Digit2, and every persona sent 186/187/189 for `;`/`=`/`-`
|
||||
where Firefox sends 59/61/173. The tables and the keyboard live in
|
||||
invisible-core 56.51.0, which this version pins
|
||||
(`tests/test_the_keyboard_follows_the_session_language.py`).
|
||||
- A dialog (`alert`, `confirm`, `prompt`) is answered after the pause a
|
||||
reader takes, counted from the moment it opened: a reaction part and a
|
||||
reading part that grows with the words, both drawn from the session's seed
|
||||
and clamped, one draw per dialog. Until now `Page.handleDialog` left in the
|
||||
same millisecond `Page.dialogOpened` arrived, whether the client dismissed
|
||||
the dialog itself (no handler) or a handler called `accept()`; a page timing
|
||||
`alert()`'s return saw single-digit milliseconds. Only the remainder is
|
||||
waited, so a handler that took its time is not made slower, and a session
|
||||
with no seed (humanising off) answers at once as before
|
||||
(`_juggler/dialogs.py`, `tests/test_a_dialog_is_answered_after_a_pause.py`).
|
||||
|
||||
### Removed
|
||||
- Linux arm64 is no longer supported from firefox-56: no engine is built for
|
||||
it. firefox-55 is the last engine with a Linux arm64 build. The engines are
|
||||
Linux x86_64 and Windows x86_64; Windows on ARM64 still runs the x86_64
|
||||
engine.
|
||||
- `scripts/ci_font_gate.py` and its test. The host gate
|
||||
(`scripts/ci_host_gate.py`) asks the general question, whether anything a
|
||||
page reads comes from the host, and it covers the font list. It ran green
|
||||
on the firefox-55 release, which was the condition for removing the font
|
||||
gate.
|
||||
|
||||
## [0.45.0] - 2026-11-04
|
||||
|
||||
The pin moves to invisible-core 55.50.0, which brings the firefox-55 engine.
|
||||
Firefox is still 159.0.
|
||||
|
||||
### Changed
|
||||
- What a page reads about the graphics card is the identity's, on every host.
|
||||
Each identity now stands for one real Windows 11 GPU, and Firefox's
|
||||
graphics blocklist answers as Firefox 159 for Windows answers on that GPU.
|
||||
A host whose adapter Firefox would block (a virtual machine, a CI runner)
|
||||
no longer turns WebGL2 or antialiasing off.
|
||||
- `navigator.gpu.requestAdapter()` returns the adapter of Firefox 159 for
|
||||
Windows on every identity, with the same features and limits, also on hosts
|
||||
without a GPU.
|
||||
- Text is measured and drawn the same way on every OS (the Windows
|
||||
DirectWrite implementation): on Linux, text metrics and rendering are those
|
||||
of Windows.
|
||||
- A 2D canvas is drawn on the CPU on every host, so its pixels no longer
|
||||
depend on the host GPU.
|
||||
- WebRTC video encoding support is the same as Firefox 159 for Windows,
|
||||
whatever encoders the host has.
|
||||
- A new profile opens straight on the page: the first-run terms-of-use dialog
|
||||
of Firefox no longer covers it and the page has focus and input at once.
|
||||
- Fullscreen follows the identity's screen.
|
||||
- 17 seeds in 1500 get a different GPU: the identities that drew a
|
||||
Direct3D 10 class card (which has no Windows 11 driver) now draw a current
|
||||
GeForce card.
|
||||
|
||||
### Fixed
|
||||
- `getParameter` answers state the page has set (depth function, stencil,
|
||||
blend, pixel store, draw buffers) from the live context instead of its
|
||||
initial value; the stencil masks are 4294967295 as on Firefox 159.
|
||||
- `getParameter(MAX_VIEWS_OVR)` answers 4 wherever `OVR_multiview2` is
|
||||
offered, instead of the host's value.
|
||||
- The CSS system colour `-moz-dialog` is white, as on Firefox 159.
|
||||
|
||||
### Tests
|
||||
- The host gate: what a page reads at a given seed is compared between
|
||||
Windows and Linux hosts and with official Firefox 159, including the
|
||||
window in fullscreen and back.
|
||||
|
||||
### Known issues
|
||||
- On Linux arm64 `navigator.gpu.requestAdapter()` returns null.
|
||||
- On Linux `maxBindingsPerBindGroup` differs from Firefox 159 for Windows.
|
||||
|
||||
## [0.44.1] - 2026-10-31
|
||||
|
||||
The pin moves to invisible-core 54.49.0. The engine is the same firefox-54
|
||||
(Firefox 159.0).
|
||||
|
||||
### Fixed
|
||||
- `navigator.mediaCapabilities.decodingInfo({type: "webrtc"})` no longer
|
||||
reports the host GPU's hardware decoding for VP8, VP9 and AV1. The answer is
|
||||
now the same as Firefox 159 on Windows, on Windows and Linux alike. AV1
|
||||
follows the identity's AV1 setting.
|
||||
|
||||
## [0.44.0] - 2026-10-31
|
||||
|
||||
The pin moves to invisible-core 54.48.0, which brings the firefox-54 engine:
|
||||
Firefox 159.0.
|
||||
|
||||
### Changed
|
||||
- invisible-core 53.48.0 -> 54.48.0, sealed to the firefox-54 engine (Firefox
|
||||
159.0). Every identity reports what Firefox 159 reports: its User-Agent, its
|
||||
WebGL extensions and its branding.
|
||||
- A click on an element that is already in full view no longer scrolls the
|
||||
page. The element is brought to the centre only when part of it is outside
|
||||
the viewport, as Chromium's scrollIntoViewIfNeeded does.
|
||||
|
||||
### Fixed
|
||||
- Downloads reach Playwright: `page.expect_download()`, `Download.save_as()`,
|
||||
`path()`, `failure()`, `delete()` and `cancel()` work, and a `goto` that ends
|
||||
in a download fails with "Download is starting" instead of hanging until its
|
||||
timeout. Contexts created with `accept_downloads=False` cancel downloads.
|
||||
- `BrowserContext.set_offline()` works instead of being refused: an offline
|
||||
context loads nothing and reports `navigator.onLine === false`.
|
||||
|
||||
### Tests
|
||||
- e2e: a clicked download and a navigation that ends in a download.
|
||||
- e2e: no scroll for an element in full view, also inside a same-origin frame;
|
||||
an element below the fold is centred.
|
||||
- e2e: set_offline stops loads and set_offline(False) resumes them.
|
||||
|
||||
## [0.43.0] - 2026-10-24
|
||||
|
||||
The pin moves to invisible-core 53.48.0, which brings the firefox-53 engine.
|
||||
|
||||
### Fixed
|
||||
- After a page that runs in a content process of its own (served with
|
||||
Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy, as challenge
|
||||
pages are) sends itself to a page that does not, locators, `inner_text` and
|
||||
`query_selector` no longer fail for good with "Cannot find object with id"
|
||||
when a read was made on the first page. The engine's context ids are now
|
||||
unique for the session, and an element handle kept across such a move can no
|
||||
longer reach a different node.
|
||||
|
||||
### Changed
|
||||
- The exposed fonts are the set of a clean Windows: Leelawadee, Microsoft
|
||||
Uighur, Wingdings 2 and Wingdings 3, which such a machine does not have, are
|
||||
no longer exposed (67 families).
|
||||
|
||||
### Tests
|
||||
- e2e: reads on an isolated page, then on the page it sends itself to.
|
||||
- The font gate checks that the engine's own manifest declares exactly the
|
||||
canonical families, none more and none less.
|
||||
|
||||
## [0.42.0] - 2026-10-24
|
||||
|
||||
The pin moves to invisible-core 52.48.0, which brings the firefox-52 engine.
|
||||
|
||||
### Changed
|
||||
- invisible-core 51.48.0 -> 52.48.0, sealed to the firefox-52 engine (Firefox
|
||||
151.0). A 2D canvas, on the page or offscreen, now reads back exactly as it
|
||||
was drawn, as on retail Firefox: the canvas noise is applied to WebGL and
|
||||
WebGPU readback only, which is unchanged.
|
||||
- A `toDataURL`/`toBlob` PNG carries the per-session `deBG` chunk retail
|
||||
Firefox 151 writes after IDAT; the pixels are untouched.
|
||||
- 1920x1080 panels are drawn at 125% and 150% as often as the Windows fleet
|
||||
is, so more seeds report a display scale above 1 (core).
|
||||
- ClearType gamma and contrast are a declared persona field. Every seed keeps
|
||||
the untuned machine's values today.
|
||||
|
||||
### Tests
|
||||
- e2e: a 2D canvas reads back as drawn on a page canvas and on an
|
||||
OffscreenCanvas, and screenshots follow the persona's display scale.
|
||||
|
||||
## [0.41.0] - 2026-10-21
|
||||
|
||||
The pin moves to invisible-core 51.48.0, which brings the firefox-51 engine.
|
||||
|
||||
### Changed
|
||||
- invisible-core 50.48.0 -> 51.48.0, sealed to the firefox-51 engine (Firefox
|
||||
151.0). The canvas noise now spares two-colour blends (`edge_tolerance`
|
||||
replaces `edge_step` in the core).
|
||||
|
||||
### Added
|
||||
- `font.system_text_quality` is documented on the pinning page. It was already
|
||||
pinnable (0 none, 4 standard antialiasing, 5 ClearType; default 5) and
|
||||
documented nowhere.
|
||||
|
||||
## [0.40.0] - 2026-10-19
|
||||
|
||||
The pin moves to invisible-core 50.48.0, on the same firefox-50 engine.
|
||||
|
||||
### Fixed
|
||||
- **`expect()` works for every condition, not two families.** The server
|
||||
re-wrote Playwright's assertions in Python one condition at a time and had
|
||||
written `to_have_count` and the `to_be_*` states; `to_have_text`,
|
||||
`to_contain_text`, `to_have_value`, `to_have_values`, `to_have_attribute`,
|
||||
`to_have_class`, `to_contain_class`, `to_have_css`, `to_have_id`,
|
||||
`to_have_js_property`, `to_be_focused`, `to_be_empty`, `to_be_in_viewport`,
|
||||
`to_have_title`, `to_have_url` and the accessibility ones answered "is not
|
||||
implemented yet". Each reading is now Playwright's own `expect`, from the
|
||||
injected script this package already ships, called the way Playwright's
|
||||
server calls it: strict mode, `element(s) not found`, and a JavaScript error
|
||||
that ends the wait with its message. On Playwright's own suite, its expect
|
||||
tests on firefox-49 went from 30 of 94 passing to 75, with none lost.
|
||||
- `to_have_js_property` with an object, an array or a date as the expected
|
||||
value is refused by name: the page's value lives in another realm, and
|
||||
comparing it would always report a difference. Primitives are compared.
|
||||
`to_match_aria_snapshot` is refused by name too: its template is YAML that
|
||||
Playwright's server parses, and this one has no parser for it.
|
||||
- A failed `expect` reports an object as the object. The client read the value
|
||||
the server sent twice, the second time as if it were still in its wire form,
|
||||
so `{"a": 1}` failed with `KeyError: 'id'` instead of the assertion's message,
|
||||
and `{"v": "x"}` or `{"n": 5}` were reported as `x` and `5`. The vendored
|
||||
client had the two reads from Playwright 1.61.0, which still has them; the
|
||||
second one is gone.
|
||||
- A failed `expect` prints its call log, as Playwright's does: the assertion
|
||||
and its timeout (`Expect "to_be_visible" with timeout 5000ms`), what it
|
||||
waited for (`waiting for locator("#a1")`), and what each reading found
|
||||
(`locator resolved to <input/>`, `unexpected value "Go"`). The message said
|
||||
what was expected and what was seen, and nothing of the wait in between.
|
||||
- `page.goto` follows the context's `base_url`. The server never read it, so
|
||||
`goto("/empty.html")` in a context created with a base failed with
|
||||
"Invalid url /empty.html"; it now navigates to the base's `/empty.html`, as
|
||||
Playwright does. The address is resolved by the engine's own URL parser,
|
||||
the one that then navigates to it.
|
||||
- `page.evaluate`, `evaluate_handle`, `wait_for_function` and the
|
||||
element-scoped evaluations run the caller's text as a script, as Playwright
|
||||
does. The server put it inside an expression so that it could call the
|
||||
result in the same pass, so a statement with its semicolon,
|
||||
`setTimeout(() => {...}, 2000);`, died with "missing ) in parenthetical".
|
||||
The text is now evaluated on its own and a function it produces is called
|
||||
with the argument, and the page sees the caller's code without anything
|
||||
around it. `wait_for_function` evaluates a function predicate once per
|
||||
document and calls it on every turn, as Playwright's poll does.
|
||||
|
||||
### Changed
|
||||
- **The user-install job runs on the ledger pull request**, not on
|
||||
`release: published`, which never fired: the Release is created with
|
||||
GITHUB_TOKEN, and an event that token causes starts no other workflow.
|
||||
CI checks the wiring with `python -m invisible_core.install_job`.
|
||||
- The release tests keep out of the venvs they build every variable the
|
||||
core's library reads, as `invisible_core.install_job.LEAKS` lists them: an
|
||||
engine folder, a seal file or a GitHub token in the caller's shell no
|
||||
longer changes what they measure.
|
||||
- The publish workflow checks the version and the ledger against the index
|
||||
before it uploads (`invisible_core.release check --verify-index`), as the
|
||||
pre-push hook does: a clone without the hook can no longer skip it.
|
||||
- **The vendored client's README says what actually differs from upstream.**
|
||||
`_pw/README.md` named `_impl/_driver.py`, a file removed with the Node driver,
|
||||
as the only changed file, while eight files carry the
|
||||
`# MODIFIED by invisible_playwright` marker; it now lists them, in English.
|
||||
- **`_pw/` is no longer excluded from the English gate.** The upstream code is
|
||||
English already, so the folder exclusion only hid our own text: the README
|
||||
and the error raised for `chromium` and `webkit`, now in English.
|
||||
- `THIRD_PARTY_FORK.md` gives the vendored client's version as 1.61.0, which is
|
||||
what `_pw/_repo_version.py` and the development pin say.
|
||||
|
||||
## [0.39.0] - 2026-10-18
|
||||
|
||||
The pin moves to invisible-core 50.47.0, on the firefox-50 engine. From
|
||||
firefox-50 every realm, worker and worklet takes the session's zone from the
|
||||
engine's own override, so the launch no longer writes `TZ` into the browser's
|
||||
environment. On Windows no `TZ` could satisfy both the C runtime and ICU, so
|
||||
some zones showed the machine's time inside a Worker, and zones outside a
|
||||
ten-row table were never covered; that is gone with it.
|
||||
|
||||
### Changed
|
||||
- The IANA-to-POSIX conversion is no longer imported or used. Code that took
|
||||
`IANA_TO_POSIX_TZ` from the core has to stop: the core 50.47.0 removes it.
|
||||
|
||||
## [0.38.0] - 2026-10-18
|
||||
|
||||
The pin moves to invisible-core 49.46.0. The desktop settings a page can read -
|
||||
scrollbars, text scale, drag threshold, double-click selection, the system
|
||||
colours in both schemes, the refresh rate, the form-control font and more -
|
||||
are declared by the persona instead of read from the machine it runs on, and
|
||||
each of them can be pinned ([pinning](docs/pinning.md)).
|
||||
|
||||
### Changed
|
||||
- **The way in is uv.** The README installs with one complete block per
|
||||
system: uv from its own installer, `uv init --python ">=3.11" my-project`,
|
||||
`uv add invisible-playwright`, `uv run invisible-playwright fetch`.
|
||||
CONTRIBUTING, the guides and the issue template teach the same, and CI
|
||||
refuses an install instruction that is not uv
|
||||
(`python -m invisible_core.way_in`, core 49.45.0).
|
||||
- **A remedy this package prints is the command for your environment.** In a
|
||||
venv uv made, which has no pip, a broken install was told to run
|
||||
`pip install --force-reinstall invisible-playwright`; it is now told the uv
|
||||
command, and an environment pip made is still told pip, through its own
|
||||
interpreter.
|
||||
|
||||
### Fixed
|
||||
- The Docker guide's base image has a Python older than this package needs,
|
||||
and the arm64 guide's Debian image an externally managed one, so neither
|
||||
install line could work: uv now brings the interpreter. The installation
|
||||
guide no longer lists macOS, which has had no engine since 2026-08-26.
|
||||
|
||||
## [0.37.0] - 2026-10-17
|
||||
|
||||
The pin moves to invisible-core 49.44.0, on the firefox-49 engine.
|
||||
|
||||
### Changed
|
||||
- **Your code runs in a world of its own, where a page that replaced a
|
||||
standard API cannot count your calls.** `evaluate`, `evaluate_handle`,
|
||||
`wait_for_function`, `eval_on_selector(_all)`, `locator.evaluate`,
|
||||
`handle.evaluate` and `set_content` ran in the page's own realm, so a
|
||||
call to `document.querySelector` went through whatever the page had
|
||||
put in its place: a Cloudflare challenge wraps it, and one lookup of
|
||||
its token field from an evaluate got the clearance refused. They now
|
||||
run in a world with the page's principal where a name the standard
|
||||
defines is the native one, and every other name is the page's:
|
||||
`window.__NEXT_DATA__`, a node's `__vue__` and the page's functions
|
||||
answer as before.
|
||||
On what the page created (its classes, their instances, its plain objects)
|
||||
the page's definitions win, `toString` and `valueOf` included, and an
|
||||
object your code hands to the page keeps its identity and looks to the
|
||||
page like its own (`instanceof Array` holds, its `constructor` is the
|
||||
page's). What changes, and it is declared rather than accidental: a name
|
||||
the standard defines for one of the browser's own objects wins even where
|
||||
the page redefined it on that object itself (a setter the page put on one
|
||||
input's `value` does not run; `.wrappedJSObject` gives the page's own
|
||||
view); a bare assignment to an undeclared name creates a global of your
|
||||
world, not of the page (`window.x = 1` still reaches the page); and your
|
||||
code's own `eval` is not governed by the page's Content-Security-Policy,
|
||||
which governs the page's (`window.eval`) as before. Needs firefox-49.
|
||||
- **`request.post_data` holds the body with no route as well.** Until
|
||||
firefox-48 the engine read a request's body only while a route was set, so
|
||||
every POST of a page with no route answered `None`, like a form sent empty.
|
||||
It now reads every body up to 10 MB, as Playwright's does, and the upload
|
||||
reaches the site whole. Needs firefox-49.
|
||||
- **`response.security_details()` names the certificate, and
|
||||
`response.from_service_worker` says when a service worker answered.**
|
||||
The engine reported neither (`None` and `False` for every response); it now
|
||||
reports both as Playwright's does. Needs firefox-49.
|
||||
|
||||
### Fixed
|
||||
- **`eval_on_selector`, `eval_on_selector_all`, `locator.evaluate` and
|
||||
`handle.evaluate` see what the page put on an element.** They ran
|
||||
behind the automation's own view, where `el.__vue__` and the methods
|
||||
of a custom element's class do not exist.
|
||||
- **The browser's favicon request no longer reaches the client.** A
|
||||
`page.route("**/*")` handler saw `GET /favicon.ico` now and then, as did the
|
||||
`request`, `response` and `requestfinished` listeners, and a
|
||||
`route.fallback(post_data=...)` rewrote it too. As in Playwright, the favicon,
|
||||
and a request it redirects to, now sends no event, reaches no route handler
|
||||
and is not a request `networkidle` waits on. Unlike Playwright it is not
|
||||
aborted under a route: it goes to the site, as from any Firefox.
|
||||
- **A request held after interception was switched off no longer stalls the
|
||||
session.** Its release was sent from the thread that delivers the engine's
|
||||
events and waited for a reply only that thread could read; the next command
|
||||
of the page then waited forever.
|
||||
- **`route.abort()` with no error code fails the request with
|
||||
`NS_ERROR_FAILURE`, as in Playwright on Firefox.** It failed with
|
||||
`NS_ERROR_ABORT`, the code of `route.abort("aborted")`.
|
||||
- **A route that sends a navigation to another URL lands there.**
|
||||
`route.fallback(url=...)` or `route.continue_(url=...)` on a document
|
||||
request made `goto` fail with "reported committed on ..., which is not where
|
||||
it went", and the response kept the URL the request was sent with. The
|
||||
response is now the routed URL's, and `goto` lands on it.
|
||||
|
||||
## [0.36.2] - 2026-10-17
|
||||
|
||||
The pin moves to invisible-core 48.43.0, still on the firefox-48 engine.
|
||||
|
||||
+12
-12
@@ -4,8 +4,7 @@ Thanks for your interest in improving this project. Contributions are welcome vi
|
||||
|
||||
## Quick links
|
||||
|
||||
- **Bug?** Open a [bug report](https://github.com/feder-cr/invisible_playwright/issues/new?template=bug_report.yml).
|
||||
- **Idea?** Open a [feature request](https://github.com/feder-cr/invisible_playwright/issues/new?template=feature_request.yml).
|
||||
- **Bug or idea?** Open an [issue](https://github.com/feder-cr/invisible_playwright/issues/new/choose).
|
||||
- **Security issue?** Do **not** open a public issue - see [SECURITY.md](SECURITY.md).
|
||||
- **The C++ patches** live in the companion repo [feder-cr/firefox_antidetect_patch](https://github.com/feder-cr/firefox_antidetect_patch) (branch `stealth/151`). Bugs in fingerprint spoofing usually belong there.
|
||||
|
||||
@@ -13,11 +12,12 @@ Thanks for your interest in improving this project. Contributions are welcome vi
|
||||
|
||||
This repository ships the **Python wrapper** (`invisible_playwright`) around a pre-built patched Firefox. In scope:
|
||||
|
||||
- The `InvisiblePlaywright` sync/async API and launcher
|
||||
- The fingerprint sampler (`_fpforge`)
|
||||
- Binary download/caching, CLI, proxy plumbing
|
||||
- The `InvisiblePlaywright` sync and async API, and its Playwright compatibility layer
|
||||
- The CLI (`invisible-playwright fetch`, `invisible-playwright version`)
|
||||
- Tests, docs, examples, packaging
|
||||
|
||||
The fingerprint, the engine download and the browser protocol client are shared by every wrapper and live in [invisible_core](https://github.com/feder-cr/invisible_core).
|
||||
|
||||
Out of scope (belongs in `firefox_antidetect_patch`):
|
||||
|
||||
- Changes to the Firefox C++ source
|
||||
@@ -26,19 +26,19 @@ Out of scope (belongs in `firefox_antidetect_patch`):
|
||||
|
||||
## Development setup
|
||||
|
||||
To *use* the package you do not need any of this: `pip install invisible-playwright`.
|
||||
The steps below are for working on the code.
|
||||
To *use* the package you do not need any of this: see [Install](README.md#install) in the README.
|
||||
The steps below are for working on the code, with [uv](https://docs.astral.sh/uv/).
|
||||
|
||||
```bash
|
||||
git clone https://github.com/feder-cr/invisible_playwright.git
|
||||
cd invisible_playwright
|
||||
python -m venv .venv
|
||||
uv venv
|
||||
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
||||
pip install -e ".[dev]"
|
||||
python -m invisible_playwright fetch # download the patched Firefox binary
|
||||
uv pip install -e ".[dev]"
|
||||
invisible-playwright fetch # download the patched Firefox binary
|
||||
```
|
||||
|
||||
Requires Python 3.11+ and one of: Windows x86_64, Linux x86_64.
|
||||
One of: Windows x86_64, Linux x86_64.
|
||||
|
||||
## Running tests
|
||||
|
||||
@@ -72,7 +72,7 @@ Before opening, please:
|
||||
|
||||
Include:
|
||||
|
||||
- OS and version, Python version, `invisible_playwright` version (`invisible_playwright version`)
|
||||
- OS and version, Python version, the output of `invisible-playwright version`
|
||||
- A minimal reproduction
|
||||
- Expected vs actual behavior
|
||||
- Relevant logs / stack traces
|
||||
|
||||
+7099
File diff suppressed because it is too large.
Load diff
@@ -31,14 +31,31 @@ Anti-bots ask two questions, and reCAPTCHA, hCaptcha and Cloudflare Turnstile sc
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
python -m invisible_playwright fetch # one-time download, sha256-verified: 240 MB (Windows) / 262 MB (Linux x86_64) / 253 MB (Linux arm64), about 550 MB unpacked
|
||||
Windows, in PowerShell:
|
||||
|
||||
```powershell
|
||||
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
||||
$env:Path = "$env:USERPROFILE\.local\bin;$env:Path"
|
||||
uv init --python ">=3.11" my-project
|
||||
cd my-project
|
||||
uv add invisible-playwright
|
||||
uv run invisible-playwright fetch # one-time download, sha256-verified: 240 MB, about 550 MB unpacked
|
||||
```
|
||||
|
||||
Requires **Python 3.11 or newer**.
|
||||
Linux:
|
||||
|
||||
Supported platforms: **Windows x86_64**, **Linux x86_64 / arm64**.
|
||||
```bash
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
source $HOME/.local/bin/env
|
||||
uv init --python ">=3.11" my-project
|
||||
cd my-project
|
||||
uv add invisible-playwright
|
||||
uv run invisible-playwright fetch # one-time download, sha256-verified: 262 MB, about 550 MB unpacked
|
||||
```
|
||||
|
||||
Supported platforms: **Windows x86_64**, **Linux x86_64**. Linux arm64 is no longer supported from firefox-56 (firefox-55 is the last engine built for it).
|
||||
|
||||
Then save one of the examples below as `main.py` in `my-project` and run it with `uv run main.py`.
|
||||
|
||||
---
|
||||
|
||||
@@ -305,7 +322,7 @@ This project is for educational purposes only. It is provided as-is, with no war
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml"><img src="https://github.com/feder-cr/invisible_playwright/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/blob/main/LICENSE"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/license.svg" alt="License: MIT"></a>
|
||||
<a href="https://www.python.org/downloads/"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/python.svg" alt="Python 3.11+"></a>
|
||||
<a href="https://github.com/feder-cr/firefox_antidetect_patch/releases"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/firefox.svg" alt="Firefox 151.0"></a>
|
||||
<a href="https://github.com/feder-cr/firefox_antidetect_patch/releases"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/main/docs/badges/firefox.svg" alt="Firefox 159.0"></a>
|
||||
<img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/badges/docs/badges/launches.svg" alt="browser launches">
|
||||
<a href="https://github.com/feder-cr/invisible_playwright/stargazers"><img src="https://raw.githubusercontent.com/feder-cr/invisible_playwright/badges/docs/badges/stars.svg" alt="GitHub stars"></a>
|
||||
</p>
|
||||
@@ -1,5 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="99" height="20" role="img" aria-label="Firefox: 151.0">
|
||||
<title>Firefox: 151.0</title>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="99" height="20" role="img" aria-label="Firefox: 159.0">
|
||||
<title>Firefox: 159.0</title>
|
||||
<linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient>
|
||||
<clipPath id="r"><rect width="99" height="20" rx="3" fill="#fff"/></clipPath>
|
||||
<g clip-path="url(#r)">
|
||||
@@ -10,7 +10,7 @@
|
||||
<g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">
|
||||
<text x="28.0" y="15" fill="#010101" fill-opacity=".3">Firefox</text>
|
||||
<text x="28.0" y="14">Firefox</text>
|
||||
<text x="77.5" y="15" fill="#010101" fill-opacity=".3">151.0</text>
|
||||
<text x="77.5" y="14">151.0</text>
|
||||
<text x="77.5" y="15" fill="#010101" fill-opacity=".3">159.0</text>
|
||||
<text x="77.5" y="14">159.0</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 855 B After Width: | Height: | Size: 855 B |
@@ -119,7 +119,8 @@ step so the download never lands on a request path:
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-slim
|
||||
RUN pip install invisible-playwright
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
RUN uv pip install --system invisible-playwright
|
||||
# Unpack the engine at BUILD time, not per request.
|
||||
RUN python -m invisible_playwright fetch
|
||||
# ... your worker entrypoint ...
|
||||
|
||||
@@ -141,7 +141,7 @@ Playwright method works unchanged because there is no wrapped subset to learn.
|
||||
Install is the ordinary way, and the engine downloads itself on first use:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
That is the engine layer, in full, scriptable. What it does not print is a
|
||||
|
||||
@@ -112,7 +112,7 @@ The launch is the same two lines for both agents. The seed makes the identity
|
||||
reproducible, so a failing run can be replayed rather than guessed at.
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
A DOM-reading agent reads structure and acts on a selector:
|
||||
|
||||
@@ -223,9 +223,9 @@ deploy on. A blank or changing emoji is a failure, not a pass.
|
||||
|
||||
## Sources
|
||||
|
||||
- This project's font architecture and its cross-OS font gate, which runs the
|
||||
browser on a Linux host with no Windows fonts and reads what it renders,
|
||||
including colour emoji (decision log, 2026-06-20).
|
||||
- This project's font architecture and its cross-OS host gate, which runs the
|
||||
browser on a Linux host with no Windows fonts and compares what a page reads,
|
||||
colour emoji included, with the Windows build (decision log, 2026-06-20).
|
||||
- Firefox's use of a bundled colour-emoji font in place of the platform emoji
|
||||
font, verified against a stock build on more than one operating system.
|
||||
- [`HTMLCanvasElement.toDataURL()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL)
|
||||
|
||||
@@ -97,7 +97,7 @@ a Playwright page directly. Because invisible_playwright hands you a genuine
|
||||
Playwright `Page`, the port attaches to it with no adapter:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright python-ghost-cursor
|
||||
uv add invisible-playwright python-ghost-cursor
|
||||
```
|
||||
|
||||
```python
|
||||
|
||||
@@ -44,7 +44,7 @@ override from the page, because the page is not where the tell originates.
|
||||
- [Execution context was destroyed, and when it means detection](execution-context-destroyed.md) - Usually a race condition, but sometimes a redirect to a challenge; how to tell the two apart.
|
||||
- [Why content_frame() returns None for a cross-origin iframe](cross-origin-iframe-unreachable.md) - One shared cause behind None, throws and timeouts: process isolation, not a permissions bug.
|
||||
|
||||
- [Running Playwright Firefox on ARM64 Linux](playwright-firefox-arm64-linux.md) - What ships per architecture on ARM64 Linux, the emulation trap, and the memory ceiling.
|
||||
- [Running Playwright Firefox on ARM64 Linux](playwright-firefox-arm64-linux.md) - What ships per architecture on ARM64 Linux, the emulation trap, and the memory ceiling (this project no longer ships a Linux arm64 engine from firefox-56).
|
||||
|
||||
## Human-like input and interaction
|
||||
|
||||
|
||||
@@ -113,8 +113,9 @@ time, so point it at a persisted path:
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-slim
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
|
||||
RUN pip install invisible-playwright
|
||||
RUN uv pip install --system invisible-playwright
|
||||
|
||||
# keep the cached engine on a mounted volume so it downloads once
|
||||
ENV INVISIBLE_PLAYWRIGHT_CACHE_DIR=/engines
|
||||
|
||||
@@ -116,7 +116,7 @@ Switching from stock Playwright is the launch line; every method after it is sta
|
||||
Playwright. Install it first:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
Then gather ICE candidates through the proxy and assert the positive form. The `seed`
|
||||
|
||||
@@ -95,7 +95,7 @@ Strip everything that is not part of the number, then parse the digits and separ
|
||||
with the page's locale rather than guessing. Babel does the locale-aware step:
|
||||
|
||||
```bash
|
||||
pip install babel
|
||||
uv add babel
|
||||
```
|
||||
|
||||
```python
|
||||
@@ -127,7 +127,7 @@ Relative and localized dates need the page's language to read the words and the
|
||||
timezone to anchor the arithmetic. `dateparser` takes both:
|
||||
|
||||
```bash
|
||||
pip install dateparser
|
||||
uv add dateparser
|
||||
```
|
||||
|
||||
```python
|
||||
|
||||
@@ -93,7 +93,7 @@ the main content block and discard the rest. The `readability-lxml` package is
|
||||
a direct port of the well-known algorithm and takes an HTML string:
|
||||
|
||||
```bash
|
||||
pip install readability-lxml lxml
|
||||
uv add readability-lxml lxml
|
||||
```
|
||||
|
||||
```python
|
||||
|
||||
@@ -69,11 +69,12 @@ Chromium-specific plumbing you have to translate.
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.11-slim
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN uv pip install --system --no-cache -r requirements.txt
|
||||
|
||||
# Bake the patched engine into the image at build time, not at container
|
||||
# start. This is a one-time ~238 MB download (~544 MB unpacked), sha256-verified
|
||||
@@ -92,7 +93,7 @@ invisible-playwright
|
||||
|
||||
That builds and runs. It also, by itself, still describes a machine with no GPU, a
|
||||
tiny font set and no audio device, for the reason above: none of those come from
|
||||
`pip install`, they come from the base image. The next two sections are what actually
|
||||
the package install, they come from the base image. The next two sections are what actually
|
||||
changes that.
|
||||
|
||||
## The part a Dockerfile cannot fix by itself
|
||||
|
||||
@@ -51,7 +51,7 @@ The launch is stock Playwright. If you have driven Playwright before, the only c
|
||||
the two lines that open the browser:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
```python
|
||||
|
||||
@@ -53,7 +53,7 @@ already in it. Wrap that string in `io.StringIO` (pandas asks for a file-like ob
|
||||
literal HTML) and pass it in.
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright pandas lxml
|
||||
uv add invisible-playwright pandas lxml
|
||||
```
|
||||
|
||||
```python
|
||||
|
||||
@@ -259,7 +259,7 @@ port and that you confirm the exit inside the browser rather than assuming it. A
|
||||
minimal install for the container it runs in:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
The engine downloads and caches itself on first use, so the first run in a fresh
|
||||
|
||||
@@ -165,7 +165,8 @@ scheduler calls it. A minimal container runs the job and exits:
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-slim
|
||||
RUN pip install invisible-playwright
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
RUN uv pip install --system invisible-playwright
|
||||
COPY monitor.py .
|
||||
CMD ["python", "monitor.py"]
|
||||
```
|
||||
|
||||
@@ -10,8 +10,8 @@ nav_order: 7
|
||||
# How to use invisible_playwright in Docker
|
||||
|
||||
To run `invisible_playwright` in Docker, start from a maintained Playwright
|
||||
base image for the OS-level shared libraries, `pip install
|
||||
invisible-playwright`, fetch the patched Firefox engine at build time, and
|
||||
base image for the OS-level shared libraries, install
|
||||
`invisible-playwright` with uv, fetch the patched Firefox engine at build time, and
|
||||
run the container with `--shm-size=1gb`. The fingerprint itself needs
|
||||
nothing container-specific: the same seed produces the same machine on a
|
||||
desktop or inside a container.
|
||||
@@ -39,6 +39,7 @@ packages that may not match your distro:
|
||||
|
||||
```dockerfile
|
||||
FROM mcr.microsoft.com/playwright/python:v1.47.0-jammy
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
|
||||
WORKDIR /app
|
||||
```
|
||||
@@ -50,17 +51,21 @@ libraries, not the browsers it ships alongside them.
|
||||
|
||||
## Installing invisible-playwright
|
||||
|
||||
Installing `invisible-playwright` in a container is the same two-step
|
||||
install as on a desktop: `pip install invisible-playwright` for the
|
||||
package, then a separate `fetch` step to download the patched engine. See
|
||||
[installation](installation.md) for why the two steps are kept separate:
|
||||
Installing `invisible-playwright` in a container takes the same two steps
|
||||
as on a desktop: install the package with uv, then a separate `fetch` step
|
||||
to download the patched engine. See [installation](installation.md) for why
|
||||
the two steps are kept separate:
|
||||
|
||||
```dockerfile
|
||||
RUN pip install --no-cache-dir invisible-playwright
|
||||
RUN uv venv --python ">=3.11" /opt/venv
|
||||
ENV VIRTUAL_ENV=/opt/venv PATH="/opt/venv/bin:$PATH"
|
||||
RUN uv pip install --no-cache invisible-playwright
|
||||
```
|
||||
|
||||
Nothing container-specific here yet. The wheel is small; the part that
|
||||
needs a build-time decision is the next step.
|
||||
The venv is not decoration: the Python in this base image is 3.10, older
|
||||
than the 3.11 the package needs, so uv brings an interpreter that can run it.
|
||||
The wheel is small; the part that needs a build-time decision is the next
|
||||
step.
|
||||
|
||||
## Fetching the patched engine at build time
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ a browser and read back what the server saw. A public HTTP/2 fingerprint endpoin
|
||||
the frames it received as JSON.
|
||||
|
||||
```bash
|
||||
pip install "httpx[http2]"
|
||||
uv add "httpx[http2]"
|
||||
```
|
||||
|
||||
```python
|
||||
|
||||
+13
-18
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: "Installation"
|
||||
description: "Install the wrapper from PyPI, then fetch the patched Firefox binary separately - a one-time, sha256-verified download. Supported on Windows, Linux and macOS."
|
||||
description: "Install the wrapper with uv, then fetch the patched Firefox binary separately - a one-time, sha256-verified download. Supported on Windows and Linux."
|
||||
parent: "Documentation"
|
||||
nav_order: 1
|
||||
---
|
||||
@@ -8,31 +8,28 @@ nav_order: 1
|
||||
|
||||
# Installation
|
||||
|
||||
Install invisible-playwright in two steps: `pip install invisible-playwright` for
|
||||
the Python wrapper, then `python -m invisible_playwright fetch` to download the
|
||||
Install invisible-playwright in two steps: `uv add invisible-playwright` for
|
||||
the Python wrapper, then `uv run invisible-playwright fetch` to download the
|
||||
patched Firefox binary it drives. The steps are separate on purpose - the Python
|
||||
package is small, the browser is not.
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
python -m invisible_playwright fetch # one-time ~238 MB download (~544 MB unpacked), sha256-verified
|
||||
uv add invisible-playwright
|
||||
uv run invisible-playwright fetch # one-time ~238 MB download (~544 MB unpacked), sha256-verified
|
||||
```
|
||||
|
||||
`pip install` gets you the wrapper and its API. `fetch` downloads the patched Firefox
|
||||
If you do not have a uv project yet, [the README's install steps](https://github.com/feder-cr/invisible_playwright#install) create one.
|
||||
|
||||
`uv add` gets you the wrapper and its API. `fetch` downloads the patched Firefox
|
||||
binary itself, verifies it against a sha256 shipped inside `invisible-core`, and caches
|
||||
it. You only pay that cost once per engine version - later runs use the cached copy
|
||||
without a network call.
|
||||
|
||||
## Supported platforms
|
||||
|
||||
**Windows x86_64**, **Linux x86_64 / arm64**, **macOS arm64 / x86_64**.
|
||||
|
||||
On macOS the app is ad-hoc signed, not notarized. If Gatekeeper complains the first
|
||||
time it runs, clear the quarantine flag once:
|
||||
|
||||
```bash
|
||||
xattr -dr com.apple.quarantine /path/to/cached/Firefox.app
|
||||
```
|
||||
**Windows x86_64**, **Linux x86_64**. There is no macOS engine: its
|
||||
build ended on 2026-08-26. Linux arm64 is no longer supported from firefox-56:
|
||||
firefox-55 is the last engine built for it.
|
||||
|
||||
`invisible-playwright version` prints the cache location, and
|
||||
`invisible-playwright fetch` prints the exact binary path as its last line.
|
||||
@@ -66,7 +63,7 @@ the [CLI reference](cli-reference.md).
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
**Do I need to install Firefox myself?** No. `python -m invisible_playwright fetch`
|
||||
**Do I need to install Firefox myself?** No. `uv run invisible-playwright fetch`
|
||||
downloads the patched binary for you, verifies it, and caches it - there is nothing
|
||||
to install separately.
|
||||
|
||||
@@ -83,9 +80,7 @@ Point `INVPW_BINARY_PATH` at a binary you already have to skip the download
|
||||
entirely. [Configuration](configuration.md) lists the other environment variables,
|
||||
including the ones for corporate networks and CI.
|
||||
|
||||
**Which platforms are supported?** Windows x86_64, Linux x86_64/arm64, and macOS
|
||||
arm64/x86_64. macOS needs the quarantine flag cleared once if Gatekeeper complains
|
||||
on first launch.
|
||||
**Which platforms are supported?** Windows x86_64 and Linux x86_64. Linux arm64 is no longer supported from firefox-56.
|
||||
|
||||
**See also:** [Configuration](configuration.md) for proxy, timezone and environment
|
||||
variables, [CLI reference](cli-reference.md) for what `fetch` and `version` do in
|
||||
|
||||
@@ -25,11 +25,13 @@ The engine and the identity come from the Python package even though the tests a
|
||||
JavaScript. Get them once:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
invisible-playwright fetch # downloads it if missing, prints the binary path as its last line
|
||||
python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
uv add invisible-playwright
|
||||
uv run invisible-playwright fetch # downloads it if missing, prints the binary path as its last line
|
||||
uv run python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
```
|
||||
|
||||
Run them in a uv project; [the README's install steps](https://github.com/feder-cr/invisible_playwright#install) create one.
|
||||
|
||||
Regenerate `prefs.json` when you upgrade the package: the pref set moves with the
|
||||
engine. Keep the seed written down next to it, because that number is the identity.
|
||||
|
||||
|
||||
@@ -27,11 +27,13 @@ The engine and the identity are produced by the Python package even though the
|
||||
crawler is Node. Get them once, at install or deploy time:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
invisible-playwright fetch > .browser-path
|
||||
python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
uv add invisible-playwright
|
||||
uv run invisible-playwright fetch > .browser-path
|
||||
uv run python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
```
|
||||
|
||||
Run them in a uv project; [the README's install steps](https://github.com/feder-cr/invisible_playwright#install) create one.
|
||||
|
||||
Yes, a Python dependency in a Node project. That is the real cost of this route,
|
||||
and if it is unacceptable, the answer is a Chromium-based tool rather than a
|
||||
workaround.
|
||||
|
||||
@@ -20,7 +20,7 @@ check the signature before blaming the engine.
|
||||
## What you need
|
||||
|
||||
```bash
|
||||
pip install crawlee[playwright] invisible-playwright
|
||||
uv add crawlee[playwright] invisible-playwright
|
||||
```
|
||||
|
||||
The patched Firefox binary is downloaded on first launch and cached, so the first
|
||||
|
||||
@@ -29,11 +29,13 @@ Verified 2026-07-27 by reading each binding's own launch options.
|
||||
|
||||
## Step one: get the two values
|
||||
|
||||
Run the commands below in a uv project; [the README's install steps](https://github.com/feder-cr/invisible_playwright#install) create one.
|
||||
|
||||
The binary has a CLI:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
invisible-playwright fetch # downloads and caches it once, prints the absolute path
|
||||
uv add invisible-playwright
|
||||
uv run invisible-playwright fetch # downloads and caches it once, prints the absolute path
|
||||
```
|
||||
|
||||
The preferences do not, and that is a real gap instead of an omission from this
|
||||
@@ -41,7 +43,7 @@ page: there is no `prefs` subcommand today, so you generate them with a one-line
|
||||
and keep the JSON.
|
||||
|
||||
```bash
|
||||
python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
uv run python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
```
|
||||
|
||||
Regenerate it when you upgrade the package, since the pref set moves with the engine.
|
||||
|
||||
@@ -32,10 +32,12 @@ Written against `microsoft/playwright-mcp` as of 2026-07-27.
|
||||
## The short version
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
python -c "from invisible_playwright import ensure_binary; print(ensure_binary())"
|
||||
uv add invisible-playwright
|
||||
uv run python -c "from invisible_playwright import ensure_binary; print(ensure_binary())"
|
||||
```
|
||||
|
||||
Run them in a uv project; [the README's install steps](https://github.com/feder-cr/invisible_playwright#install) create one.
|
||||
|
||||
The second command downloads the patched Firefox on first run, caches it, and prints
|
||||
the path. Give that path to the MCP server:
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ The engine and the identity come from the Python package, which suits Robot Fram
|
||||
since it is Python underneath anyway.
|
||||
|
||||
```bash
|
||||
pip install robotframework-browser invisible-playwright
|
||||
rfbrowser init
|
||||
invisible-playwright fetch # downloads if needed, prints the path as its last line
|
||||
python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
uv add robotframework-browser invisible-playwright
|
||||
uv run rfbrowser init
|
||||
uv run invisible-playwright fetch # downloads if needed, prints the path as its last line
|
||||
uv run python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
```
|
||||
|
||||
Regenerate `prefs.json` when you upgrade the package. Keep the seed written next to
|
||||
|
||||
@@ -22,7 +22,7 @@ is the reference; this one explains which route to pick and what each one costs.
|
||||
## Install
|
||||
|
||||
```bash
|
||||
pip install "scrapy-playwright>=0.0.48" invisible-playwright
|
||||
uv add "scrapy-playwright>=0.0.48" invisible-playwright
|
||||
```
|
||||
|
||||
The patched Firefox is downloaded on first launch and cached. You do not need
|
||||
|
||||
@@ -26,11 +26,13 @@ build's own defaults on every launch, which is a different product from
|
||||
Get the two values first, the same way for all four:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
invisible-playwright fetch
|
||||
python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
uv add invisible-playwright
|
||||
uv run invisible-playwright fetch
|
||||
uv run python -c "import json;from invisible_playwright import get_default_stealth_prefs;print(json.dumps(get_default_stealth_prefs(seed=1, humanize=True)))" > prefs.json
|
||||
```
|
||||
|
||||
Run them in a uv project; [the README's install steps](https://github.com/feder-cr/invisible_playwright#install) create one.
|
||||
|
||||
## Cypress
|
||||
|
||||
Cypress launches Firefox through geckodriver and builds a `moz:firefoxOptions` with
|
||||
|
||||
@@ -132,7 +132,7 @@ Do not assume, read it. The launch is a two-line change from stock Playwright, a
|
||||
every method after it is standard Playwright. Install it first:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
Then ask an IP-echo endpoint, from inside the proxied browser, which address it saw,
|
||||
|
||||
@@ -42,7 +42,7 @@ I/O-bound, so this rarely matters in practice, but it is not universally true.
|
||||
|
||||
**Distribution to non-technical end users.** A Python automation script needs
|
||||
a Python environment, or a packaging step (PyInstaller and similar), to reach
|
||||
someone who is not going to run `pip install`. If the deliverable is a
|
||||
someone who is not going to run a package installer. If the deliverable is a
|
||||
double-clickable app for someone else's machine, this is real friction that a
|
||||
compiled or web-based alternative does not have.
|
||||
|
||||
|
||||
+30
-1
@@ -108,6 +108,7 @@ profile disagree with the browser, on about 12% of seeds.
|
||||
| `screen.height` | int | `1440` |
|
||||
| `screen.dpr` | float | `1.0`, `1.25`, `1.5`, `2.0` |
|
||||
| `screen.color_depth` | int | `24` | `screen.colorDepth` and `screen.pixelDepth`. Declared rather than read off the panel: the engine only returned a fixed 24 when resistFingerprinting was on, which we do not turn on because it is itself a tell, so before this it reported the real display - 30 on a wide-gamut monitor, and a persona claiming an office laptop with a 30-bit panel is a contradiction a page can read. |
|
||||
| `screen.refresh_hz` | int | `60`, `144` | The monitor's refresh rate, which is the cadence of `requestAnimationFrame`: a page reads it from the gap between two frame timestamps. Without it the engine follows the host's display, so one persona answered about 120 on one machine and 58 on another. Not sampled: 60 is what an office laptop or monitor runs at, and a 144 Hz persona is one pin away. |
|
||||
|
||||
### `hardware.*`
|
||||
|
||||
@@ -167,7 +168,8 @@ would be the signal. They are pinnable for A/B work, not for realism.
|
||||
|
||||
| Key | Type | Example | Notes |
|
||||
|-----|------|---------|-------|
|
||||
| `font.ui_family` | str | `"Segoe UI"` | Family behind `font: menu`, `font: caption`, and the `-moz-` widget fonts. |
|
||||
| `font.ui_family` | str | `"Segoe UI"` | Family behind `font: menu` and `font: caption`. The form-control fonts take `font.dialog_family`. |
|
||||
| `font.dialog_family` | str | `"MS Shell Dlg 2"` | The family of the form-control fonts, `-moz-button`, `-moz-field` and `-moz-list`, which is not the shell font: Windows Firefox builds them from the message font under the name "MS Shell Dlg 2", and a page reads it with one `getComputedStyle(input).fontFamily`. |
|
||||
| `font.ui_size` | str | `"12"` | **A string, not an int.** Gecko reads this pref through `Preferences::GetFloat`, which parses the value from its text form; an int is not rejected, it is ignored, and the UI silently falls back to 16px. |
|
||||
| `font.monospace_size` | int | `13` | Default monospace size. Firefox ships 13 on Windows and 12 in its Unix block, and the gap is directly readable as the width of the `monospace` generic at the default size. |
|
||||
| `font.alpha_ladder` | tuple of int | `(0, 18, 35, ..., 255)` | The distinct alpha levels a Windows rasteriser leaves on an antialiased glyph edge, ascending, first `0` and last `255` so a fully transparent or fully opaque pixel never moves. Canvas readback snaps onto these. An empty tuple disables the snap, which is what you want when measuring what the unsnapped edge looks like. |
|
||||
@@ -179,6 +181,33 @@ would be the signal. They are pinnable for A/B work, not for realism.
|
||||
| `font.cleartype_rendering_mode` | int | `5` | DirectWrite rendering mode. |
|
||||
| `font.freetype_gamma` | int | `220` | The FreeType equivalent of `cleartype_gamma`, x100. Declared so the Linux build rasterises with Windows' curve instead of Skia's linear default. |
|
||||
| `font.freetype_contrast` | int | `100` | The FreeType equivalent of `cleartype_contrast`, x100. |
|
||||
| `font.system_text_quality` | int | `5` | The text quality the engine would otherwise ask the host for: `0` none, `4` standard antialiasing, `5` ClearType. It decides whether the ClearType parameters above apply at all, so on a machine with ClearType off (an RDP session, a VM, a Server) the same binary would draw different text from the same declaration. Declared, never asked of the machine. Any other value is refused. |
|
||||
|
||||
### `desktop.*`
|
||||
|
||||
The Windows desktop settings a page can read, declared instead of asked of the
|
||||
machine. Each one is a value whose engine default either reads the host or
|
||||
differs between Windows and Linux, so without it the same persona answered
|
||||
with the machine it ran on. The defaults are a Windows 11 desktop at its
|
||||
defaults, and they are not sampled.
|
||||
|
||||
| Key | Type | Default | Notes |
|
||||
|-----|------|---------|-------|
|
||||
| `desktop.text_scale` | int | `100` | Windows' "Text size" slider, in percent. It multiplies the device pixel ratio, so `100` is the value that leaves `screen.dpr` the one number for it. |
|
||||
| `desktop.overlay_scrollbars` | bool | `True` | Windows 11's "Automatically hide scroll bars": scrollbars draw over the content, so a scrolling box loses no width (`offsetWidth - clientWidth` is 0). Off, they take `desktop.scrollbar_size`. |
|
||||
| `desktop.scrollbar_style` | int | `5` | How scrollbars are drawn: 5 Windows 11, 4 Windows 10, 2 GTK. |
|
||||
| `desktop.scrollbar_size` | int | `17` | The width a scrollbar takes when it is not an overlay, at 96 dpi. |
|
||||
| `desktop.drag_threshold` | int | `3` | How far the pointer moves before `dragstart`. |
|
||||
| `desktop.scroll_to_click` | bool | `False` | A click in a scrollbar's track jumps there instead of paging. |
|
||||
| `desktop.document_colors` | int | `0` | When the page's colours give way to the system's: `0`, the Windows default, only under a high-contrast theme. |
|
||||
| `desktop.select_styling` | bool | `True` | A page may style a `<select>`'s popup, as on Windows. |
|
||||
| `desktop.word_select_eats_space` | bool | `True` | A double click selects the word and the space after it, as on Windows; a page reads it with `getSelection()` after a real double click. |
|
||||
| `desktop.srgb_output` | bool | `True` | Tagged images are converted to sRGB instead of the host monitor's colour profile, which a small canvas reads back. |
|
||||
| `desktop.os_client_certs` | bool | `False` | Whether the operating system's personal certificates answer a server that asks for one. Off: the persona has none. |
|
||||
| `desktop.theme_accent` | bool | `False` | Whether the page-visible `AccentColor` follows the desktop theme's accent; on Windows it does not. |
|
||||
| `desktop.hour_cycle` | int | `0` | The clock format, `0` meaning the locale decides, as on Windows; otherwise the host's 12/24-hour setting changes every `toLocaleTimeString()`. |
|
||||
| `desktop.select_on_focus` | bool | `True` | Tabbing into a pre-filled field selects all of it, as on Windows. |
|
||||
| `desktop.palette` | str | *(the Windows palette)* | The system colours, light and dark, as `ui.<name>\|<light>\|<dark>` records, one per line, the dark part empty where the scheme does not move it. Every persona carries both schemes; `dark_theme` says which one it uses. |
|
||||
|
||||
### Top-level
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ is the fastest way to tell the three apart.
|
||||
|
||||
## Cause 1: the browsers were never downloaded
|
||||
|
||||
The library and the binaries are decoupled on purpose, so `pip install playwright` or
|
||||
`npm install playwright` alone leaves you with a client and no browser to drive:
|
||||
The library and the binaries are decoupled on purpose, so installing the `playwright`
|
||||
package from PyPI or npm alone leaves you with a client and no browser to drive:
|
||||
|
||||
```bash
|
||||
playwright install # every browser Playwright supports
|
||||
@@ -144,7 +144,7 @@ changing anything, since the fix for each is different and none of them is guess
|
||||
a specific cache path and did not find a runnable one there. The message names the exact
|
||||
path it checked.
|
||||
|
||||
**Does `npm install playwright` or `pip install playwright` include the browsers?**
|
||||
**Does installing the `playwright` package from npm or PyPI include the browsers?**
|
||||
No. The package is the client library; `playwright install` is a separate, required step
|
||||
that downloads the actual browser binaries.
|
||||
|
||||
|
||||
@@ -43,9 +43,11 @@ Most current Debian and Ubuntu base images are published as multi-architecture m
|
||||
|
||||
```dockerfile
|
||||
FROM --platform=linux/arm64 debian:bookworm-slim
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3 python3-pip ca-certificates
|
||||
RUN pip install invisible-playwright
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
|
||||
RUN uv venv --python ">=3.11" /opt/venv
|
||||
ENV VIRTUAL_ENV=/opt/venv PATH="/opt/venv/bin:$PATH"
|
||||
RUN uv pip install --no-cache invisible-playwright
|
||||
```
|
||||
|
||||
The `--platform` flag pins the build explicitly rather than relying on the Docker daemon's default, which matters if you build on one machine and deploy to another. For a real GPU, font set, or screen presented to the browser instead of a bare container's defaults, see [How to run Playwright in Docker without getting detected](how-to-run-playwright-docker-undetected.md); it applies the same way on arm64, only the base image and engine differ by architecture.
|
||||
@@ -76,7 +78,7 @@ One caveat: Python's own `platform.machine()` inside your automation does not pr
|
||||
|
||||
## What this project ships, and does not
|
||||
|
||||
This project currently builds and publishes engines for Linux on both x86_64 and arm64, and for Windows on x86_64. There is no macOS build; macOS support was discontinued after the engine build for it ended, so a macOS host has no engine to download here regardless of its own CPU architecture.
|
||||
This project builds and publishes engines for Linux x86_64 and Windows x86_64. Linux arm64 is no longer supported from firefox-56: firefox-55 is the last engine built for it. There is no macOS build; macOS support was discontinued after the engine build for it ended, so a macOS host has no engine to download here regardless of its own CPU architecture.
|
||||
|
||||
## Short answers to the questions that lead here
|
||||
|
||||
@@ -90,7 +92,7 @@ It usually starts under emulation, but runs slower and less predictably, which m
|
||||
Run `file` on the resolved browser binary to see its real architecture, and compare it to the host's own `uname -m` or your cloud provider's listed instance type, rather than trusting the image tag alone.
|
||||
|
||||
**Does invisible_playwright support ARM64?**
|
||||
Yes, on Linux: separate engine builds for x86_64 and arm64, alongside a Windows x86_64 build. There is currently no macOS build.
|
||||
Not on Linux from firefox-56: firefox-55 is the last engine built for Linux arm64. The engines are Linux x86_64 and Windows x86_64. There is currently no macOS build.
|
||||
|
||||
**Is WebKit's ARM64 Linux support as mature as Chromium and Firefox?**
|
||||
Playwright's own system requirements name Debian 12 and 13 and Ubuntu 22.04, 24.04 and 26.04 on "x86-64 or arm64" without splitting the list per browser, so confirm the browser you need actually downloads on your distribution before you build around it.
|
||||
|
||||
@@ -34,6 +34,7 @@ Debian and Ubuntu-based images, which most Playwright containers are, ship almos
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.11-slim
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
fonts-noto \
|
||||
@@ -46,7 +47,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
RUN uv pip install --system --no-cache -r requirements.txt
|
||||
|
||||
RUN python -m invisible_playwright fetch
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ anecdotal. Fix the seed, capture, and assert two things at once: the screenshot
|
||||
is a sane size and it is a real image, not a wall of noise.
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
```python
|
||||
|
||||
@@ -132,10 +132,11 @@ to add, because the engine downloads itself on first use:
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-slim
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends xvfb \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN pip install invisible-playwright
|
||||
RUN uv pip install --system invisible-playwright
|
||||
COPY scrape.py .
|
||||
CMD ["python", "scrape.py"]
|
||||
```
|
||||
|
||||
@@ -55,8 +55,9 @@ jobs:
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
- uses: astral-sh/setup-uv@v6
|
||||
- name: Install
|
||||
run: pip install invisible-playwright
|
||||
run: uv pip install --system invisible-playwright
|
||||
- name: Run
|
||||
run: python scrape.py
|
||||
```
|
||||
|
||||
@@ -199,7 +199,8 @@ describe:
|
||||
|
||||
```dockerfile
|
||||
FROM python:3.12-slim
|
||||
RUN pip install invisible-playwright
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.12.10 /uv /uvx /bin/
|
||||
RUN uv pip install --system invisible-playwright
|
||||
ENV INVISIBLE_PLAYWRIGHT_CACHE_DIR=/engines
|
||||
VOLUME /engines
|
||||
COPY scrape_job.py /srv/scrape_job.py
|
||||
|
||||
@@ -43,7 +43,7 @@ That directness is the whole reason the fixture pair works cleanly:
|
||||
Install what you need first:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright pytest pytest-asyncio
|
||||
uv add invisible-playwright pytest pytest-asyncio
|
||||
```
|
||||
|
||||
And turn on pytest-asyncio's auto mode so you do not decorate every test by hand. In
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ with InvisiblePlaywright(seed=42, proxy=proxy) as browser:
|
||||
```
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
If your project is committed to Chrome and to an async Python API of its own, and
|
||||
|
||||
@@ -105,7 +105,7 @@ Switching from plain Playwright is the same two-line change it always is, and th
|
||||
object is a real Playwright `Browser` with every method intact:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
```python
|
||||
|
||||
@@ -191,7 +191,7 @@ authentication](playwright-socks5-proxy-authentication.md).
|
||||
A minimal install to run the snippet:
|
||||
|
||||
```bash
|
||||
pip install invisible-playwright
|
||||
uv add invisible-playwright
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
+4
-5
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "invisible_playwright"
|
||||
version = "0.36.2"
|
||||
version = "0.47.1"
|
||||
description = "Playwright wrapper for a patched Firefox with deterministic stealth profile."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
@@ -69,10 +69,10 @@ dependencies = [
|
||||
# metadata; nothing in src/ hardcodes a second copy (tests/test_core_pin.py
|
||||
# fails if one appears). What stays invisible to install-time machinery is the
|
||||
# --no-deps / lockfile residue, and _pin.py is the only layer that sees it.
|
||||
"invisible_core==48.43.0",
|
||||
"invisible_core==58.56.0",
|
||||
# ⛔ playwright is NO LONGER a dependency: since the full fork, the Python
|
||||
# client lives in src/invisible_playwright/_pw/ and the Node driver in
|
||||
# src/invisible_playwright/_driver/. Reintroducing it would not visibly
|
||||
# client lives in src/invisible_playwright/_pw/ and its server in
|
||||
# src/invisible_playwright/_juggler/ (no Node driver). Reintroducing it would not visibly
|
||||
# break anything - that is the problem - because the two packages coexist
|
||||
# without colliding: one of them would simply never run, and whoever
|
||||
# reads the pyproject would believe the opposite.
|
||||
@@ -243,7 +243,6 @@ release_tags = ["v"]
|
||||
# exclusion that names nothing is refused by the gate.
|
||||
[tool.invisible.english]
|
||||
excluded = [
|
||||
"src/invisible_playwright/_pw/",
|
||||
"tests/test_fork.py",
|
||||
]
|
||||
marker = "MODIFIED by invisible_playwright"
|
||||
@@ -0,0 +1,172 @@
|
||||
"""Builds tests/data/canvas_icc_ref/refs.json, the reference of the canvas ICC readback test.
|
||||
|
||||
One measurement of retail Firefox 159.0 on Windows with the default prefs (the run
|
||||
``a_win_default``: qcms converts a tagged image to the monitor profile, here the stock
|
||||
"sRGB Color Space Profile.icm"), and one control run on the same machine with
|
||||
gfx.color_management.force_srgb=true (``b_win_force_srgb``: the bytes without that
|
||||
conversion), both made by index.html and the images of gen_images.py:
|
||||
|
||||
python -I scripts/build_canvas_icc_refs.py <a_win_default.json> <b_win_force_srgb.json> \
|
||||
--repeat <a2_win_default_repeat.json> --host-profile <host_display_profile.json> \
|
||||
--source <name of the capture> [--out tests/data/canvas_icc_ref/refs.json]
|
||||
|
||||
The script stops if the repeat run has other hashes than the reference run, if the runs
|
||||
were not made on the same Firefox build, or if the prefs of the two runs are not the default
|
||||
and force_srgb=true. The probes are the 72 of the page: for each of the 10 images drawImage,
|
||||
drawImage at 32 px, createImageBitmap with the default colour space conversion and with
|
||||
``none``; the 22 fill colours; the canvas colorSpace probe; the 9 environment values.
|
||||
|
||||
Standard library only: it does not import invisible_core, and the repository holds no PNG
|
||||
and no run's pixel hex, only hashes and sizes.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import importlib.util
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
DEFAULT_OUT = Path(__file__).resolve().parents[1] / "tests" / "data" / "canvas_icc_ref" / "refs.json"
|
||||
IMAGE_PROBES = ("drawImage", "drawImage_scaled32", "bitmap_default", "bitmap_none")
|
||||
#: Value probes that are not colour management: the host's theme, which the retail machine
|
||||
#: had dark; the test does not compare it (the persona's colour scheme is checked elsewhere).
|
||||
NOT_COMPARED = ("env | prefers-color-scheme:dark",)
|
||||
|
||||
|
||||
GEN_IMAGES = DEFAULT_OUT.parent / "gen_images.py"
|
||||
|
||||
|
||||
def image_files():
|
||||
"""{image id: {file, bytes, sha256}} of the ten images gen_images.py writes: the reference
|
||||
names them, so a generator that drifts is seen before the engine is blamed."""
|
||||
spec = importlib.util.spec_from_file_location("gen_images", GEN_IMAGES)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
imgs, _profiles = mod.build_images()
|
||||
return {iid: {"file": "images/%s.%s" % (iid, ext), "bytes": len(data),
|
||||
"sha256": hashlib.sha256(data).hexdigest()}
|
||||
for iid, ext, data, _what in imgs}
|
||||
|
||||
|
||||
class RefError(ValueError):
|
||||
"""The runs cannot be one reference."""
|
||||
|
||||
|
||||
def env_sha256(value):
|
||||
"""The hash of an environment value: SHA-256 of its compact JSON (as JSON.stringify)."""
|
||||
return hashlib.sha256(json.dumps(value, separators=(",", ":")).encode()).hexdigest()
|
||||
|
||||
|
||||
def probes(R):
|
||||
"""{probe name: {kind, sha256, bytes (pixel probes), value (env)}} of a page result R
|
||||
(``window.R`` of index.html). ``bytes`` is the RGBA length: 4 x width x height."""
|
||||
out = {}
|
||||
for iid, v in R["images"].items():
|
||||
for k in IMAGE_PROBES:
|
||||
e = v.get(k)
|
||||
if not isinstance(e, dict) or "sha256" not in e:
|
||||
raise RefError("image %s probe %s has no hash: %r" % (iid, k, e))
|
||||
size = 32 if k == "drawImage_scaled32" else 16
|
||||
out["%s | %s" % (iid, k)] = {"kind": "image", "sha256": e["sha256"],
|
||||
"bytes": 4 * size * size}
|
||||
for f, v in R["fills"].items():
|
||||
if "sha256" not in v:
|
||||
raise RefError("fill %s has no hash: %r" % (f, v))
|
||||
out["fill | " + f] = {"kind": "fill", "sha256": v["sha256"], "bytes": 4 * 16 * 16}
|
||||
p3 = R["canvas_colorspace"].get("p3_fill_p3_canvas") or {}
|
||||
if "sha256" not in p3:
|
||||
raise RefError("the canvas colorSpace probe has no hash")
|
||||
out["canvas colorSpace p3 fill"] = {"kind": "colorspace", "sha256": p3["sha256"],
|
||||
"bytes": 4 * 16 * 16}
|
||||
for k, v in R["env"].items():
|
||||
out["env | " + k] = {"kind": "env", "sha256": env_sha256(v), "value": v}
|
||||
return out
|
||||
|
||||
|
||||
def build(a, b, repeat, host_profile, source):
|
||||
"""The reference from the default run ``a``, the control run ``b`` (force_srgb), the
|
||||
repeat of ``a`` and the host profile description; all as loaded JSON."""
|
||||
for key in ("buildid", "exe_sha256", "version", "os"):
|
||||
if a["firefox"][key] != b["firefox"][key] or a["firefox"][key] != repeat["firefox"][key]:
|
||||
raise RefError("the runs differ in the Firefox %s" % key)
|
||||
pa, pb, pr = probes(a["R"]), probes(b["R"]), probes(repeat["R"])
|
||||
if pa != pr:
|
||||
bad = sorted(k for k in pa if pa[k] != pr.get(k))
|
||||
raise RefError("the repeat run differs from the reference run on %d probes: %s"
|
||||
% (len(bad), ", ".join(bad[:5])))
|
||||
if set(pa) != set(pb):
|
||||
raise RefError("the control run has other probes than the reference run")
|
||||
prefs_a, prefs_b = a["prefs_read_back"], b["prefs_read_back"]
|
||||
if prefs_a.get("gfx.color_management.display_profile") not in ("", None):
|
||||
raise RefError("the reference run has a display_profile pref: it must read the host's")
|
||||
if prefs_a.get("gfx.color_management.force_srgb") is not False:
|
||||
raise RefError("the reference run is not made with the default force_srgb (false)")
|
||||
if prefs_b.get("gfx.color_management.force_srgb") is not True:
|
||||
raise RefError("the control run is not made with force_srgb=true")
|
||||
for k, v in prefs_a.items():
|
||||
if k != "gfx.color_management.force_srgb" and prefs_b.get(k) != v:
|
||||
raise RefError("the control run differs in %s" % k)
|
||||
|
||||
out = {}
|
||||
dependent = []
|
||||
for name, p in pa.items():
|
||||
e = dict(p)
|
||||
if pb[name]["sha256"] != p["sha256"]:
|
||||
e["without_conversion_sha256"] = pb[name]["sha256"]
|
||||
dependent.append(name)
|
||||
if name in NOT_COMPARED:
|
||||
e["compared"] = False
|
||||
out[name] = e
|
||||
return {
|
||||
"test_page": "index.html",
|
||||
"image_generator": "gen_images.py",
|
||||
"source": {
|
||||
"capture": source,
|
||||
"reference_run": "runs/a_win_default.json",
|
||||
"repeat_run": "runs/a2_win_default_repeat.json (same hashes on all probes)",
|
||||
"control_run": "runs/b_win_force_srgb.json (gfx.color_management.force_srgb=true)",
|
||||
"date": "2026-11-09",
|
||||
},
|
||||
"firefox": {**a["firefox"], "prefs": prefs_a},
|
||||
"display_profile": {"file": host_profile["file"], "size": host_profile["size"],
|
||||
"sha256": host_profile["sha256"], "api": "GetICMProfileW"},
|
||||
"images": image_files(),
|
||||
"probe_count": len(out),
|
||||
"profile_dependent_count": len(dependent),
|
||||
"profile_dependent": sorted(dependent),
|
||||
"probes": out,
|
||||
}
|
||||
|
||||
|
||||
def main(argv):
|
||||
ap = argparse.ArgumentParser(description=__doc__,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("reference", help="run json of the retail default run (a_win_default)")
|
||||
ap.add_argument("control", help="run json of the force_srgb run (b_win_force_srgb)")
|
||||
ap.add_argument("--repeat", required=True, help="run json of the repeat of the default run")
|
||||
ap.add_argument("--host-profile", required=True, help="host_display_profile.json")
|
||||
ap.add_argument("--source", default="canvas-color/canvas-color-icc-readback",
|
||||
help="name of the capture the runs come from")
|
||||
ap.add_argument("--out", default=str(DEFAULT_OUT))
|
||||
a = ap.parse_args(argv[1:])
|
||||
|
||||
def load(p):
|
||||
return json.loads(Path(p).read_text(encoding="utf-8"))
|
||||
|
||||
try:
|
||||
refs = build(load(a.reference), load(a.control), load(a.repeat),
|
||||
load(a.host_profile), a.source)
|
||||
except RefError as e:
|
||||
print("error: %s" % e, file=sys.stderr)
|
||||
return 1
|
||||
Path(a.out).write_text(json.dumps(refs, ensure_ascii=False, indent=1) + "\n",
|
||||
encoding="utf-8")
|
||||
print("%d probes (%d depend on the display profile) -> %s"
|
||||
% (refs["probe_count"], refs["profile_dependent_count"], a.out))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -0,0 +1,106 @@
|
||||
"""Builds tests/data/canvas_text_ref/refs.json, the one reference of the canvas text test.
|
||||
|
||||
Two measurements of retail Firefox 159.0 on Windows, made with the same page code, the same
|
||||
bundled font files and the same machine, are merged by case id:
|
||||
|
||||
python -I scripts/build_canvas_text_refs.py <canvas_ref_bundle/refs.json> \
|
||||
<canvas_ref_ext/refs.json> [--out tests/data/canvas_text_ref/refs.json]
|
||||
|
||||
The bundle file has the base cases (no ``gruppo`` field: they become group ``0_base``), the
|
||||
extension file has the cases of the other groups. A case id that is in both files is kept
|
||||
once, with the extension's group; the script stops if the two hashes of such a case differ,
|
||||
or if the two files were not measured on the same Firefox build, with the same ClearType
|
||||
state and the same font files. Fields that name a file of the measuring machine (the PNG
|
||||
paths) are dropped: the repository holds no PNG and no font.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
BASE_GROUP = "0_base"
|
||||
DEFAULT_OUT = Path(__file__).resolve().parents[1] / "tests" / "data" / "canvas_text_ref" / "refs.json"
|
||||
_DROP = ("png",)
|
||||
|
||||
|
||||
class MergeError(ValueError):
|
||||
"""The two measurements cannot be one reference."""
|
||||
|
||||
|
||||
def _case(case, group):
|
||||
out = {k: v for k, v in case.items() if k not in _DROP}
|
||||
out.setdefault("alpha", True)
|
||||
out.setdefault("stretch", "normal")
|
||||
out.setdefault("text", "TEXT")
|
||||
out["gruppo"] = group
|
||||
return out
|
||||
|
||||
|
||||
def merge(bundle, ext):
|
||||
"""One reference from the bundle measurement and the extension measurement."""
|
||||
for key in ("firefox", "canvas", "cleartype", "text"):
|
||||
if bundle[key] != ext[key]:
|
||||
raise MergeError("the two measurements differ in %r: %r vs %r"
|
||||
% (key, bundle[key], ext[key]))
|
||||
ext_fonts = {f["bundle_file"]: f for f in ext["fonts"]}
|
||||
for f in bundle["fonts"]:
|
||||
other = ext_fonts.get(f["bundle_file"])
|
||||
if other is None or other["sha256"] != f["sha256"]:
|
||||
raise MergeError("font %s is not the same file in the two measurements"
|
||||
% f["bundle_file"])
|
||||
|
||||
cases = {}
|
||||
for cid, c in bundle["cases"].items():
|
||||
cases[cid] = _case(c, c.get("gruppo") or BASE_GROUP)
|
||||
for cid, c in ext["cases"].items():
|
||||
if not c.get("gruppo"):
|
||||
raise MergeError("extension case %r has no group" % cid)
|
||||
if cid in cases and cases[cid]["sha256"] != c["sha256"]:
|
||||
raise MergeError("case %r has two different hashes: %s and %s"
|
||||
% (cid, cases[cid]["sha256"], c["sha256"]))
|
||||
cases[cid] = _case(c, c["gruppo"])
|
||||
|
||||
groups = {}
|
||||
for c in cases.values():
|
||||
groups[c["gruppo"]] = groups.get(c["gruppo"], 0) + 1
|
||||
status = {**bundle.get("font_load_status", {}), **ext.get("font_load_status", {})}
|
||||
return {
|
||||
"test_page": "index.html",
|
||||
"font_source": "bundle",
|
||||
"text": bundle["text"],
|
||||
"firefox": bundle["firefox"],
|
||||
"canvas": bundle["canvas"],
|
||||
"cleartype": bundle["cleartype"],
|
||||
"fonts": ext["fonts"],
|
||||
"font_load_status": status,
|
||||
"case_count": len(cases),
|
||||
"groups": dict(sorted(groups.items())),
|
||||
"cases": cases,
|
||||
}
|
||||
|
||||
|
||||
def main(argv):
|
||||
ap = argparse.ArgumentParser(description=__doc__,
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("bundle", help="refs.json of the base measurement (canvas_ref_bundle)")
|
||||
ap.add_argument("ext", help="refs.json of the extension measurement (canvas_ref_ext)")
|
||||
ap.add_argument("--out", default=str(DEFAULT_OUT))
|
||||
a = ap.parse_args(argv[1:])
|
||||
load = lambda p: json.loads(Path(p).read_text(encoding="utf-8"))
|
||||
try:
|
||||
refs = merge(load(a.bundle), load(a.ext))
|
||||
except MergeError as e:
|
||||
print("error: %s" % e, file=sys.stderr)
|
||||
return 1
|
||||
Path(a.out).write_text(json.dumps(refs, ensure_ascii=False, indent=1) + "\n",
|
||||
encoding="utf-8")
|
||||
print("%d cases -> %s" % (refs["case_count"], a.out))
|
||||
for g, n in refs["groups"].items():
|
||||
print(" %-30s %3d" % (g, n))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -60,9 +60,31 @@ Exit 0 + "DRIVE GATE OK ..." on success; non-zero with a reason on failure.
|
||||
from __future__ import annotations
|
||||
|
||||
import http.server
|
||||
import json
|
||||
import shutil
|
||||
import socketserver
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
# ⛔ THE FIRST RUN IS DECLARED HERE, A COPY OF THE CORE'S, written into the
|
||||
# profile's user.js. Since firefox-55 the engine leaves Mozilla's first-run
|
||||
# lines and invisible_core declares the state (terms of use accepted long ago,
|
||||
# pre-onboarding off). This job installs only Playwright, so nothing declared
|
||||
# it: measured 2026-11-02 on run 41388672849, Windows showed the terms-of-use
|
||||
# modal ("the page did not handle mouse event") and Linux opened
|
||||
# https://www.mozilla.org/en-US/privacy/firefox/ in a second tab (the legacy
|
||||
# data-reporting flow) ("Unexpected number of tabs in the new window: 2").
|
||||
# Upstream Playwright sends its own defaults in Browser.enable, which this
|
||||
# engine refuses, so a raw launch runs on Mozilla's lines alone. With these
|
||||
# three in user.js, both legs drive. tests/test_ci_drive_gate_first_run.py
|
||||
# ties the copy to the core.
|
||||
FIRST_RUN = {
|
||||
"browser.preonboarding.enabled": False,
|
||||
"termsofuse.acceptedVersion": 4,
|
||||
"termsofuse.acceptedDate": "1785573000000",
|
||||
}
|
||||
|
||||
HTML = (
|
||||
"<!doctype html><html><head><title>dt</title></head><body>"
|
||||
@@ -135,10 +157,16 @@ def _drive(exe: str, url: str, level: str) -> str:
|
||||
full = level == "full"
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
# A user.js is read at startup, before the window that would carry the
|
||||
# modal; a persistent context is the only way to hand Playwright a profile.
|
||||
profile_dir = Path(tempfile.mkdtemp(prefix="ci-drive-gate-"))
|
||||
(profile_dir / "user.js").write_bytes(
|
||||
"".join("user_pref(%s, %s);\n" % (json.dumps(k), json.dumps(v))
|
||||
for k, v in sorted(FIRST_RUN.items())).encode("utf-8"))
|
||||
with sync_playwright() as p:
|
||||
browser = p.firefox.launch(executable_path=exe, headless=True)
|
||||
ctx = p.firefox.launch_persistent_context(str(profile_dir), executable_path=exe, headless=True)
|
||||
try:
|
||||
page = browser.new_page()
|
||||
page = ctx.new_page()
|
||||
resp = page.goto(url, wait_until="load")
|
||||
assert resp and resp.ok, f"navigation to {url} failed: {resp.status if resp else 'no response'}"
|
||||
ua = page.evaluate("() => navigator.userAgent")
|
||||
@@ -163,7 +191,8 @@ def _drive(exe: str, url: str, level: str) -> str:
|
||||
inter["langs"] = page.evaluate("() => navigator.languages.length")
|
||||
inter["plugins"] = page.evaluate("() => navigator.plugins instanceof PluginArray")
|
||||
finally:
|
||||
browser.close()
|
||||
ctx.close()
|
||||
shutil.rmtree(profile_dir, ignore_errors=True)
|
||||
|
||||
# SMOKE asserts (always).
|
||||
assert "Firefox" in ua, f"unexpected UA (binary not driving correctly): {ua!r}"
|
||||
@@ -171,7 +200,7 @@ def _drive(exe: str, url: str, level: str) -> str:
|
||||
assert not webdriver, f"navigator.webdriver leaked True (stealth regression): {webdriver!r}"
|
||||
|
||||
if interacts:
|
||||
assert inter["clicked"] == 1, "page.click() did not fire the click listener - mouse-event synthesis broken (firefox-2 class), or a chrome overlay is swallowing input (terms-of-use modal: see browser/app/profile/firefox.js, termsofuse.acceptedDate)"
|
||||
assert inter["clicked"] == 1, "page.click() did not fire the click listener - mouse-event synthesis broken (firefox-2 class), or a chrome overlay is swallowing input (terms-of-use modal: see FIRST_RUN above)"
|
||||
assert inter["moves"] >= 1, "page.mouse.move() produced no mousemove - jugglerSendMouseEvent regression, or a chrome overlay is swallowing input"
|
||||
if full:
|
||||
assert inter["typed"] == "ok", f"page.keyboard.type() failed: {inter['typed']!r}"
|
||||
|
||||
@@ -1,417 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""CI font gate - assert the patched binary exposes exactly the Windows font
|
||||
persona on EVERY host OS (Windows / Linux / macOS), with zero host-font leak.
|
||||
|
||||
The patched binary is bundle-only: at font-list construction it drops every host
|
||||
system font and exposes only the bundled Windows-11 family set (the exposed set
|
||||
IS the bundle). This gate launches the binary on its NATIVE runner - so
|
||||
macOS/CoreText, Linux/fontconfig and Windows/DWrite are each tested for real -
|
||||
enumerates the visible families with the same width-probe web detectors use, and
|
||||
asserts three things:
|
||||
|
||||
1. the detected family set == the canonical Windows set (EXPECTED): the SAME
|
||||
set on all three platforms. A leaked host font or a missing Windows one
|
||||
fails here. This is the "identical on every OS" contract.
|
||||
2. no known host family is visible (macOS: Helvetica Neue / Geneva / Menlo ...;
|
||||
Linux: DejaVu / Ubuntu ...) - a POSITIVE proof that block-at-birth ran for
|
||||
this platform's backend, not just "no obvious tell".
|
||||
3. the CSS generics resolve to Windows fonts (serif=Times New Roman,
|
||||
sans-serif=Arial, monospace=Consolas) and system-ui=Segoe UI.
|
||||
|
||||
This is the macOS validator the local Win/Linux gate cannot be - there is no
|
||||
local Mac, so CoreText is only ever exercised here. Headless, no proxy, no
|
||||
secrets, loopback-free (about:blank + arrow-function evaluate, which is not
|
||||
eval and carries no CSP problem) -> safe in public CI.
|
||||
|
||||
Usage: python ci_font_gate.py <firefox-binary>
|
||||
Exit 0 + "FONT GATE OK ..." on success; non-zero + the diff on failure.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
# The canonical Windows-11 family set the bundle exposes. Verified byte-for-byte
|
||||
# identical on Windows/DWrite and Linux/fontconfig; macOS/CoreText must match it
|
||||
# too. These are the `F|` records that `invisible_core` declares.
|
||||
#
|
||||
# ⛔ THIS IS A LITERAL, and the reason is NOT laziness: verified 2026-08-17 by
|
||||
# reading the workflow that runs it. The font gate runs inside `release.yml`
|
||||
# of the SOURCE repo, in a job that checks out THIS repo but installs only
|
||||
# `playwright==...` and nothing else. Deriving it from `invisible_core` is the
|
||||
# form rule 16 asks for, was written and tried, works locally, and kills EVERY
|
||||
# release with an ImportError.
|
||||
#
|
||||
# And there is a second reason, which survives even if that job someday
|
||||
# installed the core: when the pipeline runs, the PUBLISHED core is still the
|
||||
# one from the previous release, because the core is published AFTER the
|
||||
# binary exists (17-release-seal-spec.md §9). Deriving from there would
|
||||
# measure the new binary against the old declaration.
|
||||
#
|
||||
# What keeps the literal honest is not the attention of whoever edits it: it
|
||||
# is `test_the_family_list_in_the_gate_matches_the_core_manifest`, in
|
||||
# `tests/test_ci_font_gate_declaration.py` of this repo, where the core IS
|
||||
# present. That test did not exist: it was DOCUMENTED as existing and nothing
|
||||
# more, and that is exactly why the list was able to stay at 68 while the
|
||||
# manifest moved to 71 (the two icon Segoes plus Twemoji Mozilla).
|
||||
#
|
||||
# ⛔ AND THE DRIFT DOES NOT GIVE A RED, IT GIVES A GREEN: measured 2026-08-17
|
||||
# on the real binary. The probe queries `EXPECTED + HOST_MUST_BE_ABSENT` and
|
||||
# nothing else, so a family removed from here also stops being LOOKED FOR:
|
||||
# with the three missing, the gate printed `detected 68 families (expected
|
||||
# 68)` and `FONT GATE OK`, exit 0, on a binary that exposes 71. A gate that
|
||||
# agrees with itself cannot see its own drift.
|
||||
EXPECTED = [
|
||||
"Arial", "Bahnschrift", "Calibri", "Cambria", "Cambria Math", "Candara",
|
||||
"Comic Sans MS", "Consolas", "Constantia", "Corbel", "Courier New",
|
||||
"Ebrima", "Franklin Gothic", "Gabriola", "Gadugi", "Georgia", "Impact",
|
||||
"Ink Free", "Javanese Text", "Leelawadee", "Leelawadee UI",
|
||||
"Lucida Console", "Lucida Sans Unicode", "MS Gothic", "MS PGothic",
|
||||
"MS UI Gothic", "MV Boli", "Malgun Gothic", "Marlett",
|
||||
"Microsoft Himalaya", "Microsoft JhengHei", "Microsoft JhengHei UI",
|
||||
"Microsoft New Tai Lue", "Microsoft PhagsPa", "Microsoft Sans Serif",
|
||||
"Microsoft Tai Le", "Microsoft Uighur", "Microsoft YaHei",
|
||||
"Microsoft YaHei UI", "Microsoft Yi Baiti", "MingLiU-ExtB",
|
||||
"Mongolian Baiti", "Myanmar Text", "NSimSun", "Nirmala UI",
|
||||
"PMingLiU-ExtB", "Palatino Linotype", "Segoe Fluent Icons",
|
||||
"Segoe MDL2 Assets", "Segoe Print", "Segoe Script", "Segoe UI",
|
||||
"Segoe UI Emoji", "Segoe UI Historic", "Segoe UI Symbol", "SimSun",
|
||||
"SimSun-ExtB", "Sitka Small", "Sylfaen", "Symbol", "Tahoma",
|
||||
"Times New Roman", "Trebuchet MS", "Twemoji Mozilla", "Verdana",
|
||||
"Webdings", "Wingdings", "Wingdings 2", "Wingdings 3", "Yu Gothic",
|
||||
"Yu Gothic UI",
|
||||
]
|
||||
|
||||
# Host families that must NEVER be visible - one per backend. Their presence is a
|
||||
# hard fail (block-at-birth did not run for this OS). These are decoys added to
|
||||
# the probe list; they must all come back absent.
|
||||
HOST_MUST_BE_ABSENT = [
|
||||
# macOS / CoreText
|
||||
"Helvetica Neue", "Geneva", "Menlo", "Monaco", "Avenir", "Lucida Grande",
|
||||
"Apple SD Gothic Neo", "PingFang SC",
|
||||
# Linux / fontconfig
|
||||
"DejaVu Sans", "Liberation Sans", "Ubuntu", "Nimbus Sans", "Noto Sans",
|
||||
# Office / non-standard families intentionally dropped from the bundle
|
||||
"Century Gothic", "Agency FB", "Monotype Corsiva", "Pristina",
|
||||
]
|
||||
|
||||
# CSS generic -> the Windows family it must resolve to under bundle-only.
|
||||
GENERICS = {
|
||||
"serif": "Times New Roman",
|
||||
"sans-serif": "Arial",
|
||||
"monospace": "Consolas",
|
||||
"system-ui": "Segoe UI",
|
||||
}
|
||||
|
||||
# Families that live inside a .ttc TrueType Collection (several faces packed in
|
||||
# one file). Being *listed* is not enough: without a per-face index the table
|
||||
# lookup reads the first font of the collection, so every other face silently
|
||||
# falls back to a default one. That is invisible to the presence probe below
|
||||
# (the family is registered either way) but wrecks the persona for CJK text.
|
||||
# The FF150->151 rebase dropped exactly that fix and only 7 of these loaded.
|
||||
#
|
||||
# Calibrated on firefox-17, the known-good release: these are the families that
|
||||
# demonstrably render the CJK sample with their own face there. Deliberately
|
||||
# NOT listed: "SimSun-ExtB" (covers Unicode Ext-B, not the BMP characters in
|
||||
# the sample, so it legitimately falls back) and the "... UI" variants of YaHei
|
||||
# and JhengHei (they already fall back on firefox-17, so requiring them would
|
||||
# fail the known-good build). Keep this list as a regression detector, not an
|
||||
# aspiration: everything here loads on firefox-17 and must keep loading.
|
||||
#: A fixed seed, because the declared metrics depend on the profile and a
|
||||
#: gate that changes numbers on every run is not a gate.
|
||||
_SEED = 970411
|
||||
|
||||
#: COPY of zoom.stealth.fonts.generics as invisible_core declares it.
|
||||
#: Constant across seeds (verified on 5). Tied to the core by the test
|
||||
#: test_ci_font_gate_generics_match_the_core, which turns red if they diverge.
|
||||
GENERICS_DECL = (
|
||||
"cursive||Comic Sans MS\n"
|
||||
"serif|x-math|Cambria Math\n"
|
||||
"sans-serif|ja|Yu Gothic UI\n"
|
||||
"serif|ja|Yu Gothic UI\n"
|
||||
"monospace|ja|Yu Gothic UI\n"
|
||||
"sans-serif|ko|Malgun Gothic\n"
|
||||
"serif|ko|Malgun Gothic\n"
|
||||
"monospace|ko|Malgun Gothic\n"
|
||||
"sans-serif|zh-CN|Microsoft YaHei UI\n"
|
||||
"serif|zh-CN|Microsoft YaHei UI\n"
|
||||
"monospace|zh-CN|Microsoft YaHei UI\n"
|
||||
"sans-serif|zh-TW|Microsoft JhengHei UI\n"
|
||||
"serif|zh-TW|Microsoft JhengHei UI\n"
|
||||
"monospace|zh-TW|Microsoft JhengHei UI\n"
|
||||
"sans-serif|zh-HK|Microsoft JhengHei UI\n"
|
||||
"serif|zh-HK|Microsoft JhengHei UI\n"
|
||||
"monospace|zh-HK|Microsoft JhengHei UI\n"
|
||||
"serif||Times New Roman\n"
|
||||
"sans-serif||Arial\n"
|
||||
"monospace||Consolas"
|
||||
)
|
||||
|
||||
|
||||
|
||||
TTC_FAMILIES = [
|
||||
"Microsoft YaHei", "Microsoft YaHei UI",
|
||||
"Microsoft JhengHei", "Microsoft JhengHei UI",
|
||||
"MS Gothic", "MS PGothic", "MS UI Gothic",
|
||||
"SimSun", "NSimSun",
|
||||
"Yu Gothic", "Yu Gothic UI", "Malgun Gothic",
|
||||
"MingLiU-ExtB", "PMingLiU-ExtB",
|
||||
]
|
||||
|
||||
#: The families above grouped by FACE, measured from the ink box. This is the
|
||||
#: invariant the check rests on, and it says two things at once: that every
|
||||
#: face loads (a face that does not load falls into the fallback group, and
|
||||
#: the grouping changes) and that the two platforms answer the same way (the
|
||||
#: values are identical, not just the groups).
|
||||
#:
|
||||
#: The FALLBACK group contains YaHei because YaHei IS the CJK fallback face -
|
||||
#: measured at the pixel level: asking for a nonexistent font produces exactly
|
||||
#: its glyphs. MingLiU-ExtB and PMingLiU-ExtB sit there for a different and
|
||||
#: equally correct reason: they are Extension-B fonts and their cmap does NOT
|
||||
#: cover any of the probe's characters, so the fallback draws as it should.
|
||||
#: The old check asked "does this family measure differently from NO font?"
|
||||
#: and on these four it answered no, deducing that the face had not loaded:
|
||||
#: the question was ill-posed, because the fallback face is itself one of the
|
||||
#: bundled families.
|
||||
EXPECTED_FACE_GROUPS = [
|
||||
# The FALLBACK group. Contains YaHei because YaHei IS the CJK fallback
|
||||
# face, measured at the pixel level: asking for a nonexistent font
|
||||
# produces exactly its glyphs. MingLiU-ExtB and PMingLiU-ExtB sit here for
|
||||
# a different and equally correct reason: they are Extension-B faces and
|
||||
# their cmap does not cover ANY of the probe's characters (verified by
|
||||
# reading the cmap of the bundled files), so the fallback draws as it
|
||||
# should.
|
||||
{"Microsoft YaHei", "Microsoft YaHei UI", "MingLiU-ExtB",
|
||||
"PMingLiU-ExtB", "__NoSuchFontXYZ__"},
|
||||
{"Microsoft JhengHei", "Microsoft JhengHei UI"},
|
||||
{"SimSun", "NSimSun"},
|
||||
{"MS Gothic"},
|
||||
{"MS PGothic"},
|
||||
{"MS UI Gothic"},
|
||||
{"Yu Gothic"},
|
||||
{"Yu Gothic UI"},
|
||||
{"Malgun Gothic"},
|
||||
]
|
||||
|
||||
# Width+height probe (the offsetWidth method real detectors use): a family is
|
||||
# "present" if styling text in it renders at a different size than the three CSS
|
||||
# base generics. For the generics, return the measured size of each generic and
|
||||
# of its target Windows family so the caller can assert they coincide.
|
||||
DETECT_JS = r"""(arg) => {
|
||||
const bases = ['monospace', 'sans-serif', 'serif'];
|
||||
const sample = 'mmmmmmmmmmlli WwQ 0123456789 gjpqy';
|
||||
const sp = document.createElement('span');
|
||||
sp.style.cssText =
|
||||
'position:absolute;left:-9999px;font-size:72px;white-space:nowrap;';
|
||||
sp.textContent = sample;
|
||||
document.body.appendChild(sp);
|
||||
const size = (ff) => { sp.style.fontFamily = ff; return sp.offsetWidth + 'x' + sp.offsetHeight; };
|
||||
const bw = {};
|
||||
for (const b of bases) bw[b] = size(b);
|
||||
const present = {};
|
||||
for (const f of arg.cands) {
|
||||
present[f] = bases.some((b) => size("'" + f + "'," + b) !== bw[b]);
|
||||
}
|
||||
const gen = {};
|
||||
for (const g of arg.generics) gen[g] = size(g);
|
||||
const genref = {};
|
||||
for (const w of arg.targets) genref[w] = size("'" + w + "'");
|
||||
// The INK box of measureText for a CJK string, family by family. Not the
|
||||
// pixels and not the line height, for two measured reasons:
|
||||
// - line height is a value WE DECLARE, so different families can
|
||||
// legitimately share it and the comparison stops distinguishing
|
||||
// anything;
|
||||
// - the pixels of a canvas with text are not readable on Linux (entry
|
||||
// 2026-08-11 in 70-known-bugs.md).
|
||||
// The ink box is geometry derived from the glyphs: measured 2026-08-11 it
|
||||
// is identical to the third digit between Windows and Linux.
|
||||
const c = document.createElement('canvas');
|
||||
const cx = c.getContext('2d');
|
||||
const inkbox = {};
|
||||
for (const f of arg.ttc.concat(['__NoSuchFontXYZ__'])) {
|
||||
cx.font = "56px '" + f + "', '__NoSuchFontXYZ__'";
|
||||
const m = cx.measureText(arg.cjk);
|
||||
inkbox[f] = [m.width, m.actualBoundingBoxAscent, m.actualBoundingBoxDescent,
|
||||
m.actualBoundingBoxLeft, m.actualBoundingBoxRight]
|
||||
.map((v) => Math.round(v * 1000) / 1000).join('|');
|
||||
}
|
||||
document.body.removeChild(sp);
|
||||
return { present, gen, genref, inkbox };
|
||||
}"""
|
||||
|
||||
# ⛔ FOUR PREFS THAT DISABLED THE NEWTAB USED TO SIT HERE, removed 2026-08-20
|
||||
# with the newtab revert, for the same reason as `ci_drive_gate.py`: the
|
||||
# product no longer ships them, and a bench that runs in a configuration
|
||||
# different from what ships measures a different thing.
|
||||
#
|
||||
# The comment used to say "mirrors ci_drive_gate", and that was already false:
|
||||
# it was FOUR here against SIX there, diverged who knows since when. This
|
||||
# removal closes the defect at its root instead of realigning it: now there is
|
||||
# no list to keep in sync, because there is no list at all.
|
||||
#
|
||||
# The race these prefs meant to avoid no longer exists anywhere: it was not
|
||||
# Fission, it was the preallocated new-tab browser grabbing the page's
|
||||
# channel, and it has been fixed in the engine since 2026-08-23
|
||||
# (`20-our-patches.md` §5.2w). No gate waits on anything anymore.
|
||||
_PREFS: dict = {}
|
||||
|
||||
|
||||
# ── The structural limit of this gate, measured and not inferred ─────────
|
||||
#
|
||||
# A page cannot ENUMERATE the system fonts: it can only ask name by name. So
|
||||
# the probe queries `EXPECTED + HOST_MUST_BE_ABSENT` and nothing else, and
|
||||
# from that follows something that needs to be said rather than discovered:
|
||||
# **a family removed from EXPECTED also stops being LOOKED FOR**, so the count
|
||||
# comes out even and the gate passes. Verified 2026-08-11 as a mutation:
|
||||
# deleting "Georgia" from the list, the gate answered "detected 67 families
|
||||
# (expected 67)" and OK.
|
||||
#
|
||||
# It cannot be fixed from the inside: it is the reason the list exists. The
|
||||
# practical consequence is that HOST_MUST_BE_ABSENT must stay GENEROUS,
|
||||
# because it is the only place from which the discovery of an unexpected host
|
||||
# font can arrive. A name that is in neither list is invisible to this gate
|
||||
# by construction.
|
||||
|
||||
|
||||
def main(exe: str) -> int:
|
||||
|
||||
cands = EXPECTED + HOST_MUST_BE_ABSENT
|
||||
arg = {
|
||||
"cands": cands,
|
||||
"generics": list(GENERICS.keys()),
|
||||
"targets": list(GENERICS.values()),
|
||||
"ttc": TTC_FAMILIES,
|
||||
"cjk": "中文字体測試あア漢字",
|
||||
}
|
||||
# RAW launch, and a hand-delivered declaration. The CI gate job installs
|
||||
# only Playwright: invisible_core is not there and cannot be without
|
||||
# changing the workflow, i.e. without rebuilding the five archives.
|
||||
#
|
||||
# The only thing missing from a rawly-launched engine is the generics map.
|
||||
# Measured 2026-08-11 on the same binary: without it,
|
||||
# serif/sans-serif/monospace/cursive/fantasy ALL collapse onto Arial on
|
||||
# Linux (not on Windows, because there Gecko's defaults happen to coincide
|
||||
# with the persona we declare); with it, they map onto Times New Roman,
|
||||
# Arial, Consolas and Comic Sans on BOTH, with the same numbers.
|
||||
#
|
||||
# GENERICS_DECL below is a COPY of what invisible_core declares, and it is
|
||||
# the only one in the project. It cannot diverge silently: it is tied by
|
||||
# the test test_ci_font_gate_generics_match_the_core, which compares this
|
||||
# string against the one the core produces and turns red if they part
|
||||
# ways.
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
prefs = dict(_PREFS)
|
||||
prefs["zoom.stealth.fonts.generics"] = GENERICS_DECL
|
||||
|
||||
# ⛔ Prefs are written into the PROFILE, not sent over the protocol.
|
||||
# Through firefox-20 this was `launch(firefox_user_prefs=prefs)`, which
|
||||
# Playwright delivers to the browser inside `Browser.enable` - i.e. AFTER
|
||||
# startup. From firefox-21 the engine REFUSES it instead of applying it
|
||||
# late:
|
||||
#
|
||||
# Browser.enable no longer applies preferences. They are written into
|
||||
# the profile before startup...
|
||||
#
|
||||
# and that is the right refusal. Applying them after startup means the
|
||||
# first launch initializes gfx and fonts with the defaults and the second
|
||||
# with the prefs active: two different paths, which are the cause of
|
||||
# [B150]. And ignoring them would be worse - a browser without the prefs
|
||||
# the caller believes it set, and no error.
|
||||
#
|
||||
# A `user.js` in the profile is read at STARTUP, so the generics map is
|
||||
# already there when gfx initializes: a single path.
|
||||
profile_dir = Path(tempfile.mkdtemp(prefix="ci-font-gate-"))
|
||||
(profile_dir / "user.js").write_bytes(
|
||||
("".join("user_pref(%s, %s);\n" % (json.dumps(k), json.dumps(v))
|
||||
for k, v in sorted(prefs.items()))).encode("utf-8"))
|
||||
with sync_playwright() as p:
|
||||
ctx = p.firefox.launch_persistent_context(
|
||||
str(profile_dir), executable_path=exe, headless=True)
|
||||
try:
|
||||
page = ctx.new_page()
|
||||
page.goto("about:blank")
|
||||
r = page.evaluate(DETECT_JS, arg)
|
||||
finally:
|
||||
ctx.close()
|
||||
shutil.rmtree(profile_dir, ignore_errors=True)
|
||||
|
||||
detected = {f for f, v in r["present"].items() if v}
|
||||
expected = set(EXPECTED)
|
||||
missing = sorted(expected - detected)
|
||||
# Anything detected that isn't in EXPECTED (host leaks land here too).
|
||||
extra = sorted(detected - expected)
|
||||
leaked_host = [h for h in HOST_MUST_BE_ABSENT if r["present"].get(h)]
|
||||
gen_bad = []
|
||||
for g, want in GENERICS.items():
|
||||
got, ref = r["gen"].get(g), r["genref"].get(want)
|
||||
if got != ref:
|
||||
gen_bad.append(f"{g} -> {got} (expected {want} = {ref})")
|
||||
|
||||
n = len(detected)
|
||||
print(f"[font-gate] {exe}")
|
||||
print(f"[font-gate] detected {n} families (expected {len(EXPECTED)})")
|
||||
if missing:
|
||||
print(f"[font-gate] MISSING (in bundle, not exposed): {missing}")
|
||||
if extra:
|
||||
print(f"[font-gate] UNEXPECTED (exposed, not in canonical set): {extra}")
|
||||
if leaked_host:
|
||||
print(f"[font-gate] HOST LEAK (block-at-birth did not run!): {leaked_host}")
|
||||
if gen_bad:
|
||||
print(f"[font-gate] GENERIC MISMATCH: {gen_bad}")
|
||||
# The face groups, measured now, against the expected ones. A grouping
|
||||
# that changes says a face fell into the fallback; a VALUE that changes
|
||||
# says the declared metrics have shifted, or that the two platforms no
|
||||
# longer answer the same way. These are two different defects and the
|
||||
# message keeps them apart.
|
||||
ink = r.get("inkbox", {})
|
||||
seen = {}
|
||||
for fam, box in ink.items():
|
||||
seen.setdefault(box, []).append(fam)
|
||||
# The STRUCTURE is compared - which families share a face - not the
|
||||
# values. The values are identical between Windows and Linux only when the
|
||||
# browser receives all its declarations, and this gate launches it raw
|
||||
# because the CI job has no invisible_core: on a raw launch Linux returns
|
||||
# integer bounds (FreeType's grid-fit) while Windows returns fractions.
|
||||
# The structure coincides instead, and it is what answers the question
|
||||
# "did this face load?" - a face that does not load FALLS into the
|
||||
# fallback group and the grouping changes. Cross-OS parity of the values
|
||||
# is a different check, one that has to be done under the wrapper where
|
||||
# all the declarations are present.
|
||||
measured = [set(f) for f in seen.values()]
|
||||
face_bad = []
|
||||
for expected_group in EXPECTED_FACE_GROUPS:
|
||||
if expected_group not in measured:
|
||||
nearest = max(measured, key=lambda g: len(g & expected_group), default=set())
|
||||
face_bad.append(f"expected group {sorted(expected_group)} not found; "
|
||||
f"the closest measured is {sorted(nearest)}")
|
||||
for g in measured:
|
||||
if g not in EXPECTED_FACE_GROUPS:
|
||||
face_bad.append(f"unexpected group: {sorted(g)}")
|
||||
if face_bad:
|
||||
print("[font-gate] FACES: the grouping is not the expected one")
|
||||
for line in face_bad:
|
||||
print(f"[font-gate] {line}")
|
||||
|
||||
ok = (not missing and not extra and not leaked_host and not gen_bad
|
||||
and not face_bad)
|
||||
if ok:
|
||||
print(f"FONT GATE OK - exactly the {n} Windows families, host-leak 0, "
|
||||
f"generics map to Windows (serif/sans/mono/system-ui), "
|
||||
f"{len(EXPECTED_FACE_GROUPS)} face groups over "
|
||||
f"{len(TTC_FAMILIES)} CJK families (every declared face draws "
|
||||
f"its own glyphs).")
|
||||
return 0
|
||||
print("FONT GATE FAILED - the exposed set does not match the Windows "
|
||||
"persona on this OS (see the diff above).")
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) < 2:
|
||||
print("usage: python ci_font_gate.py <firefox-binary>", file=sys.stderr)
|
||||
raise SystemExit(2)
|
||||
raise SystemExit(main(sys.argv[1]))
|
||||
@@ -0,0 +1,606 @@
|
||||
#!/usr/bin/env python3
|
||||
"""CI host gate: what a page reads is a function of the declared identity and of
|
||||
Firefox's code, never of the machine the browser runs on.
|
||||
|
||||
Two properties follow, and they are checked for every value the page dumps
|
||||
(whole APIs, not a hand-picked list), so the gate needs no knowledge of where
|
||||
the next leak will be:
|
||||
|
||||
1. HOST-INDEPENDENCE. The same identity on different hosts (the Windows and
|
||||
Linux x86_64 legs) gives the same bytes.
|
||||
2. RETAIL EQUALITY. A value that does not depend on the identity equals what
|
||||
retail Firefox for Windows answers on the same page, at the same device
|
||||
pixel ratio.
|
||||
|
||||
Values are compared leaf by leaf: an object the page reads (navigator, screen)
|
||||
mixes fields the identity decides with fields it does not, and each is held to
|
||||
its own property.
|
||||
|
||||
Which values depend on the identity is measured AND declared. Each leg visits
|
||||
the page with several seeds at a fixed DPR; a value that changes with the seed
|
||||
depends on the identity and is held to property 1 only. A value the identity
|
||||
decides can still come out the same for every seed (16 cores, a 1920x1080
|
||||
screen), so those are declared as well.
|
||||
|
||||
The only exceptions live in host_gate/exceptions.json, each with its reason:
|
||||
- identity: values the declared identity decides; exempt from property 2,
|
||||
never from property 1;
|
||||
- noise: values that differ between two launches of retail itself;
|
||||
- network: values the identity takes from the network (language and zone
|
||||
from the egress IP), which CI without a proxy cannot reproduce;
|
||||
- measurement: values that record how the reference was taken rather than
|
||||
what Firefox answers (focus, on the hidden desktop retail ran on);
|
||||
- known_defects: open divergences with the work that closes them. This list
|
||||
only shrinks: an entry that no longer matches a difference fails the gate,
|
||||
so it is removed when its fix lands.
|
||||
|
||||
Values under the diag. prefix are not held to either property. They are
|
||||
information the page records about the host (diag.webgl: whether WebGL2 and
|
||||
multisampling exist there and, when not, the message Firefox gives): the legs
|
||||
legitimately differ on them and the retail reference does not record them.
|
||||
compare() skips them by name; dump() prints them into the job log, so a run
|
||||
tells why without its artifacts being downloaded.
|
||||
|
||||
Values under the state. prefix are the window in the states a page can drive
|
||||
it to: state.normal, state.fullscreen (entered through a real click, a user
|
||||
gesture) and state.after_fullscreen. The dump measures them after the page is
|
||||
done (drive_states). Besides the two properties they are held to INVARIANTS:
|
||||
relations between values that hold on every host, for every identity and
|
||||
whatever the reference says, because a window that breaks them cannot exist
|
||||
(an outer window smaller than its viewport, a fullscreen window off the
|
||||
screen's origin). Each value can look plausible on its own; only the relation
|
||||
shows the defect, so these are checked even where nothing else is.
|
||||
|
||||
This replaces ci_font_gate.py, which checked one surface (the font list) of
|
||||
the same rule.
|
||||
|
||||
python ci_host_gate.py dump <firefox> --leg linux-x86_64 --out dumps/
|
||||
python ci_host_gate.py compare dumps/ (reference: host_gate/reference/firefox-159)
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import base64
|
||||
import fnmatch
|
||||
import gzip
|
||||
import json
|
||||
import sys
|
||||
import threading
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from pathlib import Path
|
||||
from typing import Callable, NamedTuple
|
||||
|
||||
HERE = Path(__file__).resolve().parent / "host_gate"
|
||||
PAGE = HERE / "host_gate_page.html"
|
||||
EXCEPTIONS = HERE / "exceptions.json"
|
||||
REFERENCE = HERE / "reference" / "firefox-159"
|
||||
FORMAT = "host-gate/1"
|
||||
|
||||
#: DPRs the reference is recorded at, and the seeds visited at each. Three seeds
|
||||
#: so that a value that depends on the identity is very unlikely to look
|
||||
#: constant by chance.
|
||||
DPRS = (1.0, 1.5)
|
||||
SEEDS = (11, 12, 13)
|
||||
|
||||
#: The leg every other leg is compared with: the platform the identity claims.
|
||||
ANCHOR = "win-x86_64"
|
||||
|
||||
#: Keys under this prefix are information, never compared (see the module docstring).
|
||||
DIAG = "diag."
|
||||
|
||||
|
||||
def is_diag(key: str) -> bool:
|
||||
return key.startswith(DIAG)
|
||||
|
||||
|
||||
def diag_lines(items: dict, before: dict | None = None) -> list:
|
||||
"""The diag. leaves of one visit as 'key = value' lines; with before (an
|
||||
earlier visit's diag leaves), only the keys whose value changed."""
|
||||
now = {k: v for k, v in leaves(items).items() if is_diag(k)}
|
||||
lines = [" %s = %s" % (k, json.dumps(v, sort_keys=True)) for k, v in now.items()
|
||||
if before is None or before.get(k, "<missing>") != v]
|
||||
return lines + [" %s = <missing>" % k for k in (before or {}) if k not in now]
|
||||
|
||||
|
||||
def diag_report(visit: str, items: dict, first: dict | None) -> list:
|
||||
"""What dump() prints for one visit: every diag. value on the leg's first
|
||||
visit (first is None), then only what changed from it."""
|
||||
if first is None:
|
||||
return ["diag %s:" % visit] + (diag_lines(items) or [" (the page recorded no diag. keys)"])
|
||||
changed = diag_lines(items, first)
|
||||
return ["diag %s: %s" % (visit, "changed from the first visit:" if changed else "as the first visit")] + changed
|
||||
|
||||
|
||||
# -
|
||||
# States: the window driven to fullscreen and back with real input, and the
|
||||
# relations its values must keep in every state.
|
||||
|
||||
STATE = "state."
|
||||
|
||||
#: The states drive_states measures, in the order it reaches them.
|
||||
STATES = ("normal", "fullscreen", "after_fullscreen")
|
||||
|
||||
#: How long the page waits for fullscreenchange before recording 'timeout'.
|
||||
STATE_TIMEOUT_MS = 5000
|
||||
|
||||
#: Retail equality for these namespaces waits for the reference to record them.
|
||||
#: The firefox-159 reference was taken before the dump drove any state, so it has
|
||||
#: no state.* key; until it has, a state.* value is held to host-independence and
|
||||
#: to INVARIANTS only, and compare() notes it. The session that produces the
|
||||
#: reference adds, to the items of each dpr<x>.json.gz, the three items
|
||||
#: state.normal, state.fullscreen and state.after_fullscreen, shaped exactly as
|
||||
#: drive_states returns them, by running drive_states on retail Firefox for
|
||||
#: Windows on this page with evaluate = run the expression in the page, and move
|
||||
#: and click = OS-level input at those viewport (CSS px) points, e.g. SendInput:
|
||||
#: a click a script dispatches is not a user gesture and requestFullscreen
|
||||
#: refuses it. From the first reference that has state.*, these values are
|
||||
#: compared with retail like every other; the window geometry is declared
|
||||
#: identity in exceptions.json, the rest (display-mode, fullscreenElement,
|
||||
#: window.fullScreen, how the transition went) is held to retail.
|
||||
REFERENCE_PENDING = (STATE,)
|
||||
|
||||
|
||||
def drive_states(evaluate: Callable, move: Callable, click: Callable,
|
||||
timeout_ms: int = STATE_TIMEOUT_MS) -> dict:
|
||||
"""The page's window in each of STATES, as items {state.<name>: values}.
|
||||
|
||||
evaluate runs an expression in the page and returns its (awaited) value;
|
||||
move and click are real input at a viewport point. In each state the mouse
|
||||
moves twice and clicks on the middle of the viewport, so every value of the
|
||||
state comes with the screen - client offsets of real mouse events.
|
||||
Fullscreen is entered by clicking the page's button (its handler calls
|
||||
requestFullscreen) and left with document.exitFullscreen(); each transition
|
||||
records how it ended (fullscreenchange, fullscreenerror, timeout). Whatever
|
||||
raises leaves {"error": ...} in the states not measured yet, which the
|
||||
'measured' invariant reports.
|
||||
"""
|
||||
states = {}
|
||||
|
||||
def measure(name, transition=None):
|
||||
evaluate("__hostGateStates.clear()")
|
||||
w, h = evaluate("[innerWidth, innerHeight]")
|
||||
x, y = w // 2, h // 2
|
||||
move(x - 20, y)
|
||||
move(x, y + 20)
|
||||
click(x, y + 20)
|
||||
values = evaluate("__hostGateStates.measure()")
|
||||
if transition is not None:
|
||||
values["transition"] = transition
|
||||
states[name] = values
|
||||
|
||||
try:
|
||||
button = evaluate("__hostGateStates.prepare()")
|
||||
measure("normal")
|
||||
evaluate("__hostGateStates.arm(%d)" % timeout_ms)
|
||||
click(button["x"], button["y"])
|
||||
measure("fullscreen", evaluate("__hostGateStates.wait()"))
|
||||
evaluate("__hostGateStates.leave(%d)" % timeout_ms)
|
||||
measure("after_fullscreen", evaluate("__hostGateStates.wait()"))
|
||||
except Exception as e: # noqa: BLE001 - recorded, and failed by the 'measured' invariant
|
||||
for name in STATES:
|
||||
states.setdefault(name, {"error": "%s: %s" % (type(e).__name__, str(e)[:300])})
|
||||
return {STATE + name: states[name] for name in STATES}
|
||||
|
||||
|
||||
#: What a state is made of; the screen is {width, height, availWidth, availHeight}.
|
||||
POSITION = ("innerWidth", "innerHeight", "outerWidth", "outerHeight", "screenX", "screenY",
|
||||
"mozInnerScreenX", "mozInnerScreenY", "screen")
|
||||
FIELDS = POSITION + ("display_mode_fullscreen", "fullscreen_element", "events")
|
||||
|
||||
|
||||
def _measured(s, states):
|
||||
if "error" in s:
|
||||
return "not measured: %s" % s["error"]
|
||||
missing = [f for f in FIELDS if f not in s]
|
||||
missing += ["%s as a number" % f for f in POSITION[:-1]
|
||||
if f in s and (isinstance(s[f], bool) or not isinstance(s[f], (int, float)))]
|
||||
if not isinstance(s.get("screen"), dict) or not {"width", "height", "availWidth", "availHeight"} <= set(s["screen"]):
|
||||
missing.append("screen.width/height/availWidth/availHeight")
|
||||
if not isinstance(s.get("events"), dict):
|
||||
missing.append("events as {type: [[dx, dy]]}")
|
||||
return missing and "not measured: no %s" % ", ".join(missing)
|
||||
|
||||
|
||||
def _transition(s, states):
|
||||
t = s.get("transition")
|
||||
if not isinstance(t, dict) or t.get("how") != "fullscreenchange" or not t.get("settled"):
|
||||
return "the transition did not complete: %s" % json.dumps(t, sort_keys=True)
|
||||
|
||||
|
||||
def _outer_holds_inner(s, states):
|
||||
bad = ["outer%s %s < inner%s %s" % (d, s["outer" + d], d, s["inner" + d])
|
||||
for d in ("Width", "Height") if s["outer" + d] < s["inner" + d]]
|
||||
return "; ".join(bad)
|
||||
|
||||
|
||||
def _is_the_screen(s, states):
|
||||
w, h = s["screen"]["width"], s["screen"]["height"]
|
||||
bad = ["%s %s" % (k, s[k]) for k, want in (("innerWidth", w), ("outerWidth", w),
|
||||
("innerHeight", h), ("outerHeight", h)) if s[k] != want]
|
||||
return bad and "%s, screen %sx%s (avail %sx%s)" % (", ".join(bad), w, h,
|
||||
s["screen"]["availWidth"], s["screen"]["availHeight"])
|
||||
|
||||
|
||||
def _at_origin(s, states):
|
||||
bad = ["%s %s" % (k, s[k]) for k in ("screenX", "screenY", "mozInnerScreenX", "mozInnerScreenY") if s[k] != 0]
|
||||
return ", ".join(bad)
|
||||
|
||||
|
||||
def _declares(fullscreen):
|
||||
def check(s, states):
|
||||
bad = ["%s %s" % (k, json.dumps(s[k])) for k in ("display_mode_fullscreen", "fullscreen_element")
|
||||
if s[k] is not fullscreen]
|
||||
return ", ".join(bad)
|
||||
return check
|
||||
|
||||
|
||||
def _offset_matches(offset, inner_screen):
|
||||
# MouseEvent.screenX and clientX are each rounded to a whole CSS px, while
|
||||
# mozInnerScreenX is the viewport's exact offset, fractional when the DPR
|
||||
# does not divide the window's device position (85.33 at 1.5): the
|
||||
# difference of the two rounded values is then within 1 px of it. A whole
|
||||
# offset has nothing to round and must match exactly.
|
||||
if float(inner_screen).is_integer():
|
||||
return offset == inner_screen
|
||||
return abs(offset - inner_screen) <= 1
|
||||
|
||||
|
||||
def _events_at_inner_screen(s, states):
|
||||
if not any(s["events"].values()):
|
||||
return "no mouse event was recorded"
|
||||
inner = (s["mozInnerScreenX"], s["mozInnerScreenY"])
|
||||
bad = ["%s (%s, %s)" % (typ, dx, dy) for typ, pairs in sorted(s["events"].items()) for dx, dy in pairs
|
||||
if not (_offset_matches(dx, inner[0]) and _offset_matches(dy, inner[1]))]
|
||||
return bad and "screen - client of %s, mozInnerScreen (%s, %s)" % (", ".join(bad), inner[0], inner[1])
|
||||
|
||||
|
||||
def _screen_stays(s, states):
|
||||
normal = states.get("normal")
|
||||
if not isinstance(normal, dict) or not isinstance(normal.get("screen"), dict):
|
||||
return None # the normal state's own 'measured' failure says why
|
||||
bad = ["screen.%s %s (normal %s)" % (k, s["screen"][k], normal["screen"].get(k))
|
||||
for k in ("width", "height") if s["screen"][k] != normal["screen"].get(k)]
|
||||
return ", ".join(bad)
|
||||
|
||||
|
||||
def _back_to_normal(s, states):
|
||||
normal = states.get("normal")
|
||||
if not isinstance(normal, dict) or _measured(normal, states):
|
||||
return None # the normal state's own 'measured' failure says why
|
||||
bad = ["%s %s (normal %s)" % (k, json.dumps(s[k]), json.dumps(normal[k])) for k in POSITION if s[k] != normal[k]]
|
||||
return ", ".join(bad)
|
||||
|
||||
|
||||
class Invariant(NamedTuple):
|
||||
name: str
|
||||
states: tuple
|
||||
check: Callable # (state values, every state's values) -> failure message, or a false value
|
||||
why: str
|
||||
|
||||
|
||||
#: Every relation the states are held to, the only place they are declared.
|
||||
#: 'measured' runs first: the others assume the state's fields are there.
|
||||
INVARIANTS = (
|
||||
Invariant("measured", STATES, _measured,
|
||||
"a state the dump could not reach or read is a failure, never a silent pass"),
|
||||
Invariant("transition", ("fullscreen", "after_fullscreen"), _transition,
|
||||
"a real click is a user gesture, so retail enters and leaves fullscreen and the window then holds still; "
|
||||
"a timeout or fullscreenerror means the window did not do what a user's does"),
|
||||
Invariant("outer_holds_inner", STATES, _outer_holds_inner,
|
||||
"the outer window contains the viewport: a smaller outer window cannot exist "
|
||||
"(the defect it was written for: 1936x1048 outer under a 1920x1080 viewport in fullscreen)"),
|
||||
Invariant("fullscreen_is_the_screen", ("fullscreen",), _is_the_screen,
|
||||
"in fullscreen retail has no frame, toolbar or taskbar: viewport, window and screen are one rectangle "
|
||||
"(a viewport at availHeight is a window that never really went fullscreen)"),
|
||||
Invariant("fullscreen_at_origin", ("fullscreen",), _at_origin,
|
||||
"a fullscreen window sits at the screen's origin and its viewport at the window's: "
|
||||
"screenX/Y and mozInnerScreenX/Y are 0 (not a maximized window's -8/-8 and 85)"),
|
||||
Invariant("fullscreen_declared", ("fullscreen",), _declares(True),
|
||||
"the page entered fullscreen, so CSS (display-mode) and the DOM (fullscreenElement) say so"),
|
||||
Invariant("not_fullscreen", ("normal", "after_fullscreen"), _declares(False),
|
||||
"outside fullscreen neither CSS nor the DOM may claim it; it also keeps 'back_to_normal' "
|
||||
"from passing with both states stuck in fullscreen"),
|
||||
Invariant("events_at_inner_screen", STATES, _events_at_inner_screen,
|
||||
"an event's screen point is its client point plus where the viewport sits on the screen, "
|
||||
"which is mozInnerScreenX/Y: screen - client of every mouse event equals it"),
|
||||
Invariant("screen_stays", ("fullscreen", "after_fullscreen"), _screen_stays,
|
||||
"fullscreen changes the window, not the monitor: screen.width/height are the normal state's"),
|
||||
Invariant("back_to_normal", ("after_fullscreen",), _back_to_normal,
|
||||
"leaving fullscreen puts the window back as it was: every size and position is the normal state's"),
|
||||
)
|
||||
|
||||
|
||||
def check_invariants(states: dict) -> list:
|
||||
"""Every broken invariant of one visit as (invariant, state, message).
|
||||
states maps each of STATES to its values (None when the dump has none)."""
|
||||
broken = []
|
||||
for state in STATES:
|
||||
s = states.get(state)
|
||||
if not isinstance(s, dict):
|
||||
s = {"error": "the dump has no %s%s" % (STATE, state)}
|
||||
for inv in INVARIANTS:
|
||||
if state not in inv.states:
|
||||
continue
|
||||
message = inv.check(s, states)
|
||||
if message:
|
||||
broken.append((inv, state, message))
|
||||
if inv.name == "measured":
|
||||
break
|
||||
return broken
|
||||
|
||||
|
||||
def visit_states(items: dict) -> dict:
|
||||
return {name: items.get(STATE + name) for name in STATES}
|
||||
|
||||
|
||||
def invariant_lines(visit: str, items: dict) -> list:
|
||||
return ["invariant %s %s %s%s: %s (why: %s)" % (inv.name, visit, STATE, state, message, inv.why)
|
||||
for inv, state, message in check_invariants(visit_states(items))]
|
||||
|
||||
|
||||
# -
|
||||
# Dump: one leg, every (dpr, seed) visit, the way the reference was measured:
|
||||
# the page over http://127.0.0.1 (a secure context), en-US, the zone the retail
|
||||
# reference reported (retail on Windows ignores TZ and answers the machine's),
|
||||
# the device pixel ratio pinned in the persona, no drawn cursor.
|
||||
|
||||
class _Page(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
body = PAGE.read_bytes()
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/html; charset=utf-8")
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def do_POST(self): # the page also posts its result; the dump reads it from the page
|
||||
self.rfile.read(int(self.headers.get("Content-Length") or 0))
|
||||
self.send_response(204)
|
||||
self.end_headers()
|
||||
|
||||
def log_message(self, *args):
|
||||
pass
|
||||
|
||||
|
||||
def reference_items(reference: Path, dpr: float) -> dict | None:
|
||||
"""Retail's items at one DPR, from dpr<x>.json.gz (or a plain dpr<x>.json)."""
|
||||
for name in ("dpr%s.json.gz" % dpr, "dpr%s.json" % dpr):
|
||||
path = reference / name
|
||||
if path.is_file():
|
||||
raw = path.read_bytes()
|
||||
return json.loads(gzip.decompress(raw) if name.endswith(".gz") else raw)["items"]
|
||||
return None
|
||||
|
||||
|
||||
def reference_zone(reference: Path) -> str:
|
||||
return reference_items(reference, 1.0)["surface.intl"]["DateTimeFormat"]["timeZone"]
|
||||
|
||||
|
||||
def visit_options(firefox: str, seed: int, dpr: float, zone: str) -> dict:
|
||||
"""The launch of one (dpr, seed) visit. The DPR is PINNED in the persona
|
||||
(screen.dpr), so the core declares a screen, a work area and a window made
|
||||
at that scale. It used to be forced through
|
||||
extra_prefs={"layout.css.devPixelsPerPx": ...} on whatever persona the seed
|
||||
drew: a 100% persona at 1.5 read innerWidth 1920 inside an outerWidth of
|
||||
1291 (run 41325657085), an identity no machine has, which the engine now
|
||||
refuses to start with."""
|
||||
return {"seed": seed, "binary_path": firefox, "headless": True, "show_cursor": False,
|
||||
"locale": "en-US", "timezone": zone, "pin": {"screen.dpr": dpr}}
|
||||
|
||||
|
||||
def dump(firefox: str, leg: str, out: Path, reference: Path, timeout_ms: int = 180_000) -> int:
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
server = ThreadingHTTPServer(("127.0.0.1", 0), _Page)
|
||||
threading.Thread(target=server.serve_forever, daemon=True).start()
|
||||
zone = reference_zone(reference)
|
||||
first_diag = None
|
||||
try:
|
||||
for dpr in DPRS:
|
||||
for seed in SEEDS:
|
||||
with InvisiblePlaywright(**visit_options(firefox, seed, dpr, zone)) as browser:
|
||||
page = browser.new_context().new_page()
|
||||
# The same budget as the wait below: a cold Windows runner took
|
||||
# more than goto's default 30 s to reach `load` on the first
|
||||
# visit (candidate 42410156024), and passed locally 6/6.
|
||||
page.goto("http://127.0.0.1:%d/?dpr%s" % (server.server_address[1], dpr),
|
||||
timeout=timeout_ms)
|
||||
page.wait_for_function("document.title === 'done'", timeout=timeout_ms)
|
||||
result = page.evaluate("window.__hostGate")
|
||||
if result.get("format") == FORMAT:
|
||||
result["items"].update(drive_states(page.evaluate, page.mouse.move, page.mouse.click))
|
||||
if result.get("format") != FORMAT:
|
||||
print("the page answered format %r, not %r" % (result.get("format"), FORMAT))
|
||||
return 2
|
||||
path = out / ("%s_dpr%s_seed%d.json" % (leg, dpr, seed))
|
||||
path.write_text(json.dumps({"leg": leg, "dpr": dpr, "seed": seed, "result": result}),
|
||||
encoding="utf-8")
|
||||
print("dumped %s: %d items" % (path.name, len(result["items"])))
|
||||
visit = "%s dpr %s seed %d" % (leg, dpr, seed)
|
||||
for line in diag_report(visit, result["items"], first_diag):
|
||||
print(line)
|
||||
# told here too, so the job log says it without the compare step
|
||||
for line in invariant_lines(visit, result["items"]):
|
||||
print(line)
|
||||
sys.stdout.flush()
|
||||
if first_diag is None:
|
||||
first_diag = {k: v for k, v in leaves(result["items"]).items() if is_diag(k)}
|
||||
finally:
|
||||
server.shutdown()
|
||||
return 0
|
||||
|
||||
|
||||
# -
|
||||
# Compare: every leg, every visit, against each other and against retail.
|
||||
|
||||
KINDS = ("identity", "noise", "network", "measurement", "known_defects")
|
||||
|
||||
|
||||
def load_exceptions(path: Path = EXCEPTIONS) -> dict:
|
||||
data = json.loads(path.read_text(encoding="utf-8"))
|
||||
unknown = set(data) - set(KINDS)
|
||||
if unknown:
|
||||
raise SystemExit("exceptions.json: unknown kinds %s" % sorted(unknown))
|
||||
for kind in KINDS:
|
||||
for entry in data.get(kind, []):
|
||||
if not entry.get("keys") or not entry.get("why"):
|
||||
raise SystemExit("exceptions.json: every %s entry needs keys and why" % kind)
|
||||
return data
|
||||
|
||||
|
||||
def matching(entries: list, key: str, leg: str | None = None) -> list:
|
||||
return [e for e in entries
|
||||
if any(fnmatch.fnmatchcase(key, p) for p in e["keys"])
|
||||
and (leg is None or not e.get("legs") or leg in e["legs"])]
|
||||
|
||||
|
||||
def is_image(value) -> bool:
|
||||
return isinstance(value, dict) and "data" in value and "enc" in value
|
||||
|
||||
|
||||
def leaves(items: dict) -> dict:
|
||||
"""Every value as a leaf with a dotted key; an image stays one value."""
|
||||
out = {}
|
||||
|
||||
def walk(key, value):
|
||||
if isinstance(value, dict) and value and not is_image(value):
|
||||
for k, v in value.items():
|
||||
walk("%s.%s" % (key, k), v)
|
||||
else:
|
||||
out[key] = value
|
||||
|
||||
for key, value in items.items():
|
||||
walk(key, value)
|
||||
return out
|
||||
|
||||
|
||||
def describe(a, b) -> str:
|
||||
"""A short account of a difference; for images, how many bytes differ."""
|
||||
if isinstance(a, dict) and isinstance(b, dict) and "data" in a and "data" in b:
|
||||
x, y = base64.b64decode(a["data"]), base64.b64decode(b["data"])
|
||||
if len(x) != len(y) or (a.get("w"), a.get("h")) != (b.get("w"), b.get("h")):
|
||||
return "image %sx%s vs %sx%s" % (a.get("w"), a.get("h"), b.get("w"), b.get("h"))
|
||||
diff = [abs(p - q) for p, q in zip(x, y) if p != q]
|
||||
return "image: %d of %d bytes differ, max delta %d" % (len(diff), len(x), max(diff, default=0))
|
||||
text = lambda v: json.dumps(v, sort_keys=True)[:120]
|
||||
return "%s vs %s" % (text(a), text(b))
|
||||
|
||||
|
||||
def compare(dumps: Path, reference: Path, exceptions: dict, notes: list | None = None) -> list:
|
||||
"""Every failure as one line. Empty means the gate passes. notes, when
|
||||
given, receives what was not checked and why (REFERENCE_PENDING)."""
|
||||
visits = {} # (leg, dpr, seed) -> items
|
||||
failures = []
|
||||
for path in sorted(dumps.glob("*.json")):
|
||||
d = json.loads(path.read_text(encoding="utf-8"))
|
||||
items = d["result"]["items"]
|
||||
visits[(d["leg"], d["dpr"], d["seed"])] = {k: v for k, v in leaves(items).items() if not is_diag(k)}
|
||||
# the invariants: every leg, every visit, every state; no exception and no reference applies
|
||||
failures += invariant_lines("%s dpr %s seed %d" % (d["leg"], d["dpr"], d["seed"]), items)
|
||||
if not visits:
|
||||
return ["no dumps in %s" % dumps]
|
||||
legs = sorted({k[0] for k in visits})
|
||||
refs = {}
|
||||
pending = {} # dpr -> the REFERENCE_PENDING namespaces the reference does not record yet
|
||||
for dpr in DPRS:
|
||||
items = reference_items(reference, dpr)
|
||||
if items is None:
|
||||
return ["no retail reference for dpr %s in %s" % (dpr, reference)]
|
||||
refs[dpr] = {k: v for k, v in leaves(items).items() if not is_diag(k)}
|
||||
pending[dpr] = tuple(p for p in REFERENCE_PENDING if not any(k.startswith(p) for k in refs[dpr]))
|
||||
for p in pending[dpr]:
|
||||
if notes is not None:
|
||||
notes.append("the retail reference has no %s* at dpr %s: those values are held to "
|
||||
"host-independence and the invariants, not to retail" % (p, dpr))
|
||||
|
||||
identity = exceptions.get("identity", [])
|
||||
excusable = exceptions.get("noise", []) + exceptions.get("network", []) + exceptions.get("measurement", [])
|
||||
known = exceptions.get("known_defects", [])
|
||||
used = set()
|
||||
|
||||
def excused(key, leg):
|
||||
if matching(excusable, key):
|
||||
return True
|
||||
hit = matching(known, key, leg)
|
||||
for e in hit:
|
||||
used.add(id(e))
|
||||
return bool(hit)
|
||||
|
||||
for dpr in DPRS:
|
||||
for leg in legs:
|
||||
missing = [s for s in SEEDS if (leg, dpr, s) not in visits]
|
||||
if missing:
|
||||
failures.append("%s dpr %s: no dump for seeds %s" % (leg, dpr, missing))
|
||||
present = [(leg, s) for leg in legs for s in SEEDS if (leg, dpr, s) in visits]
|
||||
keys = sorted(set().union(*(visits[(l, dpr, s)].keys() for l, s in present)) | set(refs[dpr]))
|
||||
for key in keys:
|
||||
# 1. host-independence: for each seed, every leg gives the Windows
|
||||
# leg's value. Windows is the anchor because it is the platform the
|
||||
# identity claims: a leg that differs from it is the one that moved.
|
||||
for seed in SEEDS:
|
||||
values = {leg: visits[(leg, dpr, seed)].get(key, "<missing>")
|
||||
for leg in legs if (leg, dpr, seed) in visits}
|
||||
base = ANCHOR if ANCHOR in values else next(iter(values), None)
|
||||
for leg, value in values.items():
|
||||
if leg != base and value != values[base] and not excused(key, leg):
|
||||
failures.append("host %s dpr %s seed %d: %s differs from %s: %s"
|
||||
% (key, dpr, seed, leg, base, describe(value, values[base])))
|
||||
# 1b. host-independence among the legs of one OS (two Linux
|
||||
# distributions): a known defect excuses a difference from Windows,
|
||||
# never one between two machines of the same system, whose libraries
|
||||
# (FreeType, fontconfig, Mesa) are the host's and must not show.
|
||||
for seed in SEEDS:
|
||||
for family in sorted({l.split("-")[0] for l in legs}):
|
||||
same_os = [l for l in legs if l.split("-")[0] == family and (l, dpr, seed) in visits]
|
||||
for leg in same_os[1:]:
|
||||
value = visits[(leg, dpr, seed)].get(key, "<missing>")
|
||||
first = visits[(same_os[0], dpr, seed)].get(key, "<missing>")
|
||||
if value != first and not matching(excusable, key):
|
||||
failures.append("host %s dpr %s seed %d: %s differs from %s (same OS): %s"
|
||||
% (key, dpr, seed, leg, same_os[0], describe(value, first)))
|
||||
# 2. retail equality, for a value that is the same for every seed
|
||||
if key.startswith(pending[dpr]):
|
||||
continue
|
||||
for leg in legs:
|
||||
per_seed = [visits[(leg, dpr, s)].get(key, "<missing>")
|
||||
for s in SEEDS if (leg, dpr, s) in visits]
|
||||
if len({json.dumps(v, sort_keys=True) for v in per_seed}) != 1 or matching(identity, key):
|
||||
continue # depends on the identity: property 1 only
|
||||
retail = refs[dpr].get(key, "<missing>")
|
||||
if per_seed[0] != retail and not excused(key, leg):
|
||||
failures.append("retail %s dpr %s on %s: %s"
|
||||
% (key, dpr, leg, describe(per_seed[0], retail)))
|
||||
|
||||
for e in known:
|
||||
if id(e) not in used:
|
||||
failures.append("known defect no longer seen, remove it from exceptions.json: %s (%s)"
|
||||
% (e["keys"], e["why"]))
|
||||
return failures
|
||||
|
||||
|
||||
def main(argv=None) -> int:
|
||||
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
||||
sub = ap.add_subparsers(dest="cmd", required=True)
|
||||
d = sub.add_parser("dump")
|
||||
d.add_argument("firefox")
|
||||
d.add_argument("--leg", required=True)
|
||||
d.add_argument("--out", type=Path, required=True)
|
||||
d.add_argument("--reference", type=Path, default=REFERENCE)
|
||||
c = sub.add_parser("compare")
|
||||
c.add_argument("dumps", type=Path)
|
||||
c.add_argument("--reference", type=Path, default=REFERENCE)
|
||||
args = ap.parse_args(argv)
|
||||
if args.cmd == "dump":
|
||||
return dump(args.firefox, args.leg, args.out, args.reference)
|
||||
notes = []
|
||||
failures = compare(args.dumps, args.reference, load_exceptions(), notes)
|
||||
for n in notes:
|
||||
print("NOTE " + n)
|
||||
for f in failures:
|
||||
print("FAIL " + f)
|
||||
print("HOST GATE %s: %d failures" % ("OK" if not failures else "FAILED", len(failures)))
|
||||
return 1 if failures else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,50 @@
|
||||
"""Which canvas text cases two runs draw differently.
|
||||
|
||||
tests/test_canvas_text_is_windows_e2e.py writes canvas_text_<tag>.json (case id -> SHA-256
|
||||
of the RGBA bytes) into INVISIBLE_CANVAS_TEXT_OUT. Run it on Debian 12 and on Ubuntu 24.04
|
||||
(and the retail reference, tests/data/canvas_text_ref/refs.json, is accepted too), then:
|
||||
|
||||
python scripts/compare_canvas_text_runs.py debian.json ubuntu.json
|
||||
|
||||
The exit status is 0 when every case is equal on both sides and both draw the same set.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
def load(path):
|
||||
"""case id -> sha256, from a run file or from refs.json."""
|
||||
data = json.loads(open(path, encoding="utf-8").read())
|
||||
if "cases" in data:
|
||||
return {k: v["sha256"] for k, v in data["cases"].items()}
|
||||
return data
|
||||
|
||||
|
||||
def compare(a, b):
|
||||
"""(only in a, only in b, ids whose hash differs)."""
|
||||
only_a = sorted(set(a) - set(b))
|
||||
only_b = sorted(set(b) - set(a))
|
||||
differ = sorted(k for k in set(a) & set(b) if a[k] != b[k])
|
||||
return only_a, only_b, differ
|
||||
|
||||
|
||||
def main(argv):
|
||||
if len(argv) != 3:
|
||||
print(__doc__)
|
||||
return 2
|
||||
a, b = load(argv[1]), load(argv[2])
|
||||
only_a, only_b, differ = compare(a, b)
|
||||
for label, ids in (("only in %s" % argv[1], only_a), ("only in %s" % argv[2], only_b),
|
||||
("differ", differ)):
|
||||
if ids:
|
||||
print("%s (%d):" % (label, len(ids)))
|
||||
for k in ids:
|
||||
print(" " + k)
|
||||
print("%d cases compared, %d differ" % (len(set(a) & set(b)), len(differ)))
|
||||
return 1 if (only_a or only_b or differ) else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -37,6 +37,13 @@ import urllib.error
|
||||
# Conventional-commit prefixes that never belong in user-facing release notes.
|
||||
_SKIP = re.compile(r"^(docs|chore|ci|test|style|build)(\(|:)", re.I)
|
||||
|
||||
#: Where the install commands live. ⛔ NOT RESTATED HERE: the body used to carry
|
||||
#: its own `pip install invisible-playwright`, a second copy of the README's
|
||||
#: install block that nothing kept in step with it. A command written in two
|
||||
#: places is two commands the day one of them changes; the release points at the
|
||||
#: one the README keeps.
|
||||
INSTALL_DOC = "https://github.com/feder-cr/invisible_playwright#install"
|
||||
|
||||
|
||||
def _api(url: str, token: str | None) -> dict:
|
||||
headers = {"Accept": "application/vnd.github+json",
|
||||
@@ -102,12 +109,10 @@ def build_body(tag: str, current_sha: str, bullets: list[str],
|
||||
parts += [f"- {b}" for b in bullets]
|
||||
parts.append("")
|
||||
parts += [
|
||||
"Builds: Linux x86_64, Linux arm64, Windows x86_64.",
|
||||
"Builds: Linux x86_64, Windows x86_64.",
|
||||
"",
|
||||
"Most people won't grab these by hand. The wrapper fetches the right one for "
|
||||
"your platform on first run:",
|
||||
"",
|
||||
" pip install invisible-playwright",
|
||||
"your platform on first run; how to install it is in " + INSTALL_DOC + ".",
|
||||
"",
|
||||
"If you do download manually, `checksums.txt` has the SHA256s.",
|
||||
]
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"identity": [
|
||||
{"keys": ["surface.screen.*", "surface.window.innerWidth", "surface.window.innerHeight",
|
||||
"surface.window.outerWidth", "surface.window.outerHeight", "surface.window.screen*",
|
||||
"surface.window.mozInnerScreen*", "surface.visualViewport.width", "surface.visualViewport.height",
|
||||
"surface.computedStyle.body.width", "surface.computedStyle.body.inline-size",
|
||||
"surface.computedStyle.body.perspective-origin", "surface.computedStyle.body.transform-origin"],
|
||||
"why": "the declared screen and window; the body is as wide as the window"},
|
||||
{"keys": ["state.*.innerWidth", "state.*.innerHeight", "state.*.outerWidth", "state.*.outerHeight",
|
||||
"state.*.screenX", "state.*.screenY", "state.*.screen.*", "state.*.mozInnerScreen*", "state.*.events.*"],
|
||||
"why": "the declared screen and window in each driven state (ci_host_gate.py INVARIANTS hold their relations); an event's screen - client is where the window puts the viewport"},
|
||||
{"keys": ["surface.navigator.hardwareConcurrency", "surface.worker.hc"],
|
||||
"why": "the declared core count"},
|
||||
{"keys": ["surface.voices"],
|
||||
"why": "the declared speech voices"},
|
||||
{"keys": ["surface.webgl*.unmasked", "surface.webgl*.parameters.RENDERER",
|
||||
"surface.webgl*.extension_parameters.WEBGL_debug_renderer_info.*",
|
||||
"surface.webgl*.parameters.MAX_*", "surface.webgl*.extension_parameters.*.MAX_*",
|
||||
"surface.webgpu.adapters.*"],
|
||||
"why": "the declared GPU: its name and its limits (ANGLE gives NVIDIA one vertex uniform vector less)"}
|
||||
],
|
||||
"noise": [],
|
||||
"network": [],
|
||||
"measurement": [
|
||||
{"keys": ["surface.document.hasFocus"],
|
||||
"why": "retail was measured on a hidden desktop, where its window never has focus"}
|
||||
],
|
||||
"known_defects": [
|
||||
{"keys": ["blend.*", "text.canvas.*", "text.char.*", "text.emoji.*", "text.fallback.*",
|
||||
"text.pixelscan.*", "text.svg.*", "text.metrics.*.width", "text.metrics.*.actualBoundingBoxLeft",
|
||||
"text.metrics.*.actualBoundingBoxRight", "text.fallbackwidth.*.serif",
|
||||
"text.fallbackwidth.*.monospace"],
|
||||
"why": "phase 4: text from idwr (DWrite 26100) on every OS; today Windows asks the host's DWrite and Linux FreeType. Only the rasterised glyphs, their advances and ink extents and the serif/monospace fallback widths differ (firefox-59 dumps): text.adjust, text.fonts, text.rect, text.units and the vertical metrics are held"},
|
||||
{"keys": ["control.webgl1", "control.webgl2"], "legs": ["linux-x86_64", "linux-x86_64-debian12"],
|
||||
"why": "WebGL draws through the host's driver (llvmpipe here, ANGLE on Windows); a host-independent rasterizer is its own project"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,356 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>host-gate</title>
|
||||
<body>
|
||||
<script>
|
||||
// host-gate/1: everything a page can read that the theory says is f(identity, Firefox code).
|
||||
// TEXT (text.*), CONTROL (control.*), BLEND (blend.*), SURFACE (surface.*): whole APIs, not chosen fields.
|
||||
// noise.*: only what varies between two launches of the same official build.
|
||||
// diag.*: information for the job log (why a host answers what it does); the gate never compares it.
|
||||
// Must be served from a secure context (http://127.0.0.1 or https) for WebGPU and media APIs.
|
||||
(async () => {
|
||||
const G = {format: 'host-gate/1', meta: {devicePixelRatio: window.devicePixelRatio, userAgent: navigator.userAgent}, items: {}, noise: {}};
|
||||
const put = (k, v) => { G.items[k] = v; };
|
||||
const noise = (k, v) => { G.noise[k] = v; };
|
||||
const errs = e => 'ERR ' + ((e && e.name) || '') + ': ' + ((e && e.message) || String(e));
|
||||
const safe = async (k, f) => { try { put(k, await f()); } catch (e) { put(k, errs(e)); } };
|
||||
const b64 = u8 => { let s = ''; for (let i = 0; i < u8.length; i += 0x8000) s += String.fromCharCode.apply(null, u8.subarray(i, i + 0x8000)); return btoa(s); };
|
||||
const alphaOf = (g, w, h) => { const d = g.getImageData(0, 0, w, h).data, a = new Uint8Array(w * h); for (let i = 0; i < a.length; i++) a[i] = d[i * 4 + 3]; return a; };
|
||||
const img = (g, w, h, rgba) => ({w, h, enc: rgba ? 'rgba8' : 'alpha8', data: rgba ? b64(new Uint8Array(g.getImageData(0, 0, w, h).data.buffer)) : b64(alphaOf(g, w, h))});
|
||||
const canvas = (w, h, fn) => { const c = document.createElement('canvas'); c.width = w; c.height = h; const g = c.getContext('2d'); fn(g, c); return [g, c]; };
|
||||
// a plain, comparable copy of any object: own + inherited enumerable data, functions as "function"
|
||||
const plain = (o, depth = 2) => {
|
||||
if (o === null || o === undefined) return o;
|
||||
const t = typeof o;
|
||||
if (t === 'number' || t === 'string' || t === 'boolean') return o;
|
||||
if (t === 'function') return 'function';
|
||||
if (t === 'bigint') return String(o);
|
||||
if (depth < 0) return '…';
|
||||
if (Array.isArray(o) || ArrayBuffer.isView(o)) return Array.from(o, v => plain(v, depth - 1));
|
||||
const out = {}; for (const k in o) { try { out[k] = plain(o[k], depth - 1); } catch (e) { out[k] = errs(e); } }
|
||||
return out;
|
||||
};
|
||||
const names = o => { try { return Object.getOwnPropertyNames(o).sort(); } catch (e) { return errs(e); } };
|
||||
|
||||
// ================================================================= TEXT
|
||||
const PIX = "\u{1F6CD}1>'`amlρiюदे來˦\u{25578}に◌\u{2003E}ԩԨ";
|
||||
const FONTS = ['Segoe UI', 'Arial', 'Times New Roman', 'Calibri', 'Consolas', 'Microsoft New Tai Lue', 'Myanmar Text', 'Microsoft PhagsPa',
|
||||
'Segoe UI Emoji', 'Segoe UI Symbol', 'sans-serif', 'serif', 'monospace', 'system-ui'];
|
||||
const PPEM = [4, 5, 6, 7, 8, 9, 10, 11, 12, 16, 20, 32];
|
||||
const TEXTS = {H: 'H', o: 'o', word: 'Hamburgefonstiv', digits: '0123456789', pixelscan: PIX};
|
||||
const fam = f => /^(sans-serif|serif|monospace|system-ui)$/.test(f) ? f : `"${f}"`;
|
||||
const drawText = (font, px, s, rgba) => {
|
||||
const p = document.createElement('canvas').getContext('2d'); p.font = `${px}px ${font}`;
|
||||
const w = Math.ceil(p.measureText(s).width) + 8, h = Math.ceil(px * 2) + 4;
|
||||
const [g] = canvas(w, h, g => { g.fillStyle = 'black'; g.font = `${px}px ${font}`; g.fillText(s, 4, Math.ceil(px) + 2); });
|
||||
return img(g, w, h, rgba);
|
||||
};
|
||||
const TM = ['width', 'actualBoundingBoxLeft', 'actualBoundingBoxRight', 'actualBoundingBoxAscent', 'actualBoundingBoxDescent',
|
||||
'fontBoundingBoxAscent', 'fontBoundingBoxDescent', 'emHeightAscent', 'emHeightDescent', 'hangingBaseline', 'alphabeticBaseline', 'ideographicBaseline'];
|
||||
const metrics = (font, px, s) => { const g = document.createElement('canvas').getContext('2d'); g.font = `${px}px ${font}`; const m = g.measureText(s);
|
||||
return Object.fromEntries(TM.map(k => [k, m[k]])); };
|
||||
for (const f of FONTS) { const F = fam(f);
|
||||
for (const px of PPEM) for (const [t, s] of Object.entries(TEXTS)) { put(`text.canvas.${f}.${px}.${t}`, drawText(F, px, s)); put(`text.metrics.${f}.${px}.${t}`, metrics(F, px, s)); }
|
||||
for (const px of [4, 8, 16]) [...PIX].forEach((ch, i) => put(`text.char.${f}.${px}.${i}`, drawText(F, px, ch)));
|
||||
}
|
||||
const EMOJI = {shop: '\u{1F6CD}', grin: '\u{1F600}', flag: '\u{1F1EE}\u{1F1F9}', family: '\u{1F468}\u{1F469}\u{1F467}', heart: '❤️', skin: '\u{1F44D}\u{1F3FD}'};
|
||||
for (const f of ['Segoe UI Emoji', 'sans-serif']) for (const px of [8, 16, 32]) for (const [n, s] of Object.entries(EMOJI)) put(`text.emoji.${f}.${px}.${n}`, drawText(fam(f), px, s, true));
|
||||
const PIXFONTS = ['Arial', 'Calibri', 'Cambria Math', 'Cambria', 'Candara', 'Comic Sans MS', 'Consolas', 'Constantia', 'Corbel', 'Courier New', 'Ebrima', 'Franklin Gothic', 'Gabriola', 'Georgia', 'Impact', 'Lucida Console', 'Lucida Sans Unicode', 'MS Gothic', 'MS PGothic', 'MV Boli', 'Malgun Gothic', 'Marlett', 'Microsoft Himalaya', 'Microsoft JhengHei', 'Microsoft New Tai Lue', 'Microsoft PhagsPa', 'Microsoft Sans Serif', 'Microsoft YaHei', 'Microsoft Yi Baiti', 'MingLiU-ExtB', 'Mongolian Baiti', 'PMingLiU-ExtB', 'Palatino Linotype', 'Segoe Print', 'Segoe Script', 'Segoe UI Symbol', 'Segoe UI', 'SimSun', 'SimSun-ExtB', 'Sylfaen', 'Trebuchet MS', 'Verdana', 'Webdings', 'Gadugi', 'Javanese Text', 'Microsoft JhengHei UI', 'Myanmar Text', 'Sitka Small', 'Yu Gothic'];
|
||||
{ const seen = new Set();
|
||||
for (const f of PIXFONTS) { const [g] = canvas(80, 10, g => { g.fillStyle = 'red'; g.font = 'normal 4px ' + f; g.fillText(PIX, 5, 5); });
|
||||
const a = img(g, 80, 10); put(`text.pixelscan.${f}`, a); seen.add(a.data); }
|
||||
put('text.pixelscan.distinct', seen.size); }
|
||||
{ const box = document.createElement('div'); box.style.cssText = 'position:absolute;left:0;top:0;white-space:nowrap'; document.body.appendChild(box);
|
||||
const span = (css, s) => { const e = document.createElement('span'); e.style.cssText = css; e.textContent = s; box.appendChild(e); const r = e.getBoundingClientRect();
|
||||
const out = [r.x, r.y, r.width, r.height, e.offsetWidth, e.offsetHeight]; e.remove(); return out; };
|
||||
for (const f of FONTS) { const F = fam(f).replace(/"/g, "'");
|
||||
for (const [t, s] of Object.entries(TEXTS)) put(`text.rect.${f}.${t}`, span(`font:16px ${F}`, s));
|
||||
const u = {}; for (const unit of ['ex', 'cap', 'ch', 'ic', 'lh', 'rex', 'rcap', 'rch', 'ric', 'rlh']) { const e = document.createElement('div'); e.style.cssText = `font:16px ${F};width:1${unit};height:1px`;
|
||||
box.appendChild(e); u[unit] = e.getBoundingClientRect().width; e.remove(); } put(`text.units.${f}`, u);
|
||||
for (const mode of ['0.5', 'ex-height 0.5', 'cap-height 0.7', 'ch-width 0.6', 'ic-width 1', 'from-font'])
|
||||
put(`text.adjust.${f}.${mode}`, span(`font:16px ${F};font-size-adjust:${mode}`, TEXTS.word));
|
||||
}
|
||||
box.remove(); }
|
||||
put('text.fonts.check', Object.fromEntries([...new Set([...FONTS, ...PIXFONTS])].map(f => [f, document.fonts.check(`16px ${fam(f)}`)])));
|
||||
put('text.fonts.size', document.fonts.size);
|
||||
const svgDraw = (attr, family, s) => new Promise(res => {
|
||||
const src = `<svg xmlns="http://www.w3.org/2000/svg" width="240" height="40"><text x="4" y="26" font-family="${family}" font-size="18" ${attr}>${s}</text></svg>`;
|
||||
const im = new Image(); im.onload = () => { const [g] = canvas(240, 40, g => g.drawImage(im, 0, 0)); try { res(img(g, 240, 40)); } catch (e) { res(errs(e)); } };
|
||||
im.onerror = () => res('ERR load'); im.src = 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(src); });
|
||||
for (const f of ['Segoe UI', 'Arial', 'Times New Roman', 'serif'])
|
||||
for (const [n, a] of Object.entries({plain: '', underline: 'text-decoration="underline"', linethrough: 'text-decoration="line-through"', overline: 'text-decoration="overline"'}))
|
||||
put(`text.svg.${f}.${n}`, await svgDraw(a, f, TEXTS.word));
|
||||
put('text.svg.emoji', await svgDraw('', 'Segoe UI Emoji', EMOJI.grin + EMOJI.flag));
|
||||
const SCRIPTS = {latin: 'Hamburg', greek: 'αβγδε', cyrillic: 'жизнь', arabic: 'مرحبا', hebrew: 'שלום', devanagari: 'नमस्ते', bengali: 'বাংলা',
|
||||
thai: 'สวัสดี', lao: 'ສະບາຍ', khmer: 'សួស្តី', myanmar: 'မင်္ဂလာ', sinhala: 'සිංහල', tamil: 'தமிழ்', ethiopic: 'ሰላም', tibetan: 'བོད་ཡིག',
|
||||
georgian: 'ქართული', armenian: 'Հայերեն', cjk: '漢字中文', cjkextb: '\u{20000}\u{25578}', hiragana: 'ひらがな', hangul: '한국어', mongolian: 'ᠮᠣᠩᠭᠣᠯ',
|
||||
cherokee: 'ᏣᎳᎩ', math: '∑∫√∞≠', arrows: '←↑→↓↔', box: '┌─┐│└┘', pua: '', symbols: '☀☂☃★♠'};
|
||||
for (const g of ['sans-serif', 'serif', 'monospace']) for (const [n, s] of Object.entries(SCRIPTS)) {
|
||||
put(`text.fallback.${n}.${g}`, drawText(g, 16, s)); put(`text.fallbackwidth.${n}.${g}`, metrics(g, 16, s).width); }
|
||||
|
||||
// ================================================================= CONTROL (no text)
|
||||
const ctl = (k, w, h, fn) => { const [g] = canvas(w, h, fn); put(`control.${k}`, img(g, w, h, true)); };
|
||||
ctl('rects', 64, 64, g => { g.fillStyle = '#c33'; g.fillRect(3.5, 3.5, 30, 20); g.strokeStyle = 'rgba(0,80,200,.6)'; g.lineWidth = 2.5; g.strokeRect(10.25, 15.75, 40, 30); });
|
||||
ctl('arcs', 64, 64, g => { g.beginPath(); g.arc(32, 32, 20.3, 0, Math.PI * 1.7); g.lineWidth = 3; g.strokeStyle = '#080'; g.stroke();
|
||||
g.beginPath(); g.ellipse(30, 30, 12, 7, 0.6, 0, 2 * Math.PI); g.fillStyle = 'rgba(200,100,0,.5)'; g.fill(); });
|
||||
ctl('beziers', 64, 64, g => { g.beginPath(); g.moveTo(2, 60); g.bezierCurveTo(10, 0, 50, 70, 62, 4); g.quadraticCurveTo(40, 40, 5, 30);
|
||||
g.lineWidth = 1.7; g.lineJoin = 'round'; g.lineCap = 'round'; g.setLineDash([4, 3]); g.stroke(); });
|
||||
ctl('linear', 64, 32, g => { const l = g.createLinearGradient(0, 0, 64, 32); l.addColorStop(0, '#f00'); l.addColorStop(.5, 'rgba(0,255,0,.5)'); l.addColorStop(1, '#00f'); g.fillStyle = l; g.fillRect(0, 0, 64, 32); });
|
||||
ctl('radial', 64, 64, g => { const r = g.createRadialGradient(20, 20, 2, 32, 32, 30); r.addColorStop(0, '#fff'); r.addColorStop(1, '#048'); g.fillStyle = r; g.fillRect(0, 0, 64, 64); });
|
||||
ctl('conic', 64, 64, g => { const c = g.createConicGradient(0.3, 32, 32); c.addColorStop(0, 'red'); c.addColorStop(.5, 'yellow'); c.addColorStop(1, 'red'); g.fillStyle = c; g.fillRect(0, 0, 64, 64); });
|
||||
ctl('pattern', 64, 64, g => { const [, p] = canvas(5, 5, h => { h.fillStyle = '#123'; h.fillRect(0, 0, 3, 3); }); g.fillStyle = g.createPattern(p, 'repeat'); g.translate(.5, .3); g.rotate(.2); g.fillRect(0, 0, 70, 70); });
|
||||
ctl('shadow', 64, 64, g => { g.shadowColor = 'rgba(0,0,0,.6)'; g.shadowBlur = 6; g.shadowOffsetX = 3; g.shadowOffsetY = 2; g.fillStyle = '#e91'; g.fillRect(12, 12, 30, 30); });
|
||||
for (const op of ['source-over', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'xor', 'lighter'])
|
||||
ctl(`composite.${op}`, 32, 32, g => { g.fillStyle = 'rgba(30,140,220,.8)'; g.fillRect(2, 2, 20, 20); g.globalCompositeOperation = op; g.fillStyle = 'rgba(240,60,40,.7)'; g.beginPath(); g.arc(20, 20, 10, 0, 7); g.fill(); });
|
||||
ctl('image_scaled', 48, 48, g => { const [, s] = canvas(7, 7, h => { for (let i = 0; i < 49; i++) { h.fillStyle = `rgb(${i * 5},${255 - i * 5},${(i * 37) % 255})`; h.fillRect(i % 7, (i / 7) | 0, 1, 1); } });
|
||||
g.imageSmoothingEnabled = true; g.imageSmoothingQuality = 'high'; g.drawImage(s, 0, 0, 48, 48); });
|
||||
ctl('filter', 48, 48, g => { g.filter = 'blur(2px) hue-rotate(40deg)'; g.fillStyle = '#3a6'; g.fillRect(8, 8, 30, 30); });
|
||||
{ // toDataURL: the PNG with its per-launch "deBG" chunk taken out (that chunk is noise.png_deBG)
|
||||
const [, c] = canvas(16, 16, g => { g.fillStyle = 'rgba(10,20,30,.5)'; g.fillRect(1, 1, 9, 9); });
|
||||
const bin = atob(c.toDataURL().split(',')[1]); const u = Uint8Array.from(bin, ch => ch.charCodeAt(0));
|
||||
const keep = [u.subarray(0, 8)]; let i = 8, deBG = null;
|
||||
while (i < u.length) { const n = (u[i] << 24 | u[i + 1] << 16 | u[i + 2] << 8 | u[i + 3]) >>> 0; const t = String.fromCharCode(...u.subarray(i + 4, i + 8));
|
||||
if (t === 'deBG') deBG = String.fromCharCode(...u.subarray(i + 8, i + 8 + n)); else keep.push(u.subarray(i, i + 12 + n)); i += 12 + n; }
|
||||
const out = new Uint8Array(keep.reduce((a, x) => a + x.length, 0)); let o = 0; for (const k of keep) { out.set(k, o); o += k.length; }
|
||||
put('control.toDataURL', {w: 16, h: 16, enc: 'png', data: b64(out)});
|
||||
put('control.toDataURL_deBG_shape', deBG === null ? 'absent' : (/^[0-9A-F]{16}$/.test(deBG) ? 'hex16' : 'other:' + deBG.length));
|
||||
noise('png_deBG', deBG); }
|
||||
const glScene = version => { const c = document.createElement('canvas'); c.width = 32; c.height = 32;
|
||||
const gl = c.getContext(version, {preserveDrawingBuffer: true, antialias: false}); if (!gl) return 'no ' + version;
|
||||
const sh = (type, src) => { const s = gl.createShader(type); gl.shaderSource(s, src); gl.compileShader(s); return s; };
|
||||
const pr = gl.createProgram(); gl.attachShader(pr, sh(gl.VERTEX_SHADER, 'attribute vec2 p; varying vec2 v; void main(){ v = p; gl_Position = vec4(p, 0.0, 1.0); }'));
|
||||
gl.attachShader(pr, sh(gl.FRAGMENT_SHADER, 'precision mediump float; varying vec2 v; void main(){ gl_FragColor = vec4(fract(v.x*3.7), abs(sin(v.y*5.0)), 0.5+0.5*v.x*v.y, 1.0); }'));
|
||||
gl.linkProgram(pr); gl.useProgram(pr);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer()); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-0.9, -0.8, 0.85, -0.7, 0.1, 0.95]), gl.STATIC_DRAW);
|
||||
const loc = gl.getAttribLocation(pr, 'p'); gl.enableVertexAttribArray(loc); gl.vertexAttribPointer(loc, 2, gl.FLOAT, false, 0, 0);
|
||||
gl.clearColor(0.1, 0.2, 0.3, 1); gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.TRIANGLES, 0, 3);
|
||||
const px = new Uint8Array(32 * 32 * 4); gl.readPixels(0, 0, 32, 32, gl.RGBA, gl.UNSIGNED_BYTE, px); return {w: 32, h: 32, enc: 'rgba8', data: b64(px)}; };
|
||||
put('control.webgl1', glScene('webgl')); put('control.webgl2', glScene('webgl2'));
|
||||
|
||||
// ================================================================= BLEND (Skia CPU blending of text)
|
||||
const BL = {red: g => { g.fillStyle = '#d22'; }, alpha: g => { g.fillStyle = 'rgba(0,0,0,.45)'; }, global: g => { g.globalAlpha = .6; g.fillStyle = '#226'; },
|
||||
overcolour: g => { g.fillStyle = '#9cf'; g.fillRect(0, 0, 200, 40); g.fillStyle = 'rgba(200,30,30,.7)'; }};
|
||||
for (const f of ['Segoe UI', 'Arial', 'Times New Roman']) for (const px of [8, 16]) for (const [n, set] of Object.entries(BL)) {
|
||||
const [g] = canvas(200, 40, g => { set(g); g.font = `${px}px "${f}"`; g.fillText('Hamburgefonstiv 0123', 4, 26); }); put(`blend.${f}.${px}.${n}`, img(g, 200, 40, true)); }
|
||||
|
||||
// ================================================================= SURFACE (whole APIs)
|
||||
put('surface.window_own', names(window));
|
||||
for (const n of ['Navigator', 'Document', 'HTMLDocument', 'Element', 'HTMLElement', 'Node', 'EventTarget', 'Screen', 'ScreenOrientation', 'Performance',
|
||||
'HTMLCanvasElement', 'CanvasRenderingContext2D', 'OffscreenCanvas', 'WebGLRenderingContext', 'WebGL2RenderingContext', 'AudioContext', 'BaseAudioContext',
|
||||
'MediaDevices', 'Permissions', 'Notification', 'GPU', 'GPUAdapter', 'GPUDevice', 'StorageManager', 'Crypto', 'SubtleCrypto', 'CSS', 'History', 'Location',
|
||||
'PluginArray', 'MimeTypeArray', 'MouseEvent', 'PointerEvent', 'KeyboardEvent', 'Worker', 'ServiceWorkerContainer', 'RTCPeerConnection', 'SpeechSynthesis',
|
||||
'VisualViewport', 'FontFaceSet', 'Clipboard', 'ImageDecoder', 'VideoDecoder', 'AudioDecoder', 'VideoEncoder', 'WebTransport', 'LockManager', 'WakeLock', 'Gamepad',
|
||||
'Scheduler', 'CookieStore', 'NetworkInformation', 'MediaCapabilities', 'MediaSource', 'MediaRecorder', 'IntersectionObserver', 'ResizeObserver', 'TextMetrics',
|
||||
'CustomElementRegistry', 'Window'])
|
||||
put(`surface.proto.${n}`, typeof window[n] === 'undefined' ? 'absent' : (window[n].prototype ? names(window[n].prototype) : names(window[n])));
|
||||
put('surface.navigator', plain(navigator, 1));
|
||||
put('surface.navigator.plugins', [...navigator.plugins].map(p => [p.name, p.filename, p.description, [...p].map(m => m.type)]));
|
||||
put('surface.navigator.mimeTypes', [...navigator.mimeTypes].map(m => [m.type, m.suffixes, m.description]));
|
||||
put('surface.screen', plain(screen, 1));
|
||||
put('surface.screen.orientation', screen.orientation ? [screen.orientation.type, screen.orientation.angle] : 'absent');
|
||||
put('surface.window', Object.fromEntries(['innerWidth', 'innerHeight', 'outerWidth', 'outerHeight', 'screenX', 'screenY', 'screenLeft', 'screenTop',
|
||||
'devicePixelRatio', 'mozInnerScreenX', 'mozInnerScreenY', 'scrollMaxX', 'scrollMaxY', 'isSecureContext', 'crossOriginIsolated', 'name', 'closed', 'length']
|
||||
.map(k => [k, window[k]])));
|
||||
// the origin without its port: the port is the gate server's, not the browser's
|
||||
put('surface.window.origin_scheme_host', location.protocol + '//' + location.hostname);
|
||||
put('surface.visualViewport', window.visualViewport ? plain(visualViewport, 0) : 'absent');
|
||||
put('surface.document', Object.fromEntries(['characterSet', 'compatMode', 'contentType', 'designMode', 'dir', 'visibilityState', 'hidden', 'fullscreenEnabled',
|
||||
'pictureInPictureEnabled', 'pointerLockElement', 'hasStorageAccess'].map(k => [k, typeof document[k] === 'function' ? 'function' : document[k]])));
|
||||
put('surface.document.hasFocus', document.hasFocus());
|
||||
{ const Q = {}; const feat = {'prefers-color-scheme': ['light', 'dark'], 'prefers-reduced-motion': ['no-preference', 'reduce'], 'prefers-contrast': ['no-preference', 'more', 'less', 'custom'],
|
||||
'prefers-reduced-transparency': ['no-preference', 'reduce'], 'forced-colors': ['none', 'active'], 'inverted-colors': ['none', 'inverted'], pointer: ['none', 'coarse', 'fine'],
|
||||
hover: ['none', 'hover'], 'any-pointer': ['none', 'coarse', 'fine'], 'any-hover': ['none', 'hover'], 'color-gamut': ['srgb', 'p3', 'rec2020'], 'dynamic-range': ['standard', 'high'],
|
||||
'video-dynamic-range': ['standard', 'high'], 'display-mode': ['browser', 'fullscreen', 'standalone', 'minimal-ui'], update: ['none', 'slow', 'fast'], scripting: ['none', 'initial-only', 'enabled'],
|
||||
'overflow-block': ['none', 'scroll', 'paged'], 'overflow-inline': ['none', 'scroll'], orientation: ['portrait', 'landscape'], grid: ['0', '1'], monochrome: ['0'],
|
||||
'-moz-platform': ['windows', 'macos', 'linux', 'android'], '-moz-windows-non-native-menus': ['0', '1'], '-moz-overlay-scrollbars': ['0', '1'], 'prefers-reduced-data': ['no-preference', 'reduce']};
|
||||
for (const [f, vs] of Object.entries(feat)) Q[f] = vs.filter(v => matchMedia(`(${f}: ${v})`).matches);
|
||||
for (const f of ['color', 'color-index', 'resolution', 'device-pixel-ratio']) Q['supports-' + f] = matchMedia(`(${f})`).matches;
|
||||
Q.color_bits = [1, 2, 4, 6, 8, 10, 12, 16].filter(n => matchMedia(`(color: ${n})`).matches);
|
||||
put('surface.mq', Q); }
|
||||
{ const I = {}; const ctors = ['DateTimeFormat', 'NumberFormat', 'Collator', 'PluralRules', 'RelativeTimeFormat', 'ListFormat', 'Segmenter', 'DisplayNames', 'DurationFormat'];
|
||||
for (const c of ctors) { try { I[c] = Intl[c] ? new Intl[c](undefined, c === 'DisplayNames' ? {type: 'region'} : undefined).resolvedOptions() : 'absent'; } catch (e) { I[c] = errs(e); } }
|
||||
for (const k of ['calendar', 'collation', 'currency', 'numberingSystem', 'timeZone', 'unit']) { try { I['supported_' + k] = Intl.supportedValuesOf(k); } catch (e) { I['supported_' + k] = errs(e); } }
|
||||
const d = new Date(Date.UTC(2026, 0, 15, 12, 0, 0)), s = new Date(Date.UTC(2026, 6, 15, 12, 0, 0));
|
||||
I.offsets = [d.getTimezoneOffset(), s.getTimezoneOffset()]; I.strings = [d.toString(), s.toString(), d.toLocaleString(), (1234567.891).toLocaleString(), d.toLocaleDateString(undefined, {dateStyle: 'full'})];
|
||||
I.languages = navigator.languages; put('surface.intl', I); }
|
||||
const glAll = version => { const c = document.createElement('canvas'); const gl = c.getContext(version); if (!gl) return 'no ' + version;
|
||||
const P = {}, proto = Object.getPrototypeOf(gl);
|
||||
for (const k of Object.getOwnPropertyNames(proto.constructor)) if (/^[A-Z0-9_]+$/.test(k) && typeof gl[k] === 'number') {
|
||||
const v = gl.getParameter(gl[k]); gl.getError(); if (v !== null && v !== undefined) P[k] = plain(v, 1); }
|
||||
const ext = gl.getSupportedExtensions() || []; const E = {};
|
||||
for (const e of ext) { const o = gl.getExtension(e); if (!o) continue; const ep = {};
|
||||
for (const k in o) if (/^[A-Z0-9_]+$/.test(k) && typeof o[k] === 'number') { const v = gl.getParameter(o[k]); gl.getError(); if (v !== null && v !== undefined) ep[k] = plain(v, 1); }
|
||||
E[e] = ep; }
|
||||
const prec = {}; for (const st of ['VERTEX_SHADER', 'FRAGMENT_SHADER']) for (const pt of ['LOW_FLOAT', 'MEDIUM_FLOAT', 'HIGH_FLOAT', 'LOW_INT', 'MEDIUM_INT', 'HIGH_INT']) {
|
||||
const p = gl.getShaderPrecisionFormat(gl[st], gl[pt]); prec[`${st}.${pt}`] = [p.rangeMin, p.rangeMax, p.precision]; }
|
||||
const dbg = gl.getExtension('WEBGL_debug_renderer_info');
|
||||
return {parameters: P, extensions: ext, extension_parameters: E, precisions: prec, attributes: gl.getContextAttributes(),
|
||||
unmasked: dbg ? [gl.getParameter(dbg.UNMASKED_VENDOR_WEBGL), gl.getParameter(dbg.UNMASKED_RENDERER_WEBGL)] : 'absent'}; };
|
||||
await safe('surface.webgl1', () => glAll('webgl')); await safe('surface.webgl2', () => glAll('webgl2'));
|
||||
// getParameter must answer only where Firefox would: WebGL2-only enums on a WebGL1 context and the
|
||||
// enums of extensions not enabled, each as [value, getError()] (official: null + INVALID_ENUM)
|
||||
await safe('surface.webgl_invalid_enums', () => {
|
||||
const val = x => (x === null || x === undefined) ? x : (typeof x === 'object' ? (ArrayBuffer.isView(x) || Array.isArray(x) ? Array.from(x) : String(x)) : x);
|
||||
const ask = (gl, enums) => { const o = {}; gl.getError(); for (const [n, e] of enums) { let v; try { v = val(gl.getParameter(e)); } catch (x) { v = 'THROW ' + x.name; } o[n] = [v, gl.getError()]; } return o; };
|
||||
const g1 = new Set(Object.getOwnPropertyNames(WebGLRenderingContext));
|
||||
const only2 = Object.getOwnPropertyNames(WebGL2RenderingContext).filter(k => /^[A-Z0-9_]+$/.test(k) && !g1.has(k)).map(k => [k, WebGL2RenderingContext[k]]);
|
||||
const EXT = Object.entries({MAX_TEXTURE_MAX_ANISOTROPY_EXT: 0x84FF, TEXTURE_MAX_ANISOTROPY_EXT: 0x84FE, MAX_VIEWS_OVR: 0x9631, UNMASKED_VENDOR_WEBGL: 0x9245,
|
||||
UNMASKED_RENDERER_WEBGL: 0x9246, MAX_DRAW_BUFFERS_WEBGL: 0x8824, MAX_COLOR_ATTACHMENTS_WEBGL: 0x8CDF, FRAGMENT_SHADER_DERIVATIVE_HINT_OES: 0x8B8B,
|
||||
VERTEX_ARRAY_BINDING_OES: 0x85B5, TIMESTAMP_EXT: 0x8E28, GPU_DISJOINT_EXT: 0x8FBB, QUERY_COUNTER_BITS_EXT: 0x8864, MAX_CLIP_DISTANCES_WEBGL: 0x0D32,
|
||||
MAX_CULL_DISTANCES_WEBGL: 0x82F9, MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL: 0x82FA, PROVOKING_VERTEX_WEBGL: 0x8E4F, POLYGON_OFFSET_CLAMP_EXT: 0x8E1B,
|
||||
CLIP_ORIGIN_EXT: 0x935C, CLIP_DEPTH_MODE_EXT: 0x935D, MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL: 0x88FC, DEPTH_CLAMP_EXT: 0x864F});
|
||||
const c1 = document.createElement('canvas').getContext('webgl'), c2 = document.createElement('canvas').getContext('webgl2');
|
||||
return {webgl1_webgl2only: ask(c1, only2), webgl1_ext_not_enabled: ask(c1, EXT), webgl2_ext_not_enabled: ask(c2, EXT)}; });
|
||||
await safe('surface.webgpu', async () => { if (!navigator.gpu) return 'absent'; const W = {preferredCanvasFormat: navigator.gpu.getPreferredCanvasFormat(),
|
||||
wgslLanguageFeatures: [...navigator.gpu.wgslLanguageFeatures].sort(), adapters: {}};
|
||||
for (const [n, o] of Object.entries({none: undefined, low_power: {powerPreference: 'low-power'}, high_performance: {powerPreference: 'high-performance'}, fallback: {forceFallbackAdapter: true}})) {
|
||||
const a = await navigator.gpu.requestAdapter(o); if (!a) { W.adapters[n] = null; continue; }
|
||||
const L = {}; for (const k in a.limits) L[k] = a.limits[k];
|
||||
const A = {features: [...a.features].sort(), limits: L, info: plain(a.info, 0)};
|
||||
try { const d = await a.requestDevice({requiredFeatures: A.features}); A.device = 'ok'; d.destroy(); } catch (e) { A.device = errs(e); }
|
||||
W.adapters[n] = A; }
|
||||
return W; });
|
||||
{ const types = ['video/mp4', 'video/webm', 'video/ogg', 'audio/mpeg', 'audio/mp4', 'audio/webm', 'audio/ogg', 'audio/wav', 'audio/flac', 'audio/aac',
|
||||
'video/mp4; codecs="avc1.42E01E"', 'video/mp4; codecs="avc1.640028"', 'video/mp4; codecs="hev1.1.6.L93.B0"', 'video/mp4; codecs="hvc1.1.6.L93.B0"',
|
||||
'video/mp4; codecs="av01.0.05M.08"', 'video/webm; codecs="av01.0.05M.08"', 'video/mp4; codecs="vp09.00.10.08"', 'video/webm; codecs="vp9"', 'video/webm; codecs="vp8"',
|
||||
'video/webm; codecs="vp8, vorbis"', 'audio/mp4; codecs="mp4a.40.2"', 'audio/mp4; codecs="opus"', 'audio/webm; codecs="opus"', 'audio/ogg; codecs="vorbis"',
|
||||
'audio/mp4; codecs="flac"', 'audio/mp4; codecs="ec-3"', 'audio/mp4; codecs="ac-3"', 'video/x-matroska', 'application/x-mpegURL', 'application/vnd.apple.mpegurl'];
|
||||
const v = document.createElement('video');
|
||||
put('surface.media.canPlayType', Object.fromEntries(types.map(t => [t, v.canPlayType(t)])));
|
||||
put('surface.media.MediaSource', window.MediaSource ? Object.fromEntries(types.map(t => [t, MediaSource.isTypeSupported(t)])) : 'absent');
|
||||
put('surface.media.MediaRecorder', window.MediaRecorder ? Object.fromEntries(types.map(t => [t, MediaRecorder.isTypeSupported(t)])) : 'absent');
|
||||
const D = {}; const vcodecs = {avc: 'video/mp4; codecs="avc1.640028"', hevc: 'video/mp4; codecs="hvc1.1.6.L93.B0"', vp8: 'video/webm; codecs="vp8"', vp9: 'video/webm; codecs="vp09.00.10.08"',
|
||||
av1: 'video/mp4; codecs="av01.0.05M.08"'};
|
||||
for (const [n, ct] of Object.entries(vcodecs)) for (const type of ['file', 'media-source']) for (const [w, h, fr, br] of [[1280, 720, 30, 2e6], [1920, 1080, 60, 8e6], [3840, 2160, 30, 2e7]]) {
|
||||
try { const r = await navigator.mediaCapabilities.decodingInfo({type, video: {contentType: ct, width: w, height: h, bitrate: br, framerate: fr}}); D[`${type}.${n}.${h}p${fr}`] = [r.supported, r.smooth, r.powerEfficient]; }
|
||||
catch (e) { D[`${type}.${n}.${h}p${fr}`] = errs(e); } }
|
||||
for (const ct of ['video/VP8', 'video/VP9', 'video/AV1', 'video/H264']) {
|
||||
try { const r = await navigator.mediaCapabilities.decodingInfo({type: 'webrtc', video: {contentType: ct, width: 1280, height: 720, bitrate: 1e6, framerate: 30}}); D['webrtc.' + ct] = [r.supported, r.smooth, r.powerEfficient]; }
|
||||
catch (e) { D['webrtc.' + ct] = errs(e); }
|
||||
try { const r = await navigator.mediaCapabilities.encodingInfo({type: 'webrtc', video: {contentType: ct, width: 1280, height: 720, bitrate: 1e6, framerate: 30}}); D['webrtc-encode.' + ct] = [r.supported, r.smooth, r.powerEfficient]; }
|
||||
catch (e) { D['webrtc-encode.' + ct] = errs(e); } }
|
||||
for (const [n, ct] of Object.entries({aac: 'audio/mp4; codecs="mp4a.40.2"', opus: 'audio/webm; codecs="opus"', flac: 'audio/flac', mp3: 'audio/mpeg'})) {
|
||||
try { const r = await navigator.mediaCapabilities.decodingInfo({type: 'file', audio: {contentType: ct, channels: '2', bitrate: 128000, samplerate: 48000}}); D['audio.' + n] = [r.supported, r.smooth, r.powerEfficient]; }
|
||||
catch (e) { D['audio.' + n] = errs(e); } }
|
||||
put('surface.media.capabilities', D); }
|
||||
await safe('surface.audio', async () => { const c = new AudioContext(); const o = {sampleRate: c.sampleRate, baseLatency: c.baseLatency, state: c.state,
|
||||
destination: plain(c.destination, 0), listener: Object.keys(plain(c.listener, 0)).length}; await c.close();
|
||||
const oc = new OfflineAudioContext(1, 5000, 44100), an = oc.createAnalyser(), os = oc.createOscillator(), dc = oc.createDynamicsCompressor();
|
||||
os.type = 'triangle'; os.frequency.value = 10000; dc.threshold.value = -50; dc.knee.value = 40; dc.attack.value = 0;
|
||||
os.connect(dc); dc.connect(an); dc.connect(oc.destination); os.start(0); const buf = await oc.startRendering();
|
||||
const ch = buf.getChannelData(0); let s = 0; for (let i = 4500; i < 5000; i++) s += Math.abs(ch[i]);
|
||||
o.offline_sum = s; o.offline_reduction = dc.reduction; o.offline_head = Array.from(ch.subarray(4500, 4520)); return o; });
|
||||
await safe('surface.voices', () => new Promise(res => { const get = () => speechSynthesis.getVoices().map(v => [v.name, v.lang, v.localService, v.default, v.voiceURI]);
|
||||
const now = get(); if (now.length) return res(now); speechSynthesis.onvoiceschanged = () => res(get()); setTimeout(() => res(get()), 3000); }));
|
||||
await safe('surface.permissions', async () => { const P = {}; for (const n of ['geolocation', 'notifications', 'push', 'persistent-storage', 'camera', 'microphone', 'midi',
|
||||
'clipboard-read', 'clipboard-write', 'screen-wake-lock', 'storage-access', 'background-sync', 'accelerometer', 'gyroscope', 'magnetometer', 'local-fonts', 'payment-handler']) {
|
||||
try { P[n] = (await navigator.permissions.query({name: n})).state; } catch (e) { P[n] = errs(e); } } return P; });
|
||||
await safe('surface.storage', async () => { const e = await navigator.storage.estimate(); noise('storage_usage', e.usage); return {quota: e.quota, persisted: await navigator.storage.persisted()}; });
|
||||
await safe('surface.devices', async () => (await navigator.mediaDevices.enumerateDevices()).map(d => [d.kind, d.label, d.deviceId === '' ? '' : 'id', d.groupId === '' ? '' : 'id']));
|
||||
{ const style = el => { document.body.appendChild(el); const cs = getComputedStyle(el); const o = {}; for (let i = 0; i < cs.length; i++) o[cs[i]] = cs.getPropertyValue(cs[i]); el.remove(); return o; };
|
||||
for (const [n, mk] of Object.entries({body: () => document.createElement('div'), button: () => document.createElement('button'), input: () => document.createElement('input'),
|
||||
select: () => document.createElement('select'), textarea: () => document.createElement('textarea'), a: () => Object.assign(document.createElement('a'), {href: '#'})}))
|
||||
put(`surface.computedStyle.${n}`, style(mk()));
|
||||
const SC = ['AccentColor', 'AccentColorText', 'ActiveText', 'ButtonBorder', 'ButtonFace', 'ButtonText', 'Canvas', 'CanvasText', 'Field', 'FieldText', 'GrayText', 'Highlight',
|
||||
'HighlightText', 'LinkText', 'Mark', 'MarkText', 'SelectedItem', 'SelectedItemText', 'VisitedText', 'ActiveBorder', 'ActiveCaption', 'AppWorkspace', 'Background',
|
||||
'ButtonHighlight', 'ButtonShadow', 'CaptionText', 'InactiveBorder', 'InactiveCaption', 'InactiveCaptionText', 'InfoBackground', 'InfoText', 'Menu', 'MenuText',
|
||||
'Scrollbar', 'ThreeDDarkShadow', 'ThreeDFace', 'ThreeDHighlight', 'ThreeDLightShadow', 'ThreeDShadow', 'Window', 'WindowFrame', 'WindowText',
|
||||
'-moz-buttonhoverface', '-moz-buttonhovertext', '-moz-cellhighlight', '-moz-dialog', '-moz-dialogtext', '-moz-oddtreerow'];
|
||||
const e = document.createElement('div'); document.body.appendChild(e); const C = {};
|
||||
for (const c of SC) { e.style.color = ''; e.style.color = c; C[c] = getComputedStyle(e).color; } e.remove(); put('surface.systemColors', C);
|
||||
const F = {}; const f = document.createElement('div'); document.body.appendChild(f);
|
||||
for (const k of ['caption', 'icon', 'menu', 'message-box', 'small-caption', 'status-bar', '-moz-button', '-moz-field', '-moz-list', '-moz-pull-down-menu', 'system-ui'])
|
||||
{ f.style.font = ''; f.style.font = k === 'system-ui' ? '16px system-ui' : k; const cs = getComputedStyle(f); F[k] = [cs.fontFamily, cs.fontSize, cs.fontWeight, cs.fontStyle]; }
|
||||
f.remove(); put('surface.systemFonts', F); }
|
||||
{ const M = {}; for (const [n, x] of Object.entries({acos: .123, acosh: 1e308, asin: .123, asinh: 1, atanh: .5, atan: 2, sin: -1e300, sinh: 1, cos: 10.000000000123, cosh: 1,
|
||||
tan: -1e300, tanh: 1, exp: 1, expm1: 1, log1p: 10, cbrt: 100, pow: 2}))
|
||||
M[n] = n === 'pow' ? Math.pow(Math.PI, -100) : Math[n](x);
|
||||
put('surface.math', M); }
|
||||
{ const E = {}; const tries = {undef: () => null.x, call: () => (1)(), reduce: () => [].reduce((a, b) => a), json: () => JSON.parse('{'), range: () => new Array(-1), stack: () => { throw new Error('x'); }};
|
||||
for (const [n, f] of Object.entries(tries)) { try { f(); } catch (e) { E[n] = [e.name, e.message, (e.stack || '').split('\n')[0].replace(/@.*$/, '@<page>')]; } }
|
||||
put('surface.errors', E); }
|
||||
await safe('surface.worker', () => new Promise(res => {
|
||||
const src = `const t0 = performance.now(); postMessage({ua: navigator.userAgent, hc: navigator.hardwareConcurrency, lang: navigator.languages, platform: navigator.platform,
|
||||
gpu: 'gpu' in navigator, tz: Intl.DateTimeFormat().resolvedOptions().timeZone, t0});`;
|
||||
const w = new Worker(URL.createObjectURL(new Blob([src], {type: 'text/javascript'}))); const t = performance.now();
|
||||
w.onmessage = e => { noise('worker_start_ms', Math.round(performance.now() - t)); const d = e.data; delete d.t0; res(d); w.terminate(); };
|
||||
setTimeout(() => res('timeout'), 5000); }));
|
||||
await safe('surface.branding', () => Promise.all(['chrome://branding/locale/brand.properties', 'chrome://branding/content/about-logo.png',
|
||||
'resource://app/localization/en-US/branding/brand.ftl'].map(u => new Promise(res => { const s = document.createElement('script'); let done = false;
|
||||
const fin = v => { if (!done) { done = true; res([u, v]); } }; s.onload = () => fin('load'); s.onerror = () => fin('error'); s.src = u; document.head.appendChild(s); setTimeout(() => fin('timeout'), 3000); }))));
|
||||
noise('history_length', history.length);
|
||||
noise('main_loop_ms', await new Promise(r => { const t = performance.now(); setTimeout(() => r(Math.round(performance.now() - t)), 20); }));
|
||||
|
||||
// ================================================================= DIAG (information, never compared)
|
||||
// diag.*: why this host's WebGL is what it is (no WebGL2, no MSAA). Last, so its extra contexts
|
||||
// cannot disturb anything measured above; each is lost again once read.
|
||||
await safe('diag.webgl', async () => {
|
||||
const probe = async (version, attrs) => {
|
||||
const c = document.createElement('canvas'), creation_errors = [];
|
||||
c.addEventListener('webglcontextcreationerror', e => creation_errors.push(e.statusMessage));
|
||||
let gl = null; const o = {};
|
||||
try { gl = attrs ? c.getContext(version, attrs) : c.getContext(version); } catch (e) { o.thrown = errs(e); }
|
||||
await new Promise(r => setTimeout(r, 0));
|
||||
o.is_null = !gl; o.creation_errors = creation_errors;
|
||||
if (!gl) return o;
|
||||
const ask = e => { gl.getError(); let v; try { v = gl.getParameter(e); } catch (x) { return 'THROW ' + x.name; } const err = gl.getError(); return err ? 'GL error ' + err : plain(v, 1); };
|
||||
o.attributes = gl.getContextAttributes();
|
||||
o.strings = Object.fromEntries(['VENDOR', 'RENDERER', 'VERSION', 'SHADING_LANGUAGE_VERSION'].map(k => [k, ask(gl[k])]));
|
||||
const dbg = gl.getExtension('WEBGL_debug_renderer_info');
|
||||
o.unmasked = dbg ? [ask(dbg.UNMASKED_VENDOR_WEBGL), ask(dbg.UNMASKED_RENDERER_WEBGL)] : 'absent';
|
||||
o.SAMPLES = ask(gl.SAMPLES); o.SAMPLE_BUFFERS = ask(gl.SAMPLE_BUFFERS);
|
||||
o.MAX_SAMPLES = 'MAX_SAMPLES' in gl ? ask(gl.MAX_SAMPLES) : 'absent';
|
||||
const lose = gl.getExtension('WEBGL_lose_context'); if (lose) lose.loseContext();
|
||||
return o; };
|
||||
return {webgl1: await probe('webgl'), webgl1_fail_if_caveat: await probe('webgl', {failIfMajorPerformanceCaveat: true}),
|
||||
webgl2: await probe('webgl2'), webgl2_fail_if_caveat: await probe('webgl2', {failIfMajorPerformanceCaveat: true})}; });
|
||||
|
||||
// ================================================================= STATES (state.*)
|
||||
// The window in the states a page can drive it to: normal, fullscreen, back. Nothing here runs on load:
|
||||
// fullscreen needs a user gesture, so the dump (ci_host_gate.py drive_states) calls these after 'done'
|
||||
// and gives every click and move as real input. Defined last so surface.window_own does not list it.
|
||||
window.__hostGateStates = (() => {
|
||||
let events = {}, request = null, pending = null;
|
||||
// each event type keeps the distinct (screen - client) offsets it was seen with
|
||||
const record = e => { const p = [e.screenX - e.clientX, e.screenY - e.clientY], l = (events[e.type] = events[e.type] || []);
|
||||
if (!l.some(q => q[0] === p[0] && q[1] === p[1])) l.push(p); };
|
||||
const geometry = () => ({innerWidth, innerHeight, outerWidth, outerHeight, screenX, screenY, mozInnerScreenX, mozInnerScreenY,
|
||||
screen: {width: screen.width, height: screen.height, availWidth: screen.availWidth, availHeight: screen.availHeight},
|
||||
display_mode_fullscreen: matchMedia('(display-mode: fullscreen)').matches,
|
||||
fullscreen_element: document.fullscreenElement !== null,
|
||||
window_fullScreen: typeof window.fullScreen === 'boolean' ? window.fullScreen : 'absent'});
|
||||
const sleep = ms => new Promise(r => setTimeout(r, ms));
|
||||
// the geometry once it holds for 4 polls in a row (a transition resizes in steps); false if it never does in 3 s
|
||||
const settle = async () => { let last = JSON.stringify(geometry()), still = 0;
|
||||
for (let i = 0; i < 60 && still < 4; i++) { await sleep(50); const g = JSON.stringify(geometry()); still = g === last ? still + 1 : 0; last = g; }
|
||||
return still >= 4; };
|
||||
// the next fullscreenchange or fullscreenerror, or 'timeout' after ms: a failure is recorded, never waited on
|
||||
const arm = ms => { request = null; pending = new Promise(res => {
|
||||
let t = null;
|
||||
const fin = how => { clearTimeout(t); document.removeEventListener('fullscreenchange', ok); document.removeEventListener('fullscreenerror', bad); res(how); };
|
||||
const ok = () => fin('fullscreenchange'), bad = () => fin('fullscreenerror');
|
||||
document.addEventListener('fullscreenchange', ok); document.addEventListener('fullscreenerror', bad);
|
||||
t = setTimeout(() => fin('timeout'), ms); }); };
|
||||
const asked = p => { request = 'pending'; p.then(() => { request = 'resolved'; }, e => { request = errs(e); }); };
|
||||
return {
|
||||
// listens to the mouse and adds the button whose click asks for fullscreen; returns its centre
|
||||
prepare() {
|
||||
for (const t of ['mousemove', 'mousedown', 'mouseup', 'click']) addEventListener(t, record, true);
|
||||
const b = document.createElement('button'); b.textContent = 'fullscreen';
|
||||
b.style.cssText = 'position:fixed;left:20px;top:20px;width:160px;height:40px;margin:0;z-index:2147483647';
|
||||
b.addEventListener('click', () => asked(document.documentElement.requestFullscreen()));
|
||||
document.body.appendChild(b);
|
||||
const r = b.getBoundingClientRect(); return {x: r.left + r.width / 2, y: r.top + r.height / 2}; },
|
||||
arm,
|
||||
leave(ms) { arm(ms); asked(document.exitFullscreen()); },
|
||||
async wait() { const how = await pending; const settled = await settle(); return {how, request: request === null ? 'not asked' : request, settled}; },
|
||||
clear() { events = {}; },
|
||||
measure() { return Object.assign(geometry(), {events}); },
|
||||
};
|
||||
})();
|
||||
|
||||
window.__hostGate = G;
|
||||
if (location.protocol.startsWith('http')) { try { await fetch('/result' + location.search, {method: 'POST', body: JSON.stringify(G)}); } catch (e) {} }
|
||||
document.title = 'done';
|
||||
})();
|
||||
</script>
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,298 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Daily snapshot of the public counters, and the two README badges drawn from it.
|
||||
|
||||
python scripts/launch_counters.py --history H.csv --daily D.csv --badges DIR
|
||||
python scripts/launch_counters.py --selftest
|
||||
|
||||
Run once a day by .github/workflows/counters.yml, which keeps the files on the
|
||||
unprotected `badges` branch. Nothing here needs a person or a machine of ours:
|
||||
every input is a public GitHub API answer and every output is a file on that
|
||||
branch.
|
||||
|
||||
WHAT A LAUNCH IS. Every browser process the engine starts makes one GET to a
|
||||
fixed release asset (platform/launch-counter in the engine series), and GitHub
|
||||
counts the fetches as that asset's `download_count`. GitHub keeps only the
|
||||
running total, never a history, which is why this snapshot exists: a day's
|
||||
launches are the difference between two consecutive daily totals, and a day
|
||||
nobody recorded is lost for good.
|
||||
|
||||
THE TOTAL IS A SUM, and its terms are fixed history:
|
||||
* LAUNCHES_BASELINE_V3 is everything counted before the counter moved to the
|
||||
two live assets below; those earlier assets no longer exist.
|
||||
* usage_counter_v3 is the wrapper repo's asset, counted from zero. Engines
|
||||
whose core does not declare the address ping it.
|
||||
* usage_counter_v4 is the engine repo's asset above the value it already held
|
||||
when it came back into use (USAGE_COUNTER_RESUMED_AT). Current cores point
|
||||
every session at it.
|
||||
The two populations are disjoint, so the launches are the sum.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import csv
|
||||
import datetime as dt
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import urllib.request
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Callable
|
||||
|
||||
ENGINE_REPO = "feder-cr/firefox_antidetect_patch"
|
||||
WRAPPER_REPO = "feder-cr/invisible_playwright"
|
||||
COUNTER_TAG = "usage-counter"
|
||||
|
||||
LAUNCHES_BASELINE_V3 = 2_084_136
|
||||
USAGE_COUNTER_RESUMED_AT = 1_162_840
|
||||
|
||||
Api = Callable[[str], object]
|
||||
|
||||
|
||||
def github_api(token: str | None) -> Api:
|
||||
def get(path: str):
|
||||
req = urllib.request.Request("https://api.github.com" + path)
|
||||
req.add_header("Accept", "application/vnd.github+json")
|
||||
if token:
|
||||
req.add_header("Authorization", "Bearer " + token)
|
||||
with urllib.request.urlopen(req, timeout=60) as r:
|
||||
return json.load(r)
|
||||
return get
|
||||
|
||||
|
||||
def _releases(api: Api, repo: str) -> list[dict]:
|
||||
out: list[dict] = []
|
||||
page = 1
|
||||
while True:
|
||||
batch = api(f"/repos/{repo}/releases?per_page=100&page={page}")
|
||||
if not batch:
|
||||
return out
|
||||
out.extend(batch)
|
||||
page += 1
|
||||
|
||||
|
||||
def _counter(api: Api, repo: str) -> int:
|
||||
rel = api(f"/repos/{repo}/releases/tags/{COUNTER_TAG}")
|
||||
return sum(a["download_count"] for a in rel["assets"])
|
||||
|
||||
|
||||
def launches_total(usage_counter: int, usage_counter_v3: int) -> int:
|
||||
return (LAUNCHES_BASELINE_V3 + usage_counter_v3
|
||||
+ max(0, usage_counter - USAGE_COUNTER_RESUMED_AT))
|
||||
|
||||
|
||||
def collect(api: Api) -> dict[str, int]:
|
||||
"""Every key the history has always carried, read fresh."""
|
||||
out: dict[str, int] = {}
|
||||
binaries = 0
|
||||
for r in _releases(api, ENGINE_REPO):
|
||||
tag = r["tag_name"]
|
||||
if tag == COUNTER_TAG:
|
||||
continue
|
||||
n = sum(a["download_count"] for a in r["assets"]
|
||||
if a["name"].endswith((".zip", ".tar.gz")))
|
||||
if n or tag.startswith("firefox-"):
|
||||
out[tag] = n
|
||||
binaries += n
|
||||
out["total_binaries"] = binaries
|
||||
out["usage_counter"] = _counter(api, ENGINE_REPO)
|
||||
out["usage_counter_v3"] = _counter(api, WRAPPER_REPO)
|
||||
out["usage_counter_v4"] = max(0, out["usage_counter"] - USAGE_COUNTER_RESUMED_AT)
|
||||
out["launches_total"] = launches_total(out["usage_counter"], out["usage_counter_v3"])
|
||||
out["stars"] = api(f"/repos/{WRAPPER_REPO}")["stargazers_count"]
|
||||
return out
|
||||
|
||||
|
||||
# ── history ─────────────────────────────────────────────────────────────────
|
||||
|
||||
def read_history(path: Path) -> dict[str, dict[str, int]]:
|
||||
out: dict[str, dict[str, int]] = {}
|
||||
if path.exists():
|
||||
with path.open(encoding="utf-8", newline="") as f:
|
||||
for row in csv.DictReader(f):
|
||||
out.setdefault(row["date"], {})[row["key"]] = int(float(row["value"]))
|
||||
return out
|
||||
|
||||
|
||||
def append_snapshot(path: Path, day: str, data: dict[str, int]) -> list[str]:
|
||||
"""Append today's rows. Idempotent per (date, key): a rerun the same day
|
||||
writes only keys that are not there yet, and never a second value."""
|
||||
seen = set(read_history(path).get(day, {}))
|
||||
fresh = {k: v for k, v in data.items() if k not in seen}
|
||||
if not fresh:
|
||||
return []
|
||||
new = not path.exists()
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with path.open("a", encoding="utf-8", newline="") as f:
|
||||
w = csv.writer(f, lineterminator="\n")
|
||||
if new:
|
||||
w.writerow(["date", "key", "value"])
|
||||
ff = sorted((k for k in fresh if re.fullmatch(r"firefox-\d+", k)),
|
||||
key=lambda k: int(k.split("-")[1]))
|
||||
rest = sorted(k for k in fresh if k not in ff)
|
||||
for k in ff + rest:
|
||||
w.writerow([day, k, fresh[k]])
|
||||
return list(fresh)
|
||||
|
||||
|
||||
def launches_per_day(history: dict[str, dict[str, int]]) -> list[tuple[str, int]]:
|
||||
"""(day counted, launches) for each pair of snapshots ONE day apart.
|
||||
|
||||
The snapshot dated D is taken just after midnight UTC, so the difference
|
||||
from D-1 is the launches of calendar day D-1. A gap between snapshots is
|
||||
not a day and is never spread over the missing days.
|
||||
"""
|
||||
dates = sorted(d for d in history if "launches_total" in history[d])
|
||||
out = []
|
||||
for a, b in zip(dates, dates[1:]):
|
||||
if (dt.date.fromisoformat(b) - dt.date.fromisoformat(a)).days != 1:
|
||||
continue
|
||||
delta = history[b]["launches_total"] - history[a]["launches_total"]
|
||||
if delta > 0:
|
||||
out.append((a, delta))
|
||||
return out
|
||||
|
||||
|
||||
def write_daily(path: Path, history: dict[str, dict[str, int]]) -> None:
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with path.open("w", encoding="utf-8", newline="") as f:
|
||||
w = csv.writer(f, lineterminator="\n")
|
||||
w.writerow(["day_utc", "launches"])
|
||||
w.writerows(launches_per_day(history))
|
||||
|
||||
|
||||
# ── badges ──────────────────────────────────────────────────────────────────
|
||||
|
||||
VALUE_PAD = 6
|
||||
COLOUR_LABEL = "#555"
|
||||
CHAR_W = {".": 4.0, "M": 10.0, "k": 6.0} # Verdana 11px advances
|
||||
DIGIT_W = 7.0
|
||||
SAFE_VALUE = re.compile(r"^[0-9]+(\.[0-9]+)?[kM]?$")
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Badge:
|
||||
label: str
|
||||
label_box: int # measured from the committed SVG
|
||||
colour: str
|
||||
file_name: str
|
||||
key: str
|
||||
|
||||
|
||||
BADGES = [
|
||||
Badge("browser launches", 116, "#007ec6", "launches.svg", "launches_total"),
|
||||
Badge("Stars", 43, "#e8a317", "stars.svg", "stars"),
|
||||
]
|
||||
|
||||
|
||||
def format_count(n: int) -> str:
|
||||
"""Two decimals, TRUNCATED: an adoption figure is never rounded up."""
|
||||
if n < 1000:
|
||||
return str(n)
|
||||
scaled, suffix = (n / 1000, "k") if n < 1_000_000 else (n / 1_000_000, "M")
|
||||
text = f"{int(scaled * 100) / 100:.2f}".rstrip("0").rstrip(".")
|
||||
return text + suffix
|
||||
|
||||
|
||||
def render(value: str, badge: Badge) -> bytes:
|
||||
if not SAFE_VALUE.match(value):
|
||||
raise ValueError(f"refusing to draw an unexpected value: {value!r}")
|
||||
box = int(sum(CHAR_W.get(c, DIGIT_W) for c in value) + VALUE_PAD)
|
||||
total = badge.label_box + box
|
||||
lx, vx = badge.label_box / 2, badge.label_box + box / 2
|
||||
aria = f"{badge.label}: {value}"
|
||||
lines = [
|
||||
f'<svg xmlns="http://www.w3.org/2000/svg" width="{total}" height="20"'
|
||||
f' role="img" aria-label="{aria}">',
|
||||
f"<title>{aria}</title>",
|
||||
'<linearGradient id="s" x2="0" y2="100%"><stop offset="0"'
|
||||
' stop-color="#bbb" stop-opacity=".1"/><stop offset="1"'
|
||||
' stop-opacity=".1"/></linearGradient>',
|
||||
f'<clipPath id="r"><rect width="{total}" height="20" rx="3"'
|
||||
' fill="#fff"/></clipPath>',
|
||||
'<g clip-path="url(#r)">',
|
||||
f'<rect width="{badge.label_box}" height="20" fill="{COLOUR_LABEL}"/>',
|
||||
f'<rect x="{badge.label_box}" width="{box}" height="20"'
|
||||
f' fill="{badge.colour}"/>',
|
||||
f'<rect width="{total}" height="20" fill="url(#s)"/>',
|
||||
"</g>",
|
||||
'<g fill="#fff" text-anchor="middle"'
|
||||
' font-family="Verdana,Geneva,DejaVu Sans,sans-serif" font-size="11">',
|
||||
f'<text x="{lx:.1f}" y="15" fill="#010101" fill-opacity=".3">{badge.label}</text>',
|
||||
f'<text x="{lx:.1f}" y="14">{badge.label}</text>',
|
||||
f'<text x="{vx:.1f}" y="15" fill="#010101" fill-opacity=".3">{value}</text>',
|
||||
f'<text x="{vx:.1f}" y="14">{value}</text>',
|
||||
"</g>",
|
||||
"</svg>",
|
||||
]
|
||||
return "\n".join(lines).encode("utf-8")
|
||||
|
||||
|
||||
def write_badges(directory: Path, history: dict[str, dict[str, int]]) -> None:
|
||||
directory.mkdir(parents=True, exist_ok=True)
|
||||
for b in BADGES:
|
||||
days = [d for d in history if b.key in history[d]]
|
||||
if not days:
|
||||
raise SystemExit(f"no {b.key} in the history")
|
||||
(directory / b.file_name).write_bytes(
|
||||
render(format_count(history[max(days)][b.key]), b))
|
||||
|
||||
|
||||
# ── entry point ─────────────────────────────────────────────────────────────
|
||||
|
||||
def run(api: Api, history: Path, daily: Path, badges: Path, today: dt.date) -> int:
|
||||
day = today.isoformat()
|
||||
before = read_history(history)
|
||||
written = append_snapshot(history, day, collect(api))
|
||||
after = read_history(history)
|
||||
write_daily(daily, after)
|
||||
write_badges(badges, after)
|
||||
print(f"[counters] {day}: wrote {len(written)} keys, "
|
||||
f"launches_total={after[day]['launches_total']}")
|
||||
previous = sorted(d for d in before if d < day)
|
||||
if previous and (today - dt.date.fromisoformat(previous[-1])).days > 1:
|
||||
# Recorded anyway, but a hole is a lost measurement: say it in the run.
|
||||
print(f"::warning::no snapshot between {previous[-1]} and {day}: "
|
||||
f"those days cannot be split")
|
||||
return 0
|
||||
|
||||
|
||||
def selftest() -> int:
|
||||
import tempfile
|
||||
fails = []
|
||||
# The row of 2026-11-04 as recorded: the sum must give its total back.
|
||||
if launches_total(2_758_110, 937_317) != 4_616_723:
|
||||
fails.append("sum")
|
||||
if format_count(4_616_723) != "4.61M" or format_count(2554) != "2.55k":
|
||||
fails.append("format")
|
||||
hist = {"2026-11-01": {"launches_total": 100}, "2026-11-02": {"launches_total": 160},
|
||||
"2026-11-04": {"launches_total": 300}}
|
||||
if launches_per_day(hist) != [("2026-11-01", 60)]:
|
||||
fails.append("gap")
|
||||
with tempfile.TemporaryDirectory() as t:
|
||||
p = Path(t) / "h.csv"
|
||||
append_snapshot(p, "2026-11-08", {"stars": 1})
|
||||
if append_snapshot(p, "2026-11-08", {"stars": 2}) or read_history(p)["2026-11-08"]["stars"] != 1:
|
||||
fails.append("idempotent")
|
||||
print("selftest:", "OK" if not fails else "FAIL " + ", ".join(fails))
|
||||
return 1 if fails else 0
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--selftest", action="store_true")
|
||||
ap.add_argument("--history", type=Path)
|
||||
ap.add_argument("--daily", type=Path)
|
||||
ap.add_argument("--badges", type=Path)
|
||||
a = ap.parse_args()
|
||||
if a.selftest:
|
||||
return selftest()
|
||||
if not (a.history and a.daily and a.badges):
|
||||
ap.error("--history, --daily and --badges are required")
|
||||
api = github_api(os.environ.get("GITHUB_TOKEN"))
|
||||
return run(api, a.history, a.daily, a.badges, dt.datetime.now(dt.timezone.utc).date())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,47 @@
|
||||
import socket,json,subprocess,time,os,sys,base64
|
||||
base=os.getcwd(); prof=base+'/prof'; os.makedirs(prof,exist_ok=True)
|
||||
exe=base+'/ex3/core/firefox.exe'
|
||||
open(prof+'/user.js','w').write('user_pref("marionette.port",2828);user_pref("browser.shell.checkDefaultBrowser",false);user_pref("datareporting.policy.dataSubmissionEnabled",false);user_pref("app.update.auto",false);user_pref("app.update.enabled",false);\n')
|
||||
p=subprocess.Popen([exe,'-headless','-marionette','-remote-allow-system-access','-no-remote','-profile',prof,'about:blank'],env=dict(os.environ,MOZ_REMOTE_ALLOW_SYSTEM_ACCESS='1'),stdout=subprocess.DEVNULL,stderr=subprocess.DEVNULL)
|
||||
try:
|
||||
s=None
|
||||
for i in range(60):
|
||||
try:
|
||||
s=socket.create_connection(('127.0.0.1',2828),timeout=5);break
|
||||
except Exception: time.sleep(1)
|
||||
f=s.makefile('rwb',buffering=0)
|
||||
def rd():
|
||||
n=b''
|
||||
while True:
|
||||
c=s.recv(1)
|
||||
if c==b':':break
|
||||
n+=c
|
||||
n=int(n);d=b''
|
||||
while len(d)<n: d+=s.recv(n-len(d))
|
||||
return json.loads(d)
|
||||
mid=[0]
|
||||
def cmd(name,params=None):
|
||||
mid[0]+=1
|
||||
m=json.dumps([0,mid[0],name,params or {}]).encode()
|
||||
s.sendall(str(len(m)).encode()+b':'+m)
|
||||
while True:
|
||||
r=rd()
|
||||
if r[0]==1 and r[1]==mid[0]: return r[2] if r[2] else r[3]
|
||||
s.settimeout(60)
|
||||
rd()
|
||||
cmd('WebDriver:NewSession',{'capabilities':{}})
|
||||
h=cmd('WebDriver:GetWindowHandles'); cmd('WebDriver:SwitchToWindow',{'handle':h[0]})
|
||||
cmd('WebDriver:Navigate',{'url':'data:text/html,<body><p id=p>text</p>'})
|
||||
js="""
|
||||
const fonts=['menu','caption','icon','message-box','small-caption','status-bar','system-ui'];
|
||||
const colors=['Canvas','CanvasText','LinkText','VisitedText','ActiveText','ButtonFace','ButtonText','ButtonBorder','Field','FieldText','GrayText','Highlight','HighlightText','Mark','MarkText','SelectedItem','SelectedItemText','AccentColor','AccentColorText','ActiveBorder','ActiveCaption','AppWorkspace','Background','ButtonHighlight','ButtonShadow','CaptionText','InactiveBorder','InactiveCaption','InactiveCaptionText','InfoBackground','InfoText','Menu','MenuText','Scrollbar','ThreeDDarkShadow','ThreeDFace','ThreeDHighlight','ThreeDLightShadow','ThreeDShadow','Window','WindowFrame','WindowText'];
|
||||
const o={fonts:{},light:{},dark:{},selection:{}};
|
||||
for(const f of fonts){const d=document.createElement('div');d.style.font=f==='system-ui'?'16px system-ui':f;document.body.appendChild(d);const c=getComputedStyle(d);o.fonts[f]={family:c.fontFamily,size:c.fontSize,weight:c.fontWeight,style:c.fontStyle,stretch:c.fontStretch};d.remove();}
|
||||
for(const sch of ['light','dark']){for(const k of colors){const d=document.createElement('div');d.style.colorScheme=sch;d.style.color=k;d.style.backgroundColor=k;document.body.appendChild(d);o[sch][k]=getComputedStyle(d).color;d.remove();}
|
||||
const d=document.createElement('div');d.style.colorScheme=sch;d.textContent='x';document.body.appendChild(d);const c=getComputedStyle(d,'::selection');o.selection[sch]={color:c.color,bg:c.backgroundColor};d.remove();}
|
||||
return o;"""
|
||||
r=cmd('WebDriver:ExecuteScript',{'script':js,'args':[]})
|
||||
json.dump(r['value'] if 'value' in r else r,open(base+'/retail_theme.json','w'),indent=1)
|
||||
print(json.dumps(r)[:1500])
|
||||
finally:
|
||||
subprocess.run(['taskkill','/F','/T','/PID',str(p.pid)],capture_output=True)
|
||||
@@ -0,0 +1,218 @@
|
||||
"""The expected values of tests/test_css_calc_is_windows_e2e.py.
|
||||
|
||||
Run it with `python -I`. Two steps, because a number is only worth testing if
|
||||
the two C libraries give a different page-visible text for it:
|
||||
|
||||
python -I scripts/ucrt_css_calc.py dump OUT # on Windows: ucrtbase.dll's f32 functions
|
||||
python -I scripts/ucrt_css_calc.py dump OUT # on Linux: the host's libm
|
||||
python -I scripts/ucrt_css_calc.py pick WIN LINUX tests/data/ucrt_css_calc.txt
|
||||
|
||||
`dump` computes, for a fixed grid of inputs, what the style engine (Servo's
|
||||
calc.rs) makes of ``calc(1px * sin(x))`` and the others, and the text it then
|
||||
serializes. The style engine does every step in f32 (CSSFloat): the library
|
||||
function is the f32 one (sinf, cosf, tanf, asinf, acosf, atanf, atan2f, expf,
|
||||
logf, powf), an angle is converted to degrees with one f32 multiplication, and
|
||||
a number is written by cssparser's dtoa_short: the shortest decimal that
|
||||
reads back as that f32, rounded half up to 6 significant digits. So two
|
||||
libraries whose results differ in the last f32 bit only show on the page when
|
||||
that bit moves the 6th digit - which `pick` looks for.
|
||||
|
||||
`pick` keeps every input whose text differs between the two dumps, and a few
|
||||
that do not (the control: the same text from both libraries), in the format
|
||||
the test reads:
|
||||
|
||||
<fn> <args...> <text on Windows>
|
||||
|
||||
The reference is ucrtbase's FMA3 code path, the one every Windows 11 CPU runs
|
||||
(the same one idwr_math reproduces); the SSE2 fallback of older CPUs can differ in
|
||||
the last bit and is not what a page on Windows 11 reads.
|
||||
|
||||
Inputs are exact in f32 (multiples of a power of two), so the page and this
|
||||
script read the same number whatever the CSS parser does with decimals.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import ctypes
|
||||
import math
|
||||
import struct
|
||||
import sys
|
||||
from decimal import ROUND_HALF_UP, Decimal
|
||||
from pathlib import Path
|
||||
|
||||
#: Rust's f32::to_degrees multiplier, as an f32.
|
||||
RAD_TO_DEG = struct.unpack("<f", struct.pack("<f", 57.2957795130823208767981548141051703))[0]
|
||||
|
||||
#: How many differing inputs of each function `pick` keeps, and how many of the
|
||||
#: ones that agree.
|
||||
KEEP_DIFFERENT = 6
|
||||
KEEP_SAME = 3
|
||||
|
||||
|
||||
def f32(x: float) -> float:
|
||||
return struct.unpack("<f", struct.pack("<f", x))[0]
|
||||
|
||||
|
||||
def load_libm():
|
||||
if sys.platform == "win32":
|
||||
lib = ctypes.CDLL("ucrtbase.dll")
|
||||
else:
|
||||
lib = ctypes.CDLL("libm.so.6")
|
||||
funcs = {}
|
||||
for name, nargs in (("sinf", 1), ("cosf", 1), ("tanf", 1), ("asinf", 1), ("acosf", 1),
|
||||
("atanf", 1), ("atan2f", 2), ("expf", 1), ("logf", 1), ("powf", 2)):
|
||||
fn = getattr(lib, name)
|
||||
fn.restype = ctypes.c_float
|
||||
fn.argtypes = [ctypes.c_float] * nargs
|
||||
funcs[name] = fn
|
||||
return funcs
|
||||
|
||||
|
||||
def shortest_f32(x: float) -> str:
|
||||
"""The shortest decimal text that reads back as this f32."""
|
||||
for digits in range(1, 10):
|
||||
text = "%.*e" % (digits - 1, x)
|
||||
if f32(float(text)) == x:
|
||||
return text
|
||||
return "%.8e" % x
|
||||
|
||||
|
||||
def serialize(x: float) -> str:
|
||||
"""cssparser's number text for an f32: 6 significant digits, half up,
|
||||
no trailing zeros, no exponent in the range the grid stays in."""
|
||||
if x == 0:
|
||||
return "0"
|
||||
d = Decimal(shortest_f32(x))
|
||||
exp = d.adjusted()
|
||||
q = d.quantize(Decimal(1).scaleb(exp - 5), rounding=ROUND_HALF_UP)
|
||||
text = format(q.normalize(), "f")
|
||||
return "0" if text in ("-0", "") else text
|
||||
|
||||
|
||||
def decimal(k: int, shift: int) -> str:
|
||||
"""k / 2**shift as an exact decimal text."""
|
||||
d = Decimal(k) / Decimal(2 ** shift)
|
||||
return format(d.normalize(), "f")
|
||||
|
||||
|
||||
def grid():
|
||||
"""(fn, args as texts) for every case of the dump."""
|
||||
out = []
|
||||
for fn, lim, shift in (("sin", 16, 10), ("cos", 16, 10), ("tan", 16, 10)):
|
||||
for k in range(-lim << shift, (lim << shift) + 1):
|
||||
out.append((fn, [decimal(k, shift)]))
|
||||
# Finer, over the stretch where the functions bend the most.
|
||||
for k in range(-(4 << 13), (4 << 13) + 1):
|
||||
out.append(("tan", [decimal(k, 13)]))
|
||||
for k in range(-(8 << 12), (8 << 12) + 1):
|
||||
out.append(("atan", [decimal(k, 12)]))
|
||||
for k in range(-(4 << 12), (4 << 12) + 1):
|
||||
out.append(("exp", [decimal(k, 12)]))
|
||||
for k in range(1, 32 * 1024 + 1):
|
||||
out.append(("log", [decimal(k, 10)]))
|
||||
for a in range(-128, 129):
|
||||
for b in range(-128, 129):
|
||||
if a or b:
|
||||
out.append(("atan2", [decimal(a, 6), decimal(b, 6)]))
|
||||
for k in range(-4096, 4097):
|
||||
out.append(("asin", [decimal(k, 12)]))
|
||||
out.append(("acos", [decimal(k, 12)]))
|
||||
for k in range(-8 * 512, 8 * 512 + 1):
|
||||
out.append(("atan", [decimal(k, 9)]))
|
||||
for a in range(-64, 65):
|
||||
for b in range(-64, 65):
|
||||
if a or b:
|
||||
out.append(("atan2", [decimal(a, 4), decimal(b, 4)]))
|
||||
for k in range(-10 * 256, 10 * 256 + 1):
|
||||
out.append(("exp", [decimal(k, 8)]))
|
||||
for k in range(1, 64 * 64 + 1):
|
||||
out.append(("log", [decimal(k, 6)]))
|
||||
for a in range(2, 513):
|
||||
for b in (2, 3, 5, 7, 10):
|
||||
out.append(("log", [decimal(a, 3), str(b)]))
|
||||
for a in range(-32, 33):
|
||||
for b in range(-32, 33):
|
||||
out.append(("hypot", [decimal(a * 3, 4), decimal(b * 5, 4)]))
|
||||
for a in range(4, 257):
|
||||
for b in range(-64, 65):
|
||||
out.append(("pow", [decimal(a, 4), decimal(b, 4)]))
|
||||
return out
|
||||
|
||||
|
||||
def evaluate(lib, fn, args):
|
||||
"""(text, unit) the page shows, from f32 steps."""
|
||||
v = [f32(float(a)) for a in args]
|
||||
if fn in ("sin", "cos", "tan", "exp"):
|
||||
return serialize(f32(lib[fn + "f"](v[0]))), "px"
|
||||
if fn == "log":
|
||||
if len(v) == 1:
|
||||
return serialize(f32(lib["logf"](v[0]))), "px"
|
||||
return serialize(f32(f32(lib["logf"](v[0])) / f32(lib["logf"](v[1])))), "px"
|
||||
if fn == "hypot":
|
||||
# powi(2) is a product, the sum is f32, sqrt is exact in IEEE: no library
|
||||
# function here, so no difference between the two - the control.
|
||||
return serialize(f32(math.sqrt(f32(f32(v[0] * v[0]) + f32(v[1] * v[1]))))), "px"
|
||||
if fn == "pow":
|
||||
return serialize(f32(lib["powf"](v[0], v[1]))), "px"
|
||||
if fn in ("asin", "acos", "atan"):
|
||||
return serialize(f32(f32(lib[fn + "f"](v[0])) * RAD_TO_DEG)), "deg"
|
||||
if fn == "atan2":
|
||||
return serialize(f32(f32(lib["atan2f"](v[0], v[1])) * RAD_TO_DEG)), "deg"
|
||||
raise ValueError(fn)
|
||||
|
||||
|
||||
def dump(out: Path) -> None:
|
||||
lib = load_libm()
|
||||
lines = []
|
||||
for fn, args in grid():
|
||||
text, unit = evaluate(lib, fn, args)
|
||||
if text in ("nan", "inf", "-inf") or "e" in text.lower():
|
||||
continue
|
||||
lines.append("%s %s %s%s" % (fn, " ".join(args), text, unit))
|
||||
out.write_text("\n".join(lines) + "\n")
|
||||
print("wrote %s: %d cases (%s)" % (out, len(lines), sys.platform))
|
||||
|
||||
|
||||
def read(path: Path) -> dict:
|
||||
cases = {}
|
||||
for line in path.read_text().splitlines():
|
||||
parts = line.split()
|
||||
cases[tuple(parts[:-1])] = parts[-1]
|
||||
return cases
|
||||
|
||||
|
||||
def pick(win: Path, linux: Path, out: Path) -> None:
|
||||
a, b = read(win), read(linux)
|
||||
chosen = ["# Expected text of getComputedStyle for calc(1px * f(args)) (word-spacing)",
|
||||
"# and of rotate: f(args) for the angle functions, from ucrtbase.dll's f32",
|
||||
"# functions. Generated by scripts/ucrt_css_calc.py (python -I) - do not edit.",
|
||||
"# <fn> <args...> <text on Windows>"]
|
||||
stats = []
|
||||
for fn in ("sin", "cos", "tan", "asin", "acos", "atan", "atan2", "exp", "log", "pow", "hypot"):
|
||||
keys = sorted(k for k in a if k[0] == fn and k in b)
|
||||
different = [k for k in keys if a[k] != b[k]]
|
||||
same = [k for k in keys if a[k] == b[k]]
|
||||
# Spread over the list, not the first ones.
|
||||
step_d = max(1, len(different) // KEEP_DIFFERENT)
|
||||
quarter = max(1, len(same) // 4)
|
||||
take = different[::step_d][:KEEP_DIFFERENT] + same[quarter::quarter][:KEEP_SAME]
|
||||
stats.append("%s: %d of %d differ" % (fn, len(different), len(keys)))
|
||||
for k in take:
|
||||
chosen.append("%s %s" % (" ".join(k), a[k]))
|
||||
out.write_text("\n".join(chosen) + "\n")
|
||||
print("\n".join(stats))
|
||||
print("wrote %s" % out)
|
||||
|
||||
|
||||
def main(argv) -> int:
|
||||
if len(argv) == 3 and argv[1] == "dump":
|
||||
dump(Path(argv[2]))
|
||||
elif len(argv) == 5 and argv[1] == "pick":
|
||||
pick(Path(argv[2]), Path(argv[3]), Path(argv[4]))
|
||||
else:
|
||||
print(__doc__)
|
||||
return 2
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
@@ -194,7 +194,12 @@ def main() -> int:
|
||||
import os
|
||||
env = dict(os.environ)
|
||||
env["INVPW_BINARY_PATH"] = a.binary
|
||||
env["PYTHONPATH"] = str(ROOT)
|
||||
# ⛔ THIS CHECKOUT'S `src` TOO, or the suite measures whatever wrapper is
|
||||
# INSTALLED: `ROOT` alone only makes `scripts._upstream_alias` importable,
|
||||
# and `invisible_playwright` then resolves to the editable install, which
|
||||
# from a worktree is somebody else's tree on somebody else's commit. A
|
||||
# branch measured that way reports main's numbers as its own.
|
||||
env["PYTHONPATH"] = os.pathsep.join([str(ROOT), str(ROOT / "src")])
|
||||
|
||||
if not a.per_file:
|
||||
print("running: %s" % " ".join(argv[3:]))
|
||||
|
||||
@@ -11,7 +11,7 @@ the user receives.
|
||||
|
||||
| folder | what it is | license |
|
||||
|---|---|---|
|
||||
| `_pw/` | Playwright's Python client, version **1.61.1** | Apache-2.0 (`_pw/LICENSE`) |
|
||||
| `_pw/` | Playwright's Python client, version **1.61.0** | Apache-2.0 (`_pw/LICENSE`) |
|
||||
|
||||
The client's namespace is `invisible_playwright._pw` instead of `playwright`, so
|
||||
it does not collide with a stock `playwright` that might be installed alongside
|
||||
|
||||
@@ -98,11 +98,17 @@ def assert_playwright_range() -> None:
|
||||
|
||||
if t(seal.playwright_min) <= t(have) <= t(seal.playwright_max):
|
||||
return
|
||||
# Spelled by the tool that installed this package (`invisible_core.installer`):
|
||||
# a written `pip install` is a command the venv the README makes does not have.
|
||||
from invisible_core.installer import install
|
||||
from invisible_core.pin import format_command
|
||||
|
||||
fix = format_command(install("invisible-playwright", f"playwright=={seal.playwright_max}"))
|
||||
msg = (f"playwright {have} is outside the range this engine was tested with "
|
||||
f"({seal.playwright_min} .. {seal.playwright_max}, from the seal for {seal.tag}).\n"
|
||||
f"The Juggler protocol schema is closed-world: an untested client can kill every "
|
||||
f"session at context creation.\n"
|
||||
f'Run: pip install "playwright=={seal.playwright_max}" '
|
||||
f"Run: {fix} "
|
||||
f"(or set INVISIBLE_PLAYWRIGHT_SKEW=allow to proceed anyway)")
|
||||
if os.environ.get("INVISIBLE_PLAYWRIGHT_SKEW") == "allow":
|
||||
warnings.warn(msg, RuntimeWarning, stacklevel=2)
|
||||
|
||||
@@ -15,9 +15,17 @@ there has to move.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
|
||||
def _js_number(value: Any) -> str:
|
||||
"""A number as JavaScript prints it in a template literal: `111`, never
|
||||
Python's `111.0` (the timeout of an expect's call log, [B341])."""
|
||||
number = float(value)
|
||||
return str(int(number)) if number.is_integer() else repr(number)
|
||||
|
||||
|
||||
def _caller_timeout(params: Dict, default_ms: float = 30000) -> Optional[float]:
|
||||
"""The caller's timeout off the wire, in seconds; None is no limit.
|
||||
|
||||
@@ -34,74 +42,45 @@ def _caller_timeout(params: Dict, default_ms: float = 30000) -> Optional[float]:
|
||||
return default_ms / 1000.0
|
||||
|
||||
|
||||
def _as_callable(expression: str, argument: Any) -> str:
|
||||
"""Wrap an expression so it can always be CALLED with the argument.
|
||||
#: What JavaScript's `String.prototype.trim` removes, WhiteSpace and
|
||||
#: LineTerminator, and nothing else: Python's `str.strip()` also removes U+0085
|
||||
#: and U+001C-U+001F, and keeps U+FEFF.
|
||||
_JS_WHITESPACE = ("\t\n\v\f\r \u00a0\u1680\u2000\u2001\u2002\u2003\u2004"
|
||||
"\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f"
|
||||
"\u205f\u3000\ufeff")
|
||||
|
||||
<M> PLAYWRIGHT SENDS BOTH FORMS DOWN THE SAME FIELD. `page.evaluate("1+1")`
|
||||
and `page.evaluate("() => document.title")` arrive as the same
|
||||
`expression` string, and the client does not say which is which. Evaluating
|
||||
the raw string works for the first and, for the second, produces a FUNCTION
|
||||
OBJECT: no error, no exception, and the caller gets None back for a call
|
||||
that looked fine.
|
||||
|
||||
Measured on 2026-08-27: `page.evaluate("() => !!x")` answered None, and the
|
||||
assertion that caught it read like the browser had changed behaviour.
|
||||
def _as_script(expression: str) -> str:
|
||||
"""The caller's text as Playwright evaluates it ([B340]).
|
||||
|
||||
So the string is wrapped and the result called if it turned out to be a
|
||||
function. Deciding by shape - does it start with `(` or `function` or
|
||||
`async` - is the version that gets it wrong: `(1+2)` starts with a
|
||||
parenthesis and is not a function.
|
||||
Playwright's server passes `page.evaluate`'s text through
|
||||
`normalizeEvaluationExpression` and its utility script runs it with
|
||||
`globalThis.eval`: the text is a SCRIPT, so a statement with its semicolon
|
||||
is fine and the value is the script's completion value, and when that
|
||||
value is a function it is called with the argument (`_run_callers_code`
|
||||
in `server.py`). The client sends both forms down the same field without
|
||||
saying which, so the function is recognised by what the script produced,
|
||||
never by its shape: `(1+2)` starts with a parenthesis and is not one.
|
||||
|
||||
<M> THE ARGUMENT GOES IN HERE, IN THE SAME PASS, AND THAT IS THE WHOLE
|
||||
POINT. It used to be spelled `r(ARG)` and the caller substituted it
|
||||
afterwards with `.replace("ARG", ...)` - over a string that already held
|
||||
the caller's expression. So every uppercase `ARG` a caller wrote was
|
||||
rewritten to the argument's JSON, inside their own code, silently.
|
||||
⛔ UNTIL [B340] THE TEXT WAS PUT INSIDE AN EXPRESSION, `const r = (TEXT);`,
|
||||
so that its result could be called in the same pass, and an expression is
|
||||
all a pair of parentheses holds: `setTimeout(...);` died with "missing ) in
|
||||
parenthetical" where Playwright runs it. And the page could see that
|
||||
scaffolding around the caller's code. Nothing is added now; the text is
|
||||
normalised as Playwright normalises it when the client does not say
|
||||
whether it is a function: trimmed as JavaScript trims, and a `function` or
|
||||
`async function` DECLARATION put in parentheses, so that it is a value
|
||||
rather than a statement whose completion value is undefined.
|
||||
|
||||
Measured on 2026-09-14 by driving it: `'CARGO'.length` answered 6 instead
|
||||
of 5, because the source that ran was `'CnullO'.length`; a selector
|
||||
`[data-role='TARGET']` became `[data-role='TnullET']` and matched nothing;
|
||||
`/ARGH/` became `/nullH/`; and `const ARG = 5` was a SyntaxError. The three
|
||||
letters need only appear inside a longer word - MARGIN, LARGE, CHARGE - and
|
||||
three of those four failures are silent, which is the bad kind.
|
||||
|
||||
A format string is only scanned where the format string itself is, so the
|
||||
expression is an ARGUMENT to `%` and never a place `%` looks.
|
||||
⛔ AND THE ARGUMENT IS NOT IN THE TEXT. It used to be written into the
|
||||
wrapper, once as a placeholder that a `.replace` then hunted for inside the
|
||||
caller's own code (`'CARGO'.length` answered 6, measured 2026-09-14). It is
|
||||
a protocol argument of the call now, so there is nothing to find.
|
||||
"""
|
||||
return "(() => { %s })()" % _invocation(expression, argument)
|
||||
|
||||
|
||||
def _invocation(expression: str, argument: Any, *receivers: str) -> str:
|
||||
"""The statements that evaluate the caller's expression and, when it is a
|
||||
function, call it with `receivers` first and the argument last.
|
||||
|
||||
<M> THE ONLY PLACE THAT SPELLS THE CALL. The main-world wrapper above and
|
||||
the three element-scoped ones (`handle.evaluate`, `eval_on_selector`,
|
||||
`eval_on_selector_all`) used to write it out each on its own, and that is
|
||||
how the argument reached `handle.evaluate` and was dropped by the other
|
||||
two: a callback reading its second parameter got `undefined` there.
|
||||
|
||||
The main-world output is pinned byte for byte by
|
||||
`test_the_argument_does_not_rewrite_the_expression.py`, because that one
|
||||
runs as the page.
|
||||
"""
|
||||
return ("const r = (%s); return typeof r === 'function' ? r(%s) : r;"
|
||||
% (expression,
|
||||
", ".join(receivers + (json.dumps(argument, default=str),))))
|
||||
|
||||
|
||||
def _called_on(params: Dict, receiver: str) -> str:
|
||||
"""The body of an element-scoped wrapper: the caller's function called
|
||||
with `receiver` and the caller's argument, Playwright's `fn(element, arg)`.
|
||||
"""
|
||||
return _invocation(params["expression"], _deserialize(params.get("arg")),
|
||||
receiver)
|
||||
|
||||
|
||||
def _element_function(params: Dict) -> str:
|
||||
"""The declaration `handle.evaluate` and `eval_on_selector` both send: one
|
||||
element, then the argument. Both run in the utility world."""
|
||||
return "(injected, el) => { %s }" % _called_on(params, "el")
|
||||
text = expression.strip(_JS_WHITESPACE)
|
||||
if re.match(r"(async)?\s*function(\s|\()", text):
|
||||
text = "(" + text + ")"
|
||||
return text
|
||||
|
||||
|
||||
def _deserialize(value: Any) -> Any:
|
||||
@@ -125,16 +104,6 @@ def _deserialize(value: Any) -> Any:
|
||||
return None
|
||||
|
||||
|
||||
def _with_argument(params: Dict) -> str:
|
||||
"""The expression, callable, with the caller's argument placed in it.
|
||||
|
||||
<M> THE ONLY PLACE THAT BUILDS THIS. `wait_for_function` used to repeat the
|
||||
two lines inline, which is how one of the two could have been fixed and the
|
||||
other left alone.
|
||||
"""
|
||||
return _as_callable(params["expression"], _deserialize(params.get("arg")))
|
||||
|
||||
|
||||
def _js_string(value: str) -> str:
|
||||
"""A Python string as a JavaScript literal.
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
"""A dialog is answered after the time a reader would take, not at pipe speed.
|
||||
|
||||
⛔ WHAT IT REPLACES. `alert`, `confirm` and `prompt` were answered in the same
|
||||
millisecond they opened: the client's auto-dismiss (no handler registered) and
|
||||
a handler's own `accept()`/`dismiss()` both sent `Page.handleDialog` the moment
|
||||
the event reached them. No person closes a dialog before it has been painted,
|
||||
let alone read; a page timing `alert()`'s return saw a few milliseconds where
|
||||
every browser in the world shows hundreds. The stock driver does the same, so
|
||||
this is not a tell of one driver but of all of them, which is exactly why a
|
||||
site can afford to test for it.
|
||||
|
||||
The pause is drawn from the session's seed, like every other rhythm of this
|
||||
package: one seed, one reader, the same reader on every machine. It has a
|
||||
reaction part (noticing the dialog, moving to the button) and a reading part
|
||||
that grows with the words. Both are log-normal, both clamped, and each dialog
|
||||
of a page draws its own, so two dialogs with the same text do not take the
|
||||
same time.
|
||||
|
||||
The remainder is what is waited: a handler that spent its own time deciding is
|
||||
not asked to wait again for what already passed.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import math
|
||||
import random
|
||||
from typing import Optional
|
||||
|
||||
#: Noticing the dialog and reaching the button: median and spread (log-normal).
|
||||
REACTION_MEDIAN_MS = 650.0
|
||||
REACTION_SIGMA = 0.35
|
||||
#: Reading, per word.
|
||||
PER_WORD_MEDIAN_MS = 230.0
|
||||
PER_WORD_SIGMA = 0.30
|
||||
#: No reader is faster or slower than this.
|
||||
FLOOR_MS = 350.0
|
||||
CEILING_MS = 8000.0
|
||||
|
||||
|
||||
def _rng(seed: int, page: int, ordinal: int) -> random.Random:
|
||||
"""One stream per (seed, page, dialog). Hashed to an int on purpose:
|
||||
`random.Random` seeds a tuple through `hash()`, and the hash of a str
|
||||
changes from one process to the next."""
|
||||
key = f"dialog:{seed}:{page}:{ordinal}".encode()
|
||||
return random.Random(int.from_bytes(hashlib.sha256(key).digest()[:8], "big"))
|
||||
|
||||
|
||||
def _log_normal(rng: random.Random, median: float, sigma: float) -> float:
|
||||
return median * math.exp(rng.gauss(0.0, sigma))
|
||||
|
||||
|
||||
def plan_answer_ms(seed: Optional[int], page: int, ordinal: int,
|
||||
message: str) -> float:
|
||||
"""How long after it opened this dialog is answered, in ms.
|
||||
|
||||
`seed` is None when the session has no rhythm (humanising off): then there
|
||||
is no pause, which is what every other seeded rhythm does with None."""
|
||||
if seed is None:
|
||||
return 0.0
|
||||
rng = _rng(seed, page, ordinal)
|
||||
words = len(message.split())
|
||||
total = _log_normal(rng, REACTION_MEDIAN_MS, REACTION_SIGMA)
|
||||
for _ in range(words):
|
||||
total += _log_normal(rng, PER_WORD_MEDIAN_MS, PER_WORD_SIGMA)
|
||||
return min(CEILING_MS, max(FLOOR_MS, total))
|
||||
|
||||
|
||||
def remaining_ms(planned_ms: float, opened_at: float, now: float) -> float:
|
||||
"""What is still to wait: the plan minus the time already gone since the
|
||||
dialog opened (both clocks in seconds, from the same monotonic source)."""
|
||||
elapsed_ms = (now - opened_at) * 1000.0
|
||||
return max(0.0, planned_ms - elapsed_ms)
|
||||
@@ -31,9 +31,10 @@ be, and the failure surfaces later, in a property access far from the cause.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import contextvars
|
||||
import itertools
|
||||
import threading
|
||||
from typing import Any, Callable, Dict, Optional
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
from . import perimeter
|
||||
# One class for a target that is gone, raised here for a disposed object and
|
||||
@@ -59,9 +60,37 @@ class ExpectNotMet(ProtocolException):
|
||||
reads (`_frame.py` `_expect`) to build its AssertionError: `received` is
|
||||
the last value seen, serialized, and `timedOut` says the wait ran out."""
|
||||
|
||||
def __init__(self, message: str, details: Dict) -> None:
|
||||
def __init__(self, message: str, details: Dict,
|
||||
log: Optional[List[str]] = None) -> None:
|
||||
super().__init__(message)
|
||||
self.details = details
|
||||
#: The call's log, which the reply carries as `log` ([B341]).
|
||||
self.log = list(log or [])
|
||||
|
||||
|
||||
class CallLog:
|
||||
"""What one call did, line by line: the log Playwright's server keeps per
|
||||
call (its progress, `metadata.log`) and sends with a failure, where the
|
||||
client prints it under "Call log:" ([B341]). `title` is the one the
|
||||
client sent in the call's metadata, as Playwright's `renderTitleForCall`
|
||||
reads it, or the method's name."""
|
||||
|
||||
def __init__(self, title: str) -> None:
|
||||
self.title = title
|
||||
self.lines: List[str] = []
|
||||
|
||||
def log(self, line: str) -> None:
|
||||
self.lines.append(line)
|
||||
|
||||
|
||||
#: The call this thread is answering. Set by `Server.handle` around the
|
||||
#: dispatch; each worker thread answers one call at a time.
|
||||
_CURRENT_CALL: "contextvars.ContextVar[CallLog]" = contextvars.ContextVar("call")
|
||||
|
||||
|
||||
def current_call() -> CallLog:
|
||||
"""The log of the call being answered, or a fresh one outside a call."""
|
||||
return _CURRENT_CALL.get(None) or CallLog("")
|
||||
|
||||
|
||||
class Dispatcher:
|
||||
@@ -340,7 +369,12 @@ class Server:
|
||||
raise ProtocolException(
|
||||
"no object %r to answer %r: it was never created"
|
||||
% (guid, method))
|
||||
return obj.call(method, params)
|
||||
metadata = message.get("metadata") or {}
|
||||
token = _CURRENT_CALL.set(CallLog(metadata.get("title") or method or ""))
|
||||
try:
|
||||
return obj.call(method, params)
|
||||
finally:
|
||||
_CURRENT_CALL.reset(token)
|
||||
|
||||
def handle_root(self, method: str, params: Dict) -> Any:
|
||||
raise ProtocolException("the root has no method %r" % method)
|
||||
@@ -156,7 +156,6 @@ COURTESY = {
|
||||
#: revisit on our own: honouring them would mean inventing an answer.
|
||||
NO_ENGINE_COMMAND = {
|
||||
"drop",
|
||||
"setOffline",
|
||||
"setWebSocketInterceptionPatterns",
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -295,6 +295,11 @@ class InProcessTransport(Transport):
|
||||
details = getattr(failure, "details", None)
|
||||
if details is not None:
|
||||
out["errorDetails"] = details
|
||||
# And its call log, where `Connection.dispatch` reads it: the client
|
||||
# prints it under "Call log:" ([B341]).
|
||||
log = getattr(failure, "log", None)
|
||||
if log:
|
||||
out["log"] = list(log)
|
||||
self.emit_message(out)
|
||||
|
||||
# ── choosing one ────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -19,11 +19,12 @@ is the whole floor, and its except branches classify the failure:
|
||||
installed at all, or it is older than this check and ships no
|
||||
invisible_core.pin (or no invisible_core.pin.enforce_core_pin). Those
|
||||
cannot be told apart from here and do not need to be: one remedy fixes all
|
||||
of them, `pip install --force-reinstall invisible-playwright`, which makes
|
||||
pip resolve the core version from our own Requires-Dist. No version literal
|
||||
in the message, so nothing here can drift out of step with pyproject.
|
||||
of them, a force-reinstall of invisible-playwright (`reinstall_command`, spelled
|
||||
by the tool that installed it), which makes the installer resolve the core
|
||||
version from our own Requires-Dist. No version literal in the message, so
|
||||
nothing here can drift out of step with pyproject.
|
||||
* ImportError naming any other module - the core is installed and one of ITS
|
||||
dependencies is missing. That is what `pip install --no-deps` leaves behind,
|
||||
dependencies is missing. That is what an install with `--no-deps` leaves behind,
|
||||
and reporting it as "invisible-core is not installed" sends the user to the
|
||||
wrong package.
|
||||
* anything else - the core is on disk and its import raised something that is
|
||||
@@ -51,6 +52,31 @@ import sys as _sys
|
||||
|
||||
DIST_NAME = "invisible-playwright"
|
||||
|
||||
|
||||
def reinstall_command() -> str:
|
||||
"""The command that reinstalls this distribution, as the tool that
|
||||
installed it spells it: the one remedy this floor hands over.
|
||||
|
||||
`invisible_core.installer` is where every other install command comes from,
|
||||
and it cannot be asked here: the floor speaks exactly when the core does not
|
||||
import. So this reads the same INSTALLER record with the standard library
|
||||
and takes the same two branches, for this one command. Until 2026-10-17 it was
|
||||
`pip install --force-reinstall` for everybody, and the venv the README makes
|
||||
(`uv init` + `uv add`) has no pip in it.
|
||||
"""
|
||||
from importlib.metadata import PackageNotFoundError, distribution
|
||||
|
||||
try:
|
||||
record = distribution(DIST_NAME).read_text("INSTALLER")
|
||||
except PackageNotFoundError:
|
||||
record = None
|
||||
if (record or "").strip().lower() == "uv":
|
||||
cmd = ["uv", "pip", "install", "--python", _sys.executable,
|
||||
"--force-reinstall", DIST_NAME]
|
||||
else:
|
||||
cmd = [_sys.executable, "-m", "pip", "install", "--force-reinstall", DIST_NAME]
|
||||
return " ".join(f'"{t}"' if " " in t else t for t in cmd)
|
||||
|
||||
# Captured BEFORE the core is imported, and it is the whole soundness argument
|
||||
# for the in-process repair: if nothing has imported invisible_core by the time
|
||||
# this package's __init__ starts, then nobody is holding an object from the
|
||||
@@ -105,16 +131,16 @@ except ImportError as _e:
|
||||
f"invisible-core is installed but cannot be imported: no module named "
|
||||
f"{_missing!r}.\n"
|
||||
f"That is one of its own dependencies, so it was installed without "
|
||||
f"dependency resolution (pip install --no-deps, or a lockfile that "
|
||||
f"lists the packages separately).\n"
|
||||
f"Run: pip install --force-reinstall {DIST_NAME}"
|
||||
f"dependency resolution (an install with --no-deps, or a lockfile "
|
||||
f"that lists the packages separately).\n"
|
||||
f"Run: {reinstall_command()}"
|
||||
) from _e
|
||||
raise ImportError(
|
||||
"invisible-core is missing, or too old for this invisible-playwright: it "
|
||||
"does not carry the release-pin check (invisible_core.pin), so the engine "
|
||||
"it downloads cannot be matched against the configuration this package "
|
||||
"ships.\n"
|
||||
f"Run: pip install --force-reinstall {DIST_NAME}"
|
||||
f"Run: {reinstall_command()}"
|
||||
) from _e
|
||||
except Exception as _e:
|
||||
raise ImportError(
|
||||
@@ -124,7 +150,7 @@ except Exception as _e:
|
||||
f"unreadable invisible_core/seal.json is the usual cause, and it is read "
|
||||
f"while invisible_core is still importing, so nothing inside the core can "
|
||||
f"report it.\n"
|
||||
f"Run: pip install --force-reinstall {DIST_NAME}"
|
||||
f"Run: {reinstall_command()}"
|
||||
) from _e
|
||||
|
||||
|
||||
|
||||
@@ -1,75 +1,37 @@
|
||||
# Il client Python di Playwright, biforcato
|
||||
# Playwright's Python client, vendored
|
||||
|
||||
Copia modificabile di `playwright` **1.61.0** (`_impl`, `sync_api`, `async_api`),
|
||||
Apache-2.0. **67 file, 2,4 MB.** La meta' Node del fork sta in `../_driver/`, e
|
||||
il documento che spiega la decisione e' [quello](../_driver/README.md): qui ci
|
||||
sono solo le cose che riguardano il lato Python.
|
||||
A modified copy of `playwright` **1.61.0** (`_impl`, `sync_api`, `async_api`),
|
||||
Apache-2.0 (`LICENSE` in this folder). The namespace is
|
||||
`invisible_playwright._pw` instead of `playwright`, so it never collides with a
|
||||
stock `playwright` installed alongside it. What answers this client is the
|
||||
in-process server in `../_juggler/`; Playwright's Node driver is not shipped
|
||||
(`../THIRD_PARTY_FORK.md` has the licence terms and the history).
|
||||
|
||||
## Cosa e' stato cambiato rispetto all'originale
|
||||
## What differs from upstream
|
||||
|
||||
**Gli import, in 52 file su 67.** Il client usa **446 import assoluti**
|
||||
(`from playwright...`) e **zero relativi**: copiarlo sotto un altro nome senza
|
||||
riscriverli avrebbe prodotto un pacchetto che importa quello *installato*, cioe'
|
||||
un fork che sembra funzionare e non e' un fork.
|
||||
**The imports.** Every absolute `playwright...` import is rewritten to this
|
||||
namespace, anchored at the start of the line, because the word `playwright` also
|
||||
appears in docstrings, documentation URLs, examples and two local variables.
|
||||
`tests/test_fork.py` keeps it that way: a new `from playwright...` line would
|
||||
still run, against the installed package, and silently stop being this code.
|
||||
|
||||
Le riscritture sono **ancorate a inizio riga**. Non e' pignoleria: la parola
|
||||
`playwright` compare 423 volte in docstring, URL della documentazione ed esempi
|
||||
(`browser = playwright.chromium.launch()`), e in due punti e' una **variabile
|
||||
locale** (`_impl/_browser_type.py:286`, `_impl/_fetch.py:66`). Un replace globale
|
||||
le avrebbe rovinate tutte.
|
||||
**The behaviour, in these files only.** Each change carries a
|
||||
`# MODIFIED by invisible_playwright:` comment at the point it is made, which is
|
||||
also where the repository's English gate reads it.
|
||||
|
||||
Cinque forme, censite invece che indovinate:
|
||||
|
||||
| forma | quante |
|
||||
| file | what changed |
|
||||
|---|---|
|
||||
| `from playwright.X import ...` | 353 |
|
||||
| `from playwright.{sync,async}_api import ...` | 74 |
|
||||
| `import playwright.X[.Y] [as Z]` | 10 |
|
||||
| `import playwright` | 2 |
|
||||
| `from playwright._repo_version import ...` | 1 |
|
||||
| `_impl/_browser.py` | the numbers of the pages the script asks for, 0, 1, 2, in the order of the calls, reserved before the first `await`; the only counter of them |
|
||||
| `_impl/_browser_context.py` | each page the script asks for carries its number in the session, reserved on the client at the moment of the call, where the order of the calls exists |
|
||||
| `_impl/_connection.py` | the execution-context guarantee is extracted out of `dispatch`, so a fused type (`Dialog`) gets it too: without it a sync `dialog.accept()` inside the `dialog` callback hangs |
|
||||
| `_impl/_playwright.py` | asking for `chromium` or `webkit` raises a `ValueError` that says they were removed, not disabled |
|
||||
| `sync_api/_generated.py`, `async_api/_generated.py` | the `chromium` and `webkit` properties raise `NotImplementedError` with the same explanation, instead of an `AttributeError` |
|
||||
| `sync_api/_context_manager.py`, `async_api/_context_manager.py` | the transport comes from `make_transport` (the in-process server), and the impl-side objects are bound for the fused types |
|
||||
|
||||
⛔ La terza forma **era sfuggita al primo giro**, e il primo giro sembrava
|
||||
riuscito. Dieci import sopravvissuti puntavano ancora al pacchetto installato.
|
||||
Li ha trovati il controllo che rilegge l'albero riscritto cercando residui: e'
|
||||
per quello che esiste, non per fare bella figura.
|
||||
Everything else is upstream, byte for byte.
|
||||
|
||||
**Un effetto collaterale degli import puntati.** `import playwright._impl._X`
|
||||
senza alias lasciava usabile il nome nudo `playwright`, e i due `__init__.py`
|
||||
delle API se ne servono ventitre volte a testa (`playwright._impl._api_structures.Cookie`).
|
||||
Dopo la riscrittura quel nome non era piu' legato da nessuno: il modulo sarebbe
|
||||
esploso con `NameError` alla prima riga eseguita. Il generatore aggiunge il
|
||||
legame nei file che si trovavano in quella condizione.
|
||||
## Regenerating
|
||||
|
||||
**`_impl/_driver.py` e' l'unico file in cui e' cambiato del COMPORTAMENTO**, e
|
||||
la modifica e' dichiarata in testa al file come chiede Apache-2.0: punta al
|
||||
`cli.js` in `../_driver/` e prende `node` da `invisible_playwright._node`.
|
||||
L'originale calcolava entrambi da `inspect.getfile(playwright)`, che dopo la
|
||||
vendorizzazione punterebbe a `_pw/driver/` - una cartella che non esiste.
|
||||
|
||||
## Cosa NON e' stato toccato
|
||||
|
||||
Tutto il resto, byte per byte. Il fork esiste per poter cambiare
|
||||
`../_driver/package/lib/coreBundle.js`; il client Python e' venuto dietro solo
|
||||
perche' senza di lui la dipendenza da `playwright` sarebbe rimasta.
|
||||
|
||||
## Come rifarlo
|
||||
|
||||
`playwright` resta fra le dipendenze di **sviluppo** apposta: serve come
|
||||
sorgente per rigenerare questa cartella, e serve a poter confrontare i due
|
||||
bracci sulla stessa macchina. Un fork che non si puo' confrontare con
|
||||
l'originale non si puo' nemmeno difendere.
|
||||
|
||||
Il generatore vive nel workbench (`C:/tmp/vendor_client.py` al momento della
|
||||
prima stesura) e va rimesso in un posto stabile prima di servirne un secondo
|
||||
giro.
|
||||
|
||||
## Verificato
|
||||
|
||||
- **454 test** della suite del wrapper, verdi sullo stack interamente biforcato.
|
||||
- Una sessione completa del prodotto confrontata coi valori misurati **prima**
|
||||
del fork: user agent, `navigator.languages`, geometria dello schermo, renderer
|
||||
WebGL e **screenshot identico byte per byte** (9656). Zero differenze.
|
||||
- `tests/test_fork.py` impedisce il modo silenzioso in cui questo fork
|
||||
morirebbe: qualcuno che scrive `from playwright...` in un file nuovo. Quella
|
||||
riga **funziona** - il pacchetto resta installato - e semplicemente esegue
|
||||
codice che non e' il nostro.
|
||||
`playwright==1.61.0` stays among the **development** dependencies on purpose: it is
|
||||
the source this folder is regenerated from, and the reference it is compared
|
||||
against. The changes above are re-applied by their markers.
|
||||
@@ -27,7 +27,8 @@ from invisible_playwright._pw._impl._connection import format_call_log
|
||||
from invisible_playwright._pw._impl._errors import Error
|
||||
from invisible_playwright._pw._impl._fetch import APIResponse
|
||||
from invisible_playwright._pw._impl._helper import is_textual_mime_type
|
||||
from invisible_playwright._pw._impl._js_handle import parse_value
|
||||
# MODIFIED by invisible_playwright: `parse_value` is no longer imported, since
|
||||
# `_expect_impl` uses the value `Frame._expect` already parsed ([B344]).
|
||||
from invisible_playwright._pw._impl._locator import Locator
|
||||
from invisible_playwright._pw._impl._page import Page
|
||||
from invisible_playwright._pw._impl._str_utils import escape_regex_flags
|
||||
@@ -106,8 +107,16 @@ class AssertionsBase:
|
||||
aria_snapshot = None
|
||||
if isinstance(received, dict):
|
||||
aria_snapshot = received.get("ariaSnapshot")
|
||||
value = received.get("value")
|
||||
actual = parse_value(value) if value is not None else None
|
||||
# MODIFIED by invisible_playwright: the value is used as it
|
||||
# arrives. `Frame._expect` has already turned it from its wire
|
||||
# form into a Python value, and a second `parse_value` read that
|
||||
# value AS the wire form: a dict whose keys are serialization
|
||||
# tags became something else, {"v": "x"} became "x" and
|
||||
# {"n": 5} became 5, and {"a": 1} died with KeyError: 'id'
|
||||
# instead of giving the assertion's message. Identical in
|
||||
# Playwright 1.61.0 and on its main branch of 2026-10-16
|
||||
# ([B344]).
|
||||
actual = received.get("value")
|
||||
else:
|
||||
actual = received
|
||||
if self._custom_message:
|
||||
|
||||
@@ -47,8 +47,8 @@ class Playwright(ChannelOwner):
|
||||
# AttributeError on a field that nobody sets anymore.
|
||||
if value in ("chromium", "webkit"):
|
||||
raise ValueError(
|
||||
"invisible_playwright pilota SOLO Firefox: il supporto a "
|
||||
"%s e' stato rimosso dal driver, non e' disabilitato." % value)
|
||||
"invisible_playwright drives Firefox ONLY: support for %s "
|
||||
"has been removed from the driver, not disabled." % value)
|
||||
raise ValueError("Invalid browser " + value)
|
||||
|
||||
def _set_selectors(self, selectors: Selectors) -> None:
|
||||
|
||||
@@ -28,11 +28,10 @@ class PlaywrightContextManager:
|
||||
|
||||
async def __aenter__(self) -> AsyncPlaywright:
|
||||
loop = asyncio.get_running_loop()
|
||||
# MODIFIED by invisible_playwright: the transport is chosen, not hardcoded.
|
||||
# The Node driver stays reachable BY NAME - `INVPW_TRANSPORT=driver` -
|
||||
# as the only second arm this project has to judge the Python server
|
||||
# against; the Python server has been the default since 2026-08-28.
|
||||
# See `_juggler/transport.py` for the switch.
|
||||
# MODIFIED by invisible_playwright: the transport is the in-process
|
||||
# server, from `make_transport`. The Node driver was removed on
|
||||
# 2026-08-28, and `INVPW_TRANSPORT=driver` is refused with a message
|
||||
# that says so - see `_juggler/transport.py`.
|
||||
transport = make_transport(loop)
|
||||
self._connection = Connection(
|
||||
None,
|
||||
|
||||
@@ -17130,8 +17130,8 @@ class Playwright(AsyncBase):
|
||||
# from the vendored driver, so `_impl_obj.chromium` no longer exists.
|
||||
# Refuses with a line that explains it, instead of an AttributeError.
|
||||
raise NotImplementedError(
|
||||
"invisible_playwright pilota SOLO Firefox: il supporto a chromium "
|
||||
"e' stato RIMOSSO dal driver, non e' disabilitato. Usa "
|
||||
"invisible_playwright drives Firefox ONLY: support for chromium "
|
||||
"has been REMOVED from the driver, not disabled. Use "
|
||||
"playwright.firefox."
|
||||
)
|
||||
|
||||
@@ -17161,8 +17161,8 @@ class Playwright(AsyncBase):
|
||||
# from the vendored driver, so `_impl_obj.webkit` no longer exists.
|
||||
# Refuse with a line that explains it, instead of an AttributeError.
|
||||
raise NotImplementedError(
|
||||
"invisible_playwright pilota SOLO Firefox: il supporto a webkit "
|
||||
"e' stato RIMOSSO dal driver, non e' disabilitato. Usa "
|
||||
"invisible_playwright drives Firefox ONLY: support for webkit "
|
||||
"has been REMOVED from the driver, not disabled. Use "
|
||||
"playwright.firefox."
|
||||
)
|
||||
|
||||
|
||||
@@ -57,11 +57,10 @@ Please use the Async API instead."""
|
||||
|
||||
dispatcher_fiber = MainGreenlet(greenlet_main)
|
||||
|
||||
# MODIFIED by invisible_playwright: the transport is chosen, not hardcoded.
|
||||
# The Node driver stays reachable BY NAME - `INVPW_TRANSPORT=driver` -
|
||||
# as the only second arm this project has to judge the Python server
|
||||
# against; the Python server has been the default since 2026-08-28.
|
||||
# See `_juggler/transport.py` for the switch.
|
||||
# MODIFIED by invisible_playwright: the transport is the in-process
|
||||
# server, from `make_transport`. The Node driver was removed on
|
||||
# 2026-08-28, and `INVPW_TRANSPORT=driver` is refused with a message
|
||||
# that says so - see `_juggler/transport.py`.
|
||||
transport = make_transport(self._loop)
|
||||
self._connection = Connection(
|
||||
dispatcher_fiber,
|
||||
|
||||
@@ -17106,8 +17106,8 @@ class Playwright(SyncBase):
|
||||
# from the vendored driver, so `_impl_obj.chromium` no longer exists.
|
||||
# Rejects with a line that explains it, instead of an AttributeError.
|
||||
raise NotImplementedError(
|
||||
"invisible_playwright pilota SOLO Firefox: il supporto a chromium "
|
||||
"e' stato RIMOSSO dal driver, non e' disabilitato. Usa "
|
||||
"invisible_playwright drives Firefox ONLY: support for chromium "
|
||||
"has been REMOVED from the driver, not disabled. Use "
|
||||
"playwright.firefox."
|
||||
)
|
||||
|
||||
@@ -17137,8 +17137,8 @@ class Playwright(SyncBase):
|
||||
# from the vendored driver, so `_impl_obj.webkit` no longer exists.
|
||||
# Refuse with a line that explains it, instead of an AttributeError.
|
||||
raise NotImplementedError(
|
||||
"invisible_playwright pilota SOLO Firefox: il supporto a webkit "
|
||||
"e' stato RIMOSSO dal driver, non e' disabilitato. Usa "
|
||||
"invisible_playwright drives Firefox ONLY: support for webkit "
|
||||
"has been REMOVED from the driver, not disabled. Use "
|
||||
"playwright.firefox."
|
||||
)
|
||||
|
||||
|
||||
@@ -71,43 +71,8 @@ def true_headless_requested(env: Optional[Dict[str, str]] = None) -> bool:
|
||||
|
||||
#: The IANA -> POSIX conversion comes from the core, which is where the table
|
||||
#: lives. It was duplicated here byte-for-byte - ten entries, including the
|
||||
#: Phoenix row that exists because mapping Arizona to MST7MDT made libc apply
|
||||
#: DST and an identification service deduce a Denver origin. The core's own
|
||||
#: comment admitted its copy had been "copied verbatim from the wrapper", so
|
||||
#: the two had a documented keep-in-sync obligation and nothing enforcing it.
|
||||
#: `tz_env` was made public in the core for exactly this reason. (No version
|
||||
#: number here on purpose: the pin lives in pyproject.toml and a test
|
||||
#: forbids a second copy of it anywhere in src/, prose included.)
|
||||
#
|
||||
#: GUARDED, because an import that fails must say WHY. Taking these names
|
||||
#: unguarded meant that an environment holding an older core died with
|
||||
#: `ImportError: cannot import name 'IANA_TO_POSIX_TZ' from 'invisible_core'` -
|
||||
#: a message about a symbol, from a package the user did not choose the version
|
||||
#: of, on the browser launch path. The pin machinery exists to explain exactly
|
||||
#: this, and a bare module-level import walks straight past it. Reported by a
|
||||
#: user within minutes of the change.
|
||||
try:
|
||||
from invisible_core import ( # noqa: F401 - the import IS the probe
|
||||
IANA_TO_POSIX_TZ as _IANA_TO_POSIX_TZ,
|
||||
tz_env,
|
||||
)
|
||||
except ImportError as _exc: # pragma: no cover - exercised by the old-core probe
|
||||
from ._pin import declared_core_pin as _declared_core_pin
|
||||
|
||||
try:
|
||||
_want = _declared_core_pin() or "a newer version"
|
||||
except Exception:
|
||||
_want = "a newer version"
|
||||
raise ImportError(
|
||||
f"invisible-playwright needs invisible-core {_want}: the installed one "
|
||||
f"does not provide the timezone conversion this version imports "
|
||||
f"({_exc}). Upgrade with `pip install -U invisible-playwright`, which "
|
||||
f"pulls the core it was built against."
|
||||
) from _exc
|
||||
|
||||
def build_env(
|
||||
*,
|
||||
timezone: Optional[str],
|
||||
#: The address to DECLARE as srflx, or None to declare nothing and let the
|
||||
#: real one through. ⛔ This is NOT the egress IP: it is a DECISION the
|
||||
#: core makes in a single place, looking at the capabilities of the egress
|
||||
@@ -149,7 +114,7 @@ def build_env(
|
||||
What is composed here is only what needs the EXECUTABLE: the manifest is
|
||||
verified against the engine's own fonts before its path is handed over.
|
||||
The environment itself is composed by the core's `build_launch_env`, the
|
||||
one place that knows TZ, the WebRTC declaration, the manifest variable and
|
||||
one place that knows the WebRTC declaration, the manifest variable and
|
||||
the hidden surface's `launch_env()`; until 0.25.2 this function was a twin
|
||||
of that body, and the hidden-surface half of the contract lived only here.
|
||||
"""
|
||||
@@ -175,7 +140,7 @@ def build_env(
|
||||
f"(e.g. {missing[:3]}). Engine: {executable}. The metrics "
|
||||
f"would describe fonts that are not there.")
|
||||
manifest_path = cached_font_manifest_path(manifest)
|
||||
return build_launch_env({}, timezone=timezone, srflx_declared=srflx_declared,
|
||||
return build_launch_env({}, srflx_declared=srflx_declared,
|
||||
manifest_path=manifest_path, base_env=base_env,
|
||||
display_env=display_env)
|
||||
|
||||
@@ -266,6 +231,8 @@ def build_prefs(
|
||||
# Milliseconds, and an int: Gecko has no float pref type, and `1.0` written
|
||||
# as a number arrives with the right value and the wrong type - the defect
|
||||
# `ui.textScaleFactor` had.
|
||||
# The persona's keyboards are in the prefs already: the core declares them
|
||||
# with the language and country (invisible_core.prefs._apply_locale).
|
||||
if session_seed is not None and humanize:
|
||||
prefs[SESSION_SEED_PREF] = int(session_seed)
|
||||
prefs[MOTION_BUDGET_PREF] = int(round(
|
||||
@@ -458,8 +425,7 @@ class CommonLaunch:
|
||||
"""
|
||||
vd = self._virtual_display
|
||||
return self._session_token.stamp(
|
||||
build_env(timezone=self._timezone,
|
||||
srflx_declared=self._srflx_declared,
|
||||
build_env(srflx_declared=self._srflx_declared,
|
||||
profile=self._profile,
|
||||
executable=resolve_executable(self._binary_path),
|
||||
display_env=vd.launch_env() if vd is not None else None))
|
||||
|
||||
@@ -53,13 +53,6 @@ from ._reaper import SessionToken, guard_for
|
||||
# and the use sites below read it from there. This name survives only because
|
||||
# async_api imports it, and it resolves to the same declaration.
|
||||
|
||||
# The IANA -> POSIX TZ table moved to `_session` on 2026-07-27, so the async
|
||||
# class no longer has to import it FROM the sync module. Re-exported under the
|
||||
# original names because tests and `async_api` import them from here.
|
||||
_IANA_TO_POSIX_TZ = _session._IANA_TO_POSIX_TZ
|
||||
_tz_env = _session.tz_env
|
||||
|
||||
|
||||
class InvisiblePlaywright(_session.CommonLaunch):
|
||||
"""Context manager launching a patched Firefox with a deterministic profile.
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import faulthandler
|
||||
import http.server
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import threading
|
||||
@@ -128,9 +129,22 @@ def deterministic_rng():
|
||||
@pytest.fixture
|
||||
def sample_profile():
|
||||
"""A Profile generated from seed=42 for reuse across tests."""
|
||||
_require_package()
|
||||
return generate_profile(seed=42)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def first_run_prefs():
|
||||
"""What invisible_core declares for a new profile's first run. Since firefox-55 the
|
||||
engine leaves Mozilla's first-run lines, so a test that starts the engine without
|
||||
the core has to bring this, or a second tab fails Browser.newPage."""
|
||||
from invisible_core._fpforge import generate_profile
|
||||
from invisible_core.prefs import translate_profile_to_prefs
|
||||
|
||||
prefs = translate_profile_to_prefs(generate_profile(970411), timezone="America/New_York")
|
||||
return {k: v for k, v in prefs.items() if k.startswith(("termsofuse.", "browser.preonboarding."))}
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def firefox_binary():
|
||||
"""Locate the patched Firefox binary for E2E tests, or skip cleanly.
|
||||
@@ -152,6 +166,10 @@ def firefox_binary():
|
||||
return env_path
|
||||
pytest.skip(f"INVPW_BINARY_PATH={env_path!r} does not exist")
|
||||
|
||||
# Before the table is read: with the package not importable it is None, and
|
||||
# `in None` answered a TypeError that hid the reason - measured 2026-10-25
|
||||
# with a core whose version the wrapper's pin did not name.
|
||||
_require_package()
|
||||
if sys.platform not in BINARY_ENTRY_REL:
|
||||
pytest.skip(f"unsupported platform: {sys.platform}")
|
||||
from invisible_playwright.download import cache_dir_for_version
|
||||
@@ -164,6 +182,58 @@ def firefox_binary():
|
||||
return str(entry)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# The engine a test runs against. main's e2e runs against the engine the
|
||||
# published core pins AND against the candidate of the next engine (the gate),
|
||||
# so a property only the newer engine promises must not run on the older one.
|
||||
#
|
||||
# The engine is read from the seal the process runs under, the same one that
|
||||
# checks the launch: `active_seal().tag`. Only the number counts: `firefox-60`
|
||||
# and `firefox-60-candidate` are both 60. A tag with no number (`local`, or
|
||||
# anything else) does not say which engine it is, so the test does not skip and
|
||||
# does not run: it fails and says why. A candidate is sealed as
|
||||
# `firefox-N-candidate` by the gate.
|
||||
#
|
||||
# No new pytest marker: the marker vocabulary is shared with invisible_core
|
||||
# and a marker only here would make the two drift.
|
||||
_ENGINE_TAG = re.compile(r"^firefox-(\d+)(?:-candidate)?$")
|
||||
|
||||
|
||||
def _engine_number(tag):
|
||||
"""N of `firefox-N` or `firefox-N-candidate`, or None."""
|
||||
m = _ENGINE_TAG.match(tag or "")
|
||||
return int(m.group(1)) if m else None
|
||||
|
||||
|
||||
def _skip_unless_engine_at_least(minimum, tag):
|
||||
want = _engine_number(minimum)
|
||||
if want is None:
|
||||
raise pytest.UsageError("engine_at_least wants 'firefox-N', got %r" % (minimum,))
|
||||
have = _engine_number(tag)
|
||||
if have is None:
|
||||
pytest.fail("the engine's seal has no number: a candidate must be sealed as "
|
||||
"firefox-N-candidate (seal tag %r)" % (tag,), pytrace=False)
|
||||
if have < want:
|
||||
pytest.skip("the property needs %s or later; this engine is %s"
|
||||
% (minimum, tag))
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def engine_at_least():
|
||||
"""``engine_at_least("firefox-60")``: skip the test unless the engine in
|
||||
use is that release or a later one (see above for how it is read). A seal
|
||||
whose tag has no number (``local``, anything but firefox-N or
|
||||
firefox-N-candidate) makes the test FAIL, saying so: it neither skips nor
|
||||
runs."""
|
||||
_require_package()
|
||||
from invisible_core.seal import active_seal
|
||||
tag = active_seal().tag
|
||||
|
||||
def check(minimum):
|
||||
_skip_unless_engine_at_least(minimum, tag)
|
||||
return check
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Local HTTP fixture server - service workers need a real http(s) origin
|
||||
# (data: and about:blank are opaque-origin, no SW registration possible).
|
||||
|
||||
@@ -0,0 +1,297 @@
|
||||
"""Writes the test images and ICC profiles of the canvas colour probe, standard library only.
|
||||
|
||||
python -I gen_images.py <out dir>
|
||||
|
||||
<out dir>/images/*.png|jpg, <out dir>/profiles/*.icc (built by hand: matrix/TRC, ICC v2.1),
|
||||
<out dir>/images.json (id, file, what the tag says). Nothing is downloaded. The pixels are the
|
||||
same 16x16 gradient in every image (R from x, G from y, B from x+y), so the files differ only
|
||||
in the colour tag they carry.
|
||||
"""
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import struct
|
||||
import sys
|
||||
import zlib
|
||||
|
||||
D50 = (0.9642, 1.0, 0.8249)
|
||||
D65_XY = (0.3127, 0.3290)
|
||||
D50_XY = (0.3457, 0.3585)
|
||||
# name: (primaries xy R,G,B, white xy, trc)
|
||||
SPACES = {
|
||||
"displayp3": (((0.680, 0.320), (0.265, 0.690), (0.150, 0.060)), D65_XY, ("para-srgb",)),
|
||||
"adobergb": (((0.640, 0.330), (0.210, 0.710), (0.150, 0.060)), D65_XY, ("gamma", 563 / 256)),
|
||||
"rec2020": (((0.708, 0.292), (0.170, 0.797), (0.131, 0.046)), D65_XY, ("gamma", 2.4)),
|
||||
"prophoto": (((0.7347, 0.2653), (0.1596, 0.8404), (0.0366, 0.0001)), D50_XY, ("gamma", 1.8)),
|
||||
"srgb": (((0.640, 0.330), (0.300, 0.600), (0.150, 0.060)), D65_XY, ("para-srgb",)),
|
||||
}
|
||||
|
||||
|
||||
def mat_mul(a, b):
|
||||
return [[sum(a[i][k] * b[k][j] for k in range(3)) for j in range(3)] for i in range(3)]
|
||||
|
||||
|
||||
def mat_vec(m, v):
|
||||
return [sum(m[i][k] * v[k] for k in range(3)) for i in range(3)]
|
||||
|
||||
|
||||
def mat_inv(m):
|
||||
a, b, c = m[0]
|
||||
d, e, f = m[1]
|
||||
g, h, i = m[2]
|
||||
det = a * (e * i - f * h) - b * (d * i - f * g) + c * (d * h - e * g)
|
||||
return [[(e * i - f * h) / det, (c * h - b * i) / det, (b * f - c * e) / det],
|
||||
[(f * g - d * i) / det, (a * i - c * g) / det, (c * d - a * f) / det],
|
||||
[(d * h - e * g) / det, (b * g - a * h) / det, (a * e - b * d) / det]]
|
||||
|
||||
|
||||
def xy_to_xyz(xy):
|
||||
x, y = xy
|
||||
return [x / y, 1.0, (1 - x - y) / y]
|
||||
|
||||
|
||||
BRADFORD = [[0.8951, 0.2664, -0.1614], [-0.7502, 1.7135, 0.0367], [0.0389, -0.0685, 1.0296]]
|
||||
|
||||
|
||||
def adapt(src_white, dst_white):
|
||||
s = mat_vec(BRADFORD, src_white)
|
||||
d = mat_vec(BRADFORD, dst_white)
|
||||
scale = [[d[0] / s[0], 0, 0], [0, d[1] / s[1], 0], [0, 0, d[2] / s[2]]]
|
||||
return mat_mul(mat_inv(BRADFORD), mat_mul(scale, BRADFORD))
|
||||
|
||||
|
||||
def colorants_d50(prim, white_xy):
|
||||
"""The rXYZ, gXYZ, bXYZ columns adapted (Bradford) to the D50 PCS."""
|
||||
cols = [xy_to_xyz(p) for p in prim]
|
||||
m = [[cols[j][i] for j in range(3)] for i in range(3)]
|
||||
s = mat_vec(mat_inv(m), xy_to_xyz(white_xy))
|
||||
rgb2xyz = [[m[i][j] * s[j] for j in range(3)] for i in range(3)]
|
||||
ad = adapt(xy_to_xyz(white_xy), list(D50))
|
||||
out = mat_mul(ad, rgb2xyz)
|
||||
return [[out[i][j] for i in range(3)] for j in range(3)] # per channel XYZ
|
||||
|
||||
|
||||
def s15(v):
|
||||
return struct.pack(">i", int(round(v * 65536)))
|
||||
|
||||
|
||||
def tag_xyz(v):
|
||||
return b"XYZ \0\0\0\0" + s15(v[0]) + s15(v[1]) + s15(v[2])
|
||||
|
||||
|
||||
def tag_text(s):
|
||||
return b"text\0\0\0\0" + s.encode("ascii") + b"\0"
|
||||
|
||||
|
||||
def tag_desc(s):
|
||||
b = s.encode("ascii") + b"\0"
|
||||
return (b"desc\0\0\0\0" + struct.pack(">I", len(b)) + b + struct.pack(">II", 0, 0)
|
||||
+ struct.pack(">HB", 0, 0) + b"\0" * 67)
|
||||
|
||||
|
||||
def tag_trc(trc):
|
||||
if trc[0] == "gamma":
|
||||
return b"curv\0\0\0\0" + struct.pack(">IH", 1, int(round(trc[1] * 256))) + b"\0\0"
|
||||
# parametric type 3: Y = (aX+b)^g for X >= d, cX otherwise (the sRGB curve)
|
||||
return (b"para\0\0\0\0" + struct.pack(">HH", 3, 0) + s15(2.4) + s15(1 / 1.055) + s15(0.055 / 1.055)
|
||||
+ s15(1 / 12.92) + s15(0.04045))
|
||||
|
||||
|
||||
def pad4(b):
|
||||
return b + b"\0" * (-len(b) % 4)
|
||||
|
||||
|
||||
def build_icc(name):
|
||||
prim, white, trc = SPACES[name]
|
||||
cols = colorants_d50(prim, white)
|
||||
trc_b = pad4(tag_trc(trc))
|
||||
tags = [(b"desc", pad4(tag_desc("invisible probe " + name))),
|
||||
(b"cprt", pad4(tag_text("public domain, generated by gen_images.py"))),
|
||||
(b"wtpt", tag_xyz(D50)),
|
||||
(b"rXYZ", tag_xyz(cols[0])), (b"gXYZ", tag_xyz(cols[1])), (b"bXYZ", tag_xyz(cols[2])),
|
||||
(b"rTRC", trc_b), (b"gTRC", trc_b), (b"bTRC", trc_b)]
|
||||
off = 128 + 4 + 12 * len(tags)
|
||||
table = struct.pack(">I", len(tags))
|
||||
body = b""
|
||||
seen = {}
|
||||
for sig, data in tags:
|
||||
if data in seen and sig.endswith(b"TRC"):
|
||||
o = seen[data]
|
||||
else:
|
||||
o = off + len(body)
|
||||
body += data
|
||||
seen[data] = o
|
||||
table += sig + struct.pack(">II", o, len(data))
|
||||
size = 128 + len(table) + len(body)
|
||||
hdr = (struct.pack(">I", size) + b"\0\0\0\0" + bytes([2, 0x10, 0, 0]) + b"mntrRGB XYZ "
|
||||
+ struct.pack(">6H", 2026, 11, 9, 0, 0, 0) + b"acsp"
|
||||
+ b"\0" * 28 # platform, flags, manufacturer, model, attributes (8), rendering intent
|
||||
+ s15(D50[0]) + s15(D50[1]) + s15(D50[2]) + b"\0" * 4 + b"\0" * 16 + b"\0" * 28)
|
||||
assert len(hdr) == 128, len(hdr)
|
||||
return hdr + table + body
|
||||
|
||||
|
||||
def pixels():
|
||||
rows = []
|
||||
for y in range(16):
|
||||
rows.append([(x * 17, y * 17, (x + y) * 17 // 2) for x in range(16)])
|
||||
return rows
|
||||
|
||||
|
||||
def chunk(typ, data):
|
||||
c = typ + data
|
||||
return struct.pack(">I", len(data)) + c + struct.pack(">I", zlib.crc32(c) & 0xFFFFFFFF)
|
||||
|
||||
|
||||
def png(extra):
|
||||
raw = b"".join(b"\0" + bytes(v for px in row for v in px) for row in pixels())
|
||||
return (b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", 16, 16, 8, 2, 0, 0, 0))
|
||||
+ b"".join(chunk(t, d) for t, d in extra) + chunk(b"IDAT", zlib.compress(raw, 9)) + chunk(b"IEND", b""))
|
||||
|
||||
|
||||
def iccp(name, profile):
|
||||
return (b"iCCP", name.encode() + b"\0\0" + zlib.compress(profile, 9))
|
||||
|
||||
|
||||
def chrm(prim, white):
|
||||
vals = [white[0], white[1]] + [c for p in prim for c in p]
|
||||
return (b"cHRM", b"".join(struct.pack(">I", int(round(v * 100000))) for v in vals))
|
||||
|
||||
|
||||
# ---- baseline JPEG, 4:4:4, quantisation all 1, own Huffman tables (no tables copied from anywhere)
|
||||
ZIGZAG = [0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14,
|
||||
21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53,
|
||||
60, 61, 54, 47, 55, 62, 63]
|
||||
AC_SYMS = [0x00, 0xF0] + [(r << 4) | s for r in range(16) for s in range(1, 11)] # 162 symbols, 8-bit codes 0..161
|
||||
|
||||
|
||||
def dct8(block):
|
||||
out = [0.0] * 64
|
||||
for u in range(8):
|
||||
for v in range(8):
|
||||
s = 0.0
|
||||
for x in range(8):
|
||||
for y in range(8):
|
||||
s += block[y * 8 + x] * math.cos((2 * x + 1) * u * math.pi / 16) * math.cos((2 * y + 1) * v * math.pi / 16)
|
||||
cu = 1 / math.sqrt(2) if u == 0 else 1
|
||||
cv = 1 / math.sqrt(2) if v == 0 else 1
|
||||
out[v * 8 + u] = 0.25 * cu * cv * s
|
||||
return out
|
||||
|
||||
|
||||
def jpeg(profile):
|
||||
ycc = []
|
||||
for row in pixels():
|
||||
r = []
|
||||
for (R, G, B) in row:
|
||||
r.append((0.299 * R + 0.587 * G + 0.114 * B,
|
||||
-0.168736 * R - 0.331264 * G + 0.5 * B + 128,
|
||||
0.5 * R - 0.418688 * G - 0.081312 * B + 128))
|
||||
ycc.append(r)
|
||||
bits = []
|
||||
|
||||
def put(code, n):
|
||||
for i in range(n - 1, -1, -1):
|
||||
bits.append((code >> i) & 1)
|
||||
|
||||
def cat(v):
|
||||
return 0 if v == 0 else abs(v).bit_length()
|
||||
|
||||
def amp(v, s):
|
||||
return v if v >= 0 else v + (1 << s) - 1
|
||||
|
||||
pred = [0, 0, 0]
|
||||
for by in range(2):
|
||||
for bx in range(2):
|
||||
for c in range(3):
|
||||
blk = [ycc[by * 8 + y][bx * 8 + x][c] - 128 for y in range(8) for x in range(8)]
|
||||
co = [int(round(v)) for v in dct8(blk)]
|
||||
zz = [co[i] for i in ZIGZAG]
|
||||
d = zz[0] - pred[c]
|
||||
pred[c] = zz[0]
|
||||
s = cat(d)
|
||||
put(s, 4) # DC symbol s has the 4-bit code s
|
||||
if s:
|
||||
put(amp(d, s), s)
|
||||
run = 0
|
||||
last = max([i for i in range(1, 64) if zz[i]] or [0])
|
||||
for i in range(1, last + 1):
|
||||
v = zz[i]
|
||||
if v == 0:
|
||||
run += 1
|
||||
continue
|
||||
while run > 15:
|
||||
put(AC_SYMS.index(0xF0), 8)
|
||||
run -= 16
|
||||
s = cat(v)
|
||||
put(AC_SYMS.index((run << 4) | s), 8)
|
||||
put(amp(v, s), s)
|
||||
run = 0
|
||||
if last < 63:
|
||||
put(AC_SYMS.index(0x00), 8)
|
||||
while len(bits) % 8:
|
||||
bits.append(1)
|
||||
data = bytearray()
|
||||
for i in range(0, len(bits), 8):
|
||||
b = int("".join(map(str, bits[i:i + 8])), 2)
|
||||
data.append(b)
|
||||
if b == 0xFF:
|
||||
data.append(0)
|
||||
|
||||
def seg(m, payload):
|
||||
return bytes([0xFF, m]) + struct.pack(">H", len(payload) + 2) + payload
|
||||
|
||||
icc = b"ICC_PROFILE\0" + bytes([1, 1]) + profile
|
||||
out = b"\xFF\xD8" + seg(0xE0, b"JFIF\0\x01\x01\0\0\x01\0\x01\0\0") + seg(0xE2, icc)
|
||||
out += seg(0xDB, bytes([0]) + bytes([1] * 64))
|
||||
out += seg(0xC0, bytes([8]) + struct.pack(">HH", 16, 16) + bytes([3, 1, 0x11, 0, 2, 0x11, 0, 3, 0x11, 0]))
|
||||
out += seg(0xC4, bytes([0x00]) + bytes([0, 0, 0, 12] + [0] * 12) + bytes(range(12)))
|
||||
out += seg(0xC4, bytes([0x10]) + bytes([0] * 7 + [len(AC_SYMS)] + [0] * 8) + bytes(AC_SYMS))
|
||||
out += seg(0xDA, bytes([3, 1, 0x00, 2, 0x00, 3, 0x00, 0, 63, 0])) + bytes(data) + b"\xFF\xD9"
|
||||
return out
|
||||
|
||||
|
||||
def build_images():
|
||||
"""The ten test images, in memory: a list of (id, extension, bytes, what the tag says),
|
||||
and the five generated ICC profiles by name. Deterministic: the same bytes on every run."""
|
||||
profs = {n: build_icc(n) for n in SPACES}
|
||||
p3prim, p3white, _ = SPACES["displayp3"]
|
||||
imgs = [
|
||||
("iccp-displayp3", "png", png([iccp("p3", profs["displayp3"])]), "iCCP Display P3 (matrix, sRGB-curve parametric TRC)"),
|
||||
("iccp-adobergb", "png", png([iccp("a98", profs["adobergb"])]), "iCCP Adobe RGB (1998) (matrix, gamma 563/256)"),
|
||||
("iccp-rec2020", "png", png([iccp("r2020", profs["rec2020"])]), "iCCP Rec.2020 primaries (matrix, gamma 2.4)"),
|
||||
("iccp-prophoto", "png", png([iccp("pp", profs["prophoto"])]), "iCCP ProPhoto RGB (matrix, gamma 1.8, D50 white)"),
|
||||
("iccp-srgb", "png", png([iccp("s", profs["srgb"])]), "iCCP sRGB primaries (matrix, sRGB parametric TRC): control"),
|
||||
("cicp-p3", "png", png([(b"cICP", bytes([12, 13, 0, 1]))]), "cICP primaries 12 (Display P3), transfer 13 (sRGB), full range"),
|
||||
("gama-chrm-p3", "png", png([(b"gAMA", struct.pack(">I", 45455)), chrm(p3prim, p3white)]), "gAMA 45455 + cHRM of Display P3"),
|
||||
("srgb-chunk", "png", png([(b"sRGB", b"\0")]), "sRGB chunk, perceptual"),
|
||||
("untagged", "png", png([]), "no colour tag"),
|
||||
("jpeg-icc-displayp3", "jpg", jpeg(profs["displayp3"]), "JPEG (own encoder) with APP2 ICC Display P3"),
|
||||
]
|
||||
return imgs, profs
|
||||
|
||||
|
||||
def images_json(imgs):
|
||||
"""What the page fetches as images.json: id, URL (relative) and the tag, per image."""
|
||||
return [{"id": iid, "file": "images/%s.%s" % (iid, ext), "tag": what}
|
||||
for iid, ext, _data, what in imgs]
|
||||
|
||||
|
||||
def main():
|
||||
out = sys.argv[1]
|
||||
os.makedirs(os.path.join(out, "images"), exist_ok=True)
|
||||
os.makedirs(os.path.join(out, "profiles"), exist_ok=True)
|
||||
imgs, profs = build_images()
|
||||
for n, p in profs.items():
|
||||
with open(os.path.join(out, "profiles", n + ".icc"), "wb") as f:
|
||||
f.write(p)
|
||||
for (iid, ext, data, _what), meta in zip(imgs, images_json(imgs)):
|
||||
with open(os.path.join(out, meta["file"]), "wb") as f:
|
||||
f.write(data)
|
||||
with open(os.path.join(out, "images.json"), "w") as f:
|
||||
json.dump(images_json(imgs), f, indent=1)
|
||||
print("wrote %d images and %d profiles to %s" % (len(imgs), len(profs), out))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,102 @@
|
||||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>canvas colour readback probe</title>
|
||||
<body>
|
||||
<script>
|
||||
"use strict";
|
||||
// Reads, from a page served on localhost, the bytes the canvas 2D hands back after a tagged image is
|
||||
// drawn (drawImage, createImageBitmap) and after fillRect with CSS colour functions. Result: window.R.
|
||||
const hex = (u8) => Array.from(u8, (b) => b.toString(16).padStart(2, "0")).join("");
|
||||
async function sha(u8) { return hex(new Uint8Array(await crypto.subtle.digest("SHA-256", u8))); }
|
||||
|
||||
async function readCanvas(c) {
|
||||
const ctx = c.getContext("2d");
|
||||
const d = ctx.getImageData(0, 0, c.width, c.height).data;
|
||||
const u8 = new Uint8Array(d.buffer, d.byteOffset, d.byteLength);
|
||||
return { sha256: await sha(u8), rgba_hex: hex(u8) };
|
||||
}
|
||||
|
||||
function loadImage(url) {
|
||||
return new Promise((res, rej) => {
|
||||
const i = new Image();
|
||||
i.onload = () => res(i);
|
||||
i.onerror = () => rej(new Error("image load failed " + url));
|
||||
i.src = url;
|
||||
});
|
||||
}
|
||||
|
||||
async function drawProbe(draw, size) {
|
||||
const c = document.createElement("canvas");
|
||||
c.width = size; c.height = size;
|
||||
const ctx = c.getContext("2d");
|
||||
ctx.clearRect(0, 0, size, size);
|
||||
await draw(ctx, size);
|
||||
return readCanvas(c);
|
||||
}
|
||||
|
||||
const FILLS = [
|
||||
"color(srgb 1 0 0)", "color(srgb 0.2 0.8 0.4)",
|
||||
"color(display-p3 1 0 0)", "color(display-p3 0 1 0)", "color(display-p3 0.2 0.8 0.4)", "color(display-p3 0.5 0.5 0.5)",
|
||||
"color(a98-rgb 0.2 0.8 0.4)", "color(prophoto-rgb 0.2 0.8 0.4)", "color(rec2020 0.2 0.8 0.4)",
|
||||
"color(xyz-d65 0.2 0.3 0.4)", "color(xyz-d50 0.2 0.3 0.4)",
|
||||
"color-mix(in oklab, red 30%, blue)", "color-mix(in srgb, red 30%, blue)", "color-mix(in display-p3, color(display-p3 1 0 0) 30%, blue)",
|
||||
"color-mix(in oklch, #336699 40%, #cc9933)", "oklab(0.6 0.1 -0.1)", "oklch(0.7 0.15 150)", "lab(60 40 -30)", "lch(60 40 200)",
|
||||
"hsl(200 60% 40%)", "#336699", "rgba(51,102,153,0.5)",
|
||||
];
|
||||
|
||||
async function run() {
|
||||
const R = { env: {}, images: {}, fills: {}, canvas_colorspace: {} };
|
||||
const mq = (q) => { try { return matchMedia(q).matches; } catch (e) { return "error"; } };
|
||||
R.env = {
|
||||
"color-gamut:srgb": mq("(color-gamut: srgb)"), "color-gamut:p3": mq("(color-gamut: p3)"), "color-gamut:rec2020": mq("(color-gamut: rec2020)"),
|
||||
"dynamic-range:high": mq("(dynamic-range: high)"), "video-dynamic-range:high": mq("(video-dynamic-range: high)"),
|
||||
"prefers-color-scheme:dark": mq("(prefers-color-scheme: dark)"),
|
||||
colorDepth: screen.colorDepth, pixelDepth: screen.pixelDepth, devicePixelRatio: window.devicePixelRatio,
|
||||
};
|
||||
const list = await (await fetch("images.json")).json();
|
||||
for (const it of list) {
|
||||
const out = { tag: it.tag };
|
||||
try {
|
||||
const img = await loadImage(it.file);
|
||||
out.natural = [img.naturalWidth, img.naturalHeight];
|
||||
out.drawImage = await drawProbe((ctx) => ctx.drawImage(img, 0, 0), 16);
|
||||
out.drawImage_scaled32 = await drawProbe((ctx) => ctx.drawImage(img, 0, 0, 32, 32), 32);
|
||||
const blob = await (await fetch(it.file)).blob();
|
||||
for (const csc of ["default", "none"]) {
|
||||
try {
|
||||
const bmp = await createImageBitmap(blob, { colorSpaceConversion: csc });
|
||||
out["bitmap_" + csc] = await drawProbe((ctx) => ctx.drawImage(bmp, 0, 0), 16);
|
||||
bmp.close();
|
||||
} catch (e) { out["bitmap_" + csc] = { error: String(e) }; }
|
||||
}
|
||||
} catch (e) { out.error = String(e); }
|
||||
R.images[it.id] = out;
|
||||
}
|
||||
for (const f of FILLS) {
|
||||
try {
|
||||
const c = document.createElement("canvas"); c.width = 16; c.height = 16;
|
||||
const ctx = c.getContext("2d");
|
||||
ctx.fillStyle = "#010203"; ctx.fillStyle = f;
|
||||
if (ctx.fillStyle === "#010203") { R.fills[f] = { unsupported: true }; continue; }
|
||||
ctx.fillRect(0, 0, 16, 16);
|
||||
const r = await readCanvas(c);
|
||||
R.fills[f] = { sha256: r.sha256, rgba: r.rgba_hex.slice(0, 8), fillStyle_readback: ctx.fillStyle };
|
||||
} catch (e) { R.fills[f] = { error: String(e) }; }
|
||||
}
|
||||
// canvas with colorSpace option and putImageData/getImageData colorSpace
|
||||
try {
|
||||
const c = document.createElement("canvas"); c.width = 16; c.height = 16;
|
||||
const ctx = c.getContext("2d", { colorSpace: "display-p3" });
|
||||
const attrs = ctx.getContextAttributes ? ctx.getContextAttributes() : null;
|
||||
R.canvas_colorspace.attributes = attrs ? { colorSpace: attrs.colorSpace } : "no getContextAttributes";
|
||||
R.canvas_colorspace.ctx_colorSpace = ctx.colorSpace === undefined ? "undefined" : ctx.colorSpace;
|
||||
ctx.fillStyle = "color(display-p3 1 0 0)"; ctx.fillRect(0, 0, 16, 16);
|
||||
const r = await readCanvas(c);
|
||||
R.canvas_colorspace.p3_fill_p3_canvas = { sha256: r.sha256, rgba: r.rgba_hex.slice(0, 8) };
|
||||
} catch (e) { R.canvas_colorspace.error = String(e); }
|
||||
window.R = R;
|
||||
window.DONE = true;
|
||||
}
|
||||
run().catch((e) => { window.ERR = String(e && e.stack || e); });
|
||||
</script>
|
||||
</body>
|
||||
@@ -0,0 +1,505 @@
|
||||
{
|
||||
"test_page": "index.html",
|
||||
"image_generator": "gen_images.py",
|
||||
"source": {
|
||||
"capture": "canvas-color/canvas-color-icc-readback",
|
||||
"reference_run": "runs/a_win_default.json",
|
||||
"repeat_run": "runs/a2_win_default_repeat.json (same hashes on all probes)",
|
||||
"control_run": "runs/b_win_force_srgb.json (gfx.color_management.force_srgb=true)",
|
||||
"date": "2026-11-09"
|
||||
},
|
||||
"firefox": {
|
||||
"buildid": "20261022150525",
|
||||
"exe": "firefox.exe",
|
||||
"exe_sha256": "d8b5ed82fcd9c0f159dc86dc1c4526ceae981c4d9651f21908b6de90d0a56d85",
|
||||
"os": "Windows_NT",
|
||||
"os_version": "10.0",
|
||||
"version": "159.0",
|
||||
"prefs": {
|
||||
"gfx.canvas.accelerated": false,
|
||||
"gfx.color_management.display_profile": "",
|
||||
"gfx.color_management.force_srgb": false,
|
||||
"gfx.color_management.mode": 2,
|
||||
"gfx.color_management.native_srgb": false
|
||||
}
|
||||
},
|
||||
"display_profile": {
|
||||
"file": "sRGB Color Space Profile.icm",
|
||||
"size": 3144,
|
||||
"sha256": "2b3aa1645779a9e634744faf9b01e9102b0c9b88fd6deced7934df86b949af7e",
|
||||
"api": "GetICMProfileW"
|
||||
},
|
||||
"images": {
|
||||
"iccp-displayp3": {
|
||||
"file": "images/iccp-displayp3.png",
|
||||
"bytes": 839,
|
||||
"sha256": "d0b1cb83418856be9238914c623c62304656dca6e1f8d72fab4b1907501fc94a"
|
||||
},
|
||||
"iccp-adobergb": {
|
||||
"file": "images/iccp-adobergb.png",
|
||||
"bytes": 821,
|
||||
"sha256": "b66251789a8432ac74e80206e5a5eed6368f1244e53394b02256260b712a10e5"
|
||||
},
|
||||
"iccp-rec2020": {
|
||||
"file": "images/iccp-rec2020.png",
|
||||
"bytes": 824,
|
||||
"sha256": "7c58cc0c31435196f37288fb600c4220effd27cca4f34285e40f098f84086133"
|
||||
},
|
||||
"iccp-prophoto": {
|
||||
"file": "images/iccp-prophoto.png",
|
||||
"bytes": 812,
|
||||
"sha256": "ca661ae5c42dfda0e9fe1b1eca2a08e1f2f7137cec112afd59d2a2480cfa9b24"
|
||||
},
|
||||
"iccp-srgb": {
|
||||
"file": "images/iccp-srgb.png",
|
||||
"bytes": 833,
|
||||
"sha256": "fc84c167782b6d17d3e4f462e696f41e98c90c71adeaddeefdfde7bbc02123bb"
|
||||
},
|
||||
"cicp-p3": {
|
||||
"file": "images/cicp-p3.png",
|
||||
"bytes": 572,
|
||||
"sha256": "5c2de96dbcfd4e2255785974d33082ccfb8e297b486676222a09f2922a3972ed"
|
||||
},
|
||||
"gama-chrm-p3": {
|
||||
"file": "images/gama-chrm-p3.png",
|
||||
"bytes": 616,
|
||||
"sha256": "e07805116e2a9a40e901401c00d1beb8b47f82d6e8f9708be335f06486429f26"
|
||||
},
|
||||
"srgb-chunk": {
|
||||
"file": "images/srgb-chunk.png",
|
||||
"bytes": 569,
|
||||
"sha256": "6481d9b1e09b6b89b7d7355328ade8ceaf2fec3cfe6e7bf57e052a26c4589576"
|
||||
},
|
||||
"untagged": {
|
||||
"file": "images/untagged.png",
|
||||
"bytes": 556,
|
||||
"sha256": "d10d32213102277c1b28271a19ce56aac0553bc784023e2640b9713a5ef10677"
|
||||
},
|
||||
"jpeg-icc-displayp3": {
|
||||
"file": "images/jpeg-icc-displayp3.jpg",
|
||||
"bytes": 1044,
|
||||
"sha256": "26ecbdd5a632c531522cbbda37133dd405a6135669b6a810874ddf3a5151b61b"
|
||||
}
|
||||
},
|
||||
"probe_count": 72,
|
||||
"profile_dependent_count": 27,
|
||||
"profile_dependent": [
|
||||
"cicp-p3 | bitmap_default",
|
||||
"cicp-p3 | drawImage",
|
||||
"cicp-p3 | drawImage_scaled32",
|
||||
"gama-chrm-p3 | bitmap_default",
|
||||
"gama-chrm-p3 | drawImage",
|
||||
"gama-chrm-p3 | drawImage_scaled32",
|
||||
"iccp-adobergb | bitmap_default",
|
||||
"iccp-adobergb | drawImage",
|
||||
"iccp-adobergb | drawImage_scaled32",
|
||||
"iccp-displayp3 | bitmap_default",
|
||||
"iccp-displayp3 | drawImage",
|
||||
"iccp-displayp3 | drawImage_scaled32",
|
||||
"iccp-prophoto | bitmap_default",
|
||||
"iccp-prophoto | drawImage",
|
||||
"iccp-prophoto | drawImage_scaled32",
|
||||
"iccp-rec2020 | bitmap_default",
|
||||
"iccp-rec2020 | drawImage",
|
||||
"iccp-rec2020 | drawImage_scaled32",
|
||||
"iccp-srgb | bitmap_default",
|
||||
"iccp-srgb | drawImage",
|
||||
"iccp-srgb | drawImage_scaled32",
|
||||
"jpeg-icc-displayp3 | bitmap_default",
|
||||
"jpeg-icc-displayp3 | drawImage",
|
||||
"jpeg-icc-displayp3 | drawImage_scaled32",
|
||||
"srgb-chunk | bitmap_default",
|
||||
"srgb-chunk | drawImage",
|
||||
"srgb-chunk | drawImage_scaled32"
|
||||
],
|
||||
"probes": {
|
||||
"cicp-p3 | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "da7e0175bb0c175e3d8bd5f6c9ca408707103b4b6a2d276233eca8c92d16b577",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "36c40e179db9bda2444948eee00fa2b9af802a42b7183e5caa46ff5100d46558"
|
||||
},
|
||||
"cicp-p3 | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "dcb22689a38b7a73881b1e998bdec904b9cb4ab17b4d0f339fae9d1d2b119bd8",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "68bc6166faaabddf135829bb9ea5bcec861938cb5f304f9fca235d59737fe1d9"
|
||||
},
|
||||
"cicp-p3 | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "da7e0175bb0c175e3d8bd5f6c9ca408707103b4b6a2d276233eca8c92d16b577",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "36c40e179db9bda2444948eee00fa2b9af802a42b7183e5caa46ff5100d46558"
|
||||
},
|
||||
"cicp-p3 | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"gama-chrm-p3 | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "40794d510b713345bd0f1e972078cbc794bab9a031b93cd6993fb1d303210571",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "9e5bba7e830226a96689458592f8a51f43161d9a61c989705022fbe8027fd247"
|
||||
},
|
||||
"gama-chrm-p3 | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "cf3fb3bd1722ec5155bb4b9a04de3d6e9468ad586e0417d75e6bc21a8bd09a1a",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "65051f0a8b4ff1112fd8b37682ae481a932d08ab6a8da1fe5902192f61450027"
|
||||
},
|
||||
"gama-chrm-p3 | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "40794d510b713345bd0f1e972078cbc794bab9a031b93cd6993fb1d303210571",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "9e5bba7e830226a96689458592f8a51f43161d9a61c989705022fbe8027fd247"
|
||||
},
|
||||
"gama-chrm-p3 | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"iccp-adobergb | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "b13bc0493dfad6d36c6763077c5a9144c217777fd0f282a344a11f1966910905",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "ec8e92bb2dfedc2c4ed7a86a22e5d88aaf3176f5bf95a1bc95d4a0d9207b2145"
|
||||
},
|
||||
"iccp-adobergb | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "5902f7aab7e9420a50e6c0145ed7f192355f061eb03290279b9b57c7f44f1240",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "4641000ca8c7208c7c773a640d9e739e5893d871010ebdcf18642b34a60bc2b1"
|
||||
},
|
||||
"iccp-adobergb | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "b13bc0493dfad6d36c6763077c5a9144c217777fd0f282a344a11f1966910905",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "ec8e92bb2dfedc2c4ed7a86a22e5d88aaf3176f5bf95a1bc95d4a0d9207b2145"
|
||||
},
|
||||
"iccp-adobergb | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"iccp-displayp3 | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "1320722da92c41789949998337f35ec8159f698b123581d56a464b24c64982bc",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "551fb216de2b52c749e7010781ea575f5068907f28fe673c8d0820e67ba8ab1a"
|
||||
},
|
||||
"iccp-displayp3 | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "b387a847012c88a79c3f18ad52e32a1aef606354b846e24d66c376e1e1c9c25d",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "fb974c99747b957e44a325789effaad9a548a52a8b75077a22cc1ce7648448f8"
|
||||
},
|
||||
"iccp-displayp3 | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "1320722da92c41789949998337f35ec8159f698b123581d56a464b24c64982bc",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "551fb216de2b52c749e7010781ea575f5068907f28fe673c8d0820e67ba8ab1a"
|
||||
},
|
||||
"iccp-displayp3 | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"iccp-prophoto | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "4fab448b2199c831c15ec6ddfa4c923a73bcb5f67ec1893f53c8282525512b20",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "c3637f042c01b44fd5c7ff59a5948695e9ea6e396056be7589e475c8a46f19a0"
|
||||
},
|
||||
"iccp-prophoto | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "367bc57e1fd774471cdcd1098335af3fb54d2c009c4a530aecc8806bfceb65f4",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "840d2c6b5264364f23c63a33c21380797c61e40a75750e11a69266057d381298"
|
||||
},
|
||||
"iccp-prophoto | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "4fab448b2199c831c15ec6ddfa4c923a73bcb5f67ec1893f53c8282525512b20",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "c3637f042c01b44fd5c7ff59a5948695e9ea6e396056be7589e475c8a46f19a0"
|
||||
},
|
||||
"iccp-prophoto | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"iccp-rec2020 | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "4d837ae68e7ef5039bc2cf88812ebbf7eae8624922191741d4157f697f3283db",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "f6aca679f032c943db350b8a942dcb189e48ff097617f91441082c560ba76400"
|
||||
},
|
||||
"iccp-rec2020 | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "09fdec5e80bdff0cc09171bc2c627657484ec1c5cd390d86edc6cb8c3f9fb406",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "2aa895aa06e8b06ed0fe9629a2ba97ed3fc3ec978d21a9f9871859784a96d38f"
|
||||
},
|
||||
"iccp-rec2020 | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "4d837ae68e7ef5039bc2cf88812ebbf7eae8624922191741d4157f697f3283db",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "f6aca679f032c943db350b8a942dcb189e48ff097617f91441082c560ba76400"
|
||||
},
|
||||
"iccp-rec2020 | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"iccp-srgb | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "f0f7aa5f113b0409ec14f6ba894b5e7749d79b3cafd6ea9c88632c1f0a9dbbb7"
|
||||
},
|
||||
"iccp-srgb | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "464a7a31f6a336c88616ff1bd651e6d569287aaf9445891d65f30a5b3c019bc7",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "96d26754fcd4e0c13ab72dd3e5f569eb49bed726de3da7b16bac7094f30a8d12"
|
||||
},
|
||||
"iccp-srgb | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "f0f7aa5f113b0409ec14f6ba894b5e7749d79b3cafd6ea9c88632c1f0a9dbbb7"
|
||||
},
|
||||
"iccp-srgb | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"jpeg-icc-displayp3 | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "782dc2e3d91cedc3bd985480e0575812f790ca5788fc116483baa4e551b04115",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "4c3b8db4f93d8b0ba68891cd3fdb29627b762f594286811364ac7dbb182abb5c"
|
||||
},
|
||||
"jpeg-icc-displayp3 | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "760cb8015791f49de184209a7f9b7f0cdecf7ad6dd9f89701477f840af446291",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "0d5bcd78f2230a685636cafb732109384b42064bd710631a57fe653554865f6f"
|
||||
},
|
||||
"jpeg-icc-displayp3 | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "782dc2e3d91cedc3bd985480e0575812f790ca5788fc116483baa4e551b04115",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "4c3b8db4f93d8b0ba68891cd3fdb29627b762f594286811364ac7dbb182abb5c"
|
||||
},
|
||||
"jpeg-icc-displayp3 | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "1319eeadc9d1d109384f113e3fdcf6d66db169b5fd8ede666055b3e3da70f23c",
|
||||
"bytes": 1024
|
||||
},
|
||||
"srgb-chunk | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "ff2033eebf547bf729b8ed5cde16e5cda42729f141aa2b2eaa2d693513d61542",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73"
|
||||
},
|
||||
"srgb-chunk | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "4805ce9fad88c53aa5f9df7c5ec7352fdf55691377f4d00986c7e6b76dac9ac9",
|
||||
"bytes": 4096,
|
||||
"without_conversion_sha256": "464a7a31f6a336c88616ff1bd651e6d569287aaf9445891d65f30a5b3c019bc7"
|
||||
},
|
||||
"srgb-chunk | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "ff2033eebf547bf729b8ed5cde16e5cda42729f141aa2b2eaa2d693513d61542",
|
||||
"bytes": 1024,
|
||||
"without_conversion_sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73"
|
||||
},
|
||||
"srgb-chunk | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"untagged | drawImage": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"untagged | drawImage_scaled32": {
|
||||
"kind": "image",
|
||||
"sha256": "464a7a31f6a336c88616ff1bd651e6d569287aaf9445891d65f30a5b3c019bc7",
|
||||
"bytes": 4096
|
||||
},
|
||||
"untagged | bitmap_default": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"untagged | bitmap_none": {
|
||||
"kind": "image",
|
||||
"sha256": "4408185fd170878816ebdc7412ecc36d75d53a02ff41a07f4f76c9042a531b73",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | #336699": {
|
||||
"kind": "fill",
|
||||
"sha256": "071cae1acd9f38907222c770e611ba43fea0ade431c883ea8a88824e0aadd1c8",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(a98-rgb 0.2 0.8 0.4)": {
|
||||
"kind": "fill",
|
||||
"sha256": "4258c9f7552305c497331032b1ca6413b1d1edd099e0d4ffef3a896be30531eb",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(display-p3 0 1 0)": {
|
||||
"kind": "fill",
|
||||
"sha256": "0b3b4eba5c7d53beec5ac1aa3b64c56188bcbf52906e124e5ab3e77a96fdd9cd",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(display-p3 0.2 0.8 0.4)": {
|
||||
"kind": "fill",
|
||||
"sha256": "290e0a38d91b939f45da0a3889e4398944bbd9e5cb89fed8fadb5479bdb65cd5",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(display-p3 0.5 0.5 0.5)": {
|
||||
"kind": "fill",
|
||||
"sha256": "041338275ad973347712ad0ea33583ae668a01fbef9a12c2ebf0f6b227c1bc87",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(display-p3 1 0 0)": {
|
||||
"kind": "fill",
|
||||
"sha256": "71205eb7a329a3ead670c77eee185c0fbeb612f7a2b3d6aadbe2af4f9276b60d",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(prophoto-rgb 0.2 0.8 0.4)": {
|
||||
"kind": "fill",
|
||||
"sha256": "1c19bf5b233573459d494705c2ee42bd2d0238701eea614af76e28066dd2a836",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(rec2020 0.2 0.8 0.4)": {
|
||||
"kind": "fill",
|
||||
"sha256": "6ca68d3ad37c475f5571e34aa0233cd2ebb710cac5d12375975a5fcadfd49cd4",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(srgb 0.2 0.8 0.4)": {
|
||||
"kind": "fill",
|
||||
"sha256": "daed9ae3ff78acf0f758d2a4ddfad5e10f14a053f2718e7835fe3b535dabf3fb",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(srgb 1 0 0)": {
|
||||
"kind": "fill",
|
||||
"sha256": "71205eb7a329a3ead670c77eee185c0fbeb612f7a2b3d6aadbe2af4f9276b60d",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(xyz-d50 0.2 0.3 0.4)": {
|
||||
"kind": "fill",
|
||||
"sha256": "75fc3134903d2193aa029256f8b99c5d87cfbce7286ec890d3cf4d7477ee9947",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color(xyz-d65 0.2 0.3 0.4)": {
|
||||
"kind": "fill",
|
||||
"sha256": "966ab57aae3025be30c2452c1cc49b3e5b6711f9eb43259ffa0555db58084602",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color-mix(in display-p3, color(display-p3 1 0 0) 30%, blue)": {
|
||||
"kind": "fill",
|
||||
"sha256": "58b694deea5f11273f95ffd037423b17bc813bda6b6ea82888f9892e6528a5b0",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color-mix(in oklab, red 30%, blue)": {
|
||||
"kind": "fill",
|
||||
"sha256": "699525471658eda7a99f26181e44841d8a8202443fad2500bae3f1b4e1a8158a",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color-mix(in oklch, #336699 40%, #cc9933)": {
|
||||
"kind": "fill",
|
||||
"sha256": "d35dbf1963cff18033cc64d1991a01072b16cf2e757fbc3a1800b9319470d1f0",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | color-mix(in srgb, red 30%, blue)": {
|
||||
"kind": "fill",
|
||||
"sha256": "5f173ac28e4f26e1f70d6cac12adcd59707692664770315983ecbe9eff88458b",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | hsl(200 60% 40%)": {
|
||||
"kind": "fill",
|
||||
"sha256": "e9ae94390dabacc90a2fde5f91884eba10d5fc4cf5f1aa80a0978c36b5a8e2c7",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | lab(60 40 -30)": {
|
||||
"kind": "fill",
|
||||
"sha256": "12d7c045adeb8a76347d3fd4261593c8b80d97b1dbf55f265991037a4adac6b0",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | lch(60 40 200)": {
|
||||
"kind": "fill",
|
||||
"sha256": "8063e38ed7df66e53b13ea08a949685f03e51847f7794ec9bfbb32c45bd8e10e",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | oklab(0.6 0.1 -0.1)": {
|
||||
"kind": "fill",
|
||||
"sha256": "ec97eed8fc2beb419339539ee9687a9bee6a2126db047e813d3ab91570a4d7ce",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | oklch(0.7 0.15 150)": {
|
||||
"kind": "fill",
|
||||
"sha256": "f256508187ad893812958b37b75d739a131acf40ecf8f1a54f98fc2daf615624",
|
||||
"bytes": 1024
|
||||
},
|
||||
"fill | rgba(51,102,153,0.5)": {
|
||||
"kind": "fill",
|
||||
"sha256": "d57f26dd3a6a96762190a7fcc95bb813d10e6332a6b762aba3057d108930c62c",
|
||||
"bytes": 1024
|
||||
},
|
||||
"canvas colorSpace p3 fill": {
|
||||
"kind": "colorspace",
|
||||
"sha256": "71205eb7a329a3ead670c77eee185c0fbeb612f7a2b3d6aadbe2af4f9276b60d",
|
||||
"bytes": 1024
|
||||
},
|
||||
"env | color-gamut:p3": {
|
||||
"kind": "env",
|
||||
"sha256": "fcbcf165908dd18a9e49f7ff27810176db8e9f63b4352213741664245224f8aa",
|
||||
"value": false
|
||||
},
|
||||
"env | color-gamut:rec2020": {
|
||||
"kind": "env",
|
||||
"sha256": "fcbcf165908dd18a9e49f7ff27810176db8e9f63b4352213741664245224f8aa",
|
||||
"value": false
|
||||
},
|
||||
"env | color-gamut:srgb": {
|
||||
"kind": "env",
|
||||
"sha256": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
|
||||
"value": true
|
||||
},
|
||||
"env | colorDepth": {
|
||||
"kind": "env",
|
||||
"sha256": "c2356069e9d1e79ca924378153cfbbfb4d4416b1f99d41a2940bfdb66c5319db",
|
||||
"value": 24
|
||||
},
|
||||
"env | devicePixelRatio": {
|
||||
"kind": "env",
|
||||
"sha256": "6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b",
|
||||
"value": 1
|
||||
},
|
||||
"env | dynamic-range:high": {
|
||||
"kind": "env",
|
||||
"sha256": "fcbcf165908dd18a9e49f7ff27810176db8e9f63b4352213741664245224f8aa",
|
||||
"value": false
|
||||
},
|
||||
"env | pixelDepth": {
|
||||
"kind": "env",
|
||||
"sha256": "c2356069e9d1e79ca924378153cfbbfb4d4416b1f99d41a2940bfdb66c5319db",
|
||||
"value": 24
|
||||
},
|
||||
"env | prefers-color-scheme:dark": {
|
||||
"kind": "env",
|
||||
"sha256": "b5bea41b6c623f7c09f1bf24dcae58ebab3c0cdd90ad966bc43a45b44867e12b",
|
||||
"value": true,
|
||||
"compared": false
|
||||
},
|
||||
"env | video-dynamic-range:high": {
|
||||
"kind": "env",
|
||||
"sha256": "fcbcf165908dd18a9e49f7ff27810176db8e9f63b4352213741664245224f8aa",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>canvas text ref</title>
|
||||
<style>
|
||||
@font-face{font-family:"Arial";src:url("bundle/arial7_04.ttf") format("truetype");font-weight:400;font-style:normal}
|
||||
@font-face{font-family:"Segoe UI";src:url("bundle/segoeui5_67.ttf") format("truetype");font-weight:400;font-style:normal}
|
||||
@font-face{font-family:"Times New Roman";src:url("bundle/times7_11.ttf") format("truetype");font-weight:400;font-style:normal}
|
||||
@font-face{font-family:"Consolas";src:url("bundle/consola7_00.ttf") format("truetype");font-weight:400;font-style:normal}
|
||||
@font-face{font-family:"Calibri";src:url("bundle/calibri6_26.ttf") format("truetype");font-weight:400;font-style:normal}
|
||||
@font-face{font-family:"Bahnschrift";src:url("bundle/bahnschrift2_07.ttf") format("truetype");font-weight:300 700;font-stretch:75% 100%;font-style:normal}
|
||||
@font-face{font-family:"Segoe UI Variable";src:url("bundle/seguivar2_03.ttf") format("truetype");font-weight:300 700;font-style:normal}
|
||||
@font-face{font-family:"Twemoji Mozilla";src:url("bundle/TwemojiMozilla.ttf") format("truetype");font-weight:400;font-style:normal}
|
||||
body{margin:16px;background:#fff;color:#000;font:13px sans-serif}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p id="status">loading fonts</p>
|
||||
<script>
|
||||
// Canvas 2D text reference page. Every case draws TEXT (or EMOJI) on a white canvas, reads the
|
||||
// pixels back with getImageData and hashes the RGBA bytes with SHA-256. Fonts are loaded
|
||||
// before anything is measured or drawn. The case ids and the drawing code are the ones retail
|
||||
// Firefox 159.0 on Windows ran to write refs.json, so the hashes compare.
|
||||
const FAMILIES5 = ["Arial", "Segoe UI", "Times New Roman", "Consolas", "Calibri"];
|
||||
const SIZES6 = [9, 12.5, 16, 33, 72, 300];
|
||||
const SIZES5 = [9, 12.5, 16, 33, 72];
|
||||
const TEXT = "Hamburgefonstiv 0123";
|
||||
const EMOJI = "\u{1F600}\u{1F389}\u{1F41F}";
|
||||
const ROT = "rot15-scale1.5x2";
|
||||
const TRANSFORMS = ["none", ROT];
|
||||
|
||||
const SPECS = [];
|
||||
const SEEN = new Set();
|
||||
function add(sp) {
|
||||
sp.style = sp.style || "normal";
|
||||
sp.weight = sp.weight || "normal";
|
||||
sp.stretch = sp.stretch || "";
|
||||
sp.op = sp.op || "fill";
|
||||
sp.transform = sp.transform || "none";
|
||||
sp.alpha = sp.alpha !== false;
|
||||
sp.text = sp.text || TEXT;
|
||||
let id = [sp.family, sp.size, sp.transform, sp.style, sp.weight, sp.op].join("|");
|
||||
if (sp.stretch) id += "|stretch=" + sp.stretch;
|
||||
if (!sp.alpha) id += "|alpha=false";
|
||||
if (sp.text !== TEXT) id += "|text=emoji";
|
||||
if (SEEN.has(id)) throw new Error("duplicate case id: " + id);
|
||||
SEEN.add(id);
|
||||
sp.id = id;
|
||||
SPECS.push(sp);
|
||||
}
|
||||
|
||||
// 0) base: fillText and strokeText, with and without a transform; synthetic italic and bold
|
||||
// on a regular face (fillText). Default canvas (alpha: true).
|
||||
for (const family of FAMILIES5) for (const size of SIZES6) for (const transform of TRANSFORMS) for (const op of ["fill", "stroke"])
|
||||
add({family, size, transform, op});
|
||||
for (const family of FAMILIES5) for (const size of SIZES6) for (const transform of TRANSFORMS) for (const syn of ["italic", "bold"])
|
||||
add({family, size, transform, style: syn === "italic" ? "italic" : "normal", weight: syn === "bold" ? "bold" : "normal"});
|
||||
|
||||
// 1) getContext("2d", {alpha: false}): an opaque canvas, where LCD text is possible
|
||||
for (const f of FAMILIES5) for (const s of SIZES5)
|
||||
add({family: f, size: s, alpha: false});
|
||||
|
||||
// 2) rotate(15deg) scale(1.5, 2) on an opaque canvas. The same cases with alpha: true are in
|
||||
// the base above (group 2a of the reference), so they are not drawn twice.
|
||||
for (const f of FAMILIES5) for (const s of SIZES5)
|
||||
add({family: f, size: s, transform: ROT, alpha: false});
|
||||
|
||||
// 3) COLR v0 emoji (Twemoji Mozilla), the one COLR v0 face of the bundle
|
||||
for (const s of [16, 33, 72]) for (const alpha of [true, false]) for (const transform of TRANSFORMS)
|
||||
add({family: "Twemoji Mozilla", size: s, transform, alpha, text: EMOJI});
|
||||
|
||||
// 4) past the glyph-size thresholds (255, 256, 257, 400 px; 300 px is in the base): fillText
|
||||
// and strokeText, Arial and Segoe UI
|
||||
for (const f of ["Arial", "Segoe UI"]) for (const s of [255, 256, 257, 400]) for (const op of ["fill", "stroke"])
|
||||
add({family: f, size: s, op});
|
||||
|
||||
// 5) the variable face Bahnschrift: weight (300, 400, 700) by stretch (75% = condensed, 100% = normal);
|
||||
// canvas has no font-variation-settings, so the axes are reached through font-weight and font-stretch
|
||||
for (const w of [300, 400, 700]) for (const st of ["condensed", "normal"]) for (const s of [16, 33])
|
||||
add({family: "Bahnschrift", size: s, weight: w, stretch: st});
|
||||
|
||||
// 6) the variable face Segoe UI Variable (wght 300-700, opsz 5-36): weight 300, 400 and 700 at four
|
||||
// sizes. font-optical-sizing is auto, so opsz follows the size; the weight reaches the face
|
||||
// through font-weight, as canvas has no font-variation-settings
|
||||
for (const w of [300, 400, 700]) for (const s of [9, 12.5, 16, 33])
|
||||
add({family: "Segoe UI Variable", size: s, weight: w});
|
||||
|
||||
const fontCss = sp => [sp.style, sp.weight, sp.stretch, sp.size + "px", '"' + sp.family + '"'].filter(Boolean).join(" ");
|
||||
const hex = buf => [...new Uint8Array(buf)].map(b => b.toString(16).padStart(2, "0")).join("");
|
||||
|
||||
function measure(sp) {
|
||||
const ctx = document.createElement("canvas").getContext("2d");
|
||||
ctx.font = fontCss(sp);
|
||||
return ctx.measureText(sp.text).width;
|
||||
}
|
||||
|
||||
async function drawCase(sp) {
|
||||
const m = measure(sp), S = sp.size;
|
||||
const W = Math.ceil(1.6 * m + 3 * S) + 80;
|
||||
const H = Math.ceil(4 * S + 0.42 * m) + 80;
|
||||
const c = document.createElement("canvas");
|
||||
c.width = W; c.height = H;
|
||||
const ctx = c.getContext("2d", {alpha: sp.alpha, willReadFrequently: true});
|
||||
ctx.fillStyle = "#fff"; ctx.fillRect(0, 0, W, H);
|
||||
ctx.fillStyle = "#000"; ctx.strokeStyle = "#000"; ctx.lineWidth = 1;
|
||||
ctx.font = fontCss(sp);
|
||||
ctx.textAlign = "start"; ctx.textBaseline = "alphabetic";
|
||||
const y0 = Math.ceil(2.5 * S) + 40;
|
||||
let x = 40, y = y0;
|
||||
if (sp.transform !== "none") {
|
||||
ctx.translate(40, y0);
|
||||
ctx.rotate(15 * Math.PI / 180);
|
||||
ctx.scale(1.5, 2);
|
||||
x = 0; y = 0;
|
||||
}
|
||||
if (sp.op === "stroke") ctx.strokeText(sp.text, x, y); else ctx.fillText(sp.text, x, y);
|
||||
const readback = ctx.font;
|
||||
let img = ctx.getImageData(0, 0, W, H);
|
||||
const digest = await crypto.subtle.digest("SHA-256", img.data.buffer);
|
||||
// The largest cases are 7727 x 3373 (100 MB of RGBA): release the canvas and its readback
|
||||
// before the next case, so that the page never holds more than one at a time.
|
||||
img = null;
|
||||
c.width = 0; c.height = 0;
|
||||
return {id: sp.id, family: sp.family, size: sp.size, transform: sp.transform,
|
||||
style: sp.style, weight: String(sp.weight), stretch: sp.stretch || "normal", op: sp.op,
|
||||
alpha: sp.alpha, text: sp.text === TEXT ? "TEXT" : "EMOJI", font_readback: readback,
|
||||
width: W, height: H, measured_width: m, sha256: hex(digest)};
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const st = document.getElementById("status");
|
||||
try {
|
||||
const LOADS = ['16px "Arial"', '16px "Segoe UI"', '16px "Times New Roman"', '16px "Consolas"',
|
||||
'16px "Calibri"', '300 condensed 16px "Bahnschrift"', '300 normal 16px "Bahnschrift"',
|
||||
'400 normal 16px "Bahnschrift"', '700 normal 16px "Bahnschrift"', '300 16px "Segoe UI Variable"',
|
||||
'400 16px "Segoe UI Variable"', '700 16px "Segoe UI Variable"', '16px "Twemoji Mozilla"'];
|
||||
window.FONTS = {};
|
||||
for (const q of LOADS) {
|
||||
const r = await document.fonts.load(q);
|
||||
window.FONTS[q] = r.map(x => x.status);
|
||||
if (!r.length || r.some(x => x.status !== "loaded")) throw new Error("font not loaded: " + q);
|
||||
}
|
||||
window.R = {};
|
||||
for (const sp of SPECS) {
|
||||
window.R[sp.id] = await drawCase(sp);
|
||||
window.PROGRESS = Object.keys(window.R).length;
|
||||
st.textContent = `cases: ${window.PROGRESS}/${SPECS.length}`;
|
||||
}
|
||||
window.CASE_COUNT = SPECS.length;
|
||||
st.textContent = `done: ${SPECS.length} cases`;
|
||||
window.DONE = true;
|
||||
} catch (e) {
|
||||
window.ERR = String(e);
|
||||
st.textContent = "error: " + e;
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,151 @@
|
||||
{
|
||||
"fonts": {
|
||||
"menu": {
|
||||
"family": "Segoe UI",
|
||||
"size": "12px",
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"stretch": "100%"
|
||||
},
|
||||
"caption": {
|
||||
"family": "Segoe UI",
|
||||
"size": "12px",
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"stretch": "100%"
|
||||
},
|
||||
"icon": {
|
||||
"family": "Segoe UI",
|
||||
"size": "12px",
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"stretch": "100%"
|
||||
},
|
||||
"message-box": {
|
||||
"family": "Segoe UI",
|
||||
"size": "12px",
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"stretch": "100%"
|
||||
},
|
||||
"small-caption": {
|
||||
"family": "Segoe UI",
|
||||
"size": "12px",
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"stretch": "100%"
|
||||
},
|
||||
"status-bar": {
|
||||
"family": "Segoe UI",
|
||||
"size": "12px",
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"stretch": "100%"
|
||||
},
|
||||
"system-ui": {
|
||||
"family": "system-ui",
|
||||
"size": "16px",
|
||||
"weight": "400",
|
||||
"style": "normal",
|
||||
"stretch": "100%"
|
||||
}
|
||||
},
|
||||
"light": {
|
||||
"Canvas": "rgb(255, 255, 255)",
|
||||
"CanvasText": "rgb(0, 0, 0)",
|
||||
"LinkText": "rgb(0, 0, 238)",
|
||||
"VisitedText": "rgb(85, 26, 139)",
|
||||
"ActiveText": "rgb(238, 0, 0)",
|
||||
"ButtonFace": "rgb(233, 233, 237)",
|
||||
"ButtonText": "rgb(0, 0, 0)",
|
||||
"ButtonBorder": "rgb(129, 127, 132)",
|
||||
"Field": "rgb(255, 255, 255)",
|
||||
"FieldText": "rgb(0, 0, 0)",
|
||||
"GrayText": "rgb(109, 109, 109)",
|
||||
"Highlight": "rgb(0, 120, 212)",
|
||||
"HighlightText": "rgb(255, 255, 255)",
|
||||
"Mark": "rgb(255, 255, 0)",
|
||||
"MarkText": "rgb(0, 0, 0)",
|
||||
"SelectedItem": "rgb(0, 120, 212)",
|
||||
"SelectedItemText": "rgb(255, 255, 255)",
|
||||
"AccentColor": "rgb(0, 96, 223)",
|
||||
"AccentColorText": "rgb(255, 255, 255)",
|
||||
"ActiveBorder": "rgb(129, 127, 132)",
|
||||
"ActiveCaption": "rgb(255, 255, 255)",
|
||||
"AppWorkspace": "rgb(255, 255, 255)",
|
||||
"Background": "rgb(255, 255, 255)",
|
||||
"ButtonHighlight": "rgb(233, 233, 237)",
|
||||
"ButtonShadow": "rgb(233, 233, 237)",
|
||||
"CaptionText": "rgb(0, 0, 0)",
|
||||
"InactiveBorder": "rgb(129, 127, 132)",
|
||||
"InactiveCaption": "rgb(255, 255, 255)",
|
||||
"InactiveCaptionText": "rgb(109, 109, 109)",
|
||||
"InfoBackground": "rgb(255, 255, 255)",
|
||||
"InfoText": "rgb(0, 0, 0)",
|
||||
"Menu": "rgb(255, 255, 255)",
|
||||
"MenuText": "rgb(0, 0, 0)",
|
||||
"Scrollbar": "rgb(255, 255, 255)",
|
||||
"ThreeDDarkShadow": "rgb(129, 127, 132)",
|
||||
"ThreeDFace": "rgb(233, 233, 237)",
|
||||
"ThreeDHighlight": "rgb(129, 127, 132)",
|
||||
"ThreeDLightShadow": "rgb(129, 127, 132)",
|
||||
"ThreeDShadow": "rgb(129, 127, 132)",
|
||||
"Window": "rgb(255, 255, 255)",
|
||||
"WindowFrame": "rgb(129, 127, 132)",
|
||||
"WindowText": "rgb(0, 0, 0)"
|
||||
},
|
||||
"dark": {
|
||||
"Canvas": "rgb(28, 27, 34)",
|
||||
"CanvasText": "rgb(251, 251, 254)",
|
||||
"LinkText": "rgb(0, 202, 219)",
|
||||
"VisitedText": "rgb(255, 173, 255)",
|
||||
"ActiveText": "rgb(255, 102, 102)",
|
||||
"ButtonFace": "rgb(43, 42, 51)",
|
||||
"ButtonText": "rgb(251, 251, 254)",
|
||||
"ButtonBorder": "rgb(148, 146, 151)",
|
||||
"Field": "rgb(43, 42, 51)",
|
||||
"FieldText": "rgb(251, 251, 254)",
|
||||
"GrayText": "rgb(117, 116, 122)",
|
||||
"Highlight": "rgba(0, 221, 255, 0.306)",
|
||||
"HighlightText": "rgb(0, 0, 0)",
|
||||
"Mark": "rgb(255, 255, 0)",
|
||||
"MarkText": "rgb(0, 0, 0)",
|
||||
"SelectedItem": "rgb(0, 221, 255)",
|
||||
"SelectedItemText": "rgb(43, 42, 51)",
|
||||
"AccentColor": "rgb(0, 96, 223)",
|
||||
"AccentColorText": "rgb(255, 255, 255)",
|
||||
"ActiveBorder": "rgb(57, 57, 57)",
|
||||
"ActiveCaption": "rgb(28, 27, 34)",
|
||||
"AppWorkspace": "rgb(28, 27, 34)",
|
||||
"Background": "rgb(28, 27, 34)",
|
||||
"ButtonHighlight": "rgb(43, 42, 51)",
|
||||
"ButtonShadow": "rgb(43, 42, 51)",
|
||||
"CaptionText": "rgb(251, 251, 254)",
|
||||
"InactiveBorder": "rgb(57, 57, 57)",
|
||||
"InactiveCaption": "rgb(28, 27, 34)",
|
||||
"InactiveCaptionText": "rgb(251, 251, 254)",
|
||||
"InfoBackground": "rgb(28, 27, 34)",
|
||||
"InfoText": "rgb(251, 251, 254)",
|
||||
"Menu": "rgb(43, 42, 51)",
|
||||
"MenuText": "rgb(251, 251, 254)",
|
||||
"Scrollbar": "rgb(28, 27, 34)",
|
||||
"ThreeDDarkShadow": "rgb(34, 33, 40)",
|
||||
"ThreeDFace": "rgb(43, 42, 51)",
|
||||
"ThreeDHighlight": "rgb(148, 146, 151)",
|
||||
"ThreeDLightShadow": "rgb(148, 146, 151)",
|
||||
"ThreeDShadow": "rgb(148, 146, 151)",
|
||||
"Window": "rgb(28, 27, 34)",
|
||||
"WindowFrame": "rgb(117, 116, 122)",
|
||||
"WindowText": "rgb(251, 251, 254)"
|
||||
},
|
||||
"selection": {
|
||||
"light": {
|
||||
"color": "rgb(0, 0, 0)",
|
||||
"bg": "rgba(0, 0, 0, 0)"
|
||||
},
|
||||
"dark": {
|
||||
"color": "rgb(0, 0, 0)",
|
||||
"bg": "rgba(0, 0, 0, 0)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
# Expected text of getComputedStyle for calc(1px * f(args)) (word-spacing)
|
||||
# and of rotate: f(args) for the angle functions, from ucrtbase.dll's f32
|
||||
# functions. Generated by scripts/ucrt_css_calc.py (python -I) - do not edit.
|
||||
# <fn> <args...> <text on Windows>
|
||||
sin -12.2958984375 0.267186px
|
||||
sin -3.3349609375 0.192165px
|
||||
sin -8.728515625 -0.641354px
|
||||
sin -9.603515625 0.177787px
|
||||
sin 2.6865234375 0.439525px
|
||||
sin 5.9267578125 -0.348928px
|
||||
sin -15.998046875 0.286032px
|
||||
sin 0 0px
|
||||
sin 15.9970703125 -0.285096px
|
||||
cos -10.3515625 -0.600409px
|
||||
cos -2.0146484375 -0.429422px
|
||||
cos -3.9794921875 -0.669025px
|
||||
cos 10.3515625 -0.600409px
|
||||
cos 2.0146484375 -0.429422px
|
||||
cos 3.9794921875 -0.669025px
|
||||
cos -16 -0.95766px
|
||||
cos 0 1px
|
||||
cos 15.9990234375 -0.95794px
|
||||
tan -2 2.18504px
|
||||
tan 0 0px
|
||||
tan 16 0.300632px
|
||||
asin -0.27099609375 -15.7235deg
|
||||
asin -0.6416015625 -39.9114deg
|
||||
asin -0.859619140625 -59.2738deg
|
||||
asin -0.982421875 -79.2413deg
|
||||
asin 0.59423828125 36.4583deg
|
||||
asin 0.751953125 48.7598deg
|
||||
asin -0.4990234375 -29.9354deg
|
||||
asin -1 -90deg
|
||||
asin 0.49853515625 29.9031deg
|
||||
acos -0.61669921875 128.076deg
|
||||
acos 0.499267578125 60.0484deg
|
||||
acos 0.615234375 52.031deg
|
||||
acos -0.5 120deg
|
||||
acos -1 180deg
|
||||
acos 0.499755859375 60.0161deg
|
||||
atan -4.000244140625 -75.9646deg
|
||||
atan 0 0deg
|
||||
atan 4 75.9638deg
|
||||
atan2 -1.125 1.890625 -30.7544deg
|
||||
atan2 0 0.015625 0deg
|
||||
atan2 1.125 -1.90625 149.452deg
|
||||
exp -2.1875 0.112197px
|
||||
exp 0 1px
|
||||
exp 2.187255859375 8.91073px
|
||||
log 1.0966796875 0.0922872px
|
||||
log 24.4873046875 3.19816px
|
||||
log 31.2861328125 3.44317px
|
||||
log 16.7880859375 2.82067px
|
||||
log 24.5703125 3.20154px
|
||||
log 35.609375 3.57261px
|
||||
pow 1.125 -1.5 0.838052px
|
||||
pow 4.4375 4 387.751px
|
||||
pow 12.1875 -2.0625 0.00575839px
|
||||
pow 2.0625 -4 0.0552617px
|
||||
pow 6 1.9375 32.1861px
|
||||
hypot -3.1875 -5 5.9296px
|
||||
hypot 0 0 0px
|
||||
hypot 3 4.6875 5.56531px
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,110 @@
|
||||
{
|
||||
"source": "C:/ff/invisible_WebCodecs/captures/h264-1080p-bframes/retail-win/result.json",
|
||||
"source_meta": "C:/ff/invisible_WebCodecs/captures/h264-1080p-bframes/retail-win/meta.json",
|
||||
"browser": "ff159-win-1080p",
|
||||
"codecString": "avc3.640028",
|
||||
"codedWidth": 1920,
|
||||
"codedHeight": 1080,
|
||||
"frameCount": 96,
|
||||
"frameDurationUs": 41667,
|
||||
"rgbaAllocationSize": 8294400,
|
||||
"rgbaFormat": "RGBA",
|
||||
"rgbaSha256ByIndex": [
|
||||
"ec86f786dfd4fb31be388382b7132df8f692c166f0398047454bbef38abf280c",
|
||||
"612a924786de8460f6ebcd5893921a8ae04fb41b441cd9f0087cf6183fb960a9",
|
||||
"e9aa87d893e542f53c3900fcd37f7a9ad40bc89b5e456d4a6ae73f142df04759",
|
||||
"441e299f66fca23ff0716ebb32982f919558967fbaa4bf877040e8e0e41f67f7",
|
||||
"c9b54bf73bc6d87c90196e128ee21aa5ae8c855d8474b1a967fbf6ba2110e22b",
|
||||
"2ab4b1709f2f049541095d386e7cd7297e3ebe1503d120d1138ca61d74a1b8af",
|
||||
"8fa4df13e422b44d585ba7413be439069b7911b7be4916aa6f338821be6665fc",
|
||||
"ce2e7286c19a9c461342c439ccdc31a8573f50dd9318dc836ba8adbc1c6f8958",
|
||||
"b64915b1f2d8fbb9795002736543baaf65339458c8ff204c370f78e1a0ff4da1",
|
||||
"ae82fff8551a99dee31cdda4fb1154b58382cf6e9d6a275b320b35db14fb47fe",
|
||||
"bbcc0181e5beeb699abfd810f2598e66d8f151b5e2712b030b9b8d8506cd9f64",
|
||||
"2b52fcb494ae4b3fa8bc4f7c66da19cf3816c4928c2861ca807f079a835c69dd",
|
||||
"6eeb0e0293a7447ea85227a04fba74b72f4b16573ddb457f4f7ec0b96a05a5dc",
|
||||
"8c3dc83cd33c5411cdba6123cfb62ee8c53fe181a325b4abb450ce7afb9edfa7",
|
||||
"d4d9297594c0af1c331c6d403cb78bedfcf33d82707f06873b48155287f33139",
|
||||
"f01b715b011494cf2bf5f97212507d07a48a00282ce8d2bd4afd8f76aa8f4f65",
|
||||
"976790562ae138a42395663d66d8fb987b83e1cc40b067821f3d438fe496765a",
|
||||
"5896a442951c90479e6093ee92fc51b00734c8fafe84061c6ad2988c5c9719ce",
|
||||
"dc84a9c2e608daf77ee25c881d0df69f9ddf6715b07b8eba3cbbfaaa692f4aa2",
|
||||
"98dc9edd09bf0ce330fdc8eafa675f509adccd92e21b231f4d82b67e0448b172",
|
||||
"1cc5bcb92c1947231e63a034675233933928d318962cca2598631dda4ea0398d",
|
||||
"7851d124d7665bbc63decfde6035775bc29b7fc9466513789cafd7db49c9fb03",
|
||||
"d00140e72758644c62ea0be72ff6d6371b27b1a8e488bb30b43931501def5719",
|
||||
"3fa367ee394ed399a41f60d4b0fc9a9a93c36daffb8da37d44a09999a88c8929",
|
||||
"b724e7bdd2e08efd665aeb1d088bdb6fa860c80d0e1c810f4b60e017d75b4060",
|
||||
"26920b0129c66dcc1f5df0832f7a7fa5dec50e7b0841c4bf4cbf75d886b1bd14",
|
||||
"bea97dc4d9550ab244ca648458c46cca3a8c278488e9add218af26fc37caf96e",
|
||||
"330907a28b53c8d1f97e854c827960c7a1da7fd8460694a1a145ae9bdd90a48b",
|
||||
"ac7bd746456764639eea4bb43b5d60502ee3b18cc7e7266a62960b2b1f21a3bd",
|
||||
"9797886bc01f7ab73470850cc79fe21541e286dab9f818a73e7b0f1d5f8ab838",
|
||||
"017db98229f47489c899fcedcb41c3fdace8d00adbf2c828a930eeac0adc9d3a",
|
||||
"2258e361a2762ded437a2d3b0793670d790d4e829d406f5a1c26c04d9b3272b2",
|
||||
"07ea8b535e731f51cb197015e82ebdd1b61ceff43397df94959c3bf4244bfdb8",
|
||||
"37e0a701d67c6a06b81783e27f0646071a788f0820d0d8a27d206a0e5e1bab87",
|
||||
"9e9c465245061255dea8f3e4263e500ddd96ae6555a2935771688572aa57904e",
|
||||
"ca8696c5c343ab883ee48998b20fdede0ea89da43921ce6aa010988091ad7ffe",
|
||||
"37c760b0eafc7f9b58f43cff84ff5ea4297085645a96b5b089ace4bed6579654",
|
||||
"306bd7874a05f7ee13a1977a677a901d9a803cc63a5ef51234cd09f4343b2578",
|
||||
"9e862bd1ef856d4d6e897f765b3a34405a2b33f08748135fa49782b36ebd018e",
|
||||
"9bdf82e391f7a415200b564cdb41e30b1d79e8550aaa2e100d0c93214dd02f84",
|
||||
"c58f9d86f624efcbae62ee01cadf7f1b974a9a0d1741c5a5add3d4baa4d54a57",
|
||||
"a41205a558148bc2c24c25d3f08abec0eb76371ac071cddba1a0b74f0b00b2d5",
|
||||
"8799abc56859269cc034e87b4c795b7c756db289b66d4944843bd88d44bcee0f",
|
||||
"ccfd5404af0d7ee5866e65ad1d420152be2591a339bb8cbfc8946f5789c5d46e",
|
||||
"ea56bed52ff1544be1fa04010a8a6d50c3beb9b249bd125b253006798c9c146e",
|
||||
"9f5c23b53933d5f52430f6c8d2e20b501e4747517856ee6f9e42b3c2ab3dfd93",
|
||||
"13c6283059d08e83b7a3e2823887746105c8161df2c43172a21ce81d73bf8e94",
|
||||
"62e109d54a8359628072dbd611f7c7d86a4aeb24093a79bd5e62a6212946f058",
|
||||
"00d37fb6a8bd4746bdee78fd703dbc21d571d281d270b90d315f47f807a9c8f7",
|
||||
"72b5749554816682dfb490f9a6e84c031fb257e066257de5ca38f9e61d8336e3",
|
||||
"5f736aae1dc7165be27fcbcde0424a7e81efe6ba23ea3b9ff18fe33e85edeadf",
|
||||
"82e781edecfed6f8cff7217aa7bb9843cfa050223670313f53439e5bb1cd581d",
|
||||
"2a7c33ab17ae5b68ddb6ab18157e29cd3146c170d638747d9f850bf820a0c106",
|
||||
"54638e8b4dd3721bd5e1b6ebb92d0d6269d7b3d1bb532f754860d0496657aca5",
|
||||
"f609d30438dc792107ed97d1040d5ab51d6dcf74b023429eb4cb7b687058fe44",
|
||||
"f4416eccaa2b90b2b28907dfc4560e63a4880c5c627cbf24225d68d17e3bad0d",
|
||||
"27ba6138b23ce0c3979de1943b282cbafff52a212db9665833bfefc22e1cd6a9",
|
||||
"7d3cd0fe51defbe28fac6447250b2c57614046739fb5fb9704d191470a88b629",
|
||||
"3d34c42f7038328efcffd83f12448f79d1b601aee0bb5aa9559a161715309b6e",
|
||||
"da3253068d029fcc47026cd1698316c65e9b8e30f1c33cea367e4af87569309b",
|
||||
"5b7ca1d07a9185644749ca361db6faa04b2c2fa7b6e23eba0d5e824e2294f4d3",
|
||||
"82522459c674f01cfeacc600ebbb5cffeabcd371613f5632f5c496c4018057f9",
|
||||
"72dc38d3ea4c917495c4c7eaa34f372d90dbedb9e41b6c6d2fd14649bcde3f11",
|
||||
"b6fa4a96d2aa0be036845b6180c8cbd03cf0e37f8f68cee4f13972bd29ba5dcc",
|
||||
"e4ddf2cdc4a372df492d9a3babd06b2e2e8eb3ff0f065332b066f54bf801718e",
|
||||
"7feaf1dc3f234c715e107461be06c7952c497374ad6feb1f352de690a62b5f8d",
|
||||
"edcd3c7d093d2e0bfeefaedd493c4f7bd8a2a13733b072c9c009308e45830dcb",
|
||||
"a5be7f4f6ae2aa30f391de192f89e83a2f494f0b0a29c9d4c25072e7cdbd4e8c",
|
||||
"a85212783e0614f7191cb6ea96361fd136be9afaa74c2dfe011f2a02b51acade",
|
||||
"bd3f233278c255bb4ef6cb83f2b2a3dd7daf8788aedb4f37db893ed2eb233055",
|
||||
"da0646ae2080593fe95ad475e9f88a61aaa5c67f45c88db1159afc6c808a395e",
|
||||
"635d187d98ca46b0916f83a3cb8c5e306c87519b0d97efd0b3a053be10726cae",
|
||||
"493463e004d5e760427057f25a9309dd1a7ccd8db7ff678385c0956a0df4ed6b",
|
||||
"f551dad30b92a9dc572768ec8b7d5cfdea6cbdf3d6a2612caa0a446604948d81",
|
||||
"7fccc7de25a0723a7fb96c82da7b3dfb90d13a040912e28390aa1893cfb9544c",
|
||||
"994aa24a02e2a4767c4b8c505a798d4ef2a9b6a56f457b165662951e087827ff",
|
||||
"ddcd5fcb63faeb2de4736f716384ba8033e4caf80531c6be879abcb7d1e2e3c4",
|
||||
"de319d6d3cc31892b31798aa382d3bbadbfb5c63b5d085d44535753cd1154d88",
|
||||
"bf0a1dee65b36efc72d9d47081064cd1478a41eb2930f5f209efde82ad81a90f",
|
||||
"58250251ac29c974e1c172ed7891f7b8918dc92722738051a2d47652fa15cb0c",
|
||||
"9d54d9c89ba4bb7bc44eaa92ba162851c425e6da7061712971a816d2f76226e9",
|
||||
"f8606f3d9cc85dd938e7c81c80bf459b704ee2fcf90dd5db2b22a57e9063b2d1",
|
||||
"9146f5fbfa4b9d0c6fb5d3fc754114f45b2960b0160bc5ec8049c766cb159a8f",
|
||||
"2a8fcf1082f08ad75bd679e43c331d8c68dd125583a0215a9d791f2dedacd252",
|
||||
"1cc30cac847d1f4cb3be1a6548320587083f8a140360720cf6e602643604db55",
|
||||
"f12ee7fa2a4f6c67ff363515af5d5ff269c2888c5cb0b1ef65b51c532c6513fe",
|
||||
"1fb7c9b0e42cc75c72f80ceab00ddbf1c53b79f0079afdc7f2d12a0b1362d470",
|
||||
"4204700c6c144ea21dcf35004c506abf1b4c31c7e56cb7593fe91a0df7a7e4bf",
|
||||
"1604b6be565a34d390015a69d4ce4939d1223a2a7340c665516cc268896f7302",
|
||||
"945f03992308869fd8c3cb866d587bc02cce18718491eb014e4c3a2d2b9910db",
|
||||
"b1483d183ecec1757c21ea90abe833ec6c7473e69be22fab59a804f469844fbc",
|
||||
"699ec626d2c4044b8fd95a6187b6b670f00b3e357f6147b5225f8b0b53855c08",
|
||||
"07b37382fee8cebab882854cf3ea1c05ada71ea88288333a878271c9a2d11c83",
|
||||
"4210279021308f9a52367d78c3527904da8d3488388dc78e49c435695f300f15",
|
||||
"616e4309c7b433d282b0727984cd797d0f384975749b34c12cba56b3bc6ec770",
|
||||
"6791837bb4b63b58877031e95b7e5d8556310b5f5bcbe40432ea41cd3d0a29e6"
|
||||
]
|
||||
}
|
||||
Loaded 100 of 187 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user