Compare commits

...
Author SHA1 Message Date
feder-crandClaude Sonnet 5.5 c8842355fb e2e: the dot() reads a zero's sign as the GPU does (zeros of both signs in the vectors, the comparison keeps the sign)
The comparison treated -0 and +0 as equal, which hid a fma whose product and sum are both -0 coming back +0. The model's fma now gives IEEE's sign of a zero result, with a unit test.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 17:20:40 +01:00
feder-crandClaude Sonnet 5.5 e9c888d8e8 e2e: a WebGL dot() gives the bits of the GPU family the persona declares (from firefox-60)
tests/test_webgl_dot_has_the_declared_gpu_s_bits_e2e.py reads back dot() of two, three and
four components through a float-bits shader and compares the bytes with the NVIDIA fma
chain computed in exact arithmetic, for alu_class 1 and 2; class 0 is the control. The model
runs as a unit test everywhere; the browser tests are Windows only and guarded by
engine_at_least("firefox-60"). The engine's gate lists it by name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 14:05:35 +01:00
Federico EliaandClaude Sonnet 5.5 c7c7285557 e2e: tagged images read back on a canvas as retail Windows Firefox reads them (from firefox-60) (#425)
* tests: the canvas ICC readback reference (retail Firefox 159.0 on Windows, default prefs)

refs.json holds the SHA-256 of the 72 probes of tests/data/canvas_icc_ref/index.html as
retail Firefox 159.0 (build 20261022150525) gave them on a PC whose monitor profile is the
stock "sRGB Color Space Profile.icm": ten generated tagged images drawn four ways, 22 fill
colours, the canvas colorSpace probe, nine environment values. 27 probes depend on the
profile (qcms converts tagged images to it); for those the hash without the conversion
(force_srgb=true, same machine) is kept too. gen_images.py writes the images and ICC
profiles with the standard library, byte for byte what the measurement used, so the
repository holds no binary file. scripts/build_canvas_icc_refs.py rebuilds refs.json from
the run files; the unit test checks the structure, the 72 probes and the 27 profile
dependent ones.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* e2e: tagged images read back on a canvas as retail Windows Firefox reads them (from firefox-60)

The test builds the ten tagged test images with gen_images.py, serves them with the probe
page on localhost, runs the 72 probes on the engine and compares the SHA-256 of each
getImageData read with refs.json (retail Firefox 159.0 on Windows, default prefs, monitor
profile "sRGB Color Space Profile.icm"). Every differing probe is listed with the expected
and the obtained hash, and marked when the engine gave the value without the conversion.
On an engine that skips the conversion (firefox-58, firefox-59) 27 probes differ.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 13:15:14 +01:00
Federico EliaandClaude Haiku 5.5 da503f254a tests: webgl getParameter flake reports the reason (gl null, context lost, drift) (#424)
The test returned a bare false, so a CI failure could not tell a null
getContext('webgl') from a parameter that changed between reads. The
page now returns the reason: gl null (with webgl2 availability), context
lost, or drift with the round, parameter, and first differing vs
reference values.

Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>
2026-11-09 12:45:33 +01:00
Federico EliaandClaude Sonnet 5 43a3197d89 e2e: WebCodecs software decode ignores a page's hardwareAcceleration request (#423)
* e2e: WebCodecs software decode ignores a page's hardwareAcceleration request

Firefox-60 checklist goal 6b. REA (invisible_WebCodecs/notes/
nv12-rgb-conversion.md) found the D3D11/DXVA hardware path doing its
NV12->RGB conversion in the GPU (ID3D11VideoContext::VideoProcessorBlt),
a host dependency. Companion to the engine fix
(ShouldPreferSoftwareDecoder in dom/media/webcodecs/DecoderTemplate.cpp,
branch media-webcodecs-software-only): with the engine on, decode must
stay on the software path (libyuv) no matter what the page asks for.

Same 96-frame 1080p B-frame clip and access-unit split as
test_webcodecs_h264_bframe_pts_order_e2e.py, but the page's VideoDecoder
config explicitly asks for hardwareAcceleration: "prefer-hardware", and
every output frame's copyTo({format: "RGBA"}) is hashed and compared
against the software reference (captures/h264-1080p-bframes/retail-win/
result.json - Firefox 159.0 retail Windows, headless, DXVA off per its
own meta.json), vendored at
tests/data/webcodecs_h264_1080p_bframes_rgba_sha256.json so the test does
not depend on the private study repo being checked out beside this one.

Needs no GPU to run: on a VM without one there is no hardware path to
force into software, so a pass only confirms libyuv has not drifted: the
guard is against a future regression that gives the engine a real
hardware path again while leaving the page's request wired straight
through.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Translate the Italian checklist quote in the e2e docstring to English

The pre-push hook's own English-only check refused on this (the goal
6b line, 'dalla, della'), which is why test_the_pre_push_hook_gates_release_tags
also failed: the hook's self-test run hit the refusal before the
gate-wiring assertion could see a clean pass. Not two separate bugs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-09 12:44:59 +01:00
Federico EliaandClaude Sonnet 5.5 ce79a51417 tests: the blending e2e runs on Linux only until ANGLE's translator does the blend (#422)
On Windows the blend is done by the host's Direct3D 11: a runner without a GPU uses WARP, which
rounds up to 2 off (4090 of 207956 results on the firefox-60 candidate). The Mesa patch that makes
blending exact fixes Linux only. The test skips on Windows with that reason and returns there when
the blending goes through the translator (objective 5).

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 11:26:08 +01:00
Federico EliaandClaude Sonnet 5 d9c21dd67b e2e: WebCodecs VideoFrame.timestamp order on a real H.264 B-frame stream (#421)
Companion to the engine fix in FFmpegVideoDecoder.cpp (branch
media-h264-bframe-pts, goal 6 of the firefox-60 checklist): ff_h264_decoder
doesn't set FF_CODEC_CAP_SETS_FRAME_PROPS, so without the engine's own
reorder buffer the pts ffmpeg attaches to each decoded frame is the most
recently sent packet's, not the one that produced it. A page reading
VideoFrame.timestamp from WebCodecs sees that reordering directly on any
B-frame stream.

Same schema as test_webcodecs_h264_without_host_libavcodec_linux_e2e.py:
decodes the vendored 96-frame 1080p clip (has_b_frames 2, same one measured
in invisible_WebCodecs) with the access units split client-side exactly like
the browser-side probe that produced the retail-win reference capture, and
checks the output order against that capture's own dense, strictly
increasing sequence.

Needs a firefox-60 (or later) build with the fix, which does not exist yet:
collects and skips cleanly today (no cached/pointed binary), same as the
fixture's documented contract.


(cherry picked from commit 2a025dc97f5d2f5ed9254395fc8facc8e411c59f)

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-09 11:24:26 +01:00
Federico Elia 64f76b2d94 e2e: the system fonts and colours are Windows retail's, and a missing declaration refuses the launch (from firefox-60) (#420)
* Add an e2e that compares the system fonts and colours with Windows retail

* Compare the system-ui family too

The e2e needs engine_at_least, so it is merged after PR #416.

* Add an e2e that a launch missing a system theme pref is refused

Needs engine_at_least, so it is merged after PR #416.
2026-11-09 11:16:09 +01:00
Federico EliaandClaude Sonnet 5.5 808c8f8c97 e2e: canvas 2D text equals retail Windows on every OS (from firefox-60) (#419)
* Test: canvas 2D text equals retail Windows on every OS

240 canvas text cases (five Windows fonts, six sizes, a transform, fill and stroke, synthetic
italic and bold) hashed from getImageData and compared with the hashes retail Firefox 159
gave. The run's hashes can be written out, and scripts/compare_canvas_text_runs.py names the
cases two runs (Debian 12 and Ubuntu 24.04) draw differently. Gated on firefox-61.

* Test: the canvas text reference is made with the bundled fonts, gated on firefox-60

refs.json carries the bundle file and sha256 of each font and the retail machine's
ClearType state; the test checks the engine's fonts against them and declares that
state as the persona.

* Test: the canvas text reference covers alpha false, COLR v0 emoji, large sizes and a variable face

refs.json now holds 330 cases in seven groups, merged by id from the two
measurements of retail Firefox 159.0 by scripts/build_canvas_text_refs.py;
the page draws them on getContext('2d', {alpha: false}) where the reference
did, frees each large canvas after its hash, and the test names the
differing cases group by group and checks the Twemoji Mozilla and
Bahnschrift font hashes too.

* Test: the canvas text reference covers Segoe UI Variable at three weights

Group 6 draws the bundled seguivar2_03.ttf (wght 300-700, opsz 5-36) through @font-face
font-weight 300 700 at weight 300, 400 and 700 and sizes 9, 12.5, 16 and 33: 12 cases, the
three weights hashing differently at every size. The hashes are retail Firefox 159.0's on
Windows (the official installer's firefox.exe, sha256 d8b5ed82...), measured by running this
page itself with the bundled font files; the same run redrew the 330 existing cases and
every width, height and hash equals the reference already in the repository, so the new
cases come from the same machine and the same code. refs.json keeps its existing cases and
field order and gains the 12 cases, the font entry and its load status.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 11:16:04 +01:00
Federico EliaandClaude Sonnet 5 a42d863e48 Add e2e: WebCodecs decodes H.264 without a host libavcodec/libavutil (#418)
Same schema as test_webgl2_exists_without_host_mesa_linux_e2e.py: the
engine ships its own ffvpx, so VideoDecoder must decode webcodecs/h264.annexb
(10 frames, 320x240, vendored from web-platform-tests) on a Linux host that
has no system libavcodec/libavutil to fall back on. Skips on firefox-59 and
earlier (engine_at_least("firefox-60")), on non-Linux, and on a host that
still has a libavcodec (the check proves nothing there).


(cherry picked from commit 47f26b376ba8c5e7de070c1ae6e2c3a5105fe3db)

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-11-09 07:08:33 +01:00
Federico EliaandClaude Sonnet 5.5 f62bf3f6dc e2e: WebGL blending rounds once and mediump runs at 32 bit (from firefox-60) (#417)
* e2e: no browser process reads the host's fontconfig (Linux)

The engine's gtest of the empty fontconfig configuration looks only at
the final state, so it would also pass if GTK, Pango or the first
FcInit() had loaded the host's configuration before the hook replaced
it. This test runs the browser under strace -f, through a tree of links
to the engine whose executable execs the real one, draws a page with
text and fails on any call, in the parent or a content process, that
names /etc/fonts, ~/.config/fontconfig, ~/.fonts.conf, /usr/share/fonts,
FONTCONFIG_FILE or FONTCONFIG_PATH.

Measured on ubuntu:24.04 under xvfb-run with invisible-core 58.56.0,
invisible-playwright 0.47.1 and firefox-58 (build 20261108115355): it
fails. The parent makes 1127 such calls over 503 paths, two content
processes 366 over 69, starting with access/openat of
/etc/fonts/fonts.conf and conf.d.

* e2e: Math.sin, Math.cos and Math.tan give ucrtbase's bytes in every JIT tier

Math.sin(Math.PI / 4) is 0.7071067811865476 on Windows Firefox (ucrtbase) and was
0.7071067811865475 on Linux (fdlibm, or glibc with the pref off). The test reads
the result bits of 4,516 hard inputs, every one where fdlibm or glibc 2.43 differ
from ucrtbase among 30,372 measured on Windows 11, plus every 8th of the others,
for twelve rounds in the same functions so the interpreter, the baseline JIT and
the optimizing JIT all answer. Fails on the Linux engine until it carries
libxul's own sin/cos/tan and Windows' value of
javascript.options.use_fdlibm_for_sin_cos_tan.

* e2e: the sin/cos/tan loop runs for a measured time, and the counts agree

No API a page can read tells which JIT tier ran a call, so the test no longer
claims every tier: each function now runs over its inputs for at least three
seconds and twelve rounds, and every round must equal ucrtbase. The docstring and
the data's header give the same counts, over the 30,372 distinct inputs: fdlibm
441, glibc 2.43 651 (653 counted duplicates), one or both 832, 4,516 lines kept.

* tests: engine_at_least skips a test on an engine older than the one that promises the property

* tests: calc() equals ucrtbase's text, and a screenshot of text returns

* tests: calc() cases read word-spacing, where a zero is 0px and not normal

* tests: engine_at_least compares the number only and fails on a seal with none

* tests: the fontconfig stand-in is killed as a group, the data checks are unit, the screenshot is wall-clock

* Test that WebGL blending is done unquantized and rounded once

On Windows the engine draws through ANGLE on Direct3D 11: the fragment
shader's float output goes into the blender as it is, the blend is
computed at float precision and the result is rounded once, to the
target's format. On Linux the engine's own llvmpipe quantized the shader
output to the target's 8 bits first and blended in 8-bit arithmetic, so
a page read back values up to one step off (two for SUBTRACT): SRC_ALPHA
/ ONE_MINUS_SRC_ALPHA over a destination of 100 with a source of 200 and
an alpha of 1/255 gave 101, where D3D11 gives round(100.392) = 100.

The test sweeps the source alpha over the common factor pairs and the
ADD, SUBTRACT, REVERSE_SUBTRACT, MIN and MAX equations, with straight,
premultiplied and non-8-bit-exact sources, onto RGBA8, RGB10_A2, RGBA4
and (with EXT_texture_norm16) RGBA16 and R16 targets, in one evaluate,
and compares every channel with the exact blend computed in double,
rounded half up (near-ties skipped). Maximum error must be 0. It runs on
every OS: it is the rule the Windows engine already follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test that a mediump WebGL shader computes at 32 bit, as on Windows

On Windows the engine draws through ANGLE on Direct3D 11, which runs
mediump and lowp at full 32-bit precision. On Linux the engine's own
llvmpipe ran them as fp16, so an 8-bit texel read through a sampler of
default precision came back up to ~0.12 of a step off texel/255, and
arithmetic lost every bit past 11: 2049.0 + 1.0 gave 2048.

Three shaders with `precision mediump float;` write the bits of their
floats into an RGBA32UI target: texelFetch on an RGBA8 texture holding
all 256 byte values per channel (default sampler precision, and with
`precision mediump sampler2D;`), which must read back as float32(byte/
255) to one ulp, and single correctly rounded operations whose float32
result fp16 cannot hold (2049.0 + u, 0.1 * u, 1.0 + u * 2^-12, 32.0 + u
* 2^-10), which must be exact. Runs on every OS: the rule is the one the
Windows engine already follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* tests: WebGL blending and mediump precision hold from firefox-60

Both read pixels a page reads back. firefox-59's llvmpipe still blends in 8
bits and runs mediump in fp16, so the two tests declare firefox-60 with
engine_at_least; older engines skip them with that reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test that WebGL2 exists on a Linux host that has no Mesa

A page tells a host with no GL from one with a Mesa by getContext("webgl2")
returning null. On firefox-59 the host's glxtest blocked WebGL on a host with
GTK and no Mesa (FEATURE_FAILURE_WEBGL_EXHAUSTED_DRIVERS); the engine's WebGL
draws on the GL it ships, so the host must not decide. The test asks for WebGL2
and WebGL1 and reads a cleared pixel, from firefox-60 (engine_at_least), and
skips on a host that has a Mesa since it proves nothing there. The series gate
removes every Mesa library from its Linux legs and fails if one is left.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 00:18:27 +01:00
Federico Elia eadf95b90a e2e: engine-gated tests for the empty fontconfig, ucrt math, calc() and text screenshots (#416)
* e2e: no browser process reads the host's fontconfig (Linux)

The engine's gtest of the empty fontconfig configuration looks only at
the final state, so it would also pass if GTK, Pango or the first
FcInit() had loaded the host's configuration before the hook replaced
it. This test runs the browser under strace -f, through a tree of links
to the engine whose executable execs the real one, draws a page with
text and fails on any call, in the parent or a content process, that
names /etc/fonts, ~/.config/fontconfig, ~/.fonts.conf, /usr/share/fonts,
FONTCONFIG_FILE or FONTCONFIG_PATH.

Measured on ubuntu:24.04 under xvfb-run with invisible-core 58.56.0,
invisible-playwright 0.47.1 and firefox-58 (build 20261108115355): it
fails. The parent makes 1127 such calls over 503 paths, two content
processes 366 over 69, starting with access/openat of
/etc/fonts/fonts.conf and conf.d.

* e2e: Math.sin, Math.cos and Math.tan give ucrtbase's bytes in every JIT tier

Math.sin(Math.PI / 4) is 0.7071067811865476 on Windows Firefox (ucrtbase) and was
0.7071067811865475 on Linux (fdlibm, or glibc with the pref off). The test reads
the result bits of 4,516 hard inputs, every one where fdlibm or glibc 2.43 differ
from ucrtbase among 30,372 measured on Windows 11, plus every 8th of the others,
for twelve rounds in the same functions so the interpreter, the baseline JIT and
the optimizing JIT all answer. Fails on the Linux engine until it carries
libxul's own sin/cos/tan and Windows' value of
javascript.options.use_fdlibm_for_sin_cos_tan.

* e2e: the sin/cos/tan loop runs for a measured time, and the counts agree

No API a page can read tells which JIT tier ran a call, so the test no longer
claims every tier: each function now runs over its inputs for at least three
seconds and twelve rounds, and every round must equal ucrtbase. The docstring and
the data's header give the same counts, over the 30,372 distinct inputs: fdlibm
441, glibc 2.43 651 (653 counted duplicates), one or both 832, 4,516 lines kept.

* tests: engine_at_least skips a test on an engine older than the one that promises the property

* tests: calc() equals ucrtbase's text, and a screenshot of text returns

* tests: calc() cases read word-spacing, where a zero is 0px and not normal

* tests: engine_at_least compares the number only and fails on a seal with none

* tests: the fontconfig stand-in is killed as a group, the data checks are unit, the screenshot is wall-clock
2026-11-08 23:57:25 +01:00
Federico Elia b81f1561c5 Merge pull request #415 from feder-cr/clean-install-timeout
The tests that install from the index get their own deadline
2026-11-08 21:07:05 +01:00
Federico Elia 61d2ee29d5 Merge pull request #414 from feder-cr/gate-second-linux
Host gate: two Linux legs are held to each other; text.* narrowed to what is open
2026-11-08 21:07:02 +01:00
feder-crandClaude Opus 5.5 882c0f3a0e Host gate: the Linux GL defect is excused on both Linux legs
The Debian leg draws WebGL with the same Mesa delta 1 from Windows as the
Ubuntu one (and identical to it, same-OS comparison), and the exception
named only linux-x86_64: 12 failures on the re-gate of firefox-59. A test
holds every Linux-scoped known defect to all Linux legs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:22:00 +01:00
feder-crandClaude Opus 5.5 dde60415d7 The tests that install from the index get their own deadline
The module installs the README's block once, in the clean_venv fixture,
and pytest-timeout counts that setup in the first test that requests it.
With PyPI slow the install took 517 s, over run_e2e.py's 420 s per-test
deadline, and the guard killed the worker on a slow test, not a stuck one.
Each test that takes clean_venv now carries 900 s, under the block's own
1800 s cap; a test asserts it and fails without the marks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 20:01:18 +01:00
feder-crandClaude Opus 5.5 be60e4d7e4 Host gate: two Linux legs are held to each other, and text.* is narrowed to what is open
A known defect excused a key on every non-Windows leg, so a difference
between two Linux hosts passed unseen. compare() now holds the legs of one
OS to the first of them wherever the identity does not change the value,
known defects included: they excuse the difference from Windows only.
The text.* block becomes the surfaces that differ on the firefox-59 dumps
(glyph pixels, advances, ink extents, serif/monospace fallback widths);
text.adjust, text.fonts, text.rect, text.units and the vertical metrics
are now held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 19:55:31 +01:00
Federico Elia 8c2dcbf570 Merge pull request #412 from feder-cr/ledger/0.47.1
record 0.47.1 as published
2026-11-08 18:29:05 +01:00
feder-cr 4fddee2d46 record 0.47.1 as published 2026-11-08 17:12:11 +00:00
Federico Elia 87f48c9b8a Merge pull request #411 from feder-cr/release/0.47.1
0.47.1: pin invisible-core 58.56.0, the keyboards Windows installs with the language
2026-11-08 17:57:28 +01:00
feder-crandClaude Opus 5.5 7d702fb188 0.47.1: pin invisible-core 58.56.0, the keyboards Windows installs with the language
The keyboard pref carries Windows' own form (LANGID:KLID joined by
semicolons), declared by the core; the server's fallback, when a caller
wrote its prefs without it, uses the same form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 17:27:42 +01:00
Federico Elia 42cbc45da2 Merge pull request #410 from feder-cr/own-gl-e2e
e2e: on Linux WebGL draws on the engine's own GL, also under X11
2026-11-08 16:18:44 +01:00
Federico Elia 97faaa84f2 Merge pull request #409 from feder-cr/ledger/0.47.0
record 0.47.0 as published
2026-11-08 16:06:31 +01:00
feder-crandClaude Opus 5.5 e5cb8934a2 e2e: on Linux WebGL draws on the engine's own GL, also under X11, and every declared extension answers as on Windows
Skipped where the package has no llvmpipe/ (engines before firefox-59).
On candidate 42484125583 both fail: no WebGL under Xvfb, the surfaceless
display asked for with the X11 display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 15:51:56 +01:00
feder-cr 16abec2c09 record 0.47.0 as published 2026-11-08 14:49:58 +00:00
Federico Elia 742281ec3a Merge pull request #407 from feder-cr/engine/firefox-58
0.47.0: pin invisible-core 58.55.0, the firefox-58 engine (Firefox 159)
2026-11-08 15:36:08 +01:00
feder-cr c5e89a85d2 Merge remote-tracking branch 'origin/main' into engine/firefox-58 2026-11-08 14:51:13 +01:00
Federico Elia a8da4b117f Merge pull request #408 from feder-cr/ci-github-token
CI downloads the engine with the job token; the user path stays anonymous
2026-11-08 14:07:58 +01:00
feder-crandClaude Opus 5.5 4ba1cefcdd CI downloads the engine with the job token; the user path stays anonymous
On 2026-11-08 GitHub had timeouts for unauthenticated users and the gates failed
three times on the engine download, because the jobs called the release API
anonymously (also limited to 60 requests an hour per runner address). The core
uses GITHUB_TOKEN when it is set, so each workflow that runs tests declares it
once at the top. user-install.yml stays anonymous: it is the user's path.

Test: test_ci_downloads_are_authenticated fails on the old workflows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:32:50 +01:00
Federico Elia 3378b8f3e2 Merge pull request #406 from feder-cr/ledger/0.46.4
record 0.46.4 as published
2026-11-08 13:19:11 +01:00
feder-crandClaude Opus 5.5 07a03e41e9 Keyboard: the persona's keyboards are the core's declaration, read here
invisible-core 58.55.0 declares the keyboards with the language and
country (prefs._apply_locale) and owns the pref's name; the session no
longer writes a second copy, and the server imports the name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:10:09 +01:00
feder-crandClaude Opus 5.5 22a098843a 0.47.0: pin invisible-core 58.55.0, the firefox-58 engine (Firefox 159)
The persona's keyboards (the language's and the second one Windows
installs with it, switched with left Alt + left Shift), the engine's own
scrollIntoViewIfNeeded (op_scroll_into_view hands a rect on), and the
engine's fixes for refused navigations, held requests and cookies.
test_frame_dispatch's hand-built InjectedScript gets the condition the
core's __init__ now makes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:03:53 +01:00
feder-crandClaude Opus 5.5 e76c63a6cb e2e: the switch to English is pressed, left Alt and left Shift, before KeyX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:58:15 +01:00
feder-crandClaude Opus 5.5 caae1ea0aa Keyboard: the persona's keyboards, the language's and the second one Windows installs with it
The server-only keyboard pref carries layouts_for (KLIDs joined by
commas, the language's first), so a Russian or Greek persona types a
Latin letter on English (US) with its key events instead of answering
press("x") with "unknown key: 'x'". Needs the core with layouts_for.

The four keyboard e2e tests name the US keyboard (locale="en-US"): the
persona's keyboard follows the session's language, which the runner's
address decides, and run 42453174270 met a non-Latin one. New e2e: a
Russian persona presses x as KeyX, a Greek one types "cafe" with its
keys, a Nepali (India) one, whose Windows has no Latin keyboard, gets
the letter inserted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:58:15 +01:00
feder-cr acb073dda7 record 0.46.4 as published 2026-11-08 11:55:48 +00:00
Federico Elia 081b3a1aa0 Merge pull request #404 from feder-cr/release/0.46.4
0.46.4: pin invisible-core 57.54.0, release files through the API route first
2026-11-08 12:25:27 +01:00
feder-crandClaude Opus 5.5 9460e8eb86 0.46.4: pin invisible-core 57.54.0, release files through the API route first
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 11:57:06 +01:00
Federico Elia 3abd710393 Merge pull request #401 from feder-cr/counters-on-actions
Launch counter: the daily snapshot and the badges run on GitHub Actions
2026-11-08 10:17:04 +01:00
github-actions[bot]andfeder-cr 80034c9c84 record 0.46.3 as published (#403)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-11-08 09:52:15 +01:00
Federico Elia 820d88e8eb Merge pull request #402 from feder-cr/engine/firefox-57
0.46.3: pin invisible-core 57.53.0, the firefox-57 engine (Firefox 159)
2026-11-08 09:16:52 +01:00
feder-crandClaude Opus 5.5 558a402fa9 0.46.3: pin invisible-core 57.53.0, the firefox-57 engine (Firefox 159)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 08:59:58 +01:00
feder-crandClaude Opus 5.5 2b3cbe0795 Launch counter: the daily snapshot and the badges run on GitHub Actions
GitHub keeps only the running total of the counter asset, so a day's launches
exist only if the total is recorded that day. The snapshot ran from a scheduled
task on one PC with a token file beside it; when that task went, the badge
stopped on 2026-11-04 and the days after it were never recorded.

counters.yml runs every day at 00:10 UTC on the built-in token, appends the
counters to counters/history.csv on the badges branch, derives
counters/launches_daily.csv, and redraws launches.svg and stars.svg with the
same sum and the same bytes as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 07:03:26 +01:00
Federico Elia 3dd1424a0a Merge pull request #400 from feder-cr/host-gate-goto-timeout
Host gate: the navigation has the page's budget, not goto's default 30 s
2026-11-07 22:46:50 +01:00
feder-crandClaude Opus 5.5 5847dfe87a Host gate: the navigation has the page's budget, not goto's default 30 s
Candidate 42410156024 failed the Windows host gate on its first visit: the
page reached domcontentloaded but not load within goto's default 30 s on a
cold GitHub runner, while the wait right after it has 180 s. The same binary
passed 6/6 locally. goto now takes timeout_ms like the wait.

Test: test_the_navigation_has_the_page_s_budget_not_goto_s_default (fails on
the previous script).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 22:31:31 +01:00
Federico Elia 622b6e82a7 Merge pull request #399 from feder-cr/enumeration-test-inside-engine
e2e: the enumeration's host check reads the engine's log, not a clock beside a loaded runner
2026-11-07 21:33:00 +01:00
feder-crandClaude Opus 5.5 4355274838 e2e: the enumeration's host check reads the engine's log, not a clock beside a loaded runner
The upper bound ("nothing on top of the declared time") compared the page's
clock against a runner whose load delays the parent's main thread by 150-200
ms; it failed twice on 2026-11-07 (741 and 702 against 543 + 143), green on
rerun. The load-proof checks stay (the first call waits at least the declared
time, the second is fast). Whether the host's speakers were asked is now read
from inside the engine: with MOZ_LOG=StealthMediaEnumeration:4 the engine
logs the declared wait it dispatched and "host speakers asked: yes|no"
(firefox_antidetect_patch a00ba45). That test runs from firefox-57.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 21:17:49 +01:00
Federico Elia 97f8663ec6 Merge pull request #398 from feder-cr/ledger/0.46.2
record 0.46.2 as published
2026-11-07 20:49:11 +01:00
feder-cr ce68aea668 record 0.46.2 as published 2026-11-07 19:16:16 +00:00
Federico Elia dab71bd637 Merge pull request #397 from feder-cr/keyboard-country
0.46.2: the persona's keyboard from its language and country (core 56.53.0)
2026-11-07 20:01:47 +01:00
feder-crandClaude Opus 5.5 0c043d580e test: take the profile generator from the core's public API, not the _fpforge shim
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 19:46:23 +01:00
Federico Elia 0421f95adf Merge pull request #396 from feder-cr/ledger/0.46.1
record 0.46.1 as published
2026-11-07 19:40:21 +01:00
feder-cr 284a840ebe record 0.46.1 as published 2026-11-07 18:24:35 +00:00
feder-crandClaude Opus 5.5 eb8b415635 0.46.2: the persona's keyboard from its language and country (core 56.53.0)
The session decides the keyboard with the core (keyboard.layout_for on
SessionLocale.languages and .region) and hands it to the server in a
server-only pref (invisible.server.keyboard_layout), taken out before the
profile is written; without it the language alone decides. German in
Switzerland now types on the Swiss keyboard. Pins invisible-core 56.53.0.

Test: tests/test_the_keyboard_follows_the_session_language.py (KLIDs, and
the language-and-country case).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 19:14:21 +01:00
Federico Elia e508c10e9d Merge pull request #395 from feder-cr/fix-pyproject-driver-comment
0.46.1: pin core 56.52.0 (typing hand by key); pyproject comment names the real server
2026-11-07 19:08:09 +01:00
feder-crandClaude Opus 5.5 7a4e7c4d0a 0.46.1: pin invisible-core 56.52.0 (typing hand by key)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 18:40:29 +01:00
feder-crandClaude Opus 5.5 3824a2e03e pyproject: the dependency comment names the server that exists, not a Node driver
The comment said the Node driver lives in src/invisible_playwright/_driver/,
which does not exist; the server is _juggler/. Test: every src path the
pyproject names is a folder of this tree (fails on the previous comment).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 18:22:10 +01:00
Federico Elia fb5c3a403c Merge pull request #394 from feder-cr/ledger/0.46.0
record 0.46.0 as published
2026-11-07 14:13:08 +01:00
feder-cr eb2be0e88d record 0.46.0 as published 2026-11-07 12:56:39 +00:00
Federico Elia 621a396def Merge pull request #391 from feder-cr/remove-font-gate
0.46.0: dialogs answered after a reader's pause, the persona's keyboard, the WebGL test; the font gate removed
2026-11-07 13:42:30 +01:00
feder-crandClaude Fable 5.1 2afb1cc349 The dialog's answer always goes out: the seed is the browser's, and a failed plan is a warning
0.46.0's first CI run hung three e2e tests for 30 s: the pause read the
session seed from the transport (`self.server`) instead of the browser
(`self.browser.session_seed`), the AttributeError swallowed Page.handleDialog,
and the open dialog blocked every evaluate on the page. The unit test had
mirrored the wrong path; it now models the real one (server knows no seed,
the page reaches the browser through its context), fails on the previous
server, and a new case proves the answer goes out even when planning raises.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-07 13:12:57 +01:00
feder-crandClaude Fable 5.1 b0dc24031c 0.46.0: pin invisible-core 56.51.0, the firefox-56 engine (Firefox 159)
The engine carries the WebGL declared-extension hooks (a declared extension
can be called without killing the browser); this version adds the reader's
pause on dialogs, the persona's keyboard by language, and the WebGL e2e test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-07 12:39:42 +01:00
feder-crandClaude Fable 5.1 d87cc4e3b6 The persona's keyboard follows the language the launcher decided
The server reads `intl.accept_languages` from the launch prefs and hands the
matching layout (invisible_core.juggler.keyboard.layout_for) to every page's
hands: an Italian persona types on an Italian keyboard. Until now every session
typed on one US table with Chromium's key codes. Pins invisible-core 55.51.0,
which carries the tables and the keyboard.

Test: tests/test_the_keyboard_follows_the_session_language.py.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-07 08:53:46 +01:00
feder-crandClaude Fable 5.1 8eb28c2ada Test: a WebGL extension the persona declares can be called without killing the browser
Read with symbols on 2026-11-07 (Linux, firefox-55): one provokingVertexWEBGL()
call on an extension the host had refused by policy hit MOZ_RELEASE_ASSERT and
took the main process down. The hooks ship in the engine (firefox_antidetect_patch
14feb6a, fingerprint/webgl/parameters); this test calls the six entry points on
both context kinds and asks the page a question after. Skipped on engines before
firefox-56, where it would not fail but kill the browser.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-07 08:33:02 +01:00
feder-crandClaude Fable 5.1 09eeb004d1 Answer a dialog after a reader's pause, not in the millisecond it opened
Page.handleDialog left as soon as Page.dialogOpened arrived, whoever
answered: the client's auto-dismiss or a handler's accept(). A page timing
alert()'s return saw single-digit milliseconds. The pause is drawn from the
session's seed and the dialog's text (reaction + per-word reading, clamped,
one draw per dialog); only the remainder is waited, in the worker; no seed
means no pause, as for every other rhythm.

Test fails on the previous server (two cases: the answer did not wait, and
two dialogs of a page took the same zero time) and passes on this one.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-07 07:58:03 +01:00
feder-crandClaude Opus 5.5 632490aa50 CI: remove the font gate, the host gate covers the font list
scripts/ci_font_gate.py asked one case (is the font list the persona's?) of
the host gate's question (is anything a page reads the host's?). It was kept
until the host gate ran green on a release: it did on firefox-55. The engine's
gate.yml no longer runs it (firefox_antidetect_patch 709404e).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 19:43:58 +01:00
Federico Elia 6c0cfdb610 Merge pull request #390 from feder-cr/drop-linux-arm64
Linux arm64 is no longer supported from firefox-56
2026-11-04 17:17:58 +01:00
feder-crandClaude Opus 5.5 9a98c0060b Linux arm64 is no longer supported from firefox-56
No engine is built for it from firefox-56 on; firefox-55 is the last one
with a Linux arm64 build. The README, the installation page, the arm64
guide, CONTRIBUTING and the release notes now name Linux x86_64 and Windows
x86_64 only, and the README says Linux arm64 is no longer supported. The
host gate drops its arm64-only known defects. The README check treats
linux-arm64 as retired, like macOS, and a new test fails on a page that
still lists it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 14:58:08 +01:00
Federico Elia 4b9e28a879 Merge pull request #389 from feder-cr/ledger/0.45.0
record 0.45.0 as published
2026-11-04 05:49:01 +01:00
feder-cr 6383f21dbb record 0.45.0 as published 2026-11-04 04:34:26 +00:00
Federico Elia 6080c06bd9 Merge pull request #388 from feder-cr/engine/firefox-55
0.45.0: invisible-core 55.50.0, the firefox-55 engine
2026-11-04 05:20:08 +01:00
feder-crandClaude Opus 5.5 ae947139d8 e2e: the tests that start the engine without the core bring the first-run declaration
Since firefox-55 the engine leaves Mozilla's first-run lines and the core declares
them. These two tests start the engine directly, so a second tab failed
Browser.newPage ("Unexpected number of tabs in the new window: 2"), run 41769630744.
The values come from the core, so they cannot drift.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 05:04:24 +01:00
feder-crandClaude Opus 5.5 e1f1659776 0.45.0: pin invisible-core 55.50.0, the firefox-55 engine (Firefox 159)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 04:49:31 +01:00
feder-crandClaude Opus 5.5 02bd688896 Host gate: WebGPU's null on linux-arm64 is that leg's known defect
The leg ships without our Vulkan driver, so requestAdapter answers null there
by design, never the host's driver; arm64 is not a priority. Scoped to that
leg: on Windows and linux-x86_64 the adapter stays held to retail. Run
41402916724's dumps compare with 0 failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 14:46:48 +01:00
feder-crandClaude Opus 5.5 c6dca80401 Tests follow invisible-core's gfx contract: no webgl.force-enabled, gpu.device not pinnable
The core dropped webgl.force-enabled (the engine answers the blocklist from
zoom.stealth.gfx.feature_status, WEBGL2 = 1) and its GPU profile gained
`device`, the real GPU drawn from the renderer's bucket. The renderer is the
knob; the device follows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 13:39:54 +07:00
feder-crandClaude Opus 5.5 f03164e7e0 Drive gate: the first run is declared in the profile, as the core declares it
Since firefox-55 the engine leaves Mozilla's first-run lines and invisible-core
declares the state (terms of use accepted, pre-onboarding off). The drive gate
runs upstream Playwright only, whose defaults travel in Browser.enable, which
the engine refuses, so nothing declared it. Run 41388672849: Windows showed the
terms-of-use modal (no mouse event reached the page), Linux opened Mozilla's
privacy page in a second tab ("Unexpected number of tabs in the new window").

FIRST_RUN, a copy of the core's three prefs, goes into user.js and the gate
drives a persistent context, as the font gate does. On that run's packages:
Windows --click and --full OK, Linux --click and --full OK.
tests/test_ci_drive_gate_first_run.py ties the copy to the core (fails on the
previous gate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 13:39:54 +07:00
feder-crandClaude Opus 5.5 0236afb11d Host gate: each visit pins its DPR in the persona
Every (dpr, seed) visit forced layout.css.devPixelsPerPx over whatever
persona the seed drew. A 100% persona at 1.5 read innerWidth 1920 inside an
outerWidth of 1291, and a 150% persona at 1.0 an outerWidth of 1942 on a
1280 screen (run 41325657085): identities no machine has. The DPR is now
pinned (screen.dpr), so the core declares a screen, work area and window
made at that scale; the engine refuses a scale that contradicts them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 01:01:54 +07:00
feder-crandClaude Opus 5.5 af932640b8 Host gate reference: retail 159 in fullscreen and back
state.normal, state.fullscreen and state.after_fullscreen measured on the
official Firefox 159 for Windows at DPR 1.0 and 1.5: headed, a profile past
the first-run onboarding (which otherwise keeps focus and input away from
the page), real OS-level input for the fullscreen gesture. Every invariant
of the gate holds on retail. Only state.* keys are added; no existing value
changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 23:11:47 +07:00
feder-crandClaude Opus 5.5 fd22249b65 Host gate: the window in fullscreen and back, held to invariants
A defect escaped every check: after requestFullscreen() the engine kept
declaring the maximized window (outer 1936x1048 under a 1920x1080 viewport,
screenX/Y -8/-8, mozInnerScreenY and every mouse event's screenY - clientY
at 85 instead of 0). No visit entered fullscreen, since it needs a user
gesture, and every value was checked alone against retail, never against
the others.

The dump now drives each visit through three states with real input
(drive_states): normal, fullscreen entered by a Playwright click on a page
button whose handler calls requestFullscreen(), and back through
exitFullscreen(). Each state records the window and screen geometry,
display-mode, fullscreenElement, window.fullScreen and the screen - client
offsets of real mouse events, under state.normal, state.fullscreen and
state.after_fullscreen. A transition that ends in a timeout or
fullscreenerror is recorded, never waited on.

compare() holds every leg and every visit to INVARIANTS, one table with
the reason of each: outer holds inner; in fullscreen outer == inner ==
screen, screenX/Y and mozInnerScreenX/Y at 0, display-mode and
fullscreenElement set; outside it neither; every event's screen - client
equals mozInnerScreenX/Y (exact, or within 1 px when mozInnerScreen is
fractional); the screen does not change; the return restores the normal
state. No exception and no reference applies to them.

The retail reference has no state.* yet: until it records them, those
values are held to host-independence and the invariants only, and compare
notes it. REFERENCE_PENDING says what the reference session must add.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 22:07:31 +07:00
feder-crandClaude Opus 5.5 c84c8c32a5 Host gate: the textarea is fixed, arm64-only differences are scoped to arm64
The textarea width at fractional DPRs now matches Windows on Linux (engine:
DirectWrite's average character width on FreeType), and the gate reported
the exception as no longer seen. The differences left on linux-arm64 only
(Skia's NEON composite, pattern and shadow; the offline audio FFT) are known
defects of that leg, which is not a priority. Run 41305135645's dumps
compare with 0 failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:42:58 +07:00
feder-crandClaude Opus 5.5 a5ad308e4a Host gate: the page tells why a host has no WebGL2 or MSAA, never compared
The Windows runner answers getContext('webgl2') with null and gives WebGL1
no multisampling; Linux does not. The page now records under diag.webgl,
for webgl and webgl2, with and without failIfMajorPerformanceCaveat:
whether getContext returned null, the statusMessage of every
webglcontextcreationerror (listener on a fresh canvas before getContext),
the context attributes, VENDOR/RENDERER/VERSION/SHADING_LANGUAGE_VERSION,
the unmasked pair when exposed, SAMPLES, SAMPLE_BUFFERS and MAX_SAMPLES.
The block runs last, and each context is lost once read.

diag. keys are information: the legs legitimately differ on them and the
retail reference does not record them. compare() skips the prefix by name
(documented in the module docstring); dump() prints the leg's diag values
into the job log (all on the first visit, then only what changed), so a
run says why without downloading its artifacts.

Tests: diag keys differing per leg and per seed and absent from retail do
not fail; a known defect matched only by a diag key is still reported as
no longer seen; only the exact prefix is skipped; a non-diag key missing
on one leg still fails host and retail; the dump's diag report.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 10:56:42 +07:00
feder-crandClaude Opus 5.5 c30e07ee9f Merge host-gate: the host gate runs on the next engine's candidates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:04:13 +07:00
feder-crandClaude Opus 5.5 85cc5d10e6 Host gate: measured like the reference, compared leaf by leaf, identity declared
The dump visits the page the way retail's reference was taken: over
http://127.0.0.1, en-US, the zone the reference reported, the DPR through
layout.css.devPixelsPerPx, no drawn cursor. The reference is retail Firefox
159.0 for Windows at DPR 1 and 1.5 (gzipped, 1.2 MB).

Values are compared leaf by leaf, so a field the identity decides does not
hide a wrong field of the same object, and the values the identity decides
are declared: with a few seeds, 16 cores or a 1920x1080 screen repeat by
chance. exceptions.json: identity, measurement (focus on the hidden desktop
retail ran on) and the known defects with the work that closes each.

On the 0.44.1 dumps of Windows and Linux it fails exactly the defects the
next candidate fixes (invalid WebGL enums, stencil masks, MAX_VIEWS_OVR, the
WebGPU adapter and importExternalTexture from the host, -moz-dialog), and
nothing else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:04:06 +07:00
feder-crandClaude Opus 5.5 7c23e4377d The host gate: what a page reads depends on the identity and Firefox, never the host
One rule, two properties, checked on whole API dumps rather than a list of keys:
the same identity on different hosts gives the same bytes (each leg against
the Windows leg, the platform the identity claims), and a value that does not
depend on the identity equals retail Firefox for Windows at the same DPR.
Which values depend on the identity is measured, not listed: three seeds per
DPR, and a value that changes with the seed is held to host-independence only.

The exceptions are three kinds with a reason each (noise that differs between
two retail launches, network-derived values, known open defects), and the
known-defect list only shrinks: an entry that hides nothing any more fails.

The comparison is here with its tests (tests/test_ci_host_gate.py, 8 cases on
synthetic dumps). The page, the retail reference and the CI wiring follow; the
gate then replaces ci_font_gate.py, which checks one surface of the same rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:31:37 +07:00
feder-crandClaude Opus 5.5 0418f37dbb Pin invisible-core 54.50.0 for the next engine's candidates
The candidate of the engine that declares the WebGPU adapter is gated with
the core branch that declares it (fix/codec-follows-gpu, 54.50.0). Not for
release as is: the version and the CHANGELOG follow when the engine does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:02:59 +07:00
Federico Elia 0dc42b6380 Merge pull request #386 from feder-cr/ledger/0.44.1
record 0.44.1 as published
2026-10-31 10:21:03 +07:00
feder-cr f4381155bd record 0.44.1 as published 2026-10-31 03:17:49 +00:00
Federico Elia bec6e5f835 Merge pull request #385 from feder-cr/fix/core-54.49.0
Pin invisible-core 54.49.0: WebRTC decodingInfo no longer reads the host GPU (0.44.1)
2026-10-31 10:00:31 +07:00
feder-crandClaude Opus 5.5 d9dca5b498 Pin invisible-core 54.49.0: WebRTC decodingInfo no longer reads the host GPU
invisible-core 54.49.0 declares VP8, VP9 and AV1 for the WebRTC branch of
decodingInfo, so powerEfficient is Firefox 159 for Windows's answer instead of
the host's hardware decoding. Same engine, firefox-54. Version 0.44.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 09:41:57 +07:00
Federico Elia 469e1692a7 Merge pull request #384 from feder-cr/ledger/0.44.0
record 0.44.0 as published
2026-10-31 08:29:45 +07:00
feder-cr 44a3eed971 record 0.44.0 as published 2026-10-31 01:17:58 +00:00
Federico Elia 77b192eba5 Merge pull request #383 from feder-cr/engine/firefox-159
firefox-54: Firefox 159, downloads, set_offline, scroll only when needed
2026-10-31 06:28:42 +07:00
feder-crandClaude Opus 5.5 49e4e3a133 The scroll test asserts the core's if-needed scroll, not the old centring
Core 54.48.0 (3735356) leaves an element in full view where it is and
centres only one that is not, as Chromium's scrollIntoViewIfNeeded does: the
helper runs before every click, and a click on a visible button used to move
the page under it. This test still asserted the old always-centre behaviour,
so the e2e suite went red on the 54.48.0 pin.

It now checks both halves on a page where the two behaviours differ: an
element low in the viewport but in full view leaves scrollY at 0 (red on the
old helper, which centred it), and one cut by the bottom edge is scrolled to
the centre of the viewport.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 06:14:15 +07:00
feder-crandClaude Opus 5.5 4a0bd76768 Show the engine's Firefox 159.0 on the README badge
The seal pinned by invisible_core 54.48.0 is upstream 159.0; the badge
and its alt text still said 151.0, which test_readme_claims catches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 05:55:26 +07:00
feder-crandClaude Opus 5.5 6de45423d1 0.44.0: pin invisible-core 54.48.0, the firefox-54 engine (Firefox 159)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 19:52:21 +07:00
feder-crandClaude Opus 5.5 20f8a43693 Send download options and surface downloads (Artifact/Stream, download event)
The Python server never sent Browser.setDownloadOptions, so the engine's
download interceptor stayed off: no download event, no saved file, and a goto
or click that ended in a download waited out its timeout. Contexts now get
download options at creation (accept -> saveToDisk, deny -> cancel) into a
per-session temp dir removed at shutdown. Browser.downloadCreated/Finished
become a page 'download' event with Artifact and Stream channel objects
(pathAfterFinished, saveAs, saveAsStream, stream, failure, cancel, delete).
The engine ends a navigation that became a download with no event, so the
lifecycle is fed an abort "Download is starting", as upstream's server does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 19:33:26 +07:00
feder-crandClaude Opus 5.5 00d8154ef8 e2e: a download is reported, saved, and ends the navigation that led to it
The engine registered Juggler's download interceptor and never called it, so no
downloadCreated or downloadFinished reached Playwright and a goto that ended in
a download hung. Two cases: a clicked attachment reaches expect_download and is
saved with its bytes; a goto to an attachment reports the download and ends.
Red on the 157/159 engines before the interceptor is dispatched (both time
out), to go green with the engine fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 17:05:02 +07:00
feder-crandClaude Opus 5.5 12d1cc7308 e2e: a click on an element in full view does not scroll the page
The core's scroll_into_view centred every time, so every click moved the page.
Three cases from scrollY 1000: an element in full view and one inside a
same-origin iframe stay where they are (red on the previous core); one below
the fold is centred.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 14:36:39 +07:00
feder-crandClaude Opus 5.5 2e1b91b196 set_offline() sends Juggler's Browser.setOnlineOverride instead of refusing
The refusal said the engine had no offline command. It has one (new_context(offline=True) already sent it); what was missing was the engine honouring it: its HTTP channel asked a stub that always answered online. The engine now runs Mozilla's own code there (firefox_antidetect_patch 3087f02c56), so set_offline(True/False) maps to the override and leaves NO_ENGINE_COMMAND. tests/test_set_offline_e2e.py fails on an engine with the stub (the offline goto loads) and on a server that still refuses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:18:29 +07:00
feder-crandClaude Opus 5.5 c11c04b30e The page sends a commit's navigated from the lifecycle's announcement, not from its own listener
Sent from `_on_juggler_event`, the `navigated` of a commit raced the answer of a wait the same commit ended: the lifecycle, which runs first, had already woken it. With click() now waiting for the commit of the navigation it planned, `page.click("#next")` returned with `page.url` on the page it had left (tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py, red on the 07cbaa9cea engine before this). The commit now goes up from `_on_lifecycle`, as `sameDocument` already did, and not once the page is closed (what `_deliver` guaranteed before). The unit doubles reach it the way the page does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 06:05:21 +07:00
feder-crandClaude Opus 5.5 29a5c7a516 click and press wait for the navigation they set off unless no_wait_after, as Playwright's do
From Firefox 157 a form submission is a planned navigation (the retail's dom.forms.submit_async_navigation): page.click() on a submit button returned 7 ms before the POST was announced, so a script that clicked and read its requests or URL saw the page it had left; 151 and Microsoft's client both had it. FrameDispatcher._waiting_after runs Playwright's waitForSignalsCreatedBy around click and press (not dblclick, tap, hover or check, as there), on invisible_core's Lifecycle.wait_for_action_signals, which the engine's Page.linkClicked now feeds.

tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py fails on a 157 engine without it (the click returned before its form's request) and checks no_wait_after still returns at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 03:26:04 +07:00
Federico Elia 00ad6d702f Merge pull request #382 from feder-cr/ledger/0.43.0
record 0.43.0 as published
2026-10-25 06:40:12 +07:00
feder-cr 9fb0f20dbc record 0.43.0 as published 2026-10-24 23:18:49 +00:00
Federico Elia 254b2dce1d Merge pull request #381 from feder-cr/engine/firefox-53
firefox-53: the font gate checks the artifact's manifest, e2e for a page that changes process
2026-10-25 06:03:43 +07:00
feder-crandClaude Opus 5.5 2ee9f100bf 0.43.0: pin invisible-core 53.48.0, the firefox-53 engine
Locators keep working after a page that runs in a process of its own sends
itself to one that does not: the engine's context ids are unique for the
session. The exposed fonts are the set of a clean Windows (67 families).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 05:39:50 +07:00
feder-crandClaude Opus 5.5 d5a50275ea Test fixtures name the import error instead of a TypeError
With a core whose version the wrapper's pin did not name, the package was not
importable and firefox_binary answered "argument of type 'NoneType' is not
iterable" (measured 2026-10-25); sample_profile would have answered
"'NoneType' object is not callable". _require_package() exists for this and
neither fixture called it. Both do now, and a test drives both bodies with the
import missing: it fails on the old conftest and passes now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 01:30:25 +07:00
feder-crandClaude Opus 5.5 b02c79f279 e2e: reads on a page in a process of its own, then on the page it sends itself to
A page served with Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy
runs in a process of its own; one read there, and every locator on the page it
sent itself to failed for good with "Cannot find object with id" (measured
2026-10-24 on firefox-52 with 0.42.0, where this test fails). Each round checks
that the first page really was isolated, so it cannot pass for the wrong
reason. Fixed by firefox-53, whose context ids are unique for the session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 01:30:25 +07:00
feder-crandClaude Opus 5.5 4a69d25254 Font gate: the binary declares exactly the clean Windows set, read from its own manifest
EXPECTED loses Leelawadee, Microsoft Uighur, Wingdings 2 and Wingdings 3, the
families the firefox-53 bundle drops because a clean Windows 11 has none of
them.

The gate now asks the allow-list question on the artifact itself: the engine
exposes exactly the families its manifest declares, and that manifest is
fonts/bundle-fonts.list beside the binary (Contents/Resources/fonts on macOS).
The families it declares must be EXPECTED and only those. The page probe can
only find names it asks about, so a family put back into the bundle was
invisible to it unless some list named it; now it is refused with no list
naming it.

Measured 2026-10-25 on real binaries: firefox-52 as published, where the
probe answers "detected 67 families (expected 67)", is refused with the four
families named; a copy carrying the firefox-53 font bundle passes the whole
gate. Unit tests cover exact, extra, missing, the macOS layout and no
manifest at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 01:30:24 +07:00
Federico Elia 7b783cf892 Merge pull request #380 from feder-cr/ledger/0.42.0
record 0.42.0 as published
2026-10-24 19:38:45 +07:00
feder-cr 455f0cf0e1 record 0.42.0 as published 2026-10-24 11:58:36 +00:00
Federico Elia 655d99020a Merge pull request #379 from feder-cr/canvas2d/read-as-drawn
0.42.0: pin invisible-core 52.48.0, a 2D canvas reads back as drawn
2026-10-24 18:41:37 +07:00
feder-cr 4b61bea3fa 0.42.0: pin invisible-core 52.48.0, a 2D canvas reads back as it was drawn 2026-10-24 18:13:30 +07:00
feder-crandClaude Opus 5.5 ffad787af9 A screenshot is measured in device pixels, at the persona's display scale
The core now draws 1920x1080 panels at 125% and 150% as often as the Windows
fleet does (invisible_core #170), and seed 4242 lands on 125%: the screenshot of
an 800x600 viewport is a 1000x750 image, exactly what a real Windows machine at
that scale gives. The tests asserted 1x sizes and pixel positions; they now read
window.devicePixelRatio and scale both, so they also prove the crop is right
when the scale is not 1. Passes at 1.25 (core main) and at 1 (0.41.0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 15:52:43 +07:00
feder-crandClaude Opus 5.5 cc3bce2f58 A 2D canvas reads back as it was drawn, guarded at the e2e gate
The random-pixel test public fingerprinting pages run - 64 random opaque 1x1
fills read back - must come back byte for byte on a page canvas and on an
OffscreenCanvas 2D (invisible 0.41 changed 6 of 64, retail 151 changes 0); an
undrawn canvas reads zero; two seeds declaring the same display scale and
ClearType tuning draw the same text; and a toDataURL PNG on an http page carries
the 16-byte deBG chunk retail 151 writes after IDAT. Against the firefox-51
engine five of these fail, as they should; they pass from firefox-52 with the
core that turns baseline protection on (Linux and Windows, 2026-10-24).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 15:52:43 +07:00
Federico Elia 33940459f7 Merge pull request #377 from feder-cr/ci/publish-one-at-a-time
The publish workflow serialises per repository
2026-10-21 13:36:28 -07:00
feder-cr dc9ff53e78 The publish workflow serialises per repository, so a dispatch on a branch and a push of the tag wait for each other 2026-10-21 22:15:13 +02:00
Federico Elia 4ad30e5079 Merge pull request #376 from feder-cr/ci/publish-concurrency
The publish workflow runs one at a time per ref
2026-10-21 07:37:41 -07:00
feder-cr e94863c79d The publish workflow runs one at a time per ref, so two runs of one tag cannot both upload 2026-10-21 16:09:10 +02:00
Federico Elia 151c314c05 Merge pull request #375 from feder-cr/ledger/0.41.0
record 0.41.0 as published
2026-10-21 06:18:38 -07:00
feder-cr 8bbc41162b record 0.41.0 as published 2026-10-21 12:52:37 +00:00
Federico Elia 58fd0c8d93 Merge pull request #374 from feder-cr/feat/core-51.48.0-pin
0.41.0: pin invisible-core 51.48.0, document font.system_text_quality
2026-10-21 04:28:18 -07:00
feder-cr edaf224417 The voices test declares the session it measures
It asserts the voice list measured on retail Windows Firefox for an en-US
session, and it left the locale and the time zone to the egress IP: green on
US runners, red from anywhere else. From Italy the session came out it-IT and
the list began with Microsoft Cosimo, which is right for that session and not
the one measured ([B364]). The session now declares locale en-US and time zone
America/New_York; the expected list and the assertion are unchanged. Measured
from an Italian egress: green on firefox-50 and on the form B engine.
2026-10-21 12:59:29 +02:00
feder-cr 07a55bfc85 A flat WebGL clear reads back exactly, and a realistic render varies per seed
test_high_entropy_webgl_still_noised_per_seed drew 64 scissor-cleared stripes
and asserted their readback differs between two seeds. A clear has no device
variation: the value is the clear colour quantised to 8 bits, the same on
every GPU, so noise on it is a tell a page can read by comparing with what it
cleared. The engine of form B leaves it exact, and the test asserted the tell.

The file now asserts the two things that hold: a triangle with a gradient and
antialiased edges reads back differently for seeds 1 and 2, and a flat clear
in v/255 colours reads back exactly v (an integer v, so no driver rounds it
differently). Measured: retail Firefox 151 reads the stripes exact (0 of 4096
moved); the form B engine passes both; firefox-50 passes the first and fails
the second on every pixel, both seeds.
2026-10-21 12:59:29 +02:00
feder-cr 1bac4b6f8b The required-keys list asks for edge_tolerance, the canvas pref the firefox-51 engine reads, not the retired noise_skip_mask 2026-10-21 12:28:52 +02:00
feder-cr 47dabed289 0.41.0: pin invisible-core 51.48.0, document font.system_text_quality 2026-10-21 12:20:44 +02:00
feder-cr a1312941eb Pin invisible-core==51.48.0 for the firefox-51 coupled release 2026-10-20 13:39:45 +02:00
github-actions[bot] 5b762bab65 record 0.40.0 as published (#373)
The upload succeeded and the ledger could not be pushed to main directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.
2026-10-19 00:36:04 -07:00
Federico Elia 920292760a The version gate installs the build backend it builds with (#372)
`invisible_core.release check --verify-index` builds the package without
isolation to compare it with the ledger, and the gate job installs only the
dev extra, which carries `build` and not `hatchling`. On the first tag that
ran the step (invisible-playwright v0.40.0) it stopped with exit 2, "gate
broken: Backend 'hatchling.build' is not available", and the upload was
skipped. The step installs `build hatchling` first, as the record step does.
2026-10-18 23:50:03 -07:00
Federico Elia 0afe5737fa 0.40.0: pin invisible-core 50.48.0, expect through the injected script, goto on the base URL (#371)
0.40.0 moves the pin to invisible-core 50.48.0, on the same firefox-50 engine, and brings the fixes that waited for it.

expect() reads every condition through the injected script's own expect, as Playwright's server does, instead of a Python rewrite that covered two families; a failed expect now carries its call log and reports an object value as the object (this was #368, renumbered from 0.39.0). page.goto follows the context's base_url, resolved by the engine's URL parser. evaluate, evaluate_handle and wait_for_function run the caller's text as a script and call it when it is a function, with the argument as a protocol value. The vendored client's README says what actually differs from upstream.

The client side of core 50.48.0: user-install runs on the ledger pull request instead of release: published, which never fired, and CI checks that with invisible_core.install_job; the release tests keep out of their venvs every variable the core's library reads; publish.yml checks the version and the ledger against the index before it uploads.

Eight older tests were red on fakes that did not know about the base URL or the new evaluate road; they are updated to check the same contract on the new code, and the seal-floor stub now copies the core modules pin.py imports instead of a hand list. Default suite: 762 passed.
2026-10-18 23:06:24 -07:00
github-actions[bot] 9a1501af7a record 0.39.0 as published (#370)
The upload succeeded and the ledger could not be pushed to main directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.
2026-10-18 14:40:44 -07:00
Federico Elia fb56fde88d 0.39.0: pin invisible-core 50.47.0, the firefox-50 engine (#369)
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 core no longer writes TZ into the browser's environment and drops the IANA-to-POSIX table.

This package stops importing IANA_TO_POSIX_TZ and tz_env and stops passing a zone to the launch environment. The tests of the table go with it, and so does the probe of the guarded import that took those names; a core of any other version is still refused by the pin check before anything is imported from it.
2026-10-18 11:56:14 -07:00
github-actions[bot] 88d3f7a513 record 0.38.0 as published (#367)
The upload succeeded and the ledger could not be pushed to main directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.
2026-10-17 20:20:45 -07:00
Federico Elia 1504d95ed3 0.38.0: pin invisible-core 49.46.0, uv as the way in (#366)
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) are now declared by the persona instead of read from the machine it runs on.

The way in is uv: the README has one complete install block per system, and CI refuses an install instruction that is not uv. A remedy the package prints (a broken pin, an old core) is now the command for the environment it runs in, so a uv venv, which has no pip, is told the uv command.

The guides and the issue template move to uv too, and the release e2e runs the README block as written in a clean home. The tests that build prefs outside a session now declare a timezone, which 49.46.0 asks for.
2026-10-17 13:39:46 -07:00
Federico Elia 9927c974da The firefox-N release body points at the README's install block instead of restating it (#365)
The body of every firefox-N release carried its own `pip install invisible-playwright`, a second copy of the README's install command that nothing kept in step with it. It now links to the README's Install section, so a release always teaches what the README teaches.

scripts/gen_release_notes.py is run by the engine's publish workflow; tests/test_release_notes_install.py checks the body restates no install command and the README has the section it links to. No package change, no version bump.
2026-10-17 16:34:04 +02:00
github-actions[bot]andfeder-cr 632f023b8c record 0.37.0 as published (#364)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-10-17 13:56:39 +02:00
Federico Elia 0dd99b7638 0.37.0: the pin moves to invisible-core 49.44.0, on the firefox-49 engine (#363)
The pin moves to invisible-core 49.44.0, on the firefox-49 engine.

With it: your code's evaluate runs in a world of its own; the favicon no longer reaches routes or events; route.abort() with no code fails like Playwright's; a route that sends a navigation elsewhere lands there; a held request released after interception went off no longer stalls the browser; request.post_data is the body without a route; and the response names its certificate and its service worker.

Measured on the firefox-49 candidate: the full e2e and Playwright's own suite against the recorded reference, no regression. tests/gates/upstream_baseline.json is recorded again with a cause per entry; one correction to its commit message: test_scroll is pinned failed because of a scroll position two worlds read differently after scrollTo, not because of test order.
2026-10-17 13:19:57 +02:00
github-actions[bot]andfeder-cr 0433b18aa7 record 0.36.2 as published (#362)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-10-17 02:28:33 +02:00
Federico Elia b40535b344 0.36.2: the tests that time themselves run alone, and security_details() hands on the certificate (#361)
* response.security_details() hands on the certificate the engine sent

op_security_details answered None for every response, HTTPS included,
which a script reads as "not over TLS". It was written against an engine
that sent securityDetails: null; the engine after firefox-48 reports the
certificate as upstream does, and the response now keeps what the
responseReceived event carried. An engine that still sends null answers
None, as before.

Measured with Playwright's own suite through this client: on firefox-48
with the engine change, test_response_security_details,
test_response_security_details_none_without_https and
test_should_report_if_response_was_from_service_worker pass; on the
published firefox-48 the answers are unchanged.

* The e2e tests that measure time run alone, after the parallel tests

Tests whose verdict is an upper bound on a wall-clock duration ("refused
at once", "returns before the page loads", the device enumeration's
declared time) carry the new wall_clock marker. From invisible-core
48.42.0 the e2e run gives them the machine alone, one browser, after the
last parallel test has ended: four browsers at once cross those bounds
with nothing wrong in the engine. The pin moves to invisible-core 48.42.0.

* The changelog dates 0.36.2 by the day it is uploaded, UTC
2026-10-17 01:47:55 +02:00
github-actions[bot]andfeder-cr 3986b4ccce record 0.36.1 as published (#360)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-10-16 13:23:31 -07:00
Federico Elia bc3d777f59 0.36.1: wait_for_function ends on an element, and evaluate_handle handles work (#359)
* wait_for_function ends when the predicate returns an element

The predicate ran by value and Python judged the serialized result, so a predicate that returns a node, the most common wait there is, never ended: a node serializes to nothing truthy. Each turn is now invisible-core's poll_in_main: one run by reference, judged with js_truthy, and a truthy value is the handle the wait returns. Needs invisible-core 48.42.0.

* A handle of a main-world value runs where the value lives

Every handle evaluate_handle returned was unusable on 0.36.0: text_content, evaluate and json_value failed with 'Cannot find object', because a main-world objectId was made into a utility-world handle and only json_value read the handle's world. FrameDispatcher._handle_from_main is now the one place such a handle is made: a node is adopted into the utility world and its main objectId released, as add_script_tag already did; any other value, primitives included, stays in the main world, where dispose, evaluate, get_property, get_property_list and json_value run. evaluate_handle and wait_for_function both go through it; evaluate_handle reads the whole RemoteObject (invisible-core's evaluate_in_main_remote) to tell a node from anything else. The poll test now pins one run of the caller's code per turn. Needs invisible-core 48.42.0.

* 0.36.1: the pin moves to invisible-core 48.42.0

The core brings js_truthy and poll_in_main, which wait_for_function now
uses, evaluate_in_main_remote, which evaluate_handle uses, and a GeoIP
cache that is never read half-written. The CHANGELOG lists the three under
0.36.1.
2026-10-16 12:54:03 -07:00
github-actions[bot]andfeder-cr 6dd3e5af82 record 0.36.0 as published (#358)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-10-16 10:57:08 -07:00
Federico Elia f7cd0cc378 0.36.0: the pin moves to invisible-core 48.41.0, on the firefox-48 engine (#357)
* A persistent profile stays the same machine across launches

The seed came from secrets.randbits whenever none was passed, so a
profile_dir reopened without seed= showed its cookies on another machine.
It now comes from invisible_core.resolve_session_seed, which reads the
seed the profile recorded, and record_session_seed records it where the
profile directory is created.

* docs: the branding pin, the voices by language and the persistent seed

pinning.md lists branding among the top-level keys and says the voices follow the session's first language; the CHANGELOG says all three under Unreleased.

* docs: the branding pin takes a zip archive, as the engine serves it
2026-10-16 10:09:41 -07:00
Federico Elia 36003250a4 0.35.11: a closed page says nothing, and a close waits for the event being handled (#355)
A page's close and the delivery of its session's events were not serialized, so a late Network.responseReceived could create a Response under a request the client had already dropped with the page, and new_page() or a response listener raised 'dict' object has no attribute '_object'. Every event of a page now goes through PageDispatcher._deliver, under the close's own lock.
2026-10-16 06:02:24 -07:00
Federico Elia 47ee59da22 The enumeration test bounds what the engine does, not how loaded the runner is (#354)
The first enumeration was held within the declared time plus 110 ms and the
second under 50 ms. A CI run with four browsers crossed each once in the
release of 0.35.10 (656 against 543 + 110, then exactly 50), both green again
on the same SHA, and the second one stopped the publish.

The bounds now come from the properties. The declared time is waited, which
load can only add to. The list is kept, so a second call is well under the
declared time that a fresh ask would wait again. And nothing is added on top:
the second call is the same round trip without the wait, so first - second is
the declared time plus whatever the host added, with the load both calls share
cancelled out; the margin is half the smallest time the host's audio stack
used to add (287 ms). Under four browsers at once on Windows, 12 launches out
of 12 hold all three, the difference 8-49 ms over the declared time.
2026-10-15 16:13:24 -07:00
github-actions[bot]andfeder-cr eaa044fef7 record 0.35.10 as published (#353)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-10-15 05:45:54 -07:00
Federico Elia 82565e0c98 0.35.10: the pin moves to invisible-core 47.41.0 (#352)
The engine can live on a read-only disk (INVISIBLE_PLAYWRIGHT_ENGINE_DIR), and
an "auto" timezone that cannot be resolved fails the launch without a proxy
too, instead of falling back to the host's zone in silence.
2026-10-15 05:04:40 -07:00
github-actions[bot]andfeder-cr 3dac7702ba record 0.35.9 as published (#350)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-10-14 18:41:45 -07:00
Federico Elia 48770e590e 0.35.9: the pin moves to invisible-core 47.40.0 (#349)
A connection releases each pipe end once: closing a browser twice no longer
closes the pipe of another browser in the same process.
2026-10-14 18:09:56 -07:00
Federico Elia c1835182ed record 0.35.8 as published (#348)
Records 0.35.8, uploaded by hand on 2026-10-14 at 22:49 UTC on the owner's order to release before the e2e of the merge had finished. A manual upload skips the release tool, so the entry is recorded from the same tag export that was uploaded.
2026-10-14 16:01:40 -07:00
Federico Elia bf9af85830 0.35.8: the pin moves to invisible-core 46.39.0 (firefox-46) (#347)
The pin moves to invisible-core 47.39.0, which seals the firefox-47 engine.

- **A page can no longer tell that the engine carries the automation protocol (invisible_playwright #336).** Every engine until firefox-47 registered the protocol as a chrome package named `juggler`, and a page tells a registered package from an absent one with `new Worker("chrome://juggler/...")`: it returned on our engine and throws on Firefox. Captcha vendors started probing it in October 2026, which is why a challenge solved by hand was still refused. firefox-47 loads the protocol from `resource://gre/modules/juggler/`; of 65 chrome packages and resource substitutions probed from a page, none answers differently from Firefox 151.

- **A goto the page stops on its way no longer answers OK on the old page, nor waits out its timeout.** document.open() and window.stop() in the page being left stop the navigation; the engine dropped every such stop of the main frame, so goto answered OK on the previous page (4 times in 4 on 0.35.7 with the page held 1.5 s) or waited for its timeout. It now raises NS_BINDING_ABORTED at once, as Playwright does on Firefox.
- **Every way a page or the caller can stop or replace a goto is tested**: document.open, window.stop, location.replace and assign, a form submit, an iframe navigating the top, history.back, pushState, a meta refresh, nothing, and a second goto, each in one process and across a process swap, back to back, checked against upstream Playwright 1.63's answers on its own Firefox.
- **goto refuses a success the engine made up**: a commit attributed to its navigation that is not where that navigation's request went raises instead of answering OK.
- A goto the caller's next goto stops is "interrupted by another navigation", as upstream; goto(until="load") counts only its own document's load; the timeout message no longer contradicts itself.
- The wheel is born before the page sees it, as keys and moves are since 0.35.7.

e2e on firefox-46 with core 46.39.0's source: Windows 389 passed, 5 skipped; Linux 390 passed, 4 skipped; no reruns.
2026-10-14 15:40:54 -07:00
github-actions[bot] a61169c830 record 0.35.7 as published (#346)
The upload succeeded and the ledger could not be pushed to main directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.
2026-10-13 13:31:36 -07:00
Federico 1839425da6 0.35.7: the pin moves to invisible-core 45.39.0 (firefox-45) (#345)
The pin moves to invisible-core 45.39.0, which seals the firefox-45 engine.

- **A key or a mouse move is born before the page sees it.** The engine stamped every input event at the instant it reached the page, so `event.timeStamp` equalled `performance.now()` in the handler, and a script that keeps only the events with `timeStamp < now` dropped most of our keys. Each event is now born a few milliseconds earlier, drawn per event from the session. The new e2e test checks every key and mouse move in the handler; measured on firefox-45, all of them arrive 4 to 22 ms after they were born, where retail Firefox with a real keyboard and mouse is at 3 to 18.
- **The first `enumerateDevices()` of a session takes the same time on Windows and on Linux**, a time the seed fixes between 240 and 640 ms, instead of the host's audio stack time (15 to 40 ms on Linux). The device list is unchanged. The new e2e test reads the declared time from the core's profile.

e2e on firefox-45 with core 45.39.0's source: Windows 378 passed, 5 skipped; Linux 379 passed, 4 skipped; no reruns.
2026-10-13 13:06:23 -07:00
github-actions[bot] 2aa4292458 record 0.35.6 as published (#344)
The upload succeeded and the ledger could not be pushed to main directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.
2026-10-13 10:48:18 -07:00
Federico 102913d5bf 0.35.6: the pin moves to invisible-core 44.39.0 (firefox-44) (#343)
The pin moves to invisible-core 44.39.0, which seals the firefox-44 engine.

- **Stopping a screencast no longer freezes the browser on Windows.** The engine stopped its window capture on the thread that owns the window while the capture was waiting for that thread to draw it. The new e2e test starts and stops a screencast fifty times at the rates the API is asked for; one browser froze at the ninth stop on firefox-43, and a probe of the same thing ran 1200 stops out of 1200 on firefox-44.
- **Text with a character the US layout has no key for is typed**: `page.type("#i", "café")`, `locator.type` and `keyboard.type` raised. The keys that exist are pressed and the character is inserted in its place, as Playwright does.
- **On Linux, the line endings a page reads are Windows'** (`Blob` / `File` with `endings: "native"`, and the text of a selection across two blocks).
- **`speechSynthesis.getVoices()` is Windows' list**, in its order, none of them the default.
- `scripts/run_e2e.py` is now the entry to the core's single e2e runner: a worker that dies at its deadline ends the run red, with the test's name and every thread's stack on the log, instead of waiting forever.

e2e on firefox-44 with core 44.39.0: Windows 376 passed, 5 skipped; Linux 377 passed, 4 skipped; no reruns.
2026-10-13 10:17:22 -07:00
github-actions[bot] 49e4d73de2 record 0.35.5 as published (#342)
The upload succeeded and the ledger could not be pushed to main directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.
2026-10-13 03:29:09 -07:00
Federico 857de63b48 0.35.5: firefox-43 (invisible-core 43.39.0) (#341)
The pin moves to invisible-core 43.39.0, which seals the firefox-43 engine.

- **A page's frames stay in `page.frames` after a few navigations in one tab.** The engine reported the iframes of the page being loaded as detached once the back-forward cache let an older page of the tab go, so `page.frames` missed them and a `frame_locator` into them waited until its timeout. The new e2e test (five pages in a row, then a page with nested frames) fails on firefox-42 with no child frames and passes on firefox-43 with all three.
- **On Linux, AAC is answered as on Windows** (the declaration is in the core): `canPlayType` and `MediaSource.isTypeSupported` for audio/mp4, audio/aac, audio/x-m4a and video/mp4 with mp4a.40.2 used to drop to "" after about 300 ms on a host without its own AAC decoder.

e2e on firefox-43 with core 43.39.0: Windows 373 passed, 5 skipped; Linux 374 passed, 4 skipped; no reruns.
2026-10-13 02:59:07 -07:00
github-actions[bot] 70285c5bc3 record 0.35.4 as published (#340)
The upload succeeded and the ledger could not be pushed to main directly: branch protection declines this token, which has no bypass. Merging this keeps the next release from being refused over a missing entry.
2026-10-13 01:34:51 -07:00
Federico be0620f2ee 0.35.4: firefox-42 (invisible-core 42.39.0) (#339)
The pin moves to invisible-core 42.39.0, which seals the firefox-42 engine.

What users get from it:

- A page that navigates or reloads itself no longer loses its main world now and then (a read in the page's world used to wait 30 s and fail).
- A session keeps the focus when another one starts beside it. Two sessions on one hidden Windows desktop: the first lost the focus in 4 runs of 6 before, 0 of 6 now.
- In a visible session the real cursor moving over the window can no longer turn a click on a link into a native drag.
- `evaluate` of a function that rejects with a plain object or an Event raises instead of answering `None`.

On the firefox-42 build with this branch and core 42.39.0: e2e Windows 372 passed, 5 skipped, no reruns; Linux 373 passed, 4 skipped in four full runs of five, the fifth with one drag test that saw a native pointer move from the hidden display (it passed 16 times alone and is tracked on its own).
2026-10-13 01:07:01 -07:00
github-actions[bot]andfeder-cr 91ea73bb54 record 0.35.3 as published (#338)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-10-13 06:28:49 +02:00
Federico 7d86ba00bd 0.35.3: go_back and go_forward to a same-document entry answer None at once, and the test servers are threaded (#337)
go_back and go_forward to a same-document entry (a hash, a pushState) waited
for a navigation id that a same-document navigation never has, and raised
TimeoutError at the timeout. Measured on 0.35.2: 8.0 s for
go_back(timeout=8000). Playwright answers null at once. _history now takes
Lifecycle.mark before the command (invisible-core 41.39.0), which also counts
same-document navigations.

The e2e of tests/test_navigation_response.py had left this arm out on the
word of B185, which said the engine answered Page.goBack and then did nothing.
B185 was closed a month ago and the comment stayed. The arm is back, with
go_back and go_forward on a hash entry.

The core no longer gives a protocol command a 10 s bound of its own: inside an
action it waits for what is left of the action's timeout.

Tests: 35 single-threaded servers in 18 files are now tests/_servers.py's
LocalServer, threaded with daemon threads. A connection the browser opened and
left could hold a single-threaded server's only thread, and shutdown() with
it. That is a candidate for the Windows e2e worker that stopped for 420 s on
the screencast test.

The pin moves to invisible-core 41.39.0.

Two fixes to the test servers' conversion came after: the import of LocalServer in test_detectors_e2e.py had landed in its docstring, and LocalServer gives server_name and server_port as HTTPServer does.
2026-10-13 05:44:32 +02:00
github-actions[bot]andfeder-cr a279231512 record 0.35.2 as published (#335)
Co-authored-by: feder-cr <85809106+feder-cr@users.noreply.github.com>
2026-10-13 00:37:29 +02:00
217 changed files with 35946 additions and 2102 deletions

No files matched your search

+1 -1
View File
@@ -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
+76
View File
@@ -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
+8
View File
@@ -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 }})
+8
View File
@@ -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
+33
View File
@@ -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
+68 -1
View File
@@ -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
+25 -11
View File
@@ -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'
+8
View File
@@ -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
+683
View File
@@ -6,6 +6,689 @@ 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.
### Fixed
- **`response.security_details()` hands on the certificate the engine sent.**
It answered `None` for every response, HTTPS included, which a script reads
as "not over TLS". The response now keeps what the engine reported; an
engine that reports nothing (firefox-48 and earlier) still answers `None`.
- **The e2e tests that measure time run alone.** Eight of them assert an
upper bound on a wall-clock duration, and beside four browsers the device
enumeration one went red on a rerun-clean SHA three times. They carry the
new `wall_clock` marker, and the core's e2e run gives them the machine alone
after the parallel tests.
## [0.36.1] - 2026-10-16
The pin moves to invisible-core 48.42.0, on the same firefox-48 engine.
### Fixed
- **`wait_for_function` ends when the predicate returns an element.**
`wait_for_function("() => document.querySelector('#x')")` timed out although
the element existed: the predicate ran by value and the result was judged
after serialization, where a node is nothing truthy. It is now judged as
JavaScript judges it, from one run of the predicate, and the element is the
handle the wait returns.
- **A handle from `evaluate_handle` can be used.** Its `text_content`,
`evaluate` and `json_value` all failed with "Cannot find object": the value
was made in the page's own world and the handle looked for it in the
automation's. A node is now carried into the automation's world, as the
handles of `add_script_tag` already were, and any other value's handle
runs its operations where the value lives. The same goes for the handle
`wait_for_function` returns.
- **A GeoIP database being downloaded is never read half-written.** Two
sessions starting together on a cold cache could have one open the database
while the other was still writing it, and fail with "Is this a valid MaxMind
DB file?". The core now extracts it outside the cache, checks it with the
real reader and moves it into place in one step (invisible-core 48.42.0).
## [0.36.0] - 2026-10-16
The pin moves to invisible-core 48.41.0, on the firefox-48 engine. 0.35.11 was
never published: its fix is listed here.
### Added
- **The branding a page reads is a profile field.** `pin={"branding": ...}`
takes `"official"` (the default, the retail Firefox's files), `"unofficial"`,
or the absolute path of a zip archive of your own with the same 16 files at
its root. The engine serves the declared files at `chrome://branding/content/`
and `resource://usercontext-content/branding/` instead of its own, from inside
the archive as Firefox serves its own branding. Needs firefox-48.
### Changed
- **The speechSynthesis voices follow the session's language.** An it-IT session
lists the voices of a Windows with Italian added instead of only the American
ones; a language without a measured set keeps the English one, and a
`hardware.voices` pin still wins.
### Fixed
- **A persistent profile stays the same machine across launches.** With
`profile_dir` and no `seed`, every launch used to draw a new seed, so the same
profile came back with another GPU, screen and fonts. The first launch now
records its seed in the profile and later ones reuse it; an explicit `seed`
that differs from the recorded one is refused.
- **Opening and closing pages quickly no longer breaks `new_page()`.** A page's
close and the delivery of its events ran on two threads with nothing between
them, so an event of a page being closed could create a response under a
request the client had already dropped, and the client raised
`'dict' object has no attribute '_object'`, from `new_page()` or from a
`response` listener: 3 to 5 failed cycles out of 150 in every run of four.
A page's events now go through one gate under its close's lock, and do
nothing once it is closed: 0 out of 600.
## [0.35.10] - 2026-10-15
The pin moves to invisible-core 47.41.0, on the same firefox-47 engine.
### Added
- **The engine can live on a read-only disk.** `INVISIBLE_PLAYWRIGHT_ENGINE_DIR`
puts the sealed engine trees somewhere of their own, written only by a
download; `INVISIBLE_PLAYWRIGHT_CACHE_DIR` keeps the machine's writable state
(the GeoIP database, the font manifest). Unset, nothing moves. A launch on an
engine already fetched by the same core writes nothing into the store.
### Changed
- **`timezone="auto"` that cannot be resolved now fails the launch without a
proxy too.** It used to fall back to the host's timezone in silence when the
exit could not be discovered or the GeoIP database could not be obtained,
which on a server kept in UTC gives a timezone that contradicts its own IP.
The error names the cause; pass an explicit IANA zone to launch offline.
## [0.35.9] - 2026-10-15
The pin moves to invisible-core 47.40.0, on the same firefox-47 engine.
### Fixed
- **Closing a browser no longer closes the pipe of another browser in the
same process.** The driver closes a browser's pipe from `Browser.close` and
again when the session shuts down, and each call closed the pipe's
descriptor numbers. A released number goes to the next pipe the process
opens, so when one process drove several sessions the second call closed
another browser's pipe: its launch died with `EISDIR`, or it stopped
answering. The connection now releases each end once and never touches
the number again.
## [0.35.8] - 2026-10-14
The pin moves to invisible-core 47.39.0, which seals the firefox-47 engine.
### Fixed
- **A page can no longer tell that the engine carries the automation protocol
(#336).** Every engine until firefox-47 registered the protocol as a chrome
package named `juggler`, and a page tells a registered package from an absent
one with one line, `new Worker("chrome://juggler/...")`: it returns on our
engine and throws `SecurityError` on Firefox. Captcha vendors started probing
it in October 2026, which is why a challenge solved by hand was still refused.
firefox-47 loads the protocol from `resource://gre/modules/juggler/`, a
namespace every Firefox has and inside which a page cannot tell which files
exist; the engine now registers exactly the chrome packages and resource
substitutions Firefox 151 does, and its release is refused if it registers
any name that Firefox does not.
- **A goto the page stops on its way no longer answers OK on the old page, nor
waits out its timeout.** `document.open()` and `window.stop()` in the page
being left stop the navigation on its way, and the engine dropped every such
stop of the main frame (a workaround meant for the spurious one a Fission
process swap fires): `goto` answered OK while the page was still the
previous one, or waited for its timeout. It now raises `NS_BINDING_ABORTED`
at once, as Playwright does on Firefox. Every way a page or the caller can
stop or replace a goto (document.open, window.stop, location.replace and
assign, a form submit, an iframe navigating the top, history.back,
pushState, a meta refresh, a second goto) is tested against upstream
Playwright's answers, in one process and across a process swap.
- **`goto` refuses a success the engine made up**: when the commit attributed
to its navigation is not where that navigation's request went (redirects
included), it raises "Navigation to ... was reported committed on ..., which
is not where it went" instead of answering OK.
- **A goto that the caller's next goto stops** says "is interrupted by another
navigation to" the new address, as upstream; it said `NS_BINDING_ABORTED`.
- **`goto(until="load")` counts only its own document's `load`**: the states
were cleared when a navigation started, not when it committed.
- **A goto that waited out its timeout no longer says "the current navigation
is nav-N, not our nav-N"**: it says that our navigation started and neither
committed nor was aborted.
- **The wheel is born before the page sees it**, as keys and mouse moves are
since 0.35.7: `event.timeStamp` was the instant the wheel reached the page,
0 to 2 ms below `performance.now()` in the handler where a real wheel is 6
to 14, and half of the wheel events failed the filter a tracker applies.
## [0.35.7] - 2026-10-13
The pin moves to invisible-core 45.39.0, which seals the firefox-45 engine.
### Fixed
- **A key or a mouse move is born before the page sees it**, as on a real
machine, where the system takes a few milliseconds between the hardware and
the page's handler. The engine stamped every input event at the instant it
reached the page, so `event.timeStamp` equalled `performance.now()` there,
and a script that keeps only the events with `timeStamp < performance.now()`
dropped most of our keys (`page.type`, `keyboard`, `mouse`). Each event is now born a few milliseconds earlier,
drawn per event from the session (a median of 6 to 11 ms, fixed by the
seed): measured in the handler, 4 to 22 ms.
- **The first `navigator.mediaDevices.enumerateDevices()` of a session takes
the same time on Windows and on Linux**, a time the seed fixes between 240
and 640 ms. It took the host's audio stack time, 15 to 40 ms on Linux and
about 300 ms on Windows, so a script that sends its payload before the list
arrives saw a device field on one build and not on the other. With fake
devices the browser no longer asks the host for its speakers; the list a
page sees is unchanged.
## [0.35.6] - 2026-10-13
The pin moves to invisible-core 44.39.0, which seals the firefox-44 engine.
### Fixed
- **Stopping a screencast no longer freezes the browser on Windows.** The
engine stopped its window capture on the thread that owns the window, while
the capture was waiting for that thread to draw the window for it; when a
stop landed during a capture, the browser answered nothing more. Measured
with one browser on the hidden desktop: frozen within the first ten stops
on the engines before firefox-44.
- **Text with a character the US layout has no key for is typed**:
`page.type("#i", "café")`, `locator.type(...)` and `keyboard.type(...)`
raised "'é' has no key on the US layout". The keys that exist are
pressed and the character is inserted in its place, as Playwright does.
- **On Linux, the line endings a page reads are Windows'**: a `Blob` or a
`File` made with `endings: "native"` turns `\n` into `\r\n`, and the text
of a selection across two blocks is joined by `\r\n`, as on Windows.
- **`speechSynthesis.getVoices()` is Windows' list**: David, Mark, Zira and
the two Desktop voices, in that order, and none of them is the default.
David was the default and Zira came before Mark.
## [0.35.5] - 2026-10-13
The pin moves to invisible-core 43.39.0, which seals the firefox-43 engine.
### Fixed
- **A page's frames stay in `page.frames` after a few navigations in one
tab.** The engine reported the iframes of the page being loaded as
detached while it loaded them, once the back-forward cache let an older
page of the tab go: `page.frames` missed them and a `frame_locator` into
them waited until its timeout. Measured with five pages in a row: none of
the three frames of the fifth before, all three now.
- **On Linux, AAC is answered as on Windows.** `canPlayType` and
`MediaSource.isTypeSupported` of `audio/mp4`, `audio/aac`, `audio/x-m4a`
and `video/mp4; codecs="mp4a.40.2"` answered "maybe" at first and then
nothing from about 300 ms on, on a host without its own AAC decoder, while
H.264 stayed "probably": no Windows Firefox answers that. They now answer
what Windows does, "maybe", "maybe", "maybe" and "probably", with
MediaSource true, false, false, true. A Linux host without an AAC decoder
still cannot play the audio.
## [0.35.4] - 2026-10-13
The pin moves to invisible-core 42.39.0, which seals the firefox-42 engine.
### Fixed
- **A page that replaces itself no longer loses its main world.** Now and
then, after a page that navigated or reloaded itself, the new document's
main world was never announced, and a read in the page's world waited 30
seconds and failed: the engine's channel answered the new page's first
requests with the answers an earlier page had been given.
- **A session keeps the focus when another one starts beside it.** With two
sessions on one desktop, the first lost the focus when the second opened its
window: its page got `blur`, `document.hasFocus()` turned false and a focused
field stopped taking keys. Measured on Windows, two sessions on one hidden
desktop: 4 first sessions in 6 lost it before, 0 in 6 now.
- **The real mouse no longer turns a click into a drag.** In a visible
session, the person's cursor moving over the window during a click could
start a native drag on a link, and the click failed with an error from
`dispatchDragEvent`.
- **`evaluate` of a function that rejects with something that is not an
`Error`** (a plain object, an `Event`) raises, as in Playwright; it answered
`None`.
## [0.35.3] - 2026-10-13
The pin moves to invisible-core 41.39.0.
### Fixed
- **`go_back()` and `go_forward()` to a same-document entry (a hash, a
`pushState`) answer `None` at once**, as Playwright's. They waited for a
navigation id that a same-document navigation never has, and raised
`TimeoutError` at the timeout (measured on 0.35.2: 8 s for
`go_back(timeout=8000)`).
- A protocol command inside an action waits for what is left of the action's
timeout and no longer has a 10 s bound of its own (invisible-core 41.39.0),
so an action on a loaded host does not fail before its timeout; a key or a
pointer event waits for the engine's answer, which the engine bounds itself.
## [0.35.2] - 2026-10-12
The pin moves to invisible-core 41.38.0.
+12 -12
View File
@@ -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
+11215
View File
File diff suppressed because it is too large. Load diff
+23 -6
View File
@@ -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>
+4 -4
View File
@@ -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 ...
+2 -1
View File
@@ -71,7 +71,8 @@ row is for a specific situation.
| Variable | When you need it |
|---|---|
| `INVISIBLE_PLAYWRIGHT_CACHE_DIR` | Put the cached engine somewhere else - another drive, a shared location, a path your CI already caches |
| `INVISIBLE_PLAYWRIGHT_CACHE_DIR` | Put the cache somewhere else - another drive, a shared location, a path your CI already caches. It holds the engine and this machine's state (the GeoIP database, the font manifest) |
| `INVISIBLE_PLAYWRIGHT_ENGINE_DIR` | Keep the engine apart from the state, for example on a read-only disk built once per release: `invisible-playwright fetch` with it set fills it, and a launch only reads it. The cache directory must still be writable |
| `INVPW_BINARY_PATH` | Point at a binary you already have, and skip the download |
| `STEALTHFOX_GITHUB_TOKEN` | A rate-limited or corporate network that refuses anonymous GitHub downloads |
| `INVISIBLE_PLAYWRIGHT_SKEW=allow` | Run a Playwright version outside the tested range anyway |
+1 -1
View File
@@ -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
+12
View File
@@ -81,6 +81,18 @@ All three are page-visible because they live in the document or the global scope
them is the control channel. Fixing them is a matter of not writing them into the page in
the first place, which is a design decision, not a runtime patch.
There is a fourth, and it is the one you control rather than one the browser decides:
**an init script of your own that throws reaches the page.** A script added with
`page.add_init_script()` runs in the page's own realm, so a callback it registers - an
event listener, a timer, a promise - throws into that realm like any other page code.
An uncaught one reaches the page's `window.onerror` with `"eval code"` as its source,
which is a string a document that never calls `eval` has no other way to produce. The
browser's own injection does not do this: measured on a page that installs `onerror`,
a capturing `error` listener and `unhandledrejection` before anything else, then reads
every surface this package spoofs, nothing surfaces across repeated loads, reloads and
an iframe. So keep your own init scripts inside `try { } catch { }`, especially the
callbacks they leave behind, and prefer feature checks over assuming a property exists.
## Chromium injects cdc_ into the document; Firefox through Juggler does not
Chromium-based tooling writes `cdc_`-prefixed properties into the page; Firefox driven
+1 -1
View File
@@ -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:
+3 -3
View File
@@ -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)
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+2 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
View File
@@ -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
+5 -3
View File
@@ -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.
+5 -3
View File
@@ -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.
+1 -1
View File
@@ -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
+5 -3
View File
@@ -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.
+4 -2
View File
@@ -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:
+4 -4
View File
@@ -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
+1 -1
View File
@@ -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
+5 -3
View File
@@ -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,
+1 -1
View File
@@ -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.
+17 -16
View File
@@ -129,16 +129,14 @@ enough that there is no reason to open that window.
## What happens when the lookup fails
When resolution fails, the fallback depends on whether a proxy is in play, and the two
cases have opposite risks. Behind a proxy the wrapper fails early at launch rather than
ship a mismatch; without a proxy it falls back to the host timezone and the session
continues. The interesting part of any resolution step is what it does when it cannot
resolve, so both cases are set out below.
When resolution fails, the launch fails, with a proxy or without one. The interesting part
of any resolution step is what it does when it cannot resolve, so both cases are set out
below.
| Situation | On a failed resolution | Why |
|---|---|---|
| Proxy set | Fails early at launch | A foreign exit paired with the host timezone is a mismatch worth stopping for |
| No proxy | Falls back to the host timezone, continues | The host address is what the session presents, so the host timezone is correct |
| No proxy | Fails early at launch | The host's timezone can disagree with the host's own address, which is why it is resolved at all |
**With a proxy**, a failed resolution fails early. The reason is precise: if resolution
fell back to the host's own timezone while the traffic exits through a foreign proxy, the
@@ -147,14 +145,16 @@ to prevent, and it would do so silently. A foreign exit paired with the host tim
`timezone_mismatch` waiting to be scored, so the wrapper refuses rather than ship it. You
find out at launch, not from a block three requests later.
**Without a proxy**, there is no exit to disagree with. The session presents the host's own
address, so the host's own timezone is the correct answer, and a transient failure to read
it should never take the launch down. In that case resolution falls back to the host
timezone and the session proceeds.
**Without a proxy**, the session presents the host's own address, and the timezone is still
resolved from that address rather than read from the host. The reason is the case this
section used to wave through: a server kept in UTC whose public address is in another
country. Until invisible-core 47.41.0 a failed resolution here fell back to the host
timezone and the session went on, which handed exactly that server a timezone contradicting
its own IP, with nothing said. Now it fails at launch and names the cause. To launch with
no network at all, pass an explicit IANA zone, which asks the network nothing.
So the fallback is not a single policy applied everywhere. It is chosen so that the only
time resolution is allowed to fail loudly is the only time a quiet fallback would have been
a fingerprint bug. This matters most when you
So the rule is a single one: a resolution that cannot be honoured is an error, never a
quiet guess. This matters most when you
[rotate proxies across sessions](how-to-rotate-proxies-playwright.md) or run
[a different exit per browser context](playwright-proxy-per-context.md), because each new
exit is a fresh resolution, and each one either agrees with its browser or refuses to start.
@@ -220,9 +220,10 @@ explicit IANA identifier only when you want to override that.
once, over the proxy, and maps it against a local database. There is no per-launch call to a
geolocation service.
**Will my session break if the timezone lookup fails?** Behind a proxy it fails early, on
purpose, because a foreign exit with the host timezone is a mismatch worth stopping for.
Without a proxy it falls back to the host timezone and the session continues.
**Will my session break if the timezone lookup fails?** Yes, on purpose, with a proxy or
without one: a timezone that contradicts the exit is a mismatch worth stopping for, and the
host's own timezone can contradict the host's own address. Pass an explicit IANA zone to
launch without the lookup.
**How does the offline database stay current?** Each launch makes one cheap, unmetered check
against a permalink to the newest build and downloads only when the cache is behind. There is
+35 -4
View File
@@ -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.*`
@@ -116,8 +117,9 @@ profile disagree with the browser, on about 12% of seeds.
| `hardware.concurrency` | int | `16` | [`navigator.hardwareConcurrency`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/hardwareConcurrency). |
| `hardware.storage_quota_mb` | int | `10_000` | `navigator.storage.estimate().quota / 1024**2`. |
| `hardware.max_touch_points` | int | `0` | `navigator.maxTouchPoints`. `0` is what a desktop without a touchscreen reports, which is what the personas claim; it was a constant compiled into the binary until 2026-08-08, correct but not inspectable and not overridable. |
| `hardware.voices` | str | *(five en-US voices)* | The speechSynthesis voice list, as the engine parses it: `name\|lang\|default\|localService`, comma separated. Always the English (United States) set today, whatever locale the session resolved to - a real Windows machine running in Italian reports Italian voices, so an it-IT session declaring only American ones contradicts itself. The per-locale tables have to be measured on a real install of each locale, not invented; this field is the level at which that becomes possible. |
| `hardware.voices` | str | *(the session language's voices)* | The speechSynthesis voice list, as the engine parses it: `name\|lang\|default\|localService`, comma separated. Unpinned, it follows the session's first language: English gives the English (United States) set, Italian the set of a Windows with English UI and Italian added, as measured on one; a language without a measured set keeps the English one, because a table has to be measured on a real install, not invented. A pin wins over the table. |
| `hardware.fake_media_devices` | bool | `True` | One fake audio input and one fake video input on every host, so `enumerateDevices` does not report the machine's real hardware. Measured in a secure context (about:blank is not one, and measuring there made the two hosts look like they agreed because both returned nothing): Linux enumerated 0 real devices and Windows 2. |
| `hardware.media_enumeration_ms` | int | `412` | How long the first `navigator.mediaDevices.enumerateDevices()` of a session takes, in ms. With `fake_media_devices` the engine no longer asks the host's audio stack for its speakers, whose time it was (15-40 ms on Linux, about 300 on Windows), and answers after this long on every host; later calls are fast, as in Firefox. Drawn from the seed between 240 and 640, the range retail Windows Firefox took on one machine in two states. Ignored with real devices. Needs firefox-45. |
| `hardware.storage_enabled` | bool | `True` | Whether cookies, localStorage, sessionStorage and indexedDB all work. One field for four booleans because Gecko exposes them through two levers, not four. They used to be true because nobody touched `network.cookie.cookieBehavior` or `dom.storage.enabled`, i.e. because the upstream defaults happened to be right. |
| `hardware.generics` | str | *(20 rows)* | The CSS generic families, as `generic\|lang\|family` records separated by newlines. It was ten rows compiled into gfxPlatformFontList.cpp; the `x-math` row is load-bearing and easy to lose, because without it every MathML glyph renders in Times New Roman on every host, which no cross-OS gate can see. |
| `hardware.accessibility_overrides` | bool | `False` | Reduced motion, reduced transparency and inverted colours. Content-exposed media features that read the HOST through different code on each platform. They agreed across our two builds when measured - by luck, both machines having no accessibility settings on - and nothing declared them. Costs nothing to close: Firefox reads these generic prefs before the native path. |
@@ -166,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. |
@@ -178,15 +181,43 @@ 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
| Key | Type | Example | Notes |
|-----|------|---------|-------|
| `dark_theme` | bool | `False` | [`prefers-color-scheme: dark`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme). Real traffic is ~85% light, 15% dark. |
| `branding` | str | `"official"`, `"unofficial"`, `"C:/brand/branding.zip"` | The branding a page can read at `chrome://branding/content/` and `resource://usercontext-content/branding/`: the about dialog's stylesheet, the wordmarks' boxes, the logos' sizes. `"official"` (the default) is the retail Firefox's files, `"unofficial"` those of a build without the trademark, and an absolute path is a zip archive of your own holding exactly the same 16 file names at its root; anything else raises when the profile is built. An archive and not a folder because the engine serves it the way Firefox serves its own branding, from inside an archive: served from a folder, a page could tell the difference. The engine keeps no copy of its own. Needs firefox-48. |
`dark_theme` is the ONLY top-level key. Anything else raises `ValueError: pin key
'...' is not valid`.
`dark_theme` and `branding` are the ONLY top-level keys. Anything else raises
`ValueError: pin key '...' is not valid`.
**`fonts` is not one of them, and no longer exists as an axis.** This table used
to list a per-profile font allowlist ("the sampler usually picks 14-24 system
+3 -3
View File
@@ -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.
+7 -5
View File
@@ -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.
+2 -1
View File
@@ -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
+1 -1
View File
@@ -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
+2 -2
View File
@@ -102,8 +102,8 @@ How this project does it, because the details are the part that bites:
request per launch announcing that a new session started.
- The **same** lookup feeds the locale and the WebRTC public address, so those three
cannot drift apart. They come from one answer, not three.
- **On failure with a proxy configured, it fails the launch** instead of falling back
to the host timezone. That fallback is the exact mismatch you set out to avoid, and a
- **On failure it fails the launch**, with a proxy or without one, instead of falling
back to the host timezone. That fallback is the exact mismatch you set out to avoid, and a
silent fallback to it is worse than an error.
That last one is a small decision that took a while to get right. A fallback that
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+7 -6
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "invisible_playwright"
version = "0.35.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==41.38.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.
@@ -138,13 +138,15 @@ markers = [
# invisible_core's addopts said `not slow` while never declaring `slow`,
# so the exclusion matched nothing and the word meant nothing.
#
# The blocks are byte-identical on purpose, and
# The lists are identical on purpose, and
# invisible_core/tests/test_marker_vocabulary.py fails when they drift.
# (It compares the parsed lists, so this comment may differ per repo.)
"unit: pure logic - no I/O, no network, no subprocess, no browser",
"integration: several modules together, in process - no network, no browser",
"e2e: needs something outside this process - the network, the real patched binary, or a display",
"slow: builds a wheel or an sdist - opt-in only",
"linux_only: requires Linux",
"wall_clock: its verdict reads a wall-clock duration - the e2e run gives it the machine alone, after the parallel tests",
]
# Both exclusions in ONE addopts: declaring the key twice is a TOML error, not
# a merge, and pytest then sees neither value.
@@ -241,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"
+172
View File
@@ -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))
+106
View File
@@ -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))
+33 -4
View File
@@ -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}"
-417
View File
@@ -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]))
+606
View File
@@ -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())
+50
View File
@@ -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))
+9 -4
View File
@@ -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.",
]
+37
View File
@@ -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"}
]
}
+356
View File
@@ -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>
+298
View File
@@ -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())
+47
View File
@@ -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)
+9 -186
View File
@@ -1,201 +1,24 @@
#!/usr/bin/env python3
"""Run the FULL e2e suite (every test that opens the browser) against a binary.
"""Run this repository's FULL e2e suite (every test that opens the browser)
against a binary: the mandatory pre-release e2e gate of a firefox-N.
Every ``@pytest.mark.e2e`` test is excluded from the default `pytest` run
(`addopts = -m 'not slow and not e2e'`) because they need a real Firefox binary
and a display, and they skip themselves when no binary is available. That makes
them easy to forget - and "we can't afford for something to not work". This is
the gate that runs them all, deliberately, against a chosen binary.
It is the MANDATORY pre-release e2e gate: run it green against the freshly-built
release binary BEFORE un-drafting a firefox-N (alongside the fppro + WebRTC
realness gates). It is NOT in the public CI drive-gate - the hosted runners are
content-process unstable under a heavy headless interaction sequence (see
70-known-bugs / 60-ci-release-pipeline); this runs locally on reliable hardware.
Flake-resilience: under full-suite load a couple of interaction tests (dblclick,
hover/mouseenter) can flake even though they pass 3/3 in isolation, so failures
are reran up to twice on the known transient signatures. A genuinely broken
binary fails all attempts. The webrtc e2e fake a TCP-only SOCKS locally (no
proxy/secrets), so the whole suite is offline.
The run opens FOUR browsers at once by default. `--dist loadfile` is not
negotiable and the reason is on the line that sets it: two properties of this
suite depend on a file staying whole on one worker, and both were measured
failing when it did not.
The run itself - which tests, how many browsers at once, the rerun rules, the
deadline, and why each is what it is - lives ONCE, in
`invisible_core.testing.e2e`, for the three clients of the core. This file is
the entry the workflows and the documents call.
Usage:
python scripts/run_e2e.py <firefox-binary>
python scripts/run_e2e.py # uses $INVPW_BINARY_PATH
python scripts/run_e2e.py <binary> -n 8 # eight browsers at once
python scripts/run_e2e.py <binary> -n 1 # the old serial path, unchanged
python scripts/run_e2e.py <binary> -n 1 # the serial path, no xdist
"""
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
_RERUN_SIGNATURES = "Timeout|context was destroyed|was detached|not visible|because of a navigation|TargetClosed"
#: Browsers opened at once. Four was asked for and four is what the default is;
#: it is not a measured optimum and there is no reason to believe one number
#: fits every machine, so `-n` moves it and `-n 1` puts the run back exactly on
#: the serial path this script had before parallelism existed.
_DEFAULT_PROCS = "4"
def _take_procs(argv: list[str]) -> tuple[str, list[str]]:
"""Pull `-n/--procs` out of the arguments, leaving the rest for pytest.
Hand-parsed rather than argparse because everything this script does not
recognise is forwarded to pytest verbatim, and argparse would have to be
taught every pytest flag in order to not eat one.
The value is kept as a STRING and handed to xdist unread, so `auto` and any
future spelling xdist accepts keep working without this function learning
about them. Only `0` and `1` are interpreted here, and they mean the same
thing: do not load xdist at all. That is not the same as `-n 1`, which
still runs the tests inside a worker subprocess - a difference that matters
the day this script is used to compare a parallel run against a serial one,
because then the serial arm must be the ORIGINAL path and not a
one-worker variant of the new one.
"""
procs, rest, i = _DEFAULT_PROCS, [], 0
while i < len(argv):
if argv[i] in ("-n", "--procs"):
if i + 1 >= len(argv):
print("run_e2e.py: -n needs a value (1 = serial)", file=sys.stderr)
raise SystemExit(2)
procs, i = argv[i + 1], i + 2
continue
rest.append(argv[i])
i += 1
return procs, rest
def main() -> int:
procs, extra = _take_procs(sys.argv[1:])
binary = extra[0] if extra else os.environ.get("INVPW_BINARY_PATH")
extra = extra[1:] if extra else []
if not binary:
print("usage: run_e2e.py <firefox-binary> (or set INVPW_BINARY_PATH)", file=sys.stderr)
return 2
if not Path(binary).exists():
print(f"ERROR: binary not found: {binary}", file=sys.stderr)
return 2
# An escape hatch in the environment is not neutral here: one e2e ASSERTS
# the behaviour it disables.
#
# `INVISIBLE_CORE_PIN=allow` tells the core to run a mismatched pair instead
# of repairing it. It is the normal way to drive a locally built engine, so
# it is often already exported in the shell that starts this run - and it is
# INHERITED by the venv subprocess that
# `test_the_mismatch_repairs_itself_at_import_without_a_restart` spawns.
# That test deliberately breaks an environment and requires importing the
# wrapper to fix it. With the variable set, the repair correctly declines,
# the version does not move, and the test fails for a reason that has
# nothing to do with the binary under test.
#
# Measured 2026-08-16: 1 failed / 143 passed in 14 minutes, and the same
# file re-run with the variable unset gave 4 passed in 2 minutes. Refusing
# up front costs a second; discovering it costs the whole run plus the time
# spent believing the product was broken.
#
# It is stripped, not merely warned about: a warning at the top of a
# 14-minute run scrolls away long before the failure appears.
env = {k: v for k, v in os.environ.items() if k != "INVISIBLE_CORE_PIN"}
if "INVISIBLE_CORE_PIN" in os.environ:
print("[run_e2e] INVISIBLE_CORE_PIN is set in this shell and has been "
"STRIPPED for the run: one e2e asserts the pin repair that the "
"variable disables, and it would fail for that reason alone.",
file=sys.stderr)
# One setting drives the whole suite: conftest's firefox_binary fixture and
# the webrtc e2e both resolve from these.
env["INVPW_BINARY_PATH"] = binary
env["STEALTHFOX_E2E_BINARY"] = binary
repo = Path(__file__).resolve().parent.parent
# ⛔ `--dist loadfile` IS NOT A TUNING CHOICE, IT IS A CORRECTNESS ONE, and
# xdist's default (`--dist load`, which hands out one test at a time) breaks
# this suite in two measured ways.
#
# 1. MODULE-SCOPED BROWSERS. `test_fingerprint_consistency.py` is 65 of the
# 193 e2e tests and opens ONE browser for all of them, from a
# module-scoped fixture. Scattered test-by-test across four workers, each
# worker that receives any of those tests builds its own copy of that
# fixture: four browsers where the file wants one, and the identity those
# 65 tests exist to prove is no longer being read off a single session.
#
# 2. TESTS THAT DEPEND ON AN EARLIER TEST IN THEIR OWN FILE.
# `test_binary_executes_after_fetch` fails 2 out of 2 in isolation and
# passes 9 out of 9 when its module runs whole, because a prior test in
# that file populates the venv it uses. Measured 2026-08-29, and it very
# nearly got recorded as a deterministic failure of the product.
#
# `loadfile` keeps every file whole on one worker, so both properties
# survive. The price is the ceiling: the longest single FILE is now the
# floor of the whole run, and with 65 of 193 tests in one file this run
# cannot go faster than that file no matter how many workers are asked for.
# That is why raising `-n` past a certain point buys nothing here, and the
# fix for it would be splitting that file, not adding workers.
parallel = [] if procs in ("0", "1") else ["-n", procs, "--dist", "loadfile"]
cmd = [
sys.executable, "-m", "pytest",
"-m", "e2e",
"-o", "addopts=", # override the default 'not e2e' deselection
"--reruns", "2", "--reruns-delay", "1",
"--only-rerun", _RERUN_SIGNATURES,
# A DEADLINE is not a flake, and retrying one multiplies it by three.
# `Timeout` in the signatures above was written for Playwright's
# TimeoutError, but it also matches `subprocess.TimeoutExpired` -
# measured, 2 tests produced 4 reruns - and the release/upgrade e2e
# spend their time in `pip install` calls whose timeouts run to 300s
# each. Retried twice that is 900s for one test, and the two files sum
# to 10050s of timeout budget against a 2400s job. That is how the job
# was killed at 40 minutes twice with nothing to show for it.
"--rerun-except", "TimeoutExpired", # a subprocess deadline
"--rerun-except", "Timeout >", # pytest-timeout's own deadline
# And a per-test deadline, so a hang FAILS WITH A NAME instead of eating
# the job. 420s is 4.5x the slowest legitimate test measured on CI
# (test_webgl_readpixels_no_masking_signature, 94.4s; the second slowest
# is 11.4s and the whole suite is 318s), and 1/6 of the job budget.
# METHOD=thread, not the signal default, and that is the whole point.
# Measured 2026-08-13 on the run of this very change: the suite wedged in
# `test_hover_triggers_mouseenter` and the 420s signal deadline came and
# went with NOTHING at 19.3 minutes, 21 minutes, 40. SIGALRM is delivered
# to the main thread and Python runs the handler at the next bytecode
# boundary; Playwright's sync API is blocked in a greenlet waiting on the
# driver socket, so that boundary never arrives. A watchdog THREAD does
# not need the hung thread to cooperate: it dumps every thread's stack
# and ends the process. The suite does not carry on, which is the price,
# and in exchange a hang stops being anonymous.
"--timeout", "420",
"--timeout-method", "thread",
"-p", "no:cacheprovider",
# -v, not -q, and the reason is a hang we could not name twice.
# Under -q pytest emits one character per test and the line only
# reaches the log when it is full, so a run that dies mid-line says
# nothing about where it died. Measured 2026-08-12 on two runs of the
# SAME commit: both printed the identical `.s....[ 50%]` line at 78
# seconds, one then finished in 4:47 and the other was killed by the
# 40-minute timeout with no second line - so the hang was somewhere in
# tests 73-141 and that is as close as the log could get. Same symptom
# on 2026-08-04. PYTHONUNBUFFERED was already set and is not the
# missing piece: the output does stream, the GRANULARITY was wrong.
# One line per test costs 141 lines and names the last one that ran.
"-v", "--tb=short",
] + parallel + extra
print(f"[run_e2e] binary={binary}")
print(f"[run_e2e] browsers at once: {procs if parallel else '1 (serial)'}")
print(f"[run_e2e] {' '.join(cmd)}")
return subprocess.run(cmd, cwd=repo, env=env).returncode
from invisible_core.testing.e2e import main
if __name__ == "__main__":
sys.exit(main())
sys.exit(main(sys.argv[1:], repo=Path(__file__).resolve().parent.parent))
+218
View File
@@ -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))
+6 -1
View File
@@ -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:]))
+1 -1
View File
@@ -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
+7 -1
View File
@@ -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)
+41 -72
View File
@@ -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 ────────────────────────────────────────────────────────────
+35 -9
View File
@@ -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
+28 -66
View File
@@ -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."
)
+5 -39
View File
@@ -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))
+6 -3
View File
@@ -2,7 +2,6 @@
from __future__ import annotations
import asyncio
import secrets
import time
from pathlib import Path
from typing import Any, Dict, Optional, Union
@@ -13,7 +12,7 @@ from invisible_playwright._pw._impl._browser_context import page_number_reserved
from . import _session
from ._cursor import resolve_cursor_engine
from invisible_core._fpforge import Profile, generate_profile
from invisible_core import SessionLocale, persona_cookies, prepare_session_geo
from invisible_core import SessionLocale, persona_cookies, prepare_session_geo, record_session_seed, resolve_session_seed
from ._engine import assert_wire_version, resolve_executable
from invisible_core import configure_proxy as _configure_proxy_shared
from ._reaper import SessionToken, guard_for
@@ -40,7 +39,9 @@ class InvisiblePlaywright(_session.CommonLaunch):
show_cursor: Optional[bool] = None,
) -> None:
# See sync launcher: `zoom.stealth.fpp.hw_seed` is int32_t - clamp.
self.seed: int = int(seed) if seed is not None else secrets.randbits(31)
# One place decides the seed, and a profile directory remembers it
# (invisible_core.resolve_session_seed, B314).
self.seed: int = resolve_session_seed(seed, profile_dir)
self._pin = pin
self._headless = headless
self._proxy = proxy
@@ -142,6 +143,8 @@ class InvisiblePlaywright(_session.CommonLaunch):
if self._profile_dir is not None:
# See sync launcher for the persistent-context rationale.
self._profile_dir.mkdir(parents=True, exist_ok=True)
# The profile is this machine from now on (B314).
record_session_seed(self._profile_dir, self.seed)
# firefox-5 ships the C++ overrideTimezone IDL method (C7
# closure), so locale + timezone_id now propagate cleanly
# to the persistent context without hanging the launch.
+5 -3
View File
@@ -39,7 +39,7 @@ import sys
from . import __version__
from invisible_core import BINARY_VERSION, FIREFOX_UPSTREAM_VERSION
from invisible_core.download import cache_root, ensure_binary # noqa: F401
from invisible_core.download import cache_root, engine_root, ensure_binary # noqa: F401
from ._pin import (
declared_core_pin as _declared_core_pin,
@@ -111,8 +111,10 @@ def _cmd_version(_args: argparse.Namespace) -> int:
print(f"engine {s.tag} Firefox {s.upstream_version} build {s.build_id}")
print(f"seal {s.digest[:12]} [{s.origin}]")
# Where the engine lives, because `clear-cache` is gone and "how do I get
# the disk space back" needs an answer that is not a subcommand.
print(f"cache {cache_root()}")
# the disk space back" needs an answer that is not a subcommand. Two
# roots: the engines (engine_root) and this machine's state (cache_root).
print(f"engines {engine_root()}")
print(f"state {cache_root()}")
return 0
+6 -10
View File
@@ -1,7 +1,6 @@
"""Sync Playwright launcher for invisible_playwright."""
from __future__ import annotations
import secrets
import time
from pathlib import Path
from typing import Any, Dict, Optional, Union
@@ -11,7 +10,7 @@ from invisible_playwright._pw.sync_api import Browser, BrowserContext, Playwrigh
from . import _session
from ._cursor import resolve_cursor_engine
from invisible_core._fpforge import Profile, generate_profile
from invisible_core import SessionLocale, persona_cookies, prepare_session_geo
from invisible_core import SessionLocale, persona_cookies, prepare_session_geo, record_session_seed, resolve_session_seed
from ._engine import assert_wire_version, resolve_executable
from invisible_core import configure_proxy as _configure_proxy_shared
from ._reaper import SessionToken, guard_for
@@ -54,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.
@@ -187,7 +179,9 @@ class InvisiblePlaywright(_session.CommonLaunch):
# interpreted as negative on the C++ side, where the noise hooks
# bail out on ``seed <= 0`` - which produces bit-identical audio
# / canvas fingerprints across half the sessions.
self.seed: int = int(seed) if seed is not None else secrets.randbits(31)
# One place decides the seed, and a profile directory remembers it
# (invisible_core.resolve_session_seed, B314).
self.seed: int = resolve_session_seed(seed, profile_dir)
self._pin = pin
self._headless = headless
self._proxy = proxy
@@ -349,6 +343,8 @@ class InvisiblePlaywright(_session.CommonLaunch):
# was REMOVED once the origin was found, so that only one place
# knows the fact.
self._profile_dir.mkdir(parents=True, exist_ok=True)
# The profile is this machine from now on (B314).
record_session_seed(self._profile_dir, self.seed)
self._persistent_context = self._pw.firefox.launch_persistent_context(
user_data_dir=str(self._profile_dir),
executable_path=str(executable),
+35
View File
@@ -0,0 +1,35 @@
"""The local HTTP server the tests serve their pages from: ONE class.
⛔ THREADED, BECAUSE A SINGLE-THREADED SERVER CAN BE HELD BY ONE CONNECTION.
`socketserver.TCPServer` and `http.server.HTTPServer` serve one connection at a
time: a connection the browser opens and leaves without a request (a
speculative connect, a keep-alive) holds the only thread, so the next request
waits behind it and `shutdown()` waits for it. That is a candidate for
[B277], a Windows e2e worker that stopped for 420 s on the screencast test, and
it was in 35 servers of 18 files, each its own copy. A thread per connection,
and daemon threads, so neither a request nor the shutdown can be held.
Same interface as the classes it replaces (`serve_forever`, `shutdown`,
`server_address`, the `with` block), so a test changes only its constructor.
Not `http.server.ThreadingHTTPServer`: its `server_bind` asks `getfqdn` for
the address, a reverse lookup that can take seconds on Windows.
"""
from __future__ import annotations
import socketserver
class LocalServer(socketserver.ThreadingTCPServer):
daemon_threads = True
# What `http.server.HTTPServer` sets, for the tests that bind a port they
# picked rather than 0.
allow_reuse_address = True
def server_bind(self):
"""`server_name` and `server_port`, which `http.server.HTTPServer`
gives and tests read, without its `getfqdn`."""
socketserver.ThreadingTCPServer.server_bind(self)
self.server_name, self.server_port = self.server_address[:2]
__all__ = ["LocalServer"]
+73 -2
View File
@@ -2,7 +2,7 @@ import faulthandler
import http.server
import os
import random
import socketserver
import re
import sys
import tempfile
import threading
@@ -10,6 +10,8 @@ from pathlib import Path
import pytest
from _servers import LocalServer
# ── The watchdog that says WHERE it is stuck, while it is still stuck ─────────
#
# The e2e hangs in 12% of CI runs (4 out of 33, from 2026-08-01 to 08-13) and
@@ -127,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.
@@ -151,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
@@ -163,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).
@@ -232,7 +303,7 @@ self.addEventListener('fetch', e => {
def fixture_server():
"""Spin up a localhost HTTP server with SW-friendly headers. Yields
the base URL (e.g., 'http://127.0.0.1:54321')."""
httpd = socketserver.TCPServer(("127.0.0.1", 0), _SWFixtureHandler)
httpd = LocalServer(("127.0.0.1", 0), _SWFixtureHandler)
port = httpd.server_address[1]
thread = threading.Thread(target=httpd.serve_forever, daemon=True)
thread.start()
+297
View File
@@ -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()
+102
View File
@@ -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>
+505
View File
@@ -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
}
}
}
Loaded 100 of 217 files, more files were not shown because too many files have changed in this diff. Show more