Compare commits

...
Author SHA1 Message Date
feder-cr d4bee3cb19 ci(hunt): linux-3 becomes linux-3-loaded: 4 background loops of the security state's generation during the main run of every round (temporary) 2026-11-22 15:41:01 +01:00
feder-cr 7ae04457ef ci(hunt): this branch runs its own workflow: three Linux whole-suite copies, 3 rounds each, cores read by gdb (temporary) 2026-11-22 14:21:59 +01:00
feder-cr ca142970a2 Merge remote-tracking branch 'origin/char69/cores' into hunt/intermittent-68-suite-cores
# Conflicts:
#	ci/required-suites.json
2026-11-22 14:20:52 +01:00
feder-cr 866436f822 tests: the core of any crash is read by gdb after the test that fails (temporary)
The -11 at the exit of the security state's generate (runs 44985244053, 45014369018) left no core: a release build crashes in silence, and only a core
tells a wanted crash (gMozCrashReason) from a bad access. tests/_crash_cores.py, TEMPORARY:

* tests/conftest.py raises the soft RLIMIT_CORE of the pytest session to its hard limit once, at pytest_configure, on Linux: every engine a test starts
  inherits it, the core's own launches included;
* a pytest_runtest_makereport wrapper, after every phase that fails, has gdb read every core* in $INVPW_CORE_DIR (all threads' backtraces and names,
  the signal's address, gMozCrashReason, registers, shared libraries with build ids, mappings; the executable from the core's header, else
  INVPW_BINARY_PATH) into $RUNNER_TEMP/invpw-evidence/cores/<test>/ and deletes the core; the cores left after a passing test are deleted and listed in
  cores/after-passing-tests.txt.

tests/_generation_evidence.py keeps only stdout, stderr and the profile's files of the core's launch: its core-limit raising and its own gdb call are
gone, and the direct launch of tests/test_security_state_engine_e2e.py no longer lifts its limit. The proof with a fake engine that dies by SIGSEGV
through the core's real generate now asserts gdb's text with a backtrace on Linux (where a core lands and gdb exists) and the Linux-only note on
Windows; tests/test_the_core_of_a_crash_is_read_by_gdb_after_a_failed_test.py drives the conftest hook with a fake core and a fake gdb on every
system. Unit rows: +4 each (2301 Linux, 2302 Windows).
2026-11-22 13:48:52 +01:00
feder-cr e44b2d623c ci(hunt): the fourth Linux copy becomes linux-secstate: tests/test_security_state_engine_e2e.py alone, 40 rounds, cores and gdb texts kept per round 2026-11-22 13:41:35 +01:00
feder-cr c7b8c4533e test(fakeweb p2): a round that does not idle keeps the whole in-flight list, what the lifecycle held open at the expiry, and each open request's history on the Juggler wire (+4 unit tests) 2026-11-22 13:40:18 +01:00
feder-cr 17a38797c5 Merge origin/tests/characterization-69 (10d15eee) into the suite hunt branch 2026-11-22 13:33:36 +01:00
feder-cr dd227e72b9 ci: a hunt for the intermittent e2e of firefox-68 in the whole suite (8 jobs, rounds), on the hunt branch only 2026-11-22 13:29:37 +01:00
feder-cr 0f06f39c14 Merge origin/tests/characterization-69 into the suite hunt branch 2026-11-22 13:25:09 +01:00
feder-cr 8a57737969 tests: the popup's recorder binds the error text before the lambda that writes it (F821) 2026-11-22 13:22:54 +01:00
feder-cr 10d15eee00 ci: the unit rows name the files of the merged fixes, counted again 2026-11-22 13:19:47 +01:00
feder-cr 5f64171b68 Merge commit '6f0a3af9' into tests/characterization-69 2026-11-22 13:17:20 +01:00
feder-cr ebcf4ab793 Merge the evidence of a failed security-state generation into the characterization line 2026-11-22 13:17:19 +01:00
feder-cr 06f0de8a7f Merge remote-tracking branch 'origin/char69/ownaddr' into tests/characterization-69 2026-11-22 13:17:10 +01:00
feder-cr 3571ea427e Merge the first batch of the fixes of the existing tests (PR #561, d76ecfbf) into the characterization line 2026-11-22 13:17:09 +01:00
feder-cr 72c7e6acf6 tests: the far-away gateway gather saves, when it fails, where the page's STUN request went
Evidence only (webrtc-far-away-<ice row>-<rtt>): the gateway's control connections and datagrams with their times and addresses,
the page's candidates, ICE errors and gathering states, the timings, the Juggler wire and the addresses of the runner.
Assertions, waits and deadlines are unchanged.
2026-11-22 13:12:02 +01:00
feder-cr 78670896b9 tests: the core's own generation of the security state keeps its evidence when it fails (temporary)
In run 45014369018 the -11 came from the CORE's generate, which _ready calls once per module and whose outcome three tests share; the test's own
launch had exited 0, so its save path never ran, and the core's launch writes stdout and stderr to the null device, deletes its work profile before
it raises and keeps the test process's core limit of 0. tests/_generation_evidence.py wraps the core's launch while _ready runs it: stdout and
stderr to files, the soft core limit raised to the hard one (Linux), the profile's files noted at the engine's exit, and on GenerationError all of
it saved in $RUNNER_TEMP/invpw-evidence/security-state-generate-core with gdb's backtrace where a core lands. The direct launch lifts its limit the
same way (preexec_fn, no sh wrapper). A unit test proves it with a fake engine that dies by SIGSEGV through the core's real generate.
2026-11-22 13:08:58 +01:00
feder-cr e461d9d763 test(h3 lab): the residual case of the QUIC-first order is measured: a client that starts a QUIC handshake and vanishes holds the TCP of its IP until the QUIC idle timeout (+1 unit test) 2026-11-22 13:07:46 +01:00
feder-cr 365df5d90f test(read after goto): the test saves, when it fails, the client's view of every request and navigation, the Juggler wire, the engine's trace and the server's record of the requests it served 2026-11-22 13:06:26 +01:00
feder-cr aa078c0ff9 test(popup): the server-side recorder passes every call through unchanged and a recording error never reaches the server 2026-11-22 13:06:00 +01:00
feder-cr 2ab0b97072 test(popup): the 25 s popup saves, when it fails, the engine's wire and trace, what the server sent to the client and did with the target, what the client heard and the destination's record 2026-11-22 13:05:59 +01:00
feder-cr 5e70b513ce tests: the two-connections loopback test keeps what the lab heard on the mDNS group, packet by packet, when it fails
A passive listener (tests/_mdns_listener.py) joins 224.0.0.251:5353 on 127.0.0.1, the interface the engine's responder joins, before each launch and records every packet with its time, source, query or response, names and addresses. It never sends or answers, shares the port with the engine's socket and never raises. No assertion, wait or deadline changes.
2026-11-22 13:05:59 +01:00
feder-cr c0683e010b tests: the two-connections loopback test keeps the mDNS and mtransport logs and the page's ICE timeline when it fails
On failure the test saves the engine's own log of the failing launch (mdns_service and mtransport, MOZ_LOG_FILE in the evidence folder), the timings and the page's timeline of every launch up to it: each icecandidate of both connections, every ice and connection state change, when each addIceCandidate was called and settled. No assertion, wait or deadline changes.
2026-11-22 13:05:59 +01:00
feder-cr 525832571f tests: the no-proxy HTTP/3 test keeps the engine's HTTP log, the lab server's record and the visit timings when it fails
On failure the test saves the engine's own log of the launch (nsHttp and the neqo_glue, neqo_http3 and neqo_transport modules, MOZ_LOG_FILE in the evidence folder), the lab server's record of every TCP and QUIC connection (start, handshake, each request with its path, close and reason) and the url, protocol, goto time and read time of each visit. No assertion, wait or deadline changes.
2026-11-22 13:05:55 +01:00
feder-cr 6f0a3af9fd tests: the focus test gives the X input focus itself, as the window manager the private Xvfb lacks
On the private Xvfb no window manager runs, so nobody calls XSetInputFocus: the
focus stays PointerRoot and GDK activates the toplevel under the pointer
(has_pointer_focus when no _NET_SUPPORTING_WM_CHECK), while Firefox presents a
window (gtk_window_present_with_time, XSetInputFocus without a WM) only when it
is not active already. XGetInputFocus therefore read PointerRoot for the whole
wait although the first page had the focus.

The test now does the window manager's part on Linux: it finds the window the
step names by its _NET_WM_NAME and gives it the X input focus (the first
session's, the second session's, and the session's own new window as a focus
on map), then reads the focus back before judging; on Windows the same steps
ask for the foreground as before. X errors no longer end the process.
2026-11-22 12:57:09 +01:00
feder-cr e68597cdb8 ci: the unit file of the lab server's QUIC-first order is in the rows of the whole unit suite (+5 tests) 2026-11-22 12:54:59 +01:00
feder-cr 59186492f3 test(h3 lab): LF line endings for the new test file, as the rest of the repository 2026-11-22 12:54:43 +01:00
feder-cr 9ef9ae651c test(h3 lab): the TLS of a TCP connection waits for the QUIC handshake in progress of the same client, as a real network orders them (QUIC 1 RTT, TCP+TLS 2) 2026-11-22 12:54:27 +01:00
feder-cr 13ecefb579 test(h3 lab): the QUIC connection of a client is ready before its TCP+TLS one while its QUIC handshake is in progress (red on the current server) 2026-11-22 12:53:30 +01:00
feder-cr 93239a1a10 tests: the save-on-failure helper of the e2e (tests/_evidence_on_failure.py as on tests/characterization-69 bc6d861f, unchanged), for the journey's evidence 2026-11-22 12:50:09 +01:00
feder-cr 42c344a180 test(fakeweb): a failure of the journey's request log is never the client's 2026-11-22 12:49:55 +01:00
feder-cr 261883cfd5 test(fakeweb): the journey saves, when it fails, the site's record of each request, the client's log of every request event per step and each step's in-flight list 2026-11-22 12:49:55 +01:00
feder-cr 652d7ead39 tests: a gateway says why it refused and which interfaces of this host it read; an unreadable list raises
Every refusal of LabGuard now carries its reason: the lab's rule (a name that is not localhost; an address that is not loopback, not a
documentation range and not one of the N addresses of this host read at the decision) or the narrower rule of the gateway (the DoH gateway
carries only loopback; the IPv6 literal gateway only its listener). The record also says, once per gateway, the interfaces of this host as
read when the gateway was made (by interface name) and how they were read (psutil.net_if_addrs, its version, the normalisation).

The reading never fails silently any more: _own_addresses returned an empty set on any exception (psutil raising or not importing, _witness
not importing), which made every address of this host "not the lab's" without a word. _witness.read_host_interfaces raises
HostInterfacesUnreadable (also for an entry that is not an address and for a list with no address at all); the guard raises when it is made,
a failure at a decision refuses with that reason and raises at the close; the witness keeps an arrival it cannot judge as the host's and
raises when read.

The refusals of 10.1.0.52 in run 45014369018 (Windows part 2) were the DoH gateway's own rule in
test_nothing_of_a_context_leaves_but_through_its_proxy_e2e (the witness stands at the runner's address and no proxy may forward to it),
which the record did not say. Nine unit tests, red on the old helpers; registry: unit.all 2269 (Linux), 2270 (Windows).
2026-11-22 12:42:37 +01:00
feder-cr d76ecfbfbb Version 0.58.1: a read that runs out of time says Playwright's timeout (no tag: the release is decided with firefox-69) 2026-11-22 12:11:29 +01:00
feder-cr fc3622345f ci: the unit rows hold the model of a moving page's goto and the read whose probe ran out (24 tests more) 2026-11-22 11:49:22 +01:00
feder-cr c208d2f895 A read's probe running out of time is the read's timeout, not a second look at the clock 2026-11-22 11:49:05 +01:00
feder-cr a57ea6d34a tests: a read whose probe ran out of time is the caller's timeout, whatever the clock says 2026-11-22 11:49:05 +01:00
feder-cr bdb5a84508 tests: after a goto of a moving page raises the frame may go with either page; each test of the moving pages has its own page 2026-11-22 11:49:05 +01:00
feder-cr d8179ab1e0 tests: the model of where the frame goes after a goto of a moving page raises, on a fake page (red on the model that picks one page) 2026-11-22 11:49:05 +01:00
feder-cr 84ce385ef5 tests: the goto-stopped test says in one line why a page is not reused 2026-11-22 11:41:25 +01:00
feder-cr 4cc4b8e7c8 tests: each iteration of the goto-and-every-way-it-is-stopped test runs on its own page, so a refresh the engine replays late cannot fall on the next iteration's setup goto 2026-11-22 11:41:25 +01:00
feder-cr bc6d861f62 tests: the download left to Firefox keeps its evidence when slow, the shutdown ping is judged on the core's own grace
- test_a_context_without_download_options_is_left_to_firefox: the download reputation prefs are no longer switched off (a slow save is the product's); the seconds from the click to the file stay a junit property, and a save slower than 40 s (judged after the fact, never a verdict) keeps in invpw-evidence/download-left-to-firefox the test server's record, the client's requests, the Juggler wire and trace, and a MOZ_LOG of the download machinery
- _evidence_on_failure: keep(why) saves what the helper holds though the test passed; arm(moz_log=...) and note_records(...)
- test_the_shutdown_ping...: no patch of SENDER_GRACE nor of the session's safety net; the ping must be on the endpoint when the session has ended, within the core's 10 s grace
2026-11-22 11:38:07 +01:00
feder-cr 8f8a191e9b ci: the unit rows count the new test of the Marionette helpers 2026-11-22 11:17:51 +01:00
feder-cr eca6652f56 Merge remote-tracking branch 'origin/char69/movesonevidence' into tests/characterization-69 2026-11-22 11:16:41 +01:00
feder-cr fbae6d54a4 Merge remote-tracking branch 'origin/char69/misc' into tests/characterization-69 2026-11-22 11:16:41 +01:00
feder-cr 836e16724e Merge commit 'eb203fc5' into tests/characterization-69 2026-11-22 11:16:40 +01:00
feder-cr 2ca4fa8084 Merge remote-tracking branch 'origin/char69/windowdet' into tests/characterization-69 2026-11-22 11:16:30 +01:00
feder-cr 8dc5c3745a Merge remote-tracking branch 'origin/char69/pids' into tests/characterization-69 2026-11-22 11:16:30 +01:00
feder-cr 364175411e ci: the unit rows count the install wait's busy-machine case (one test more) 2026-11-22 10:43:07 +01:00
feder-cr 87bd845ac0 tests: the install wait runs on a fake clock, so its rounds do not depend on the load of the machine 2026-11-22 10:40:21 +01:00
feder-cr 7f25429b4f tests: a busy machine cuts the install wait's rounds short (red: the wait reads the real clock) 2026-11-22 10:38:53 +01:00
feder-cr ce65951227 tests: the type a process was given is read for the process instance, not for the pid alone
remote_types read the engine's child logs in the order of their names (child-10 before child-2) and kept the last
type per pid, so a pid reused by a later content process could be read as the site of the ended one and the waits
for "no process of the site is left" never became true. The lines are now stamped with the time MOZ_LOG logs, ordered
by it (then by child number as a number), and a process takes only the types logged at or after its own creation time.
Unit tests with fake logs: reused pid, child-10 against child-2.
2026-11-22 10:36:04 +01:00
feder-cr 766961dcdb tests: steady e2e of the characterization round (download without options, shutdown ping, dom iterables, windows TEMP)
- test_a_context_without_download_options_is_left_to_firefox: Firefox's own save no longer runs the download reputation check; the time until the file landed is recorded (not judged)
- test_the_shutdown_ping...: the sender is given 120 s (_profile.SENDER_GRACE) and the session's safety net follows, so the verdict waits for it to end by itself
- test_dom_iterables_from_evaluate_e2e: one browser per case
- e2e.yml: TEMP and TMP on D:\a\_temp in the Windows jobs, as the engine series' gate
2026-11-22 10:19:58 +01:00
feder-cr eb203fc58c tests: the Marionette port is the one the browser got, and the language worker test waits on each content process
- the browsers of the e2e tests are launched with marionette.port 0 and the port is read from <profile>/MarionetteActivePort
  (webfont_probe.marionette_active_port): no port is freed for a browser to take, so a neighbour cannot bind it first
- the worker with its own language is read after a process script has read intl.accept_languages in the content process of each tab
- the script cache test keeps the file size of the sample that matched
2026-11-22 10:17:18 +01:00
feder-cr 3f4ee5c61e tests: the focus and fullscreen window tests judge after the event, not after a pause
The focus test is wall_clock (it runs alone, after the parallel tests), its two
sessions share a private Xvfb on Linux, and before judging it reads from the OS
that the focus is where the step says (X input focus, GetForegroundWindow on
Windows); "no blur" is judged after that and a round trip to the page's process
instead of a two-frame pause.

The fullscreen test waits for the condition itself with the engine on (declared
size, display-mode fullscreen, fullscreenElement) and for fullscreenchange and
the following resize with it off; on Windows it reads the monitor first and
declares a size that is not the monitor's.
2026-11-22 10:17:09 +01:00
feder-cr 5d0be75316 tests: the occlusion test puts the covering in place on Windows and checks it as the tracker reads it
WinWindowOcclusionTracker marks a window OCCLUDED only when the windows above
it in the Z-order cover its rectangle, the second session's window lands above
the first only if the system lets its process take the foreground, and a move
of another process's window is heard only once that process was seen with a
visible window. Opening the second window left all three to the runner: red in
one Windows run, green in two. On Windows the test now moves the first window
right under the second, inside its rectangle (a maximized window counts as its
work area), with SWP_NOACTIVATE; that move is the tracker's own signal. Before
waiting it checks the cover is visible, uncloaked, opaque, not a popup, above
the first window and containing it, and a red names what did not hold.
2026-11-22 09:25:11 +01:00
feder-cr dbd2022e34 tests/test_a_page_that_moves_on_e2e.py: a failing read-after-goto round leaves the client log, Juggler wire, engine trace and server record 2026-11-22 07:23:08 +01:00
feder-cr ac5a519244 tests: every proxy of the tests that could forward outside the lab carries only the lab's destinations
The base Gateway of _socks_servers (CONNECT relay and UDP relay, tcp_from_exit included), Socks5TcpOnly
and the SOCKS5 server of test_proxy_socks_auth_e2e refuse and record any destination that is not the
lab's (loopback, the documentation ranges, the addresses of this host's interfaces, localhost): a
CONNECT is answered with reply 2, a datagram is dropped, and the refusal is written down (time since the
gateway started, address type, destination as received, port, protocol) under
$RUNNER_TEMP/invpw-evidence/<gateway>/, always, when the gateway is closed. forward_only_to only narrows.
The gateway of test_ipv6_literal_connect_e2e reuses the base behaviour and keeps its evidence.
New unit test with known-bad inputs; the two unit rows of the registry name it.
2026-11-22 07:12:32 +01:00
feder-cr f5d2ec81f9 Merge remote-tracking branch 'origin/char69/network' into tests/characterization-69 2026-11-22 06:41:14 +01:00
feder-cr 6d1bd1047b ci: the whole-e2e suite holds the characterization tests, the adapted Windows tests leave the exclusions, a third Linux row
The 35 new e2e files of the characterization branch are in one row of each system (balanced on the junits of runs 44942540063 and 44985244053, about 9.4 minutes of estimated wall time per Linux row, 10.2 per Windows row, 4 browsers). The four tests adapted to Windows (the headed popup, two fission process-name tests, the service-worker process test) are no longer excluded and are named by their files in the Windows rows. Linux gets wrapper.e2e.suite.linux.3.
2026-11-22 06:40:46 +01:00
feder-cr ac75085d10 tests: the ipv6 literal gateway records every CONNECT with time since launch, address type, destination as received and port 2026-11-22 06:31:57 +01:00
feder-cr 8ab1d3d68a Merge remote-tracking branch 'origin/ci/e2e-suite-on-candidate' into tests/characterization-69 2026-11-22 06:31:29 +01:00
feder-cr b58edbf367 Merge remote-tracking branch 'origin/char69/fakeweb' into tests/characterization-69 2026-11-22 06:31:29 +01:00
feder-cr aad5ac38da Merge remote-tracking branch 'origin/char69/skips' into tests/characterization-69 2026-11-22 06:31:29 +01:00
feder-cr ac62151198 Merge remote-tracking branch 'origin/char69/secstate' into tests/characterization-69 2026-11-22 06:31:28 +01:00
feder-cr 94fd5740c8 Merge remote-tracking branch 'origin/char69/screen' into tests/characterization-69 2026-11-22 06:31:28 +01:00
feder-cr 174c6b8b88 Merge remote-tracking branch 'origin/char69/platform' into tests/characterization-69 2026-11-22 06:31:28 +01:00
feder-cr 4bf9b5e009 tests: the ICE host candidates test leaves: in the product configuration a page reads only mDNS names, and what depends on the declaration is already asserted by test_declared_host_network_e2e.py 2026-11-22 06:31:28 +01:00
feder-cr 0af776766a tests: a generation of the security state that does not exit 0 saves the engine's stderr, the profile's files and, on Linux, the gdb backtrace of the core it left (e2e.yml installs gdb and points kernel.core_pattern at a folder) 2026-11-22 06:23:53 +01:00
feder-cr f5234742e6 tests: the ipv6 literal e2e gateway forwards nothing outside the lab; assert the CONNECT shape, not a count 2026-11-22 06:19:23 +01:00
feder-cr 07018c00b7 tests: the script cache test keeps every amount the two preloaders report under a path (the parent's scriptCache.bin and the child's scriptCache-child.bin share the reporter paths) and records the files of startupCache/ in each assertion message 2026-11-22 06:18:45 +01:00
feder-crandClaude Sonnet 5.5 b37287094e tests: the closed-context service-worker process test runs on Windows (process types from the engine log) instead of skipping
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 06:18:19 +01:00
feder-cr 4d97eae291 tests: the closed-context process test judges by the processes that host the frames' sites, not by a count
The count of content processes holds the preallocated pool and what the browser starts for itself, so it moved with whatever ran beside the test (gate run on Windows: [9, 9] while open, [9] after). The test now waits until the processes that host the sites of the frames (B and C) exist while the context is open, and until none is left once it is closed: by the name of the process on Linux, by the remote type the engine logs on Windows.
2026-11-22 05:49:03 +01:00
feder-cr a4e6c8f56d tests: a popup naming only left reads that x and the declared default y 2026-11-22 05:48:26 +01:00
feder-cr 435d261ce4 test(fakeweb): evidence helper with LF endings 2026-11-22 05:38:54 +01:00
feder-cr 8a42ed3676 test(fakeweb): the networkidle-under-load case saves its evidence when it fails
On failure only, into RUNNER_TEMP/invpw-evidence/fakeweb-leaving-beacons-under-load/: the fake web's own record of every
connection and request (arrival, answer, error), the client's log of every request, the Juggler wire of the served browser,
the engine's Juggler trace (INVISIBLE_JUGGLER_TRACE_DIR) and the cells. No assertion, wait or deadline changes.
2026-11-22 05:32:57 +01:00
feder-cr 2c6a93900f tests: the headed popup test and the two process-by-site bench tests run on Windows instead of skipping
The headed window.open test asked for DISPLAY, which Windows never has: it now asks for it only off Windows.
The bench tests found a site's process by its name, which only Linux sets: on Windows they read the remote type the
engine logs for every process it creates (MOZ_LOG Process) and count the live content processes of that site.
2026-11-22 05:29:42 +01:00
feder-cr 756f722d40 Merge remote-tracking branch 'origin/char69/platform' into tests/characterization-69 2026-11-22 05:22:56 +01:00
feder-cr 215f552a10 ci: the whole e2e suite as seven rows of the gate (linux 1-2, windows 1-4, control_a), run on the candidate's binary by scripts/ci_suite_run.py
The rows are balanced on the test times of run 44942540063 and exact; the Windows parts of e2e.yml read them instead of taking every fourth file.
tests/test_the_e2e_suite_is_accounted_for.py holds every e2e test in one row of each system or in a named exclusion.
2026-11-22 05:14:46 +01:00
feder-cr 98da306330 tests: the warm session's script cache is compared with the file left on disk when the fresh session ended (a rewrite at shutdown replaces the adopted one) 2026-11-22 05:02:50 +01:00
feder-cr b14f479e09 Merge remote-tracking branch 'origin/char69/icehost' into tests/characterization-69 2026-11-22 04:59:24 +01:00
feder-cr af48556777 Merge remote-tracking branch 'origin/char69/platform' into tests/characterization-69 2026-11-22 04:59:23 +01:00
feder-cr 5776836ab6 tests: the DOM iterables that firefox-68 iterates from evaluate stay; the WebGPU features case keeps its red proof on its branch 2026-11-22 04:59:23 +01:00
feder-cr da0720364a tests: a page with a media permission reads the declared network in its ICE host candidates (characterization of firefox-68) 2026-11-22 04:47:24 +01:00
feder-cr c3295c5b12 tests: the launch counter test reads browser/omni.ja with the core's jar reader (Mozilla's optimized jar is refused by zipfile on Windows) 2026-11-22 04:43:43 +01:00
feder-cr a7b1acf732 tests: iterating DOM iterables from page.evaluate, one case each 2026-11-22 04:42:13 +01:00
feder-cr 8d6d6ae208 Merge remote-tracking branch 'origin/char69/platform' into tests/characterization-69 2026-11-22 04:04:03 +01:00
feder-cr 194ae6f042 Merge remote-tracking branch 'origin/char69/automation' into tests/characterization-69 2026-11-22 04:04:03 +01:00
feder-cr dee362ea02 Merge remote-tracking branch 'origin/char69/mediajs' into tests/characterization-69 2026-11-22 04:04:03 +01:00
feder-cr f8e5ff8700 Merge remote-tracking branch 'origin/char69/locale' into tests/characterization-69 2026-11-22 04:04:03 +01:00
feder-cr e8b3efa8c9 Merge remote-tracking branch 'origin/char69/screen' into tests/characterization-69 2026-11-22 04:04:02 +01:00
feder-cr b02f74ed58 Merge remote-tracking branch 'origin/char69/window' into tests/characterization-69 2026-11-22 04:04:02 +01:00
feder-cr b48592587f tests: the popup frame control is a second declared frame (the engine off reads the host's own frame on Windows) 2026-11-22 03:51:47 +01:00
feder-cr 66e5b75cb6 tests: the launch counter's address is read from the engine's module in the binary, the shutdown ping goes to an allowed host (a refused host is a control), the warm session's script cache is moved aside until rewritten 2026-11-22 03:51:20 +01:00
feder-cr 8e4be5b67d tests: a goto to a refused port waits for the error page's navigation before the next goto starts 2026-11-22 03:51:20 +01:00
feder-cr 69a9c60328 tests: escape the line breaks of the native-endings probe; the branding test reads only chrome://, the one place a page can load 2026-11-22 03:50:27 +01:00
feder-cr 2b9858570a tests: the second window session runs in a thread of its own (no sync client inside another one's loop) 2026-11-22 03:48:00 +01:00
feder-cr bd71ac2026 tests: leave out of the locale characterisation what the product cannot do or the 68 engine does not do (running-worker language change, worker canvas group, shared and service worker Accept-Language) 2026-11-22 03:47:58 +01:00
feder-cr cba46aa042 Merge remote-tracking branch 'origin/char69/platform' into tests/characterization-69 2026-11-22 00:18:02 +01:00
feder-cr 55ce95a1ad Merge remote-tracking branch 'origin/char69/window' into tests/characterization-69 2026-11-22 00:18:01 +01:00
feder-cr a837e63a08 Merge remote-tracking branch 'origin/char69/webglread' into tests/characterization-69 2026-11-22 00:18:01 +01:00
feder-cr 70f81bbb3a Merge remote-tracking branch 'origin/char69/automation' into tests/characterization-69 2026-11-22 00:18:01 +01:00
feder-cr 3a67051a92 Merge remote-tracking branch 'origin/char69/locale' into tests/characterization-69 2026-11-22 00:18:01 +01:00
feder-cr 112607291a Merge remote-tracking branch 'origin/char69/screen' into tests/characterization-69 2026-11-22 00:18:01 +01:00
feder-cr 38fb8b6877 Merge remote-tracking branch 'origin/char69/mediajs' into tests/characterization-69 2026-11-22 00:18:00 +01:00
feder-cr 2703b5fc97 Merge remote-tracking branch 'origin/char69/audiohw' into tests/characterization-69 2026-11-22 00:18:00 +01:00
feder-cr 323d272a32 tests: negative controls with the engine off or another declared screen, second sync client in a thread of its own 2026-11-21 23:56:27 +01:00
feder-cr b7f974788a tests: negative controls with the engine off or another declared screen, second sync client in a thread of its own 2026-11-21 23:51:23 +01:00
feder-cr 3f372e4675 tests: the WebGPU adapter is read in the page realm, where the features iterate 2026-11-21 23:47:53 +01:00
feder-cr a9ec63caed tests: the fullscreen test pins the device pixel ratio with the screen 2026-11-21 23:47:27 +01:00
feder-cr c3dad8b9e9 tests: the WebGL noise control keeps the engine on and declares only the canvas noise off 2026-11-21 23:47:10 +01:00
feder-cr 50f2e53c9c tests: the click on a download left to Firefox does not wait for a navigation, the file does 2026-11-21 23:46:42 +01:00
feder-cr 0a0a2f4efd tests: negative controls with the engine off or another declared screen, second sync client in a thread of its own 2026-11-21 23:46:02 +01:00
feder-cr 8add8e4a42 tests: the locale of a live context is changed through the product's Juggler command; the canvas test records every measure 2026-11-21 23:44:28 +01:00
feder-cr 89c7d3be3b Merge remote-tracking branch 'origin/char69/platform' into tests/characterization-69 2026-11-21 21:28:04 +01:00
feder-cr 241d156f1f Merge remote-tracking branch 'origin/char69/automation' into tests/characterization-69 2026-11-21 21:28:04 +01:00
feder-cr d6dc3bf0ba Merge remote-tracking branch 'origin/char69/mediajs' into tests/characterization-69 2026-11-21 21:28:04 +01:00
feder-cr 74deb6a060 Merge remote-tracking branch 'origin/char69/locale' into tests/characterization-69 2026-11-21 21:28:04 +01:00
feder-cr fa735a74e7 Merge remote-tracking branch 'origin/char69/window' into tests/characterization-69 2026-11-21 21:28:03 +01:00
feder-cr d6498e527b Merge remote-tracking branch 'origin/char69/screen' into tests/characterization-69 2026-11-21 21:28:03 +01:00
feder-cr 92712b1658 Merge remote-tracking branch 'origin/char69/audiohw' into tests/characterization-69 2026-11-21 21:28:03 +01:00
feder-cr ab3247d359 Merge remote-tracking branch 'origin/char69/fonts' into tests/characterization-69 2026-11-21 21:28:03 +01:00
feder-cr 4bf642a58a Merge remote-tracking branch 'origin/char69/canvasreaders' into tests/characterization-69 2026-11-21 21:28:03 +01:00
feder-cr 360a22887f Merge remote-tracking branch 'origin/char69/webglread' into tests/characterization-69 2026-11-21 21:28:02 +01:00
feder-cr 2d31ecdfff Merge remote-tracking branch 'origin/char69/webglparams' into tests/characterization-69 2026-11-21 21:28:02 +01:00
feder-cr 6b67a514e5 tests: characterise the script cache, the launch counter, the shutdown ping, the geolocation of the host and the WebGPU adapter on firefox-68 2026-11-21 21:21:31 +01:00
feder-cr f42d5ecd26 tests: characterize automation hooks on firefox-68 (download cancel and no-options control, refused port goto, element atoms, hybrid xray control and cross-origin handover) 2026-11-21 21:19:32 +01:00
feder-cr 1f06722137 Characterize the readers of a WebGL/WebGPU canvas and the as-drawn painter on firefox-68
Five e2e tests written before the hooks of fingerprint/canvas/noise-projection and
fingerprint/canvas/as-drawn are redone: every reader of a WebGL element, an
OffscreenCanvas and a transferred placeholder gives the same noised bytes; a WebGPU
canvas reads noised through toDataURL and toBlob; -moz-element paints a WebGL canvas
as drawn. Each carries its control in the same test (canvas noise declared off).
2026-11-21 20:56:43 +01:00
feder-cr 9f91d752e4 tests: characterise the language and zone of workers, worklets, canvases, the page realm and every request kind (firefox-68) 2026-11-21 20:56:29 +01:00
feder-cr c820dd50f9 tests: characterize the bundle-only font list, src:local names, regional-indicator measureText, vertical text metrics and createPattern projection on firefox-68 2026-11-21 20:54:54 +01:00
feder-cr 20af8c4509 tests: characterize window occlusion, fullscreen without a window manager, and focus on OS deactivation (e2e, firefox-68) 2026-11-21 20:52:11 +01:00
feder-cr c6d3ded241 tests: characterisation e2e for screen, popup geometry, iframe click origin and css-media hooks 2026-11-21 20:52:05 +01:00
feder-cr 11db0d50b5 tests: characterize the declared WebGL parameters and the shader language on firefox-68 2026-11-21 20:52:05 +01:00
feder-cr 194035dec5 tests: characterise the WebGL readback roads (PBO, captureStream, partial rectangle, non-premultiplied) 2026-11-21 20:51:54 +01:00
feder-cr 79b46cc0a2 Characterization e2e of the media enumeration, voice URIs, eval name, native line endings and branding on firefox-68 2026-11-21 20:50:35 +01:00
feder-cr 8c926d9551 tests: characterize audio noise, audio context values, sample rate and hardware declarations on firefox-68 2026-11-21 20:48:55 +01:00
feder-cr c65828d809 tests: characterize the IPv6 literal gate of firefox-68 (direct refused, mapped refused, SOCKS destination left to the proxy) 2026-11-21 20:37:26 +01:00
Federico Elia 5d84475d98 record 0.58.0 as published (#553) 2026-11-21 12:37:30 +01:00
Federico Elia 0d3a710c02 Release 0.58.0: invisible-core 68.80.0 on firefox-68 (the security state of a retail profile) (#552)
* security state: fetch has the engine generate it, every launch gives the core its engine, and CI launches with a fixed ready directory

The core replaced the intermediates list with the security state (intermediates, OneCRL and the CRLite filters, generated by the engine and copied into every profile). The CLI's fetch calls update_security_state(engine=<the binary it installed>); server.py's one write_user_js passes engine=<the executable of the launch> (no engine_argv: a generation is its own headless run, the core's default line). STEALTHFOX_SECURITY_STATE replaces STEALTHFOX_INTERMEDIATES in every workflow that launches the browser (scripts/ci_lab_security_state.py, ci/security-state/ with a result and no data, pinned by sha256); the unit tests' conftest patches ensure_security_state.

Tests: tests/test_cli.py (fetch), tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py, tests/test_ci_lab_security_state.py, tests/test_ci_workflows_set_the_security_state.py, each red on the code of main.

* e2e: the engine's security state - generation, a normal launch, a certificate revoked in a CRLite delta refused at the first navigation, a launch with no state

wrapper.e2e.securitystate, both legs, in the candidate's wrapper-e2e job: the engine launched directly in its generate mode (exit, the contract's keys, the hashes are the sha256 of the files, the bytes of security_state/) and through the core's generate; a normal launch writes no security-state pref and re-imports nothing; with Mozilla's CRLite test filters and a CA on Mozilla's default test key, a leaf with the serial and SCTs of revoked-in-delta.example.com is refused with SEC_ERROR_REVOKED_CERTIFICATE at the first navigation, a valid one loads, and the revoked one loads with no state; a launch with no or an empty state starts. Red on firefox-67 (no generate mode); the last test is a guard.

* ci: the required list only grows, so the two test files of the intermediates lab keep their names and guard that the old road stays gone

The judge of main refused the list of the branch: wrapper.unit.all.* lost tests/test_ci_lab_intermediates.py and tests/test_ci_workflows_set_the_intermediates_list.py. Both files come back with tests that the lab's files and steps are gone and that every leg that had the step sets the security state (red on main, 5 of 5). The unit suites count what the candidate collected (2183 and 2184) plus these 5: 2188 on Linux, 2189 on Windows.

* ci: the unit rows count what the candidate's gate collected (2168 linux, 2169 windows)

* Release 0.58.0: invisible-core 68.80.0 on firefox-68 (the security state of a retail profile)

* test: the frames of a goto are counted once all are announced, within the goto's own deadline

With Fission the innermost frame of a-b-a lives in a third process and its
announcement may reach the client after the top document's load (2 of 3
frames 0.22 s after the goto, run 44888497316). A frame that never comes
is still red.
2026-11-21 11:12:31 +01:00
Federico Elia 4c7faecde0 tests: the close-loop verdict counts the replies that arrive inside the close, and says where a silent browser was (#550)
The corsa 44856198702 (Windows) was red with replies [47, 0, 46] inside the close: the second browser's engine did not run for the
whole close while the loop read the other two. The verdict asked every browser for a call that BEGAN and ENDED inside the close, so a
single call that straddled the whole close turned a machine that did not run an engine into "the loop did not run".

- the pinger records the spans of its calls and the call still waiting; the test prints the close's duration, the replies that arrived
  inside it, the calls inside it, and the spans that touched it;
- a browser answered during the close when a reply ARRIVED while it was in flight, whenever its call began;
- a browser silent inside the close is red only if the watcher saw the loop's thread inside a step of the close that waits, or if no
  browser answered at all; "all three answer while the removal is held" stays with `during_removal`;
- unit tests: a held loop is red, one silent engine with a free loop is green (the 47/0/46 of the corsa), a straddling call counts, the
  client's own pinger on a scripted page; required-suites: wrapper.unit.all +6 (37 -> 43 in the verdicts file), e2e count unchanged.
2026-11-21 08:59:56 +01:00
Federico Elia f84f83f17d tests: the witness counts only what comes from this host (#551)
* tests: the witness counts as the browser only a source that is an address of this host

* ci: the unit rows that hold the witness test count its four new tests
2026-11-21 08:26:41 +01:00
Federico Elia 2b68ae3adf tests: each engine gate waits for the release that carries its property (68 vs 69) (#548)
* The accumulated line's tests wait for firefox-69, not for the release being made

firefox-68 now carries only the core's in-memory caches, the security-state
files, the held cut of a committed navigation (networkidle), the Juggler trace
and MOZ_LOG modules, and TEMP on D:. The 18 gates on firefox-68 of the 15 test
files of the accumulated line (idwr canvas text, empty fontconfig, ucrt maths,
WebGL blending and ALU, WebCodecs, system fonts and colours, the canvas colour
profile, WebGL2 without Mesa) move to firefox-69. test_a_page_that_moves_on_e2e
keeps its firefox-68 gate.

tests/data/engine_gates.json states for each release from firefox-68 on what it
carries and which test files wait for it; tests/unit/test_engine_at_least.py
reads every engine_at_least / engine_reaches call and fails when a gate names a
release the registry does not put that file in (red on the old gates, green now).
The two unit rows of ci/required-suites.json go up by the 5 new tests.

* Delete the 15 tests of the cancelled backlog, with what exists only for them

The accumulated line (firefox-69) is not the backlog any more: its 15 e2e tests prove
functions that were deleted, and a test no round runs is deleted, not left off.

Out with them: the six unit tests that only read their references or helpers, the
reference data (canvas text and ICC, ucrt sweeps, system theme, WebCodecs streams), the
scripts that built them and the shared canvas helper. tests/data/engine_gates.json keeps
only firefox-68. The strace stand-in that the fontconfig cache test imported from one of
the deleted files moves to tests/_strace_stand_in.py. The two rows of the unit suite lose
those files and 41 tests.

* The fake web's case under load waits for firefox-68, where the held cut of networkidle is fixed
2026-11-21 04:04:49 +01:00
Federico Elia 6c800e7fa0 The judge lets a test leave a row only by a retired list that main holds (#549)
A test that is deleted because its feature is cancelled cannot stay in the rows, and the
judge, reading main, called every such deletion a lost test and a lower minimum.
ci/retired-tests.json, read from main next to main's list (never from the judged branch),
names the files that may go: each with its reason, its date and the number of tests it had
in each row. A retired file that no longer exists leaves its row without being counted as
lost, and the minimum of the row may go down by exactly those tests. A retired file still
on disk, a file main did not retire and a minimum lowered by more all stay red. The ten
files of the cancelled backlog that the unit rows name are the first entries; a test checks
that the declared counts are what the collection gives while a file exists.
2026-11-21 02:45:40 +01:00
175 changed files with 15156 additions and 17895 deletions

No files matched your search

+39 -32
View File
@@ -113,12 +113,19 @@ jobs:
sudo apt-get install -y xvfb
# the fontconfig e2e trace the opens of the browser: strace is not in the runner image (setsid is, util-linux)
sudo apt-get install -y strace
# TEMPORARY (the -11 at the exit of the security state's generate): a core file of any crash where kernel.core_pattern says, and gdb to read it. tests/conftest.py
# lifts the core limit of the pytest session (the runner's default soft limit is 0) and, after a test that fails, tests/_crash_cores.py saves gdb's text of every
# core in INVPW_CORE_DIR under invpw-evidence/cores/<test>/ and deletes the core.
sudo apt-get install -y gdb
mkdir -p "$RUNNER_TEMP/invpw-cores"
sudo sysctl -w kernel.core_pattern="$RUNNER_TEMP/invpw-cores/core.%e.%p"
echo "INVPW_CORE_DIR=$RUNNER_TEMP/invpw-cores" >> "$GITHUB_ENV"
sudo "$(which python)" -m playwright install-deps firefox
# The preloaded-intermediates list is a file of the repository (ci/intermediates.json, empty, the sha256 in ci/intermediates.pin.json): with
# STEALTHFOX_INTERMEDIATES set the core neither downloads nor checks Mozilla's. BEFORE `fetch`, which makes the list present (it would download it).
- name: The intermediates list (a fixed file of the repository)
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
- name: The protocol mirror agrees with the engine it is pinned to
@@ -318,6 +325,11 @@ jobs:
if: needs.core-on-index.outputs.available == 'true'
runs-on: windows-latest
timeout-minutes: 20
# TEMP and TMP on D:\a\_temp (the runner's temp folder): the Firefox profiles land in TEMP and on C: they saturate the disk (queue up to 144,
# latencies up to 4 s, parent main thread still 40-60 s). On the job, not in a step: `runner.temp` is not readable in a job's `env`.
env:
TEMP: 'D:\a\_temp'
TMP: 'D:\a\_temp'
# `run:` blocks are PowerShell on Windows unless said otherwise (e2e-hunt.yml had a ParserError on its first launch there).
defaults:
run:
@@ -331,11 +343,11 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
# The intermediates list of the repository (ci/intermediates.json, empty): with STEALTHFOX_INTERMEDIATES set the core asks Mozilla for nothing.
# BEFORE `fetch`, which makes the list present (it would download it).
- name: The intermediates list (a fixed file of the repository)
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
- name: The keyboard shortcut selects all (the browser opens on the runner's desktop, as in e2e-hunt.yml)
@@ -345,15 +357,22 @@ jobs:
# THE SAME e2e ON WINDOWS (Federico, 12/11: every test of the product runs on Linux AND Windows; where Windows behaves
# differently the test adapts to the system). Before this, 562 of the 808 e2e had never run on Windows in any round. The census
# of 12/11 (run 43307193708) took ~50 minutes in one job, so the files are split in four parts (the sorted list, every fourth
# file: a split that does not move when a file is added elsewhere). Left out, by name, are the suites ci/required-suites.json
# declares `linux_only` (the reason is on the row); tests/test_every_suite_runs_on_linux_and_windows.py holds both together.
# of 12/11 (run 43307193708) took ~50 minutes in one job, so the files are split in four parts: the rows `wrapper.e2e.suite.windows.1`
# to `.4` of ci/required-suites.json, balanced on the test times measured on Windows (a split that does not move when a file is added
# elsewhere: a new file is added by hand to a row). Left out of the rows, by name, are the suites ci/required-suites.json declares
# `linux_only` (the reason is on the row) and the tests that skip on Windows; tests/test_the_e2e_suite_is_accounted_for.py holds the
# partition whole and tests/test_every_suite_runs_on_linux_and_windows.py holds both systems together.
e2e-windows:
name: e2e (windows, part ${{ matrix.part }})
needs: core-on-index
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
runs-on: windows-2022
timeout-minutes: 40
# TEMP and TMP on D:\a\_temp (the runner's temp folder): the Firefox profiles land in TEMP and on C: they saturate the disk (queue up to 144,
# latencies up to 4 s, parent main thread still 40-60 s). On the job, not in a step: `runner.temp` is not readable in a job's `env`.
env:
TEMP: 'D:\a\_temp'
TMP: 'D:\a\_temp'
strategy:
fail-fast: false
matrix:
@@ -371,33 +390,21 @@ jobs:
python -m pip install --upgrade pip
python -m pip install ".[dev]"
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)"
# The preloaded-intermediates list is a file of the repository (ci/intermediates.json, empty, the sha256 in ci/intermediates.pin.json): with
# STEALTHFOX_INTERMEDIATES set the core neither downloads nor checks Mozilla's. BEFORE `fetch`, which makes the list present (it would download it).
- name: The intermediates list (a fixed file of the repository)
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(cd "$RUNNER_TEMP" && python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
# The GeoIP database made by the repository, as on the Linux run (no download, the same bytes every run).
- name: The GeoIP database (made by the repository, same bytes every run)
run: python scripts/ci_lab_geoip.py build
- name: The files of this part, without the linux_only suites
run: |
set -e
python -m pytest --collect-only -q -m e2e -o addopts= -p no:cacheprovider 2>/dev/null | grep "::" | cut -d: -f1 | sort -u > "$RUNNER_TEMP/e2e_files.txt"
python - "${{ matrix.part }}" "$RUNNER_TEMP" <<'PY'
import json, os, sys
part, tmp = int(sys.argv[1]), sys.argv[2]
rows = json.load(open("ci/required-suites.json", encoding="utf-8"))
left_out = [t for r in rows if r.get("linux_only") for t in r["tests"]]
files = [l.strip() for l in open(os.path.join(tmp, "e2e_files.txt")) if l.strip()]
files = [f for f in files if f not in left_out]
mine = [f for i, f in enumerate(files) if i % 4 == part - 1]
nodes = [t for t in left_out if "::" in t and t.split("::")[0] in mine]
open(os.path.join(tmp, "e2e_args.txt"), "w").write("\n".join(mine + ["--deselect=" + n for n in nodes]) + "\n")
print("%d e2e files, %d left out as linux_only, %d in part %d, %d node(s) deselected"
% (len(files) + len([t for t in left_out if "::" not in t]), len(left_out), len(mine), part, len(nodes)))
PY
# The files of the part are the rows `wrapper.e2e.suite.windows.N` of ci/required-suites.json (files, and node ids where a file has tests that skip on
# Windows or run in another suite): the same list the gate of the candidate runs on the engine under test, so what is measured here and there is one
# partition. tests/test_the_e2e_suite_is_accounted_for.py holds it whole, and the suites declared `linux_only` are left out of it by name.
- name: The files of this part (the row of the suite, in ci/required-suites.json)
run: python scripts/ci_verdict.py args --required ci/required-suites.json --suite "wrapper.e2e.suite.windows.${{ matrix.part }}" --os windows > "$RUNNER_TEMP/e2e_args.txt"
- name: Run this part of the e2e
env:
PYTHONUNBUFFERED: "1"
+4 -4
View File
@@ -88,10 +88,10 @@ jobs:
sudo "$(which python)" -m playwright install-deps firefox
- name: Playwright's own Firefox (the control)
run: python -m playwright install firefox
# The preloaded-intermediates list is a file of the repository (ci/intermediates.json, empty, the sha256 in ci/intermediates.pin.json): with
# STEALTHFOX_INTERMEDIATES set the core neither downloads nor checks Mozilla's. BEFORE `fetch`, which makes the list present (it would download it).
- name: The intermediates list (a fixed file of the repository)
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(cd "$RUNNER_TEMP" && python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
# The GeoIP database made by the repository (no download, the same bytes every run).
@@ -0,0 +1,457 @@
# ─────────────────────────────────────────────────────────────────────────────
# intermittent-68-suite-cores-hunt.yml - a HUNT for the intermittent e2e of firefox-68, in the context that reproduces them: the WHOLE e2e suite, on the load
# of the whole suite, with the cores of any crash read by gdb. It is NOT a gate, it is never merged to main (it lives on the branch
# `hunt/intermittent-68-suite-cores` and is deleted with it), and no result of it counts as green for anything: a green hunt proves nothing about a release,
# a red one is evidence to read.
#
# What it runs. The Linux job of .github/workflows/e2e.yml on this branch, as that file runs it, ROUNDS (3) times in sequence per job, and it never stops at a
# red: three identical copies (the whole suite under xvfb-run without the root and the sandbox files, then the root step and the sandbox step, as e2e.yml
# runs them). No Windows, no one-file security-state job. Left out on purpose: the gate that waits for the core on the index. Same runner, same install, same
# security state, same fetch, same GeoIP database, same scripts/run_e2e.py with its own width (-n), its own deadline and no rerun of any kind.
# The job linux-3-loaded also runs, DURING the main run of every round, 4 background loops of tests/test_security_state_engine_e2e.py::
# test_the_engine_generates_the_security_state_it_is_given (see "THE BACKGROUND LOOPS" in the step): the -11 of the generation did not happen alone, only
# inside the suite. A red iteration, or a core of a background engine, makes the job red; the summary lists node, iteration and engine exit code.
# What this branch adds to the tests: tests/conftest.py raises RLIMIT_CORE and, after a test that fails, tests/_crash_cores.py has gdb read every core in
# $INVPW_CORE_DIR (gdb, kernel.core_pattern and INVPW_CORE_DIR are set in the system-deps step, as in e2e.yml); the gdb texts are in
# invpw-evidence/cores/<test>/, which moves with invpw-evidence into round-N.
#
# Each round leaves, in $RUNNER_TEMP/hunt/round-N/: the junit of the round, the evidence the tests save on failure (invpw-evidence, with the gdb texts of
# the cores), the watchdog file, the log of the round and the junit of the root and sandbox steps. The browsers left over are closed between rounds.
# hunt-summary.md (also in the job summary) has one line per round (passed, failed, errors, skipped) and the failed node ids with the first line of each
# message. A job is red when any round has a failure or an error, when a round produced no junit, or when the shell broke.
#
# Triggered ONLY by a push to `hunt/intermittent-68-suite-cores`: no schedule, no dispatch, no pull request.
# ─────────────────────────────────────────────────────────────────────────────
name: intermittent 68 suite cores hunt
on:
push:
branches: [hunt/intermittent-68-suite-cores]
permissions:
contents: read
# A newer push to the hunt branch replaces the run it supersedes.
concurrency:
group: intermittent-68-suite-cores-hunt-${{ github.ref }}
cancel-in-progress: true
# Engine and GeoIP downloads go through the release API with this token (as every workflow that runs tests).
env:
GITHUB_TOKEN: ${{ github.token }}
jobs:
hunt:
name: suite cores hunt ${{ matrix.label }}
runs-on: ubuntu-24.04
# Up to 6 rounds of the whole suite plus the install: the ceiling is the longest a hosted job may run.
timeout-minutes: 360
strategy:
fail-fast: false
max-parallel: 3
matrix:
include:
- label: linux-1
temp: /tmp
- label: linux-2
temp: /tmp
- label: linux-3-loaded
temp: /tmp
load: secstate-x4
env:
TEMP: ${{ matrix.temp }}
TMP: ${{ matrix.temp }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
python -m pip install "playwright==$(cat scripts/playwright_pin.txt)"
- name: System deps (xvfb + Firefox runtime libs)
run: |
sudo apt-get update
sudo apt-get install -y xvfb
sudo apt-get install -y strace
sudo apt-get install -y gdb
mkdir -p "$RUNNER_TEMP/invpw-cores"
sudo sysctl -w kernel.core_pattern="$RUNNER_TEMP/invpw-cores/core.%e.%p"
echo "INVPW_CORE_DIR=$RUNNER_TEMP/invpw-cores" >> "$GITHUB_ENV"
sudo "$(which python)" -m playwright install-deps firefox
# The loaded job: 4 background loops run the engine from their own copy of its folder (/tmp/ffbg-K), and the name of a core carries the path of the executable
# (%E, slashes as '!'), so that the core of a background engine is told from the cores of the main run: tests/_crash_cores.py leaves the first to the loops.
- name: Core names carry the executable's path (loaded job)
if: matrix.load == 'secstate-x4'
run: sudo sysctl -w kernel.core_pattern="$RUNNER_TEMP/invpw-cores/core.%E.%p"
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one. BEFORE `fetch`, which makes the state present (it would download and generate it).
- name: The security state (a fixed directory of the repository)
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
- name: Fetch the published firefox binary
run: echo "FF=$(python -m invisible_playwright fetch | tail -1)" >> "$GITHUB_ENV"
# The GeoIP database made by the repository, as in e2e.yml (no download, the same bytes every run).
- name: The GeoIP database (made by the repository, same bytes every run)
run: python scripts/ci_lab_geoip.py build
- name: The suite, round after round
env:
PYTHONUNBUFFERED: "1"
# The number of rounds: the matrix's (40 for the one-file job), else 3, and never more than 6 for the whole suite or 100 for the one file (the script clamps it).
HUNT_ROUNDS: ${{ matrix.rounds || '3' }}
# `suite`: the e2e of e2e.yml (the Linux job or the Windows part); `secstate`: only tests/test_security_state_engine_e2e.py, on Linux.
HUNT_MODE: ${{ matrix.mode || 'suite' }}
# The loaded job (matrix.load): this many background loops of the generation of the security state run during the main run of every round; else none.
HUNT_BG: ${{ matrix.load == 'secstate-x4' && '4' || '0' }}
# No new round starts after this many seconds of the step, so that the artifact is uploaded before the job's ceiling.
HUNT_BUDGET_S: "19000"
HUNT_LABEL: ${{ matrix.label }}
# The watchdog of tests/conftest.py, as e2e.yml sets it for the run of the runner user (the junit of the run is written beside it).
HUNT_WATCHDOG: ${{ runner.temp }}/e2e-watchdog.log
# The Linux job of e2e.yml: the root files and the sandbox file are left out of the run and run in their own steps.
ROOT_FILES: tests/test_a_proxy_that_cannot_carry_udp_leaks_nothing_direct_e2e.py
ROOT_NODES: tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_before_the_tick
SANDBOX_FILES: tests/test_the_socket_process_is_sandboxed_e2e.py
ROOT_TESTS: "7"
SANDBOX_TESTS: "1"
run: |
# A step of a hunt that breaks must never end green: any error stops it, and the trap below turns a stop before the verdict into a red step.
set -euo pipefail
finished=0
trap 'if [ "$finished" != 1 ]; then echo "::error::the hunt step stopped before its verdict"; exit 1; fi' EXIT
if [ -z "${FF:-}" ] || [ ! -e "$FF" ]; then echo "::error::no engine binary (FF='${FF:-}')"; exit 1; fi
rounds="${HUNT_ROUNDS:-3}"
case "$rounds" in ''|*[!0-9]*) echo "::warning::HUNT_ROUNDS='$rounds' is not a number: 3 rounds"; rounds=3;; esac
if [ "$rounds" -lt 1 ]; then rounds=3; fi
most=6
if [ "$HUNT_MODE" = "secstate" ]; then most=100; fi
if [ "$rounds" -gt "$most" ]; then echo "::warning::HUNT_ROUNDS=$rounds is more than $most: $most rounds"; rounds=$most; fi
hunt="$RUNNER_TEMP/hunt"
mkdir -p "$hunt"
extras=()
if [ "$RUNNER_OS" = "Windows" ]; then
mapfile -t ARGS < <(tr -d '\r' < "$RUNNER_TEMP/e2e_args.txt")
elif [ "$HUNT_MODE" = "suite" ]; then
# What the restriction on user namespaces was, to put it back after the sandbox step of every round.
USERNS0="$(sysctl -n kernel.apparmor_restrict_unprivileged_userns 2>/dev/null || echo 1)"
extras=("root-e2e.xml=$ROOT_TESTS" "sandbox-e2e.xml=$SANDBOX_TESTS")
fi
# The reading of one round: "tests failures errors skipped junit-files problems" on the first line, then one line per red test (node id, first line of
# the message) and one per problem (a junit that is not there or not readable, an extra with the wrong number of tests).
cat > "$hunt/read_round.py" <<'PY'
import glob, os, sys, xml.etree.ElementTree as ET
sys.stdout.reconfigure(newline="\n")
rd = sys.argv[1]
exact = dict(a.split("=", 1) for a in sys.argv[2:])
files = sorted(glob.glob(os.path.join(rd, "e2e-junit-*.xml")))
problems, reds = [], []
tests = failures = errors = skipped = 0
if not files:
problems.append("no e2e-junit-*.xml in the round")
for name in sorted(exact):
path = os.path.join(rd, name)
if not os.path.exists(path):
problems.append("%s is not there" % name)
else:
files.append(path)
for path in files:
try:
root = ET.parse(path).getroot()
except Exception as exc:
problems.append("%s is not readable: %r" % (os.path.basename(path), exc))
continue
count = 0
for case in root.iter("testcase"):
count += 1
tests += 1
if case.find("skipped") is not None:
skipped += 1
for kind in ("failure", "error"):
bad = case.find(kind)
if bad is None:
continue
if kind == "failure":
failures += 1
else:
errors += 1
message = (bad.get("message") or bad.text or "").strip().splitlines()
reds.append("%s::%s [%s] | %s" % (case.get("classname"), case.get("name"), kind, (message[0] if message else "")[:300]))
want = exact.get(os.path.basename(path))
if want is not None and count != int(want):
problems.append("%s has %d tests, exactly %s were demanded" % (os.path.basename(path), count, want))
print(tests, failures, errors, skipped, len(files), len(problems))
for line in reds:
print("FAIL " + line)
for line in problems:
print("PROBLEM " + line)
PY
# Every browser left by a round is closed before the next one starts (and after the last).
reap() {
if [ "$RUNNER_OS" = "Windows" ]; then
powershell -NoProfile -Command "Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue" > /dev/null 2>&1 || true
else
pkill -9 -f "$(dirname "$FF")" > /dev/null 2>&1 || true
pkill -9 -f '[/]tmp/ffbg-' > /dev/null 2>&1 || true
sudo pkill -9 -f '[/]opt/ff' > /dev/null 2>&1 || true
pkill -9 Xvfb > /dev/null 2>&1 || true
fi
}
# THE BACKGROUND LOOPS (loaded job only): while the main run of a round goes on, HUNT_BG copies of the generation of the security state loop, each one pytest
# (-n 0) after the other until the round's main run ends. A loop has its own copy of the engine folder (/tmp/ffbg-K: the name of its cores says so), its own
# basetemp (the work dir of the test and the engine's profile are under it), its own RUNNER_TEMP (the evidence the test saves) and no INVPW_CORE_DIR (the hooks
# of tests/conftest.py touch nothing): after each iteration the loop reads and deletes the cores of ITS engine with gdb itself (tests/_crash_cores.py gdb_text).
cat > "$hunt/bg_cores.py" <<'PY'
import os, sys
from pathlib import Path
sys.path.insert(0, "tests")
import _crash_cores
coredir, mark, into = sys.argv[1], sys.argv[2], Path(sys.argv[3])
if coredir and os.path.isdir(coredir):
for core in sorted(p for p in Path(coredir).glob("core*") if p.is_file() and mark in p.name):
into.mkdir(parents=True, exist_ok=True)
print(_crash_cores.gdb_text(core, into))
core.unlink()
PY
cat > "$hunt/bg_loop.sh" <<'SH'
#!/usr/bin/env bash
# bg_loop.sh K ROUND_DIR STOP_FILE HUNT_DIR: one pytest after the other of the generation test until STOP_FILE exists. FF and INVPW_CORE_DIR come from the step.
k=$1; rd=$2; stop=$3; hunt=$4
d="$rd/secstate-bg-$k"
mkdir -p "$d"
bin="/tmp/ffbg-$k/$(basename "$FF")"
node="tests/test_security_state_engine_e2e.py::test_the_engine_generates_the_security_state_it_is_given"
n=0
while [ ! -e "$stop" ]; do
n=$((n + 1))
it="$d/it-$n"
mkdir -p "$it/rt"
echo "$n" > "$d/current"
t0=$SECONDS
env -u INVPW_CORE_DIR -u GEOIP_USED_OUT -u PYTEST_ADDOPTS RUNNER_TEMP="$it/rt" INVPW_TEST_WATCHDOG_FILE="$it/watchdog.log" \
STEALTHFOX_E2E_BINARY="$bin" INVPW_BINARY_PATH="$bin" \
python -u -m pytest "$node" -m e2e -n 0 -o addopts='' -o junit_family=xunit2 -q -p no:cacheprovider -p no:rerunfailures -rs \
--basetemp="$it/base" --junitxml="$it/e2e-junit-bg.xml" > "$it/log.txt" 2>&1
code=$?
secs=$((SECONDS - t0))
python "$hunt/bg_cores.py" "$INVPW_CORE_DIR" "!ffbg-$k!" "$it/cores" > "$it/cores.txt" 2>&1
ncores=$(grep -c '^core ' "$it/cores.txt")
python "$hunt/read_round.py" "$it" 2>&1 | tr -d '\r' > "$it/read.txt"
read -r t f e s files problems < <(head -1 "$it/read.txt")
state=green
if [ "$code" -ne 0 ] || [ "${t:-x}" != 1 ] || [ "${f:-x}" != 0 ] || [ "${e:-x}" != 0 ] || [ "${s:-x}" != 0 ] || [ "${problems:-x}" != 0 ]; then state=RED; fi
if [ "$ncores" -gt 0 ]; then state=RED; fi
engine=$(grep -o 'exit code -\?[0-9]*' "$it/read.txt" | head -1)
case "$engine" in *" -11") engine="$engine (SIGSEGV)";; esac
printf '%s\t%s\tpytest exit %s\t%s s\t%s\t%s cores\n' "$n" "$state" "$code" "$secs" "${engine:-no engine exit code in the message}" "$ncores" >> "$d/bg.tsv"
if [ "$state" = RED ]; then
echo "bg-$k iteration $n: RED, pytest exit $code, ${engine:-no engine exit code in the message}, $ncores core(s), $secs s, $node | $(grep -m1 '^FAIL\|^PROBLEM' "$it/read.txt" | cut -c1-300)" >> "$d/red.txt"
else
rm -rf "$it/base"
fi
rm -f "$d/current"
done
SH
bg_n="${HUNT_BG:-0}"
case "$bg_n" in ''|*[!0-9]*) bg_n=0;; esac
bg_pids=()
if [ "$bg_n" -gt 0 ]; then
for k in $(seq 1 "$bg_n"); do rm -rf "/tmp/ffbg-$k"; cp -a "$(dirname "$FF")" "/tmp/ffbg-$k"; done
fi
bg_start() {
local rd=$1 k
[ "$bg_n" -gt 0 ] || return 0
rm -f "$rd/bg-stop"
bg_pids=()
for k in $(seq 1 "$bg_n"); do
setsid xvfb-run -a bash "$hunt/bg_loop.sh" "$k" "$rd" "$rd/bg-stop" "$hunt" > "$rd/bg-$k.log" 2>&1 &
bg_pids+=("$!")
done
}
# The main run has ended: no new iteration, the one in progress ends by itself (a generation lasts a few seconds; at most 420 s are waited), then the loops that
# are still there are killed with their group. Nothing outlives the round.
bg_stop() {
local rd=$1 waited=0 pid alive
[ "$bg_n" -gt 0 ] || return 0
touch "$rd/bg-stop"
while [ "$waited" -lt 420 ]; do
alive=0
for pid in "${bg_pids[@]}"; do if kill -0 "$pid" 2>/dev/null; then alive=1; fi; done
if [ "$alive" = 0 ]; then break; fi
sleep 3
waited=$((waited + 3))
done
for pid in "${bg_pids[@]}"; do
if kill -0 "$pid" 2>/dev/null; then
echo "::warning::a background loop (pid $pid) was still running $waited s after the end of the main run: killed"
echo "a background loop (pid $pid) was killed $waited s after the end of the main run" >> "$rd/bg-killed.txt"
kill -TERM -- "-$pid" 2>/dev/null; sleep 2; kill -KILL -- "-$pid" 2>/dev/null
fi
wait "$pid" 2>/dev/null
done
bg_pids=()
pkill -9 -f '[/]tmp/ffbg-' > /dev/null 2>&1
# The cores of a background engine that a killed iteration left.
python "$hunt/bg_cores.py" "${INVPW_CORE_DIR:-}" '!ffbg-' "$rd/bg-leftover-cores" > "$rd/bg-leftover-cores.txt" 2>&1
}
# The count of the loops of a round: bg_iters, bg_red, and the lines for the summary in $1/bg-summary.txt.
bg_read() {
local rd=$1 k d
bg_iters=0; bg_red=0
: > "$rd/bg-summary.txt"
[ "$bg_n" -gt 0 ] || return 0
for k in $(seq 1 "$bg_n"); do
d="$rd/secstate-bg-$k"
local it=0 red=0
if [ -f "$d/bg.tsv" ]; then it=$(wc -l < "$d/bg.tsv"); red=$(grep -c "RED" "$d/bg.tsv" || true); fi
bg_iters=$((bg_iters + it)); bg_red=$((bg_red + red))
echo "secstate loop $k: $it iterations, $red red" >> "$rd/bg-summary.txt"
if [ -f "$d/red.txt" ]; then sed 's/^/ RED /' "$d/red.txt" >> "$rd/bg-summary.txt"; fi
if [ -f "$d/current" ]; then echo " iteration $(cat "$d/current") was cut at the end of the round (not counted)" >> "$rd/bg-summary.txt"; fi
done
if [ -s "$rd/bg-killed.txt" ]; then sed 's/^/ /' "$rd/bg-killed.txt" >> "$rd/bg-summary.txt"; fi
if [ -s "$rd/bg-leftover-cores.txt" ] && grep -q '^core ' "$rd/bg-leftover-cores.txt"; then
bg_red=$((bg_red + 1)); sed 's/^/ RED leftover /' "$rd/bg-leftover-cores.txt" >> "$rd/bg-summary.txt"
fi
if [ "$bg_iters" -eq 0 ]; then bg_red=$((bg_red + 1)); echo " RED no iteration of any loop ended in the round: not measured" >> "$rd/bg-summary.txt"; fi
}
# The run of the runner user, as e2e.yml runs it: Linux, the whole suite without the root and the sandbox files; Windows, the files of the part.
run_main() {
if [ "$RUNNER_OS" = "Windows" ]; then
INVPW_TEST_WATCHDOG_FILE="$HUNT_WATCHDOG" python -u scripts/run_e2e.py "$FF" "${ARGS[@]}"
elif [ "$HUNT_MODE" = "secstate" ]; then
# The one file, as e2e.yml runs it (the whole file, the engine in its generate mode, under xvfb), on the serial path of run_e2e.py: one pytest.
INVPW_TEST_WATCHDOG_FILE="$HUNT_WATCHDOG" xvfb-run -a python -u scripts/run_e2e.py "$FF" tests/test_security_state_engine_e2e.py -n 1
else
local IGNORE=() DESELECT=() f nodeid
for f in $ROOT_FILES $SANDBOX_FILES; do IGNORE+=("--ignore=$f"); done
for nodeid in $ROOT_NODES; do DESELECT+=("--deselect=$nodeid"); done
INVPW_TEST_WATCHDOG_FILE="$HUNT_WATCHDOG" xvfb-run -a python -u scripts/run_e2e.py "$FF" "${IGNORE[@]}" "${DESELECT[@]}"
fi
}
# THE ROOT STEP of e2e.yml (wrapper.e2e.udp.exit), after the run of the runner user.
run_root() {
sudo rm -rf /opt/ff
sudo cp -a "$(dirname "$FF")" /opt/ff
sudo chown -R root:root /opt/ff
sudo chmod -R go+rX /opt/ff
local ROOT_FF="/opt/ff/$(basename "$FF")"
local JUNIT="${RUNNER_TEMP}/root-e2e.xml"
sudo -H -E env -u PYTEST_ADDOPTS -u XDG_RUNTIME_DIR INVPW_REQUIRE_TRAP=1 "PATH=$PATH" INVPW_BINARY_PATH="$ROOT_FF" STEALTHFOX_E2E_BINARY="$ROOT_FF" \
python -m pytest $ROOT_FILES $ROOT_NODES -m e2e -o addopts='' -o junit_family=xunit2 -q -p no:cacheprovider -p no:rerunfailures -rs --junitxml="$JUNIT"
}
# THE SANDBOX STEP of e2e.yml (wrapper.e2e.udp.sandbox), after the root step.
run_sandbox() {
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
local JUNIT="${RUNNER_TEMP}/sandbox-e2e.xml"
xvfb-run -a env -u PYTEST_ADDOPTS INVPW_BINARY_PATH="$FF" STEALTHFOX_E2E_BINARY="$FF" \
python -m pytest $SANDBOX_FILES -m e2e -o addopts='' -o junit_family=xunit2 -q -p no:cacheprovider -p no:rerunfailures -rs --junitxml="$JUNIT"
}
{
echo "## $HUNT_LABEL"
echo ""
if [ "$HUNT_MODE" = "secstate" ]; then what="tests/test_security_state_engine_e2e.py alone"; else what="The whole e2e of e2e.yml on this branch"; fi
echo "$what, $rounds rounds in sequence. A hunt, not a gate: nothing here counts as green."
echo ""
} > "$hunt/hunt-summary.md"
rounds_run=0; rounds_red=0
for n in $(seq 1 "$rounds"); do
if [ "$SECONDS" -gt "${HUNT_BUDGET_S:-19000}" ]; then
echo "::warning::time budget reached after $rounds_run rounds of $rounds: no new round"
echo "- time budget reached after $rounds_run rounds of $rounds: no new round" >> "$hunt/hunt-summary.md"
break
fi
rd="$hunt/round-$n"
mkdir -p "$rd"
log="$rd/round.log"
t0=$SECONDS
echo "::group::round $n/$rounds"
code_main=-; code_root=-; code_sandbox=-
set +e
bg_start "$rd"
run_main 2>&1 | tee "$log"
code_main=${PIPESTATUS[0]}
bg_stop "$rd"
if [ "$RUNNER_OS" = "Linux" ] && [ "$HUNT_MODE" = "suite" ]; then
run_root 2>&1 | tee -a "$log"
code_root=${PIPESTATUS[0]}
# Whatever root wrote under the evidence folder is the runner's again.
sudo chown -R "$(id -u):$(id -g)" "$RUNNER_TEMP/root-e2e.xml" "$RUNNER_TEMP/invpw-evidence" > /dev/null 2>&1
run_sandbox 2>&1 | tee -a "$log"
code_sandbox=${PIPESTATUS[0]}
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns="$USERNS0" > /dev/null 2>&1
{
echo "-- files owned by root under the runner's home and /tmp"; sudo find /home/runner /tmp -maxdepth 3 -user root 2>/dev/null | head -40
echo "-- /etc/resolv.conf"; cat /etc/resolv.conf
echo "-- lo"; ip -4 addr show lo
} >> "$log" 2>&1
fi
reap
# The leg ran with the pinned GeoIP database (the step of e2e.yml, once per round here).
geoip_ok=1
python scripts/ci_lab_geoip.py evidence --out "$(dirname "$GEOIP_USED_OUT")/geoip-evidence.json" > /dev/null 2>> "$log" || geoip_ok=0
python scripts/ci_lab_geoip.py verify --evidence "$(dirname "$GEOIP_USED_OUT")/geoip-evidence.json" --used "$GEOIP_USED_OUT" >> "$log" 2>&1 || geoip_ok=0
set -e
echo "::endgroup::"
# What this round left, moved aside so that the next one does not overwrite it.
shopt -s nullglob
for item in "$RUNNER_TEMP"/e2e-junit-*.xml "$RUNNER_TEMP/root-e2e.xml" "$RUNNER_TEMP/sandbox-e2e.xml" "$HUNT_WATCHDOG" "$(dirname "$GEOIP_USED_OUT")/geoip-evidence.json"; do
if [ -e "$item" ]; then mv "$item" "$rd/"; fi
done
if [ -d "$RUNNER_TEMP/invpw-evidence" ]; then mv "$RUNNER_TEMP/invpw-evidence" "$rd/invpw-evidence"; fi
# A core file the engine left (the test deletes the ones it reads) and the gdb texts beside it, kept with the round that made them.
if [ -n "${INVPW_CORE_DIR:-}" ] && [ -d "$INVPW_CORE_DIR" ] && [ -n "$(ls -A "$INVPW_CORE_DIR")" ]; then
mkdir -p "$rd/invpw-cores"
find "$INVPW_CORE_DIR" -mindepth 1 -maxdepth 1 -exec mv -t "$rd/invpw-cores" {} +
fi
shopt -u nullglob
# Python writes CRLF on Windows: every line read back loses its carriage return before it is used in an arithmetic expression.
python "$hunt/read_round.py" "$rd" "${extras[@]}" | tr -d '\r' > "$rd/round-read.txt"
read -r t f e s files problems < <(head -1 "$rd/round-read.txt")
for number in "$t" "$f" "$e" "$s" "$files" "$problems"; do
case "$number" in ''|*[!0-9]*) echo "::error::round $n: the junit read gave '$t $f $e $s $files $problems', not six numbers"; exit 1;; esac
done
rounds_run=$((rounds_run + 1))
bg_read "$rd"
red=0
if [ "$bg_red" -gt 0 ]; then red=1; fi
if [ $((f + e)) -gt 0 ] || [ "$problems" -gt 0 ] || [ "$code_main" -ne 0 ] || [ "$geoip_ok" -ne 1 ]; then red=1; fi
if [ "$red" -eq 1 ]; then rounds_red=$((rounds_red + 1)); verdict=RED; else verdict=green; fi
line="round $n/$rounds: $verdict - passed $((t - f - e - s)), failed $f, errors $e, skipped $s (tests $t in $files junit files; exit main=$code_main root=$code_root sandbox=$code_sandbox; geoip ok=$geoip_ok; $((SECONDS - t0)) s)"
echo "$line"
{
echo "- $line"
tail -n +2 "$rd/round-read.txt" | sed 's/^/ - /'
sed 's/^/ - /' "$rd/bg-summary.txt"
} >> "$hunt/hunt-summary.md"
tail -n +2 "$rd/round-read.txt"
cat "$rd/bg-summary.txt"
done
cat "$hunt/hunt-summary.md"
# Red means FOUND, and also NOT MEASURED: a red round, or no round at all.
finished=1
if [ "$rounds_run" -eq 0 ]; then echo "::error::no round ran"; exit 1; fi
if [ "$rounds_red" -ne 0 ]; then echo "::error::$rounds_red of $rounds_run rounds are red"; exit 1; fi
- name: The counts in the job summary
if: always()
run: |
if [ -f "$RUNNER_TEMP/hunt/hunt-summary.md" ]; then cat "$RUNNER_TEMP/hunt/hunt-summary.md" >> "$GITHUB_STEP_SUMMARY"; fi
# Everything of every round, and what a round that did not end (a kill at the ceiling) left where it was.
- name: Upload what the hunt found (every round)
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: suite-hunt-${{ matrix.label }}-${{ github.run_id }}
path: |
${{ runner.temp }}/hunt
${{ runner.temp }}/invpw-evidence
${{ runner.temp }}/e2e-junit-*.xml
${{ runner.temp }}/root-e2e.xml
${{ runner.temp }}/sandbox-e2e.xml
${{ runner.temp }}/e2e-watchdog.log
if-no-files-found: warn
retention-days: 14
+4 -4
View File
@@ -234,11 +234,11 @@ jobs:
run: |
python -m ruff check --select F821,F811,F601 --no-cache --output-format concise .
# The preloaded-intermediates list is a file of the repository (ci/intermediates.json, empty, the sha256 in ci/intermediates.pin.json): with
# STEALTHFOX_INTERMEDIATES set the core neither downloads nor checks Mozilla's.
- name: The intermediates list (a fixed file of the repository)
# The security state is a ready directory of the repository (ci/security-state/, a result with no data, the sha256 in ci/security-state.pin.json): with
# STEALTHFOX_SECURITY_STATE set the core neither downloads nor generates one.
- name: The security state (a fixed directory of the repository)
shell: bash
run: python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json
run: python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json
# The GeoIP database is made by the repository (scripts/ci_lab_geoip.py: the same bytes on every run, the sha256 in ci/geoip.json), never a
# site and never a licensed file: without STEALTHFOX_GEOIP_MMDB the core asks GitHub which database is the latest on every call
+21
View File
@@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.58.1] - 2026-11-22
### Fixed
- A read that waits for its element (`inner_text`, `text_content`, `get_attribute` and the others) and runs out of time now always fails with
Playwright's own `Timeout Nms exceeded`. On Windows it could fail with the engine connection's `no response in 0s` instead, when the last
probe ran out of the caller's time a moment before the clock said so.
## [0.58.0] - 2026-11-21
### Changed
- Pins invisible-core 68.80.0 on the engine firefox-68 (Firefox 159.0).
- Every profile starts with the security state a retail Firefox has: the intermediate certificates, OneCRL and the CRLite revocation filters.
`invisible-playwright fetch` downloads them from Mozilla's service and has the engine build them once; every launch copies the result into its
profile. Filters ten days old or more are left out, as a retail Firefox does, with one warning that says to run `fetch`.
### Fixed
- `networkidle` waits for the end of the document request that is still arriving when the page is cut, instead of ending early.
- A navigation the page's process reports as aborted while the parent is still carrying its request now waits for that request, so a
`goto` no longer fails with a false abort.
- Behind a SOCKS5 proxy, WebRTC sockets on ports Windows reserves no longer take the proxy's UDP association from the sockets that work.
## [0.57.1] - 2026-11-20
### Fixed
+642
View File
@@ -43632,6 +43632,648 @@
}
},
"wheel_filename": "invisible_playwright-0.57.1-py3-none-any.whl"
},
{
"published_at": "2026-11-21T10:59:58Z",
"requires_dist": [
"greenlet<4.0.0,>=3.1.1",
"invisible-core==68.80.0",
"psutil>=5.9",
"pyee<14,>=13",
"aioquic>=1.2; extra == 'dev'",
"build>=1; extra == 'dev'",
"cryptography>=41; extra == 'dev'",
"h2<5,>=4; extra == 'dev'",
"playwright==1.61.0; extra == 'dev'",
"pytest-timeout>=2; extra == 'dev'",
"pytest-xdist>=3; extra == 'dev'",
"pytest>=7; extra == 'dev'",
"ruff>=0.6; extra == 'dev'",
"websockets>=13; extra == 'dev'",
"websockets>=13; extra == 'remote'"
],
"sdist": {
"digest": "eb72d5e2510357290e107ab81a0142749bcfba54191c430f0046093fe91a214d",
"files": {
"LICENSE": "2abb03e63a96918967f383cbc36e3faefe10a47ae20b2cab43212ef965e02f96",
"PKG-INFO": "3d4dda3a68fd4d64e094c253c9d565f96426fc8e90de71dd03a6474b3fc1eef3",
"README.md": "2114ecc63ee45954a88b4d91d3e11f01e416f40810a3d71963f3d5d986d4cf67",
"docs/README.md": "ae694f21758d2b80d1dc8eb4d13867d7241ca80fb4137c0ead03e7af799b7192",
"docs/integrations/README.md": "d9d4a01c5ce0b3a94123653bf8e78283113cae0a6ec22ba0bc2a2a77baf8ea19",
"pyproject.toml": "a9c3966266d21bad46ee245ec05de1628b2b39ddab422808286b847f8f72b609",
"src/invisible_playwright/THIRD_PARTY_FORK.md": "d54bd2a4c1e0b4d132d96647f82de205637d1ea0a739a61809b3d7c4048f65d7",
"src/invisible_playwright/__init__.py": "8d0fb7aa787c73bec8140616d9762fa6f672dfe9cb58a6d39dea42c2a429d801",
"src/invisible_playwright/__main__.py": "c6cd277050ead2d11c98b7cbab91ada7d19e495c95e4c86de1f9aaf2b2051d38",
"src/invisible_playwright/_cursor.py": "a30bcac49cb88d2f568764cdf20359bd8b49f1051034dcd7451f161d7237cb46",
"src/invisible_playwright/_engine.py": "5ee84a62eb30ead2632a49840b37cfc1a8bc0d41aef16e95186323085a364f38",
"src/invisible_playwright/_juggler/__init__.py": "96d6d06dad40f3c5112ab2bf9852c9d273ca891647baaf86e9913a06112db829",
"src/invisible_playwright/_juggler/_bindings.py": "3ccfc601acdee9fe67c6de693892ff90d53b60729df1be29f091493a4a3e0c9c",
"src/invisible_playwright/_juggler/_marshal.py": "11da69c3de627bd809a1d5b5371874f4aab3356d95ed602a4dfe4d53230245df",
"src/invisible_playwright/_juggler/_reaped.py": "81d85cdbcabbe9342486d90c995a27b7c31646936b51e264104acf436d49d453",
"src/invisible_playwright/_juggler/_threads.py": "a790d60fae3815169f2692af3377e62add5ac3ec240fa0dc7e6b52a88c7fa5c0",
"src/invisible_playwright/_juggler/dialogs.py": "5541004829d2484526fc93f11338bfdf9f63f3319e17fc95ea51f61e1b429220",
"src/invisible_playwright/_juggler/dispatcher.py": "a0314cb560c7a01132b81583b146ef693b5610c5b25fc5eb348fe0e247e51511",
"src/invisible_playwright/_juggler/memprobe.py": "b970afd7f877ac3ed631bd8b069000798034e32c1df497ce8102928aa29277d7",
"src/invisible_playwright/_juggler/perimeter.py": "6c453ccb00624a40d222ae8887c93aed688a108199d17e18e0791109c2686535",
"src/invisible_playwright/_juggler/pointer.py": "2516adc85c3872e120a58812f499023bb15c26b556b89c0edd12033d3d87ed40",
"src/invisible_playwright/_juggler/remote.py": "5346ff9f247e8b9611524515974aeec84210e5f164f99237a78845771292a21f",
"src/invisible_playwright/_juggler/server.py": "e03c54cd87fe4563cc2ea3abcc88cf6cdcf2aa278647d97c836b6aa82383bbf5",
"src/invisible_playwright/_juggler/transport.py": "e928e74fbc49f7cd00ba196c5ba1867cf14b34f5627b8f3ad9a0be8e7e78519a",
"src/invisible_playwright/_juggler/variants.py": "0ad98874f892ba1527be16230160166230aa846c5665bbf02fc0a643279a99c8",
"src/invisible_playwright/_juggler/wire.py": "fbe0399da9896031a104bdbe83a7c24a42dd6c264a23bd65d83e8e5f2be9e840",
"src/invisible_playwright/_pin.py": "34840d65c3ce32aa856f55344358a84cf47904471039a0a28d510166c6feda4b",
"src/invisible_playwright/_pw/LICENSE": "7fab1461b41970ff376f1c9303a637076bfaaeb71cd12dd3a1c44aaf59a1a2b9",
"src/invisible_playwright/_pw/README.md": "3ff2819bfde496151299983c4db167171e3e49933e7cf75613239893b2530570",
"src/invisible_playwright/_pw/__init__.py": "06c3acdadd13e2813fcb95ad91d53ee3885c2b5f473beccc45a579d9ceead70b",
"src/invisible_playwright/_pw/__main__.py": "dcc8e224337e54bb2febd50cc2e3c6db6ad345c2e148fe64612ca64c4dbea469",
"src/invisible_playwright/_pw/_impl/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"src/invisible_playwright/_pw/_impl/__pyinstaller/__init__.py": "5a8c0cfeb2d84ed4287afdec24ffcec60d1ed827b92afdfbd82b2351ffae1c15",
"src/invisible_playwright/_pw/_impl/__pyinstaller/hook-playwright.async_api.py": "d4a8c45554b3ba55e8102f03f576bab6ea4abfb70cdc60095471d504e34a1014",
"src/invisible_playwright/_pw/_impl/__pyinstaller/hook-playwright.sync_api.py": "d4a8c45554b3ba55e8102f03f576bab6ea4abfb70cdc60095471d504e34a1014",
"src/invisible_playwright/_pw/_impl/_api_structures.py": "7117217bc28b93311e0ded2232935bbb3e71cd36a69ace95faa5b5f019b6186d",
"src/invisible_playwright/_pw/_impl/_artifact.py": "3f06f56db387ad34194b9287291843e32ee6b2fbd06417872085ba5cdf58c3d0",
"src/invisible_playwright/_pw/_impl/_assertions.py": "ebfe537ce1c118606f256cf431d8acc55dbf45cec0ff8ce80b7d08189372d584",
"src/invisible_playwright/_pw/_impl/_async_base.py": "411bdbf2019879b7338bfd11291dab77662c4de8c029ce233f6c8c173845e440",
"src/invisible_playwright/_pw/_impl/_browser.py": "96af02910c9bd02ed3747049e4dc83f792b18ab363257bea5bb63e81335b5098",
"src/invisible_playwright/_pw/_impl/_browser_context.py": "c91c6e44a0dbc4e9c0430807561d9b92a73a3b33c406792a71a1362ccf995e46",
"src/invisible_playwright/_pw/_impl/_browser_type.py": "8e8fab1f8253952f971ea941948292e49fa08038e6566e6164ba1db927f16017",
"src/invisible_playwright/_pw/_impl/_cdp_session.py": "da1f31e66ee6a1a47a77412f6efa3e72670835a81d20a42a939cc6043f4c3357",
"src/invisible_playwright/_pw/_impl/_clock.py": "c3868a4cfdad993d99a554e58742f8c1e9f6806d51199e2870916e6c8b2eea2c",
"src/invisible_playwright/_pw/_impl/_connection.py": "0c345f8afd418c42c9722126b4562009922135df050c076ce279481cc9ae2534",
"src/invisible_playwright/_pw/_impl/_console_message.py": "4adcc1921c9ad348a2f796848b2ce92ab625b3f328ed611ac42d6576fe16ac66",
"src/invisible_playwright/_pw/_impl/_credentials.py": "0d5e2ea044d6a0861de54aae29de5f0da8ef871635384f57a111e2d70cd9843e",
"src/invisible_playwright/_pw/_impl/_debugger.py": "17a425f2c82a798098fe08a0a1b92be5fd7ccce0d56af25a6795e80d33aee2bd",
"src/invisible_playwright/_pw/_impl/_dialog.py": "2061f36b8952cd8fcb74c9a9cc9930c3a600eb1e7f6fa4ef1867867f353d14a6",
"src/invisible_playwright/_pw/_impl/_disposable.py": "564a3c3e3e2c5dc8db07727d682e2fb40c0e113e8489cf7fc179ed4aaea2ac87",
"src/invisible_playwright/_pw/_impl/_download.py": "5349c613615cc690593537acbedc83e5a53fd056521358cacaf2a355238efdd4",
"src/invisible_playwright/_pw/_impl/_element_handle.py": "b922cf771522209192727547185c922e9617f94fe55ae7c37ffa99cadf410a45",
"src/invisible_playwright/_pw/_impl/_errors.py": "49407bd6164ab563f82b2bf37863a265555071544dcabedbf7beba8be1b618cd",
"src/invisible_playwright/_pw/_impl/_event_context_manager.py": "55ea0fab5a17acbb3f6f797610cf20a77efcbc7b62e8c19bac53a138f39c7127",
"src/invisible_playwright/_pw/_impl/_fetch.py": "2756ee00ffb7cf8e178af4d9f8d56ab7d06828fce431faa9318e54a2ade55e1f",
"src/invisible_playwright/_pw/_impl/_file_chooser.py": "3efbf6c96f36cb906508330cb09ef5b5e1843e2b1aa95b27a5f85ec4376c8522",
"src/invisible_playwright/_pw/_impl/_form_data.py": "a9ce4cb4f77a06d24d31ea0e81a0e007a965bf33ad848ebed7cf0ad2f40f36b7",
"src/invisible_playwright/_pw/_impl/_frame.py": "0f974f94f52be86e510552900469c219007ba7a5ec05f3fe3a0d5cb78ff42b81",
"src/invisible_playwright/_pw/_impl/_glob.py": "af927c1cc1a33e12094224ca96158964ce2c7ad9f4b4de3ac60e16e0baf9f887",
"src/invisible_playwright/_pw/_impl/_greenlets.py": "27456c0ecfc181a04a6a1245e0f72549129e3af0b611e60607cb5d29f4fe2634",
"src/invisible_playwright/_pw/_impl/_har_router.py": "24fe3134253de1b71a3738348444dea88b78bdd250851ac7cfdac2ffcdef68b8",
"src/invisible_playwright/_pw/_impl/_helper.py": "c866f0dde846d84856404d7b6c72c5fbd5ac41302b1f6ac043016956256c2812",
"src/invisible_playwright/_pw/_impl/_impl_to_api_mapping.py": "ea1e5b8ea94f344a18a6c049e465d45044cfd61c2ef779887f076e675dffa655",
"src/invisible_playwright/_pw/_impl/_input.py": "14ed52c5e5bda7f5d8bde6b67fd651dee8c368344e13d652178d04e975ea1801",
"src/invisible_playwright/_pw/_impl/_js_handle.py": "cbb76fdf29d5087e2f2d04bac5e729bf7905238a9b386f3be9e01a4e2a95406a",
"src/invisible_playwright/_pw/_impl/_json_pipe.py": "c738956081dee483bbc032707553a9f9b3be38750f2ee7916390fa47fb1b19e8",
"src/invisible_playwright/_pw/_impl/_local_utils.py": "93677e1277ef74efcf52630d98a8857c1ea847b6e16757538040ce49e2758490",
"src/invisible_playwright/_pw/_impl/_locator.py": "c4457bbae669d98530a5bfd717619f8fc801a20c35e2e52e39b4f96193fba708",
"src/invisible_playwright/_pw/_impl/_map.py": "606086b53edc29605a5ff0b22147dfc640e38c65089df790063aed9cb89bfaa7",
"src/invisible_playwright/_pw/_impl/_network.py": "6af15cca7afa486ddb3edcea9ed2fdd2104f6ec268612dedf6707453a0c9433d",
"src/invisible_playwright/_pw/_impl/_object_factory.py": "16cf089afe2a37a18c397ac6cc9aebd296db731b6e6fac2a1248cae09585f26e",
"src/invisible_playwright/_pw/_impl/_page.py": "187b110afac50f94766b0b5b40a82c02b895e723c0000fbee7233deb0e08d11e",
"src/invisible_playwright/_pw/_impl/_path_utils.py": "2c0c34e8c14e04d350044e5ecca4d804b4c5f9191a94c450f58e6a3f9d8bcd1c",
"src/invisible_playwright/_pw/_impl/_playwright.py": "7f1771a504561f108c9e0faa9a44f4e4ab8cc13116bbf2686ea1a3b03ede7d52",
"src/invisible_playwright/_pw/_impl/_screencast.py": "3bbef5e66981e9216f27f83428207f61d33d2e371ce2121d195c9ed646d1001f",
"src/invisible_playwright/_pw/_impl/_selectors.py": "8f480ab03977b1d1d703a5519d195e3f3335e0e644cd559501167f39318db354",
"src/invisible_playwright/_pw/_impl/_set_input_files_helpers.py": "a8863bbe7d98520c8770f51b130c69c259ae629a829e1286588da6b16950377e",
"src/invisible_playwright/_pw/_impl/_str_utils.py": "0ff1b72ae6d0dfefc92939fca4cc0c2dcb7efe4fd8e520c72c630a6bd94b0fe3",
"src/invisible_playwright/_pw/_impl/_stream.py": "0f05ac6e14aa97ae37b68986bee03d656e3b1f92944b8aa42b9ad927df1803fa",
"src/invisible_playwright/_pw/_impl/_sync_base.py": "0bfe9eee479bad5295d7b281f20bb306ed652ef74a5053b14c320995a3187af5",
"src/invisible_playwright/_pw/_impl/_tracing.py": "d88db6cdfedaa54ee6435fb7dd5e89b2906ad409374ec0177d17a2bf344d694b",
"src/invisible_playwright/_pw/_impl/_transport.py": "96def727d12fec006999113563caca190e6f7e25bec81922ea274b552480dcf5",
"src/invisible_playwright/_pw/_impl/_video.py": "f7002004b2c26d072bd108f9539b8e1b698f917be7b17cd30cc7eb3fb373d6d6",
"src/invisible_playwright/_pw/_impl/_waiter.py": "d8cda0d02e1e92674c4c0a3127229ff87ca4ef214c1682daf3b64ad4268240e0",
"src/invisible_playwright/_pw/_impl/_web_error.py": "238b060de72bdf92b54f771622e9e9739b64240d73e7d573c9125f68a28b64a8",
"src/invisible_playwright/_pw/_impl/_web_storage.py": "7f942aee8cc96bd82ea59b3d0839e8b20e4f44f066343e8640e3180fe001ab70",
"src/invisible_playwright/_pw/_impl/_writable_stream.py": "4a4936a37ee5c783f88d7f6c7bfda2850bcc18867a420581ca16c90e1248047e",
"src/invisible_playwright/_pw/_repo_version.py": "d53af84ac37b99e382129383cbd4ae8f2c78798801ced917b9c0b0e23b34f58e",
"src/invisible_playwright/_pw/async_api/__init__.py": "77bbd2c48813238c42211e1470f66bcf82ec31373f89fbe0670b8cba52aae7d6",
"src/invisible_playwright/_pw/async_api/_context_manager.py": "acb8dc6cf148b3347a14ec8377ab269285363592ef3a3e703c3f537e41a21c4c",
"src/invisible_playwright/_pw/async_api/_generated.py": "b0a5713e9b560387b04bf6410c56b231ec90f0dd7e571f58d2af50013d977f18",
"src/invisible_playwright/_pw/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"src/invisible_playwright/_pw/sync_api/__init__.py": "a99ad0ce7f8511de29e3661e9e2c8b2dd5e8c4a0cfe7731de4428367df00c15e",
"src/invisible_playwright/_pw/sync_api/_context_manager.py": "5bc3c715bedad07533173bd27d6f690f07779ebea3fd49f8ec4bcd896a8aec5e",
"src/invisible_playwright/_pw/sync_api/_generated.py": "7881f3918cdeadd2909f82d36cfd993a54664638adf289cb9eb2e3dbd139f045",
"src/invisible_playwright/_session.py": "cd515bc2f27b42b58a5105a78a0466e321fff37dec2044bc53ecba4981f26dae",
"src/invisible_playwright/_version.py": "101d9ed902fb1a3a806f99f220eb10dd73ca656bd8b02f0c507ec338ef14890b",
"src/invisible_playwright/async_api.py": "51ac8fd3c7b1f7bc3b68af15ba84e3f0688525c33086332058b4fa1ea7a06f97",
"src/invisible_playwright/cli.py": "f8fb408ffdc93f3aeaeb775a454f71c1aa854b4921fc5cc3f618c3890bc4b81d",
"src/invisible_playwright/launcher.py": "af22dcbda32407a6b62d050671e68d8ed9f809500cd4d2a1d895bae9925f6c8d",
"src/invisible_playwright/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"src/invisible_playwright/sync_api.py": "4c42eacfdd306f1b610a54bb54fcd1cbaef3c20dd525e584d3c587c4a846ea6b",
"tests/_bfcache_evidence.py": "49085e45eb21eb0c3cef0fcb39c2d82d936b5532277c7fa1c2ecbc38c0a93e25",
"tests/_browser_census.py": "cf91f249e8e098366c59148ffd62aa10e1847675da6748e3d0e8a93e95b229ec",
"tests/_close_loop_verdicts.py": "9adad099186f5ba4d352db792b5265442c8926ea9ae24cc8659164348dd8907e",
"tests/_cpu_by_type.py": "74a9acc80a560141b90966804b4f664ed6044caa7faff5f34a107bedd64dd2cf",
"tests/_doh_servers.py": "0521a66bb3402b27655156003a50e09f306d09c60644575516afd00b72c7d771",
"tests/_doh_support.py": "172caeae4992a91b57fa9866430cdb6bb4df53609c6c6646304b22dfa14b3941",
"tests/_e2e_clocks.py": "af6ccede1a1c5719670e3d1cf75216e4d9782dc49b7249473354894c24504128",
"tests/_e2e_verdicts.py": "733e6489cb9f463dc544e47bb9e50faabbc16441e7595912f86d28d28bc770c7",
"tests/_egress_sink.py": "57669610c5601b9fc351e86072db8092a403f6dac18e6b7b72e2c6a840a6b1df",
"tests/_fission_frames.py": "35520541f121ce63d20d523d4eb6988c3501702962c6678fa065b30a56cccccc",
"tests/_h3_server.py": "b3e45ee4d890a233ea43d4ddd857d705f90c14792105c24278a384d4d9e62bc8",
"tests/_host_address.py": "f2dd658654b7735b8fb2455c4c0a00abcaffaa7d019942923ac3d9dc91a00694",
"tests/_http_proxy.py": "8a3bafb2240dd29a24de5ab9aacdc0d2f49d665bd01e53ad87bf58b0c8565673",
"tests/_lab_egress.py": "d592137c145b2e086f824194e32b8f3c5e992dbf2cfc778a1c6daf0abc7f44fb",
"tests/_lab_pki.py": "6a5e87f3b5fee314e65dde231a54ad3ed28a0971431fdfcab081f5efafa5eb57",
"tests/_leaks.py": "cbe026e0bef8cd4d6458fab6688a1c7a678f5c4db4b8820712c900d07a9a0b22",
"tests/_page_bytes.py": "979e20aa6f97d28f084499ecc3ba3f412b3f4d92cfda4db9b187c285be5f0032",
"tests/_page_work.py": "88fc590ca508a4c5ee37e1a40892083dbfb82e2ae0cff0635cc67a579d0a73d0",
"tests/_pointer_fakes.py": "b27e66aeb9e173fd43a764e4a95866080ef80615a904ea6ce100bda8a552dcaf",
"tests/_ports.py": "318c91399b6397395df993f55c5109e06d2b25b351d93d73d19369825d445202",
"tests/_post_publication.py": "a7009a34d0b0a22f9eab18904d638becb3b776117843e70e59081d417905be40",
"tests/_processes.py": "4193b1cea8f43dfa85e998e70246188c482a6e3f8b5fa0e9517c272ce9fa7846",
"tests/_realness_support.py": "3b2413ad78be0742f7689e99293b508938bdcd1eeb57ff15a9f9b91f18edd0f7",
"tests/_screencast_evidence.py": "0c45a3d092dc00c6b3c387f335d42bfefb49db1408d1f7124cef4bf308165c5d",
"tests/_second_goto_verdicts.py": "37f418897eb22008ffe9cca0403225ae8a44367710b922e0efdcb596ac83cc3f",
"tests/_servers.py": "d3e2668c7e4c3d4a2c54304dda334381012e6327838381279fd3d9802e73dd7d",
"tests/_session_end.py": "c136592e3a915c32faa45703c8595c4e582e5fe3c1df9912f15eb57a25363932",
"tests/_socks_servers.py": "bc6dee22c478f454db557a14e2a9325acafb7ba95a9968b7ca5bb907832fcea7",
"tests/_strace_stand_in.py": "2a8f79444466cde95eeaf438b5d6fe0cef6f5d998bb5118d901d475706896c4a",
"tests/_trap_policy.py": "b71592501c795a14396a4dd2dcd4396ef54377d87a011af9475dbb3bb7d6cfcf",
"tests/_turn_chain.py": "fe923aabfb07d6d2bf1680bf3c92f25a4a48983a0601100d50cdb4fce2787af1",
"tests/_udp_line.py": "ec8165605f4f58a07a740611085f7ec05a2b3dd37d1019d65d6addf628812dd7",
"tests/_waits.py": "68af63ff7bb0a1fe3b3ff58b4d390fa0b848b6e8ed1c9bee88192d571b4f05a8",
"tests/_witness.py": "3e6175efd084b7dd9b408ccba18e973a79cf9c43daaf07bef52f760664f55597",
"tests/conftest.py": "f1c22c9db6557f5d239e9b372d906d2b1d4d629d3ec143aca5e3e5c9ab5962d7",
"tests/data/engine_gates.json": "420b53e60c74efd764311aac9ddf3814328f1ceb800d6186d056217866f9ebdf",
"tests/data/page_bytes_linux.json": "50ee0f624eec21cc311efc92ae80f35163d287a8b90b426a136d048b05b3ad29",
"tests/data/page_bytes_windows.json": "344d335caee6c446dec67a6a2a85bab24051ea1901c1d4704dc4d1681e2f09f9",
"tests/data/pointer_golden.json": "1c1da4b1a064d5266b602623c7297712803fb0615d6bcf9927a4a335721a7498",
"tests/data/pointer_golden_origin.py": "da88b31e7bdbc6e39638e6614530aad4773f72000dce19829496c96cd4bc990f",
"tests/data/security_state_crlite.json": "d02d097407456c77dc642465e55af497bd64404578fb270bfba308022648c8f1",
"tests/data/security_state_default_key.json": "5ba8b47b1a7f51343e19dafa0fe1c86913ca243658b9c116c6eb15bb1072ebbd",
"tests/engine_process_tree.py": "e949fb5898c9d14cfb76c49507004168585af463a12722296ca6876c7815408a",
"tests/engine_refusal.py": "6ccefd8c51d767a289d908e6aa70b2a194de82ec50f9286440763e5fa77f63cc",
"tests/fakeweb/JOURNEY.md": "2b9df7acdd8874bbdc658b514de7d9bcc5fe9963396551b287b5244e5aaa268f",
"tests/fakeweb/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"tests/fakeweb/journey_site.py": "c17e7d9b4571d0776b7f9b658e60ca04364e2107c59c4e6cae7f50b0bac695ad",
"tests/fakeweb/loader.py": "f04f12e55132c3eed2d3dedf28b5dc583630307e44fc2af91ce00908b1192681",
"tests/fakeweb/pages.json": "b55d4fdb0cc1838ef450312bff6b49c141f190b8329594a5e80c1053261e4f42",
"tests/fakeweb/profile_p2.py": "290d3e4d1b930f9b22528ff52cd0bb19969690e7238053942aa86cb1a5f782f8",
"tests/fakeweb/profile_p4.py": "873db3efe788397bdb96eda190eb81d2a31bb98f92f3a80636b3780b2f744f36",
"tests/fakeweb/sites.py": "6a2ef6d454a08578389ac6eaefbf101f2ac740dfbc3460ac57c6c7ede3a98990",
"tests/fakeweb/stock.lock": "56a47089999a7a48278e6c894e2eb2df30bf0e2bc7b6c5ff554baced3829d26f",
"tests/gates/e2e_clock_exceptions.json": "c3fb29c354a81cd42bacabb030b2fccf0e3eee61982a43e7f938d4a88bf8b0a4",
"tests/gates/upstream_baseline.json": "d87ea58e2ea92b24b8d5d6f3451f1fc0055825c53e315555d522aed7fa6d273a",
"tests/geoip_used.py": "59641c6c282016d36ed69254df2e3d571b81a4347537ed50da252161ec17a999",
"tests/page_bytes_probe.js": "1a6a264dbaced1a9adf362194cda72db24f60734d9e8c057ca7895ee1492db05",
"tests/realsites/sites.json": "f8215670a65015a0b711395b667f9bce5a5de7c9b756323eee6fff0944b7a20d",
"tests/stroke_shape.py": "f4bb1315338dc4d1b402e2feff1b40ee8cb46358c2d66934c7456a183c5384e3",
"tests/test_a_162_message_is_read_like_a_161_one.py": "793ffb99c62be438f17308e99541f1053378b5aebd4f936d8ae3c48445e1efec",
"tests/test_a_bundled_stock_firefox_is_refused_by_binary_path.py": "58e9af4687623485cd538cfb09376f37733ea8bce362f1aedcd43df33e0b56db",
"tests/test_a_click_makes_one_mousemove_at_its_point.py": "16685cfe4a40fc00d94168c8640478f48ec1943310c280a55a55e0f9459775c9",
"tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py": "1325b13b438f819883f1aed5daa06cd4e6305c05eb8ceb01b844f5d4bed92970",
"tests/test_a_closed_browser_leaves_the_others_alone_e2e.py": "f8454227ff36dc9413eab6cbe7203f4df15c83df6a8c372fcb6274a5085bf0f3",
"tests/test_a_closed_context_leaves_nothing_in_the_registry.py": "7d8da81271cbd2fcba9ba40ba800ef07c47a02059e7edfbeddfdeeb3d0acfa5b",
"tests/test_a_closed_page_says_nothing.py": "f21c0f2ca50c24f282d448b6eba299d98037820bccb5853f5e584a7eb3cb0723",
"tests/test_a_closed_pipe_is_a_closed_target.py": "55e821fb6b1ffc0479f2c627e96e56484c51d3f4a7af39f735922149137e8885",
"tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py": "d4c647ebb0ce8eb904f36c72b4bebe6ec3dd3b84cf3806f8c48d539c485c476d",
"tests/test_a_context_init_script_runs_once_e2e.py": "670e2466cbce855fd1a83f0eb8568a3bbe4b5ce32e67ee795896da5c512e8711",
"tests/test_a_context_proxy_carries_its_measured_udp_exit.py": "86a99305db92194c848ac2884a552469736e88f4479d60dbb28e36babfa15b95",
"tests/test_a_context_route_disables_the_cache.py": "da73964c3228320438a631d3a623e1c2dee748302d35b07cc37d2c52227614f4",
"tests/test_a_context_that_ends_leaves_no_process_e2e.py": "b7192bfdd19b74bbdb357b2c41a665cf19b844ede1be72deba9385cf2b38bdb7",
"tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py": "3e60fa7bfac06611e41d0253c1fa798bb98b04dbdc9aca770219602be6425c68",
"tests/test_a_declared_webgl_extension_survives_its_use_e2e.py": "955e14cf9ab2a0d4774dc77db317d0766be7dc92a32eeaa5b411130ab66ac478",
"tests/test_a_detached_frame_answers_detached.py": "b4f7f6e825d4183eb3b5a07f57a78abe96885757e821d1fab24c36e9ce69c883",
"tests/test_a_dialog_is_a_protocol_object.py": "23b67e1e0b26053407a0c37c8e08aff526c8e83bf62a667e12783b325c7ff4fd",
"tests/test_a_dialog_is_answered_after_a_pause.py": "a9a50b2ec40b3a87a0088f82e1d71a1432c2fc4c84e3cd0029ee83fd640893bc",
"tests/test_a_download_finished_before_it_was_announced_is_finished.py": "5d3be1aa70190287d020657b25b41600b691971c9f492d8ad51fc6ab85f82a58",
"tests/test_a_drag_keeps_its_buttons_pressed_e2e.py": "d5ca808caa1bfad52503153a876382e9744969dadcb33ef0f9abe9248bba37a7",
"tests/test_a_failed_expect_carries_its_call_log.py": "00c085fc57f814958c3ef49827a2c2bb3a8de7e8c72a551dac191b3073adb9f9",
"tests/test_a_failed_launch_stops_the_display.py": "0b1abca525396088c48aaf7c5a93eead14bf304bf786dbf9f5aa2898c9333629",
"tests/test_a_field_is_typed_after_a_pause.py": "8fcbe8fbfe30f022f07129aaaabc64d27c6b6c4deac628dab3d84a49c4ab1a39",
"tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py": "bfd2ff45312cdd863347c9d284f6d86edcf62b35c6ad3dda99850213f810c02a",
"tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py": "db000204b439bd11302fd18d3348e9761dd02ae6b0327daa94894e85c56b008f",
"tests/test_a_keepalive_request_reaches_the_client_e2e.py": "ec2e25ac059f797ce3510fb7d21145e5ea5134dc9fa1f0b88d8ebac9cb32bb0e",
"tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py": "ef8e2f386d6dd55a191118811708944c7a61364d5c97ba0f31083c4338aaf4c5",
"tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py": "f3d1377be9f9c3b71d867034da87850330118f495697a0844cea7fdfac474a8a",
"tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py": "47545e192a5afdfc81cc6af5b9dc5e70b7cbcb974092537790e9570410c43ebd",
"tests/test_a_launch_has_one_deadline.py": "5754beba9d57035c43bb86203afb5e2c5c064ff58b0aeb58a55f6c7ea904d3ba",
"tests/test_a_launch_without_a_session_gets_one.py": "c4d4e6d5d7ce2a26498695ae92709802c7c581a31a0a3fe5624709e42c3b0fd0",
"tests/test_a_launch_without_a_session_gets_one_e2e.py": "12e3f35cca990ed253ba4f1f508f0bca5e1ad7ce8ee2447be79112a44ca1451b",
"tests/test_a_left_documents_body_is_evicted_e2e.py": "b6ed55ef5c4b24396cb0d06c06980836d9978538afab3101ac1b86bd33b72c79",
"tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py": "e78091bad22bf3d9e7669fc4f236abc34605f113dff55ce5bffb6f2f480756c9",
"tests/test_a_module_that_leaves_a_browser_open_fails.py": "a7075810abe82226ece71465bbe4521708d20243ac2bd41ac3d2877ae2d82d95",
"tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py": "b6a8f47d0989c2a9e673a33bb42a5bd8909733890b6d849bf06a65d706ea0d96",
"tests/test_a_new_page_waits_for_the_engine.py": "87d60be3ca55fb2e79accf35aa3c81bf97601a11045ce8fc52b57ad61f0edac4",
"tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py": "cbb23cb5b6df948bb93f60375df27dbffc274e5c4f227502498f66edb32c2a40",
"tests/test_a_page_cannot_probe_the_juggler_e2e.py": "4f0d0ddee18bbac04c0d467be975ccd6dc546860c6ac028dd12d9d7b1afc97ec",
"tests/test_a_page_closed_before_its_announcement_is_not_announced.py": "e953ebd2671a4d8f560a1cc42488d4282ccb523f78292e1ad6011ea9fbaf1631",
"tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py": "bb6e640169994bf68730ddbf26bd1ce99c98d734baadd67ee0de991749752c8f",
"tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py": "10f1c7a7ab70b14e993be8c541fac609531ad501fb9a634fb848b252d1b3b18f",
"tests/test_a_page_that_moves_on_e2e.py": "ac99363d43bfeac58d75a7844e8de842818a489dc6674a5bc1c9a8971909cd8e",
"tests/test_a_path_leaves_as_one_stroke.py": "17946bc4a9b3ab18423724077273869071565d20bbe28baf3ac66d35ae526a2e",
"tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py": "46fc161ba40a531035f191fcfd77712be50d6fb40d7a249860e1f7c708d773e5",
"tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py": "d42bff20da1be4b732fa1f31fe92eb7f3e7a73b8a121d03af095443254173606",
"tests/test_a_popup_of_a_link_reaches_the_client_e2e.py": "148dfd1da555ea44cb09a16a5093eae2b7f895499737b293b44a588f4147c0bd",
"tests/test_a_port_number_is_held_until_it_is_used.py": "bb4702b79a453b9a194b66cc8ddec067d0dd79972079e51a2e75ae2172cf09e4",
"tests/test_a_proxy_that_cannot_carry_udp_leaks_nothing_direct_e2e.py": "caf655dc5a1a647706db35cce5357160c284efd2d0cec6a3c69c7b9380ddbedf",
"tests/test_a_request_and_a_response_are_light.py": "0a0c731037f9b1fbd8868721550f49a113da5e1cfc2f71fff5e75d5e474fe5a1",
"tests/test_a_request_says_what_it_is.py": "e586459542963cc4f20617848f22b3eb4fd45b83d4bef73acc8cf1666b9a4a7d",
"tests/test_a_request_says_what_it_is_e2e.py": "da770169408b00f01b3eb8bdf179875a02ceda5d900a270ef2f27325df0bfe93",
"tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py": "1392b6b11967a9859642ad20d48b48cb2b461fb4a6045247bdd84b029b61c18c",
"tests/test_a_served_browser_answers_a_plain_client_e2e.py": "b5147129eba86f91d10c6631615ba5f6153e66b405bb499081aa7c24e33c6799",
"tests/test_a_session_ends_before_the_next_test_starts.py": "99cab200dbb0c95d99d7456dd0e303ef5474841f0e7c237c6823e7cd931b8c01",
"tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py": "5e7c7028beaefeb73a9419656d8b9074d438383e05baa7fadc77b00615ff78f9",
"tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py": "9c8f25ae0c31cff4ecbfe891d6d95ad87f453ae69607bee96897d1528afabb9c",
"tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py": "f14a69f6919b538b7599602ba82bca224a7088de7ff1f821645d38245d65256d",
"tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py": "c6bf497cd53e8a3887b4a93cfeaf7819983a87a18bbbc37285e6333bcece0743",
"tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py": "830705c090e7ccde73e1211635cf2ef1a789928021cea8eb32e85bce3e1b5a94",
"tests/test_accept_language_on_the_wire_e2e.py": "7881900b5508d20c97ac0828e0e489bf7970b80193a19126ddbfb9c1ec0cde83",
"tests/test_actions_without_a_point.py": "6c48b30fcc2c1c48e74f6fdde90a61217fe26590a9a1e8b46981be4a27f6a048",
"tests/test_add_script_tag.py": "b513b68ef486b2837ad7e9dc411a24fe323160f8c75234ac53bb8295c77212c8",
"tests/test_an_expect_reads_its_value_once.py": "d23d6005eb6bf20307b010afce91b8b6f2128d3743dc76b264ef47ed5a3c3d43",
"tests/test_an_isolated_page_and_the_next_e2e.py": "4a2286f13d75b39ccedd3d0a44823b6726c0e5732d61bb1d16ce088410deaf21",
"tests/test_async_api.py": "11ecc5b425233e97287813e4bf4435321b7b4d9e9aa67685a9642ee759adec91",
"tests/test_browser_output_is_drained.py": "08a135852f9f1aa51944c57600e5e4ab0c50cdc0a5f9d549d5a5d0e26ed77284",
"tests/test_build.py": "30fff1ce6fd17c1d81874fc6db7253a745a403d30e536cf6ed7186533584e13a",
"tests/test_bypass_csp_e2e.py": "8cfae28f4acdd2d6e7bed95a8117bbac00064cb9d3cee2c39ebf9b7d16099078",
"tests/test_caller_world_handles_e2e.py": "464332c1893f610e04f68cced2a3b03f2ca6b8790ff7346eb112200093371210",
"tests/test_canvas_reads_as_drawn.py": "95444935965f00f7db3668e1b61ceb2be74a864b16b6288283c877e7fc68c0bf",
"tests/test_canvas_render_stealth.py": "fb43cfd2cf77c91fdb836d1b9cce874c16486df9ceae0ba89e999fdd8ad2c14e",
"tests/test_ci_downloads_are_authenticated.py": "04bef9dcb53092d2bff696c8ebc77dd9238e66ae80b204b707944fe82da547fb",
"tests/test_ci_drive_gate_goes_through_the_core.py": "51a00b9ca3480f2df187a137467e16f6891850862e4c79671a3ef5ba898ebcc8",
"tests/test_ci_host_gate.py": "328cf30c2dcd45fa7ef8349981952d530c9d448883a370a4f4e8611b54e24adf",
"tests/test_ci_lab_geoip.py": "9bdae7f75db538cadc674df931522578f3e222a5fdb0eb3a006550f8e23d07e5",
"tests/test_ci_lab_geoip_verify.py": "754081f6b6d01d877043d3511377c641e2aacb4fe751033f1c6633ef66f68037",
"tests/test_ci_lab_intermediates.py": "d6accf8bc1e73e444d9a6ac8921dc7dee08064053090da57f22aa9515d067ced",
"tests/test_ci_lab_security_state.py": "cdd6b990a5039d31296f1e458a46199109a486113a11e1c87602690a16fc7dc4",
"tests/test_ci_real_geoip_check.py": "4e7abc43dab8c50ead9802137c7b34f80f8f2191cc8310aee73ac20f995e84fc",
"tests/test_ci_real_geoip_exit_code.py": "e5acaa5829ccea2a930a0c7310c9aa3ddc725c16bf883095bcad8125b5014fa9",
"tests/test_ci_runs_once_per_commit.py": "6c92c16d6914db249e88937a06bd81fc0a3bd124f1adbeda0852e70b21437ea1",
"tests/test_ci_verdict.py": "b56f0f076efcf4cb021aea361cb8c91bbde6044625f3ccea9e747c6c7bf744cd",
"tests/test_ci_workflows_build_the_geoip_database.py": "c232cb4e994e5c45b9563b13be811254fda5d63c427292216eaf6f4a45351ba5",
"tests/test_ci_workflows_set_the_intermediates_list.py": "48c18de15649eb4a6335cb56d7ee85f8a89ca3ba45b4d78b49d1068b492b84a0",
"tests/test_ci_workflows_set_the_security_state.py": "6a3e76f2826055352336787f72b581434cc8915702103447803f3e65b9991822",
"tests/test_cli.py": "3bbf3b676f1f698af0256b2a4e70de42e1a529d3fa52a13058c5b99316a0a54c",
"tests/test_click_rhythm.py": "ddd74c6e55c75dfb66780deb6617eab54596fe23f4e77b8eadbd616eb07396e2",
"tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py": "5af5f447d31c2dd8196d58f40c83dd5bcce370cadaf4f1bc68ab74221121d730",
"tests/test_connect_does_not_start_threads_on_the_loop.py": "ba67e88ce653558499d7f064f9b39ee37d664700f63382c922cef5b6b55d015b",
"tests/test_context_locale_e2e.py": "bc8c5955645fd3df66f9c701a45f7e31dc1e3d52e2202ee005787fe0590a5769",
"tests/test_context_locale_is_a_list.py": "31d2c45f8c6bfd3609f57b5b7cf33c954affac2ab3f272d8c8457e58ec8c5764",
"tests/test_context_proxy_only_resolves_by_doh_e2e.py": "7200b081c443cb559a6e5cd40028f42509ce0832057a9fe9ae81db17e83be928",
"tests/test_control_a_selects_all_in_a_field_e2e.py": "a10bd2c68c975bbfe8eb55e37c3f22626428608d177e803e1a9dfaabf1bbdbd8",
"tests/test_core_pin.py": "85c4baf6afef4f3df928547d82e651c8bc8f5262717adc82a8bcce341d00bc46",
"tests/test_cpu_by_type_window.py": "b02f4918c9e4394a34bb2ec8703effebe92e5dc233fd3659f986cb03b8cc0f92",
"tests/test_cross_origin_iframe.py": "3c3fb9113da40a62694eac0251a6fb60b4a604db9d3bdeec03ae8fb1f7bf406c",
"tests/test_cursor_dispatch.py": "7ea3d9aca83e672f059fbf85da3dead955176afc639a13e8ebf29b5b66ee04a8",
"tests/test_cursor_wiring.py": "86a48cae0a462e62f34179059cea8e60e4683fbbb3b6bfca5bb447f9893f0915",
"tests/test_declared_host_network_e2e.py": "e767b4d0d74a7ccac4f6d5ed4738d00eb7fd920cbee088a92ded3c0364c99aea",
"tests/test_detectors_e2e.py": "476fa9fd40bfb3d1e544a950efa7251f70a5eb650598ffc7912015d438cbf6e4",
"tests/test_docs_name_the_mcp_repo_as_it_is.py": "c6563d16a9c56fc80b6edee8b82de09288a939afbc3fa97b0c3d43bfbd9da4fa",
"tests/test_doh_session_prefs_unit.py": "802e51996616c044858add5df6b5e831879354b643326112e6faafa91f4e4f08",
"tests/test_doh_through_the_proxy_e2e.py": "59a3bfb8f262e3e934801d0bae7bfc144264e8286b5ad6e7e113204da405cc72",
"tests/test_doh_under_stress_e2e.py": "5f2e92d07ed1f0848c84ee2a3e11e5176659d800136773c974853e5cde8a716f",
"tests/test_download_is_intercepted_e2e.py": "dc77bf0ce3374c0896b03a877e6c4b4b4aae5dbefbb92ea5a7d013b8f5d9057b",
"tests/test_drag_motion.py": "8c7e2c00f35c3f6018d5c621f52677af53331fbae89bf18be1f0b84c0e38ece8",
"tests/test_e2e.py": "60fe4aad2e8fb6b146f09c590eb18037bcd8dfd009e2c29cacb217c882b001d6",
"tests/test_e2e_hermetic.py": "6ff72fb72345fc1f766edc63f741818c708a805b1041d18cc1bf7bddfce3dc91",
"tests/test_element_handle_actions.py": "a32fcaed7ebbed8a0e67477460c847084a05cca8bfd7e93072f8c5be371068b3",
"tests/test_element_screenshot_e2e.py": "42d9b82c856bd86140c64a959ab552d4391866916a2c59b0303c681a6e18a9f2",
"tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py": "3a7e3cd3ffeb285843d1e457a52199c9490851a5756ad307f2a5b076a91c5f1d",
"tests/test_every_page_draws_its_own_acts.py": "3a1f821d191e9c92b25e95f293094315cf9218f7e7083d08c0301a5824c2472f",
"tests/test_every_refusal_is_declared.py": "07d0669781c9576a76c1090731f6906708e72bdf65371384c5ade362d574694a",
"tests/test_every_route_command_is_answered_may_fail.py": "15359fc307e1dfdfb73e74bd1965b72a7d7de53dc9b07b7f5e10d0bc6ea820e2",
"tests/test_every_suite_runs_on_linux_and_windows.py": "bded76458724f831dfd4514ca7a35350650eab18f27bc42733c7e94f3c000515",
"tests/test_expose_binding_e2e.py": "87fc46eda36fa78e885add276c285e65db23c72d46add9fdafe79fc364473e12",
"tests/test_expose_binding_refusal.py": "830fa5b68be646ca2e51d187b2dd9ef1401ef6231aa648bec501e6992f19f24e",
"tests/test_fakeweb_p2_e2e.py": "0cce9485eda46eb6748f8d1df7bcfb1affa5ddb0c1a00d49f26dba662a27a265",
"tests/test_fakeweb_p4_e2e.py": "a85bb59424de263a2a299a35f0a9cb4123ffa3bc01f83fcf277255ed8b138d08",
"tests/test_fakeweb_p4_report.py": "87f7b4198e9aff1631fb67be33e146469c4ae18424e53de500509cb2a6799504",
"tests/test_file_chooser.py": "bdc2112386776e3c348eab585e0c6fb1c3ad75627e9e51588295d6ffa0ab8f62",
"tests/test_fingerprint_consistency.py": "b6da7f73a6fdd5ebf4297ee7f976ff0ca028493e40decd1be47b863b8dff5093",
"tests/test_fingerprint_surface.py": "20d2d936f925610a448a74d8b47cf6ecded48532e99ae9ad6d490bc016fab816",
"tests/test_first_launch_from_a_new_path.py": "e3d61cc2a8fc893a34058cf05204f9bfd8cbc93fa7544733b5aa5cafd044a45d",
"tests/test_fission_frames_dialogs_downloads_popups_e2e.py": "f206299cf493f63b4ebbb8b4c11fad5b657ef4ee0699675dcfd9e832547e5eb5",
"tests/test_fission_frames_history_and_processes_e2e.py": "78b4ea8d969c38547f2f72a036b081c2c3f7c1e08acb8baaa75eb60314713d37",
"tests/test_fission_frames_route_and_bindings_e2e.py": "2c443bf43fff41aa0143049c9650a9e16af4af2ef142c05a55c7bf4dd52dfc6c",
"tests/test_fission_frames_tree_input_and_pixels_e2e.py": "f9539f83f6d6130a90b1d3c75a96ce3d283c05b50a3e6f5d5ca816f927cf4319",
"tests/test_fission_frames_workers_storage_and_special_frames_e2e.py": "daf643d0e02bbf798bc25043343f7a9d5b5e55d6191fafea2d88733f1369285f",
"tests/test_fission_identity_parity_e2e.py": "9b5eb515f8758fb29aa6d6017d3f0a19b1ce3ad75d5134f0c391938d03653d7d",
"tests/test_fission_iframe_crash_e2e.py": "2518669c50908cce4ed370d88f400621cf9c1d031f6887c1ab06d88d77422ec5",
"tests/test_fission_strategy1_bench.py": "ad7a1c6fd5c1dc40a403b04806a6c210c1db30ed4d32d46c9776baa848b2ab82",
"tests/test_fixtures_name_why_the_package_is_missing.py": "8de82b31e4baef3dc2485a082e7e9136501a1796aa2a73b73ae40d9722cd581b",
"tests/test_fork.py": "fbd37d915c3aa8ea8490578b4da4b4207970efc928c5209a00c885cb6423e06d",
"tests/test_frame_dispatch.py": "04ca6dcba6e13064d201531ed14c23b1212fee14e3c1aa6027badd30699aa598",
"tests/test_frames_outlive_the_back_forward_cache_e2e.py": "75409e7e4b7d4259db5ece525042f6507884e05e1d2306ed7e33e39d8c904e7b",
"tests/test_geoip_used.py": "0ad66c33f98711bd00d909c3f421f4b02bfef0aae141f01751238cc88448b3e7",
"tests/test_goto_and_every_way_it_is_stopped_e2e.py": "47cfc60d65c0b01e858e9ccdfbb398e4f9a09448a760c82c45b38bd8f8ff9cf0",
"tests/test_goto_follows_the_base_url.py": "bd4867905bbf341333d6d84927452276a0c5595e96f4ce192251796fb13677a0",
"tests/test_goto_networkidle_after_spa_e2e.py": "ff985e48769cc3f0cb28a89b3a6f908ee33d98390be3eca09c16a9ae123b3ead",
"tests/test_goto_script_redirect_e2e.py": "03bf95321341a1ecb74938fe6129c63c829c122b991314bd3bce9746e3735ef4",
"tests/test_goto_to_the_same_url_e2e.py": "60ca2644145a3b727c273487d18787d81a1ba9c7627ca495ffebdbdf7e96eac4",
"tests/test_hidden_desktop.py": "0c3f58545f8dbd43acf527b7bd773e8d25abea9c912ba7bbfae2d570fa5a8af4",
"tests/test_hidden_display_linux.py": "101be6358fd7dcc2fea46fe992c2d12cf08b0ec99513ef76a0cfdad0c89314e6",
"tests/test_hook_wiring.py": "b06a8d0c747c695987086128cc4946e6baf2afbdd953f340cb1d0270c8bd88cd",
"tests/test_http3_through_the_proxy_e2e.py": "9f45e92a68f9ea913ade15cfb468b9cc13ca3f42e3a4a79de3de484649205ba9",
"tests/test_ice_names_by_the_context_proxy_e2e.py": "45135ea743e5afdc1c91bef419f09d5a1a0f5da5bce81be11f6d0016ac09838d",
"tests/test_ignore_https_errors_e2e.py": "7fa328cb862aa97d398e418a04c1e3185f0b34d33df20b3296b8f11070c7313d",
"tests/test_imports.py": "42bc09d1118cead72eae269ac3799bab9a3e622290edf720a7cfbf1ace9fd1fc",
"tests/test_injected_node_surface.py": "406e309fe370888aa337487694745a1cefbcc98a648b485eec8a0a7325649194",
"tests/test_input_is_born_before_the_page_sees_it_e2e.py": "72df96d948bc3eb1e3f44a2e18fb0a4cf500c702f8ad362b54dbc76c4f7fb95f",
"tests/test_integration.py": "39859483ad6fb2fed8137fb2c9310833248daf5d298ab35ed677c87fa5d47fe6",
"tests/test_juggler_actions.py": "dc84e5349674bee27d7cda61003210bca15afb9a49a9964b6e71940a4b398ef6",
"tests/test_juggler_connection.py": "aa2bb990598281dcf1da2a7b3e220b023bd1dac644d76e4231c7fcb402dad571",
"tests/test_juggler_event_buffer.py": "3b67fee3ecc8b806e1cf4dd1d6b644617b3f67537133e598a126757120108bb8",
"tests/test_juggler_event_listeners.py": "47b8c44423c8d250f465656b70264004102115d84e3b02863c63ef6b23469e85",
"tests/test_juggler_injected.py": "765e7974f840fb5d692b86de90fe653d71f176065c8206129ee6dfc1053b2c2e",
"tests/test_juggler_lifecycle_e2e.py": "d0e49fb71347926b11e4715d5f1aa0bbf6758e2ca96d1a9acba771fb00bf8989",
"tests/test_juggler_lives_in_the_core.py": "e14acc31eb3c31499f4270b5eb5e06ffbd89bd97892b4b5e796fd80b4d5e1885",
"tests/test_juggler_posix_pipe.py": "e26156bc3ee89d9c8213ce88ea45402a4c084b78212e735cea0a818885d423ed",
"tests/test_juggler_transport.py": "7f8af14f45dcaf7f7f48643266583fd4153a84144bcca15d9c932561cf9b16a6",
"tests/test_key_delay_reaches_the_keyboard.py": "daa93adecd07cad1cd1603c301c0f55e2fc2266f1c39b34ea6e8bedec28a1a0d",
"tests/test_keyboard_rhythm.py": "432cc602ce9625fc0fbddf767093d68d4ad3382c0ff5558d5947df7f699d3427",
"tests/test_launch_counters_run_on_github.py": "b36040ceacf6add9606be1aef2e18579ad0488dd9ec4981f5e6eb460577a79b9",
"tests/test_launcher_config.py": "2006cbac5f4a485033bb857c755f535eda3bf01a8dd1c551069e3d96335e9bb3",
"tests/test_launcher_helpers.py": "4a6b7bbed4f0b82ce96c71fd04c15c519cb488d24475f212bb454aab5826c560",
"tests/test_long_session_e2e.py": "96cd8fd6bb5ec76d56574d9bfb1bea0a3803dde55f7ed261f91ff6922f5e064a",
"tests/test_motion_never_hides_a_programming_error.py": "d70b395a2b156106064941dfbfa5c2247f2ed1f6f0701a9dac7d7101fa41dd8f",
"tests/test_mouse.py": "9183150efbf1c9766d415bf8032dd7570b8d30a28abc5cd08d7c9f0f64397b57",
"tests/test_mouse_events_keep_their_values_e2e.py": "bbeb14ebc08e7b471f7ef8db32b91c945f0b444870f30e197c1ac5695fa55547",
"tests/test_navigation_across_processes_e2e.py": "a497530248ce0de43022dccf33caa0fde1c9570f7e986267f40df4e783784e9a",
"tests/test_navigation_response.py": "ce6aaeb066d035234d6856197243a8ce6a6d8d321baa068e6cc45810db42427b",
"tests/test_nested_frame_actions.py": "a58d3b8507122d2336ab64a4150f2aad26a485708095dc71ab6354209ab2f9c1",
"tests/test_networkidle_reaches_the_client_e2e.py": "409edcc8c65b6b9be721e0e0a92bfdd9dafe8aec02186e297bf53897287fd70c",
"tests/test_networkidle_through_a_served_browser_with_routes_e2e.py": "a13e33f8f23bff09baa9321aaa4c62771349c3ab6d842c90f786eaf1a4424841",
"tests/test_new_page_defaults.py": "e74367f3e008e5345c8391070bce0ac857395a47b2aa69ca69d6376926d3c4ce",
"tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py": "48e8f6401d729269ff0d60f6a5e6f673b44339da49066420b5f14e4d6145b537",
"tests/test_no_legacy_in_the_wrapper.py": "510d0ad825eff4880775d55713ded24c19b3530d9b1da4866cbcb25e71381ed0",
"tests/test_no_override_leaves_the_persona_scheme.py": "d46a4c66359afafdac275ac1ef6994018de990e061d5a2d1d22c18b1e89a14f1",
"tests/test_no_thread_is_started_on_the_reader.py": "f882ec09a53c4d4541ecdaffe5a263523c355470109dd3f53c517cc8e8eb2e16",
"tests/test_nothing_leaves_but_the_proxy_e2e.py": "d025caeb277cae7fcb0dc2fd8966db714ffe97700be05f133141976a1f7b8427",
"tests/test_nothing_of_a_context_leaves_but_through_its_proxy_e2e.py": "c40bf1bbedfb7b4d0262af4eb594ad53f02cdd502de592ae0341a6acb86414a7",
"tests/test_oop_frame_element.py": "cc81644aa23226b5ff6c7d7e1f78863d33f4b4e07bf86b7c3fcb441c261cab86",
"tests/test_oop_frame_geometry.py": "03064113e169395e8edf2218b75fb38f0df9049d75342d4c2a2b0b892a27c589",
"tests/test_page_number_follows_the_call.py": "19fccae03e22cd302251cc78395e3f846d0b5477483bd59aea0b8a60ed60fe93",
"tests/test_persistent_profile_keeps_state.py": "b4f8a819fe44239cb4f1537e7acbaa1b97c07384dd5c6af5d53044607d8b999a",
"tests/test_pin.py": "e297f630a7c281d951c536cd7e683ce9daaefed78afafbeb6c9f91410f6a7a85",
"tests/test_pin_dicts_are_valid.py": "a6bbc441942cd5772a1a0d3a0b3b69540c2ae1b9f955fcd70b052e47cb68a0eb",
"tests/test_pinning_doc.py": "50a620a3b9fd9077eeda7806bf891f8a138aa5f9ba3dba7fd5f9d12b1b4fbd48",
"tests/test_pointer_position.py": "c2132d7ea8b1b8f628d262d2df2246d70d213723adc5a1f8ab5be91482041d1a",
"tests/test_pointer_server.py": "583ab849325708736c7235787df4be2a15b8827e83a03106c980a5845ab61f0e",
"tests/test_popup_adoption_unit.py": "ee9c2b940346cc0ab71151bdbb0b0ab988983df961847d3c548996c7e03ce4ab",
"tests/test_popup_destinations_e2e.py": "1d857eb23f9c81edda31bfdac4627cf082adb63e7ffbff978ebda7f75c57b2de",
"tests/test_popup_pages.py": "a9752710243580869a5fb676417eb09724f4c5dc9043ab9348f7ea2b0875dac1",
"tests/test_popups_reach_the_client_e2e.py": "82556ca17c9b8db3a0432b0030ebde116d21c56c8a7bb78b376247b2a94d4013",
"tests/test_prefs_composition_arm.py": "a91195bbb2a8b7fd2be986593572e54fb69b26ddcf3728d8a99ba9ae3abea1f2",
"tests/test_prefs_composition_arm_on_windows.py": "042064c088b2dd741f0ea44ea5905b024e83760fe1b90594370416d12029e8bf",
"tests/test_preload_newtab_is_written_only_when_asked.py": "a8a993de6e6d4d884e35657315604d4792eceed22914d3bf4d9c520a6813b8da",
"tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py": "e809201dbcd2194a5e26ac0a1b4586f14cf75d5d04fae6fad7419004061216a3",
"tests/test_protocol_names_are_declared.py": "d9fb8913d290c8a61bf461a2198a3e6fbe2c1a81f6a6f6384280595c97ee290e",
"tests/test_proxy_http_auth_e2e.py": "884f978221e7f968c43b2bf7261da93aac37049572aa563a27af153722701b0a",
"tests/test_proxy_reaches_the_browser.py": "b9fd7bde8fd419834c5171daab0de4d4b9865eb05739a2dad323abb323d6d04b",
"tests/test_proxy_socks_auth_e2e.py": "ad96a2d6542f909a29813b99028615d9a80f40c08eef26dab3541a83c56f6342",
"tests/test_publish_gate_wiring.py": "cc66c7d57450913222b0151175a27ba5549543c53cf2e026aefd8ed54f5d7994",
"tests/test_pyproject_names_real_paths.py": "a142fd2737ac94e3f965ad7d9bb40297fb3a9016379baf1b756a62b72be92bf1",
"tests/test_readme_claims.py": "0407f77f5c08c66a55a0f8fcac0857881c55c04cea8163ae1482018df5aa9e11",
"tests/test_real_sites_judge.py": "93f0a634b0813d4a520ca165fa39c6b91cae35b5099292995fc7a3f7d988e13c",
"tests/test_realness_behind_a_declared_exit_e2e.py": "c4f213a9d75577b84e64795c0da9fc57318acd2b536a6ce63d8968ad90a79850",
"tests/test_reaper.py": "4ff4b0473f20634704270cf9aabc16076adb80fa2a33121d630432c9e51c8801",
"tests/test_reaper_on_windows.py": "9b1748ed9fcd21883f23914cd1e0852f82ecf46b926c0eaac34ca83d708fd039",
"tests/test_release_e2e.py": "90254e1d3b8e19faf2419cc48d43772ffa85ed655656617fabb1f0a86fc4e964",
"tests/test_release_notes_install.py": "e0a6024ef78995e9650bccf0bcc7a72727b6bb6fb32f21f38b467c105f37e5fa",
"tests/test_request_gc_uses_the_page_session.py": "1a574bf6aa857a139548142211b05b34705fa15fa08fe0abe6e4be7a194ac3aa",
"tests/test_requestless_navigation.py": "6a9b2b8be968d5fcae0d089edd77f3d8fa5bfe2e6e4195ef0835b182d410d176",
"tests/test_resolver_race_e2e.py": "97bd5a66b47a0cde5b2e2f75f8dbdada255e2c30f4749601fec2bee356eb3d95",
"tests/test_resource_types_match_the_pinned_driver.py": "d7f2bfb2e8eb31deefcb283ccbc0c19401ebb36ef5369877a786fb1dd3493ec4",
"tests/test_route_abort_code.py": "6ec26ec73dce79161a7b2446955ef4c6d1697d1431a8402c3027fe1c5ef28209",
"tests/test_route_e2e.py": "0ee793c246bd5c5e200af069a300d626b85da6e641660efaaf382adefc7a5483",
"tests/test_route_header_order_e2e.py": "a5e58720c0dddd3a1090b565064170b1213bdc9061484e5eb9193a94fba8e1ea",
"tests/test_route_post_data_e2e.py": "88e0b42229841441ccaf9145ae58e2c6808ac3852c29d6c68751aeb4c77a1d32",
"tests/test_route_sends_a_navigation_elsewhere_e2e.py": "278fb9fa637586066c7352bafbab7c0ab0a6482e387e9fac2ee5a24053d1f8af",
"tests/test_route_superseded_e2e.py": "300b3eb7a7330cad9bd2b9a8eca42800c05e1c465a360fcecaa7478c2db0b467",
"tests/test_same_document_goto_e2e.py": "a10b3d5d1604ce4221e5d66e65191cfec9652d7a7a85167d54e7d63c6ead4a0b",
"tests/test_same_document_navigation.py": "5f7f61f265b6c5121595c799a7a24760d0df73618c665e127d8a7cb6bf6e02f8",
"tests/test_screencast.py": "2ffd209e3906c27a341fce7ab2f4238be9ea998a96cc6476e0f6c88590977988",
"tests/test_screencast_ack_race.py": "b66e8fa467fa41b48222f83809737e51a828e9adbc7479d1a53645cf5ba2b045",
"tests/test_screencast_stop_e2e.py": "27ef3263a76e8315623e059e6574d84cb84caec20f43c7a6246adf21e18c755f",
"tests/test_screenshot_looks_where_you_are.py": "03547af251d768a3d4885edae275ce0d14db59220f3f65abb0a6851e9852795e",
"tests/test_screenshot_of_text_returns_linux_e2e.py": "8d39b03f9c2dee6940b07ecd0dd4d51f2fe7608d24d467220ff71cddaeeaf245",
"tests/test_scroll_into_view.py": "16651e6f43cee76f95d96d0593d0aec44c4344a3a63ec78a0489db61d894ad7b",
"tests/test_scroll_only_if_needed_e2e.py": "b78ed5fcb9a596d63c68ceecb77ecdf92e744a6a64b16dc7b17b88dde9929125",
"tests/test_seal_binary_path.py": "b2655c6bb6b7747b0226ef44d65a13c58cfe1d168a8ca2026ff34624bb3dbaa7",
"tests/test_seal_floor.py": "da21918a05f93e50296c70815cc583262c9dd7bfa03a622f67e7dd62bd2c9b70",
"tests/test_seal_playwright_range.py": "bbd420a41cdbcc21f1f40b6412334b70b0d4b2e0e3e5d4645fec249a0ab3cba6",
"tests/test_seal_wire_version.py": "56173e3f3a622abcc3a564573b4c359185021ce784f755ddb84523be4be75658",
"tests/test_security_state_engine_e2e.py": "1db5f04a71fea453ba8d53eb7009f5d7ba9fcfc265be47fe19a29dc51bbe423a",
"tests/test_service_worker.py": "9a76bbedad588fb2a43e4913b326f58b442b8354369a3d05270c1fdac05fd8a8",
"tests/test_service_worker_controller_e2e.py": "d28afd1e19243df2479116b8321e5cca253717b90d00a55cd265ceb7932eea06",
"tests/test_service_worker_options.py": "40e70e6ec5744024ee280466924c10159b43c74a6a079085de84b7aadac4800f",
"tests/test_service_workers_blocked.py": "2a3571778f3c13eb1a19ff32bd46b1e40e85f753894d4738e2475d59fb348a20",
"tests/test_session_transport.py": "60c413770e0ea78bd01bae528818c0cb51dcf262ca9712a4a0bf87aac3620675",
"tests/test_set_input_files_payloads.py": "49107918de7d93d2f203a802b475b3a9c50ab9b80b848420923eb8f6c973cc51",
"tests/test_set_offline_e2e.py": "fb6a2d29871b1b1fe85acdbf9d6df60cfa6737dc96765c81a0ca45a6dddf2ac7",
"tests/test_shadow_trusted_input.py": "9dbb0dfa1ebf700ec2ec993d3752a2d47225571524382efae996d9587f5cba93",
"tests/test_software_compositing_is_declared_e2e.py": "747f25ff0eb37568c986edbe634bbca3f5f6cea7cbed0c9fdfbe97a87b616090",
"tests/test_strict_and_force.py": "707556806be438e1fb6663e174ec3c76770f95459ff92a46cbf2ef66d570e546",
"tests/test_the_argument_does_not_rewrite_the_expression.py": "bfd094b08582355c60d6e2d8df8b2cf39a5f3134f7dc492d06f1fed8b24b9c69",
"tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py": "ebfe2d15987c16a368f5da902593e6017fa9c4dd500ba50c7d5d2e8773239ed2",
"tests/test_the_callers_code_is_not_counted_e2e.py": "9b4d7f0033101db7a5242d39a7086b2c418282d8d880daabe312572190bd15b8",
"tests/test_the_callers_code_runs_once.py": "5a3d86180bd11ab1e9433905c2f99485269c7dfe6cf3c75a5530cf7d94384a01",
"tests/test_the_callers_code_runs_once_e2e.py": "f988010379d0af6527a584461f0001ad8cc83ecae32cd74f10fa355f3e748ea7",
"tests/test_the_census_needs_no_package.py": "225e8c1821085da1f18da20d45c83997411e000632e3d6537f4017f5674e692b",
"tests/test_the_changelog_covers_this_version.py": "3cfd227ac69901ab7cfe5a3286d5c3dbfdc1322b15279521253b1b733c159af3",
"tests/test_the_close_loop_verdicts_see_the_defects.py": "0aaa3afe2812f20f6fa326f8a0330e2639d1a32e3c2058eb45acf6e1734af976",
"tests/test_the_close_returns_when_the_browser_has_exited_e2e.py": "95dcd55b3cd8889c75ec3854aba9db1b376c222c2cd040a2fbc2fa282650f81e",
"tests/test_the_consecutive_port_tests_run_serially.py": "186412cc691a7b12b46d13fa3accbac1902d1e6ef5ff3e1615901abd411ed2db",
"tests/test_the_device_enumeration_takes_the_declared_time_e2e.py": "ff56e2abfc60256bc09774ca5bdc73972b1136292bf61ec083ecf3144246214e",
"tests/test_the_doh_e2e_launch_on_a_virtual_display.py": "33ae300b61cf37a8cce81adb14711ca870d1dcdf11d66ebd3377c10c526f910c",
"tests/test_the_e2e_run_stops_at_the_first_engine_refusal.py": "0f29e035ee261be18d2d7d2250c6da072e7a35ea024525be4eeb6716d0dd0772",
"tests/test_the_e2e_tests_do_not_wait_on_clocks.py": "d858a2a06d0d18e5ec30493703a320a425778a8b6bbdfebca238e933c5ac917d",
"tests/test_the_egress_sink_helpers.py": "af6bd061089da4363b99ce9dc7d3d244218ba05c86e52a3c0dc77b9c27e29b6f",
"tests/test_the_engine_is_born_in_the_job_e2e.py": "4db6c8e5274d095c489e25e481d5ec5a17fcdc1c3100a8069982497bc1d93f73",
"tests/test_the_engine_processes_of_a_test_come_from_its_tree.py": "32f45d4e7af16761dec0257fae360f9fa241fc5f37b3ff8d9453318c6f40c693",
"tests/test_the_exit_of_a_context_is_discovered_through_its_own_gateway.py": "a07027f344b531a9c6d047af0131a35a9b0811d03430f4c638ddf9de5e723b8b",
"tests/test_the_fake_doh_answers.py": "eee1db51996881388c3d3cbbabe66a97ae6a1317fb61892f0ccecfa8c40e9d72",
"tests/test_the_fake_doh_delays_and_refuses.py": "e3d8737e872039decb8d9dc876d37d5c4d621f09dbf897b602382d42e487f0f4",
"tests/test_the_fake_doh_tells_a_refused_certificate_from_a_dropped_connection.py": "4fa9aa72435612edd665719d82ca725925fd0722e049e49044256d7c36463009",
"tests/test_the_fake_web_asks_nothing_of_the_internet.py": "c4b41ba2f74400e63c51bd7097980e95e829ec3d097b9a18333534d9eb24963b",
"tests/test_the_favicon_stays_out_of_sight_e2e.py": "d89a381cf59c081cbd59097c85377bc8347dbb6de71419fc985202ec9e3db962",
"tests/test_the_floor_says_the_installer_of_this_environment.py": "baa238883691235250b426537e95e9da6bd68749073bd980b392bd050d83536a",
"tests/test_the_h3_line_helpers.py": "a76ec5669483bd69e975eb809b28c2346c1e80d5a24657e3729bdbc5fa8308e2",
"tests/test_the_hand_over_of_a_popup_holds_under_concurrency.py": "ea075622ed1dbc8f3ad58a5a5606ef94ce94711f3440c53280882b8bcc6c6f1e",
"tests/test_the_host_address_helper.py": "e104c158686333a80603ba838e6b5210ceb99570b2772d859523e6fd7f6c5905",
"tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py": "6dff62aaf9b926f78bd682a5e0e352534bf4dfe53bf5403ecd6f59314d55ebed",
"tests/test_the_http_proxy_helper_asks_for_credentials.py": "e2c16386e7c356a61c13bd307695b35f2bf579cc1766bc3718964d34bb2e0023",
"tests/test_the_install_job_waits_for_the_index.py": "1d6c1bc3934b32b6a10c898f4160102cc5699ae601e2aa8565ffc58347250e84",
"tests/test_the_keyboard_follows_the_session_language.py": "a745ec07a7020f4df8a6f1d3101b3efaccd9937a7f7abb573b6d349e2af86f95",
"tests/test_the_lab_ca_and_its_ocsp_leaf.py": "723e542175fcc9156869d0e43759acab1bce2b91028938d78f65ed31c32b31b8",
"tests/test_the_leak_watcher_sees_a_direct_connection.py": "a5dc39c2ebc379a17e80d8667c12623dc04fd138dddc30db64d5cd46fa64801d",
"tests/test_the_marionette_helpers.py": "2b7fa3b93f3de07eb086ebc2e2ce7a7d2386d8d48a170a2dcab884319e420152",
"tests/test_the_names_of_a_permission_are_the_engines.py": "e59caecfc07bbbd7fa574e098e730dfa28baacca7d5a0180709cd9d6bb72b9da",
"tests/test_the_network_declaration_reaches_the_engine.py": "31c11a5d6527ac341b8ad602f3343c17b50afe620769b61d5c058b9e21dbcfe7",
"tests/test_the_page_bytes_reference_compares_decoded_pixels.py": "fef6096a0ec7fd1e564e682300a27e93b0720cedc1725c958b1c38db3dfe3c38",
"tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py": "5374a67658c9c48359c68146b9644fab0d4197ce0424021f294feca2953eb698",
"tests/test_the_popups_test_helpers.py": "c0aef893d174e3cde3fbf741b09ffa8d058a1d1176a76591cd23f9a909170c91",
"tests/test_the_ports_are_one_sequence.py": "8d997db80819dcd8452d64178f3e15910a92ea2b17b82ff12ea95c9f70037688",
"tests/test_the_post_publication_files_run_only_in_their_own_round.py": "be772574b9e0f3b1047f37e6a0625f56685dd327d1e326ff37388e62518c144a",
"tests/test_the_real_sites_runner_imports_its_own_package.py": "ecdf34c87f70a0641e76182c50630066ab5ebe63833161ddda423002365d4961",
"tests/test_the_real_sites_workflow.py": "8b5236bd570604cc77af917de41894e8ed7e569a5f991f947de193468de2a63b",
"tests/test_the_realness_helpers.py": "3211aaf9a1f01e03a4efbf9c64c81f183fdfa51d20a157a4976f30945af78fe8",
"tests/test_the_registry_collects_the_oldest_like_playwright.py": "188e319115e0c441a7075c342bc30e22378b7f70e889cce09cf1967cf85c1b09",
"tests/test_the_remote_server_memory_probe_and_trim.py": "501fcae728a3bee087094493a785872584f20b41b894f984bb4cbd9fb56557de",
"tests/test_the_remote_server_serves_the_protocol.py": "8e9f36d9783c015133d12f614d5e97d994d654e1548ffec245e008cded349e1a",
"tests/test_the_resolver_trap_counts_its_own_users.py": "74189c33495ca93a33cc6479a77f6c035511ebb77f936169735da6b479c73399",
"tests/test_the_resolver_trap_is_required_by_the_gate.py": "862c3da5f21f192c297be545c23eb3c2cf4dfcfea934a286124f08904f221653",
"tests/test_the_root_e2e_run_in_the_root_step_and_nowhere_else.py": "10421f0802257983be343e78dd9e1cb2c2d2c45759cf9065240c412e944c0fc4",
"tests/test_the_sandbox_e2e_runs_where_user_namespaces_are_on.py": "3fb2e5b18caa40339f346d0662654ce4d611a7c7a6557b26eb85d3e3ade31bbb",
"tests/test_the_scheme_is_the_personas_e2e.py": "63143d88c1ee6e368bb7dc302d27a5a19bd39a2faa8dd5e1326582ef5c86939a",
"tests/test_the_second_goto_verdicts_see_the_defects.py": "507b462c4b60877fb072807b8b004cb2bbb6d04d55a20b736ff52aaa08fb733e",
"tests/test_the_server_is_exported_and_the_readme_shows_it.py": "fb666592d1574036c6a3d1536f43605a906eddeb094537064de6b46dcb780df5",
"tests/test_the_server_says_nothing_about_the_launch_counter.py": "8132a7c996fee1d93a7680db238dd53e538f2fe30b78b877a2623da68e7a17f4",
"tests/test_the_session_files_go_to_the_reaper.py": "8f30c22392ae1a573694e893fbd84bed26951928a2d6736771ebd0735f4c60de",
"tests/test_the_session_position_reaches_every_context.py": "2164f0dd6d46260fe7a351c9307833abd255ddcc3261225ddb0905f7e33c6194",
"tests/test_the_socket_process_is_sandboxed_e2e.py": "274af0db09fbc66f58918064ba689c309c1506019638c7ac35bc47ebe364b732",
"tests/test_the_timing_comparisons_run_serially.py": "5232f69f2ebce950d64401432d9de1b76be4e0858cce9101eeede1436585d8e8",
"tests/test_the_timing_of_the_e2e_tests_is_the_browsers_not_the_runners.py": "516741ff7057f44bd01334ffd4f99312d32df785ca415ebbb6e4358184c67cea",
"tests/test_the_udp_bench_survives_what_a_loaded_machine_does_to_it.py": "6f82661690088942537addeaff558e88bc99c6bf49df441c55f95b12a61a89d1",
"tests/test_the_udp_chain_helper.py": "144ea82e740f92e17e615d515b4d40ed7b0088470af89e4ad9bca7f635e26d45",
"tests/test_the_udp_line_helpers.py": "e089fb12d8671230d761b0f6e4acff8fe1d47a025028333f2f67edb1fec69f43",
"tests/test_the_unit_suite_is_accounted_for.py": "f3301eafe09a6e915f4c78dc77c2026dee67556ee1dbd84f52b1691e63c79837",
"tests/test_the_version_describes_the_code.py": "6db64fe0b6d59c073f5b64ffb0c175260f7552bdb89f61abd70ca6c7b46a9fa5",
"tests/test_the_waits_of_the_e2e_tests_end_on_a_condition.py": "4656dd1dcd2065d3f77c797c9b40877cc5e42c8dc53a0b10a0f068a776616f47",
"tests/test_the_whole_udp_chain_by_name_e2e.py": "a3fe788cecba7d98d46d40499ee405894792b43a571e454994128c9efb5a84cb",
"tests/test_the_wire_is_json.py": "48f89523b0d83f49876cd3eb1f92b50dd36ecf7eb91a939575f9e795d2a6c306",
"tests/test_the_witness_hears_a_direct_send.py": "863d5b77c0f3451b830f3d268e9241679505cd4e158daaab13ea0ed77a0b1e93",
"tests/test_the_witness_picks_a_port_both_sockets_bind.py": "acc056c825c07eeb71b55af526e4ab7bd40301bfbf0d32c980ba2bd09fff06da",
"tests/test_the_working_clone_has_its_hooks_armed.py": "37ba9063c8ba90b7059c3e3ef44d5eee6fe2c10dec49357d64530c1359315bd9",
"tests/test_the_working_clone_has_main_to_compare_the_debt.py": "c09fee036f5b2cd4e62e92ad1f03b24704e13a8b7cca585539e89e72ceb79d71",
"tests/test_the_working_clone_has_the_workbench_next_to_it.py": "eb1cc18021c5f37dc2fbaea0329fea4c2ce0e7172df54cae5659782f8db6c07b",
"tests/test_timeout_zero_is_no_limit.py": "f4b7dc56a2b5840fc6daf0ea1dea22a8d9798d20febf8261a46a5b6e70d1ebaf",
"tests/test_trial_does_not_act.py": "5b836b82b7cf3e6f41814d9c6505cba637da2f1740f140eb64a24997826d429a",
"tests/test_turn_over_tcp_is_tried_for_real_e2e.py": "2bf090d730807bbf380202f230cbac59da3142bfc87472a448f8ff5239b26354",
"tests/test_typing_a_character_without_a_key_e2e.py": "2018dec5589d58ce1cbb320bd2fc2e7372d5bebf092fa24ef6e8c782b3f4f4f4",
"tests/test_ua_widget_not_selectable.py": "c9c8af8f6176efce558deca44dc3fb1dbb5d707921f519be52361c0382063aec",
"tests/test_upgrade_e2e.py": "283179707e6ed13b03c19b27b981e91415bb267bd9da8eefb2a38a4b8e224bfe",
"tests/test_version.py": "b22609f731743835f3f681ed3227aa2e5d8462a166dfd9934440b744344914a6",
"tests/test_version_is_not_taken.py": "254661fd419fc5df2957c01238e333e9be32391ff719b9a11292a864f232d8be",
"tests/test_virtual_display_start_off_the_loop.py": "76cfa87142db05d8483ae6fb08348650c67e95818f2a6c5e1209047160fe587d",
"tests/test_voices_e2e.py": "642378ed4184173b572b0346c3bad2c5bef2a427e07d309dc96f3a0ce61cd4fb",
"tests/test_wait_for_function.py": "007d6818c4fc7a1041f1afb836050f34467c4a33957df7b034e1f7168a41d8f3",
"tests/test_wait_for_timeout.py": "9f1ee4b14e315532f4e0e2c113d537ef943ca0a11587b347ccde4f4a33fa9373",
"tests/test_web_fonts_of_closed_contexts_e2e.py": "6f0733b723e6a68d11804fe6ad2de7e18bdc97c19ebbbb17c3ee3bcc90b4c531",
"tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py": "9b8c284e2f49d0a83ee2d76fe95ab0773a075d9cb8f0fb4ca80ba6da9027adf2",
"tests/test_webgl_noise_active.py": "1a820cb9dd67e9fa4c909beab8ce2eeefb0da3eb81b178275dac017afdcb83e6",
"tests/test_webrtc_realness.py": "a671838e4cf47809ce03a5a94ee00cfe4bbd4cc215dd347278f1f609253bac35",
"tests/unit/test_bfcache_evidence.py": "aac37eae30b4140a84593973486b784b0f48771d4a08ed91bee102ea972f5a7e",
"tests/unit/test_config_public.py": "26463631553cda971169d8519621f0d02f1992be9cb86e6d56bdd3b697c49def",
"tests/unit/test_engine_at_least.py": "e12b329f0cad61615aa4783e737b034d10e9a1b2e025d90c032589ff2d4c1a98",
"tests/unit/test_fontconfig_cache_criterion.py": "117e968a6e52a0765367d9d716ae13d09577000f9438cd17d72d5b45b4b919ae",
"tests/unit/test_processes_counts_sites.py": "960541d1e102c8c1ea1b6aacad0a2ddf98083ba4daba720db8b58f8c11ec2a39",
"tests/vendor/README.md": "551b2c2337690f908914ef1a7a1ed2385bdde5ddf444ae1410d9cee464403681",
"tests/vendor/botd-2.0.0.esm.js": "f438ed251dc7414ece9d4a2b6941441ad9ffae1a1905817f5f0c7366e701dd86",
"tests/vendor/creepjs-10aa672.js": "80f43f364bd973bc03cb5b82de033ce28b2bbb145cb04237632a46ef040a92be",
"tests/vendor/fingerprintjs-5.2.0.umd.min.js": "a8de5ead580c42d2e2b01a5752aa08da510852230971aa18554d67cd5de5775b",
"tests/vendor/fpscanner-1.0.6.es.js": "5680b88e6075fceab5343d31b43dcb1892a98cff072d37084efdd244fd2cb809",
"tests/webfont_probe.py": "671fa104883b8d51159a58cf3f5a66c44c2cecbadfd48afe56228b8a2cea14e8"
}
},
"sdist_filename": "invisible_playwright-0.58.0.tar.gz",
"seal_tag": "",
"version": "0.58.0",
"wheel": {
"digest": "d7bf3c3b707bf2e97548e233dcd15ab7aad52e670ceccfa8a290c28fadaa00e4",
"files": {
"<dist-info>/METADATA": "3d4dda3a68fd4d64e094c253c9d565f96426fc8e90de71dd03a6474b3fc1eef3",
"<dist-info>/WHEEL": "da266b2640c891e0e1d24f528a428ca85b913feb9aea66f822bd40b04478044c",
"<dist-info>/entry_points.txt": "f07941bc791c2c31375755627886bfe11ba2d83df7b2522064f84be8299ee3a3",
"<dist-info>/licenses/LICENSE": "2abb03e63a96918967f383cbc36e3faefe10a47ae20b2cab43212ef965e02f96",
"invisible_playwright/THIRD_PARTY_FORK.md": "d54bd2a4c1e0b4d132d96647f82de205637d1ea0a739a61809b3d7c4048f65d7",
"invisible_playwright/__init__.py": "8d0fb7aa787c73bec8140616d9762fa6f672dfe9cb58a6d39dea42c2a429d801",
"invisible_playwright/__main__.py": "c6cd277050ead2d11c98b7cbab91ada7d19e495c95e4c86de1f9aaf2b2051d38",
"invisible_playwright/_cursor.py": "a30bcac49cb88d2f568764cdf20359bd8b49f1051034dcd7451f161d7237cb46",
"invisible_playwright/_engine.py": "5ee84a62eb30ead2632a49840b37cfc1a8bc0d41aef16e95186323085a364f38",
"invisible_playwright/_juggler/__init__.py": "96d6d06dad40f3c5112ab2bf9852c9d273ca891647baaf86e9913a06112db829",
"invisible_playwright/_juggler/_bindings.py": "3ccfc601acdee9fe67c6de693892ff90d53b60729df1be29f091493a4a3e0c9c",
"invisible_playwright/_juggler/_marshal.py": "11da69c3de627bd809a1d5b5371874f4aab3356d95ed602a4dfe4d53230245df",
"invisible_playwright/_juggler/_reaped.py": "81d85cdbcabbe9342486d90c995a27b7c31646936b51e264104acf436d49d453",
"invisible_playwright/_juggler/_threads.py": "a790d60fae3815169f2692af3377e62add5ac3ec240fa0dc7e6b52a88c7fa5c0",
"invisible_playwright/_juggler/dialogs.py": "5541004829d2484526fc93f11338bfdf9f63f3319e17fc95ea51f61e1b429220",
"invisible_playwright/_juggler/dispatcher.py": "a0314cb560c7a01132b81583b146ef693b5610c5b25fc5eb348fe0e247e51511",
"invisible_playwright/_juggler/memprobe.py": "b970afd7f877ac3ed631bd8b069000798034e32c1df497ce8102928aa29277d7",
"invisible_playwright/_juggler/perimeter.py": "6c453ccb00624a40d222ae8887c93aed688a108199d17e18e0791109c2686535",
"invisible_playwright/_juggler/pointer.py": "2516adc85c3872e120a58812f499023bb15c26b556b89c0edd12033d3d87ed40",
"invisible_playwright/_juggler/remote.py": "5346ff9f247e8b9611524515974aeec84210e5f164f99237a78845771292a21f",
"invisible_playwright/_juggler/server.py": "e03c54cd87fe4563cc2ea3abcc88cf6cdcf2aa278647d97c836b6aa82383bbf5",
"invisible_playwright/_juggler/transport.py": "e928e74fbc49f7cd00ba196c5ba1867cf14b34f5627b8f3ad9a0be8e7e78519a",
"invisible_playwright/_juggler/variants.py": "0ad98874f892ba1527be16230160166230aa846c5665bbf02fc0a643279a99c8",
"invisible_playwright/_juggler/wire.py": "fbe0399da9896031a104bdbe83a7c24a42dd6c264a23bd65d83e8e5f2be9e840",
"invisible_playwright/_pin.py": "34840d65c3ce32aa856f55344358a84cf47904471039a0a28d510166c6feda4b",
"invisible_playwright/_pw/LICENSE": "7fab1461b41970ff376f1c9303a637076bfaaeb71cd12dd3a1c44aaf59a1a2b9",
"invisible_playwright/_pw/README.md": "3ff2819bfde496151299983c4db167171e3e49933e7cf75613239893b2530570",
"invisible_playwright/_pw/__init__.py": "06c3acdadd13e2813fcb95ad91d53ee3885c2b5f473beccc45a579d9ceead70b",
"invisible_playwright/_pw/__main__.py": "dcc8e224337e54bb2febd50cc2e3c6db6ad345c2e148fe64612ca64c4dbea469",
"invisible_playwright/_pw/_impl/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"invisible_playwright/_pw/_impl/__pyinstaller/__init__.py": "5a8c0cfeb2d84ed4287afdec24ffcec60d1ed827b92afdfbd82b2351ffae1c15",
"invisible_playwright/_pw/_impl/__pyinstaller/hook-playwright.async_api.py": "d4a8c45554b3ba55e8102f03f576bab6ea4abfb70cdc60095471d504e34a1014",
"invisible_playwright/_pw/_impl/__pyinstaller/hook-playwright.sync_api.py": "d4a8c45554b3ba55e8102f03f576bab6ea4abfb70cdc60095471d504e34a1014",
"invisible_playwright/_pw/_impl/_api_structures.py": "7117217bc28b93311e0ded2232935bbb3e71cd36a69ace95faa5b5f019b6186d",
"invisible_playwright/_pw/_impl/_artifact.py": "3f06f56db387ad34194b9287291843e32ee6b2fbd06417872085ba5cdf58c3d0",
"invisible_playwright/_pw/_impl/_assertions.py": "ebfe537ce1c118606f256cf431d8acc55dbf45cec0ff8ce80b7d08189372d584",
"invisible_playwright/_pw/_impl/_async_base.py": "411bdbf2019879b7338bfd11291dab77662c4de8c029ce233f6c8c173845e440",
"invisible_playwright/_pw/_impl/_browser.py": "96af02910c9bd02ed3747049e4dc83f792b18ab363257bea5bb63e81335b5098",
"invisible_playwright/_pw/_impl/_browser_context.py": "c91c6e44a0dbc4e9c0430807561d9b92a73a3b33c406792a71a1362ccf995e46",
"invisible_playwright/_pw/_impl/_browser_type.py": "8e8fab1f8253952f971ea941948292e49fa08038e6566e6164ba1db927f16017",
"invisible_playwright/_pw/_impl/_cdp_session.py": "da1f31e66ee6a1a47a77412f6efa3e72670835a81d20a42a939cc6043f4c3357",
"invisible_playwright/_pw/_impl/_clock.py": "c3868a4cfdad993d99a554e58742f8c1e9f6806d51199e2870916e6c8b2eea2c",
"invisible_playwright/_pw/_impl/_connection.py": "0c345f8afd418c42c9722126b4562009922135df050c076ce279481cc9ae2534",
"invisible_playwright/_pw/_impl/_console_message.py": "4adcc1921c9ad348a2f796848b2ce92ab625b3f328ed611ac42d6576fe16ac66",
"invisible_playwright/_pw/_impl/_credentials.py": "0d5e2ea044d6a0861de54aae29de5f0da8ef871635384f57a111e2d70cd9843e",
"invisible_playwright/_pw/_impl/_debugger.py": "17a425f2c82a798098fe08a0a1b92be5fd7ccce0d56af25a6795e80d33aee2bd",
"invisible_playwright/_pw/_impl/_dialog.py": "2061f36b8952cd8fcb74c9a9cc9930c3a600eb1e7f6fa4ef1867867f353d14a6",
"invisible_playwright/_pw/_impl/_disposable.py": "564a3c3e3e2c5dc8db07727d682e2fb40c0e113e8489cf7fc179ed4aaea2ac87",
"invisible_playwright/_pw/_impl/_download.py": "5349c613615cc690593537acbedc83e5a53fd056521358cacaf2a355238efdd4",
"invisible_playwright/_pw/_impl/_element_handle.py": "b922cf771522209192727547185c922e9617f94fe55ae7c37ffa99cadf410a45",
"invisible_playwright/_pw/_impl/_errors.py": "49407bd6164ab563f82b2bf37863a265555071544dcabedbf7beba8be1b618cd",
"invisible_playwright/_pw/_impl/_event_context_manager.py": "55ea0fab5a17acbb3f6f797610cf20a77efcbc7b62e8c19bac53a138f39c7127",
"invisible_playwright/_pw/_impl/_fetch.py": "2756ee00ffb7cf8e178af4d9f8d56ab7d06828fce431faa9318e54a2ade55e1f",
"invisible_playwright/_pw/_impl/_file_chooser.py": "3efbf6c96f36cb906508330cb09ef5b5e1843e2b1aa95b27a5f85ec4376c8522",
"invisible_playwright/_pw/_impl/_form_data.py": "a9ce4cb4f77a06d24d31ea0e81a0e007a965bf33ad848ebed7cf0ad2f40f36b7",
"invisible_playwright/_pw/_impl/_frame.py": "0f974f94f52be86e510552900469c219007ba7a5ec05f3fe3a0d5cb78ff42b81",
"invisible_playwright/_pw/_impl/_glob.py": "af927c1cc1a33e12094224ca96158964ce2c7ad9f4b4de3ac60e16e0baf9f887",
"invisible_playwright/_pw/_impl/_greenlets.py": "27456c0ecfc181a04a6a1245e0f72549129e3af0b611e60607cb5d29f4fe2634",
"invisible_playwright/_pw/_impl/_har_router.py": "24fe3134253de1b71a3738348444dea88b78bdd250851ac7cfdac2ffcdef68b8",
"invisible_playwright/_pw/_impl/_helper.py": "c866f0dde846d84856404d7b6c72c5fbd5ac41302b1f6ac043016956256c2812",
"invisible_playwright/_pw/_impl/_impl_to_api_mapping.py": "ea1e5b8ea94f344a18a6c049e465d45044cfd61c2ef779887f076e675dffa655",
"invisible_playwright/_pw/_impl/_input.py": "14ed52c5e5bda7f5d8bde6b67fd651dee8c368344e13d652178d04e975ea1801",
"invisible_playwright/_pw/_impl/_js_handle.py": "cbb76fdf29d5087e2f2d04bac5e729bf7905238a9b386f3be9e01a4e2a95406a",
"invisible_playwright/_pw/_impl/_json_pipe.py": "c738956081dee483bbc032707553a9f9b3be38750f2ee7916390fa47fb1b19e8",
"invisible_playwright/_pw/_impl/_local_utils.py": "93677e1277ef74efcf52630d98a8857c1ea847b6e16757538040ce49e2758490",
"invisible_playwright/_pw/_impl/_locator.py": "c4457bbae669d98530a5bfd717619f8fc801a20c35e2e52e39b4f96193fba708",
"invisible_playwright/_pw/_impl/_map.py": "606086b53edc29605a5ff0b22147dfc640e38c65089df790063aed9cb89bfaa7",
"invisible_playwright/_pw/_impl/_network.py": "6af15cca7afa486ddb3edcea9ed2fdd2104f6ec268612dedf6707453a0c9433d",
"invisible_playwright/_pw/_impl/_object_factory.py": "16cf089afe2a37a18c397ac6cc9aebd296db731b6e6fac2a1248cae09585f26e",
"invisible_playwright/_pw/_impl/_page.py": "187b110afac50f94766b0b5b40a82c02b895e723c0000fbee7233deb0e08d11e",
"invisible_playwright/_pw/_impl/_path_utils.py": "2c0c34e8c14e04d350044e5ecca4d804b4c5f9191a94c450f58e6a3f9d8bcd1c",
"invisible_playwright/_pw/_impl/_playwright.py": "7f1771a504561f108c9e0faa9a44f4e4ab8cc13116bbf2686ea1a3b03ede7d52",
"invisible_playwright/_pw/_impl/_screencast.py": "3bbef5e66981e9216f27f83428207f61d33d2e371ce2121d195c9ed646d1001f",
"invisible_playwright/_pw/_impl/_selectors.py": "8f480ab03977b1d1d703a5519d195e3f3335e0e644cd559501167f39318db354",
"invisible_playwright/_pw/_impl/_set_input_files_helpers.py": "a8863bbe7d98520c8770f51b130c69c259ae629a829e1286588da6b16950377e",
"invisible_playwright/_pw/_impl/_str_utils.py": "0ff1b72ae6d0dfefc92939fca4cc0c2dcb7efe4fd8e520c72c630a6bd94b0fe3",
"invisible_playwright/_pw/_impl/_stream.py": "0f05ac6e14aa97ae37b68986bee03d656e3b1f92944b8aa42b9ad927df1803fa",
"invisible_playwright/_pw/_impl/_sync_base.py": "0bfe9eee479bad5295d7b281f20bb306ed652ef74a5053b14c320995a3187af5",
"invisible_playwright/_pw/_impl/_tracing.py": "d88db6cdfedaa54ee6435fb7dd5e89b2906ad409374ec0177d17a2bf344d694b",
"invisible_playwright/_pw/_impl/_transport.py": "96def727d12fec006999113563caca190e6f7e25bec81922ea274b552480dcf5",
"invisible_playwright/_pw/_impl/_video.py": "f7002004b2c26d072bd108f9539b8e1b698f917be7b17cd30cc7eb3fb373d6d6",
"invisible_playwright/_pw/_impl/_waiter.py": "d8cda0d02e1e92674c4c0a3127229ff87ca4ef214c1682daf3b64ad4268240e0",
"invisible_playwright/_pw/_impl/_web_error.py": "238b060de72bdf92b54f771622e9e9739b64240d73e7d573c9125f68a28b64a8",
"invisible_playwright/_pw/_impl/_web_storage.py": "7f942aee8cc96bd82ea59b3d0839e8b20e4f44f066343e8640e3180fe001ab70",
"invisible_playwright/_pw/_impl/_writable_stream.py": "4a4936a37ee5c783f88d7f6c7bfda2850bcc18867a420581ca16c90e1248047e",
"invisible_playwright/_pw/_repo_version.py": "d53af84ac37b99e382129383cbd4ae8f2c78798801ced917b9c0b0e23b34f58e",
"invisible_playwright/_pw/async_api/__init__.py": "77bbd2c48813238c42211e1470f66bcf82ec31373f89fbe0670b8cba52aae7d6",
"invisible_playwright/_pw/async_api/_context_manager.py": "acb8dc6cf148b3347a14ec8377ab269285363592ef3a3e703c3f537e41a21c4c",
"invisible_playwright/_pw/async_api/_generated.py": "b0a5713e9b560387b04bf6410c56b231ec90f0dd7e571f58d2af50013d977f18",
"invisible_playwright/_pw/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"invisible_playwright/_pw/sync_api/__init__.py": "a99ad0ce7f8511de29e3661e9e2c8b2dd5e8c4a0cfe7731de4428367df00c15e",
"invisible_playwright/_pw/sync_api/_context_manager.py": "5bc3c715bedad07533173bd27d6f690f07779ebea3fd49f8ec4bcd896a8aec5e",
"invisible_playwright/_pw/sync_api/_generated.py": "7881f3918cdeadd2909f82d36cfd993a54664638adf289cb9eb2e3dbd139f045",
"invisible_playwright/_session.py": "cd515bc2f27b42b58a5105a78a0466e321fff37dec2044bc53ecba4981f26dae",
"invisible_playwright/_version.py": "101d9ed902fb1a3a806f99f220eb10dd73ca656bd8b02f0c507ec338ef14890b",
"invisible_playwright/async_api.py": "51ac8fd3c7b1f7bc3b68af15ba84e3f0688525c33086332058b4fa1ea7a06f97",
"invisible_playwright/cli.py": "f8fb408ffdc93f3aeaeb775a454f71c1aa854b4921fc5cc3f618c3890bc4b81d",
"invisible_playwright/launcher.py": "af22dcbda32407a6b62d050671e68d8ed9f809500cd4d2a1d895bae9925f6c8d",
"invisible_playwright/py.typed": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"invisible_playwright/sync_api.py": "4c42eacfdd306f1b610a54bb54fcd1cbaef3c20dd525e584d3c587c4a846ea6b"
}
},
"wheel_filename": "invisible_playwright-0.58.0-py3-none-any.whl"
}
],
"schema": 1
-1
View File
@@ -1 +0,0 @@
{"format":1,"collection":"security-state/intermediates","collection_timestamp":0,"fetched_utc":"1970-01-01T00:00:00Z","count":0,"set_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","certs":[]}
-6
View File
@@ -1,6 +0,0 @@
{
"comment": "The preloaded-intermediates list every CI leg launches with (STEALTHFOX_INTERMEDIATES): EMPTY (format 1, no certificates), so a leg never asks Mozilla for the real list (the core neither downloads nor checks when the variable is set) and every run has the same bytes. Set by scripts/ci_lab_intermediates.py. To change the list, change ci/intermediates.json and sha256 here in one commit; `set` refuses to go on when they differ. The real list is looked at only by what the release proves about the product.",
"file": "ci/intermediates.json",
"sha256": "f4f6a2332a4d589a1e8aaa4e73c820644a764125bb2970667afc7351e7cb3465",
"bytes": 219
}
+12 -3
View File
@@ -7,13 +7,22 @@
{"id": "wrapper.e2e.context.egress", "giro": "G2", "os": ["linux", "windows"], "min_tests": 14, "exact": true, "tests": ["tests/test_nothing_leaves_but_the_proxy_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py"], "marker": "e2e", "needs_root": ["linux"], "note": "Taken from the minimal-engine port (branch tests/minimal-port) unchanged but for the removed engine gate: 12 = 6 kinds of page work (hints, image/fetch/WebSocket/EventSource, WebRTC STUN and TURN-udp by name, geolocation, a service worker with push, a page still loading when its context closes) x 2 schemes (no proxy at launch and a gateway on the context; a launch gateway and a different one on the context), and 2 = the TURN server named over TCP in those two schemes. EXPECTED RED on the published firefox-63: the 2 TURN-by-name cases (the lookup of the TCP socket takes user context 0; fixed by commits ac0214bff4 and 058edd6cc6 of firefox-64). The 12 have not run on any engine yet. Like wrapper.e2e.doh: the Linux leg runs as root for the resolver trap (INVPW_REQUIRE_TRAP=1); on Windows the DoH log and the gateway's CONNECTs are the sink."},
{"id": "wrapper.e2e.context.sink", "giro": "G2", "os": ["linux", "windows"], "min_tests": 36, "exact": true, "tests": ["tests/test_nothing_of_a_context_leaves_but_through_its_proxy_e2e.py"], "marker": "e2e", "needs_root": ["linux"], "note": "The behavioural half of the class gate 'nothing of a context leaves but through its proxy', with a witness at an address of this host (no root, no address on lo) and the engine's own resolver log as the native-lookup sink. 35 = 31 + the 4 OCSP cases; the 31 are 19 probes (fetch, WebSocket, stun, turn over UDP, turn and turns over TCP, each by name, by IP and by a .local name, behind SOCKS5 and behind an HTTP proxy where the road differs) + 3 controls (the same probe by IP with no proxy IS heard by the witness) + 1 control of the native sink. + 4 PeerConnections built from a torn-down window (a detached iframe, a closed popup; behind SOCKS5 and behind HTTP; defect B3: EXPECTED RED on firefox-63, green on firefox-64) + 2 controls of them (the same PeerConnection from an attached iframe, green on both). + 2 cases of two contexts alive at once (each with its own proxy and DoH, a TURN server over TCP by a different name in each; behind SOCKS5 EXPECTED RED on firefox-63 like turn_tcp-name-socks5, behind HTTP green on both). EXPECTED RED on firefox-63: turn_tcp-name-socks5, turns_tcp-name-socks5 (user context 0, fixed in firefox-64) and the three .local cases fetch-local-socks5, stun-local-socks5, stun-local-http (audit B4, also red on firefox-64 until decided). The Linux leg runs as root so the resolver trap is a second sink. Windows reads the same engine log (its getaddrinfo lines are in the parent process file under the sandbox: run 43574494194), with the no-proxy native control as its positive control. THE OCSP CASES (4): a TLS page whose leaf, signed by a lab CA the engine trusts (put in the profile by the engine's xpcshell, no ignore_https_errors), names its OCSP responder by a NAME (ocsp-<nonce>.lab.test) and by an IP; a context behind the gateway loads it and the request must go through the gateway, never be looked up natively, in user context 0, or reach the responder (2 cases, EXPECTED RED on firefox-63, green on firefox-64); the same page in a context with no proxy IS asked of the responder (control); a page of an issuer the engine does not trust makes no OCSP request (negative control). THE CLOSED CONTEXT CASE (1, gated firefox-65): a beacon sent on pagehide as a proxied context closes, to a name never looked up, is resolved over the DoH through the context's gateway after the close; on firefox-64 it went to the machine's resolver every time (hunt 43733181674)."},
{"id": "wrapper.e2e.realness", "giro": "G2", "os": ["linux", "windows"], "min_tests": 32, "exact": true, "tests": ["tests/test_realness_behind_a_declared_exit_e2e.py"], "marker": "e2e", "needs_root": ["linux"], "note": "The realness check without a real proxy: six declared exits, the values a page reads, and the roads. Linux runs as root without xdist like the DoH suite (the resolver trap); on Windows the trap does not exist and the assertion on the system resolver is the only one omitted."},
{"id": "wrapper.unit.udp", "giro": "G1", "os": ["linux", "windows"], "min_tests": 259, "exact": true, "tests": ["tests/test_doh_session_prefs_unit.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_preload_newtab_is_written_only_when_asked.py", "tests/test_the_doh_e2e_launch_on_a_virtual_display.py", "tests/test_the_egress_sink_helpers.py", "tests/test_the_exit_of_a_context_is_discovered_through_its_own_gateway.py", "tests/test_the_fake_doh_answers.py", "tests/test_the_fake_doh_delays_and_refuses.py", "tests/test_the_h3_line_helpers.py", "tests/test_the_host_address_helper.py", "tests/test_the_http_proxy_helper_asks_for_credentials.py", "tests/test_the_lab_ca_and_its_ocsp_leaf.py", "tests/test_the_leak_watcher_sees_a_direct_connection.py", "tests/test_the_network_declaration_reaches_the_engine.py", "tests/test_the_realness_helpers.py", "tests/test_the_resolver_trap_counts_its_own_users.py", "tests/test_the_resolver_trap_is_required_by_the_gate.py", "tests/test_the_server_says_nothing_about_the_launch_counter.py", "tests/test_the_udp_bench_survives_what_a_loaded_machine_does_to_it.py", "tests/test_the_udp_chain_helper.py", "tests/test_the_witness_hears_a_direct_send.py", "tests/test_the_witness_picks_a_port_both_sockets_bind.py"], "marker": "unit", "needs_root": false, "note": "92 = 6+32+21+7+8+3+9+6. The leak watcher file defines exactly one of its two resolver-trap tests per host (7 everywhere), so no test is skipped. `exact`: min_tests is raised by hand when a test is added. The sink of the egress gate (tests/test_the_egress_sink_helpers.py, 20): the engine's log (the same on Linux and Windows) and the witness read on known inputs, and a blind log that must raise, never answer 'nothing'. The lab CA of its OCSP case (tests/test_the_lab_ca_and_its_ocsp_leaf.py, 17; tests/test_the_fake_doh_answers.py +1, the DoH serving a lab-CA leaf): the leaf's AIA, trusted and untrusted issuers, the responder, the xpcshell step."},
{"id": "wrapper.unit.udp", "giro": "G1", "os": ["linux", "windows"], "min_tests": 263, "exact": true, "tests": ["tests/test_doh_session_prefs_unit.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_preload_newtab_is_written_only_when_asked.py", "tests/test_the_doh_e2e_launch_on_a_virtual_display.py", "tests/test_the_egress_sink_helpers.py", "tests/test_the_exit_of_a_context_is_discovered_through_its_own_gateway.py", "tests/test_the_fake_doh_answers.py", "tests/test_the_fake_doh_delays_and_refuses.py", "tests/test_the_h3_line_helpers.py", "tests/test_the_host_address_helper.py", "tests/test_the_http_proxy_helper_asks_for_credentials.py", "tests/test_the_lab_ca_and_its_ocsp_leaf.py", "tests/test_the_leak_watcher_sees_a_direct_connection.py", "tests/test_the_network_declaration_reaches_the_engine.py", "tests/test_the_realness_helpers.py", "tests/test_the_resolver_trap_counts_its_own_users.py", "tests/test_the_resolver_trap_is_required_by_the_gate.py", "tests/test_the_server_says_nothing_about_the_launch_counter.py", "tests/test_the_udp_bench_survives_what_a_loaded_machine_does_to_it.py", "tests/test_the_udp_chain_helper.py", "tests/test_the_witness_hears_a_direct_send.py", "tests/test_the_witness_picks_a_port_both_sockets_bind.py"], "marker": "unit", "needs_root": false, "note": "The leak watcher file defines exactly one of its two resolver-trap tests per host (7 everywhere), so no test is skipped. `exact`: min_tests is raised by hand when a test is added. The sink of the egress gate (tests/test_the_egress_sink_helpers.py, 20): the engine's log (the same on Linux and Windows) and the witness read on known inputs, and a blind log that must raise, never answer 'nothing'. The lab CA of its OCSP case (tests/test_the_lab_ca_and_its_ocsp_leaf.py, 17; tests/test_the_fake_doh_answers.py +1, the DoH serving a lab-CA leaf): the leaf's AIA, trusted and untrusted issuers, the responder, the xpcshell step."},
{"id": "wrapper.e2e.page", "giro": "G2", "os": ["linux", "windows"], "min_tests": 130, "exact": true, "tests": ["tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_popup_destinations_e2e.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py"], "marker": "e2e", "needs_root": false, "note": "130 = 126 + the 4 of test_a_drag_keeps_its_buttons_pressed_e2e.py (a drag reaches the page with the button it holds: event.buttons is 1 on every mousemove of a left drag, 2 on a right one, 0 after the release; with and without humanize). The 126 before it: 116 + the 9 of test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py (four browsers in one process, one closes: the loop is never seen inside a step of the close, the removal of the profile is held still and reached on a thread of the reaper while the close has returned, the other three keep answering; one control holds the loop on purpose, the other leaves it late in its selector and must not be charged). 116 = 100 + the 16 of test_a_page_that_moves_on_e2e.py (a navigation the page overtook with location.replace ends; the engine fix 860ef8a6d9 is proved by it; 2 of them the strict networkidle cases, a document still arriving that moves). 100 counted at the collection; was 96 = 10+32+16+34+4 before the popup tests of 6200bc2). A page is handed over when the engine says Page.ready; a popup reaches the client (link, noopener, window.open; own site and another; with and without a route; in-process and over launch_server) as Playwright's does; a superseded route. Needs the candidate binary, and the stock Playwright client of the dev extra."},
{"id": "wrapper.unit.page", "giro": "G1", "os": ["linux", "windows"], "min_tests": 72, "exact": true, "tests": ["tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_page_number_follows_the_call.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_the_hand_over_of_a_popup_holds_under_concurrency.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py"], "marker": "unit", "needs_root": false, "note": "72 = 44 + 3+9+5+1+10 of the popup hand-over (24 counted at the collection before; was 20 = 3+8+1+8 before 6200bc2). The page dispatcher's wait for Page.ready and what it hands over; the drive gate goes through the core (the engine waits for the session's road)."},
{"id": "wrapper.e2e.compositing", "giro": "G2", "os": ["linux", "windows"], "min_tests": 9, "exact": true, "tests": ["tests/test_software_compositing_is_declared_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The engine DECLARES software compositing on every machine (core: the compositing entries of zoom.stealth.gfx.feature_status carry the VM decision, and on Windows gfx.webrender.software=true, gfx.webrender.software.d3d11=false). 3 = (1) the compositor read from a privileged context is 'WebRender (Software)' on Windows and on Linux (windowUtils.layerManagerType of each window: Troubleshoot.snapshot().graphics throws on this engine, `ext is null`, so it is not the route); (2) the GPU process uses under 1.5 s of CPU on the fixed 10-scene loop of one browser (Windows runner: 0.32 s declared, 2.7-4.2 s not, runs 43652292533 and 43642744101; on Linux it is held to the bound if a GPU process exists); (3) the 86 keys of the page-bytes probe plus the canvas 2D scenes (drawImage scaled with smoothing off/low/medium/high, text with linear/radial/conic gradients) equal tests/data/page_bytes_<os>.json, PNGs on decoded pixels. EXPECTED RED on the core 64.71.0 (tests 1 and 2 on Windows). The reference of Windows holds the 75 stable keys and 6 of the 11 PNG keys of run 43652292533; the five other PNG keys and the new canvas keys, and all of Linux, are written from the first run on the engine of the reference (the failure of test 3 prints RECORD-BEGIN ... RECORD-END with the entries to merge): a reference that is not complete is red, never skipped. 9 = those 3 + the 6 families of tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py (from firefox-66, engine_at_least): a screenshot draws the text of Arial, Times New Roman, Consolas and Segoe UI, with accents, the typographic apostrophe, the euro sign, Chinese, Arabic and Russian, and of MS PGothic (face 2 of msgothic5_32.ttc: Japanese and Latin) and NSimSun (face 1 of simsun.ttc: Chinese), two faces that are not the first of their collection, with the same bytes as the content process drew them in a canvas (an SVG image with a foreignObject of the same markup), cut from the same page.screenshot, on both systems and with no threshold. EXPECTED RED on every engine that rebuilds the text in the parent with another font than the bundle (Linux: fontconfig answers DejaVu Sans), and skipped, hence red here, on an engine older than firefox-66. It saves the screenshot, the two boxes and a result.json under RUNNER_TEMP/invpw-evidence."},
{"id": "wrapper.e2e.fakeweb", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_fakeweb_p2_e2e.py", "tests/test_fakeweb_p4_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The fake web, offline: our browser on the hard pages (profile P2: a reused routed page reaches networkidle every time, also under a load of three other browsers; the other site is another process) and on the 17-step journey of a person (profile P4), each judged against what stock Firefox does, as tests/fakeweb/pages.json declares it. 4 = 3 + 1. Stock itself is held to that declaration, and compared with ours step by step, by scripts/run_fakeweb.py in .github/workflows/fakeweb.yml. Needs the candidate binary (STEALTHFOX_E2E_BINARY)."},
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 2, "exact": true, "tests": ["tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the parent of the engine shows <GRE>/fonts to it (FcConfigAppFontAddDir) to rebuild a font from a path and a face index. On Windows DirectWrite opens the file from its path, with no folder to scan and no cache to read, so this test has no Windows counterpart.", "note": "2 = (1) the stand-in that runs the engine under strace stays in the engine's place, as the core launches it (the leader of a process group of its own): a fake engine with a child, no browser; the process the launcher holds lives as long as the fake engine, and the group killed holds strace and the child (the stand-in that exec'd setsid forked and exited 0 at once: candidate 44161687675); (2) the warm launch of the parent reads the bundle from fontconfig's cache and does not scan it again (from firefox-66, engine_at_least). Two launches under strace with the same XDG_CACHE_HOME of the test, the first cold and the second warm: the cold parent opens every font file of <GRE>/fonts (the folder as the disk lists it) before any page and fontconfig writes its cache; the warm parent does not open every one of them, and it opens a *.cache-* file of fontconfig (a few files are opened to be used, so the verdict asks about the whole folder, as a scan does). Scan and drawing are told apart by position: only what the parent opens before the first page counts (the opens that draw are written as after_startup). Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-cache: the interval and the number of opens of the bundle, the names of the files of the bundle each launch opened before the first page, the size of the cache file, the VmRSS of the parent after about:blank and after a page with every family, and a third launch with gfx.bundled-fonts.activate=0 (the behaviour before), which is evidence only. Needs strace on the runner: without it both are red, not skipped. No threshold."},
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 30, "exact": true, "tests": ["tests/test_the_page_bytes_reference_compares_decoded_pixels.py"], "marker": "unit", "needs_root": false, "note": "The helpers of wrapper.e2e.compositing on known inputs, no browser: the PNG compared on decoded pixels (another deBG chunk and compression are the same, one pixel is not, every scanline filter), the comparison with a reference (changed, missing and extra keys named, the entry to record), the type of an engine process, an engine process known by its executable and not by the name it gives itself (Linux), and the CPU of a window, and the shape of the committed Windows reference, and the box cut out of a screenshot (its pixels, a box outside the picture refused, written as a PNG and read back, two boxes told apart by a pixel that is named, the pixels that are not grey)."},
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 2183, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_css_calc_is_windows_e2e.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_math_sin_cos_tan_are_windows_e2e.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_preload_newtab_is_written_only_when_asked.py", "tests/test_protocol_names_are_declared.py"Line truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2184, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_css_calc_is_windows_e2e.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_math_sin_cos_tan_are_windows_e2e.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_are_valid.py", "tests/test_pinning_doc.py", "tests/test_pointer_server.py", "tests/test_popup_adoption_unit.py", "tests/test_prefs_composition_arm.py", "tests/test_prefs_composition_arm_on_windows.py", "tests/test_preload_newtab_is_written_only_when_asked.py", "tests/test_protocol_nameLine truncated
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 2311, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_moving_page_model.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/testLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 2312, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_integration.py", "tests/test_juggler_event_buffer.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py", "tests/test_juggler_lives_in_the_core.py", "tests/test_juggler_transport.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_launch_counters_run_on_github.py", "tests/test_launcher_config.py", "tests/test_launcher_helpers.py", "tests/test_motion_never_hides_a_programming_error.py", "tests/test_moving_page_model.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_no_event_of_any_family_is_lost_by_the_hand_over.py", "tests/test_no_legacy_in_the_wrapper.py", "tests/test_no_override_leaves_the_persona_scheme.py", "tests/test_no_thread_is_started_on_the_reader.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pin.py", "tests/test_pin_dicts_Line truncated
{"id": "wrapper.e2e.securitystate", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_security_state_engine_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The security state the core declares, against the engine: the engine launched directly in its generate mode makes what it is given (the contract's result, security_state/ with the bytes of the full filter and of the delta, the core's own validation of it); a normal launch declares no pref of the mode and re-imports nothing; a certificate that Mozilla's CRLite test data say is revoked in a delta is refused at the first navigation (SEC_ERROR_REVOKED_CERTIFICATE) while a valid one loads, and the revoked one loads when the ready directory has no data; a ready directory with no or an empty security_state/ starts. Certificates made on the run (a fresh root trusted in cert9.db by the engine's own xpcshell, Mozilla's default test key as the key of CN=int), servers on loopback, no network. Red on firefox-67 (no generate mode)."},
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 376, "exact": true, "tests": ["tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_declared_host_network_e2e.py", "tests/test_detectors_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_element_screenshot_e2e.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_display_linux.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_ignore_https_errors_e2e.py", "tests/test_injected_node_surface.py", "tests/test_juggler_connection.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_navigation_response.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_oop_frame_element.py", "tests/test_oop_frame_geometry.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_screencast.py", "tests/test_screencast_stop_e2e.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_offline_e2e.py", "tests/test_shadow_trusted_input.py", "tests/test_strict_and_force.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_a_launch_scans_no_process_of_the_machine", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_after_close_no_process_of_the_session_is_left", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_ua_widget_not_selectable.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_through_the_proxy_of_that_context", "tests/test_webrtc_realness.py::test_two_contexts_with_two_proxies_each_gets_the_srflx_of_its_own"], "marker": "e2e", "needs_root": false, "windows_twin"Line truncated
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 411, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_drag_motion.py", "tests/test_expose_binding_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_new_page_defaults.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_e2e.py", "tests/test_route_post_data_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screenshot_of_text_returns_linux_e2e.py", "tests/test_scroll_into_view.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_service_workers_blocked.py", "tests/test_set_input_files_payloads.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 564 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapLine truncated
{"id": "wrapper.e2e.suite.linux.3", "giro": "G2", "os": ["linux"], "min_tests": 239, "exact": true, "tests": ["tests/test_a_click_in_an_iframe_lands_at_the_frames_own_screen_origin_e2e.py", "tests/test_a_context_language_is_the_accept_language_of_every_request_e2e.py", "tests/test_a_goto_to_a_refused_port_ends_with_its_reason_e2e.py", "tests/test_a_launch_and_a_context_timezone_reach_the_page_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py", "tests/test_audio_context_values_are_declared_e2e.py", "tests/test_audio_noise_e2e.py", "tests/test_audio_sample_rate_is_declared_e2e.py", "tests/test_bundle_font_names_e2e.py", "tests/test_canvas_create_pattern_projection_e2e.py", "tests/test_canvas_measure_text_metrics_e2e.py", "tests/test_css_media_reads_the_declared_screen_and_pointer_e2e.py", "tests/test_dom_iterables_from_evaluate_e2e.py", "tests/test_every_reader_of_a_webgl_canvas_agrees_e2e.py", "tests/test_fakeweb_p2_e2e.py", "tests/test_fission_frames_tree_input_and_pixels_e2e.py", "tests/test_focus_survives_os_deactivation_e2e.py", "tests/test_fullscreen_without_wm_e2e.py", "tests/test_geolocation_reads_nothing_of_the_host_windows_e2e.py", "tests/test_goto_and_every_way_it_is_stopped_e2e.py", "tests/test_hardware_values_are_declared_e2e.py", "tests/test_ipv6_literal_connect_e2e.py", "tests/test_moz_element_paints_a_webgl_canvas_as_drawn_e2e.py", "tests/test_native_line_endings_are_windows_e2e.py", "tests/test_nested_frame_actions.py", "tests/test_networkidle_through_a_served_browser_with_routes_e2e.py", "tests/test_nothing_leaves_but_the_proxy_e2e.py", "tests/test_nothing_of_a_context_leaves_but_through_its_proxy_e2e.py", "tests/test_page_element_atoms_run_in_a_sandbox_e2e.py", "tests/test_popup_geometry_is_the_declared_frame_e2e.py", "tests/test_script_cache_written_is_adopted_e2e.py", "tests/test_the_branding_a_page_loads_is_the_declared_archive_e2e.py", "tests/test_the_evaluated_code_has_no_debugger_name_e2e.py", "tests/test_the_launch_counter_is_one_plain_get_before_any_page_e2e.py", "tests/test_the_shutdown_ping_leaves_by_the_background_task_e2e.py", "tests/test_webgl_declared_parameters_e2e.py", "tests/test_webgl_shader_language_e2e.py", "tests/test_webgpu_adapter_is_declared_e2e.py", "tests/test_webgpu_canvas_readback_is_noised_e2e.py", "tests/test_webgpu_external_texture_e2e.py", "tests/test_window_occlusion_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.3", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 565 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on linux (a skip is red in the verdict)."},
{"id": "wrapper.e2e.suite.windows.1", "giro": "G2", "os": ["windows"], "min_tests": 260, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_goto_to_a_refused_port_ends_with_its_reason_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_canvas_create_pattern_projection_e2e.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_detectors_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_reader_of_a_webgl_canvas_agrees_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_focus_survives_os_deactivation_e2e.py", "tests/test_geolocation_reads_nothing_of_the_host_windows_e2e.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_ignore_https_errors_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_transport.py", "tests/test_keyboard_rhythm.py", "tests/test_moz_element_paints_a_webgl_canvas_as_drawn_e2e.py", "tests/test_nested_frame_actions.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_workers_blocked.py", "tests/test_strict_and_force.py", "tests/test_the_engine_is_born_in_the_job_e2e.py", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_the_shutdown_ping_leaves_by_the_background_task_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_ua_widget_not_selectable.py", "tests/test_webgpu_canvas_readback_is_noised_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "Part 1 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 609 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict)."},
{"id": "wrapper.e2e.suite.windows.2", "giro": "G2", "os": ["windows"], "min_tests": 218, "exact": true, "tests": ["tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_audio_context_values_are_declared_e2e.py", "tests/test_bundle_font_names_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_css_media_reads_the_declared_screen_and_pointer_e2e.py", "tests/test_declared_host_network_e2e.py", "tests/test_expose_binding_e2e.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fullscreen_without_wm_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_desktop.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_native_line_endings_are_windows_e2e.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_nothing_leaves_but_the_proxy_e2e.py", "tests/test_nothing_of_a_context_leaves_but_through_its_proxy_e2e.py", "tests/test_oop_frame_geometry.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_e2e.py", "tests/test_screencast_stop_e2e.py", "tests/test_the_branding_a_page_loads_is_the_declared_archive_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_evaluated_code_has_no_debugger_name_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_through_the_proxy_of_that_context", "tests/test_webrtc_realness.py::test_two_contexts_with_two_proxies_each_gets_the_srflx_of_its_own"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 610 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict)."},
{"id": "wrapper.e2e.suite.windows.3", "giro": "G2", "os": ["windows"], "min_tests": 273, "exact": true, "tests": ["tests/test_a_click_in_an_iframe_lands_at_the_frames_own_screen_origin_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_audio_noise_e2e.py", "tests/test_audio_sample_rate_is_declared_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_dom_iterables_from_evaluate_e2e.py", "tests/test_drag_motion.py", "tests/test_element_screenshot_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_first_launch_from_a_new_path.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_and_every_way_it_is_stopped_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_ipv6_literal_connect_e2e.py", "tests/test_networkidle_through_a_served_browser_with_routes_e2e.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_post_data_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screencast.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_input_files_payloads.py", "tests/test_set_offline_e2e.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_launch_counter_is_one_plain_get_before_any_page_e2e.py", "tests/test_webgl_declared_parameters_e2e.py", "tests/test_webgl_shader_language_e2e.py", "tests/test_webgpu_adapter_is_declared_e2e.py", "tests/test_webgpu_external_texture_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "Part 3 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 610 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict)."},
{"id": "wrapper.e2e.suite.windows.4", "giro": "G2", "os": ["windows"], "min_tests": 270, "exact": true, "tests": ["tests/test_a_context_language_is_the_accept_language_of_every_request_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_launch_and_a_context_timezone_reach_the_page_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_canvas_measure_text_metrics_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_fakeweb_p2_e2e.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_frames_tree_input_and_pixels_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_hardware_values_are_declared_e2e.py", "tests/test_injected_node_surface.py", "tests/test_juggler_connection.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_oop_frame_element.py", "tests/test_page_element_atoms_run_in_a_sandbox_e2e.py", "tests/test_popup_geometry_is_the_declared_frame_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_script_cache_written_is_adopted_e2e.py", "tests/test_scroll_into_view.py", "tests/test_shadow_trusted_input.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_window_occlusion_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.2", "note": "Part 4 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 609 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict)."},
{"id": "wrapper.e2e.suite.windows.control_a", "giro": "G2", "os": ["windows"], "min_tests": 20, "exact": true, "tests": ["tests/test_control_a_selects_all_in_a_field_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "The keyboard shortcut Control+A selects all in a field (5 ways to press it x an input and a textarea, in-process and served to the stock client), alone on its own Windows runner (windows-latest), as e2e.yml runs it on the published engine: the Windows keyboard of a real user is what it needs. The same file is in one of wrapper.e2e.suite.windows.1..4 and in wrapper.e2e.suite.linux.1."}
]
+12
View File
@@ -0,0 +1,12 @@
[
{"file": "tests/test_css_calc_is_windows_e2e.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 1, "wrapper.unit.all.windows": 1}},
{"file": "tests/test_math_sin_cos_tan_are_windows_e2e.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 1, "wrapper.unit.all.windows": 1}},
{"file": "tests/test_system_fonts_and_colors_are_windows_e2e.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 1, "wrapper.unit.all.windows": 1}},
{"file": "tests/test_webgl_dot_has_the_declared_gpu_s_bits_e2e.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 3, "wrapper.unit.all.windows": 3}},
{"file": "tests/unit/test_canvas_icc_refs.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 9, "wrapper.unit.all.windows": 9}},
{"file": "tests/unit/test_canvas_text_colors_refs.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 8, "wrapper.unit.all.windows": 8}},
{"file": "tests/unit/test_canvas_text_refs.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 7, "wrapper.unit.all.windows": 7}},
{"file": "tests/unit/test_compare_canvas_text_runs.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 3, "wrapper.unit.all.windows": 3}},
{"file": "tests/unit/test_fontconfig_criterion.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 5, "wrapper.unit.all.windows": 5}},
{"file": "tests/unit/test_theme_refusal_drop.py", "reason": "feature cancelled with the 69 backlog (21/11)", "date": "2026-11-21", "tests": {"wrapper.unit.all.linux": 3, "wrapper.unit.all.windows": 3}}
]
+6
View File
@@ -0,0 +1,6 @@
{
"comment": "The ready security state every job of ci.yml launches with (STEALTHFOX_SECURITY_STATE, set at the top of the workflow): a result with NO data (format 1, ok, no CRLite hashes, zero timestamps, no engine) and no security_state/ directory, so a launch copies nothing and no job asks Mozilla for anything or runs the engine's generate mode (the core neither downloads nor generates when the variable is set). To change it, change ci/security-state/securitystate-result.json and sha256 here in one commit; tests/test_ci_sets_the_security_state.py fails when they differ.",
"file": "ci/security-state/securitystate-result.json",
"sha256": "15bed64b8d0d0db9e6e5cceeec231bbca5300cdc6715280a647895dd6f6f14a4",
"bytes": 260
}
@@ -0,0 +1 @@
{"format":1,"ok":true,"error":null,"engine":{"version":"","build_id":""},"collections":{"intermediates":{"collection_timestamp":0},"onecrl":{"collection_timestamp":0},"cert-revocations":{"collection_timestamp":0,"channel":"default"}},"crlite_filter_hashes":[]}
+2 -2
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "invisible_playwright"
version = "0.57.1"
version = "0.58.1"
description = "Playwright wrapper for a patched Firefox with deterministic stealth profile."
readme = "README.md"
requires-python = ">=3.11"
@@ -69,7 +69,7 @@ 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==67.79.0",
"invisible_core==68.80.0",
# ⛔ playwright is NO LONGER a dependency: since the full fork, the Python
# client lives in src/invisible_playwright/_pw/ and its server in
# src/invisible_playwright/_juggler/ (no Node driver). Reintroducing it would not visibly
-172
View File
@@ -1,172 +0,0 @@
"""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))
-184
View File
@@ -1,184 +0,0 @@
"""Builds tests/data/canvas_text_ref_colors/refs.json from the bytes retail Firefox drew.
The reference of tests/test_canvas_text_colors_and_cleartype_is_windows_e2e.py: coloured
canvas text, and 39 cases (25 of black text on white, 14 coloured) under three ClearType
keys, all measured on retail Firefox 159.0 on Windows with tests/data/canvas_text_ref_colors/
index.html (the 14 coloured cases) and tests/data/canvas_text_ref/index.html (the 25 black
ones). The measuring harness saved, for every case, the RGBA bytes of the canvas
(<name>.rgba) and a <name>.json with its id, width, height and sha256:
<BYTES>/colors/retail/<name>.{json,rgba} the 14 coloured cases, retail's own
ClearType state (the seed's)
<BYTES>/keys/<gamma>_<contrast>/retail/<name>.{json,rgba}
the 39 cases under that key; the case
id of a coloured one is "color:<id>"
python -I scripts/build_canvas_text_colors_refs.py --bytes <BYTES> \
[--keys 1800_100,1400_50,2200_0] [--out tests/data/canvas_text_ref_colors/refs.json]
The repository holds no .rgba: they are 270 kB each. The script hashes an .rgba when the
directory has it (and stops if that is not the sha256 its .json says, or the size is not
width x height x 4); when only the .json is there (a byte file kept only where the engine
differed) it takes the hash the harness wrote. It stops too when the black cases under
1800/100 are not the ones tests/data/canvas_text_ref/refs.json holds for the same ids, or
when the coloured cases under 1800/100 differ from the ones of colors/retail (same machine,
same key: they are one measurement). Standard library only.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
DATA = ROOT / "tests" / "data" / "canvas_text_ref_colors"
BASE_REFS = ROOT / "tests" / "data" / "canvas_text_ref" / "refs.json"
DEFAULT_KEYS = "1800_100,1400_50,2200_0"
SEED_KEY = "1800_100"
DATE = "2026-11-09"
#: The prefs of the retail profile for the keys (user.js), gamma and contrast per key.
RETAIL_PREFS = {
"gfx.canvas.accelerated": False,
"gfx.font_rendering.cleartype_params.gamma": "<gamma>",
"gfx.font_rendering.cleartype_params.enhanced_contrast": "<contrast>",
"gfx.font_rendering.cleartype_params.cleartype_level": 100,
"gfx.font_rendering.cleartype_params.pixel_structure": 1,
"gfx.font_rendering.cleartype_params.rendering_mode": 0,
}
#: The coloured cases of colors/retail were measured with the machine's own ClearType prefs,
#: and gfx.canvas.accelerated off.
COLORS_RETAIL_PREFS = {"gfx.canvas.accelerated": False}
class BuildError(ValueError):
"""The saved bytes cannot be this reference."""
def colors_of_page(html):
"""[[name, fg, bg], ...] and [sizes] from the measuring page, as the page declares them."""
m = re.search(r"const COLORS = (\[\[.*?\]\]);", html, re.S)
s = re.search(r"const SIZES = (\[[^\]]*\]);", html)
if not m or not s:
raise BuildError("index.html declares no COLORS / SIZES")
return json.loads(m.group(1)), json.loads(s.group(1))
def read_dir(d):
"""{case id: {"width", "height", "sha256"}} of the .json files of one directory."""
d = Path(d)
if not d.is_dir():
raise BuildError("%s is not a directory" % d)
out = {}
for j in sorted(d.glob("*.json")):
m = json.loads(j.read_text(encoding="utf-8"))
sha, w, h = m["sha256"], int(m["w"]), int(m["h"])
rgba = j.with_suffix(".rgba")
if rgba.is_file():
data = rgba.read_bytes()
if len(data) != w * h * 4:
raise BuildError("%s: %d bytes, not %d x %d x 4" % (rgba, len(data), w, h))
got = hashlib.sha256(data).hexdigest()
if got != sha:
raise BuildError("%s: sha256 %s, its json says %s" % (rgba, got, sha))
if not re.fullmatch(r"[0-9a-f]{64}", sha):
raise BuildError("%s: sha256 %r is not 64 hex digits" % (j, sha))
if m["id"] in out:
raise BuildError("%s: case %r twice in %s" % (j.name, m["id"], d))
out[m["id"]] = {"width": w, "height": h, "sha256": sha}
return out
def build(bytes_dir, keys, page_html, base):
colors, sizes = colors_of_page(page_html)
color_ids = ["%s|%s" % (c[0], s) for c in colors for s in sizes]
bytes_dir = Path(bytes_dir)
seed = read_dir(bytes_dir / "colors" / "retail")
if sorted(seed) != sorted(color_ids):
raise BuildError("colors/retail has %s, the page draws %s" % (sorted(seed), sorted(color_ids)))
spec = {"%s|%s" % (c[0], s): {"name": c[0], "fg": c[1], "bg": c[2], "size": s}
for c in colors for s in sizes}
out_colors = {i: {"id": i, **spec[i], **seed[i]} for i in color_ids}
out_keys = {}
for tag in keys:
gamma, contrast = (int(x) for x in tag.split("_"))
cases = read_dir(bytes_dir / "keys" / tag / "retail")
black = {i: v for i, v in cases.items() if not i.startswith("color:")}
col = {i[len("color:"):]: v for i, v in cases.items() if i.startswith("color:")}
if sorted(col) != sorted(color_ids):
raise BuildError("key %s: coloured cases %s, the page draws %s"
% (tag, sorted(col), sorted(color_ids)))
for i in black:
if i not in base["cases"]:
raise BuildError("key %s: %r is not a case of canvas_text_ref" % (tag, i))
out_keys[tag] = {
"gamma": gamma, "contrast": contrast, "count": len(black) + len(col),
"black": {i: {"id": i, **black[i]} for i in sorted(black)},
"colors": {i: {"id": i, **col[i]} for i in color_ids},
}
if SEED_KEY in out_keys:
k = out_keys[SEED_KEY]
for i, v in k["black"].items():
if v["sha256"] != base["cases"][i]["sha256"]:
raise BuildError("%s under %s: %s, canvas_text_ref/refs.json has %s"
% (i, SEED_KEY, v["sha256"], base["cases"][i]["sha256"]))
for i, v in k["colors"].items():
if v["sha256"] != out_colors[i]["sha256"]:
raise BuildError("%s under %s differs from colors/retail: %s vs %s"
% (i, SEED_KEY, v["sha256"], out_colors[i]["sha256"]))
arial = [f for f in base["fonts"] if f["family"] == "Arial"]
if len(arial) != 1:
raise BuildError("canvas_text_ref/refs.json has no single Arial entry")
return {
"test_page": "index.html",
"black_page": "../canvas_text_ref/index.html",
"text": base["text"],
"firefox": base["firefox"],
"canvas": base["canvas"],
"cleartype": base["cleartype"],
"fonts": arial,
"capture": {
"date": DATE,
"origin": "retail Firefox 159.0 (build %s, firefox.exe sha256 %s) on Windows, "
"headless, canvases read back with getImageData; bytes saved by the "
"measuring harness: colors/retail (the 14 coloured cases) and "
"keys/<gamma>_<contrast>/retail (39 cases per key) of the win-asset "
"analysis of 2026-11-09"
% (base["firefox"]["buildid"], base["firefox"]["exe_sha256"]),
"colors_prefs": COLORS_RETAIL_PREFS,
"keys_prefs": RETAIL_PREFS,
},
"colors": {"count": len(out_colors), "cases": out_colors},
"keys": out_keys,
}
def main(argv):
ap = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("--bytes", required=True, metavar="DIR",
help="directory with colors/retail and keys/<gamma>_<contrast>/retail")
ap.add_argument("--keys", default=DEFAULT_KEYS,
help="ClearType keys, gamma_contrast, comma separated (default %(default)s)")
ap.add_argument("--out", default=str(DATA / "refs.json"))
a = ap.parse_args(argv[1:])
keys = [k for k in a.keys.split(",") if k]
try:
refs = build(a.bytes, keys, (DATA / "index.html").read_text(encoding="utf-8"),
json.loads(BASE_REFS.read_text(encoding="utf-8")))
except (BuildError, KeyError, ValueError) 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", newline="\n")
print("%d coloured cases, %d keys x %d cases -> %s"
% (refs["colors"]["count"], len(refs["keys"]),
next(iter(refs["keys"].values()))["count"], a.out))
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))
-106
View File
@@ -1,106 +0,0 @@
"""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))
-82
View File
@@ -1,82 +0,0 @@
"""The preloaded-intermediates list of a CI leg: a fixed (empty) file of the repository, and the variable that makes the core use it.
python scripts/ci_lab_intermediates.py set [--pin ci/intermediates.pin.json] # checks the file against the pin, exports STEALTHFOX_INTERMEDIATES
Why this exists: without ``STEALTHFOX_INTERMEDIATES`` the core downloads Mozilla's intermediates list on a cold cache (in line, at the first launch or at
`invisible_playwright fetch`) and asks once a week whether it changed, from the python of the test. A CI leg reaches no site for its data and every run has to
have the same bytes, so the leg launches with ``ci/intermediates.json``: a valid list in the engine's format 1 with no certificate. With the variable set the
core neither downloads nor checks, ever. ``ci/intermediates.pin.json`` holds the sha256 of the file: ``set`` refuses to go on when the file is not that.
``set`` writes ``STEALTHFOX_INTERMEDIATES=<absolute path>`` to ``$GITHUB_ENV`` (every later step of the job sees it) and, when there is no
``$GITHUB_ENV``, to stdout. The paths of the pin are relative to the repository, not to the working directory of the caller.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import os
import sys
from pathlib import Path
ENV = "STEALTHFOX_INTERMEDIATES"
ROOT = Path(__file__).resolve().parents[1]
class Refused(Exception):
pass
def sha256_of(path) -> str:
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
def load_pin(path) -> dict:
try:
pin = json.loads(Path(path).read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
raise Refused("the pin %s cannot be read: %s" % (path, exc))
sha = pin.get("sha256") if isinstance(pin, dict) else None
if not isinstance(sha, str) or len(sha) != 64 or any(c not in "0123456789abcdef" for c in sha):
raise Refused("the pin %s has no sha256 that is a sha256" % path)
if not isinstance(pin.get("file"), str) or not pin["file"]:
raise Refused("the pin %s names no file" % path)
return pin
def resolve(pin: dict, pin_path) -> Path:
"""The file the pin names, checked against its sha256: a file that is not the pinned one is refused."""
target = Path(pin["file"])
if not target.is_absolute():
target = ROOT / target
if not target.is_file():
raise Refused("the file %s of the pin cannot be found" % pin["file"])
got = sha256_of(target)
if got != pin["sha256"]:
raise Refused("%s has sha256 %s, the pin says %s: change both in one commit" % (pin["file"], got, pin["sha256"]))
return target.resolve()
def main(argv=None) -> int:
ap = argparse.ArgumentParser(description=__doc__.split("\n", 1)[0])
sub = ap.add_subparsers(dest="cmd", required=True)
s = sub.add_parser("set")
s.add_argument("--pin", default="ci/intermediates.pin.json")
ns = ap.parse_args(argv)
try:
path = resolve(load_pin(ns.pin), ns.pin)
except Refused as exc:
print("ci_lab_intermediates: %s" % exc, file=sys.stderr)
return 1
line = "%s=%s" % (ENV, path)
env_file = os.environ.get("GITHUB_ENV")
if env_file:
with open(env_file, "a", encoding="utf-8", newline="\n") as fh:
fh.write(line + "\n")
else:
print(line)
return 0
if __name__ == "__main__":
sys.exit(main())
+87
View File
@@ -0,0 +1,87 @@
"""The security state of a CI leg: a fixed, ready directory of the repository, and the variable that makes the core use it.
python scripts/ci_lab_security_state.py set [--pin ci/security-state.pin.json] # checks the directory against the pin, exports STEALTHFOX_SECURITY_STATE
Why this exists: without ``STEALTHFOX_SECURITY_STATE`` the core downloads Mozilla's security-state collections on a cold cache (in line, at the first launch or at
`invisible_playwright fetch`), has the engine generate the state from them and copies it into every profile. A CI leg reaches no site for its data, runs no generation and
every run has to have the same bytes, so the leg launches with ``ci/security-state/``: a ready directory that holds ONLY ``securitystate-result.json`` (a result with no
data: format 1, ok, no CRLite hashes, zero timestamps, no engine) and no ``security_state/``, so a launch copies nothing. With the variable set the core neither downloads
nor generates, ever. ``ci/security-state.pin.json`` holds the sha256 of that file: ``set`` refuses to go on when the file is not that, or when the directory holds
anything else.
``set`` writes ``STEALTHFOX_SECURITY_STATE=<absolute directory>`` to ``$GITHUB_ENV`` (every later step of the job sees it) and, when there is no ``$GITHUB_ENV``, to
stdout. The paths of the pin are relative to the repository, not to the working directory of the caller.
"""
from __future__ import annotations
import argparse
import hashlib
import json
import os
import sys
from pathlib import Path
ENV = "STEALTHFOX_SECURITY_STATE"
ROOT = Path(__file__).resolve().parents[1]
class Refused(Exception):
pass
def sha256_of(path) -> str:
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
def load_pin(path) -> dict:
try:
pin = json.loads(Path(path).read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
raise Refused("the pin %s cannot be read: %s" % (path, exc))
sha = pin.get("sha256") if isinstance(pin, dict) else None
if not isinstance(sha, str) or len(sha) != 64 or any(c not in "0123456789abcdef" for c in sha):
raise Refused("the pin %s has no sha256 that is a sha256" % path)
if not isinstance(pin.get("file"), str) or not pin["file"]:
raise Refused("the pin %s names no file" % path)
return pin
def resolve(pin: dict, pin_path) -> Path:
"""The directory of the file the pin names, checked: the file has the pinned sha256 and it is the ONLY entry of its directory."""
target = Path(pin["file"])
if not target.is_absolute():
target = ROOT / target
if not target.is_file():
raise Refused("the file %s of the pin cannot be found" % pin["file"])
got = sha256_of(target)
if got != pin["sha256"]:
raise Refused("%s has sha256 %s, the pin says %s: change both in one commit" % (pin["file"], got, pin["sha256"]))
others = sorted(p.name for p in target.parent.iterdir() if p.name != target.name)
if others:
raise Refused("the directory %s holds more than %s: %s" % (target.parent, target.name, ", ".join(others)))
return target.parent.resolve()
def main(argv=None) -> int:
ap = argparse.ArgumentParser(description=__doc__.split("\n", 1)[0])
sub = ap.add_subparsers(dest="cmd", required=True)
s = sub.add_parser("set")
s.add_argument("--pin", default="ci/security-state.pin.json")
ns = ap.parse_args(argv)
try:
path = resolve(load_pin(ns.pin), ns.pin)
except Refused as exc:
print("ci_lab_security_state: %s" % exc, file=sys.stderr)
return 1
line = "%s=%s" % (ENV, path)
env_file = os.environ.get("GITHUB_ENV")
if env_file:
with open(env_file, "a", encoding="utf-8", newline="\n") as fh:
fh.write(line + "\n")
else:
print(line)
return 0
if __name__ == "__main__":
sys.exit(main())
+116
View File
@@ -0,0 +1,116 @@
#!/usr/bin/env python3
"""Run ONE row of the whole-e2e suite against a binary, for the candidate's gate, and write ONE junit for the judge.
ci_suite_run.py --required ci/required-suites.json --suite wrapper.e2e.suite.linux.1 --os linux --binary FF --junit result/x.xml
The run is the run of ``scripts/run_e2e.py`` (``invisible_core.testing.e2e``: the two passes, ``-m "e2e and not wall_clock"`` with 4 browsers at once and then
``-m "e2e and wall_clock"`` alone, ``--dist loadfile``, the deadline per test, no rerun) on the files and node ids of the row; this script does not copy it, it calls it.
What it adds is the end: that run writes one junit per pass, and the judge (``scripts/ci_verdict.py judge``) reads one. The two are merged into ONE xunit2 file, every
testcase as pytest wrote it (``classname`` kept, no ``file``/``line``).
The exit code is 0 when the passes reached their end, red tests included: the verdict is the judge's, and a failed test is a line of its list, not a reason to lose the
junit. It is not 0 when a pass did not run to its end (interrupted, an internal error, a usage error: the code of that pass) or when no junit was written at all.
"""
from __future__ import annotations
import argparse
import copy
import os
import sys
import tempfile
import xml.etree.ElementTree as ET
from pathlib import Path
from typing import Callable, Optional, Sequence
sys.path.insert(0, str(Path(__file__).resolve().parent))
import ci_verdict # noqa: E402 (the judge: the row is read the way it reads it)
#: pytest's exit codes that mean "the pass reached its end": all passed, some failed, nothing collected (a client with no `wall_clock` test has an empty pass).
_REACHED_THE_END = (0, 1, 5)
def row_arguments(required: str, suite: str, os_name: str) -> list:
"""The files and node ids of the row, in its order (what ``ci_verdict.py args`` prints, without the marker: the passes bring their own)."""
return list(ci_verdict.find_suite(ci_verdict.load_required(required), suite, os_name)["tests"])
def pass_junits(directory: Path, procs: str = "4") -> list:
"""The junit file of each pass of the run, in the order of the passes (``invisible_core.testing.e2e`` names them)."""
from invisible_core.testing import e2e
return [e2e.junit_file(Path(directory), selection) for _width, selection in e2e.passes(procs)]
def merge_junits(paths: Sequence, out: Path) -> int:
"""Write ONE xunit2 junit with every testcase of the junit files that exist, in the order given. -> the number of testcases.
The counts of the testsuite are those of the testcases written, not the sum of the headers read: a header that disagrees with its own cases is not copied.
A path that does not exist is a pass that wrote nothing (it is not an error here: the judge counts what is in the file)."""
cases = []
for path in paths:
if not Path(path).is_file():
continue
cases += [copy.deepcopy(c) for c in ET.parse(path).getroot().iter("testcase")]
tags = [{child.tag for child in c} for c in cases]
failures = sum(1 for t in tags if "failure" in t and "error" not in t)
errors = sum(1 for t in tags if "error" in t)
skipped = sum(1 for t in tags if "skipped" in t and not ({"failure", "error"} & t))
seconds = sum(float(c.get("time") or 0) for c in cases)
suite = ET.Element("testsuite", {"name": "pytest", "errors": str(errors), "failures": str(failures), "skipped": str(skipped),
"tests": str(len(cases)), "time": "%.3f" % seconds})
suite.extend(cases)
root = ET.Element("testsuites", {"name": "pytest tests"})
root.append(suite)
out = Path(out)
out.parent.mkdir(parents=True, exist_ok=True)
ET.ElementTree(root).write(out, encoding="utf-8", xml_declaration=True)
return len(cases)
def run(required: str, suite: str, os_name: str, binary: str, junit: str, *, repo: Path, procs: Optional[str] = None,
run_e2e: Optional[Callable] = None, junit_directory: Optional[Path] = None) -> int:
"""Run the row and write the merged junit. ``run_e2e`` is ``invisible_core.testing.e2e.main`` (a fake in the unit tests)."""
from invisible_core.testing import e2e
run_e2e = run_e2e or e2e.main
arguments = row_arguments(required, suite, os_name)
directory = Path(junit_directory or tempfile.mkdtemp(prefix="invpw-suite-junit-"))
# the core reads the directory of the junit from the environment (its own order: this variable, the watchdog's folder, the checkout): one name, set for this run
before = os.environ.get(e2e.JUNIT_DIR_ENV)
os.environ[e2e.JUNIT_DIR_ENV] = str(directory)
try:
code = run_e2e([binary] + (["-n", procs] if procs else []) + arguments, repo)
finally:
if before is None:
os.environ.pop(e2e.JUNIT_DIR_ENV, None)
else:
os.environ[e2e.JUNIT_DIR_ENV] = before
written = merge_junits(pass_junits(directory, procs or "4"), Path(junit))
print("[ci_suite_run] %s on %s: %d test(s) in %s" % (suite, os_name, written, junit), flush=True)
if code not in _REACHED_THE_END:
print("[ci_suite_run] a pass did not run to its end (exit %s)" % code, file=sys.stderr)
return code
if not written:
print("[ci_suite_run] no pass wrote a junit", file=sys.stderr)
return 3
return 0
def main(argv: Optional[Sequence[str]] = None) -> int:
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("--required", required=True, help="ci/required-suites.json")
parser.add_argument("--suite", required=True, help="the id of the row")
parser.add_argument("--os", required=True, choices=ci_verdict.OSES)
parser.add_argument("--binary", required=True, help="the engine under test")
parser.add_argument("--junit", required=True, help="the one junit written for the judge")
parser.add_argument("--procs", default=None, help="browsers at once, for the first pass (default: the run's own, 4)")
ns = parser.parse_args(argv)
try:
return run(ns.required, ns.suite, ns.os, ns.binary, ns.junit, repo=Path(__file__).resolve().parent.parent, procs=ns.procs)
except ci_verdict.Usage as exc:
print("ci_suite_run.py: %s" % exc, file=sys.stderr)
return 2
if __name__ == "__main__":
sys.exit(main())
+69 -7
View File
@@ -21,6 +21,9 @@ pytest wrote and fails on every one of them.
missing (--binary is mandatory: without it exit 2) or the commit cannot be known; the --seal is unreadable.
With --main-required (the list of main) the list only grows: a suite of main is gone, its minimum went down,
its `exact` went from true to false, its os or tests lost an element, or its marker changed is red.
The one exception is `retired-tests.json` NEXT TO main's list (read from main, never from the judged branch): a file it names that
no longer exists in the checkout may leave the rows, and the minimum of a row may go down by the tests main counted for it in that
row (`tests: {row id: n}`), and by no more. A retired file still on disk, or any other lost test, stays red.
What the file of main is can be said only by the gate, which checks main out (a failed download is not
"main has no list"): the file exists -> it is compared; it does not exist and the gate passed
--main-has-no-list (main was checked out and has no such file) -> passed, declared; it does not exist
@@ -248,12 +251,65 @@ def _int(value):
return value if _is_int(value) else 0
def against_main(current, main):
RETIRED_NAME = "retired-tests.json"
def validate_retired(data):
"""-> the reasons why `data` is not a well-formed list of retired files (empty if it is). An entry: the file, why it went, the date, and
for each row id the number of tests the file had in that row on main (counted with the row's marker)."""
if not isinstance(data, list):
return ["the retired list must be a JSON list"]
problems, seen = [], set()
for i, e in enumerate(data):
where = "retired entry %d" % i
if not isinstance(e, dict):
problems.append("%s is not an object" % where)
continue
f = e.get("file")
if not isinstance(f, str) or not f.strip():
problems.append("%s has no file" % where)
elif f in seen:
problems.append("%s: the file %s appears more than once" % (where, f))
else:
seen.add(f)
where = "retired %s" % f
for key in ("reason", "date"):
if not isinstance(e.get(key), str) or not e.get(key).strip():
problems.append("%s: %s must be a non-empty string" % (where, key))
counts = e.get("tests")
if not (isinstance(counts, dict) and counts and all(isinstance(k, str) and _is_int(v) and v > 0 for k, v in counts.items())):
problems.append("%s: tests must be {row id: number of tests of the file in that row (> 0)}" % where)
return problems
def retired_of_main(main_required):
"""The retired files of main: ``ci/retired-tests.json`` next to main's list, read from main and never from the judged branch. It may not
exist (main older than the format): nothing is retired. A malformed one is a problem, never an empty list. -> (entries, problems)."""
path = Path(main_required).with_name(RETIRED_NAME)
if not path.is_file():
return [], []
try:
data = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
return [], ["the retired list of main %s cannot be read: %s" % (path, exc)]
bad = validate_retired(data)
if bad:
return [], ["the retired list of main %s is malformed: %s" % (path, "; ".join(bad))]
return data, []
def against_main(current, main, retired=(), exists=os.path.exists):
"""The list only grows: every suite of main is still here, with no lower minimum, no exact turned off, no lost
test or OS and the same marker. `main` is read leniently (it may be older than the current format)."""
test or OS and the same marker. `main` is read leniently (it may be older than the current format).
The one way a test leaves a row is `retired` (the list of MAIN, never of the branch): a file that main retired and that no longer exists
(`exists`, in the checkout judged) is not a lost test, and the minimum of the row may go down by exactly the tests main counted for that file
in that row (``tests[row id]``), and by no more. A retired file that is still on disk is not excused: it must stay in its rows."""
problems = []
if not isinstance(main, list):
return ["the list of main is not a JSON list: it cannot be compared"]
gone = {e["file"]: e["tests"] for e in retired if isinstance(e, dict) and isinstance(e.get("file"), str)
and isinstance(e.get("tests"), dict) and not exists(e["file"])}
by_id = {s.get("id"): s for s in current if isinstance(s, dict)}
for old in main:
if not isinstance(old, dict):
@@ -263,12 +319,16 @@ def against_main(current, main):
if new is None:
problems.append("the suite %s of main is gone from the list" % sid)
continue
if _int(new.get("min_tests")) < _int(old.get("min_tests")):
problems.append("the minimum of %s went down: %s on main, %s here"
% (sid, old.get("min_tests"), new.get("min_tests")))
lost = [t for t in old.get("tests", []) if t not in new.get("tests", [])]
excused = [t for t in lost if t in gone]
lost = [t for t in lost if t not in gone]
allowed = sum(_int(gone[t].get(sid)) for t in excused)
if _int(new.get("min_tests")) < _int(old.get("min_tests")) - allowed:
problems.append("the minimum of %s went down: %s on main, %s here%s"
% (sid, old.get("min_tests"), new.get("min_tests"),
" (retired files account for %d of it)" % allowed if allowed else ""))
if old.get("exact") is True and new.get("exact") is not True:
problems.append("the suite %s is no longer exact, as it is on main" % sid)
lost = [t for t in old.get("tests", []) if t not in new.get("tests", [])]
if lost:
problems.append("the suite %s lost %d required test(s) that main has: %s" % (sid, len(lost), ", ".join(lost)))
lost_os = [o for o in old.get("os", []) if o not in new.get("os", [])]
@@ -406,7 +466,9 @@ def cmd_judge(ns):
problems.append("the list of main %s exists, but --main-has-no-list says main has none" % ns.main_required)
elif exists:
try:
problems += against_main(suites, _read_json_list(ns.main_required))
retired, retired_problems = retired_of_main(ns.main_required)
problems += retired_problems
problems += against_main(suites, _read_json_list(ns.main_required), retired)
except Usage as exc:
problems.append(str(exc))
elif ns.main_has_no_list:
-50
View File
@@ -1,50 +0,0 @@
"""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))
-47
View File
@@ -1,47 +0,0 @@
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)
-218
View File
@@ -1,218 +0,0 @@
"""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))
+11 -4
View File
@@ -1243,9 +1243,12 @@ class FrameDispatcher(Dispatcher):
frame_id, selector, what, *args, strict=strict,
timeout=deadline.left())
except juggler.ReplyTimeout as exc:
# The caller's time ran out while a probe was in flight: that
# is this read's timeout, not the probe's.
if deadline.passed():
# The probe's bound is what was left of the caller's time, so
# its running out IS the caller's time running out: this
# read's timeout, not the probe's. Not asked of the clock
# again: on Windows a wait can end before it says so. With no
# limit the probe had no bound, and this is something else.
if deadline.seconds is not None:
raise expired() from exc
raise
if found:
@@ -6261,7 +6264,11 @@ class BrowserTypeDispatcher(Dispatcher):
# profile sees them; without it, the language alone decides.
keyboard_layout = prefs.pop(KEYBOARD_LAYOUT_PREF, None) or profiles_pref(
prefs.get("intl.accept_languages") or "")
write_user_js(profile, prefs)
# The security state is placed in the profile by this one call, FOR THE ENGINE THIS LAUNCH RUNS: a generation is tied to its
# build id, so the core is told which binary it is (`engine=`). `engine_argv` is NOT passed: the line this launch runs is
# headed or headless, with `-juggler-pipe` and the caller's `args`, none of which a generation may use (it is its own
# headless run on a work profile); the core's default line for the engine is the right one.
write_user_js(profile, prefs, engine=executable)
# ⛔ THE CALLER'S TIMEOUT, not ours. `launch(timeout=)` is a
# documented option and this server ignored it, so a caller who
# shortened it waited the full built-in 60 s anyway - and one who
+7 -6
View File
@@ -38,7 +38,7 @@ import argparse
import sys
from . import __version__
from invisible_core import BINARY_VERSION, FIREFOX_UPSTREAM_VERSION, update_intermediates
from invisible_core import BINARY_VERSION, FIREFOX_UPSTREAM_VERSION, update_security_state
from invisible_core.download import cache_root, engine_root, ensure_binary # noqa: F401
from ._pin import (
@@ -86,13 +86,14 @@ def _cmd_fetch(_args: argparse.Namespace) -> int:
except Exception as e:
print(f"error: {e}", file=sys.stderr)
return 1
# The list of preloaded intermediate certificates the core declares to the engine: `fetch` is where the user asks for what is current, so it looks for a
# newer list EVERY time (a small request to the changes feed; the list is downloaded only when it changed) and puts it in the cache. A launch only reads the
# cache. A failure here is a warning and nothing more: it changes neither the exit code nor the last line (`update_intermediates` itself does not raise).
# The security state the core copies into every profile (the intermediates, OneCRL and the CRLite filters a retail Firefox has from its first second): `fetch` is
# where the user asks for what is current, so it looks for newer data EVERY time (a small request to the changes feed; a collection is downloaded only when it
# changed), has THIS engine generate the state from it and puts the result in the cache. A launch only copies from the cache. A failure here is a warning and
# nothing more: it changes neither the exit code nor the last line (`update_security_state` itself does not raise).
try:
update_intermediates()
update_security_state(engine=path)
except Exception as e:
print(f"warning: the intermediates list could not be fetched: {e}", file=sys.stderr)
print(f"warning: the security state could not be fetched: {e}", file=sys.stderr)
# Last line, alone, so `$(invisible-playwright fetch)` is a path.
print(path)
return 0
+274
View File
@@ -0,0 +1,274 @@
"""What the canvas-reader e2e tests share: one scene, the readers of a canvas, the page that serves them, and the comparison of bytes.
The engine applies its canvas noise (``gfx::StealthProjectPixels``) to a WebGL or WebGPU canvas when a PAGE reads it, and only then. These
tests ask whether every road by which a page reads such a canvas gives the same bytes, so they need one scene that the noise touches, the same
scene drawn through every API, and the same list of readers for every kind of canvas.
THE SCENE. Ten triangles with random vertex colours (a fixed generator, the same numbers in every launch and in every API: ``starVertices``)
over a white clear. The noise touches only an edge pixel whose 3x3 neighbourhood holds a THIRD colour besides a blend of two, so a flat clear
is never touched; ten overlapping triangles make hundreds of such junctions, and the chance that two reads of a noised and an un-noised canvas
differ nowhere is nil. The 2D twin (``draw2D``) draws the same triangles with translucent fills and a shadow: a canvas that WOULD be noised if
the 2D road were projected, and is not (a 2D canvas reads as drawn).
THE CONTROL. ``noised=False`` declares ``zoom.stealth.canvas.substitute_pixels`` false: the canvas noise is declared off and NOTHING else changes
(same declared GPU, same antialiasing, same raster), so the difference between the two launches is the noise and nothing else, which is why
the tests may ask that it touches only the low bit of R, G and B. (A launch with ``hw_seed`` 0 would also change the declared GPU.)
THE READERS (``readersOf``): the canvas's own read (``readPixels`` / ``getImageData``), ``drawImage`` onto a 2D canvas, ``createImageBitmap``, the
PNG of ``toDataURL`` / ``toBlob`` / ``convertToBlob`` (decoded here, never by the browser, so the browser's image decoding is not a variable)
and, for an OffscreenCanvas, ``transferToImageBitmap``. Every entry is the base64 of RGBA bytes, top row first; a name that ends in ``.png`` is a
PNG file.
Nothing here waits on a clock: the page's async functions end on events, and the one wait that needs polling (``wait_until``) ends on a condition.
"""
from __future__ import annotations
import base64
import contextlib
import json
import threading
from http.server import BaseHTTPRequestHandler
from typing import Dict, List
import _page_bytes as pb
from _servers import LocalServer
#: The side of every canvas of the scene.
SIZE = 128
#: A noise seed that no runner has.
HW_SEED = 12345
#: The persona (identity) seed of every launch: not the noise seed.
SEED = 7
#: The JS of the scene and of the readers. Plain script: it runs in the page and, as the head of a worker's source, in a worker (no ``document`` in it).
SHARED_JS = r"""
const W = 128, H = 128;
// ten triangles, 30 vertices of (x, y, r, g, b), x and y in clip space: a fixed generator, so every launch and every API draws the same scene
function starVertices() {
const v = []; let s = 12345;
const rnd = () => (s = (s * 1103515245 + 12345) & 0x7fffffff) / 0x7fffffff;
for (let i = 0; i < 30; i++) v.push(rnd() * 1.8 - 0.9, rnd() * 1.8 - 0.9, rnd(), rnd(), rnd());
return v;
}
function drawGL(canvas, kind) {
const gl = canvas.getContext(kind || 'webgl', {preserveDrawingBuffer: true, antialias: true});
if (!gl) throw new Error('no ' + (kind || 'webgl') + ' context');
const shader = (type, src) => {
const s = gl.createShader(type); gl.shaderSource(s, src); gl.compileShader(s);
if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(s));
return s;
};
const pr = gl.createProgram();
gl.attachShader(pr, shader(gl.VERTEX_SHADER, 'attribute vec2 p; attribute vec3 c; varying vec3 v; void main(){v=c;gl_Position=vec4(p,0.,1.);}'));
gl.attachShader(pr, shader(gl.FRAGMENT_SHADER, 'precision mediump float; varying vec3 v; void main(){gl_FragColor=vec4(v,1.);}'));
gl.linkProgram(pr);
if (!gl.getProgramParameter(pr, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(pr));
gl.useProgram(pr);
const b = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, b);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(starVertices()), gl.STATIC_DRAW);
const pl = gl.getAttribLocation(pr, 'p'), cl = gl.getAttribLocation(pr, 'c');
gl.enableVertexAttribArray(pl); gl.vertexAttribPointer(pl, 2, gl.FLOAT, false, 20, 0);
gl.enableVertexAttribArray(cl); gl.vertexAttribPointer(cl, 3, gl.FLOAT, false, 20, 8);
gl.clearColor(1, 1, 1, 1); gl.clear(gl.COLOR_BUFFER_BIT);
gl.drawArrays(gl.TRIANGLES, 0, 30);
gl.finish();
return gl;
}
// the same ten triangles on a 2D canvas, with translucent fills and a shadow
function draw2D(x) {
x.fillStyle = '#fff'; x.fillRect(0, 0, W, H);
const v = starVertices();
for (let t = 0; t < 10; t++) {
const q = v.slice(t * 15, t * 15 + 15);
x.fillStyle = 'rgba(' + Math.round(q[2] * 255) + ',' + Math.round(q[3] * 255) + ',' + Math.round(q[4] * 255) + ',' + (t % 2 ? 0.7 : 1) + ')';
x.beginPath();
for (let k = 0; k < 3; k++) {
const px = (q[k * 5] + 1) / 2 * W, py = (1 - q[k * 5 + 1]) / 2 * H;
if (k) x.lineTo(px, py); else x.moveTo(px, py);
}
x.closePath(); x.fill();
}
x.shadowColor = 'rgba(0, 0, 0, 0.6)'; x.shadowBlur = 4; x.shadowOffsetX = 3; x.shadowOffsetY = 2;
x.fillStyle = 'rgb(200, 120, 20)'; x.fillRect(40, 40, 30, 30);
}
// readPixels, top row first (readPixels gives the bottom row first)
function readGL(gl) {
const buf = new Uint8Array(W * H * 4);
gl.readPixels(0, 0, W, H, gl.RGBA, gl.UNSIGNED_BYTE, buf);
const out = new Uint8Array(W * H * 4);
for (let y = 0; y < H; y++) out.set(buf.subarray((H - 1 - y) * W * 4, (H - y) * W * 4), y * W * 4);
return out;
}
function readCtx(x) { return new Uint8Array(x.getImageData(0, 0, W, H).data); }
function b64(u8) {
let s = '';
for (let i = 0; i < u8.length; i += 8192) s += String.fromCharCode.apply(null, u8.subarray(i, i + 8192));
return btoa(s);
}
function blobB64(blob) {
return new Promise((ok, bad) => {
const r = new FileReader();
r.onload = () => ok(String(r.result).split(',')[1]);
r.onerror = () => bad(new Error('FileReader failed'));
r.readAsDataURL(blob);
});
}
// what a fresh 2D canvas (made by `make`) holds after `draw(context)`
function pixelsOf(make, draw) {
const c = make(); c.width = W; c.height = H;
const x = c.getContext('2d'); draw(x);
return readCtx(x);
}
// every road by which a page turns `src` into bytes: {name: base64 of RGBA, top row first}; a name ending in .png is a PNG file
async function readersOf(src, direct, make, withTransfer) {
const out = {direct: b64(direct())};
out.drawImage = b64(pixelsOf(make, x => x.drawImage(src, 0, 0)));
const bm = await createImageBitmap(src);
out.createImageBitmap = b64(pixelsOf(make, x => x.drawImage(bm, 0, 0)));
bm.close();
if (src.toDataURL) {
out['toDataURL.png'] = src.toDataURL('image/png').split(',')[1];
out['toBlob.png'] = await blobB64(await new Promise(r => src.toBlob(r, 'image/png')));
} else {
out['convertToBlob.png'] = await blobB64(await src.convertToBlob({type: 'image/png'}));
}
if (withTransfer && src.transferToImageBitmap) { // last: it empties the canvas
const tb = src.transferToImageBitmap();
out.transferToImageBitmap = b64(pixelsOf(make, x => x.drawImage(tb, 0, 0)));
tb.close();
}
return out;
}
const makeElement = () => document.createElement('canvas');
const makeOffscreen = () => new OffscreenCanvas(W, H);
"""
def page_html(page_js: str) -> str:
"""A page whose script holds SHARED_JS, ``WORKER_LIB`` (the same text, for the source of a worker) and the page's own functions."""
return ("<!doctype html><meta charset=utf-8><title>canvas readers</title><body><script>\n" + SHARED_JS
+ "\nconst WORKER_LIB = " + json.dumps(SHARED_JS) + ";\n" + page_js + "\n</script></body>")
@contextlib.contextmanager
def serve(html: str):
"""The page on a local http origin (a secure context, and a site a canvas has a principal on); port 0, the one the system gave."""
body = html.encode("utf-8")
class Page(BaseHTTPRequestHandler):
timeout = 5
def do_GET(self):
self.send_response(200)
self.send_header("Content-Type", "text/html; charset=utf-8")
self.send_header("Content-Length", str(len(body)))
self.send_header("Cache-Control", "no-store")
self.end_headers()
self.wfile.write(body)
def log_message(self, *args):
pass
httpd = LocalServer(("127.0.0.1", 0), Page)
threading.Thread(target=httpd.serve_forever, daemon=True).start()
try:
yield "http://127.0.0.1:%d/" % httpd.server_address[1]
finally:
httpd.shutdown()
httpd.server_close()
@contextlib.contextmanager
def launched(firefox_binary, html: str, noised: bool = True, pin=None, viewport=None):
"""The page open in a browser of the product: the engine on (a declared noise seed no runner has), and, when ``noised`` is false, the
canvas noise declared off and nothing else. One browser, closed on leaving."""
from invisible_playwright import InvisiblePlaywright
prefs = {"zoom.stealth.fpp.hw_seed": HW_SEED}
if not noised:
prefs["zoom.stealth.canvas.substitute_pixels"] = False
with serve(html) as url:
with InvisiblePlaywright(seed=SEED, binary_path=firefox_binary, headless=True, extra_prefs=prefs, pin=pin) as browser:
context = browser.new_context(viewport=viewport) if viewport else browser.new_context()
page = context.new_page()
page.goto(url, wait_until="load", timeout=60_000)
yield page
def run(page, call: str, deadline_s: int = 120):
"""Runs the page's async function ``call`` (a JS expression that gives a promise) to its end and returns what it resolved to. The end is
the promise's own: the deadline is only how long a lost event is allowed before the test says so."""
page.evaluate("() => { window.DONE = false; window.ERR = null; window.R = null;"
" Promise.resolve().then(() => %s).then(r => { window.R = r; window.DONE = true; },"
" e => { window.ERR = String((e && e.stack) || e); window.DONE = true; }); }" % call)
page.wait_for_function("window.DONE === true", timeout=deadline_s * 1000)
err = page.evaluate("window.ERR")
assert err is None, "the page could not run %s: %s" % (call, err)
return page.evaluate("window.R")
# ------------------------------------------------------------------------------------------------------------------ bytes
def rgba_of_image(image) -> bytes:
"""RGBA bytes of an ``_page_bytes.unfiltered`` image (RGB gets an opaque alpha)."""
data, channels = image["data"], image["channels"]
if channels == 4:
return data
assert channels == 3, "a PNG of %d channels is not read here" % channels
out = bytearray()
for i in range(0, len(data), 3):
out += data[i:i + 3] + b"\xff"
return bytes(out)
def rgba(name: str, value: str) -> bytes:
"""The RGBA bytes of a reader's entry: its base64, or, for a PNG, the pixels it decodes to."""
raw = base64.b64decode(value)
if name.endswith(".png"):
image = pb.unfiltered(raw)
assert (image["w"], image["h"]) == (SIZE, SIZE), "%s is a %dx%d image, not %dx%d" % (name, image["w"], image["h"], SIZE, SIZE)
return rgba_of_image(image)
assert len(raw) == SIZE * SIZE * 4, "%s holds %d bytes, not %d" % (name, len(raw), SIZE * SIZE * 4)
return raw
def decode(readers: Dict[str, str], prefix: str = "") -> Dict[str, bytes]:
return {prefix + name: rgba(name, value) for name, value in readers.items()}
def differing_pixels(a: bytes, b: bytes) -> int:
assert len(a) == len(b), "two images of %d and %d bytes" % (len(a), len(b))
return sum(1 for i in range(0, len(a), 4) if a[i:i + 4] != b[i:i + 4])
def only_the_low_bit_of_rgb(a: bytes, b: bytes) -> List[int]:
"""The pixels where ``a`` and ``b`` differ by more than the low bit of R, G and B (or in alpha): the noise writes nothing else."""
return [i // 4 for i in range(0, len(a), 4)
if (a[i] | 1, a[i + 1] | 1, a[i + 2] | 1, a[i + 3]) != (b[i] | 1, b[i + 1] | 1, b[i + 2] | 1, b[i + 3])]
def distinct_colours(a: bytes) -> int:
return len({a[i:i + 4] for i in range(0, len(a), 4)})
def disagreements(readers: Dict[str, bytes], reference: str) -> List[str]:
"""The readers whose bytes are not those of ``reference``, each with how many pixels differ."""
want = readers[reference]
return ["%s (%d pixels differ)" % (name, differing_pixels(want, got)) for name, got in readers.items() if got != want]
def assert_agree(what: str, readers: Dict[str, bytes], reference: str = "direct") -> None:
bad = disagreements(readers, reference)
assert not bad, (
"%s: the readers %s do not read what %s reads (readers: %s). Every road by which a page reads a canvas gives the same bytes "
"when it is the same canvas" % (what, "; ".join(bad), reference, ", ".join(sorted(readers))))
-115
View File
@@ -1,115 +0,0 @@
"""What the canvas text e2e tests share: the persona pin, the bundled fonts and the server.
tests/test_canvas_text_is_windows_e2e.py (black text, 342 cases) and
tests/test_canvas_text_colors_and_cleartype_is_windows_e2e.py (coloured text and the
ClearType keys) both compare the RGBA bytes of a canvas drawn by the engine with the ones
retail Firefox 159.0 on Windows drew, for pages served on localhost with the engine's own
bundled font files. This module holds what the two do the same way.
"""
from __future__ import annotations
import hashlib
import http.server
import json
import threading
from pathlib import Path
DATA = Path(__file__).parent / "data" / "canvas_text_ref"
#: What the reference's ``cleartype`` field says the retail machine had: FontSmoothing 2 with
#: FontSmoothingType 2 is ClearType (system text quality 5). The other tuning values are an
#: untuned Windows machine's (gamma 1.8, contrast 1.0, level 1.0), which refs.json does not
#: record.
UNTUNED = {"font.cleartype_gamma": 1800, "font.cleartype_contrast": 100,
"font.cleartype_level": 100}
def pin(refs):
"""The prefs that make the engine the machine ``refs["cleartype"]`` describes."""
ct = refs["cleartype"]
smoothing, kind = str(ct["FontSmoothing"]), str(ct["FontSmoothingType"])
if smoothing == "2" and kind in ("2", "0x2"):
quality = 5
elif smoothing == "2":
quality = 4
else:
quality = 0
return {"screen.dpr": 1.0, "font.system_text_quality": quality, **UNTUNED}
def bundle_font(fonts_dir, entry):
"""The bundled file a reference entry names."""
return Path(fonts_dir) / entry["bundle_file"]
def wrong_fonts(fonts_dir, entries):
"""One line for each reference font whose bundled file is not the one measured."""
wrong = []
for e in entries:
f = bundle_font(fonts_dir, e)
got = hashlib.sha256(f.read_bytes()).hexdigest() if f.is_file() else None
if got != e["sha256"]:
wrong.append("%s: the engine's %s has sha256 %s, the reference was made with %s"
% (e["family"], f.name, got, e["sha256"]))
return wrong
def serve(fonts_dir, entries, pages):
"""``pages`` (url path -> HTML bytes) and, under /bundle/<name>, the engine's bundled
font files. Returns the running server; the caller shuts it down."""
by_url = {"/bundle/" + e["bundle_file"]: bundle_font(fonts_dir, e) for e in entries}
class _H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
path = self.path.split("?")[0]
if path in pages:
body, kind = pages[path], "text/html"
elif path in by_url and by_url[path].is_file():
body, kind = by_url[path].read_bytes(), "font/ttf"
else:
self.send_error(404)
return
self.send_response(200)
self.send_header("Content-Type", kind)
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def log_message(self, *args):
pass
server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), _H)
threading.Thread(target=server.serve_forever, daemon=True).start()
return server
_SPECS_LOOP = " window.R = {};\n for (const sp of SPECS) {"
def only_cases(html, ids):
"""canvas_text_ref/index.html as text, drawing only the cases ``ids``.
The page draws all 342 cases (the 400 px ones take minutes); a test that wants a few of
them serves this. The drawing code is untouched, so a case gives the bytes it gives in
the whole page."""
if _SPECS_LOOP not in html:
raise AssertionError("canvas_text_ref/index.html no longer has the loop over SPECS "
"that only_cases() narrows: update the helper")
return html.replace(
_SPECS_LOOP,
" window.R = {};\n const ONLY = new Set(%s);\n"
" for (const sp of SPECS.filter(s => ONLY.has(s.id))) {" % json.dumps(sorted(ids)))
def diff_lines(want, got, label=""):
"""One line for each case of ``want`` (id -> sha256) that ``got`` does not draw as
expected: its name, the hash retail gave, the hash the engine gave (or "not drawn")."""
lines = []
for cid in sorted(want):
have = got.get(cid)
if have != want[cid]:
lines.append("%s%s: expected %s, got %s"
% (label, cid, want[cid], have if have is not None else "not drawn"))
lines += ["%s%s: drawn but not in the reference" % (label, cid)
for cid in sorted(set(got) - set(want))]
return lines
+26 -12
View File
@@ -2,8 +2,8 @@
unit test feeds them the red case and the green case without a browser).
None of them reads how long something took: a loop that is held is told by WHERE the thread of the loop was (inside a blocking step of
the close), a browser that keeps answering is told by the ORDER of the events (a call that began and ended while the close was in
flight, and answers that came while the removal of the profile was held), and the removal of the profile is told by WHICH THREAD
the close), a browser that keeps answering is told by the ORDER of the events (a reply that arrived while the close was in flight,
and answers that came while the removal of the profile was held), and the removal of the profile is told by WHICH THREAD
reached it (the reaper's or its continuation's, never the loop's nor one of the close's) and by the order of the close's return and
the release of the hold. A machine that is slow stretches every duration and changes none of these.
@@ -85,21 +85,35 @@ def charged_more_than_ran_problem(held: float, busy_run: float) -> Optional[str]
"its selector (the machine did not schedule it) was counted as held" % (held * 1000, busy_run * 1000))
def others_answered_problem(others: Sequence[dict], gate: dict) -> Optional[str]:
def others_answered_problem(others: Sequence[dict], gate: dict, loop_inside: Dict[str, dict]) -> Optional[str]:
"""What is wrong with the way the other browsers answered while the first one closed, or None.
``others`` has one record per other browser: ``inside`` is the calls that began AFTER the close began and ended BEFORE it ended
(a call that was answered during the close, in the order of the events, not by how long it took), ``during_removal`` the calls
that began after the removal of the closing browser's profile was reached and ended while it was still held. ``gate`` says how that
hold ended: ``reached`` (the removal ran), ``released_by``: ``answered`` (the close had returned and every other browser had
answered a call that began after the removal was reached: the loop was free while the removal waited) or ``deadline`` (they had not,
in 30 s: the loop could not run while the removal was waiting, which is a removal made on the loop's thread)."""
``others`` has one record per other browser: ``answered`` is the replies that ARRIVED while the close was in flight, whenever the
call began (a reply read during the close is proof that the loop ran then; a call that began a moment before the close and ended
in it is one), ``inside`` the calls that began AND ended in it (printed, not judged), ``during_removal`` the calls that began after
the removal of the closing browser's profile was reached and ended while it was still held. ``gate`` says how that hold ended:
``reached`` (the removal ran), ``released_by``: ``answered`` (the close had returned and every other browser had answered a call
that began after the removal was reached: the loop was free while the removal waited) or ``deadline`` (they had not, in 30 s: the
loop could not run while the removal was waiting, which is a removal made on the loop's thread). ``loop_inside`` is what the
watcher saw of the loop's thread during the close (see the head of this file).
A browser that answered nothing inside the close is the loop's fault only if the loop was HELD: the watcher saw its thread inside
a step of the close that waits, or no browser answered at all (nothing shows that the loop ran). One engine that did not answer
while the others did, and the loop was seen free, is a browser the machine did not run: the removal's hold below still asks every
browser to answer, once the close is over."""
if len(others) != 3:
return "the client followed %d other browsers instead of 3: %r" % (len(others), others)
silent = [i for i, r in enumerate(others) if r["inside"] < 1]
silent = [i for i, r in enumerate(others) if r["answered"] < 1]
if silent:
return ("the other browsers %s did not answer a single call that began and ended inside the close (calls inside it, per "
"browser: %s): the loop that serves them did not run during the close" % (silent, [r["inside"] for r in others]))
held = blocked_by(loop_inside)
counts = [r["answered"] for r in others]
if held:
return ("the other browsers %s did not answer a single call inside the close (replies that arrived inside it, per "
"browser: %s) and the watcher saw the loop's thread inside %s: the loop that serves them did not run during "
"the close" % (silent, counts, held))
if len(silent) == len(others):
return ("no other browser answered a single call inside the close (replies that arrived inside it, per browser: %s): "
"nothing shows that the loop ran during the close" % counts)
if gate.get("reached") and gate.get("released_by") != "answered":
return ("the removal of the profile was held until every other browser answered, and they did not (%s): the loop that "
"serves them could not run while the removal waited, so the removal ran on it (answers during the removal, per "
+175
View File
@@ -0,0 +1,175 @@
"""TEMPORARY: the core of every crash of an engine the tests start, read by gdb after a test that fails. Remove it with tests/_generation_evidence.py once the
exit by SIGSEGV (-11) of the engine in generate mode on Linux (runs 44985244053 and 45014369018) is understood and fixed.
A release build crashes in silence: MOZ_CRASH, MOZ_RELEASE_ASSERT and a Rust panic write to a null address and print nothing, so stderr cannot tell a crash the
code wanted from a bad access. The core can: `gMozCrashReason` says the reason of a wanted crash, the faulting address and the thread that fell say the rest.
* `lift_the_core_limit_of_the_session()`: once, at the start of pytest (tests/conftest.py, `pytest_configure`), on Linux: the soft RLIMIT_CORE of the pytest
process raised to its hard limit. Every process a test starts inherits it, the engines the CORE launches included (its `generate` passes no limit of its own),
so a crash of any of them leaves a core where `kernel.core_pattern` says. The Linux e2e jobs (e2e.yml, and gate.yml of the engine series) point it at
`$INVPW_CORE_DIR` and install gdb.
* `after_the_report(nodeid, when, failed)`: tests/conftest.py calls it after each phase of every test (`pytest_runtest_makereport`). When `$INVPW_CORE_DIR` is set:
after a phase that FAILED, every `core*` there is read by gdb into `<evidence>/cores/<nodeid>/<core>.gdb.txt` and deleted, and `notes.txt` says what was found
(no core included); after the teardown of a test that did not fail, the cores left are deleted and listed in `<evidence>/cores/after-passing-tests.txt` (a crash
in a passing test is information too). `<evidence>` is `$RUNNER_TEMP/invpw-evidence`, the folder the e2e jobs upload.
* `gdb_text(core, into)`: the one gdb path of the tests: the executable is the one the core's header names (else `$INVPW_BINARY_PATH`), and the text holds the
backtrace of every thread, their names, the signal's address, `gMozCrashReason`, the registers, the shared libraries with their addresses and build ids, and the
mappings. Only the text is kept: a core of the engine is hundreds of MB.
Best effort: nothing here raises, and nothing here decides a test.
"""
from __future__ import annotations
import contextlib
import os
import re
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
#: The folder under `$RUNNER_TEMP` the e2e workflows upload (`invpw-evidence-*`, "Keep what the tests saved").
EVIDENCE_FOLDER = "invpw-evidence"
CORES = "cores"
AFTER_PASSING = "after-passing-tests.txt"
#: How long gdb may take to read a core of the engine, and to read its header only.
GDB_TIMEOUT_S = 600
HEADER_TIMEOUT_S = 120
#: What gdb prints from the core: the crashing thread first, then every thread with its name, the signal, the reason of a wanted crash, where libxul is.
GDB_COMMANDS = (
"set pagination off",
"set width 0",
"bt",
"info threads",
"thread apply all bt",
"p $_siginfo",
"p $_siginfo._sifields._sigfault.si_addr",
"x/s *(char**)&gMozCrashReason",
"info registers",
"x/8i $pc",
"info sharedlibrary",
"python print('\\n'.join('%s %s' % (o.filename, o.build_id) for o in gdb.objfiles()))",
"info proc mappings",
)
_HEADER = re.compile(r"Core was generated by `([^']*)'")
#: The tests a phase of which failed: their teardown reads its cores too.
_FAILED = set()
def lift_the_core_limit_of_the_session():
"""Linux: the soft RLIMIT_CORE of this process raised to its hard limit, inherited by every child. Elsewhere, or if it is refused, nothing."""
if not sys.platform.startswith("linux"):
return
try:
import resource
_soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
resource.setrlimit(resource.RLIMIT_CORE, (hard, hard))
except (ImportError, OSError, ValueError):
pass
def core_pattern():
try:
return Path("/proc/sys/kernel/core_pattern").read_text(encoding="utf-8").strip()
except OSError as exc:
return "unreadable: %r" % (exc,)
def gdb():
"""The gdb command (a list), or None when gdb is not installed."""
found = shutil.which("gdb")
return [found] if found else None
def evidence_root():
base = os.environ.get("RUNNER_TEMP") or tempfile.gettempdir()
return Path(base) / EVIDENCE_FOLDER / CORES
def folder_name(nodeid):
return re.sub(r"[^A-Za-z0-9._-]+", "_", nodeid).strip("_")[:150] or "unnamed"
def _cores():
where = os.environ.get("INVPW_CORE_DIR")
if not where or not Path(where).is_dir():
return None, []
# A core of a background engine of the hunt (/tmp/ffbg-K, the executable's path is in the core's name) is read by the loop that owns it, never by the run's hooks.
return Path(where), sorted((path for path in Path(where).glob("core*") if path.is_file() and "!ffbg-" not in path.name), key=lambda path: path.stat().st_mtime)
def executable_of(core, command):
"""The executable the core's header names when it is a file, else `$INVPW_BINARY_PATH` (or `$STEALTHFOX_E2E_BINARY`), else None. Returns (path, how)."""
header = ""
try:
done = subprocess.run(command + ["-batch", "-nx", "-c", str(core)], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
timeout=HEADER_TIMEOUT_S)
header = done.stdout.decode("utf-8", "replace")
except Exception as exc: # best effort
header = "header unreadable: %r" % (exc,)
match = _HEADER.search(header)
named = match.group(1).split()[0] if match and match.group(1).split() else None
if named and Path(named).is_file():
return named, "from the core's header"
for variable in ("INVPW_BINARY_PATH", "STEALTHFOX_E2E_BINARY"):
if os.environ.get(variable) and Path(os.environ[variable]).is_file():
return os.environ[variable], "from $%s (the header names %r)" % (variable, named)
return None, "none (the header names %r)" % (named,)
def gdb_text(core, into):
"""gdb's text of `core` in `into/<core>.gdb.txt`. One line saying what was done. Does not delete the core."""
command = gdb()
size = core.stat().st_size
if command is None:
return "core %s (%d bytes, kernel.core_pattern %r) but gdb is not installed" % (core.name, size, core_pattern())
exe, how = executable_of(core, command)
argv = command + ["-batch", "-nx"]
for line in GDB_COMMANDS:
argv += ["-ex", line]
argv += ([exe] if exe else []) + ["-c", str(core)]
target = into / (core.name + ".gdb.txt")
try:
done = subprocess.run(argv, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=GDB_TIMEOUT_S)
target.write_bytes(("executable: %s (%s)\n\n" % (exe, how)).encode("utf-8") + done.stdout)
return "core %s (%d bytes): gdb exited %d, %d bytes of text in %s; executable %s" % (core.name, size, done.returncode, len(done.stdout), target.name, how)
except Exception as exc:
return "core %s (%d bytes): gdb failed: %r" % (core.name, size, exc)
def after_the_report(nodeid, when, failed):
"""After a phase (`setup`, `call`, `teardown`) of the test `nodeid`: see the module's docstring. Never raises."""
try:
failed_before = nodeid in _FAILED
if failed:
_FAILED.add(nodeid)
if when == "teardown":
_FAILED.discard(nodeid)
where, cores = _cores()
if where is None:
return
if failed or (failed_before and cores):
into = evidence_root() / folder_name(nodeid)
into.mkdir(parents=True, exist_ok=True)
notes = ["%s failed (phase %s); INVPW_CORE_DIR %s, kernel.core_pattern %r, gdb %s" % (nodeid, when, where, core_pattern(), gdb())]
if not cores:
notes.append("no core file in %s" % where)
for core in cores:
notes.append(gdb_text(core, into))
with open(str(into / "notes.txt"), "a", encoding="utf-8") as sink:
sink.write("\n".join(notes) + "\n")
elif when == "teardown" and cores:
root = evidence_root()
root.mkdir(parents=True, exist_ok=True)
with open(str(root / AFTER_PASSING), "a", encoding="utf-8") as sink:
for core in cores:
sink.write("%s\t%s\t%d bytes (deleted, not read)\n" % (nodeid, core.name, core.stat().st_size))
else:
return
for core in cores:
with contextlib.suppress(OSError):
core.unlink()
except Exception: # the evidence is best effort: the test's own outcome is what counts
pass
+4 -1
View File
@@ -602,7 +602,8 @@ class DohGateway(Gateway):
* CONNECT to a loopback address is relayed for real (the pages and the echo servers of a test);
* the egress endpoints of the base class (``api.ipify.org:80``) keep working;
* any other CONNECT is refused (reply 2 "not allowed", for an address; 4 "host unreachable", for a name) and
listed in :attr:`refused`: the gateway never resolves a name and never reaches past the loopback.
listed in :attr:`refused` (and in ``guard``, the record every gateway of ``_socks_servers`` writes under ``$RUNNER_TEMP/invpw-evidence/``):
the gateway never resolves a name and never reaches past the loopback. Its UDP relay is the base one: only the lab's, the rest dropped and recorded.
:attr:`connects` (inherited) lists EVERY CONNECT target in order, so ``("page-a.test", 80)`` in it means the
browser sent a name where it should have sent an address. :attr:`credentials_seen` lists every
@@ -696,6 +697,8 @@ class DohGateway(Gateway):
if not is_loopback(host):
self.connects.append((host, port))
self.refused.append((host, port))
self.guard.refuse(host, port, getattr(self._local, "atyp", 3), "tcp",
reason="past loopback: the DoH gateway carries only loopback (besides the DoH, the exit questions and the web name it answers)")
self._send(c, self._reply(2 if _is_address(host) else 4))
return
self.connects.append((host, port))
+194
View File
@@ -0,0 +1,194 @@
"""What an e2e test that fails leaves for a reader, and nothing when it passes.
``with FailureEvidence("name") as evidence:`` around the body of a test: while the body runs, the helper collects, in a temporary folder,
the sources the test points it at (the fake web's own record, the Juggler wire of the served browser, the engine's own Juggler trace,
the client's view of every request); when the body raises (an assertion included), it copies what it holds to
``$RUNNER_TEMP/invpw-evidence/<name>/<pid>-<ms>/``, the folder the e2e jobs upload (``invpw-evidence-*``), with a ``meta.json``; when the
body passes, it deletes it all. Off a runner (no ``RUNNER_TEMP``) nothing is copied. It changes no assertion, wait or deadline of the
test: it only listens.
A test that passed slowly may keep the evidence too: ``evidence.keep(why)`` saves what the helper holds at that moment (the same folder, a
``meta.json`` whose ``kept`` says why, judged after the fact and never a verdict). ``arm(moz_log=...)`` also starts the engine's own log
(``MOZ_LOG``, its file in the evidence), and ``note_records(name, state)`` adds a record the test keeps itself (``state.lock``,
``state.records``) as ``<name>.jsonl``.
The times written: ``t``, wall-clock seconds since the epoch (``time.time()``; the engine's own trace writes milliseconds in ``t``, its
``performance.timeOrigin + now``, also since the epoch), and ``m``, ``time.perf_counter()`` of the test process, finer on Windows (whose wall
clock ticks every 15 ms) and shared by the fake web's record, the client's log and the Juggler wire.
"""
from __future__ import annotations
import json
import os
import pathlib
import platform
import shutil
import sys
import tempfile
import threading
import time
import pytest
#: The folder under ``$RUNNER_TEMP`` the e2e workflows upload (``invpw-evidence-*``).
EVIDENCE_FOLDER = "invpw-evidence"
#: The most characters of one Juggler message kept in the wire log: a message longer than this is cut and says so.
WIRE_LIMIT = 4000
#: The engine's trace: the variable `Trace.js` of the engine reads in the parent process (off without it).
TRACE_ENV = "INVISIBLE_JUGGLER_TRACE_DIR"
#: The base name of the engine's log file in the evidence (``MOZ_LOG_FILE``; the engine adds a suffix per process).
MOZ_LOG_BASE = "engine"
class FailureEvidence:
def __init__(self, name: str):
self.name = name
self.work = pathlib.Path(tempfile.mkdtemp(prefix="invpw-failure-evidence-"))
self.trace_dir = self.work / "juggler-engine-trace"
self.wire_path = self.work / "juggler-wire.jsonl"
self.moz_log_dir = self.work / "moz-log"
#: The records the test keeps itself, by name (``note_records``).
self.records = {}
#: What the client heard of each request (a list ``profile_p2.drive(client_log=...)`` fills).
self.client_log = []
#: The cells of the run, once it has returned (``note_cells``).
self.cells = None
self._stop = None
self._patch = None
self._wire = None
self._wire_lock = threading.Lock()
self.saved_to = None
# ---- what the test points the helper at ---------------------------------------------------------------------------
def watch_server(self, stop) -> None:
"""The ``stop`` function ``tests/fakeweb/sites.start`` returned: it carries the server's own record (``stop.state``)."""
self._stop = stop
def note_cells(self, cells) -> None:
self.cells = cells
def note_records(self, name: str, state) -> None:
"""A record the test keeps itself (``state.lock``, ``state.records``: a list of dicts), saved as ``<name>.jsonl``."""
self.records[name] = state
def arm(self, moz_log: str = "") -> None:
"""Before the browser under test is launched: the engine writes its trace, and the Juggler wire of this process is logged.
Armed after the other processes of the test were started, so that they do not inherit the variable. ``moz_log``, a value of
``MOZ_LOG`` (modules and levels), also starts the engine's own log into the evidence (a diagnostic no page reads: the core passes it)."""
self.trace_dir.mkdir(parents=True, exist_ok=True)
self._patch = pytest.MonkeyPatch()
self._patch.setenv(TRACE_ENV, str(self.trace_dir))
if moz_log:
self.moz_log_dir.mkdir(parents=True, exist_ok=True)
self._patch.setenv("MOZ_LOG", moz_log)
self._patch.setenv("MOZ_LOG_FILE", str(self.moz_log_dir / MOZ_LOG_BASE))
self._wire = open(self.wire_path, "w", encoding="utf-8")
try:
from invisible_core.juggler import connection
except Exception as exc: # the trace of the engine is still written; say that the wire is not
self._write_wire({"dir": "note", "what": "the Juggler wire is not logged: %r" % (exc,)})
return
owner = self
original_deliver, original_write = connection.Connection._deliver, connection.Connection._write
def deliver(connection_self, raw):
owner._log_wire("in", raw)
return original_deliver(connection_self, raw)
def write(connection_self, msg):
owner._log_wire("out", msg)
return original_write(connection_self, msg)
self._patch.setattr(connection.Connection, "_deliver", deliver)
self._patch.setattr(connection.Connection, "_write", write)
# ---- the wire ------------------------------------------------------------------------------------------------------
def _write_wire(self, record: dict) -> None:
try:
with self._wire_lock:
if self._wire is not None:
self._wire.write(json.dumps(record, default=str) + "\n")
self._wire.flush()
except Exception:
pass
def _log_wire(self, direction: str, message) -> None:
try:
if isinstance(message, (bytes, bytearray)):
text = bytes(message).decode("utf-8", "replace")
else:
text = json.dumps(message, default=str)
cut = len(text) > WIRE_LIMIT
self._write_wire({"t": round(time.time(), 4), "m": round(time.perf_counter(), 6), "dir": direction, "len": len(text), "cut": cut,
"msg": text[:WIRE_LIMIT]})
except Exception:
pass
# ---- the end ---------------------------------------------------------------------------------------------------------
def keep(self, why: str) -> None:
"""Saves what the helper holds now, though the test has not failed: a run judged after the fact as one to read (a step slower
than any healthy run). Not a verdict: nothing is raised and the test goes on. Never raises."""
try:
self._save(None, None, kept=why)
except Exception as problem:
sys.stderr.write("evidence: could not be kept: %r\n" % (problem,))
def __enter__(self) -> "FailureEvidence":
return self
def __exit__(self, exc_type, exc, tb) -> bool:
try:
if self._patch is not None:
self._patch.undo()
with self._wire_lock:
if self._wire is not None:
self._wire.close()
self._wire = None
if exc_type is not None:
self._save(exc_type, exc)
except Exception as problem: # the evidence never hides the failure it is about
sys.stderr.write("failure evidence: could not be saved: %r\n" % (problem,))
finally:
shutil.rmtree(self.work, ignore_errors=True)
return False
def _save(self, exc_type, exc, kept: str = "") -> None:
base = os.environ.get("RUNNER_TEMP")
if not base:
return
target = pathlib.Path(base) / EVIDENCE_FOLDER / self.name / ("%d-%d" % (os.getpid(), int(time.time() * 1000)))
target.mkdir(parents=True, exist_ok=True)
if self._stop is not None and getattr(self._stop, "state", None) is not None:
state = self._stop.state
with state.lock:
records = list(state.records)
self._jsonl(target / "fakeweb-server-record.jsonl", records)
for name, state in self.records.items():
with state.lock:
records = list(state.records)
self._jsonl(target / ("%s.jsonl" % name), records)
self._jsonl(target / "client-request-log.jsonl", list(self.client_log))
if self.cells is not None:
(target / "cells.json").write_text(json.dumps(self.cells, indent=1, default=str), encoding="utf-8")
if self.wire_path.exists():
shutil.copyfile(self.wire_path, target / "juggler-wire.jsonl")
if self.trace_dir.exists():
shutil.copytree(self.trace_dir, target / "juggler-engine-trace", dirs_exist_ok=True)
if self.moz_log_dir.exists():
shutil.copytree(self.moz_log_dir, target / "moz-log", dirs_exist_ok=True)
meta = {"test": self.name, "platform": sys.platform,
"machine": platform.machine(), "python": platform.python_version(), "saved_at": round(time.time(), 4),
"times": "t: wall-clock seconds since the epoch (the engine's trace: milliseconds, in t); m: time.perf_counter() of the test process, the scale shared by the server record, the client log and the wire",
"files": sorted(p.name for p in target.iterdir())}
if exc_type is not None:
meta["failure"] = "%s: %s" % (exc_type.__name__, str(exc)[:1500])
if kept:
meta["kept"] = kept
(target / "meta.json").write_text(json.dumps(meta, indent=1), encoding="utf-8")
self.saved_to = target
@staticmethod
def _jsonl(path: pathlib.Path, records) -> None:
with open(path, "w", encoding="utf-8") as out:
for record in records:
out.write(json.dumps(record, default=str) + "\n")
+31
View File
@@ -0,0 +1,31 @@
"""``FailureEvidence`` that also keeps a folder of extra files (the engine's own log of the launch, a lab server's record, a page's timeline).
The test writes whatever it wants to keep into ``evidence.files`` while it runs. When the body fails, the folder is copied next to the
rest of the evidence (``<evidence folder>/files/``) and ``meta.json`` lists it; when the body passes, it is deleted with the rest.
Nothing else differs from ``tests/_evidence_on_failure.py``.
"""
from __future__ import annotations
import json
import shutil
from _evidence_on_failure import FailureEvidence
class FailureEvidenceWithFiles(FailureEvidence):
def __init__(self, name: str):
super().__init__(name)
#: Under the helper's own temporary folder: removed with it when the body passes.
self.files = self.work / "files"
self.files.mkdir(parents=True, exist_ok=True)
def _save(self, exc_type, exc) -> None:
super()._save(exc_type, exc)
if self.saved_to is None or not self.files.exists():
return
shutil.copytree(self.files, self.saved_to / "files", dirs_exist_ok=True)
meta_path = self.saved_to / "meta.json"
meta = json.loads(meta_path.read_text(encoding="utf-8"))
meta["files"] = sorted(p.name for p in self.saved_to.iterdir())
meta["extra_files"] = sorted(str(p.relative_to(self.files)).replace("\\", "/") for p in self.files.rglob("*") if p.is_file())
meta_path.write_text(json.dumps(meta, indent=1), encoding="utf-8")
+244
View File
@@ -0,0 +1,244 @@
"""What the e2e tests of the font list need to know about the bundle and about the host, read from files and never typed.
Two sources, both plain data:
* the bundle manifest the core hands to the engine (``invisible_core._fpforge.profile.FONT_MANIFEST``, the text of
``bundle-fonts.list``: ``F|<family>`` opens a family, ``f|<file>|<index>|...|<psname>|<upem>|<ascent>|<descent>|...`` is one of its faces,
``A|<alias>|<target>`` is a Windows font-substitute). The engine prefers this text to the copy in its own directory, so it is the list of
the families the engine answers to;
* the font files of the machine that runs the test (the host): the folders a system installs fonts in. Each file's ``name`` table gives the
family, PostScript and full names of each of its faces. A host font whose names are not in the bundle is a "host-only" face: the engine
must not know it, and a test that asks the page for it has a name that exists on this machine and in no bundle.
Only the header and the ``name`` table of a file are read (a font collection is several faces; ``simsun.ttc`` is 15 MB).
"""
from __future__ import annotations
import os
import struct
import sys
from pathlib import Path
from typing import Dict, Iterable, List, Optional, Set
#: What an sfnt file starts with: TrueType 1.0, OpenType with CFF outlines, the Apple TrueType tag, a collection.
_SFNT = (b"\x00\x01\x00\x00", b"OTTO", b"true")
_COLLECTION = b"ttcf"
_EXTENSIONS = {".ttf", ".otf", ".ttc", ".otc"}
#: name ids of the strings that name a face.
FAMILY, FULL, POSTSCRIPT, TYPOGRAPHIC_FAMILY = 1, 4, 6, 16
class Manifest:
"""The bundle manifest, parsed: families in order, the faces of each (file, index, PostScript name, metrics) and the aliases."""
def __init__(self, text: str):
self.families: List[str] = []
self.faces: Dict[str, List[dict]] = {}
self.aliases: Dict[str, str] = {}
current: Optional[str] = None
for line in text.splitlines():
if not line or line.startswith("#"):
continue
fields = line.split("|")
if fields[0] == "F" and len(fields) >= 2:
current = fields[1]
self.families.append(current)
self.faces[current] = []
elif fields[0] == "A" and len(fields) >= 3:
self.aliases[fields[1]] = fields[2]
elif fields[0] == "f" and current is not None and len(fields) >= 19:
self.faces[current].append({
"file": fields[1], "index": int(fields[2]), "psname": fields[8],
"upem": int(fields[9]), "ascent": int(fields[10]), "descent": int(fields[11]),
})
def family_of_psname(self, psname: str) -> Optional[str]:
for family, faces in self.faces.items():
if any(face["psname"] == psname for face in faces):
return family
return None
def face_with_psname(self, psname: str) -> dict:
for faces in self.faces.values():
for face in faces:
if face["psname"] == psname:
return face
raise AssertionError("the bundle manifest has no face with the PostScript name %r" % psname)
def known_names(self) -> Set[str]:
"""Every name the bundle answers to, lower case: its families, its aliases and the PostScript names of its faces."""
names = {family.lower() for family in self.families}
names |= {alias.lower() for alias in self.aliases}
names |= {face["psname"].lower() for faces in self.faces.values() for face in faces}
return names
def bundle_manifest() -> Manifest:
"""The manifest of the core installed with the wrapper under test, the one the engine is handed as ``zoom.stealth.fonts.manifest``."""
from invisible_core._fpforge.profile import FONT_MANIFEST
manifest = Manifest(FONT_MANIFEST)
assert manifest.families, "the manifest of the core has no family: the parser read nothing"
return manifest
def _decode(platform: int, encoding: int, raw: bytes) -> Optional[str]:
try:
if platform in (0, 3):
return raw.decode("utf-16-be")
if platform == 1 and encoding == 0:
return raw.decode("mac_roman")
except UnicodeDecodeError:
return None
return None
def _name_strings(table: bytes) -> Dict[int, List[tuple]]:
"""name id -> [(is english windows name, text)] of one ``name`` table."""
out: Dict[int, List[tuple]] = {}
if len(table) < 6:
return out
_format, count, string_offset = struct.unpack(">HHH", table[:6])
for i in range(count):
record = table[6 + 12 * i: 18 + 12 * i]
if len(record) < 12:
break
platform, encoding, language, name_id, length, offset = struct.unpack(">6H", record)
text = _decode(platform, encoding, table[string_offset + offset: string_offset + offset + length])
if text:
out.setdefault(name_id, []).append((platform == 3 and language == 0x409, text))
return out
def face_names(path: Path) -> List[dict]:
"""For each face of a font file: ``family`` (every family string, any language), ``psname`` and ``full`` (the English ones, or None).
An unreadable file, or a file that is not an sfnt, has no faces: a host folder holds other things than fonts."""
faces: List[dict] = []
try:
with open(path, "rb") as handle:
head = handle.read(12)
if len(head) < 12:
return faces
if head[:4] == _COLLECTION:
count = struct.unpack(">I", head[8:12])[0]
if count > 64:
return faces
offsets = struct.unpack(">%dI" % count, handle.read(4 * count))
elif head[:4] in _SFNT:
offsets = (0,)
else:
return faces
for base in offsets:
handle.seek(base + 4)
tables = struct.unpack(">H", handle.read(2))[0]
handle.seek(base + 12)
directory = handle.read(16 * tables)
name_table = None
for i in range(tables):
tag, _checksum, offset, length = struct.unpack(">4sIII", directory[16 * i: 16 * i + 16])
if tag == b"name" and 0 < length <= 1 << 20:
handle.seek(offset)
name_table = handle.read(length)
break
if name_table is None:
continue
strings = _name_strings(name_table)
def english(name_id: int) -> Optional[str]:
for is_english, text in strings.get(name_id, []):
if is_english:
return text
return None
families = []
for name_id in (FAMILY, TYPOGRAPHIC_FAMILY):
for _english, text in strings.get(name_id, []):
if text not in families:
families.append(text)
faces.append({"file": str(path), "families": families, "psname": english(POSTSCRIPT), "full": english(FULL)})
except (OSError, struct.error):
return []
return faces
def host_font_files() -> List[Path]:
"""The font files the host has installed, in a stable order."""
if sys.platform == "win32":
roots = [Path(os.environ.get("WINDIR", r"C:\Windows")) / "Fonts"]
local = os.environ.get("LOCALAPPDATA")
if local:
roots.append(Path(local) / "Microsoft" / "Windows" / "Fonts")
else:
roots = [Path("/usr/share/fonts"), Path("/usr/local/share/fonts"), Path.home() / ".fonts",
Path.home() / ".local" / "share" / "fonts"]
files: List[Path] = []
for root in roots:
if root.is_dir():
files += [p for p in root.rglob("*") if p.suffix.lower() in _EXTENSIONS and p.is_file()]
return sorted(files, key=lambda p: str(p).lower())
def _plain(name: Optional[str]) -> bool:
"""A name that goes into a CSS string between double quotes without an escape: printable ASCII, no quote, no backslash."""
return bool(name) and all(32 <= ord(ch) < 127 and ch not in "\"\\" for ch in name)
def bundle_file_names(manifest: Manifest, binary: str) -> Set[str]:
"""Every name (families of any language, PostScript, full), lower case, that the files of the bundle carry in their own ``name`` tables.
The engine answers to the other-language family names of a bundled face as it does to its family (a localized name is an alias of the
face it names), so a host font that carries such a name is not host-only. The folder is ``<engine>/fonts``; when the build has no such
folder the set is empty and the manifest alone decides."""
folder = Path(binary).resolve().parent / "fonts"
names: Set[str] = set()
if not folder.is_dir():
return names
for name in sorted({face["file"] for faces in manifest.faces.values() for face in faces}):
for face in face_names(folder / name):
names |= {family.lower() for family in face["families"]}
names |= {value.lower() for value in (face["psname"], face["full"]) if value}
return names
def host_only_faces(manifest: Manifest, extra_known: Iterable[str] = ()) -> List[dict]:
"""The faces of the host whose names the bundle does not know: no family, no alias and no PostScript name of the bundle."""
known = manifest.known_names() | set(extra_known)
out: List[dict] = []
for path in host_font_files():
for face in face_names(path):
names = [name.lower() for name in face["families"]]
if face["psname"]:
names.append(face["psname"].lower())
if names and not any(name in known for name in names):
out.append(face)
return out
def host_only_families(manifest: Manifest, extra_known: Iterable[str] = ()) -> List[str]:
"""The family names (every language) of the host-only faces, once each, in the order of the files."""
extra_known = set(extra_known)
known = manifest.known_names() | extra_known
seen: Set[str] = set()
out: List[str] = []
for face in host_only_faces(manifest, extra_known):
for family in face["families"]:
key = family.lower()
if key not in seen and key not in known and _plain(family):
seen.add(key)
out.append(family)
return out
def a_host_only_face(manifest: Manifest, prefer: Iterable[str] = (), extra_known: Iterable[str] = ()) -> dict:
"""One host-only face with a PostScript name and a full name a page can write: the first of the ``prefer`` families the host has, else the first.
The face is what a ``src: local()`` is given: its names exist on this machine (the file is on its disk) and in no bundle."""
faces = [f for f in host_only_faces(manifest, extra_known) if _plain(f["psname"]) and _plain(f["full"])]
assert faces, "the host has no font whose names are not the bundle's: there is nothing to ask the engine for that only the host knows"
for wanted in prefer:
for face in faces:
if wanted.lower() in (family.lower() for family in face["families"]):
return face
return faces[0]
+165
View File
@@ -0,0 +1,165 @@
"""TEMPORARY: what a generation of the security state that fails leaves for a reader, whoever started the engine. Remove it once the exit by SIGSEGV
(-11) of the engine in generate mode on the Linux e2e job (run 45014369018) is understood and fixed.
Two launches of the engine in generate mode run in tests/test_security_state_engine_e2e.py: the test's own (`-profile <p>` with the four prefs) and the
CORE's (`invisible_core._security_state_generate.generate`, which `_ready` calls once per module and whose outcome the three tests that need a ready
directory share). The core sends the engine's stdout and stderr to the null device, deletes its work profile before it raises `GenerationError`, and
starts the engine with the core size limit of the test process: a crash of its launch left nothing at all.
* `save_what_the_failed_generation_left` saves, in `$RUNNER_TEMP/invpw-evidence/<name>/` (the folder the e2e jobs upload), the engine's stdout and stderr and
the files of the profile with their sizes (the result, `user.js` and `security_state/` copied);
* `the_core_s_generation_keeps_its_evidence(work, name)` wraps the core's own launch while it is in force: its Popen writes stdout and stderr to files of
`work`, the files of the work profile are noted when the engine exits (before the core deletes them), and when `generate` raises, everything is saved
under `name` and the error is raised unchanged. The core's launch line, environment and outcome are not touched.
The CORE file of a crash is not read here: tests/_crash_cores.py lifts the core limit of the whole pytest session (every engine inherits it, the core's
launches included) and, after the test fails, saves gdb's text of every core in `$INVPW_CORE_DIR` under `invpw-evidence/cores/<test>/`.
Saving is best effort: it never raises and never decides a test (the assertion of the test, or the core's error, does).
"""
from __future__ import annotations
import contextlib
import importlib
import os
import shutil
import subprocess
import sys
import time
from pathlib import Path
import _crash_cores
#: The folder under `$RUNNER_TEMP` the e2e workflows upload (`invpw-evidence-*`).
EVIDENCE_FOLDER = "invpw-evidence"
RESULT_NAME = "securitystate-result.json"
STATE_DIR = "security_state"
def evidence_folder(name, fallback):
"""`$RUNNER_TEMP/invpw-evidence/<name>` on a runner, `<fallback>/<name>` elsewhere; made here."""
base = os.environ.get("RUNNER_TEMP")
folder = (Path(base) / EVIDENCE_FOLDER if base else Path(fallback)) / name
folder.mkdir(parents=True, exist_ok=True)
return folder
def _profile_of(argv):
argv = [str(part) for part in argv]
return Path(argv[argv.index("-profile") + 1]) if "-profile" in argv[:-1] else None
def snapshot_the_profile(profile, into):
"""The files of `profile` (path, size) in `into/profile-files.tsv`, with the result, `user.js` and `security_state/` copied: what the engine left, kept before
anybody deletes the profile. One line saying what was done."""
into.mkdir(parents=True, exist_ok=True)
if profile is None or not Path(profile).is_dir():
return "no profile directory (%s)" % (profile,)
profile = Path(profile)
listing = ["%s\t%d" % (path.relative_to(profile).as_posix(), path.stat().st_size) for path in sorted(profile.rglob("*")) if path.is_file()]
(into / "profile-files.tsv").write_text("\n".join(listing) + "\n", encoding="utf-8")
for name in (RESULT_NAME, "user.js"):
if (profile / name).is_file():
shutil.copyfile(str(profile / name), str(into / name))
if (profile / STATE_DIR).is_dir():
shutil.copytree(str(profile / STATE_DIR), str(into / STATE_DIR), dirs_exist_ok=True)
return "profile files: %d" % len(listing)
def save_what_the_failed_generation_left(profile, output, code, why, folder, *, snapshot=None):
"""ONLY after a generation that failed: `<output>.stdout` and `<output>.stderr` copied as `engine.stdout`/`engine.stderr` and the profile's files (from
`profile`, or from a `snapshot` folder made by `snapshot_the_profile` when the profile is gone); `notes.txt` says what was found, and where the core of a
crash goes. Never raises."""
notes = ["exit code %r; %s" % (code, why or "the engine exited")]
try:
for suffix in (".stdout", ".stderr"):
source = Path(str(output) + suffix)
if source.is_file():
shutil.copyfile(str(source), str(folder / ("engine" + suffix)))
notes.append("%s: %d bytes" % (source.name, source.stat().st_size))
else:
notes.append("%s: not written" % source.name)
if snapshot is not None and Path(snapshot).is_dir():
shutil.copytree(str(snapshot), str(folder), dirs_exist_ok=True)
notes.append("profile: as the engine left it at its exit (the core deleted it afterwards)")
else:
notes.append(snapshot_the_profile(profile, folder))
notes.append(where_the_core_goes())
except Exception as exc: # the evidence is best effort: the test reports the failure
notes.append("saving the evidence failed: %r" % (exc,))
with open(str(folder / "notes.txt"), "a", encoding="utf-8") as sink:
sink.write("\n".join(notes) + "\n")
def where_the_core_goes():
"""One line for `notes.txt`: where the core of a crash is read (Linux), or that there is none to read (elsewhere)."""
if not sys.platform.startswith("linux"):
return "core files: Linux only (tests/_crash_cores.py); none is looked for on %s" % sys.platform
return "core file: read by tests/_crash_cores.py after the test fails, into invpw-evidence/cores/<test>/ (INVPW_CORE_DIR %r, kernel.core_pattern %r, gdb %s)" % (
os.environ.get("INVPW_CORE_DIR"), _crash_cores.core_pattern(), _crash_cores.gdb())
class _Subprocess:
"""The `subprocess` the core's module sees while the wrapper is in force: the real module, with `Popen` replaced."""
def __init__(self, popen):
self.Popen = popen
def __getattr__(self, name):
return getattr(subprocess, name)
@contextlib.contextmanager
def the_core_s_generation_keeps_its_evidence(work, name):
"""While in force, every engine the core's `generate` starts writes its stdout and stderr to files of `work` and has the files of its profile noted when it
exits; if the block raises (the core's `GenerationError`), each launch is saved in the evidence folder `name` and the
exception goes on unchanged. Yields the list of the launches (dicts: argv, output, started_at, code, snapshot)."""
module = importlib.import_module("invisible_core._security_state_generate")
work = Path(work)
work.mkdir(parents=True, exist_ok=True)
launches = []
real_popen = subprocess.Popen
real_module, real_wait = module.subprocess, module._wait_for_exit
def popen(argv, *args, **kwargs):
output = work / ("engine-%d" % len(launches))
launch = {"argv": [str(part) for part in argv], "output": output, "started_at": time.time(), "code": "not exited", "snapshot": None}
launches.append(launch)
sinks = [open(str(output) + ".stdout", "wb"), open(str(output) + ".stderr", "wb")]
kwargs["stdout"], kwargs["stderr"] = sinks
try:
proc = real_popen(argv, *args, **kwargs)
finally:
for sink in sinks:
sink.close()
launch["proc"] = proc
return proc
def wait_for_exit(proc, timeout_s):
code = real_wait(proc, timeout_s)
for launch in launches:
if launch.get("proc") is proc:
launch["code"] = code
launch["snapshot"] = work / ("engine-%d-profile" % launches.index(launch))
try:
snapshot_the_profile(_profile_of(launch["argv"]), launch["snapshot"])
except Exception: # best effort, as every save here
launch["snapshot"] = None
return code
module.subprocess, module._wait_for_exit = _Subprocess(popen), wait_for_exit
try:
yield launches
except BaseException as exc:
folder = evidence_folder(name, work)
with open(str(folder / "notes.txt"), "a", encoding="utf-8") as sink:
sink.write("the core's generate raised %s: %s\nlaunches of the engine: %d\n" % (type(exc).__name__, exc, len(launches)))
for index, launch in enumerate(launches):
target = folder if len(launches) == 1 else folder / ("launch-%d" % index)
target.mkdir(parents=True, exist_ok=True)
with open(str(target / "notes.txt"), "a", encoding="utf-8") as sink:
sink.write("argv: %r\n" % (launch["argv"],))
save_what_the_failed_generation_left(_profile_of(launch["argv"]), launch["output"], launch["code"], str(exc), target, snapshot=launch["snapshot"])
raise
finally:
module.subprocess, module._wait_for_exit = real_module, real_wait
+141 -14
View File
@@ -7,6 +7,13 @@ later one read `h3` (retail Firefox 159, native DNS in loopback: h2, h3, h3; beh
came from: a connection that comes from anywhere but the relay of a gateway on this host (127.0.0.1) did not go through
the proxy.
A client that has a QUIC handshake in progress toward the server is served its next TCP connection only once that handshake has ended (``_QuicFirst``): a real network completes
QUIC in 1 round trip and TCP+TLS in 2, and a browser takes the first connection that is ready.
It also keeps its own record of what it saw (``H3Server.record``, ``write_record``): per TCP connection its accept, the ALPN, every request
path and its end, per QUIC connection its first datagram, its handshake, every request and its end (with the reason), each with ``m``
(``time.perf_counter()`` of the test process) and ``t`` (``time.time()``). It only listens: no answer depends on it.
Needs `aioquic` and `h2` (pip install aioquic h2; the dev extra installs both).
"""
from __future__ import annotations
@@ -14,14 +21,17 @@ from __future__ import annotations
import asyncio
import datetime
import ipaddress
import itertools
import json
import socket
import socketserver
import ssl
import sys
import tempfile
import threading
import time
from pathlib import Path
from typing import List, Tuple
from typing import Dict, List, Tuple
from _ports import bind_tcp_and_hold_udp
@@ -50,6 +60,50 @@ def _certificate(address: str, directory: Path):
#: The one document every path answers, over TCP and over QUIC.
PAGE = b"<!doctype html><meta charset=utf-8><title>h3</title><p>ok</p>"
class _QuicFirst:
"""Keeps the order of a real network between the two connections a browser opens to one server: QUIC is ready after 1 round trip and TCP+TLS after 2, so the QUIC one is
taken. The Python QUIC server of the lab needs longer than TCP+TLS under load and would invert that. For a peer address that has a QUIC handshake in progress toward the
server, the TLS of a new TCP connection from that address waits until the handshake has ended. It waits for an event, never for a time: ``ended`` is called when the
handshake completes (the client has had its connection ready for a round trip by then), fails, or the connection terminates (the idle timeout is one of them), and
``release_all`` when the server closes. With no handshake in progress for the address nothing is held.
The residual case: a client that starts a QUIC handshake and vanishes without a CONNECTION_CLOSE leaves its handshake in progress, so the TCP connections of the same
IP are held until the QUIC idle timeout ends the connection (aioquic: 60 s by default, ``H3Server(quic_idle_timeout=...)``). A real network does not hold the TCP of a
client for that long, but a client of the lab that opens QUIC and goes away is not one a test of the lab depends on; it is measured, with the order asserted and not a
duration, in tests/test_the_h3_lab_server_lets_quic_finish_first.py."""
def __init__(self):
self._changed = threading.Condition()
self._in_progress: Dict[str, int] = {}
self._closed = False
def began(self, peer: str) -> None:
with self._changed:
self._in_progress[peer] = self._in_progress.get(peer, 0) + 1
def ended(self, peer: str) -> None:
with self._changed:
left = self._in_progress.get(peer, 0) - 1
if left > 0:
self._in_progress[peer] = left
else:
self._in_progress.pop(peer, None)
self._changed.notify_all()
def hold(self, peer: str, held: List[str]) -> None:
"""Returns at once when no QUIC handshake of ``peer`` is in progress; otherwise records the hold in ``held`` and returns when none is."""
with self._changed:
if peer not in self._in_progress or self._closed:
return
held.append(peer)
self._changed.wait_for(lambda: self._closed or peer not in self._in_progress)
def release_all(self) -> None:
with self._changed:
self._closed = True
self._changed.notify_all()
class _TcpServer(socketserver.ThreadingTCPServer):
# On Windows SO_REUSEADDR is "share the port": with a number the picker drew (tests/_ports.py) it would bind over a listener that is there.
allow_reuse_address = sys.platform != "win32"
@@ -71,29 +125,36 @@ class _TcpHandler(socketserver.BaseRequestHandler):
def handle(self):
owner = self.server.owner
cid = "tcp-%d" % next(owner._ids)
owner.note("tcp_accept", conn=cid, peer=list(self.client_address[:2]))
reason = "handler ended"
try:
owner._quic_first.hold(self.client_address[0], owner.tcp_held)
self.request.settimeout(10)
tls = owner._tls.wrap_socket(self.request, server_side=True)
except (ssl.SSLError, OSError):
except (ssl.SSLError, OSError) as exc:
owner.note("tcp_handshake_failed", conn=cid, error=repr(exc))
return
try:
tls.settimeout(60)
alpn = tls.selected_alpn_protocol() or "http/1.1"
owner.tcp_alpn.append(alpn)
owner.note("tcp_handshake_done", conn=cid, alpn=alpn)
if alpn == "h2":
self._h2(tls, owner)
reason = self._h2(tls, owner, cid)
else:
self._http1(tls, owner)
except (ssl.SSLError, OSError):
pass
reason = self._http1(tls, owner, cid)
except (ssl.SSLError, OSError) as exc:
reason = "error: %r" % (exc,)
finally:
owner.note("tcp_close", conn=cid, reason=reason)
try:
tls.close()
except OSError:
pass
@staticmethod
def _h2(tls, owner):
def _h2(tls, owner, cid):
import h2.config
import h2.connection
import h2.events
@@ -105,15 +166,16 @@ class _TcpHandler(socketserver.BaseRequestHandler):
while True:
data = tls.recv(65536)
if not data:
return
return "the client closed the connection (EOF)"
try:
events = conn.receive_data(data)
except h2.exceptions.ProtocolError:
except h2.exceptions.ProtocolError as exc:
tls.sendall(conn.data_to_send())
return
return "h2 protocol error: %r" % (exc,)
for event in events:
if isinstance(event, h2.events.RequestReceived):
owner.tcp_requests.append(dict(event.headers).get(":path", ""))
owner.note("tcp_request", conn=cid, stream=event.stream_id, path=dict(event.headers).get(":path", ""))
conn.send_headers(event.stream_id, [
(":status", "200"), ("content-type", "text/html; charset=utf-8"),
("content-length", str(len(PAGE))), ("alt-svc", owner.alt_svc),
@@ -122,13 +184,13 @@ class _TcpHandler(socketserver.BaseRequestHandler):
elif isinstance(event, h2.events.DataReceived):
conn.acknowledge_received_data(event.flow_controlled_length, event.stream_id)
elif isinstance(event, h2.events.ConnectionTerminated):
return
return "h2 GOAWAY from the client (error code %s)" % (event.error_code,)
out = conn.data_to_send()
if out:
tls.sendall(out)
@staticmethod
def _http1(tls, owner):
def _http1(tls, owner, cid):
head = b""
while b"\r\n\r\n" not in head:
chunk = tls.recv(4096)
@@ -140,18 +202,20 @@ class _TcpHandler(socketserver.BaseRequestHandler):
tls.sendall(b"HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: %d\r\n"
b"Alt-Svc: %s\r\nAccess-Control-Allow-Origin: *\r\nConnection: close\r\n\r\n%s"
% (len(PAGE), owner.alt_svc.encode(), PAGE))
return "answered, Connection: close"
class H3Server:
"""TCP+TLS (HTTP/2) and QUIC (HTTP/3) on one port of `address`."""
def __init__(self, address: str):
def __init__(self, address: str, quic_idle_timeout: float = None):
"""``quic_idle_timeout`` (seconds) is the QUIC idle timeout of the server; None keeps aioquic's default (60 s)."""
from aioquic.asyncio.protocol import QuicConnectionProtocol
from aioquic.asyncio.server import QuicServer
from aioquic.h3.connection import H3_ALPN, H3Connection
from aioquic.h3.events import HeadersReceived
from aioquic.quic.configuration import QuicConfiguration
from aioquic.quic.events import ProtocolNegotiated
from aioquic.quic.events import ConnectionTerminated, HandshakeCompleted, ProtocolNegotiated
self.address = address
#: The address each QUIC connection came from.
@@ -164,6 +228,12 @@ class H3Server:
self.tcp_requests: List[str] = []
#: The ALPN each TCP connection negotiated ("h2", or "http/1.1").
self.tcp_alpn: List[str] = []
#: The peer address of each TCP connection whose TLS was held until a QUIC handshake of that address had ended (see ``_QuicFirst``).
self.tcp_held: List[str] = []
self._quic_first = _QuicFirst()
#: The server's own record of what it saw, in order (``note``): a list of dicts, each with ``m``, ``t`` and ``kind``.
self.record: List[dict] = []
self._ids = itertools.count(1)
self._dir = tempfile.TemporaryDirectory()
cert, key = _certificate(address, Path(self._dir.name))
@@ -186,8 +256,47 @@ class H3Server:
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._http = None
#: The address whose handshake this connection holds open in ``_quic_first``; None before its first datagram and once the handshake has ended.
self._handshaking = None
self._began = False
self._cid = "quic-%d" % next(server._ids)
self._datagrams = 0
self._last_datagram_m = None
def datagram_received(self, data, addr):
self._datagrams += 1
self._last_datagram_m = round(time.perf_counter(), 6)
if self._datagrams == 1:
server.note("quic_first_datagram", conn=self._cid, peer=list(addr[:2]), bytes=len(data))
# The first datagram of a peer is the start of its handshake: it is registered before the server answers it.
if not self._began:
self._began = True
self._handshaking = addr[0]
server._quic_first.began(addr[0])
super().datagram_received(data, addr)
# A close (the peer's, or ours after a failed handshake) ends the handshake before the event of the end of the connection.
if self._quic._close_event is not None:
self._handshake_ended()
def _handshake_ended(self):
if self._handshaking is not None:
peer, self._handshaking = self._handshaking, None
server._quic_first.ended(peer)
def quic_event_received(self, event):
if isinstance(event, (HandshakeCompleted, ConnectionTerminated)):
self._handshake_ended()
kind = type(event).__name__
if isinstance(event, ProtocolNegotiated):
server.note("quic_protocol_negotiated", conn=self._cid, alpn=event.alpn_protocol, datagrams=self._datagrams)
elif kind == "HandshakeCompleted":
server.note("quic_handshake_done", conn=self._cid, alpn=getattr(event, "alpn_protocol", None),
datagrams=self._datagrams)
elif kind == "ConnectionTerminated":
server.note("quic_close", conn=self._cid, error_code=event.error_code, frame_type=event.frame_type,
reason=event.reason_phrase, datagrams=self._datagrams, last_datagram_m=self._last_datagram_m)
elif kind == "StreamReset":
server.note("quic_stream_reset", conn=self._cid, stream=event.stream_id, error_code=event.error_code)
if isinstance(event, ProtocolNegotiated):
self._http = H3Connection(self._quic)
peer = self._quic._network_paths[0].addr
@@ -198,6 +307,7 @@ class H3Server:
if isinstance(http_event, HeadersReceived):
headers = dict(http_event.headers)
server.h3_requests.append(headers.get(b":path", b"").decode())
server.note("quic_request", conn=self._cid, stream=http_event.stream_id, path=server.h3_requests[-1])
self._http.send_headers(http_event.stream_id, [
(b":status", b"200"), (b"content-type", b"text/html; charset=utf-8"),
(b"access-control-allow-origin", b"*")])
@@ -205,6 +315,8 @@ class H3Server:
self.transmit()
configuration = QuicConfiguration(is_client=False, alpn_protocols=H3_ALPN)
if quic_idle_timeout is not None:
configuration.idle_timeout = quic_idle_timeout
configuration.load_cert_chain(str(cert), str(key))
self._loop = asyncio.new_event_loop()
started = threading.Event()
@@ -236,7 +348,22 @@ class H3Server:
def url(self) -> str:
return "https://%s:%d/" % (self.address, self.port)
def note(self, kind: str, **fields) -> None:
"""One line of the server's record: ``m`` is ``time.perf_counter()`` of this process, ``t`` the wall clock. Never raises."""
try:
self.record.append({"m": round(time.perf_counter(), 6), "t": round(time.time(), 4), "kind": kind, **fields})
except Exception:
pass
def write_record(self, path) -> None:
"""The record as JSON lines (what the failure evidence of a test keeps)."""
with open(path, "w", encoding="utf-8") as out:
for line in list(self.record):
out.write(json.dumps(line, default=str) + "\n")
def close(self) -> None:
self._quic_first.release_all()
self.note("server_close", quic_connections=len(self.quic_peers), tcp_connections=len(self.tcp_alpn))
self._tcp.shutdown()
self._tcp.server_close()
if not self._loop.is_closed():
+213
View File
@@ -0,0 +1,213 @@
"""The pieces the e2e tests of the language and the zone a context declares share.
* ``serve(routes)``: a local HTTP server on a port the OS gives, answering a table of paths (the query is ignored), each with its bytes, its type
and, if the test needs them, extra headers. Nothing leaves the machine.
* ``open_chrome(port)`` / ``chrome(...)`` / ``set_pref(...)``: the engine's own chrome scope through Marionette, for what no protocol command of
the wrapper does: writing ``intl.accept_languages`` while a session runs, and ``content_process_prefs(...)``: what a pref holds in the
content process of each tab asked for (the proof that a process has taken a change, read from the process itself).
* ``read_in_page_realm(page, body)``: runs ``body`` as an inline ``<script>`` of the page, so in the page's own realm, and returns what it
wrote into the DOM. ``page.evaluate`` is not the page's realm on this engine; an inline script is what a site runs.
* the measuring scripts of the canvas tests (``MEASURE_JS``): the width of a few strings as a canvas of one language group draws them.
No clock, no port written as a number, no environment written here.
"""
from __future__ import annotations
import http.server
import json
import threading
from typing import Any, Dict, Tuple, Union
import webfont_probe
#: What the launch of a browser whose chrome scope is read through Marionette is given (the env var MOZ_REMOTE_ALLOW_SYSTEM_ACCESS
#: is set by the test with ``monkeypatch``).
MARIONETTE_ARGS = ["-marionette", "-remote-allow-system-access"]
Route = Union[bytes, Tuple[bytes, str], Tuple[bytes, str, Dict[str, str]]]
def serve(routes: Dict[str, Route]):
"""A server for ``routes``; returns ``(server, base_url)``. Stop it with :func:`stop`."""
class Handler(http.server.BaseHTTPRequestHandler):
def do_GET(self):
path = self.path.split("?", 1)[0]
route = routes.get(path)
if route is None:
self.send_response(404)
self.send_header("Content-Length", "0")
self.end_headers()
return
if isinstance(route, bytes):
route = (route, "text/html; charset=utf-8")
body, kind = route[0], route[1]
extra = route[2] if len(route) > 2 else {}
self.send_response(200)
self.send_header("Content-Type", kind)
self.send_header("Content-Length", str(len(body)))
self.send_header("Cache-Control", "no-store")
for name, value in extra.items():
self.send_header(name, value)
self.end_headers()
self.wfile.write(body)
def log_message(self, *args):
pass
server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler)
server.daemon_threads = True
threading.Thread(target=server.serve_forever, daemon=True).start()
return server, "http://127.0.0.1:%d" % server.server_address[1]
def stop(server) -> None:
server.shutdown()
server.server_close()
PAGE = b"<!doctype html><html><head><meta charset=utf-8><title>t</title></head><body><p id=p>t</p></body></html>"
# ----------------------------------------------------------------------------------------------------------------- the chrome scope
def open_chrome(port: int):
"""A Marionette session in chrome scope on the engine that listens on ``port``."""
marionette = webfont_probe._Marionette(port)
marionette.call("WebDriver:NewSession", {"capabilities": {"alwaysMatch": {}}})
marionette.call("WebDriver:SetTimeouts", {"script": 240000})
marionette.call("Marionette:SetContext", {"value": "chrome"})
return marionette
def chrome(marionette, script: str, *args: Any) -> Any:
"""Run ``script`` (the body of a function that returns ``JSON.stringify(...)``) in chrome scope; its answer, decoded."""
return json.loads(marionette.call("WebDriver:ExecuteScript", {"script": script, "args": list(args)})["value"])
SET_STRING_PREF_JS = """
const [name, value] = arguments;
Services.prefs.setStringPref(name, value);
return JSON.stringify(Services.prefs.getStringPref(name));
"""
def set_pref(marionette, name: str, value: str) -> str:
return chrome(marionette, SET_STRING_PREF_JS, name, value)
#: What the content process of each tab holds for a pref, read in that process. ``arguments``: the pref's name and the labels of the tabs; a tab is
#: found by its address ending in ``?<label>``. A process script (``Services.ppmm.loadProcessScript``, a data: URL, only the processes that exist)
#: runs in every process and sends back its pid and the value ``Services.prefs`` of THAT process gives; the answer comes when each tab's process
#: has answered. The parent sends a pref change to a content process before this message on the same channel, and the process applies it
#: (and runs its observers) before it runs the script, so a process that answers has handled the change.
PROCESS_PREFS_JS = """
const [name, labels] = arguments;
const done = arguments[arguments.length - 1];
const wanted = {};
for (const win of Services.wm.getEnumerator('navigator:browser')) {
for (const tab of win.gBrowser.tabs) {
const spec = tab.linkedBrowser.currentURI.spec;
const wg = tab.linkedBrowser.browsingContext && tab.linkedBrowser.browsingContext.currentWindowGlobal;
for (const label of labels) {
if (spec.endsWith('?' + label) && wg && wg.domProcess) { wanted[label] = wg.domProcess.osPid; }
}
}
}
const missing = labels.filter((label) => !(label in wanted));
if (missing.length) { done(JSON.stringify({missing})); return; }
const KEY = 'invisible-probe:pref';
const answers = {};
const listener = {
receiveMessage(message) {
answers[message.data.pid] = message.data.value;
if (Object.values(wanted).every((pid) => pid in answers)) {
Services.ppmm.removeMessageListener(KEY, listener);
const prefs = {};
for (const [label, pid] of Object.entries(wanted)) { prefs[label] = answers[pid]; }
done(JSON.stringify({pids: wanted, prefs}));
}
},
};
Services.ppmm.addMessageListener(KEY, listener);
const body = 'sendAsyncMessage(' + JSON.stringify(KEY) + ', {pid: Services.appinfo.processID, value: Services.prefs.getStringPref(' + JSON.stringify(name) + ', "")});';
Services.ppmm.loadProcessScript('data:,' + encodeURIComponent(body), false);
"""
def content_process_prefs(marionette, name: str, labels) -> Dict[str, Any]:
"""``{"pids": {label: pid}, "prefs": {label: value}}``: what pref ``name`` holds in the content process of each tab whose address ends with
``?<label>`` (or ``{"missing": [labels]}`` when a tab is not there)."""
answer = marionette.call("WebDriver:ExecuteAsyncScript", {"script": PROCESS_PREFS_JS, "args": [name, list(labels)]})
return json.loads(answer["value"])
# -------------------------------------------------------------------------------------------------------------------- the page realm
def read_in_page_realm(page, body: str, name: str = "read") -> Any:
"""What ``body`` (the body of a function that returns a JSON-able value) gives when an inline script of the page runs it."""
page.add_script_tag(content=("document.documentElement.setAttribute('data-%s', JSON.stringify((() => {%s})()));" % (name, body)))
return json.loads(page.evaluate("n => document.documentElement.getAttribute('data-' + n)", name))
# ------------------------------------------------------------------------------------------------------------------------ the workers
#: A dedicated worker that answers every message with the language its realm and its navigator speak.
LANG_WORKER = b"""
onmessage = () => postMessage({languages: [...navigator.languages],
intl: Intl.DateTimeFormat().resolvedOptions().locale});
"""
#: Starts that worker in the page and leaves ``window.__ask()`` to ask it again; the worker lives as long as the page.
START_LANG_WORKER_JS = """() => {
window.__worker = new Worker('/lang-worker.js');
window.__ask = () => new Promise((ok) => {
window.__worker.onmessage = (e) => ok(e.data);
window.__worker.postMessage(0);
});
}"""
ASK_LANG_WORKER_JS = "() => window.__ask()"
# ----------------------------------------------------------------------------------------------------------------------- the canvases
#: The width of a few strings, in two generic families, as a canvas of ONE language group draws them: Latin text (the generic serif of each
#: group is another font), full-width Han, kana, half-width kana. ``widths(canvas)`` takes the 2D context's canvas, a main-thread or a
#: worker's OffscreenCanvas, or an element: the font is resolved the way each of them resolves it, which is what the tests compare.
MEASURE_JS = """
const STRINGS = ['Hamburgefonstiv', '\\u6f22\\u5b57', '\\u3042\\u3044\\u3046', '\\uff71\\uff72\\uff73', '\\u76f4\\u9aa8'];
function widths(context) {
const out = {};
for (const font of ['20px serif', '20px sans-serif']) {
context.font = font;
out[font] = STRINGS.map((s) => context.measureText(s).width);
}
return out;
}
"""
#: A dedicated worker that measures on its own OffscreenCanvas and answers with the widths.
MEASURE_WORKER = (MEASURE_JS + """
onmessage = () => postMessage(widths(new OffscreenCanvas(300, 60).getContext('2d')));
""").encode()
#: In the page: the worker's widths, the widths of an OffscreenCanvas of the main thread (no element, no ``lang``), and the widths of a canvas
#: ELEMENT whose ``lang`` is each of the two languages asked for.
MEASURE_PAGE_JS = """async (languages) => {
%s
const worker = await new Promise((ok) => {
const w = new Worker('/measure-worker.js');
w.onmessage = (e) => { ok(e.data); w.terminate(); };
w.postMessage(0);
});
const offscreen = widths(new OffscreenCanvas(300, 60).getContext('2d'));
const element = {};
for (const lang of languages) {
const c = document.createElement('canvas');
c.setAttribute('lang', lang);
document.body.appendChild(c);
element[lang] = widths(c.getContext('2d'));
}
return {worker, offscreen, element};
}""" % MEASURE_JS
+165
View File
@@ -0,0 +1,165 @@
"""A passive listener on the mDNS group (224.0.0.251, UDP 5353): what the lab heard of the engine's responder, packet by packet.
Failure evidence of ``tests/test_declared_host_network_e2e.py``. The engine's responder (dom/media/webrtc/transport/mdns_service/src/lib.rs) is
not heard in a release build: its ``trace!`` lines are compiled out (``release_max_level_info``), so the lab listens to the group itself.
IT ONLY LISTENS. It never sends a packet, never answers, never sets a multicast interface or the loop flag (those are the sender's), and it never raises:
every refusal (a bind, a join, a read, a parse) is written into its own record and the test goes on unchanged.
HOW IT BINDS, against the engine's own socket (lib.rs:124-135): the engine makes a UDP socket with SO_REUSEADDR, SO_REUSEPORT where the system has it
(not on Windows) and binds 0.0.0.0:5353. Both sockets here set the same options, so two sockets share the port and each receives every datagram sent
to the group, and the listener takes nothing from the engine:
* Linux: SO_REUSEADDR and SO_REUSEPORT, bound to the group address 224.0.0.251:5353. A socket bound to a multicast address receives only datagrams
addressed to that group, never a unicast one, so it cannot take a datagram that was meant for the engine's wildcard socket.
* Windows: SO_REUSEADDR, bound to 0.0.0.0:5353 (a multicast address cannot be bound there). The listener is started BEFORE the browser is launched, so the
engine's socket is the later one: Windows gives a unicast datagram to the socket bound last, and the engine's responder sends and answers on the group
address only (lib.rs: ``send_to(&buf, mdns_addr)``).
It joins the group on the interfaces the engine joins on: ``mdns_service_start`` is given ``nr_stealth_mdns_interfaces()``, which is ``"127.0.0.1;"``
(dom/media/webrtc/transport/nr_stealth_network.cpp:229), and the engine joins each address it is given (lib.rs:138-145) and sends through the first
(lib.rs:150-153). So the listener joins on 127.0.0.1 and nothing else.
The record (``write``): JSON lines, the first line ``{"kind": "listener", ...}`` (how the bind and the join went, and the packet counts), then one
line per packet: ``m`` (``time.perf_counter()`` of the test process, the scale of the page timeline once joined by the launch's ``started_m``), ``t`` (wall
clock), ``src`` ([address, port]), ``bytes``, ``kind`` (``query``, ``response`` or ``unparsed``), ``id``, ``questions`` ([{name, type, unicast_bit}]) and
``answers`` ([{name, type, ttl, data}]) as read by a minimal DNS parse.
"""
from __future__ import annotations
import ipaddress
import json
import socket
import struct
import sys
import threading
import time
GROUP = "224.0.0.251"
#: The engine's group, and the one interface it joins on (nr_stealth_mdns_interfaces).
MDNS_ADDRESS = (GROUP, 5353)
JOIN_INTERFACE = "127.0.0.1"
_TYPES = {1: "A", 12: "PTR", 16: "TXT", 28: "AAAA", 33: "SRV", 255: "ANY"}
def _name(data: bytes, offset: int, depth: int = 0):
"""The domain name at ``offset`` (compression followed) and the offset after it in the record the name started in."""
labels, end, jumped = [], None, False
while True:
if offset >= len(data) or depth > 20:
raise ValueError("name out of range")
length = data[offset]
if length == 0:
offset += 1
break
if length & 0xC0 == 0xC0:
pointer = ((length & 0x3F) << 8) | data[offset + 1]
if end is None:
end = offset + 2
offset, jumped, depth = pointer, True, depth + 1
continue
labels.append(data[offset + 1: offset + 1 + length].decode("utf-8", "replace"))
offset += 1 + length
return ".".join(labels), (end if jumped else offset)
def parse(data: bytes) -> dict:
"""A DNS message, minimally: its id, whether it is a query or a response, the questions and the answers."""
identifier, flags, qd, an, ns, ar = struct.unpack("!6H", data[:12])
out = {"id": identifier, "kind": "response" if flags & 0x8000 else "query", "counts": [qd, an, ns, ar], "questions": [], "answers": []}
offset = 12
for _ in range(qd):
name, offset = _name(data, offset)
qtype, qclass = struct.unpack("!HH", data[offset: offset + 4])
offset += 4
out["questions"].append({"name": name, "type": _TYPES.get(qtype, qtype), "unicast_bit": bool(qclass & 0x8000)})
for _ in range(an + ns + ar):
name, offset = _name(data, offset)
rtype, _rclass, ttl, length = struct.unpack("!HHIH", data[offset: offset + 10])
offset += 10
raw = data[offset: offset + length]
if rtype == 1 and length == 4:
value = str(ipaddress.IPv4Address(raw))
elif rtype == 28 and length == 16:
value = str(ipaddress.IPv6Address(raw))
else:
value = raw.hex()
out["answers"].append({"name": name, "type": _TYPES.get(rtype, rtype), "ttl": ttl, "data": value})
offset += length
return out
class MdnsListener:
def __init__(self):
self.packets = []
#: What happened to the listener itself: the bind, the join, a read or a parse that failed. Never raised.
self.status = []
self._socket = None
self._thread = None
self._stop = threading.Event()
def start(self) -> "MdnsListener":
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
if sys.platform != "win32" and hasattr(socket, "SO_REUSEPORT"):
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1)
sock.bind((GROUP if sys.platform != "win32" else "0.0.0.0", MDNS_ADDRESS[1]))
self.status.append({"what": "bound", "address": sock.getsockname()[0], "port": sock.getsockname()[1]})
except Exception as exc:
self.status.append({"what": "bind failed: the listener hears nothing", "error": repr(exc)})
return self
try:
sock.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, socket.inet_aton(GROUP) + socket.inet_aton(JOIN_INTERFACE))
self.status.append({"what": "joined", "group": GROUP, "interface": JOIN_INTERFACE})
except Exception as exc:
self.status.append({"what": "join failed", "group": GROUP, "interface": JOIN_INTERFACE, "error": repr(exc)})
try:
sock.settimeout(0.2)
self._socket = sock
self._thread = threading.Thread(target=self._run, name="mdns-listener", daemon=True)
self._thread.start()
except Exception as exc:
self.status.append({"what": "no reader thread", "error": repr(exc)})
return self
def _run(self) -> None:
sock = self._socket
while not self._stop.is_set():
try:
data, source = sock.recvfrom(9000)
except socket.timeout:
continue
except Exception as exc:
if not self._stop.is_set():
self.status.append({"what": "read failed: the listener stops", "error": repr(exc)})
return
record = {"m": round(time.perf_counter(), 6), "t": round(time.time(), 4), "src": [source[0], source[1]], "bytes": len(data)}
try:
record.update(parse(data))
except Exception as exc:
record.update(kind="unparsed", error=repr(exc), hex=data[:64].hex())
self.packets.append(record)
def stop(self) -> None:
self._stop.set()
try:
if self._socket is not None:
self._socket.close()
except Exception:
pass
if self._thread is not None:
self._thread.join()
def summary(self) -> dict:
kinds = {}
for packet in list(self.packets):
kinds[packet["kind"]] = kinds.get(packet["kind"], 0) + 1
return {"packets": len(self.packets), "by_kind": kinds, "status": list(self.status)}
def write(self, path) -> None:
with open(path, "w", encoding="utf-8") as out:
out.write(json.dumps(dict(kind="listener", group=GROUP, join_interface=JOIN_INTERFACE, **self.summary()), default=str) + "\n")
for packet in list(self.packets):
out.write(json.dumps(packet, default=str) + "\n")
+69
View File
@@ -0,0 +1,69 @@
"""The `goto` of the tests of pages that move on their own (`test_a_page_that_moves_on_e2e.py`), and the model of where the frame goes."""
from __future__ import annotations
def _landing(url: str) -> str:
"""Where the page of `url` sends itself: /landed with the query of its round, which no other round of the module has."""
return "/landed" + url[url.index("?"):]
#: The pages (by address) the frame may still go with, for each page of the browser (by `id`): the page sent last when `goto` answered, and, from a
#: `goto` that raised, every page it may have gone with (`_goto`). `forget` takes a page out when its test ends: an `id` is reused.
_SENT: dict = {}
#: An optional hook for the evidence a failing test leaves: called as ``note(what, **fields)`` where `_goto` sends, hears the answer and hears the error.
#: The test module sets it; it only listens and changes no wait or assertion.
note = None
def forget(page) -> None:
_SENT.pop(id(page), None)
def _goto(page, url, *, the_page_before_may_move, our_page_may_stop_ours, **kwargs) -> frozenset:
"""`page.goto`, and the pages the frame may go with: ``{url}`` when `goto` answers.
- ``the_page_before_may_move``: the pages sent before ours may still be moving (the rounds of the read test go on
while they do, module docstring). A `location.replace` of one of them may win: `goto` says ours was interrupted by it, or
stopped (NS_BINDING_ABORTED), and the frame lands on the landing of THAT page.
- ``our_page_may_stop_ours``: an engine before firefox-68, where `goto` may say NS_BINDING_ABORTED for our own
document, which had committed and then moved
(`test_networkidle_is_reached_only_on_the_page_that_replaced_a_document_still_arriving`); the frame then lands on
our landing.
When `goto` raises, the frame may still go with EITHER page: Playwright raises "interrupted" as soon as a different navigation commits,
while ours goes on, commits and moves to its own landing (run 44688029161: x50-4 raised for the landing of x50-3, and the frame then
navigated to the landing of x50-4). Nothing here knows which one it is, so the pages that may be moving are all of the pages before and
ours, and the next round accepts the landing of any of them. Stock Playwright behaves the same: the model was the test's.
Any other answer is red: an error that is neither answer, an "interrupted" that names a page that cannot be moving, and a navigation that
never answers. The detector of that last one is the timeout of the `goto` itself (each caller passes one): a bound of the test stricter
than it only judged the speed of the machine."""
from invisible_playwright.sync_api import Error
before = _SENT.get(id(page), frozenset()) if the_page_before_may_move else frozenset()
if note:
note("goto", url=url, before=sorted(before))
try:
page.goto(url, **kwargs)
if note:
note("goto-answered", url=url)
except Error as e:
text = str(e)
if note:
note("goto-raised", url=url, error=text[:300])
if "NS_BINDING_ABORTED" in text:
ends = tuple(_landing(u) for u in sorted(before | ({url} if our_page_may_stop_ours else frozenset())))
assert ends, e
page.wait_for_url(lambda u: u.endswith(ends), timeout=30_000)
else:
assert before, e
assert "is interrupted by another navigation to" in text, e
named = text.split("another navigation to")[1]
assert any(_landing(u) in named for u in before), (e, sorted(before))
possible = before | {url}
else:
possible = frozenset({url})
_SENT[id(page)] = possible
return possible
+186
View File
@@ -0,0 +1,186 @@
"""What the window e2e tests ask the operating system itself: which window holds the input focus, on a display of the test's own.
A page's ``document.hasFocus()`` is what the engine reports. A test that judges "the first session kept the focus when another one took the display" must
first know that the OS did give the focus to the second session's window; otherwise a green means only that nothing happened (the second window never took
it, or took it later than the read). The OS answers that without the engine:
* Linux: the X input focus (``XGetInputFocus`` on the display the sessions share); the display is a private Xvfb started for the test (``a_display_of_its_own``),
so no other test's headed window moves the focus in it. No window manager runs there, so nobody ever sets the X input focus: it stays ``PointerRoot``
and GDK activates whichever toplevel is under the pointer (``has_pointer_focus``, ``gdk/x11/gdkdevicemanager-core-x11.c``), and Firefox raises a window
itself only when it is not active already (``nsWindow::SetFocus``, ``gtk_window_present_with_time``). The test therefore does what a window manager does
when the user clicks a window: ``XSetInputFocus`` on the toplevel the step names (found by its ``_NET_WM_NAME``), and reads ``XGetInputFocus`` back;
* Windows: the foreground window (``GetForegroundWindow``), the window of the session found by the title its page gave it.
"""
from __future__ import annotations
import contextlib
import ctypes
import subprocess
import sys
import threading
from typing import Iterator, Optional
#: ``RevertToParent`` and ``CurrentTime`` of ``XSetInputFocus`` (as GDK's own ``gdk_x11_window_focus`` without a window manager); ``IsViewable``.
_REVERT_TO_PARENT, _CURRENT_TIME, _IS_VIEWABLE = 2, 0, 2
class _XWindowAttributes(ctypes.Structure):
_fields_ = [("x", ctypes.c_int), ("y", ctypes.c_int), ("width", ctypes.c_int), ("height", ctypes.c_int), ("border_width", ctypes.c_int),
("depth", ctypes.c_int), ("visual", ctypes.c_void_p), ("root", ctypes.c_ulong), ("c_class", ctypes.c_int), ("bit_gravity", ctypes.c_int),
("win_gravity", ctypes.c_int), ("backing_store", ctypes.c_int), ("backing_planes", ctypes.c_ulong), ("backing_pixel", ctypes.c_ulong),
("save_under", ctypes.c_int), ("colormap", ctypes.c_ulong), ("map_installed", ctypes.c_int), ("map_state", ctypes.c_int),
("all_event_masks", ctypes.c_long), ("your_event_mask", ctypes.c_long), ("do_not_propagate_mask", ctypes.c_long),
("override_redirect", ctypes.c_int), ("screen", ctypes.c_void_p)]
#: An X error (a window gone between two requests, a focus asked for a window not yet viewable) is ignored instead of ending the process as Xlib's
#: default handler does; the wait that asked reads the focus again on its next look.
_X_ERROR_HANDLER = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p)
_ignore_x_error = _X_ERROR_HANDLER(lambda display, event: 0)
@contextlib.contextmanager
def a_display_of_its_own(monkeypatch) -> Iterator[str]:
"""Linux: a private Xvfb (the number chosen by the server, ``-displayfd``), set as ``DISPLAY`` for the test and stopped at its end.
Two headed sessions started inside it see each other and nothing else; the Xvfb of ``xvfb-run`` that the parallel workers share is never touched."""
process = subprocess.Popen(["Xvfb", "-displayfd", "1", "-screen", "0", "1920x1080x24", "-nolisten", "tcp"],
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True)
answer = {}
reader = threading.Thread(target=lambda: answer.setdefault("line", process.stdout.readline()), daemon=True)
reader.start()
try:
reader.join(60)
number = answer.get("line", "").strip()
assert number.isdigit(), "the private Xvfb did not give a display number (it said %r, exit %r)" % (number, process.poll())
monkeypatch.setenv("DISPLAY", ":" + number)
for name in ("WAYLAND_DISPLAY", "XAUTHORITY"):
monkeypatch.delenv(name, raising=False)
yield ":" + number
finally:
process.terminate()
try:
process.wait(30)
except subprocess.TimeoutExpired:
process.kill()
process.wait(30)
process.stdout.close()
class XFocus:
"""The X input focus of a display, read and given through a connection of its own (libX11, as the engine's own client library)."""
def __init__(self, display: str) -> None:
x11 = self.x11 = ctypes.CDLL("libX11.so.6")
ulong_p, int_p = ctypes.POINTER(ctypes.c_ulong), ctypes.POINTER(ctypes.c_int)
x11.XOpenDisplay.restype, x11.XOpenDisplay.argtypes = ctypes.c_void_p, (ctypes.c_char_p,)
x11.XSetErrorHandler.argtypes = (_X_ERROR_HANDLER,)
x11.XDefaultRootWindow.restype, x11.XDefaultRootWindow.argtypes = ctypes.c_ulong, (ctypes.c_void_p,)
x11.XInternAtom.restype, x11.XInternAtom.argtypes = ctypes.c_ulong, (ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int)
x11.XQueryTree.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ulong_p, ulong_p, ctypes.POINTER(ulong_p), ctypes.POINTER(ctypes.c_uint))
x11.XGetWindowAttributes.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.POINTER(_XWindowAttributes))
x11.XGetWindowProperty.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_long, ctypes.c_long, ctypes.c_int, ctypes.c_ulong,
ulong_p, int_p, ulong_p, ulong_p, ctypes.POINTER(ctypes.c_void_p))
x11.XFree.argtypes = (ctypes.c_void_p,)
x11.XSetInputFocus.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_int, ctypes.c_ulong)
x11.XSync.argtypes = (ctypes.c_void_p, ctypes.c_int)
x11.XGetInputFocus.argtypes = (ctypes.c_void_p, ulong_p, int_p)
x11.XCloseDisplay.argtypes = (ctypes.c_void_p,)
x11.XSetErrorHandler(_ignore_x_error)
self.connection = x11.XOpenDisplay(display.encode())
assert self.connection, "no connection to the display %r" % display
self.root = x11.XDefaultRootWindow(self.connection)
self.net_wm_name = x11.XInternAtom(self.connection, b"_NET_WM_NAME", False)
self.utf8_string = x11.XInternAtom(self.connection, b"UTF8_STRING", False)
def holder(self) -> int:
window, revert = ctypes.c_ulong(), ctypes.c_int()
self.x11.XGetInputFocus(self.connection, ctypes.byref(window), ctypes.byref(revert))
return int(window.value)
def _title(self, window: int) -> str:
kind, size, count, left, data = ctypes.c_ulong(), ctypes.c_int(), ctypes.c_ulong(), ctypes.c_ulong(), ctypes.c_void_p()
if self.x11.XGetWindowProperty(self.connection, window, self.net_wm_name, 0, 1024, False, self.utf8_string, ctypes.byref(kind),
ctypes.byref(size), ctypes.byref(count), ctypes.byref(left), ctypes.byref(data)) != 0 or not data.value:
return ""
try:
return ctypes.string_at(data.value, count.value).decode("utf-8", "replace") if size.value == 8 else ""
finally:
self.x11.XFree(data)
def _viewable(self, window: int) -> bool:
attributes = _XWindowAttributes()
return bool(self.x11.XGetWindowAttributes(self.connection, window, ctypes.byref(attributes))) and attributes.map_state == _IS_VIEWABLE
def window_titled(self, title: str) -> Optional[int]:
"""The one viewable toplevel (a child of the root: no window manager reparents it) whose ``_NET_WM_NAME`` starts with ``title``, or None."""
root, parent, children, count = ctypes.c_ulong(), ctypes.c_ulong(), ctypes.POINTER(ctypes.c_ulong)(), ctypes.c_uint()
if not self.x11.XQueryTree(self.connection, self.root, ctypes.byref(root), ctypes.byref(parent), ctypes.byref(children), ctypes.byref(count)):
return None
try:
windows = [int(children[i]) for i in range(count.value)]
finally:
if children:
self.x11.XFree(children)
found = [window for window in windows if self._title(window).startswith(title) and self._viewable(window)]
return found[0] if len(found) == 1 else None
def ask_for_the_foreground(self, window: int) -> int:
"""What a window manager does when the user clicks the window (none runs on this display): ``XSetInputFocus`` on it, then the focus is read back."""
self.x11.XSetInputFocus(self.connection, window, _REVERT_TO_PARENT, _CURRENT_TIME)
self.x11.XSync(self.connection, False)
return self.holder()
def close(self) -> None:
self.x11.XCloseDisplay(self.connection)
self.connection = None
class ForegroundWindow:
"""Windows: the foreground window of the desktop the sessions run on, and the Firefox window a title names."""
def __init__(self) -> None:
from ctypes import wintypes
self.user32 = ctypes.WinDLL("user32", use_last_error=True)
self.user32.GetForegroundWindow.restype = wintypes.HWND
self.user32.SetForegroundWindow.argtypes = (wintypes.HWND,)
self.enum = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
def holder(self) -> int:
return self.user32.GetForegroundWindow() or 0
def window_titled(self, title: str) -> Optional[int]:
"""The one visible top-level Firefox window whose title starts with ``title``, or None (none, or more than one)."""
found = []
def each(hwnd, _):
name, text = ctypes.create_unicode_buffer(256), ctypes.create_unicode_buffer(512)
self.user32.GetClassNameW(hwnd, name, 256)
self.user32.GetWindowTextW(hwnd, text, 512)
if name.value.startswith("MozillaWindowClass") and text.value.startswith(title) and self.user32.IsWindowVisible(hwnd):
found.append(hwnd)
return True
self.user32.EnumWindows(self.enum(each), 0)
return found[0] if len(found) == 1 else None
def ask_for_the_foreground(self, hwnd: int) -> int:
"""What a user does by clicking the window: the system may refuse it, and then the foreground is what the test reads."""
self.user32.SetForegroundWindow(hwnd)
return self.holder()
def host_monitor_size() -> Optional[tuple]:
"""Windows: the primary monitor in device pixels (the reading of a per-monitor-aware process, whatever the test's own awareness is); None elsewhere."""
if sys.platform != "win32":
return None
user32 = ctypes.WinDLL("user32")
user32.SetThreadDpiAwarenessContext.restype = ctypes.c_void_p
user32.SetThreadDpiAwarenessContext.argtypes = (ctypes.c_void_p,)
previous = user32.SetThreadDpiAwarenessContext(ctypes.c_void_p(-4))
try:
return (user32.GetSystemMetrics(0), user32.GetSystemMetrics(1))
finally:
if previous:
user32.SetThreadDpiAwarenessContext(ctypes.c_void_p(previous))
+110
View File
@@ -0,0 +1,110 @@
"""A popup opened the way a page opens one, and what it reads of its own window.
Shared by `test_popup_geometry_is_the_declared_frame_e2e.py` and by the inner-size test of
`test_fingerprint_surface.py`: both need a popup (`window.open` with features, from a click) whose document may carry an
iframe of another site (so, under Fission, in another process), and both read the window geometry from inside it.
The popup is read with a CONDITION, not a pause: the reading is repeated (with the client's events being read between two
looks) until the caller's `ready` holds or 30 s have passed, and the last reading is returned either way, so the caller's
assertion names what was read when it never settled.
"""
from __future__ import annotations
import threading
from typing import Any, Callable, Dict, Optional
from _fission_frames import Sites, wait_frame
from _waits import wait_until
#: The scale at which the declared window frame is the one of `WINDOW_FRAME_BY_DPR[1.0]`: border 8, popup UI 72, default
#: position 4 (device pixels, and CSS pixels at 1.0). The screen is the one the other surface tests pin.
PIN = {"screen.width": 1920, "screen.height": 1080, "screen.dpr": 1.0}
#: A second declared window frame that no runner has: a border of 6, a popup UI of 53 above the content, a default position of 9. The declared frame at scale 1.0
#: (8, 72, 4) is the frame of a retail Windows window, so a Windows runner's own popup has it too (outer - inner = 16 x 80) and a launch with the engine off
#: cannot tell the declaration from the host there; a launch declared with ANOTHER frame can (the prefs are applied last, over the core's declaration).
OTHER_FRAME = {"zoom.stealth.screen.frame_border": 6, "zoom.stealth.screen.popup_ui": 53, "zoom.stealth.screen.popup_position": 9}
OTHER_BORDER, OTHER_POPUP_UI, OTHER_POSITION = 6, 53, 9
READ = """() => ({iw: innerWidth, ih: innerHeight, ow: outerWidth, oh: outerHeight,
sx: screenX, sy: screenY, mx: mozInnerScreenX, my: mozInnerScreenY})"""
def in_a_thread_of_its_own(fn: Callable[[], Any], timeout: float = 300) -> Any:
"""Runs `fn` in a thread with no asyncio loop and gives back its result or raises its error.
For a module whose own fixture keeps a sync client open for the whole module: an open sync client leaves its loop marked as
running in its thread, and a second sync client started in that thread refuses with "Playwright Sync API inside the asyncio
loop". The second browser needs a thread of its own.
"""
box: Dict[str, Any] = {}
def run() -> None:
try:
box["value"] = fn()
except BaseException as exc: # handed back to the test's thread below
box["error"] = exc
worker = threading.Thread(target=run, name="second-sync-client", daemon=True)
worker.start()
worker.join(timeout)
if worker.is_alive():
raise AssertionError("the browser of the test did not end within %d s" % timeout)
if "error" in box:
raise box["error"]
return box.get("value")
def frame_of_the_declaration():
"""The window frame the core declares at scale 1.0: what the engine adds to a popup's inner size."""
from invisible_core.constants import WINDOW_FRAME_BY_DPR
return WINDOW_FRAME_BY_DPR[1.0]
def frame_extra(border: int, popup_ui: int):
"""What a popup adds to its inner size: (outer - inner) wide and high, for a border and a popup UI."""
return (2 * border, popup_ui + border)
def _plausible(reading: Dict[str, Any]) -> bool:
"""Every size of every window read is above 0: the window (and its frame, if any) has been laid out."""
return all(r["iw"] > 0 and r["ih"] > 0 and r["ow"] > 0 and r["oh"] > 0
for r in (reading["popup"], reading["frame"]) if r is not None)
def read_popup(binary: str, extra_prefs: Optional[Dict[str, Any]] = None, iframe: bool = False,
ready: Optional[Callable[[Dict[str, Any]], bool]] = None,
features: str = "width=500,height=400") -> Dict[str, Any]:
"""Open `window.open(url, 'p', features)` (default `width=500,height=400`) from a click and read it.
Returns `{"popup": {...}, "frame": {...} or None}` with `iw ih ow oh sx sy mx my` (innerWidth, innerHeight,
outerWidth, outerHeight, screenX, screenY, mozInnerScreenX, mozInnerScreenY) of the popup and, with `iframe`, of its
iframe (another site, 200x150). `ready(reading)` says when the reading has settled (default: every size above 0).
"""
from invisible_playwright import InvisiblePlaywright
with Sites() as s:
s.route("A", "/main", "<!doctype html><title>main</title><button id='open' onclick=\"window.open('%s', 'p', "
"'%s')\">open</button>" % (s.url("A", "/popup"), features))
frame_html = ("<iframe id='f' src='%s' style='position:absolute;left:0;top:0;width:200px;height:150px;border:0'>"
"</iframe>" % s.url("B", "/frame")) if iframe else ""
s.route("A", "/popup", "<!doctype html><title>popup</title>" + frame_html)
s.route("B", "/frame", "<!doctype html><title>frame</title>")
with InvisiblePlaywright(seed=42, pin=PIN, binary_path=binary, headless=True, humanize=False,
extra_prefs=extra_prefs) as browser:
page = browser.new_page()
page.goto(s.url("A", "/main"), wait_until="load", timeout=30000)
with page.expect_popup(timeout=30000) as info:
page.click("#open", timeout=30000)
popup = info.value
popup.wait_for_load_state("load", timeout=30000)
frame = wait_frame(popup, s.origin["B"], "/frame", seconds=30) if iframe else None
seen: Dict[str, Any] = {}
def settled() -> bool:
seen["now"] = {"popup": popup.evaluate(READ), "frame": frame.evaluate(READ) if frame else None}
return _plausible(seen["now"]) and (ready is None or bool(ready(seen["now"])))
wait_until(settled, 30, lambda: popup.wait_for_timeout(100))
return seen["now"]
+105 -6
View File
@@ -21,10 +21,20 @@ test-only: the product never sets it) a content process that hosts a site is nam
The process gets its name before any document loads in it, so when a page of the site has run, its process already
answers to the site. Windows names no process (ProcessUtils_none.cpp): a test that looks at sites skips there and
says so.
Windows names no process, but the engine's own log names the type of every process it creates (`Setting remoteType of
process <pid> to <type>` when a process is born with its type, `Changing remoteType of process <pid> from prealloc to
<type>` when a spare one is given its site: `dom/ipc/ContentChild.cpp`, `RecvSetRemoteType`, log module `Process`). The
type of a process that hosts a site is `webIsolated=<site>^<attributes>` (`dom/ipc/RemoteType.cpp`, `Stringify`), the
same site the Linux name carries, and the process gets it before any document loads in it. So on Windows a test starts the
engine with `LOG_ENV` and a file base (`MOZ_LOG_FILE`), and `remote_types(base)` reads which type each process was given (by pid and time, a pid being reused);
liveness and the engine's own directory are still told by the process tree, so a process that has ended is not counted.
"""
from __future__ import annotations
import calendar
import os
import re
import sys
import pytest
@@ -57,9 +67,94 @@ def hosts_site(name, site):
return len(prefix) >= NAME_LENGTH or name[len(prefix)] == "^"
#: The environment that makes the engine write the type of each process it creates (`MOZ_LOG_FILE` is added by the
#: test: a file base in its own temporary folder). Used where the system names no process (Windows).
LOG_ENV = {"MOZ_LOG": "Process:5,timestamp,sync"}
_TYPE_GIVEN = re.compile(r"(?:Setting remoteType of process (\d+) to|Changing remoteType of process (\d+) from \S+ to) (\S+)")
#: The start of a line of `MOZ_LOG` with the `timestamp` option: `2026-11-22 10:11:12.123456 UTC - [Process 12: Thread]: ...`.
_LOG_TIME = re.compile(r"^(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)\.(\d{6}) UTC - ")
#: How much earlier than the creation time of a process (psutil) its first log line may be stamped: the two clocks are
#: read at different moments of its birth.
BIRTH_SLACK = 0.25
def _natural(path):
"""The sort key that puts `base.child-2` before `base.child-10` (the plain order of names puts it after)."""
return [int(part) if part.isdigit() else part for part in re.split(r"(\d+)", path.name)]
def _stamp(line):
"""The time of a log line in seconds since the epoch (UTC), or None when the line carries no timestamp."""
match = _LOG_TIME.match(line)
if match is None:
return None
year, month, day, hour, minute, second, micro = (int(g) for g in match.groups())
return calendar.timegm((year, month, day, hour, minute, second)) + micro / 1e6
def remote_types(base):
"""`{pid: [(time, remote type), ...]}` of the processes the engine has logged to the files that start with the path
`base` (`MOZ_LOG_FILE`: the parent writes `base`, each child its own `base.child-N`), each list in the order of the
time the lines were logged (then the child number as a number, then the line). A pid alone does not name a process:
the system gives the number of an ended process to a later one, and a later process of another site must not
inherit the type of the old one. So the types stay stamped, and `type_of_process` chooses the ones of the process
instance in hand. A process that logs twice (a spare one, then the site it is given) has two entries, the last wins."""
entries = {}
for order, path in enumerate(sorted(base.parent.glob(base.name + "*"), key=_natural)):
for number, line in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines()):
match = _TYPE_GIVEN.search(line)
if match is None:
continue
stamp = _stamp(line)
key = (stamp if stamp is not None else float("-inf"), order, number)
entries.setdefault(int(match.group(1) or match.group(2)), []).append((key, stamp, match.group(3)))
return {pid: [(stamp, remote_type) for _key, stamp, remote_type in sorted(found, key=lambda entry: entry[0])]
for pid, found in entries.items()}
def type_of_process(types, pid, created):
"""The remote type the process `pid` born at `created` (epoch seconds, `psutil.Process.create_time()`) was given: the
last one logged for the pid at or after its birth (less `BIRTH_SLACK`). Entries logged before the process existed
are the ones of an earlier process that had the same pid, and are ignored. A line with no timestamp counts for any
birth. `""` when the process has not logged its type yet."""
chosen = ""
for stamp, remote_type in types.get(pid, ()):
if stamp is None or stamp >= created - BIRTH_SLACK:
chosen = remote_type
return chosen
def hosts_site_by_type(remote_type, site):
"""True when a process of the remote type `remote_type` hosts `site` (`http://a.test`): `<kind>=<site>` or
`<kind>=<site>^<attributes>`. A process with no site (`web`, `prealloc`, `privilegedabout`, `extension`) has no `=`."""
meta = remote_type.partition("=")[2]
return meta == site or meta.startswith(site + "^")
def site_pids_by_type(processes, site, types, engine_dir=None):
"""Like `site_pids`, told by the remote types the engine logged (`remote_types`) instead of by the process name."""
return _content_pids(processes, engine_dir, lambda proc, _name: hosts_site_by_type(_type_of(types, proc), site))
def _type_of(types, proc):
import psutil
try:
return type_of_process(types, proc.pid, proc.create_time())
except psutil.Error:
return ""
def site_pids(processes, site, engine_dir=None):
"""The pids, among `processes` (psutil-like), of the content processes (`-contentproc ... tab`) that host `site`;
with `engine_dir`, only those of the engine in that directory."""
return _content_pids(processes, engine_dir, lambda _proc, name: hosts_site(name, site))
def _content_pids(processes, engine_dir, hosts):
import psutil
pids = set()
@@ -70,19 +165,23 @@ def site_pids(processes, site, engine_dir=None):
name, cmd = proc.name(), proc.cmdline()
except psutil.Error:
continue
if "-contentproc" in cmd and cmd and cmd[-1] == "tab" and hosts_site(name, site):
if "-contentproc" in cmd and cmd and cmd[-1] == "tab" and hosts(proc, name):
pids.add(proc.pid)
return pids
def site_processes_below(root_pid, site, engine_dir=None):
"""The pids of the processes below `root_pid` that host `site`. Off Linux the test skips: no name says it."""
def site_processes_below(root_pid, site, engine_dir=None, types=None):
"""The pids of the processes below `root_pid` that host `site`. On Linux the name of the process says it; on Windows
`types` (a function that returns `remote_types(base)` of the engine's log, see `LOG_ENV`) does. With neither, the test
skips: no name says it."""
import psutil
if not sys.platform.startswith("linux"):
pytest.skip("only Linux names a content process by the site it hosts; %s names none" % sys.platform)
if not sys.platform.startswith("linux") and types is None:
pytest.skip("only Linux names a content process by the site it hosts; %s names none (pass `types`)" % sys.platform)
try:
children = psutil.Process(root_pid).children(recursive=True)
except psutil.Error:
return set()
return site_pids(children, site, engine_dir)
if sys.platform.startswith("linux"):
return site_pids(children, site, engine_dir)
return site_pids_by_type(children, site, types(), engine_dir)
+214 -26
View File
@@ -33,11 +33,22 @@ answer as the service; the plain-HTTP endpoint ``api.ipify.org:80`` is still
answered here for the tests that ask it), and the UDP exit is what the fake STUN server puts in its XOR-MAPPED-ADDRESS.
Both are chosen by the test (``tcp_exit`` and ``udp_exit`` arguments).
Any other CONNECT is really forwarded, and any other UDP datagram is really
forwarded to its destination and the reply wrapped back, so a page, or an echo
server on 127.0.0.1, can be reached through the gateway and the test can
observe which road its bytes took (:attr:`Gateway.connects`,
:attr:`Gateway.datagrams`).
HERMETIC: a gateway of this module carries a CONNECT or a datagram only to the LAB (:func:`is_lab_destination`: loopback, the
documentation ranges of RFC 5737 and RFC 3849 the tests use as lab exits and servers, the addresses of this host's own interfaces, where a server
of a test may stand, and the name ``localhost``). These tests run in the gate of the candidate, where no test may depend on a real service, and the
browser behind a gateway makes background requests of its own (a name of the vendor, a captive-portal check, a telemetry endpoint): such a
destination is REFUSED, never forwarded (a CONNECT is answered with reply 2, "not allowed"; a datagram is dropped), and RECORDED
(:class:`LabGuard`: the time since the gateway started, the SOCKS5 address type, the destination as it was received - the NAME for type 3 -, the
port, the protocol, ``tcp`` or ``udp``, and the REASON: which rule refused it, the lab's or the narrower one of a subclass). The interfaces of this
host are read when the guard is made (``psutil.net_if_addrs``, written once in the record with how they were read) and again at each decision that
needs them; a reading that fails RAISES (``_witness.HostInterfacesUnreadable``), it is never an empty list. The record is always written, when the gateway is closed, under
``$RUNNER_TEMP/invpw-evidence/<gateway>/<pid>-<ms>/refused-destinations.json`` (the folder the e2e jobs upload; off a runner nothing is
written), so that a reader sees what the browser asked for besides what the test drives. There is no option that reopens it. A subclass can only
narrow it (:meth:`Gateway._admits`); the destinations it serves itself (the fake STUN server, the page of ``WEB_NAME``, the exit questions) are
answered before it, and a name mapped to a local server by :meth:`Gateway._target` is judged by the server it maps to. What a test sees of the
road is :attr:`Gateway.connects`, :attr:`Gateway.datagrams` (every datagram the relay read, carried or dropped) and
:attr:`Gateway.guard`. :class:`Socks5TcpOnly` and the SOCKS5 server of ``test_proxy_socks_auth_e2e.py`` are hermetic the same way (same rule,
same record).
This is the ONE SOCKS5 gateway of the test suite. A road that needs more than the three above (a TURN server, a resolver,
a page, by NAME: ``tests/_turn_chain.py``) subclasses :class:`Gateway` and overrides the small hooks (:meth:`Gateway._route`,
@@ -46,7 +57,10 @@ ASSOCIATE, the relay or the round trip.
"""
from __future__ import annotations
import ipaddress
import json
import os
import pathlib
import select
import socket
import struct
@@ -55,7 +69,7 @@ import time
from typing import Callable, Dict, List, Optional, Set, Tuple
#: The name the product's STUN probe sends through the relay. The relay maps it
#: to the fake STUN server; every other destination is forwarded for real.
#: to the fake STUN server; every other destination is the lab's to carry or is refused (``LabGuard``).
STUN_NAME = "stun.l.google.com"
STUN_PORT = 19302
#: The same STUN server by NUMBER. A page cannot resolve a name behind the session (the engine forbids local
@@ -79,19 +93,18 @@ _MAGIC = b"\x21\x12\xa4\x42"
# ----------------------------------------------------------------------------------------------------------------
# The exit of a proxy that forwards for real. The question "where do I leave from" is HTTPS (api.ipify.org:443), and no gateway
# of the tests can answer a TLS request as the service: a proxy that FORWARDS (a CONNECT to anything outside loopback goes out for
# real) would carry it to the internet, and the answer would be the address of whatever machine runs the test (a GitHub runner
# that changes NAT in the middle of a session: ``ProxyEgressDrifted``). So such a proxy DECLARES its exit (``declare_exit``) and
# ``tests/_lab_egress.DeclaredExit`` answers the question with it; and as a backstop each of them refuses to forward the question
# (``asks_the_world``), which records it and makes the test fail (``nobody_asked_the_world``), so that a proxy that forgot to declare
# is a red with its name and not a flaky green.
# The exit of a proxy that relays CONNECTs. The question "where do I leave from" is HTTPS (api.ipify.org:443), and no gateway
# of the tests can answer a TLS request as the service. A gateway of this module is hermetic (a CONNECT outside the lab is refused, see
# ``LabGuard``), so the question could not reach the internet through it anyway; but the product would then be told no exit at all. So such a
# proxy DECLARES its exit (``declare_exit``) and ``tests/_lab_egress.DeclaredExit`` answers the question with it; and as a backstop each of
# them refuses the question itself (``asks_the_world``), which records it and makes the test fail (``nobody_asked_the_world``), so that a
# proxy that forgot to declare is a red with its name and not a flaky green.
# ----------------------------------------------------------------------------------------------------------------
#: The hosts of the services of the core that tell a caller its address (``invisible_core._geo._IP_ECHO_ENDPOINTS`` and
#: ``_IPV6_ECHO_ENDPOINTS``; ``tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py`` checks that this list covers them).
EXIT_SERVICES = ("api.ipify.org", "api6.ipify.org", "icanhazip.com", "ipv6.icanhazip.com", "checkip.amazonaws.com", "ifconfig.me")
#: ``host:port`` of a proxy of the tests that forwards for real -> the exit it declares. Filled by the proxies themselves.
#: ``host:port`` of a proxy of the tests that relays CONNECTs -> the exit it declares. Filled by the proxies themselves.
_DECLARED_EXITS: Dict[str, str] = {}
#: The questions of the exit that reached a forwarding proxy and were refused there: one sentence each, until a test reads them.
_WORLD_QUESTIONS: List[str] = []
@@ -103,7 +116,7 @@ def _endpoint(server: str) -> str:
def declare_exit(server: str, exit_ip: str) -> None:
"""The proxy at ``server`` forwards for real and says its exit is ``exit_ip``."""
"""The proxy at ``server`` relays CONNECTs and says its exit is ``exit_ip``."""
_DECLARED_EXITS[_endpoint(server)] = exit_ip
@@ -117,10 +130,10 @@ def declared_exit_of(server: Optional[str]) -> Optional[str]:
def asks_the_world(server: str, host: str, port: int) -> bool:
"""True, and the question is recorded, when a CONNECT to ``host:port`` is the question of the exit: the proxy must refuse it, not forward it."""
"""True, and the question is recorded, when a CONNECT to ``host:port`` is the question of the exit: the proxy must refuse it (the lab answers it with the declared exit)."""
if host.lower() not in EXIT_SERVICES:
return False
_WORLD_QUESTIONS.append("%s was asked %s:%d: the question of the exit reached a proxy that would have forwarded it to the internet" % (
_WORLD_QUESTIONS.append("%s was asked %s:%d: the question of the exit reached a proxy of the lab, which refuses it (its exit is declared, not asked of the internet)" % (
server, host, port))
return True
@@ -149,6 +162,148 @@ def _recv_exact(s: socket.socket, n: int) -> bytes:
return data
# ----------------------------------------------------------------------------------------------------------------
# The lab. A gateway of the tests forwards nothing that is not the lab's: the destination is refused and recorded.
# ----------------------------------------------------------------------------------------------------------------
#: The networks that are the lab's whatever the host: loopback, and the documentation ranges (RFC 5737 TEST-NET-1/2/3, RFC 3849) that the tests use
#: for their exits and their servers (nothing routes them: a test holds the ones a server stands at on ``lo``).
LAB_NETWORKS = tuple(ipaddress.ip_network(net) for net in (
"127.0.0.0/8", "::1/128", "192.0.2.0/24", "198.51.100.0/24", "203.0.113.0/24", "2001:db8::/32"))
#: The folder under ``$RUNNER_TEMP`` the e2e workflows upload (``invpw-evidence-*``).
EVIDENCE_FOLDER = "invpw-evidence"
def _own_interfaces() -> Dict[str, List[str]]:
"""The addresses assigned to each interface of this host (a server of a test stands at one of them), by interface name. It RAISES when they
cannot be listed (``_witness.HostInterfacesUnreadable``, or the ImportError of ``_witness``): never an empty list in place of an unreadable one."""
from _witness import read_host_interfaces
return read_host_interfaces()
def _own_addresses() -> Set[str]:
"""Every address of :func:`_own_interfaces` (raises as it does)."""
return {address for addresses in _own_interfaces().values() for address in addresses}
def _how_own_interfaces_are_read() -> str:
from _witness import how_host_interfaces_are_read
return how_host_interfaces_are_read()
def lab_refusal(host: str) -> Optional[str]:
"""None when ``host`` (an address, or a name as a SOCKS5 client sent it) is the lab's: loopback, a documentation range, an address of one of this host's
own interfaces, or ``localhost``; otherwise WHY it is not, one sentence. Any other NAME is not the lab's: nothing here resolves a name for the internet's
sake, and the question would leave the machine. The interfaces are read (:func:`_own_addresses`) only for an address outside loopback and the
documentation ranges, and a reading that fails raises."""
text = host.strip().strip("[]").split("%", 1)[0].rstrip(".").lower()
try:
address = ipaddress.ip_address(text)
except ValueError:
if text == "localhost" or text.endswith(".localhost"):
return None
return "a name that is not localhost: a gateway of the tests resolves no name, the question would leave the machine"
mapped = getattr(address, "ipv4_mapped", None)
if mapped is not None:
address = mapped
if any(address in network for network in LAB_NETWORKS):
return None
own = _own_addresses()
if address.compressed in own:
return None
return ("%s is not loopback, not in a documentation range and not one of the %d addresses of this host's interfaces read at the decision"
% (address.compressed, len(own)))
def is_lab_destination(host: str) -> bool:
"""Whether ``host`` is the lab's (:func:`lab_refusal` has no reason to refuse it)."""
return lab_refusal(host) is None
class LabGuard:
"""What refuses a destination that is not the lab's and writes it down: one per gateway.
:meth:`admits` is asked with the destination as RECEIVED (``atyp`` is the SOCKS5 address type: 1 IPv4, 3 a name, 4 IPv6; ``protocol`` is ``"tcp"`` or
``"udp"``); ``target`` is where it would really go, as (host, port), when that is not the destination itself (a name a gateway maps to a local server): the lab's
decision is about the target. A refusal is recorded in :attr:`records` as a dict with ``t`` (seconds since ``t0``, the start of the gateway), ``atyp``,
``destination`` (as received), ``port``, ``protocol`` and ``reason`` (the rule that refused it). :meth:`write_evidence` leaves them, always, under
``$RUNNER_TEMP/invpw-evidence/<name>/``, with the interfaces of this host as the guard read them when it was made (:attr:`host_interfaces`) and how.
The interfaces are read when the guard is made: a reading that fails raises there (the gateway is not made). A reading at a decision that fails refuses
the destination with that failure as its reason, is listed in :attr:`read_errors`, and :meth:`write_evidence` (the close of the gateway) raises it."""
def __init__(self, name: str, t0: Optional[float] = None):
self.name = name
self.t0 = time.monotonic() if t0 is None else t0
#: Every refusal, in order.
self.records: List[dict] = []
#: The addresses of each interface of this host, read when the guard was made (raises if they cannot be read), and how they were read.
self.host_interfaces: Dict[str, List[str]] = _own_interfaces()
self.host_interfaces_read_by = _how_own_interfaces_are_read()
#: Every reading of the interfaces at a decision that failed (the destination was refused with it as the reason).
self.read_errors: List[str] = []
self._lock = threading.Lock()
self._written = False
def admits(self, host: str, port: int, atyp: int, protocol: str, target: Optional[Tuple[str, int]] = None) -> bool:
try:
reason = lab_refusal(host if target is None else target[0])
except Exception as exc: # the interfaces could not be read at the decision: refused, said, and raised at the close
error = "the interfaces of this host could not be read at the decision: %s: %s" % (type(exc).__name__, exc)
with self._lock:
self.read_errors.append(error)
self.refuse(host, port, atyp, protocol, reason=error)
return False
if reason is None:
return True
if target is not None and (target[0], target[1]) != (host, port):
reason = "mapped to %s:%d, and %s" % (target[0], target[1], reason)
self.refuse(host, port, atyp, protocol, reason=reason)
return False
def refuse(self, host: str, port: int, atyp: int, protocol: str, *, reason: str) -> None:
"""Write down a destination that was refused (by this guard's rule, or by the narrower rule of a subclass), with the ``reason``: which rule, one sentence."""
record = {"t": round(time.monotonic() - self.t0, 3), "atyp": atyp, "destination": host, "port": port, "protocol": protocol,
"reason": reason}
with self._lock:
self.records.append(record)
def refused(self, protocol: Optional[str] = None) -> List[Tuple[str, int]]:
"""Every refused destination as (destination as received, port), in order; of one protocol when asked."""
with self._lock:
return [(r["destination"], r["port"]) for r in self.records if protocol is None or r["protocol"] == protocol]
def evidence(self, extra: Optional[dict] = None) -> dict:
"""The record as it is written: the refusals, the interfaces of this host as read when the guard was made and how, the failed readings."""
with self._lock:
records, errors = list(self.records), list(self.read_errors)
return dict({"gateway": self.name, "refused": records,
"host_interfaces": {"read_by": self.host_interfaces_read_by, "read_at": "when the gateway was made",
"interfaces": self.host_interfaces},
"host_interfaces_read_errors": errors}, **(extra or {}))
def write_evidence(self, extra: Optional[dict] = None) -> Optional[pathlib.Path]:
"""Write the record, once (a gateway may be closed twice): the file written, or None off a runner (no ``$RUNNER_TEMP``) or when already written.
Then, the first time, it RAISES if a reading of the interfaces failed at a decision (:attr:`read_errors`), on a runner or not."""
runner_temp = os.environ.get("RUNNER_TEMP")
with self._lock:
if self._written:
return None
self._written = True
path = None
if runner_temp:
folder = pathlib.Path(runner_temp) / EVIDENCE_FOLDER / self.name / ("%d-%d" % (os.getpid(), int(time.time() * 1000)))
folder.mkdir(parents=True, exist_ok=True)
path = folder / "refused-destinations.json"
path.write_text(json.dumps(self.evidence(extra), indent=2), encoding="utf-8")
if self.read_errors:
from _witness import HostInterfacesUnreadable
raise HostInterfacesUnreadable("gateway %s: %s" % (self.name, "; ".join(self.read_errors)))
return path
class FakeStun:
"""A UDP STUN server that answers every binding request with ``mapped_ip``."""
@@ -215,10 +370,12 @@ class FakeStun:
class Gateway:
"""A SOCKS5 server. ``udp`` is ``"relay"`` or ``"refuse"`` (reply code 7)."""
#: Whether a CONNECT that is not special is forwarded for real, past loopback: such a gateway declares ``tcp_exit`` as its exit
#: Whether this gateway relays the CONNECTs that are not special (to the lab: it is hermetic): such a gateway declares ``tcp_exit`` as its exit
#: (``declare_exit``). A subclass that refuses everything but loopback (``tests/_doh_servers.DohGateway``) sets False: it cannot carry the
#: question of the exit anywhere, and the question is left to what answers it.
forwards_for_real = True
#: The name of the folder of the record of what this gateway refused under ``$RUNNER_TEMP/invpw-evidence/`` (a subclass may name its own).
evidence_name = "socks5-gateway"
def __init__(self, *, udp: str, tcp_exit: str, udp_exit: str,
user: Optional[str] = None, password: Optional[str] = None,
@@ -269,6 +426,9 @@ class Gateway:
self.associates = 0
#: When the gateway started: the origin of the times below.
self.t0 = time.monotonic()
#: What refuses (and records, and writes under ``$RUNNER_TEMP/invpw-evidence/<evidence_name>/`` when the gateway is closed) every destination that is
#: not the lab's, CONNECT or datagram: ``guard.records``, ``guard.refused()``.
self.guard = LabGuard(self.evidence_name, self.t0)
#: The same instant on the wall clock (seconds since the epoch), to compare with what a page reads from Date.now().
self.wall0 = time.time()
#: Every TCP connection the gateway accepted (a SOCKS handshake starts with one), as seconds from t0.
@@ -287,8 +447,8 @@ class Gateway:
self.exit_ports: List[int] = []
#: A datagram the relay could not send (a socket that raised): said here and in the report of a test, never mute.
self.send_errors: List[str] = []
#: The hosts the relay forwards a datagram to (the fake STUN server aside); None: any host. A test that sends from an
#: address of this host keeps its lab closed: the browser's own background QUIC does not leave the machine.
#: The hosts the relay forwards a datagram to (the fake STUN server aside), among the lab's; None: any host of the lab. It only narrows: a host
#: that is not the lab's is never forwarded (``guard``).
self.forward_only_to: Optional[Set[str]] = None
self._listener = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self._listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@@ -330,6 +490,11 @@ class Gateway:
except OSError:
pass
self.stun.close()
self.guard.write_evidence(self._evidence())
def _evidence(self) -> dict:
"""What a subclass adds to the record of the refusals written at the close (a dict of JSON values)."""
return {}
def __enter__(self) -> "Gateway":
return self
@@ -397,9 +562,10 @@ class Gateway:
self._send(c, b"\x01\x00")
return True
@staticmethod
def _read_address(c: socket.socket) -> Tuple[str, int]:
def _read_address(self, c: socket.socket) -> Tuple[str, int]:
"""The destination of a request, as received (the NAME for address type 3); its address type is left in ``self._local.atyp``."""
atyp = _recv_exact(c, 1)[0]
self._local.atyp = atyp
if atyp == 1:
host = socket.inet_ntoa(_recv_exact(c, 4))
elif atyp == 3:
@@ -442,6 +608,12 @@ class Gateway:
"""Where a CONNECT that is not a special one really goes. A subclass maps a name to a local server."""
return host, port
def _admits(self, host: str, port: int, atyp: int, protocol: str, target: Optional[Tuple[str, int]] = None) -> bool:
"""Whether the gateway carries a CONNECT (``protocol`` ``"tcp"``) or a datagram (``"udp"``) to ``host``:``port`` (as received; ``atyp`` is its SOCKS5
address type), or to ``target`` (host, port) when it is mapped elsewhere: only the lab's, and the rest is refused and recorded (``guard``). A subclass may narrow
it (never widen it: call this one first)."""
return self.guard.admits(host, port, atyp, protocol, target)
def _open_upstream(self, target: Tuple[str, int]) -> socket.socket:
"""The TCP connection of a CONNECT: from ``exit_host`` when ``tcp_from_exit``, else from wherever the system chooses."""
if not self.tcp_from_exit:
@@ -478,8 +650,12 @@ class Gateway:
if self.forwards_for_real and asks_the_world(self.server, host, port):
self._send(c, self._reply(2)) # not allowed: the exit of this gateway is declared, it is not asked of the internet
return
target = self._target(host, port)
if not self._admits(host, port, getattr(self._local, "atyp", 3), "tcp", target):
self._send(c, self._reply(2)) # not allowed: the gateway carries nothing outside the lab
return
try:
up = self._open_upstream(self._target(host, port))
up = self._open_upstream(target)
except OSError:
self._send(c, self._reply(5))
return
@@ -536,13 +712,15 @@ class Gateway:
``target`` is the real address the datagram is sent to from the exit socket (``out_port`` is that socket's port);
``reported_as`` is the address the client is told the reply came from (None: the real source). A subclass may also
answer by itself with ``answer(host, port, data)``. By default the fake STUN server, by name or by number, is
mapped and everything else is forwarded for real."""
mapped and everything else is forwarded when it is the lab's (``_admits``); a datagram to any other destination is dropped and recorded."""
if (host, dport) in ((STUN_NAME, STUN_PORT), (STUN_NUMBER, STUN_PORT), (MEASURE_NUMBER, STUN_PORT)):
if not self.stun_answers:
return None
# A real server answers from the address it was asked at; the fake STUN server is mapped, so its reply is
# reported as from the asked address (only when that was a literal: a name has no address to report).
return self.stun.address, ((host, dport) if atyp == 1 else None)
if not self._admits(host, dport, atyp, "udp"):
return None # not the lab's: dropped, and recorded
if self.forward_only_to is not None and host not in self.forward_only_to:
return None
return (host, dport), None
@@ -685,12 +863,15 @@ def silent_udp(*, exit_ip: str = EXIT, user: Optional[str] = None, password: Opt
# A tiny TCP-only SOCKS5 server for the e2e tests (the fixture `socks5_tcp_only` of conftest.py makes one).
# ----------------------------------------------------------------------------------------------------------------
class Socks5TcpOnly:
"""Minimal SOCKS5: no-auth, CONNECT (TCP) relayed, UDP ASSOCIATE refused.
"""Minimal SOCKS5: no-auth, CONNECT (TCP) relayed to the lab, UDP ASSOCIATE refused.
Reproduces a residential TCP-only proxy: pages load over TCP, but WebRTC's
UDP path is dead - which (for a no-camera page in default_address_only mode)
is exactly what made the default-route probe fail and ICE return zero
candidates before Fix C.
Hermetic like :class:`Gateway`: a CONNECT to a destination that is not the lab's (:func:`is_lab_destination`) is refused with reply 2 and
recorded in :attr:`guard` (written under ``$RUNNER_TEMP/invpw-evidence/socks5-tcp-only/`` when the server is closed).
"""
def __init__(self, exit_ip: Optional[str] = None):
@@ -699,10 +880,12 @@ class Socks5TcpOnly:
self._srv.bind(("127.0.0.1", 0))
self._srv.listen(16)
self.port = self._srv.getsockname()[1]
#: It relays a CONNECT for real, so it declares its exit (what a launch behind it is told: the lab's, unless a test gives another).
#: It relays a CONNECT (to the lab), so it declares its exit (what a launch behind it is told: the lab's, unless a test gives another).
self.exit_ip = exit_ip or _lab_exit()
declare_exit(self.server, self.exit_ip)
self.udp_associate_attempts = 0
#: What refuses (and records) every CONNECT that is not the lab's.
self.guard = LabGuard("socks5-tcp-only")
self._stop = False
self._t = threading.Thread(target=self._serve, daemon=True)
self._t.start()
@@ -762,6 +945,10 @@ class Socks5TcpOnly:
conn.sendall(b"\x05\x02\x00\x01\x00\x00\x00\x00\x00\x00") # not allowed: the exit is declared, not asked of the internet
conn.close()
return
if not self.guard.admits(addr, port, atyp, "tcp"):
conn.sendall(b"\x05\x02\x00\x01\x00\x00\x00\x00\x00\x00") # not allowed: nothing outside the lab is carried
conn.close()
return
try:
upstream = socket.create_connection((addr, port), timeout=30)
except OSError:
@@ -801,3 +988,4 @@ class Socks5TcpOnly:
self._srv.close()
except Exception:
pass
self.guard.write_evidence()
+173
View File
@@ -0,0 +1,173 @@
"""The strace stand-in of the Linux font tests: the engine's directory as links, whose executable runs the real one under ``strace`` in the
engine's place (same pid, same process group), and what reads its log (who is the parent and who a content process) and cleans its group.
Used by tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py. No test of its own, no browser."""
from __future__ import annotations
import os
import re
import shutil
import signal
import stat
import subprocess
import time
from pathlib import Path
import pytest
_SYSCALLS = ("execve,clone,clone3,fork,vfork,open,openat,stat,lstat,"
"newfstatat,statx,access,faccessat,faccessat2,readlink")
def _strace_options() -> str:
"""strace's own flags: quiet, follow forks, and die with the traced process
when this build knows --kill-on-exit."""
help_text = subprocess.run([shutil.which("strace"), "-h"], capture_output=True,
text=True).stdout
return "-f -qq -s 4096" + (" --kill-on-exit" if "--kill-on-exit" in help_text else "")
def _require_strace_can_trace(tmp: Path) -> None:
"""strace needs ptrace: a container or yama can refuse it, and then the
failure is the environment's, said as such, not the launch's."""
probe = subprocess.run([shutil.which("strace"), "-o", str(tmp / "probe.log"), "true"],
capture_output=True, text=True)
if probe.returncode != 0:
pytest.fail("strace cannot trace here: %s" % (probe.stderr.strip() or probe.returncode),
pytrace=False)
def _stand_in(binary: str, tree: Path, log: Path, pidfile: Path, syscalls: str = _SYSCALLS,
timestamps: bool = False) -> str:
"""A copy of the engine's directory made of links, whose executable runs
the real one under strace, in the engine's place.
The script writes its pid and execs strace: the pid stays, and so does the
process group its launcher gave it. The core spawns the engine as the
leader of a process group of its own (``posix_spawn`` with ``setpgroup=0``,
as Playwright's launcher does with ``detached: true``), so that group holds
strace and everything it traces, and ``_kill_group`` kills the group of the
pid (``os.getpgid``). The script used to exec ``setsid``: setsid(1) forks
when its caller leads a process group, its parent exited 0 at once, and the
core saw the engine exit during startup (candidate 44161687675).
``syscalls`` is what strace traces; ``timestamps`` adds ``-ttt`` (the epoch
seconds after each pid), which ``_LINE`` does not read: a caller that asks
for them strips them first (``test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e``)."""
real = Path(os.path.realpath(binary))
tree.mkdir()
for entry in real.parent.iterdir():
if entry.name != real.name:
(tree / entry.name).symlink_to(entry)
script = tree / real.name
script.write_text(
"#!/bin/sh\n"
"echo $$ > %s\n"
'exec %s %s -o %s -e trace=%s %s "$@"\n'
% (pidfile, shutil.which("strace"), _strace_options() + (" -ttt" if timestamps else ""), log, syscalls, real))
script.chmod(script.stat().st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
return str(script)
_LINE = re.compile(r"^(\d+)\s+(\w+)\((.*)$")
# strace -f splits a call that another thread interrupts in two lines:
# "PID clone3({...} <unfinished ...>" and "PID <... clone3 resumed>) = CHILD".
_RESUMED = re.compile(r"^(\d+)\s+<\.\.\. (\w+) resumed>(.*)$")
_RESULT = re.compile(r"=\s+(\d+)\s*$")
def _roles(lines: list, real_binary: str):
"""``(role, argv_of)`` for a strace log read as lines: ``role(pid)`` is ``"parent"``, ``"content"`` or ``"other"`` (walking up the
clones to the process that executed the engine), ``argv_of`` maps a pid to the arguments of the last execve of the engine it made."""
parent_of = {}
argv_of = {}
for line in lines:
m = _LINE.match(line) or _RESUMED.match(line)
if not m:
continue
pid, call, rest = int(m.group(1)), m.group(2), m.group(3)
if call in ("clone", "clone3", "fork", "vfork"):
r = _RESULT.search(rest)
if r:
parent_of[int(r.group(1))] = pid
elif call == "execve" and real_binary in rest:
# The arguments are on the first line even when the result comes
# on a resumed one; the last execve of a process is what it runs.
argv_of[pid] = rest
def role(pid: int) -> str:
seen = set()
while pid not in seen:
seen.add(pid)
argv = argv_of.get(pid)
if argv is not None and real_binary in argv:
return "content" if "-contentproc" in argv else "parent"
if pid not in parent_of:
break
pid = parent_of[pid]
return "other"
return role, argv_of
def _group_of(pidfile: Path):
"""The process group of the stand-in, read from its living pid (``os.getpgid``); None when it is gone or wrote no pid."""
try:
return os.getpgid(int(pidfile.read_text().strip()))
except (OSError, ValueError):
return None
def _kill_group(pidfile: Path):
"""Kill the stand-in's process group: strace, the browser and its children. Returns the group killed, or None.
Looking for the stand-in's path in the command lines found nothing (strace
and its children carry the real binary's path), so the group is the handle:
the group of the stand-in's pid, not the pid taken as a group id. Never the
group of this test: a stand-in started inside it is killed alone."""
pgid = _group_of(pidfile)
if pgid is None:
return None
if pgid == os.getpgrp():
try:
os.kill(int(pidfile.read_text().strip()), signal.SIGKILL)
except (OSError, ValueError):
pass
return None
try:
os.killpg(pgid, signal.SIGKILL)
except OSError:
pass
return pgid
def _detached(argv: list, **kwargs) -> subprocess.Popen:
"""A process started as the core starts the engine: the leader of a process group of its own (``posix_spawn`` with
``setpgroup=0`` in ``invisible_core.juggler.connection._spawn_posix``)."""
return subprocess.Popen(argv, process_group=0, **kwargs)
def _group_members(pgid: int) -> list:
"""Pids still in the process group ``pgid``."""
members = []
for pid in os.listdir("/proc"):
if not pid.isdigit():
continue
try:
stat_line = Path("/proc/%s/stat" % pid).read_text()
except OSError:
continue
fields = stat_line.rsplit(")", 1)[1].split()
# fields: state ppid pgrp ...; a zombie is already dead.
if fields[0] != "Z" and int(fields[2]) == pgid:
members.append(int(pid))
return members
def _wait_for_exit(pgid: int, seconds: float = 30.0) -> list:
end = time.monotonic() + seconds
left = _group_members(pgid)
while left and time.monotonic() < end:
time.sleep(0.1)
left = _group_members(pgid)
return left
+99
View File
@@ -0,0 +1,99 @@
"""What the window e2e tests share: a headed session of the product, and a wait on a condition of a page.
The sessions are HEADED on purpose. ``headless=True`` gives every session a display of its own (a fresh Xvfb on Linux, a fresh Win32 desktop on
Windows), so two of them never see each other; the focus and occlusion tests need two windows on ONE display, which is what two headed sessions of the
same run have (the Linux e2e runs under ``xvfb-run``). Both sessions use the same seed, so both windows are the same declared window and the second one
covers the first completely.
The first session is the one of the test's own thread; the second one lives in a thread of its own (``in_a_thread_of_its_own``, the pattern of
``test_popups_reach_the_client_e2e.py``): an open sync client keeps its asyncio loop marked as running in the thread that started it, and a second sync client
refuses to start there ("It looks like you are using Playwright Sync API inside the asyncio loop"). A sync client's objects belong to the thread that made
them, so everything the test does with the second session is handed to that thread (``run``).
"""
from __future__ import annotations
import contextlib
import queue
import threading
from typing import Any, Callable, Dict, Iterator, Optional
from _waits import Watch, watch
#: The seed only has to give two sessions the same window.
SEED = 21
#: The deadline of a wait for something that must happen, in seconds.
DEADLINE_S = 30
def launch(firefox_binary: str, *, extra_prefs: Optional[Dict[str, Any]] = None, pin: Optional[Dict[str, Any]] = None, headless: bool = False):
"""A session of the product (RFP off, the engine declared as the core launches it); ``extra_prefs`` and ``pin`` only where a test needs them."""
from invisible_playwright import InvisiblePlaywright
return InvisiblePlaywright(seed=SEED, binary_path=firefox_binary, headless=headless, locale="en-US", timezone="America/New_York",
extra_prefs=extra_prefs, pin=pin)
def wait_for_condition(page, sample: Callable[[], Any], done: Callable[[Any], Any], what: str, seconds: float = DEADLINE_S) -> Watch:
"""Until ``done(sample())``, reading the page between two looks. Red after ``seconds`` with what was seen on the way."""
result = watch(sample, done, seconds, lambda: page.wait_for_timeout(100))
assert result.ok, "%s; seen: %s" % (what, result.render())
return result
class SecondSession:
"""A session that lives in a thread of its own: ``run(fn)`` calls ``fn(session)`` in that thread and gives back its result or raises its error."""
def __init__(self) -> None:
self._jobs: "queue.Queue[Optional[tuple]]" = queue.Queue()
def run(self, fn: Callable[[Any], Any]) -> Any:
box: Dict[str, Any] = {}
done = threading.Event()
self._jobs.put((fn, box, done))
assert done.wait(300), "the second session did not answer within 300 s"
if "error" in box:
raise box["error"]
return box.get("value")
@contextlib.contextmanager
def in_a_thread_of_its_own(firefox_binary: str, *, extra_prefs: Optional[Dict[str, Any]] = None) -> Iterator[SecondSession]:
"""A second headed session on the same display, started and closed in a thread with no asyncio loop; the test keeps the first one in its own thread."""
handle = SecondSession()
up = threading.Event()
failure: Dict[str, BaseException] = {}
def serve() -> None:
try:
with launch(firefox_binary, extra_prefs=extra_prefs) as session:
up.set()
while True:
job = handle._jobs.get()
if job is None:
return
fn, box, done = job
try:
box["value"] = fn(session)
except BaseException as exc: # handed back to the test's thread by ``run``
box["error"] = exc
finally:
done.set()
except BaseException as exc: # the launch or the close of the session
failure["error"] = exc
finally:
up.set()
worker = threading.Thread(target=serve, name="second-session", daemon=True)
worker.start()
assert up.wait(300), "the second session did not start within 300 s"
if "error" in failure:
raise failure["error"]
try:
yield handle
finally:
handle._jobs.put(None)
worker.join(120)
assert not worker.is_alive(), "the second session did not close within 120 s"
if "error" in failure:
raise failure["error"]
+119 -3
View File
@@ -6,17 +6,22 @@ browser can reach directly (a documentation address held on ``lo``, see ``_turn_
source that is not the exit of the proxy, and a test can tell a leak from a drop. It answers a STUN Binding Request with the source it
saw, so a road that works also gives the page a server-reflexive candidate.
``udp`` is every datagram as (source ip, source port, length); ``tcp`` is every connection as (source ip, source port).
``udp`` is every datagram as (source ip, source port, length); ``tcp`` is every connection as (source ip, source port), both of a source that
is an address of THIS host. The browser runs on this host, so a direct send of it comes from an address of this host; a source that is not
one (a runner's address is reachable from the internet, and noise arrives) cannot be the browser. Those arrivals are written down apart,
in ``foreign_udp`` and ``foreign_tcp``, and are never answered. ``heard()`` and ``heard_from_other_than()`` speak of the host's only.
"""
from __future__ import annotations
import ipaddress
import socket
import sys
import struct
import threading
from typing import Dict, Iterable, List, Tuple
from typing import Dict, Iterable, List, Set, Tuple
_MAGIC = b"\x21\x12\xa4\x42"
_IP_FAMILIES = (socket.AF_INET, socket.AF_INET6)
#: How many port numbers the witness tries before it gives up, and where it draws them from after the system's own pick: the sequence of
#: tests/_ports.py, which the HTTP/3 server and the resolver trap walk too. Below the start of Windows' dynamic range (49152), where its excluded
@@ -25,11 +30,92 @@ _MAGIC = b"\x21\x12\xa4\x42"
from _ports import DRAW_FROM, TRIES, candidates # noqa: E402
def _normal(ip: str) -> str:
"""``ip`` as the one spelling a set compares on (an IPv4-mapped IPv6 address is its IPv4 address; a zone id is dropped)."""
try:
parsed = ipaddress.ip_address(ip.split("%")[0])
except ValueError:
return ip
mapped = getattr(parsed, "ipv4_mapped", None)
return (mapped or parsed).compressed
class HostInterfacesUnreadable(RuntimeError):
"""The interfaces of this host could not be listed. Whatever decides by them (is a source the browser's? is a destination the lab's?) must fail
with this, never decide on an empty list in its place."""
def how_host_interfaces_are_read() -> str:
"""How :func:`read_host_interfaces` lists the interfaces, said in the record of a reader (the version of ``psutil`` included)."""
try:
import psutil
version = psutil.__version__
except Exception as exc: # the reading itself raises it, with its cause: here it is only said
version = "not importable: %s: %s" % (type(exc).__name__, exc)
return "psutil.net_if_addrs() (psutil %s): the AF_INET and AF_INET6 entries of every interface, normalised (zone id dropped, " \
"IPv4-mapped read as IPv4, lower case)" % version
def read_host_interfaces() -> Dict[str, List[str]]:
"""Every IPv4 and IPv6 address assigned to an interface of this machine (loopback and link-local included), normalised, by interface name.
``psutil`` is a dependency of the package and answers the same on Linux and on Windows.
Raises :class:`HostInterfacesUnreadable` when the list cannot be read: ``psutil`` does not import, ``net_if_addrs()`` raises, an entry of an IP
family is not an address, or no interface has any IP address at all (every host has loopback: an empty list is a failed reading)."""
try:
import psutil
table = psutil.net_if_addrs()
except Exception as exc:
raise HostInterfacesUnreadable("the interfaces of this host could not be read (%s): %s: %s"
% (how_host_interfaces_are_read(), type(exc).__name__, exc)) from exc
interfaces: Dict[str, List[str]] = {}
for name, entries in table.items():
for entry in entries:
if entry.family not in _IP_FAMILIES:
continue
normal = _normal(entry.address)
try:
ipaddress.ip_address(normal)
except ValueError:
raise HostInterfacesUnreadable("interface %r lists %r as an address of family %s, and it is not one"
% (name, entry.address, entry.family)) from None
listed = interfaces.setdefault(name, [])
if normal not in listed:
listed.append(normal)
if not interfaces:
raise HostInterfacesUnreadable("psutil.net_if_addrs() listed no IPv4 or IPv6 address on any interface (not even loopback): %r"
% sorted(table))
return interfaces
def host_addresses() -> Set[str]:
"""Every address of :func:`read_host_interfaces`, of every interface (raises :class:`HostInterfacesUnreadable` as it does)."""
return {address for addresses in read_host_interfaces().values() for address in addresses}
def is_host_source(ip: str, known: Set[str]) -> bool:
"""Whether a source ip is an address of this host: any 127.0.0.0/8, ::1, or one of ``known`` (the host's addresses)."""
ip = _normal(ip)
try:
if ipaddress.ip_address(ip).is_loopback:
return True
except ValueError:
return False
return ip in known
class Witness:
def __init__(self, address: str, port: int = 0) -> None:
self.address = address
self.udp: List[Tuple[str, int, int]] = []
self.tcp: List[Tuple[str, int]] = []
self.foreign_udp: List[Tuple[str, int, int]] = []
self.foreign_tcp: List[Tuple[str, int]] = []
#: Every failed reading of the interfaces after the start (the first one raises here): :meth:`heard` raises while any is listed.
self.read_errors: List[str] = []
self._host: Set[str] = host_addresses() | {_normal(address)}
self._lock = threading.Lock()
self._closed = False
# One port number for both, TCP and UDP. Each try binds TCP and then UDP on the same number; if either is refused, both
@@ -71,9 +157,35 @@ class Witness:
# --- what a test reads ------------------------------------------------------------------------------------------
def heard(self) -> Dict[str, list]:
self._raise_if_unread()
with self._lock:
return {"udp": list(self.udp), "tcp": list(self.tcp)}
def heard_foreign(self) -> Dict[str, list]:
"""What reached the witness from a source that is NOT an address of this host: not the browser, noise from the network."""
self._raise_if_unread()
with self._lock:
return {"udp": list(self.foreign_udp), "tcp": list(self.foreign_tcp)}
def _is_host(self, ip: str) -> bool:
"""Whether ``ip`` is an address of this host; a miss looks at the interfaces again (an address added since) before it is foreign. A reading
that fails is never a silent "foreign": the arrival is kept as the host's (a direct send is not hidden) and every reader of the witness raises."""
if is_host_source(ip, self._host):
return True
try:
self._host |= host_addresses()
except HostInterfacesUnreadable as exc:
with self._lock:
self.read_errors.append(str(exc))
return True
return is_host_source(ip, self._host)
def _raise_if_unread(self) -> None:
with self._lock:
errors = list(self.read_errors)
if errors:
raise HostInterfacesUnreadable("the witness could not read the interfaces of this host again: %s" % "; ".join(errors))
def heard_from_other_than(self, allowed: Iterable[str]) -> Dict[str, list]:
"""What the witness heard from a source that is not one of ``allowed`` (the exit of the proxy): a direct send."""
ok = set(allowed)
@@ -107,6 +219,10 @@ class Witness:
continue
except OSError:
return
if not self._is_host(peer[0]):
with self._lock:
self.foreign_udp.append((peer[0], peer[1], len(data)))
continue
with self._lock:
self.udp.append((peer[0], peer[1], len(data)))
if len(data) >= 20 and data[0:2] == b"\x00\x01" and data[4:8] == _MAGIC:
@@ -125,7 +241,7 @@ class Witness:
except OSError:
return
with self._lock:
self.tcp.append((peer[0], peer[1]))
(self.tcp if self._is_host(peer[0]) else self.foreign_tcp).append((peer[0], peer[1]))
try:
conn.close()
except OSError:
+22 -7
View File
@@ -71,6 +71,10 @@ def _watchdog_open():
def pytest_configure(config):
# TEMPORARY, with tests/_crash_cores.py (the -11 at the exit of the security state's generate): on Linux every engine of the run, the core's launches
# included, inherits a core limit equal to the hard one, so a crash leaves a core in $INVPW_CORE_DIR (kernel.core_pattern on the e2e jobs).
import _crash_cores
_crash_cores.lift_the_core_limit_of_the_session()
# The run stops at the first refusal of the engine (tests/engine_refusal.py).
from engine_refusal import StopAtTheFirstRefusal
config.pluginmanager.register(StopAtTheFirstRefusal(config), "engine-refusal-stop")
@@ -96,6 +100,16 @@ def pytest_runtest_teardown(item, nextitem):
faulthandler.cancel_dump_traceback_later()
@pytest.hookimpl(wrapper=True)
def pytest_runtest_makereport(item, call):
"""TEMPORARY, with tests/_crash_cores.py: after a phase that failed, gdb's text of every core in $INVPW_CORE_DIR is saved in the evidence and the core deleted;
the cores left after a test that passed are deleted and listed."""
report = yield
import _crash_cores
_crash_cores.after_the_report(item.nodeid, report.when, report.failed)
return report
def pytest_collection_modifyitems(config, items):
"""The e2e tests of the post-publication files (``tests/_post_publication.py``: pip, uv, PyPI, GitHub) belong to the round after a publication: a run
that does not NAME their file does not run them. ``user-install.yml`` names both files; ``scripts/run_e2e.py`` and every PR or candidate leg do not."""
@@ -172,19 +186,20 @@ def _what_the_core_declares_for_a_proxy_is_recorded(monkeypatch):
@pytest.fixture(autouse=True)
def _a_unit_test_asks_mozilla_for_no_intermediates_list(request, monkeypatch):
"""Outside the e2e, a launch declares no intermediates list.
def _a_unit_test_asks_mozilla_for_no_security_state(request, monkeypatch):
"""Outside the e2e, a launch asks Mozilla for nothing and runs no generation.
The core's `write_user_js` (every launch the server makes) declares Mozilla's list: on a cold cache it downloads it in line, and the line it writes would
differ with the cache of whoever runs the test. The function is stubbed, as the core's own suite does (tests/conftest.py of invisible-core): no list, no
request. The tests of `fetch` set their own; a test marked `e2e` gets the real one (the CI legs point it at the empty file of `ci/intermediates.json`)."""
The core's `write_user_js` (every launch the server makes) places the security state in the profile: on a cold cache it downloads Mozilla's collections in line and
has the engine generate the state from them, and what it copies would differ with the cache of whoever runs the test. The function the launch calls
(`ensure_security_state`) is stubbed, as the core's own suite does (tests/conftest.py of invisible-core): nothing ready, no request, no engine. The tests of `fetch`
set their own; a test marked `e2e` gets the real one (the CI legs point STEALTHFOX_SECURITY_STATE at the ready directory of `ci/security-state/`)."""
if request.node.get_closest_marker("e2e") is not None:
return
try:
import invisible_core._intermediates as _im
import invisible_core._security_state as _ss
except Exception: # the package is absent: the tests that need it say so
return
monkeypatch.setattr(_im, "ensure_intermediates", lambda *a, **kw: None)
monkeypatch.setattr(_ss, "ensure_security_state", lambda *a, **kw: None)
@pytest.fixture(autouse=True)
-297
View File
@@ -1,297 +0,0 @@
"""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
@@ -1,102 +0,0 @@
<!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
@@ -1,505 +0,0 @@
{
"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
}
}
}
-161
View File
@@ -1,161 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>canvas text ref</title>
<style>
@font-face{font-family:"Arial";src:url("bundle/arial7_04.ttf") format("truetype");font-weight:400;font-style:normal}
@font-face{font-family:"Segoe UI";src:url("bundle/segoeui5_67.ttf") format("truetype");font-weight:400;font-style:normal}
@font-face{font-family:"Times New Roman";src:url("bundle/times7_11.ttf") format("truetype");font-weight:400;font-style:normal}
@font-face{font-family:"Consolas";src:url("bundle/consola7_00.ttf") format("truetype");font-weight:400;font-style:normal}
@font-face{font-family:"Calibri";src:url("bundle/calibri6_26.ttf") format("truetype");font-weight:400;font-style:normal}
@font-face{font-family:"Bahnschrift";src:url("bundle/bahnschrift2_07.ttf") format("truetype");font-weight:300 700;font-stretch:75% 100%;font-style:normal}
@font-face{font-family:"Segoe UI Variable";src:url("bundle/seguivar2_03.ttf") format("truetype");font-weight:300 700;font-style:normal}
@font-face{font-family:"Twemoji Mozilla";src:url("bundle/TwemojiMozilla.ttf") format("truetype");font-weight:400;font-style:normal}
body{margin:16px;background:#fff;color:#000;font:13px sans-serif}
</style>
</head>
<body>
<p id="status">loading fonts</p>
<script>
// Canvas 2D text reference page. Every case draws TEXT (or EMOJI) on a white canvas, reads the
// pixels back with getImageData and hashes the RGBA bytes with SHA-256. Fonts are loaded
// before anything is measured or drawn. The case ids and the drawing code are the ones retail
// Firefox 159.0 on Windows ran to write refs.json, so the hashes compare.
const FAMILIES5 = ["Arial", "Segoe UI", "Times New Roman", "Consolas", "Calibri"];
const SIZES6 = [9, 12.5, 16, 33, 72, 300];
const SIZES5 = [9, 12.5, 16, 33, 72];
const TEXT = "Hamburgefonstiv 0123";
const EMOJI = "\u{1F600}\u{1F389}\u{1F41F}";
const ROT = "rot15-scale1.5x2";
const TRANSFORMS = ["none", ROT];
const SPECS = [];
const SEEN = new Set();
function add(sp) {
sp.style = sp.style || "normal";
sp.weight = sp.weight || "normal";
sp.stretch = sp.stretch || "";
sp.op = sp.op || "fill";
sp.transform = sp.transform || "none";
sp.alpha = sp.alpha !== false;
sp.text = sp.text || TEXT;
let id = [sp.family, sp.size, sp.transform, sp.style, sp.weight, sp.op].join("|");
if (sp.stretch) id += "|stretch=" + sp.stretch;
if (!sp.alpha) id += "|alpha=false";
if (sp.text !== TEXT) id += "|text=emoji";
if (SEEN.has(id)) throw new Error("duplicate case id: " + id);
SEEN.add(id);
sp.id = id;
SPECS.push(sp);
}
// 0) base: fillText and strokeText, with and without a transform; synthetic italic and bold
// on a regular face (fillText). Default canvas (alpha: true).
for (const family of FAMILIES5) for (const size of SIZES6) for (const transform of TRANSFORMS) for (const op of ["fill", "stroke"])
add({family, size, transform, op});
for (const family of FAMILIES5) for (const size of SIZES6) for (const transform of TRANSFORMS) for (const syn of ["italic", "bold"])
add({family, size, transform, style: syn === "italic" ? "italic" : "normal", weight: syn === "bold" ? "bold" : "normal"});
// 1) getContext("2d", {alpha: false}): an opaque canvas, where LCD text is possible
for (const f of FAMILIES5) for (const s of SIZES5)
add({family: f, size: s, alpha: false});
// 2) rotate(15deg) scale(1.5, 2) on an opaque canvas. The same cases with alpha: true are in
// the base above (group 2a of the reference), so they are not drawn twice.
for (const f of FAMILIES5) for (const s of SIZES5)
add({family: f, size: s, transform: ROT, alpha: false});
// 3) COLR v0 emoji (Twemoji Mozilla), the one COLR v0 face of the bundle
for (const s of [16, 33, 72]) for (const alpha of [true, false]) for (const transform of TRANSFORMS)
add({family: "Twemoji Mozilla", size: s, transform, alpha, text: EMOJI});
// 4) past the glyph-size thresholds (255, 256, 257, 400 px; 300 px is in the base): fillText
// and strokeText, Arial and Segoe UI
for (const f of ["Arial", "Segoe UI"]) for (const s of [255, 256, 257, 400]) for (const op of ["fill", "stroke"])
add({family: f, size: s, op});
// 5) the variable face Bahnschrift: weight (300, 400, 700) by stretch (75% = condensed, 100% = normal);
// canvas has no font-variation-settings, so the axes are reached through font-weight and font-stretch
for (const w of [300, 400, 700]) for (const st of ["condensed", "normal"]) for (const s of [16, 33])
add({family: "Bahnschrift", size: s, weight: w, stretch: st});
// 6) the variable face Segoe UI Variable (wght 300-700, opsz 5-36): weight 300, 400 and 700 at four
// sizes. font-optical-sizing is auto, so opsz follows the size; the weight reaches the face
// through font-weight, as canvas has no font-variation-settings
for (const w of [300, 400, 700]) for (const s of [9, 12.5, 16, 33])
add({family: "Segoe UI Variable", size: s, weight: w});
const fontCss = sp => [sp.style, sp.weight, sp.stretch, sp.size + "px", '"' + sp.family + '"'].filter(Boolean).join(" ");
const hex = buf => [...new Uint8Array(buf)].map(b => b.toString(16).padStart(2, "0")).join("");
function measure(sp) {
const ctx = document.createElement("canvas").getContext("2d");
ctx.font = fontCss(sp);
return ctx.measureText(sp.text).width;
}
async function drawCase(sp) {
const m = measure(sp), S = sp.size;
const W = Math.ceil(1.6 * m + 3 * S) + 80;
const H = Math.ceil(4 * S + 0.42 * m) + 80;
const c = document.createElement("canvas");
c.width = W; c.height = H;
const ctx = c.getContext("2d", {alpha: sp.alpha, willReadFrequently: true});
ctx.fillStyle = "#fff"; ctx.fillRect(0, 0, W, H);
ctx.fillStyle = "#000"; ctx.strokeStyle = "#000"; ctx.lineWidth = 1;
ctx.font = fontCss(sp);
ctx.textAlign = "start"; ctx.textBaseline = "alphabetic";
const y0 = Math.ceil(2.5 * S) + 40;
let x = 40, y = y0;
if (sp.transform !== "none") {
ctx.translate(40, y0);
ctx.rotate(15 * Math.PI / 180);
ctx.scale(1.5, 2);
x = 0; y = 0;
}
if (sp.op === "stroke") ctx.strokeText(sp.text, x, y); else ctx.fillText(sp.text, x, y);
const readback = ctx.font;
let img = ctx.getImageData(0, 0, W, H);
const digest = await crypto.subtle.digest("SHA-256", img.data.buffer);
// The largest cases are 7727 x 3373 (100 MB of RGBA): release the canvas and its readback
// before the next case, so that the page never holds more than one at a time.
img = null;
c.width = 0; c.height = 0;
return {id: sp.id, family: sp.family, size: sp.size, transform: sp.transform,
style: sp.style, weight: String(sp.weight), stretch: sp.stretch || "normal", op: sp.op,
alpha: sp.alpha, text: sp.text === TEXT ? "TEXT" : "EMOJI", font_readback: readback,
width: W, height: H, measured_width: m, sha256: hex(digest)};
}
(async () => {
const st = document.getElementById("status");
try {
const LOADS = ['16px "Arial"', '16px "Segoe UI"', '16px "Times New Roman"', '16px "Consolas"',
'16px "Calibri"', '300 condensed 16px "Bahnschrift"', '300 normal 16px "Bahnschrift"',
'400 normal 16px "Bahnschrift"', '700 normal 16px "Bahnschrift"', '300 16px "Segoe UI Variable"',
'400 16px "Segoe UI Variable"', '700 16px "Segoe UI Variable"', '16px "Twemoji Mozilla"'];
window.FONTS = {};
for (const q of LOADS) {
const r = await document.fonts.load(q);
window.FONTS[q] = r.map(x => x.status);
if (!r.length || r.some(x => x.status !== "loaded")) throw new Error("font not loaded: " + q);
}
window.R = {};
for (const sp of SPECS) {
window.R[sp.id] = await drawCase(sp);
window.PROGRESS = Object.keys(window.R).length;
st.textContent = `cases: ${window.PROGRESS}/${SPECS.length}`;
}
window.CASE_COUNT = SPECS.length;
st.textContent = `done: ${SPECS.length} cases`;
window.DONE = true;
} catch (e) {
window.ERR = String(e);
st.textContent = "error: " + e;
}
})();
</script>
</body>
</html>
File diff suppressed because it is too large. Load diff
@@ -1,41 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>canvas text colours ref</title>
<style>@font-face{font-family:"Arial";src:url("bundle/arial7_04.ttf") format("truetype")}</style>
</head>
<body>
<script>
// Canvas 2D coloured text reference page. Seven colour pairs (text, background) by two sizes:
// each case fills a 420 x 160 canvas with the background, draws TEXT in the text colour with
// fillText, reads the pixels back with getImageData and hashes the RGBA bytes with SHA-256.
// The case id is "<name>|<size>". The drawing code is the one retail Firefox 159.0 on Windows
// ran to write refs.json, so the hashes compare.
const COLORS = [["black", "#000000", "#ffffff"], ["teal", "#006699", "#ffffff"],
["limealpha", "rgba(102,204,0,0.2)", "#ffffff"], ["grey", "#888888", "#ffffff"],
["white_on_black", "#ffffff", "#000000"], ["red", "#ff0000", "#ffffff"],
["white_on_blue", "#ffffff", "#0000ff"]];
const SIZES = [16, 33];
(async () => {
try {
await document.fonts.load('16px "Arial"');
window.R = {};
for (const [name, fg, bg] of COLORS) for (const S of SIZES) {
const W = 420, H = 160, c = document.createElement("canvas");
c.width = W; c.height = H;
const ctx = c.getContext("2d", {willReadFrequently: true});
ctx.fillStyle = bg; ctx.fillRect(0, 0, W, H);
ctx.fillStyle = fg; ctx.font = S + 'px "Arial"'; ctx.textBaseline = "alphabetic";
ctx.fillText("Hamburgefonstiv 0123", 20, 90);
const img = ctx.getImageData(0, 0, W, H);
const id = name + "|" + S;
const d = await crypto.subtle.digest("SHA-256", img.data.buffer);
window.R[id] = {sha256: [...new Uint8Array(d)].map(b => b.toString(16).padStart(2, "0")).join("")};
}
window.DONE = true;
} catch (e) { window.ERR = String(e); }
})();
</script>
</body>
</html>
-929
View File
@@ -1,929 +0,0 @@
{
"test_page": "index.html",
"black_page": "../canvas_text_ref/index.html",
"text": "Hamburgefonstiv 0123",
"firefox": {
"version": "159.0",
"buildid": "20261022150525",
"browser_version_capability": "159.0",
"exe_sha256": "d8b5ed82fcd9c0f159dc86dc1c4526ceae981c4d9651f21908b6de90d0a56d85",
"os": "Windows_NT",
"os_version": "10.0"
},
"canvas": {
"gfx.canvas.accelerated": false,
"pref_read_back": false
},
"cleartype": {
"FontSmoothing": "2",
"FontSmoothingType": "0x2"
},
"fonts": [
{
"family": "Arial",
"bundle_file": "arial7_04.ttf",
"sha256": "05c7da5fe195e04d76bbe4f22b7829ebc142f957066449f68d59afbb2d446b33",
"version": "Version 7.04",
"psname": "ArialMT",
"names": {
"1": "Arial",
"2": "Normal",
"4": "Arial",
"5": "Version 7.04",
"6": "ArialMT"
},
"list_entry": "f|arial7_04.ttf|0|400|400|100|100|normal|ArialMT|2048|1854|434|67|1062|1467|-217|150|530|102"
}
],
"capture": {
"date": "2026-11-09",
"origin": "retail Firefox 159.0 (build 20261022150525, firefox.exe sha256 d8b5ed82fcd9c0f159dc86dc1c4526ceae981c4d9651f21908b6de90d0a56d85) on Windows, headless, canvases read back with getImageData; bytes saved by the measuring harness: colors/retail (the 14 coloured cases) and keys/<gamma>_<contrast>/retail (39 cases per key) of the win-asset analysis of 2026-11-09",
"colors_prefs": {
"gfx.canvas.accelerated": false
},
"keys_prefs": {
"gfx.canvas.accelerated": false,
"gfx.font_rendering.cleartype_params.gamma": "<gamma>",
"gfx.font_rendering.cleartype_params.enhanced_contrast": "<contrast>",
"gfx.font_rendering.cleartype_params.cleartype_level": 100,
"gfx.font_rendering.cleartype_params.pixel_structure": 1,
"gfx.font_rendering.cleartype_params.rendering_mode": 0
}
},
"colors": {
"count": 14,
"cases": {
"black|16": {
"id": "black|16",
"name": "black",
"fg": "#000000",
"bg": "#ffffff",
"size": 16,
"width": 420,
"height": 160,
"sha256": "938b7381139ef4f5d5bd0ca3f12d58f11224981f494afa869e92a2f22d7e7181"
},
"black|33": {
"id": "black|33",
"name": "black",
"fg": "#000000",
"bg": "#ffffff",
"size": 33,
"width": 420,
"height": 160,
"sha256": "d201f011ff0da51760a7dbd6f8b1a415173b278dd861edd19f1e240273661d21"
},
"teal|16": {
"id": "teal|16",
"name": "teal",
"fg": "#006699",
"bg": "#ffffff",
"size": 16,
"width": 420,
"height": 160,
"sha256": "8746ee921e50c0b8b08d8448faaa2bdc6c71e9268621bd71c0fcf24fd5495ae7"
},
"teal|33": {
"id": "teal|33",
"name": "teal",
"fg": "#006699",
"bg": "#ffffff",
"size": 33,
"width": 420,
"height": 160,
"sha256": "2b3df9671621de69a4e8415db76825bb2e18ddd122778521a8ddbc79e899dd71"
},
"limealpha|16": {
"id": "limealpha|16",
"name": "limealpha",
"fg": "rgba(102,204,0,0.2)",
"bg": "#ffffff",
"size": 16,
"width": 420,
"height": 160,
"sha256": "2f3cac50d2b3cfdda020841414a171c06b9d42c671b1688e744ccda1587ae74e"
},
"limealpha|33": {
"id": "limealpha|33",
"name": "limealpha",
"fg": "rgba(102,204,0,0.2)",
"bg": "#ffffff",
"size": 33,
"width": 420,
"height": 160,
"sha256": "4de189802d53988a14c12696b7304b5c46c43b77478b43c5174011b547e3cd71"
},
"grey|16": {
"id": "grey|16",
"name": "grey",
"fg": "#888888",
"bg": "#ffffff",
"size": 16,
"width": 420,
"height": 160,
"sha256": "117520b0392502751ddab388c91e9713153a58a71c2df5ca948e78b3471c3f0d"
},
"grey|33": {
"id": "grey|33",
"name": "grey",
"fg": "#888888",
"bg": "#ffffff",
"size": 33,
"width": 420,
"height": 160,
"sha256": "a20325721477839253b47e912d6ca2faca57b678dfd0684a53d2039c71b18f7d"
},
"white_on_black|16": {
"id": "white_on_black|16",
"name": "white_on_black",
"fg": "#ffffff",
"bg": "#000000",
"size": 16,
"width": 420,
"height": 160,
"sha256": "72e1b06edb977634bd70fcd9edd921a4332b526097ebb51e876eceb429cf5194"
},
"white_on_black|33": {
"id": "white_on_black|33",
"name": "white_on_black",
"fg": "#ffffff",
"bg": "#000000",
"size": 33,
"width": 420,
"height": 160,
"sha256": "5b84dd2f3a04210bb86a375e0c0d531fc1c7d90e0d50e97d19940981bee77dfc"
},
"red|16": {
"id": "red|16",
"name": "red",
"fg": "#ff0000",
"bg": "#ffffff",
"size": 16,
"width": 420,
"height": 160,
"sha256": "ac0c3b25f7d973e6c77251b100130e5d2df749def5502a84c98c28645540c594"
},
"red|33": {
"id": "red|33",
"name": "red",
"fg": "#ff0000",
"bg": "#ffffff",
"size": 33,
"width": 420,
"height": 160,
"sha256": "8a0a7f5461dccf8b1e87bf37c0b58333995a61ea73464c11575f40d3750e8d7e"
},
"white_on_blue|16": {
"id": "white_on_blue|16",
"name": "white_on_blue",
"fg": "#ffffff",
"bg": "#0000ff",
"size": 16,
"width": 420,
"height": 160,
"sha256": "7d3fc588aec100214021ced202515a3c51799a75540e507b1c68eadbdf5ebb80"
},
"white_on_blue|33": {
"id": "white_on_blue|33",
"name": "white_on_blue",
"fg": "#ffffff",
"bg": "#0000ff",
"size": 33,
"width": 420,
"height": 160,
"sha256": "9b90b082b3ec5a6242f60f89d198017d0dc84d4082b26f6de7fa01b9b8929436"
}
}
},
"keys": {
"1800_100": {
"gamma": 1800,
"contrast": 100,
"count": 39,
"black": {
"Arial|12.5|none|normal|normal|fill": {
"id": "Arial|12.5|none|normal|normal|fill",
"width": 319,
"height": 183,
"sha256": "ee3a8e3dfea9159a8497979695e096057fa49f2577fe6bf638e41d1fecec67ea"
},
"Arial|16|none|normal|normal|fill": {
"id": "Arial|16|none|normal|normal|fill",
"width": 386,
"height": 212,
"sha256": "98cd2b38609078580d7cb7eda232967ee28ad53ba6159ae59298cf1c7137c164"
},
"Arial|16|none|normal|normal|stroke": {
"id": "Arial|16|none|normal|normal|stroke",
"width": 386,
"height": 212,
"sha256": "1e6571d8a74938a478548455619639476ac1d5fe556361aa227059f9a5383cc8"
},
"Arial|33|none|normal|normal|fill": {
"id": "Arial|33|none|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "77d3ad98366467e10e0a7a30ec89615435d500684bd6ae14e077be083e0fd1b4"
},
"Arial|33|rot15-scale1.5x2|normal|normal|fill": {
"id": "Arial|33|rot15-scale1.5x2|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "268661170dbf65b4087095d6572a9e5eb47df3aba92de4497ab9305ddc25969a"
},
"Arial|33|rot15-scale1.5x2|normal|normal|fill|alpha=false": {
"id": "Arial|33|rot15-scale1.5x2|normal|normal|fill|alpha=false",
"width": 711,
"height": 352,
"sha256": "56bdb525c665af5aed8eb887d5fef9bc2cf96dc04c580f847e3ac2d7adb7facf"
},
"Arial|72|none|normal|normal|fill": {
"id": "Arial|72|none|normal|normal|fill",
"width": 1456,
"height": 673,
"sha256": "cde0d587e27ae735ab3f4d48ab9db9e4ab67b428a47725e80889b05fc585cb19"
},
"Arial|72|none|normal|normal|fill|alpha=false": {
"id": "Arial|72|none|normal|normal|fill|alpha=false",
"width": 1456,
"height": 673,
"sha256": "8f3002ed06eb19f56b436404bf270b89ef1f773c403a682d0197bb8c86193b09"
},
"Arial|72|none|normal|normal|stroke": {
"id": "Arial|72|none|normal|normal|stroke",
"width": 1456,
"height": 673,
"sha256": "dcfd4e18ea49e2939fc9ed4b0125d3537129ef9db16a307bbace4ee0e404db3e"
},
"Arial|9|none|normal|normal|fill": {
"id": "Arial|9|none|normal|normal|fill",
"width": 252,
"height": 155,
"sha256": "3e7800055997f8c1a66b8e6743079abc1f8861a7805097be20910e23d2a94f96"
},
"Calibri|12.5|none|normal|normal|fill": {
"id": "Calibri|12.5|none|normal|normal|fill",
"width": 302,
"height": 179,
"sha256": "d2ffbf661f27e331c065dfaa75d9ac211e422cdd33ec7100ad440e880d9609ea"
},
"Calibri|16|none|normal|normal|fill": {
"id": "Calibri|16|none|normal|normal|fill",
"width": 364,
"height": 206,
"sha256": "e92b7be795a3f9c6fff81923bd19332ed197e0d4c9a435eec3007503277731f4"
},
"Calibri|33|none|normal|normal|fill": {
"id": "Calibri|33|none|normal|normal|fill",
"width": 666,
"height": 340,
"sha256": "51da20ad1f3cff06c7e3f03112f697c430cafe5b0ec1a02d7b81d73226389fa8"
},
"Calibri|9|none|normal|normal|fill": {
"id": "Calibri|9|none|normal|normal|fill",
"width": 240,
"height": 151,
"sha256": "196f471dd173d75c7eda41f9d87caa3a6321d43b2df3cf176581f82257169aad"
},
"Consolas|12.5|none|normal|normal|fill": {
"id": "Consolas|12.5|none|normal|normal|fill",
"width": 338,
"height": 188,
"sha256": "94e60dca493f234bea874e7a962855d2a708f00cc35f4e266c0d5f98f998b905"
},
"Consolas|16|none|normal|normal|fill": {
"id": "Consolas|16|none|normal|normal|fill",
"width": 410,
"height": 218,
"sha256": "50e756f75be97db95df3cb2d46511ec95a1afa2ba5d9cdb2cd73123a65bcb0e4"
},
"Consolas|33|none|normal|normal|fill": {
"id": "Consolas|33|none|normal|normal|fill",
"width": 760,
"height": 365,
"sha256": "f0ab5cc32841bb964b06cad8cc960a6ce7b2ff1f893b61d40f2ade0fa1a3da57"
},
"Consolas|9|none|normal|normal|fill": {
"id": "Consolas|9|none|normal|normal|fill",
"width": 266,
"height": 158,
"sha256": "fe35c05a55d67fa9be55edc4a3c26ec1b02ae0554c3927df65d63d7f314ba5cb"
},
"Segoe UI|12.5|none|normal|normal|fill": {
"id": "Segoe UI|12.5|none|normal|normal|fill",
"width": 319,
"height": 183,
"sha256": "2b0e2121a7cecb95627884b225686516823ecf907cdac3d16de2c9d9448e7cb4"
},
"Segoe UI|16|none|normal|normal|fill": {
"id": "Segoe UI|16|none|normal|normal|fill",
"width": 386,
"height": 212,
"sha256": "e2da2ca50b4a3714b344fc909f06cc21d8e70985c87fba10d02105302b050f03"
},
"Segoe UI|33|none|normal|normal|fill": {
"id": "Segoe UI|33|none|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "051b495e0c4c7c29ded7b83f54aaa0eca0d072c0f3b299c8429828394a614499"
},
"Segoe UI|9|none|normal|normal|fill": {
"id": "Segoe UI|9|none|normal|normal|fill",
"width": 253,
"height": 155,
"sha256": "498ab34b34191205b46cce4edbd08c539c07734be633f17998dc4cc3e613360c"
},
"Times New Roman|16|none|normal|normal|fill": {
"id": "Times New Roman|16|none|normal|normal|fill",
"width": 365,
"height": 207,
"sha256": "3060970fff10250556c1dedda06e0602ba74f8cd62319cc4c07d79c764d0d198"
},
"Twemoji Mozilla|33|none|normal|normal|fill|alpha=false|text=emoji": {
"id": "Twemoji Mozilla|33|none|normal|normal|fill|alpha=false|text=emoji",
"width": 338,
"height": 254,
"sha256": "b17a096d51b6b7226984188e54627a496863aeab998bb9f1adc9e816c8b6a64b"
},
"Twemoji Mozilla|33|none|normal|normal|fill|text=emoji": {
"id": "Twemoji Mozilla|33|none|normal|normal|fill|text=emoji",
"width": 338,
"height": 254,
"sha256": "b17a096d51b6b7226984188e54627a496863aeab998bb9f1adc9e816c8b6a64b"
}
},
"colors": {
"black|16": {
"id": "black|16",
"width": 420,
"height": 160,
"sha256": "938b7381139ef4f5d5bd0ca3f12d58f11224981f494afa869e92a2f22d7e7181"
},
"black|33": {
"id": "black|33",
"width": 420,
"height": 160,
"sha256": "d201f011ff0da51760a7dbd6f8b1a415173b278dd861edd19f1e240273661d21"
},
"teal|16": {
"id": "teal|16",
"width": 420,
"height": 160,
"sha256": "8746ee921e50c0b8b08d8448faaa2bdc6c71e9268621bd71c0fcf24fd5495ae7"
},
"teal|33": {
"id": "teal|33",
"width": 420,
"height": 160,
"sha256": "2b3df9671621de69a4e8415db76825bb2e18ddd122778521a8ddbc79e899dd71"
},
"limealpha|16": {
"id": "limealpha|16",
"width": 420,
"height": 160,
"sha256": "2f3cac50d2b3cfdda020841414a171c06b9d42c671b1688e744ccda1587ae74e"
},
"limealpha|33": {
"id": "limealpha|33",
"width": 420,
"height": 160,
"sha256": "4de189802d53988a14c12696b7304b5c46c43b77478b43c5174011b547e3cd71"
},
"grey|16": {
"id": "grey|16",
"width": 420,
"height": 160,
"sha256": "117520b0392502751ddab388c91e9713153a58a71c2df5ca948e78b3471c3f0d"
},
"grey|33": {
"id": "grey|33",
"width": 420,
"height": 160,
"sha256": "a20325721477839253b47e912d6ca2faca57b678dfd0684a53d2039c71b18f7d"
},
"white_on_black|16": {
"id": "white_on_black|16",
"width": 420,
"height": 160,
"sha256": "72e1b06edb977634bd70fcd9edd921a4332b526097ebb51e876eceb429cf5194"
},
"white_on_black|33": {
"id": "white_on_black|33",
"width": 420,
"height": 160,
"sha256": "5b84dd2f3a04210bb86a375e0c0d531fc1c7d90e0d50e97d19940981bee77dfc"
},
"red|16": {
"id": "red|16",
"width": 420,
"height": 160,
"sha256": "ac0c3b25f7d973e6c77251b100130e5d2df749def5502a84c98c28645540c594"
},
"red|33": {
"id": "red|33",
"width": 420,
"height": 160,
"sha256": "8a0a7f5461dccf8b1e87bf37c0b58333995a61ea73464c11575f40d3750e8d7e"
},
"white_on_blue|16": {
"id": "white_on_blue|16",
"width": 420,
"height": 160,
"sha256": "7d3fc588aec100214021ced202515a3c51799a75540e507b1c68eadbdf5ebb80"
},
"white_on_blue|33": {
"id": "white_on_blue|33",
"width": 420,
"height": 160,
"sha256": "9b90b082b3ec5a6242f60f89d198017d0dc84d4082b26f6de7fa01b9b8929436"
}
}
},
"1400_50": {
"gamma": 1400,
"contrast": 50,
"count": 39,
"black": {
"Arial|12.5|none|normal|normal|fill": {
"id": "Arial|12.5|none|normal|normal|fill",
"width": 319,
"height": 183,
"sha256": "14c99d061e0f4a4c53418e9364cfbebb263637ff271eb88ce0174ec7f580a8d1"
},
"Arial|16|none|normal|normal|fill": {
"id": "Arial|16|none|normal|normal|fill",
"width": 386,
"height": 212,
"sha256": "460090856e361a9d1c8b8e508f1389bb18d6ed4bcbcb54de0a41def27df66c60"
},
"Arial|16|none|normal|normal|stroke": {
"id": "Arial|16|none|normal|normal|stroke",
"width": 386,
"height": 212,
"sha256": "d430dc9d241cbcf3163cf3c84819e296695b271ce5e4c0cbb81ff5e52fb7f888"
},
"Arial|33|none|normal|normal|fill": {
"id": "Arial|33|none|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "133696ab25926088783d52f37a1e0b38b6c05d89b5f8be9ba526a6d40b3ac9cc"
},
"Arial|33|rot15-scale1.5x2|normal|normal|fill": {
"id": "Arial|33|rot15-scale1.5x2|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "60be668ad5c98d4f6c1a882c991ac2bf716c370e7ddad2fc33727382729540e1"
},
"Arial|33|rot15-scale1.5x2|normal|normal|fill|alpha=false": {
"id": "Arial|33|rot15-scale1.5x2|normal|normal|fill|alpha=false",
"width": 711,
"height": 352,
"sha256": "a6d3ed8f876b2549de27d495a18275a8d1d57aabb12b366a5ea010f64ff2a487"
},
"Arial|72|none|normal|normal|fill": {
"id": "Arial|72|none|normal|normal|fill",
"width": 1456,
"height": 673,
"sha256": "e94fec8095a60639e7f032a83010c67d2cb903c564963a7502736424b031cfd1"
},
"Arial|72|none|normal|normal|fill|alpha=false": {
"id": "Arial|72|none|normal|normal|fill|alpha=false",
"width": 1456,
"height": 673,
"sha256": "7e99bff1907801acadcbac04269a7d12ffb3bd7f51866dfc530160150b323042"
},
"Arial|72|none|normal|normal|stroke": {
"id": "Arial|72|none|normal|normal|stroke",
"width": 1456,
"height": 673,
"sha256": "2f6e77afccf808b8093d8401eff74063579e20878aa92b9dee79e9772bb9557a"
},
"Arial|9|none|normal|normal|fill": {
"id": "Arial|9|none|normal|normal|fill",
"width": 252,
"height": 155,
"sha256": "f6f0f83c38699bac16c911ffb08bb4d65bcd2eb310af96999c86ed1a3849b1c1"
},
"Calibri|12.5|none|normal|normal|fill": {
"id": "Calibri|12.5|none|normal|normal|fill",
"width": 302,
"height": 179,
"sha256": "9245eea21c147ff68d9939442dd706a543c5d330aac23bf8b3d98763c6b4be49"
},
"Calibri|16|none|normal|normal|fill": {
"id": "Calibri|16|none|normal|normal|fill",
"width": 364,
"height": 206,
"sha256": "99267623a24e50c9b8780c9164466c3e87eeba0f1121e3a967388b2270c1f4e0"
},
"Calibri|33|none|normal|normal|fill": {
"id": "Calibri|33|none|normal|normal|fill",
"width": 666,
"height": 340,
"sha256": "015bb14578ca98863179cf6cf8f081141895919caa5b40bbbeb5850d6daf1dd6"
},
"Calibri|9|none|normal|normal|fill": {
"id": "Calibri|9|none|normal|normal|fill",
"width": 240,
"height": 151,
"sha256": "3032e62b1f242f40a929515e8c7c0795df490ee8689b7ff8edb5576cb281039f"
},
"Consolas|12.5|none|normal|normal|fill": {
"id": "Consolas|12.5|none|normal|normal|fill",
"width": 338,
"height": 188,
"sha256": "940e7b60291c65c0478370523b110ba443a154bb9adbfeb6a8f2f05aa5bf64f9"
},
"Consolas|16|none|normal|normal|fill": {
"id": "Consolas|16|none|normal|normal|fill",
"width": 410,
"height": 218,
"sha256": "627d72ba3944f9f7d75f7656022c3e2721d40c7c58bb54066231ed87be12997c"
},
"Consolas|33|none|normal|normal|fill": {
"id": "Consolas|33|none|normal|normal|fill",
"width": 760,
"height": 365,
"sha256": "75658b28d60aa33498c7beab0672416a0e1aa1e90ea1a5baec103b687725552a"
},
"Consolas|9|none|normal|normal|fill": {
"id": "Consolas|9|none|normal|normal|fill",
"width": 266,
"height": 158,
"sha256": "5a9fa9c242e44227bbb68d45b58324c7e16d3a4b36c7e97a0113b945c72147d9"
},
"Segoe UI|12.5|none|normal|normal|fill": {
"id": "Segoe UI|12.5|none|normal|normal|fill",
"width": 319,
"height": 183,
"sha256": "659a72b345f342f4bd4d4a7cdd444f68e802302d199ac59ba619441414a3cf5a"
},
"Segoe UI|16|none|normal|normal|fill": {
"id": "Segoe UI|16|none|normal|normal|fill",
"width": 386,
"height": 212,
"sha256": "7ed00e70c9ad30aa78faa09a0781197a4fe511af65f72e14b6b65ec8081d8ffd"
},
"Segoe UI|33|none|normal|normal|fill": {
"id": "Segoe UI|33|none|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "85598e54157f9c74091a92cd86653e6f4b10956c47aa63791ea4f799a41e0cda"
},
"Segoe UI|9|none|normal|normal|fill": {
"id": "Segoe UI|9|none|normal|normal|fill",
"width": 253,
"height": 155,
"sha256": "ba4e8c10825da7b2ca987a159345da51bd15892465a7e4102cd8ea28cf6861a1"
},
"Times New Roman|16|none|normal|normal|fill": {
"id": "Times New Roman|16|none|normal|normal|fill",
"width": 365,
"height": 207,
"sha256": "05f8cc92764a333044b3ea5ff03f8cfc52616670c2ac89b351a1a94bd0ac3316"
},
"Twemoji Mozilla|33|none|normal|normal|fill|alpha=false|text=emoji": {
"id": "Twemoji Mozilla|33|none|normal|normal|fill|alpha=false|text=emoji",
"width": 338,
"height": 254,
"sha256": "09d0464c8a0da0cdde22392a6e02df35f02ba67c7e89ff415f37302630b076df"
},
"Twemoji Mozilla|33|none|normal|normal|fill|text=emoji": {
"id": "Twemoji Mozilla|33|none|normal|normal|fill|text=emoji",
"width": 338,
"height": 254,
"sha256": "09d0464c8a0da0cdde22392a6e02df35f02ba67c7e89ff415f37302630b076df"
}
},
"colors": {
"black|16": {
"id": "black|16",
"width": 420,
"height": 160,
"sha256": "52ad1861583860289040685f6d12360e17707b94a0e518c5484cffd4e022e4bb"
},
"black|33": {
"id": "black|33",
"width": 420,
"height": 160,
"sha256": "980ea0631ee5813905f894ebfbca8ce859402b3eeb11cc3069c265d594610f84"
},
"teal|16": {
"id": "teal|16",
"width": 420,
"height": 160,
"sha256": "019ef31ba5e38bba0e0ed00c1f7872d1f752d4faef964220728b703689b8e0ea"
},
"teal|33": {
"id": "teal|33",
"width": 420,
"height": 160,
"sha256": "3a46c08e48f0adb86e68d95a211eb61ac2f9dcc9a6279913b1d9698f50a33fb1"
},
"limealpha|16": {
"id": "limealpha|16",
"width": 420,
"height": 160,
"sha256": "10e296a606b3c506a4d9046dfc593d901d49e6eaaa5803d18ff51d8e49dd10ac"
},
"limealpha|33": {
"id": "limealpha|33",
"width": 420,
"height": 160,
"sha256": "40e733728a6aae4ab7e78993ad2e2eb8689b8761f3698dc1054bf6d0615da30f"
},
"grey|16": {
"id": "grey|16",
"width": 420,
"height": 160,
"sha256": "a6b24c09f8364adf1190ae3c33d6c8b575d179cc6c2de98a342cd321c82dffe7"
},
"grey|33": {
"id": "grey|33",
"width": 420,
"height": 160,
"sha256": "fd6f0d41ebb37ceff9ae9d476f297293be36279bed196d66a13708298322d3ff"
},
"white_on_black|16": {
"id": "white_on_black|16",
"width": 420,
"height": 160,
"sha256": "acc160da81e8cddd293c5bce6a0d24f382cb778c4df90488ad21e3cc0177099c"
},
"white_on_black|33": {
"id": "white_on_black|33",
"width": 420,
"height": 160,
"sha256": "2b457056b9add984d1f09f3194b116399d6f1313cb7b5c006adb59662d8011c1"
},
"red|16": {
"id": "red|16",
"width": 420,
"height": 160,
"sha256": "bbafe01fa867809ef60b23de34292b6130e018f06cecb5dc4036fde01ad8524c"
},
"red|33": {
"id": "red|33",
"width": 420,
"height": 160,
"sha256": "00c7c3b8114a536a2e305b9c995456501553c158a572288a6382c7addcd6ab9f"
},
"white_on_blue|16": {
"id": "white_on_blue|16",
"width": 420,
"height": 160,
"sha256": "2114b54a0da2799c310357e1f3e88255228bd6b10277b5bb4c28be9dd0e8309f"
},
"white_on_blue|33": {
"id": "white_on_blue|33",
"width": 420,
"height": 160,
"sha256": "42df0d6244b32216364af6dbfaba48a44ef3689a28786529715372688e1da443"
}
}
},
"2200_0": {
"gamma": 2200,
"contrast": 0,
"count": 39,
"black": {
"Arial|12.5|none|normal|normal|fill": {
"id": "Arial|12.5|none|normal|normal|fill",
"width": 319,
"height": 183,
"sha256": "bc41b0f4665d48690f6acaf86575e90045da6eeeb1e21c1d71cee9eb0fdadf97"
},
"Arial|16|none|normal|normal|fill": {
"id": "Arial|16|none|normal|normal|fill",
"width": 386,
"height": 212,
"sha256": "494f8937cfabe6df194df5942b4a1a7dc11de5e891784bd743467714cc905bb2"
},
"Arial|16|none|normal|normal|stroke": {
"id": "Arial|16|none|normal|normal|stroke",
"width": 386,
"height": 212,
"sha256": "c59f1864698754e5f010baa4b2af1c65e9e74d6bdf6d84cafada9bae1fbeeb6f"
},
"Arial|33|none|normal|normal|fill": {
"id": "Arial|33|none|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "46753d78e39d6d7d472e805e46b062256705d2622ad1a0441b34b622e20fbe30"
},
"Arial|33|rot15-scale1.5x2|normal|normal|fill": {
"id": "Arial|33|rot15-scale1.5x2|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "dc2d1220bfc481f561e0ee1c1093f9a2e7484a137e1fa4a7054e88a8cde8efee"
},
"Arial|33|rot15-scale1.5x2|normal|normal|fill|alpha=false": {
"id": "Arial|33|rot15-scale1.5x2|normal|normal|fill|alpha=false",
"width": 711,
"height": 352,
"sha256": "d766613d927d0402f64875a3f84d730c05e8334f04d538550669eb60a6f7c90b"
},
"Arial|72|none|normal|normal|fill": {
"id": "Arial|72|none|normal|normal|fill",
"width": 1456,
"height": 673,
"sha256": "bff75224bc88dad497d360779bd999a2c327651e68a29df0332a025f27414b60"
},
"Arial|72|none|normal|normal|fill|alpha=false": {
"id": "Arial|72|none|normal|normal|fill|alpha=false",
"width": 1456,
"height": 673,
"sha256": "3b1d63436b498024c8fa5dd191aaec66a720920f4f5cbebcec4fb10cafbad543"
},
"Arial|72|none|normal|normal|stroke": {
"id": "Arial|72|none|normal|normal|stroke",
"width": 1456,
"height": 673,
"sha256": "44fd511bb9097a9344524a9ce88a2832767b93310274790de08ca68a76da971d"
},
"Arial|9|none|normal|normal|fill": {
"id": "Arial|9|none|normal|normal|fill",
"width": 252,
"height": 155,
"sha256": "7f1c0a53a28d5d1928788db178742643435c6576e0df291b6d68688d306ebeb1"
},
"Calibri|12.5|none|normal|normal|fill": {
"id": "Calibri|12.5|none|normal|normal|fill",
"width": 302,
"height": 179,
"sha256": "c6834082d739490f9486ff17e13b07d97c47bf823e14864d18ae752db88193ed"
},
"Calibri|16|none|normal|normal|fill": {
"id": "Calibri|16|none|normal|normal|fill",
"width": 364,
"height": 206,
"sha256": "48d1d575a8e73c17c89b57bcadaf94a21d66956ab3406c81d0462a3d5f1e7f42"
},
"Calibri|33|none|normal|normal|fill": {
"id": "Calibri|33|none|normal|normal|fill",
"width": 666,
"height": 340,
"sha256": "823a7c1037ba76cee297b77e26de62d698bd8f8055fbdde556949248c01eb5c4"
},
"Calibri|9|none|normal|normal|fill": {
"id": "Calibri|9|none|normal|normal|fill",
"width": 240,
"height": 151,
"sha256": "d22432b47834f0426de5e2bcfa199e39f54db75e5cd503aa7175fa125f52a9c4"
},
"Consolas|12.5|none|normal|normal|fill": {
"id": "Consolas|12.5|none|normal|normal|fill",
"width": 338,
"height": 188,
"sha256": "2038306771f3c80c528cceca6a5045367dfb2789e0fac6c3b063a1979262ff82"
},
"Consolas|16|none|normal|normal|fill": {
"id": "Consolas|16|none|normal|normal|fill",
"width": 410,
"height": 218,
"sha256": "8e4d6ffa72d864c811647613554a9e9f044c949688566e84847be8d544b0c57b"
},
"Consolas|33|none|normal|normal|fill": {
"id": "Consolas|33|none|normal|normal|fill",
"width": 760,
"height": 365,
"sha256": "d79a5a9f2134bbbeb509fac67eaedddbba88a71a901ebc498c9e3c2b0f42178b"
},
"Consolas|9|none|normal|normal|fill": {
"id": "Consolas|9|none|normal|normal|fill",
"width": 266,
"height": 158,
"sha256": "9d76f6b720d844f961d74c8779849f701a10b6b088cb8f6b73d1ac181a01179e"
},
"Segoe UI|12.5|none|normal|normal|fill": {
"id": "Segoe UI|12.5|none|normal|normal|fill",
"width": 319,
"height": 183,
"sha256": "6f05277c4eea92d7d1ca86471bcf47f42172d9ab43d11e784c14650b86b7f744"
},
"Segoe UI|16|none|normal|normal|fill": {
"id": "Segoe UI|16|none|normal|normal|fill",
"width": 386,
"height": 212,
"sha256": "7fed78964672e26bfc878ab65910c9c59abf57af85f8d01af330f0d8e6a890e4"
},
"Segoe UI|33|none|normal|normal|fill": {
"id": "Segoe UI|33|none|normal|normal|fill",
"width": 711,
"height": 352,
"sha256": "af8d02cec31673a205a5a389f478e8270474bd025936cd11fd01478a706da04b"
},
"Segoe UI|9|none|normal|normal|fill": {
"id": "Segoe UI|9|none|normal|normal|fill",
"width": 253,
"height": 155,
"sha256": "5bc7924b646811c83d2a6f31bb02236ccae08abdc39c98f574c41c6211ee0413"
},
"Times New Roman|16|none|normal|normal|fill": {
"id": "Times New Roman|16|none|normal|normal|fill",
"width": 365,
"height": 207,
"sha256": "cfff39b7d31293c20e44353c76ed717424e375ad59f98a74b800f24c5934316b"
},
"Twemoji Mozilla|33|none|normal|normal|fill|alpha=false|text=emoji": {
"id": "Twemoji Mozilla|33|none|normal|normal|fill|alpha=false|text=emoji",
"width": 338,
"height": 254,
"sha256": "4aac8af7051ea57f30eeb0a18bc56e1f73d74c1751df3a45a78c874eb0a4a5f2"
},
"Twemoji Mozilla|33|none|normal|normal|fill|text=emoji": {
"id": "Twemoji Mozilla|33|none|normal|normal|fill|text=emoji",
"width": 338,
"height": 254,
"sha256": "4aac8af7051ea57f30eeb0a18bc56e1f73d74c1751df3a45a78c874eb0a4a5f2"
}
},
"colors": {
"black|16": {
"id": "black|16",
"width": 420,
"height": 160,
"sha256": "77d5557ee05bc85c9ecd875517422c0516ac9d979933fc4c50a00c2a85c4a8a1"
},
"black|33": {
"id": "black|33",
"width": 420,
"height": 160,
"sha256": "580a367613617a17978fe64bc2514e0c34414fbbfdbfea4a81f6f41a9048fd02"
},
"teal|16": {
"id": "teal|16",
"width": 420,
"height": 160,
"sha256": "226470fa83fe2039c31e073cb620c1aadd4c0c615be2e40b53905c2132554ef5"
},
"teal|33": {
"id": "teal|33",
"width": 420,
"height": 160,
"sha256": "20ee0972b2582b55c1532bbc98fd00550ae6af110bc92ac65f09ae7a5e4c1ae0"
},
"limealpha|16": {
"id": "limealpha|16",
"width": 420,
"height": 160,
"sha256": "8674bbefa9ce1106172929a986f6a98b37a1394d13c537c4d4388a7600816ef7"
},
"limealpha|33": {
"id": "limealpha|33",
"width": 420,
"height": 160,
"sha256": "643b28b21d276d940d892b5fb393f845e3bb74a87b388b609d057d5901fe9469"
},
"grey|16": {
"id": "grey|16",
"width": 420,
"height": 160,
"sha256": "022631fc03d1610531248ef4a927231ec6e23194e1e1f4afa89c4c3948cd0629"
},
"grey|33": {
"id": "grey|33",
"width": 420,
"height": 160,
"sha256": "df655c2f29a1dc0c478fe57f9bbc5201f465d56b77de99504cb775bc519df987"
},
"white_on_black|16": {
"id": "white_on_black|16",
"width": 420,
"height": 160,
"sha256": "5b80cc5864ab3e7b53fae364eaf9328938f2170312201ec0e27a0c42bfd02bd9"
},
"white_on_black|33": {
"id": "white_on_black|33",
"width": 420,
"height": 160,
"sha256": "7abbe06b0ae934fde081a8e9e7abdba2c74268a4703b3fd14ec91165ba9e0643"
},
"red|16": {
"id": "red|16",
"width": 420,
"height": 160,
"sha256": "11d2b4bbd971feb10b866a8aed895b944c68c3094eab90f4fbe1c4e75cdbfe84"
},
"red|33": {
"id": "red|33",
"width": 420,
"height": 160,
"sha256": "b4ff984d6faf7c7a7c17c5bd347dfd243196fbcd55ce2754b05b684b775edaed"
},
"white_on_blue|16": {
"id": "white_on_blue|16",
"width": 420,
"height": 160,
"sha256": "806b730875ad3b0223aa3acb435fbc5490a7240e5e4e0f1df4d9422001232ae5"
},
"white_on_blue|33": {
"id": "white_on_blue|33",
"width": 420,
"height": 160,
"sha256": "46035656360248005c49c9bd0e9db1ac47223689b96993ccb2370c82e7f726f2"
}
}
}
}
}
+15
View File
@@ -0,0 +1,15 @@
{
"firefox-68": {
"carries": [
"the in-memory caches of the core are gone (core 67.78.0, no engine change)",
"revocations and intermediates as ready-made files (the security-state component)",
"a navigation that committed is not cut by the parent (the held cut: networkidle)",
"the Juggler trace and the MOZ_LOG modules of the gate",
"TEMP on D: in the Windows jobs"
],
"files": {
"tests/test_a_page_that_moves_on_e2e.py": "a navigation that committed is not cut by the parent: goto answers on our own page, networkidle is reached on the one that replaced it",
"tests/test_fakeweb_p2_e2e.py": "under a load of other browsers the page that leaves with beacons reaches networkidle every round (the held cut of a committed navigation); on an older engine the run is made and not judged"
}
}
}
-151
View File
@@ -1,151 +0,0 @@
{
"fonts": {
"menu": {
"family": "Segoe UI",
"size": "12px",
"weight": "400",
"style": "normal",
"stretch": "100%"
},
"caption": {
"family": "Segoe UI",
"size": "12px",
"weight": "400",
"style": "normal",
"stretch": "100%"
},
"icon": {
"family": "Segoe UI",
"size": "12px",
"weight": "400",
"style": "normal",
"stretch": "100%"
},
"message-box": {
"family": "Segoe UI",
"size": "12px",
"weight": "400",
"style": "normal",
"stretch": "100%"
},
"small-caption": {
"family": "Segoe UI",
"size": "12px",
"weight": "400",
"style": "normal",
"stretch": "100%"
},
"status-bar": {
"family": "Segoe UI",
"size": "12px",
"weight": "400",
"style": "normal",
"stretch": "100%"
},
"system-ui": {
"family": "system-ui",
"size": "16px",
"weight": "400",
"style": "normal",
"stretch": "100%"
}
},
"light": {
"Canvas": "rgb(255, 255, 255)",
"CanvasText": "rgb(0, 0, 0)",
"LinkText": "rgb(0, 0, 238)",
"VisitedText": "rgb(85, 26, 139)",
"ActiveText": "rgb(238, 0, 0)",
"ButtonFace": "rgb(233, 233, 237)",
"ButtonText": "rgb(0, 0, 0)",
"ButtonBorder": "rgb(129, 127, 132)",
"Field": "rgb(255, 255, 255)",
"FieldText": "rgb(0, 0, 0)",
"GrayText": "rgb(109, 109, 109)",
"Highlight": "rgb(0, 120, 212)",
"HighlightText": "rgb(255, 255, 255)",
"Mark": "rgb(255, 255, 0)",
"MarkText": "rgb(0, 0, 0)",
"SelectedItem": "rgb(0, 120, 212)",
"SelectedItemText": "rgb(255, 255, 255)",
"AccentColor": "rgb(0, 96, 223)",
"AccentColorText": "rgb(255, 255, 255)",
"ActiveBorder": "rgb(129, 127, 132)",
"ActiveCaption": "rgb(255, 255, 255)",
"AppWorkspace": "rgb(255, 255, 255)",
"Background": "rgb(255, 255, 255)",
"ButtonHighlight": "rgb(233, 233, 237)",
"ButtonShadow": "rgb(233, 233, 237)",
"CaptionText": "rgb(0, 0, 0)",
"InactiveBorder": "rgb(129, 127, 132)",
"InactiveCaption": "rgb(255, 255, 255)",
"InactiveCaptionText": "rgb(109, 109, 109)",
"InfoBackground": "rgb(255, 255, 255)",
"InfoText": "rgb(0, 0, 0)",
"Menu": "rgb(255, 255, 255)",
"MenuText": "rgb(0, 0, 0)",
"Scrollbar": "rgb(255, 255, 255)",
"ThreeDDarkShadow": "rgb(129, 127, 132)",
"ThreeDFace": "rgb(233, 233, 237)",
"ThreeDHighlight": "rgb(129, 127, 132)",
"ThreeDLightShadow": "rgb(129, 127, 132)",
"ThreeDShadow": "rgb(129, 127, 132)",
"Window": "rgb(255, 255, 255)",
"WindowFrame": "rgb(129, 127, 132)",
"WindowText": "rgb(0, 0, 0)"
},
"dark": {
"Canvas": "rgb(28, 27, 34)",
"CanvasText": "rgb(251, 251, 254)",
"LinkText": "rgb(0, 202, 219)",
"VisitedText": "rgb(255, 173, 255)",
"ActiveText": "rgb(255, 102, 102)",
"ButtonFace": "rgb(43, 42, 51)",
"ButtonText": "rgb(251, 251, 254)",
"ButtonBorder": "rgb(148, 146, 151)",
"Field": "rgb(43, 42, 51)",
"FieldText": "rgb(251, 251, 254)",
"GrayText": "rgb(117, 116, 122)",
"Highlight": "rgba(0, 221, 255, 0.306)",
"HighlightText": "rgb(0, 0, 0)",
"Mark": "rgb(255, 255, 0)",
"MarkText": "rgb(0, 0, 0)",
"SelectedItem": "rgb(0, 221, 255)",
"SelectedItemText": "rgb(43, 42, 51)",
"AccentColor": "rgb(0, 96, 223)",
"AccentColorText": "rgb(255, 255, 255)",
"ActiveBorder": "rgb(57, 57, 57)",
"ActiveCaption": "rgb(28, 27, 34)",
"AppWorkspace": "rgb(28, 27, 34)",
"Background": "rgb(28, 27, 34)",
"ButtonHighlight": "rgb(43, 42, 51)",
"ButtonShadow": "rgb(43, 42, 51)",
"CaptionText": "rgb(251, 251, 254)",
"InactiveBorder": "rgb(57, 57, 57)",
"InactiveCaption": "rgb(28, 27, 34)",
"InactiveCaptionText": "rgb(251, 251, 254)",
"InfoBackground": "rgb(28, 27, 34)",
"InfoText": "rgb(251, 251, 254)",
"Menu": "rgb(43, 42, 51)",
"MenuText": "rgb(251, 251, 254)",
"Scrollbar": "rgb(28, 27, 34)",
"ThreeDDarkShadow": "rgb(34, 33, 40)",
"ThreeDFace": "rgb(43, 42, 51)",
"ThreeDHighlight": "rgb(148, 146, 151)",
"ThreeDLightShadow": "rgb(148, 146, 151)",
"ThreeDShadow": "rgb(148, 146, 151)",
"Window": "rgb(28, 27, 34)",
"WindowFrame": "rgb(117, 116, 122)",
"WindowText": "rgb(251, 251, 254)"
},
"selection": {
"light": {
"color": "rgb(0, 0, 0)",
"bg": "rgba(0, 0, 0, 0)"
},
"dark": {
"color": "rgb(0, 0, 0)",
"bg": "rgba(0, 0, 0, 0)"
}
}
}
+1
View File
@@ -0,0 +1 @@
{"format":1,"source":"Mozilla's security/manager/ssl/tests/unit/test_crlite_filters","files":{"20200101-0-filter":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/20200101-0-filter","sha256":"3c116fb9feacdf83b74fd0a4d38b9427df19733021b97ff40e9aa53f8e81b71b","base64":"AwABAAAAAAAAAFQiJZjzPTZIBULa7ODmuU3hXA7ujFkUykjXXjxIToA/AAAAAAAAAAB/TnFOGAkAAAEAAAAAAAAAIAAAAAAAAABUIiWY8z02SAVC2uzg5rlN4VwO7oxZFMpI1148SE6APwIAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAABgAAAAAAAAA="},"20200101-1-filter.delta":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/20200101-1-filter.delta","sha256":"27a608525e50b97ca3b8d6e9b91a517be681731576efda99a6b02d3024b968bb","base64":"AwABAAAAAAAAAFQiJZjzPTZIBULa7ODmuU3hXA7ujFkUykjXXjxIToA/AAAAAAAAAAB/TnFOGAkAAAEAAAAAAAAAIAAAAAAAAABUIiWY8z02SAVC2uzg5rlN4VwO7oxZFMpI1148SE6APwEAAAAAAAAAAwAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAADAAAAAAAAAA=="},"int.pem":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/int.pem","sha256":"4b604e9b4254131a85fad2bca65fde30e53b68feeab9144e9db08b84ada5a365","base64":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5akNDQWJLZ0F3SUJBZ0lVVXhuMGYrZFl5bFNtUzM1Nkx2RFZQWWFYdHlzd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0RURUxNQWtHQTFVRUF3d0NZMkV3SWhnUE1qQXlNREF4TURFd01EQXdNREJhR0E4eU1ESXdNREl3TVRBdwpNREF3TUZvd0RqRU1NQW9HQTFVRUF3d0RhVzUwTUlJQklqQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FROEFNSUlCCkNnS0NBUUVBdW9oUnFFU09GdFpCL1c2MmlBWTJFRDA4RTlucTVEVkt0T3oxYUZkc0pIdkJ4eVdvNE5nZnZiR2MKQnB0dUdvYnlhK0t2V25WcmFtUnhDSHFsV3FkRmgvY2MxU1NjQW43TlEvd2VhZEE0SUNtVHF5RERTZVRidVV6QwphMndPN1JXQ0QvRityV2thc2RNQ09vc3FRZTZuY09BUERZMzlaZ3Nyc0NTU3BIMjVpR0Y1a0xGWGtEM1NPOFhnCnVFZ2ZxRGZUaUVQdkp4YllWYmRtV3FwK0FwQXZPbnNRZ0FZa3pCeHNsNjJXWVZ1MzRwWVN3SFV4b3d5UjNiVEsKOS95dEhTWFRDZSs1Rnc2bmFPR3pleThpYjJuanRJcVZZUjN1SnRZbG5hdVJDRTQyeXh3a0JDeS9Gb3N2NWZHUAptUmN4dUxQK1NTUDZjbEhFTWRVRHJOb1lDalh0alFJREFRQUJveDB3R3pBTUJnTlZIUk1FQlRBREFRSC9NQXNHCkExVWREd1FFQXdJQkJqQU5CZ2txaGtpRzl3MEJBUXNGQUFPQ0FRRUFodEdyNlZoZHJiOXJIZEpoTUhIck9YNEsKbFlDL0ZBVmhkY2R4RG8vN2JGam5ON1RYWFd4VjgzUzBwK01SRmw5Tk9Xa1A0SzJGSGVOUDd4OTdPcE4xOTIvSgo2V3ZsT01Wbk8zc0o0c21GRlFscVpYNVBoZzNTYk5rU01EdFJJOUd0TllSTHNJanpTb2d4VzFCZldpTDNZdnJSCnNIYlROV01DR2d1cUZlUkdZVjhQQ2ZhMjBJcDdqZDZwbXRsQ0ZTWmY1T3JYQjl2QnA5azZTS0hhSXpXMk5xTDUKTjV6TUwvcXIrS0x3cFRjVGVweEcrVHkzUzZIVnE0eWMwaVUrMDRWNS9yM0V1Rk5VTTIvTTV0OXRQN1lxTnA1QwprU1BEVGw0RzRsQU1NN1hHOXVHYytrR0JURHI3QmZyY0RBM0hqZG00NVE0UUJ4ZkZYNGhzN2JFOGp6OHFWdz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"},"valid.example.com.pem":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/valid.example.com.pem","sha256":"14cf7809b590b9eb7a6fa0263f38a7b8113b701d1969462eb7e7c0ae8614676b","base64":"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVYekNDQTBlZ0F3SUJBZ0lVZmNreElWR3pIVzE4SW1YZG9YNEFreHZmRll3d0RRWUpLb1pJaHZjTkFRRUwKQlFBd0RqRU1NQW9HQTFVRUF3d0RhVzUwTUNJWUR6SXdNakF3TVRBeE1EQXdNREF3V2hnUE1qQXlNREF5TURFdwpNREF3TURCYU1Cd3hHakFZQmdOVkJBTU1FWFpoYkdsa0xtVjRZVzF3YkdVdVkyOXRNSUlCSWpBTkJna3Foa2lHCjl3MEJBUUVGQUFPQ0FROEFNSUlCQ2dLQ0FRRUF1b2hScUVTT0Z0WkIvVzYyaUFZMkVEMDhFOW5xNURWS3RPejEKYUZkc0pIdkJ4eVdvNE5nZnZiR2NCcHR1R29ieWErS3ZXblZyYW1SeENIcWxXcWRGaC9jYzFTU2NBbjdOUS93ZQphZEE0SUNtVHF5RERTZVRidVV6Q2Eyd083UldDRC9GK3JXa2FzZE1DT29zcVFlNm5jT0FQRFkzOVpnc3JzQ1NTCnBIMjVpR0Y1a0xGWGtEM1NPOFhndUVnZnFEZlRpRVB2SnhiWVZiZG1XcXArQXBBdk9uc1FnQVlrekJ4c2w2MlcKWVZ1MzRwWVN3SFV4b3d5UjNiVEs5L3l0SFNYVENlKzVGdzZuYU9HemV5OGliMm5qdElxVllSM3VKdFlsbmF1UgpDRTQyeXh3a0JDeS9Gb3N2NWZHUG1SY3h1TFArU1NQNmNsSEVNZFVEck5vWUNqWHRqUUlEQVFBQm80SUJvVENDCkFaMHdIQVlEVlIwUkJCVXdFNElSZG1Gc2FXUXVaWGhoYlhCc1pTNWpiMjB3TWdZSUt3WUJCUVVIQVFFRUpqQWsKTUNJR0NDc0dBUVVGQnpBQmhoWm9kSFJ3T2k4dmJHOWpZV3hvYjNOME9qZzRPRGd2TUlJQlJ3WUtLd1lCQkFIVwplUUlFQWdTQ0FUY0VnZ0V6QVRFQkx3QlVJaVdZOHowMlNBVkMydXpnNXJsTjRWd083b3haRk1wSTExNDhTRTZBClB3QUFBVzllWnVnQUFBQUVBUUVBYlNsdmRPeGM1bmtEbDJlY1hDL0NxZStRTHRRNzhqWkJmbDZPZCs0TlNVTloKK1lYVUkxSk93aXYwdHNlMmhjTDR4cHBkMHlnbzRGV2VYSDVwbkFCOTBCdnJZQXcraXh0VzNHQ0VyRzVGVE1KTwpNUVZlUE8yd2I1dDB3VWJrQlRpYmZ4NjlhcTU5dW43T211R25TZDBCbnJrK2x5eVo4VHdhaDRQMmlzOHJCTnB6Cis2ZDBjd0ZWTnJCU2tNWkhTUWdpWnIySS84Z2ZuY0VDcVBTSzhFMjV4cUdVY0UwT0JkczdDcW9EL0txTzUzQ0sKeWhzdTEvbG55MGpFQnhyTDZ5dDlKZ2VqeVF0dzF4TW5uQWlFY0dsTGtCbUFYNVR4VGMvZGtnMWtXY3ZRYTM0ZgpnbEZieUpDM3hrWThpK2dJcDRsTVJ1QVV3VWRiVHROTTFqNktUSVgzU1RBTkJna3Foa2lHOXcwQkFRc0ZBQU9DCkFRRUFRejRFYmFsOFgzb084Unl4V29oRHByTndNVGVnR1ZYY3Ntd1lsSUhJQjFYa0xsb2Q4aVk0dGNNQ2Y4UmsKbEFURE9vSXNsZjdNenNZcVd6dHBpT1RSREczUTFmS25qa0tzak9mRTQzMkxwNitDVEdWVm9aSTlMeFdkL25EegpPd01rbm1NRDJiWHVxK1pzdG1LRDRxanN3Yi9ZRy9rN2VtQ21EQ0s2Q1l4T05nRzNSSkpmUDZ0UW84b1hVQ3RFCnpIQ1M0bEhTWjcxOEFqTnpBZURxNEc2WHBzN0RNVHVEYmRMVEhMVFdVUTZ1N2o5c3k1cTFzUmU2S2VZWklUU20KMWZ2WjYwWG5zblF5cVdYSGVTekxCb2pVdzlTQVlEOC9ZVnZQWXRWaHNnR0JXeHFOY0VBNmJCZUxXbkVNeUhocgpDMVlkZEFSd1FDM1JJSjZ5MFk0eTRHek42QT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K"},"revoked-in-delta.example.com.pem":{"path":"security/manager/ssl/tests/unit/test_crlite_filters/revoked-in-delta.example.com.pem","sha256":"93bc3e3494e14ec7a828c205678d1736ca6310288Line truncated
@@ -0,0 +1,5 @@
{
"format": 1,
"source": "security/manager/tools/pykey.py, RSAKey.shared* (the key of the specification `default`)",
"pem": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC6iFGoRI4W1kH9\nbraIBjYQPTwT2erkNUq07PVoV2wke8HHJajg2B+9sZwGm24ahvJr4q9adWtqZHEI\neqVap0WH9xzVJJwCfs1D/B5p0DggKZOrIMNJ5Nu5TMJrbA7tFYIP8X6taRqx0wI6\niypB7qdw4A8Njf1mCyuwJJKkfbmIYXmQsVeQPdI7xeC4SB+oN9OIQ+8nFthVt2Za\nqn4CkC86exCABiTMHGyXrZZhW7filhLAdTGjDJHdtMr3/K0dJdMJ77kXDqdo4bN7\nLyJvaeO0ipVhHe4m1iWdq5EITjbLHCQELL8Wiy/l8Y+ZFzG4s/5JI/pyUcQx1QOs\n2hgKNe2NAgMBAAECggEBAJ7LzjhhpFTsseD+j4XdQ8kvWCXOLpl4hNDhqUnaosWs\nVZskBFDlrJ/gw+McDu+mUlpl8MIhlABO4atGPd6e6CKHzJPnRqkZKcXmrD2IdT9s\nJbpZeec+XY+yOREaPNq4pLDN9fnKsF8SM6ODNcZLVWBSXn47kq18dQTPHcfLAFeI\nr8vh6Pld90AqFRUw1YCDRoZOs3CqeZVqWHhiy1M3kTB/cNkcltItABppAJuSPGgz\niMnzbLm16+ZDAgQceNkIIGuHAJy4yrrK09vbJ5L7kRss9NtmA1hb6a4Mo7jmQXqg\nSwbkcOoaO1gcoDpngckxW2KzDmAR8iRyWUbuxXxtlEECgYEA3W4dT//r9o2InE0R\nTNqqnKpjpZN0KGyKXCmnF7umA3VkTVyqZ0xLi8cyY1hkYiDkVQ12CKwn1Vttt0+N\ngSfvj6CQmLaRR94GVXNEfhg9Iv59iFrOtRPZWB3V4HwakPXOCHneExNx7O/JznLp\nxD3BJ9I4GQ3oEXc8pdGTAfSMdCsCgYEA16dz2evDgKdn0v7Ak0rU6LVmckB3Gs3r\nta15b0eP7E1FmF77yVMpaCicjYkQL63yHzTi3UlA66jAnW0fFtzClyl3TEMnXpJR\n3b5JCeH9O/Hkvt9Go5uLODMo70rjuVuS8gcK8myefFybWH/t3gXo59hspXiG+xZY\nEKd7mEW8MScCgYEAlkcrQaYQwK3hryJmwWAONnE1W6QtS1oOtOnX6zWBQAul3RMs\n2xpekyjHu8C7sBVeoZKXLt+X0SdR2Pz2rlcqMLHqMJqHEt1OMyQdse5FX8CT9byb\nWS11bmYhR08ywHryL7J100B5KzK6JZC7smGu+5WiWO6lN2VTFb6cJNGRmS0CgYAo\ntFCnp1qFZBOyvab3pj49lk+57PUOOCPvbMjo+ibuQT+LnRIFVA8Su+egx2got7pl\nrYPMpND+KiIBFOGzXQPVqFv+Jwa9UPzmz83VcbRspiG47UfWBbvnZbCqSgZlrCU2\nTaIBVAMuEgS4VZ0+NPtbF3yaVv+TUQpaSmKHwVHeLQKBgCgGe5NVgB0u9S36ltit\ntYlnPPjuipxv9yruq+nva+WKT0q/BfeIlH3IUf2qNFQhR6caJGv7BU7naqNGq80m\nks/J5ExR5vBpxzXgc7oBn2pyFJYckbJoccrqv48GRBigJpDjmo1f8wZ7fNt/ULH1\nNBinA5ZsT8d0v3QCr2xDJH9D\n-----END PRIVATE KEY-----\n"
}
-63
View File
@@ -1,63 +0,0 @@
# Expected text of getComputedStyle for calc(1px * f(args)) (word-spacing)
# and of rotate: f(args) for the angle functions, from ucrtbase.dll's f32
# functions. Generated by scripts/ucrt_css_calc.py (python -I) - do not edit.
# <fn> <args...> <text on Windows>
sin -12.2958984375 0.267186px
sin -3.3349609375 0.192165px
sin -8.728515625 -0.641354px
sin -9.603515625 0.177787px
sin 2.6865234375 0.439525px
sin 5.9267578125 -0.348928px
sin -15.998046875 0.286032px
sin 0 0px
sin 15.9970703125 -0.285096px
cos -10.3515625 -0.600409px
cos -2.0146484375 -0.429422px
cos -3.9794921875 -0.669025px
cos 10.3515625 -0.600409px
cos 2.0146484375 -0.429422px
cos 3.9794921875 -0.669025px
cos -16 -0.95766px
cos 0 1px
cos 15.9990234375 -0.95794px
tan -2 2.18504px
tan 0 0px
tan 16 0.300632px
asin -0.27099609375 -15.7235deg
asin -0.6416015625 -39.9114deg
asin -0.859619140625 -59.2738deg
asin -0.982421875 -79.2413deg
asin 0.59423828125 36.4583deg
asin 0.751953125 48.7598deg
asin -0.4990234375 -29.9354deg
asin -1 -90deg
asin 0.49853515625 29.9031deg
acos -0.61669921875 128.076deg
acos 0.499267578125 60.0484deg
acos 0.615234375 52.031deg
acos -0.5 120deg
acos -1 180deg
acos 0.499755859375 60.0161deg
atan -4.000244140625 -75.9646deg
atan 0 0deg
atan 4 75.9638deg
atan2 -1.125 1.890625 -30.7544deg
atan2 0 0.015625 0deg
atan2 1.125 -1.90625 149.452deg
exp -2.1875 0.112197px
exp 0 1px
exp 2.187255859375 8.91073px
log 1.0966796875 0.0922872px
log 24.4873046875 3.19816px
log 31.2861328125 3.44317px
log 16.7880859375 2.82067px
log 24.5703125 3.20154px
log 35.609375 3.57261px
pow 1.125 -1.5 0.838052px
pow 4.4375 4 387.751px
pow 12.1875 -2.0625 0.00575839px
pow 2.0625 -4 0.0552617px
pow 6 1.9375 32.1861px
hypot -3.1875 -5 5.9296px
hypot 0 0 0px
hypot 3 4.6875 5.56531px
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
@@ -1,110 +0,0 @@
{
"source": "C:/ff/invisible_WebCodecs/captures/h264-1080p-bframes/retail-win/result.json",
"source_meta": "C:/ff/invisible_WebCodecs/captures/h264-1080p-bframes/retail-win/meta.json",
"browser": "ff159-win-1080p",
"codecString": "avc3.640028",
"codedWidth": 1920,
"codedHeight": 1080,
"frameCount": 96,
"frameDurationUs": 41667,
"rgbaAllocationSize": 8294400,
"rgbaFormat": "RGBA",
"rgbaSha256ByIndex": [
"ec86f786dfd4fb31be388382b7132df8f692c166f0398047454bbef38abf280c",
"612a924786de8460f6ebcd5893921a8ae04fb41b441cd9f0087cf6183fb960a9",
"e9aa87d893e542f53c3900fcd37f7a9ad40bc89b5e456d4a6ae73f142df04759",
"441e299f66fca23ff0716ebb32982f919558967fbaa4bf877040e8e0e41f67f7",
"c9b54bf73bc6d87c90196e128ee21aa5ae8c855d8474b1a967fbf6ba2110e22b",
"2ab4b1709f2f049541095d386e7cd7297e3ebe1503d120d1138ca61d74a1b8af",
"8fa4df13e422b44d585ba7413be439069b7911b7be4916aa6f338821be6665fc",
"ce2e7286c19a9c461342c439ccdc31a8573f50dd9318dc836ba8adbc1c6f8958",
"b64915b1f2d8fbb9795002736543baaf65339458c8ff204c370f78e1a0ff4da1",
"ae82fff8551a99dee31cdda4fb1154b58382cf6e9d6a275b320b35db14fb47fe",
"bbcc0181e5beeb699abfd810f2598e66d8f151b5e2712b030b9b8d8506cd9f64",
"2b52fcb494ae4b3fa8bc4f7c66da19cf3816c4928c2861ca807f079a835c69dd",
"6eeb0e0293a7447ea85227a04fba74b72f4b16573ddb457f4f7ec0b96a05a5dc",
"8c3dc83cd33c5411cdba6123cfb62ee8c53fe181a325b4abb450ce7afb9edfa7",
"d4d9297594c0af1c331c6d403cb78bedfcf33d82707f06873b48155287f33139",
"f01b715b011494cf2bf5f97212507d07a48a00282ce8d2bd4afd8f76aa8f4f65",
"976790562ae138a42395663d66d8fb987b83e1cc40b067821f3d438fe496765a",
"5896a442951c90479e6093ee92fc51b00734c8fafe84061c6ad2988c5c9719ce",
"dc84a9c2e608daf77ee25c881d0df69f9ddf6715b07b8eba3cbbfaaa692f4aa2",
"98dc9edd09bf0ce330fdc8eafa675f509adccd92e21b231f4d82b67e0448b172",
"1cc5bcb92c1947231e63a034675233933928d318962cca2598631dda4ea0398d",
"7851d124d7665bbc63decfde6035775bc29b7fc9466513789cafd7db49c9fb03",
"d00140e72758644c62ea0be72ff6d6371b27b1a8e488bb30b43931501def5719",
"3fa367ee394ed399a41f60d4b0fc9a9a93c36daffb8da37d44a09999a88c8929",
"b724e7bdd2e08efd665aeb1d088bdb6fa860c80d0e1c810f4b60e017d75b4060",
"26920b0129c66dcc1f5df0832f7a7fa5dec50e7b0841c4bf4cbf75d886b1bd14",
"bea97dc4d9550ab244ca648458c46cca3a8c278488e9add218af26fc37caf96e",
"330907a28b53c8d1f97e854c827960c7a1da7fd8460694a1a145ae9bdd90a48b",
"ac7bd746456764639eea4bb43b5d60502ee3b18cc7e7266a62960b2b1f21a3bd",
"9797886bc01f7ab73470850cc79fe21541e286dab9f818a73e7b0f1d5f8ab838",
"017db98229f47489c899fcedcb41c3fdace8d00adbf2c828a930eeac0adc9d3a",
"2258e361a2762ded437a2d3b0793670d790d4e829d406f5a1c26c04d9b3272b2",
"07ea8b535e731f51cb197015e82ebdd1b61ceff43397df94959c3bf4244bfdb8",
"37e0a701d67c6a06b81783e27f0646071a788f0820d0d8a27d206a0e5e1bab87",
"9e9c465245061255dea8f3e4263e500ddd96ae6555a2935771688572aa57904e",
"ca8696c5c343ab883ee48998b20fdede0ea89da43921ce6aa010988091ad7ffe",
"37c760b0eafc7f9b58f43cff84ff5ea4297085645a96b5b089ace4bed6579654",
"306bd7874a05f7ee13a1977a677a901d9a803cc63a5ef51234cd09f4343b2578",
"9e862bd1ef856d4d6e897f765b3a34405a2b33f08748135fa49782b36ebd018e",
"9bdf82e391f7a415200b564cdb41e30b1d79e8550aaa2e100d0c93214dd02f84",
"c58f9d86f624efcbae62ee01cadf7f1b974a9a0d1741c5a5add3d4baa4d54a57",
"a41205a558148bc2c24c25d3f08abec0eb76371ac071cddba1a0b74f0b00b2d5",
"8799abc56859269cc034e87b4c795b7c756db289b66d4944843bd88d44bcee0f",
"ccfd5404af0d7ee5866e65ad1d420152be2591a339bb8cbfc8946f5789c5d46e",
"ea56bed52ff1544be1fa04010a8a6d50c3beb9b249bd125b253006798c9c146e",
"9f5c23b53933d5f52430f6c8d2e20b501e4747517856ee6f9e42b3c2ab3dfd93",
"13c6283059d08e83b7a3e2823887746105c8161df2c43172a21ce81d73bf8e94",
"62e109d54a8359628072dbd611f7c7d86a4aeb24093a79bd5e62a6212946f058",
"00d37fb6a8bd4746bdee78fd703dbc21d571d281d270b90d315f47f807a9c8f7",
"72b5749554816682dfb490f9a6e84c031fb257e066257de5ca38f9e61d8336e3",
"5f736aae1dc7165be27fcbcde0424a7e81efe6ba23ea3b9ff18fe33e85edeadf",
"82e781edecfed6f8cff7217aa7bb9843cfa050223670313f53439e5bb1cd581d",
"2a7c33ab17ae5b68ddb6ab18157e29cd3146c170d638747d9f850bf820a0c106",
"54638e8b4dd3721bd5e1b6ebb92d0d6269d7b3d1bb532f754860d0496657aca5",
"f609d30438dc792107ed97d1040d5ab51d6dcf74b023429eb4cb7b687058fe44",
"f4416eccaa2b90b2b28907dfc4560e63a4880c5c627cbf24225d68d17e3bad0d",
"27ba6138b23ce0c3979de1943b282cbafff52a212db9665833bfefc22e1cd6a9",
"7d3cd0fe51defbe28fac6447250b2c57614046739fb5fb9704d191470a88b629",
"3d34c42f7038328efcffd83f12448f79d1b601aee0bb5aa9559a161715309b6e",
"da3253068d029fcc47026cd1698316c65e9b8e30f1c33cea367e4af87569309b",
"5b7ca1d07a9185644749ca361db6faa04b2c2fa7b6e23eba0d5e824e2294f4d3",
"82522459c674f01cfeacc600ebbb5cffeabcd371613f5632f5c496c4018057f9",
"72dc38d3ea4c917495c4c7eaa34f372d90dbedb9e41b6c6d2fd14649bcde3f11",
"b6fa4a96d2aa0be036845b6180c8cbd03cf0e37f8f68cee4f13972bd29ba5dcc",
"e4ddf2cdc4a372df492d9a3babd06b2e2e8eb3ff0f065332b066f54bf801718e",
"7feaf1dc3f234c715e107461be06c7952c497374ad6feb1f352de690a62b5f8d",
"edcd3c7d093d2e0bfeefaedd493c4f7bd8a2a13733b072c9c009308e45830dcb",
"a5be7f4f6ae2aa30f391de192f89e83a2f494f0b0a29c9d4c25072e7cdbd4e8c",
"a85212783e0614f7191cb6ea96361fd136be9afaa74c2dfe011f2a02b51acade",
"bd3f233278c255bb4ef6cb83f2b2a3dd7daf8788aedb4f37db893ed2eb233055",
"da0646ae2080593fe95ad475e9f88a61aaa5c67f45c88db1159afc6c808a395e",
"635d187d98ca46b0916f83a3cb8c5e306c87519b0d97efd0b3a053be10726cae",
"493463e004d5e760427057f25a9309dd1a7ccd8db7ff678385c0956a0df4ed6b",
"f551dad30b92a9dc572768ec8b7d5cfdea6cbdf3d6a2612caa0a446604948d81",
"7fccc7de25a0723a7fb96c82da7b3dfb90d13a040912e28390aa1893cfb9544c",
"994aa24a02e2a4767c4b8c505a798d4ef2a9b6a56f457b165662951e087827ff",
"ddcd5fcb63faeb2de4736f716384ba8033e4caf80531c6be879abcb7d1e2e3c4",
"de319d6d3cc31892b31798aa382d3bbadbfb5c63b5d085d44535753cd1154d88",
"bf0a1dee65b36efc72d9d47081064cd1478a41eb2930f5f209efde82ad81a90f",
"58250251ac29c974e1c172ed7891f7b8918dc92722738051a2d47652fa15cb0c",
"9d54d9c89ba4bb7bc44eaa92ba162851c425e6da7061712971a816d2f76226e9",
"f8606f3d9cc85dd938e7c81c80bf459b704ee2fcf90dd5db2b22a57e9063b2d1",
"9146f5fbfa4b9d0c6fb5d3fc754114f45b2960b0160bc5ec8049c766cb159a8f",
"2a8fcf1082f08ad75bd679e43c331d8c68dd125583a0215a9d791f2dedacd252",
"1cc30cac847d1f4cb3be1a6548320587083f8a140360720cf6e602643604db55",
"f12ee7fa2a4f6c67ff363515af5d5ff269c2888c5cb0b1ef65b51c532c6513fe",
"1fb7c9b0e42cc75c72f80ceab00ddbf1c53b79f0079afdc7f2d12a0b1362d470",
"4204700c6c144ea21dcf35004c506abf1b4c31c7e56cb7593fe91a0df7a7e4bf",
"1604b6be565a34d390015a69d4ce4939d1223a2a7340c665516cc268896f7302",
"945f03992308869fd8c3cb866d587bc02cce18718491eb014e4c3a2d2b9910db",
"b1483d183ecec1757c21ea90abe833ec6c7473e69be22fab59a804f469844fbc",
"699ec626d2c4044b8fd95a6187b6b670f00b3e357f6147b5225f8b0b53855c08",
"07b37382fee8cebab882854cf3ea1c05ada71ea88288333a878271c9a2d11c83",
"4210279021308f9a52367d78c3527904da8d3488388dc78e49c435695f300f15",
"616e4309c7b433d282b0727984cd797d0f384975749b34c12cba56b3bc6ec770",
"6791837bb4b63b58877031e95b7e5d8556310b5f5bcbe40432ea41cd3d0a29e6"
]
}
+67 -4
View File
@@ -22,6 +22,8 @@ User: alice / secret.
import html
import json
import secrets
import select
import socket
import threading
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
@@ -31,6 +33,8 @@ from urllib.parse import parse_qs, urlencode, urlsplit
from fakeweb import sites
CACHE_PAGES = "no-cache"
#: Most records kept per start(): a long run of the site is not a memory leak.
MAX_RECORDS = 50000
STATE = None # the State of the running site (set by start): the walk tells it the current step
USER, PASSWORD = "alice", "secret"
N_ARTICLES = 30
@@ -365,6 +369,17 @@ class State:
self.walk = 0
self.cond = threading.Condition()
self.released = set()
#: What the server itself saw, in order, for a test that saves it when it fails (`start(...)[2].state.records`; nothing else reads
#: it): one `accept` per TCP connection and one `request` per request, with `time.perf_counter()` of this process as `m_*` (the
#: scale of the client's log) and `time.time()` as `t_*`; for a held request (`/hold`) also when the hold began and ended, why
#: it ended, and when the server first saw the browser's end of the connection closed.
self.records = []
def note(self, record):
with self.lock:
if len(self.records) < MAX_RECORDS:
self.records.append(record)
return record
def set_step(self, n):
with self.cond:
@@ -388,13 +403,17 @@ class State:
self.released.add(rid)
self.cond.notify_all()
def hold(self, rid, until=0, failsafe=90.0):
def hold(self, rid, until=0, failsafe=90.0, watch=None):
"""Block until /release?id=rid arrives, or the walk reaches step `until`; the failsafe only
keeps a lost event from blocking a thread forever."""
keeps a lost event from blocking a thread forever. Returns why it ended (`released`, `step`, `failsafe`);
`watch`, if given, is called every half second while waiting (it only looks)."""
end = time.time() + failsafe
with self.cond:
while rid not in self.released and not (until and self.step >= until) and time.time() < end:
self.cond.wait(0.5)
if watch is not None:
watch()
return "released" if rid in self.released else "step" if (until and self.step >= until) else "failsafe"
def record(self, idx, method, path, q):
"""Server-side log: what the server saw, tagged with the walk step that was current."""
@@ -425,6 +444,11 @@ class Site(ThreadingHTTPServer):
self.idx = idx
self.state = state
def process_request(self, request, client_address):
self.state.note({"ev": "accept", "t": round(time.time(), 4), "m": round(time.perf_counter(), 6), "site": self.idx,
"peer": client_address[1]})
super().process_request(request, client_address)
class Handler(BaseHTTPRequestHandler):
protocol_version = "HTTP/1.1"
@@ -451,6 +475,11 @@ class Handler(BaseHTTPRequestHandler):
self.end_headers()
if body and self.command != "HEAD":
self.wfile.write(body)
rec = getattr(self, "_rec", None)
if rec is not None:
rec["status"] = code
rec["t_answer"] = round(time.time(), 4)
rec["m_answer"] = round(time.perf_counter(), 6)
def _html(self, text, code=200, headers=()):
self._send(code, "text/html; charset=utf-8", text.encode(), headers, cache=CACHE_PAGES)
@@ -460,10 +489,32 @@ class Handler(BaseHTTPRequestHandler):
def _guard(self, fn):
# Browsers abort requests on purpose; a dropped socket is not an error here.
state = self.server.state
rec = self._rec = state.note({
"ev": "request", "t_arrive": round(time.time(), 4), "m_arrive": round(time.perf_counter(), 6), "site": self.server.idx,
"peer": self.client_address[1], "method": self.command, "path": self.path, "walk": state.walk, "step": state.step,
"status": None, "t_answer": None, "m_answer": None, "t_done": None, "m_done": None, "error": None})
try:
fn()
except (BrokenPipeError, ConnectionResetError, ConnectionAbortedError, TimeoutError):
except (BrokenPipeError, ConnectionResetError, ConnectionAbortedError, TimeoutError) as exc:
rec["error"] = type(exc).__name__
self.close_connection = True
except BaseException as exc:
rec["error"] = type(exc).__name__
raise
finally:
rec["t_done"] = round(time.time(), 4)
rec["m_done"] = round(time.perf_counter(), 6)
def _peer_closed(self):
"""Whether the browser has closed its end of this connection (a peek: nothing is read from it)."""
try:
readable, _w, _x = select.select([self.connection], [], [], 0)
return bool(readable) and self.connection.recv(1, socket.MSG_PEEK) == b""
except (BlockingIOError, InterruptedError):
return False
except (OSError, ValueError):
return True
def do_GET(self):
self._guard(self._get)
@@ -570,7 +621,18 @@ class Handler(BaseHTTPRequestHandler):
return self._send(200, "text/plain", b"ok", cache="no-store")
if p == "/hold":
until = int(q.get("until", ["0"])[0] or 0)
self.server.state.hold(q.get("id", [""])[0], until)
rec = self._rec
def watch():
if rec.get("m_peer_closed_seen") is None and self._peer_closed():
rec["t_peer_closed_seen"] = round(time.time(), 4)
rec["m_peer_closed_seen"] = round(time.perf_counter(), 6)
rec["t_hold_start"], rec["m_hold_start"] = round(time.time(), 4), round(time.perf_counter(), 6)
rec["hold_until_step"], rec["m_peer_closed_seen"] = until, None
rec["hold_ended_by"] = self.server.state.hold(q.get("id", [""])[0], until, watch=watch)
rec["t_hold_end"], rec["m_hold_end"], rec["step_at_hold_end"] = round(time.time(), 4), round(time.perf_counter(), 6), self.server.state.step
watch()
return self._send(200, "application/json", b'{"held":true}', cache="no-store")
if p == "/stream":
# headers and 10 of 20 body bytes at once; the rest after a short wait
@@ -635,6 +697,7 @@ def start(ports=(8321, 8322), bind="127.0.0.1", public_host="127.0.0.1", other_h
s.shutdown()
s.server_close()
stop.state = state # the server's own record (`state.records`), kept after stop()
global STATE
STATE = state
return state.origins[0], state.origins[1], stop
+203 -7
View File
@@ -8,6 +8,8 @@ verdict is "same outcome as stock".
"""
from __future__ import annotations
import json
import re
import time
BLOCKED = ("image", "media")
@@ -17,13 +19,26 @@ def install_route(context):
context.route("**/*", lambda route: route.abort() if route.request.resource_type in BLOCKED else route.continue_())
def navigate(page, url, *, idle_timeout_ms):
def navigate(page, url, *, idle_timeout_ms, client_log=None, lifecycle_probe=None):
"""`lifecycle_probe`, a function (default None: nothing), is called the moment the wait for networkidle expires and its answer is kept in `lifecycle_open`
of the cell (`lifecycle_open_requests`). `client_log`, a list (default None: nothing kept), gets one entry per event the client heard (wall time `t`, time.time(), and `m`, time.perf_counter()):
the navigation's start and end, and every request, its response and its end. A test that saves evidence when it fails passes it."""
rec = {"idle": False, "err": None, "seconds": None}
# The requests the client has heard of and not yet heard the end of: a navigation that does not idle says who is still in flight
# (type, method, url, frame). The process that hosts a request is not readable by a client.
open_requests = {}
def note(event, request=None, **more):
if client_log is None:
return
entry = {"ev": event, "t": round(time.time(), 4), "m": round(time.perf_counter(), 6), "url": url}
if request is not None:
entry.update(req=id(request), type=request.resource_type, method=request.method, target=request.url[:160])
entry.update(more)
client_log.append(entry)
def started(request):
note("request", request)
try:
frame = request.frame.url[:100]
except Exception:
@@ -33,11 +48,18 @@ def navigate(page, url, *, idle_timeout_ms):
def ended(request):
open_requests.pop(id(request), None)
note("ended", request)
def answered(response):
note("response", response.request, status=response.status)
t0 = time.monotonic()
page.on("request", started)
if client_log is not None:
page.on("response", answered)
page.on("requestfinished", ended)
page.on("requestfailed", ended)
note("navigation_start")
try:
page.goto(url, wait_until="commit", timeout=15000)
page.wait_for_load_state("networkidle", timeout=idle_timeout_ms)
@@ -45,18 +67,188 @@ def navigate(page, url, *, idle_timeout_ms):
except Exception as exc: # recorded, the run goes on: the verdict compares outcomes
text = str(exc).strip()
rec["err"] = (text.splitlines()[0] if text else repr(exc))[:200]
rec["in_flight"] = list(open_requests.values())[:30]
# First thing at the expiry, before anything else is read: what the served browser's own lifecycle holds as open is what keeps networkidle away.
if lifecycle_probe is not None:
rec["expired_at"] = {"t": round(time.time(), 4), "m": round(time.perf_counter(), 6)}
try:
rec["lifecycle_open"] = lifecycle_probe()
except Exception as problem: # the evidence never changes the outcome it is about
rec["lifecycle_open"] = [{"error": repr(problem)}]
# The WHOLE list, not a head of it: what is left open is the question.
rec["in_flight"] = list(open_requests.values())
finally:
for event, handler in (("request", started), ("requestfinished", ended), ("requestfailed", ended)):
for event, handler in (("request", started), ("response", answered), ("requestfinished", ended), ("requestfailed", ended)):
try:
page.remove_listener(event, handler)
except Exception:
pass
rec["seconds"] = round(time.monotonic() - t0, 2)
note("navigation_end", idle=rec["idle"], err=rec["err"])
return rec
def drive(browser, origin, patterns, repetitions, idle_timeout_ms=10000):
def lifecycle_open_requests(server):
"""What the in-process server of a served browser (`launch_server()`) holds as OPEN, per page: the lifecycle's own map of the requests it waits the end of
(`Lifecycle._open`: request id -> (owner frame, navigation)), each with what the lifecycle knows of its owner frame, and the frame tree. A client cannot
read it: the test reaches the lifecycle through the registry of the server (`RemoteServer._endpoint.server._objects`, whose `Page` objects are the
`PageDispatcher`s, each with its `lifecycle`). Read-only; the lifecycle's lock is taken for at most two seconds, and the dump says when it was not."""
pages = []
for obj in list(server._endpoint.server._objects.values()):
if getattr(obj, "TYPE", None) != "Page":
continue
try:
lifecycle = obj.lifecycle
except Exception:
continue
locked = lifecycle._cv.acquire(timeout=2)
try:
frames = dict(lifecycle.frames)
held = list(lifecycle._open.items())
main = lifecycle.main_frame
tree = lifecycle.frame_tree()
finally:
if locked:
lifecycle._cv.release()
opened = []
for rid, (owner, navigation) in held:
frame = frames.get(owner or main)
opened.append({"rid": rid, "owner": owner, "navigation": navigation, "owner_is_known": (owner in frames) if owner else None,
"owner_url": frame.url if frame else None, "owner_parent": frame.parent if frame else None,
"owner_navigation": frame.navigation if frame else None, "owner_states": sorted(frame.states) if frame else None})
pages.append({"page": obj.guid, "main_frame": main, "lock_taken": locked, "open": opened, "frame_tree": tree})
return pages
# ---- the history of the requests still open, read from the Juggler wire (tests/_evidence_on_failure.py writes it) -----------------------------------
#: The commands that answer an intercepted request, and the events of a frame that matter around a request of it.
INTERCEPT_COMMANDS = ("Network.resumeInterceptedRequest", "Network.abortInterceptedRequest", "Network.fulfillInterceptedRequest")
FRAME_EVENTS = ("Page.frameAttached", "Page.frameDetached", "Page.navigationStarted", "Page.navigationCommitted", "Page.navigationAborted",
"Page.sameDocumentNavigation")
#: Seconds of a frame's events kept before a request and after it.
FRAME_WINDOW = (1.0, 20.0)
_FIELDS = ("requestId", "frameId", "url", "navigationId", "errorCode")
def _string_field(text, name):
found = re.search(r'"%s"\s*:\s*"((?:[^"\\]|\\.)*)"' % name, text)
return found.group(1) if found else None
def _wire_events(lines):
"""The records of the wire log (one JSON per line) as events: time, direction and the message; a message the log cut is read from the fields it still shows."""
events = []
for line in lines:
try:
record = json.loads(line)
except ValueError:
continue
text = record.get("msg") or ""
try:
msg = json.loads(text)
except ValueError:
msg = None
if not isinstance(msg, dict):
number = re.search(r'"id"\s*:\s*(\d+)', text)
msg = {"method": _string_field(text, "method"), "id": int(number.group(1)) if number else None,
"params": {name: _string_field(text, name) for name in _FIELDS}, "_cut": True}
events.append({"t": record.get("t"), "m": record.get("m"), "dir": record.get("dir") or "", "msg": msg})
return events
def _brief(msg, *names):
params = msg.get("params") or {}
return " ".join("%s=%s" % (n, params.get(n)) for n in names if params.get(n) is not None)
def open_requests_history(wire_lines, cells):
"""The text of `p2-open-requests-history.txt`: for each request id the lifecycle held open when a wait for networkidle expired (the `lifecycle_open` of
the cells), in time order, what the Juggler wire says of it: `requestWillBeSent` (frame, interception, address, navigation), each command that answered
the interception and its reply, `responseReceived`, `requestFinished` or `requestFailed` if any, and, around it, the `Page` events of its frame
(frameAttached/Detached, navigationStarted/Committed/Aborted): the history that says who ended it and who did not."""
events = _wire_events(wire_lines)
wanted = {}
for cell in cells or []:
for page in cell.get("lifecycle_open") or []:
for entry in page.get("open") or []:
wanted.setdefault(entry["rid"], []).append((cell, entry))
out = ["The requests the served browser's lifecycle held open when the wait for networkidle expired, and what the Juggler wire says of each.",
"t: wall clock (seconds since the epoch), m: perf_counter of the test process, +s: seconds from the request's requestWillBeSent. Around a request "
"the events of its frame are kept from %.0f s before to %.0f s after. A message longer than the wire log's limit is read from the fields "
"still readable (cut)." % FRAME_WINDOW, ""]
if not wanted:
out.append("No request was held open at an expiry (no cell was not idle, or the lifecycle could not be read).")
return "\n".join(out) + "\n"
by_request, replies = {}, {}
for ev in events:
msg = ev["msg"]
method = msg.get("method")
params = msg.get("params") if isinstance(msg.get("params"), dict) else {}
rid = params.get("requestId")
if rid is not None and method and method.startswith("Network."):
by_request.setdefault(rid, []).append(ev)
elif not method and msg.get("id") is not None and ev["dir"] == "in":
replies.setdefault(msg["id"], []).append(ev)
def line(ev, base, text):
t = ev["t"]
after = (" (+%.3fs)" % (t - base)) if (t is not None and base is not None) else ""
return " t=%s m=%s %s%s %s" % (t, ev["m"], ev["dir"].ljust(3), after, text)
def first_expiry(rid):
return min(((c.get("expired_at") or {}).get("t") or 0) for c, _e in wanted[rid])
for rid in sorted(wanted, key=first_expiry):
out.append("== request %s" % rid)
for cell, entry in wanted[rid]:
expired = cell.get("expired_at") or {}
out.append(" open at the expiry of round %s %s%s (t=%s m=%s): owner frame %s (known to the lifecycle: %s, url %s, its navigation %s, states %s), "
"the request's navigation %s" % (cell.get("round"), cell.get("pattern"), " (canary)" if cell.get("canary") else "",
expired.get("t"), expired.get("m"), entry.get("owner"), entry.get("owner_is_known"),
entry.get("owner_url"), entry.get("owner_navigation"), entry.get("owner_states"),
entry.get("navigation")))
mine = by_request.get(rid, [])
sent = [ev for ev in mine if ev["msg"].get("method") == "Network.requestWillBeSent"]
base = sent[0]["t"] if sent else None
frame = None
if not mine:
out.append(" not on the wire: its requestWillBeSent came before the wire was logged, or from another connection")
for ev in mine:
msg = ev["msg"]
method = msg["method"]
if method == "Network.requestWillBeSent":
frame = frame or (msg.get("params") or {}).get("frameId")
out.append(line(ev, base, "requestWillBeSent %s%s" % (_brief(msg, "frameId", "isIntercepted", "navigationId", "redirectedFrom", "method", "url"),
" (cut)" if msg.get("_cut") else "")))
elif method in INTERCEPT_COMMANDS:
out.append(line(ev, base, "%s sent, id=%s %s" % (method.split(".")[1], msg.get("id"), _brief(msg, "requestId"))))
answers = replies.get(msg.get("id"), [])
for reply in answers:
body = reply["msg"]
verdict = ("error " + json.dumps(body.get("error"), default=str)[:300]) if body.get("error") else "ok"
out.append(line(reply, base, " reply to id=%s: %s" % (msg.get("id"), verdict)))
if not answers:
out.append(" no reply to id=%s on the wire" % msg.get("id"))
else:
out.append(line(ev, base, "%s %s" % (method.split(".")[1], _brief(msg, "errorCode", "url"))))
if mine and not [ev for ev in mine if ev["msg"].get("method") in ("Network.requestFinished", "Network.requestFailed")]:
out.append(" no requestFinished or requestFailed for it on the wire")
if frame is not None and base is not None:
out.append(" events of its frame %s, %.0f s before to %.0f s after the request:" % ((frame,) + FRAME_WINDOW))
shown = 0
for ev in events:
msg = ev["msg"]
params = msg.get("params") if isinstance(msg.get("params"), dict) else {}
if msg.get("method") in FRAME_EVENTS and params.get("frameId") == frame and ev["t"] is not None \
and base - FRAME_WINDOW[0] <= ev["t"] <= base + FRAME_WINDOW[1]:
shown += 1
out.append(line(ev, base, "%s %s" % (msg["method"].split(".")[1], _brief(msg, "navigationId", "url", "parentFrameId", "errorText"))))
if not shown:
out.append(" none")
out.append("")
return "\n".join(out) + "\n"
def drive(browser, origin, patterns, repetitions, idle_timeout_ms=10000, client_log=None, lifecycle_probe=None):
"""Every pattern `repetitions` times, each followed by the canary. Returns a list of cells."""
cells = []
context = browser.new_context()
@@ -66,7 +258,8 @@ def drive(browser, origin, patterns, repetitions, idle_timeout_ms=10000):
for rep in range(1, repetitions + 1):
for name in patterns:
for pattern, canary in ((name, False), ("quiet", True)):
cell = navigate(page, "%s/p/%s" % (origin, pattern), idle_timeout_ms=idle_timeout_ms)
cell = navigate(page, "%s/p/%s" % (origin, pattern), idle_timeout_ms=idle_timeout_ms, client_log=client_log,
lifecycle_probe=lifecycle_probe)
cell.update(round=rep, pattern=pattern, canary=canary, after=name if canary else None)
cells.append(cell)
finally:
@@ -77,11 +270,14 @@ def drive(browser, origin, patterns, repetitions, idle_timeout_ms=10000):
return cells
def run_on_candidate(sync_playwright, binary, origin, patterns, repetitions, **kw):
"""Our engine, served over the Playwright WebSocket and driven by the stock client."""
def run_on_candidate(sync_playwright, binary, origin, patterns, repetitions, lifecycle_dump=False, **kw):
"""Our engine, served over the Playwright WebSocket and driven by the stock client. With `lifecycle_dump`, a cell that does not idle keeps what the
server's lifecycle held open when its wait expired (`lifecycle_open_requests`)."""
from invisible_playwright._juggler.remote import launch_server
server = launch_server(headless=True, binary_path=binary, locale="en-US", timezone="Europe/Rome")
if lifecycle_dump:
kw["lifecycle_probe"] = lambda: lifecycle_open_requests(server)
try:
with sync_playwright() as p:
browser = p.firefox.connect(server.ws_endpoint)
+92 -8
View File
@@ -30,32 +30,98 @@ def install_route(context):
class Tracer:
"""The requests the client has heard of and not yet heard the end of (kept for the report; never compared). With
`events` (the runner's --trace) it also keeps every request event the client reports, per step, for the request-type check."""
`events` (the runner's --trace) it also keeps every request event the client reports, per step, for the request-type check.
With `log` (a list; a test that saves evidence when it fails gives it) it keeps, apart from that, one entry per event the client
hears (request, response, requestfinished, requestfailed, and the page's own framenavigated / domcontentloaded / load), each with
the step the walk is in (`self.step`, set by the walk), its wall time `t` and `time.perf_counter()` as `m`; it only listens."""
def __init__(self, context, events=False):
def __init__(self, context, events=False, log=None):
self.open = {}
self.events = [] if events else None
self.t0 = time.monotonic()
self.log = log
self.step = 0
self.detail = {}
context.on("request", self._started)
context.on("requestfinished", lambda r: self._ended(r, "finished"))
context.on("requestfailed", lambda r: self._ended(r, "failed"))
if log is not None:
context.on("response", self._answered)
context.on("page", self._page_opened)
def _started(self, r):
self.open[r] = "%s %s" % (r.resource_type, r.url.split("/", 3)[-1][:70])
self._event(r, "request")
entry = self._logged(r, "request")
if entry is not None:
self.detail[r] = {k: entry[k] for k in ("step", "m", "type", "method", "url", "frame")}
def _ended(self, r, kind):
self.open.pop(r, None)
self.detail.pop(r, None)
self._event(r, kind)
more = {}
if kind == "failed" and self.log is not None:
try:
more["failure"] = str(r.failure)[:200]
except Exception:
more["failure"] = None
self._logged(r, "requestfinished" if kind == "finished" else "requestfailed", **more)
def _event(self, r, kind):
if self.events is not None:
self.events.append({"ev": kind, "type": r.resource_type, "method": r.method,
"url": "/" + r.url.split("/", 3)[-1][:90], "t": round(time.monotonic() - self.t0, 3)})
def _logged(self, r, kind, **more):
"""One entry of the log; a failure of the recording is never the client's (the walk goes on, the entry is missing)."""
if self.log is None:
return None
try:
try:
frame = r.frame.url[:160]
except Exception:
frame = None
entry = {"ev": kind, "step": self.step, "t": round(time.time(), 4), "m": round(time.perf_counter(), 6), "req": id(r),
"type": r.resource_type, "method": r.method, "url": r.url[:200], "frame": frame}
entry.update(more)
self.log.append(entry)
return entry
except Exception:
return None
def _answered(self, response):
try:
self._logged(response.request, "response", status=response.status)
except Exception:
pass
def _page_opened(self, page):
try:
for name in ("framenavigated", "domcontentloaded", "load"):
page.on(name, lambda arg, name=name: self._page_event(page, name, arg))
self._page_event(page, "page", None)
except Exception:
pass
def _page_event(self, page, name, arg):
try:
url = (arg.url if name == "framenavigated" else page.url)[:200]
except Exception:
url = None
try:
self.log.append({"ev": name, "step": self.step, "t": round(time.time(), 4), "m": round(time.perf_counter(), 6), "page": id(page), "url": url})
except Exception:
pass
def snapshot(self):
return sorted(self.open.values())[:12]
def in_flight(self):
"""What the client counts as in flight now, with how long (`age_s`) and from which step (`step`); `log` only."""
now = time.perf_counter()
return [dict(d, age_s=round(now - d["m"], 3)) for d in sorted(self.detail.values(), key=lambda d: d["m"])]
def take_events(self):
taken, self.events = self.events, []
return taken
@@ -326,13 +392,20 @@ def snapshot(j, pg, rec):
rec["url"] = j.norm(pg.url)
def run_round(j, tracer, round_no, idle_timeout_ms):
def run_round(j, tracer, round_no, idle_timeout_ms, step_log=None):
"""`step_log`, a list (default None: nothing kept), receives each step's record as soon as it is done, with the moments of the step
(`m_*`: time.perf_counter(), the scale of the client log and of the site's record) and what the client counted as in flight when
`networkidle` returned or gave up: for a test that saves evidence when it fails. Never compared."""
out = []
walk = journey_site.STATE.begin_walk() # the site tags what it sees with the walk, stock and ours both use steps 1..N
for n, (name, method) in enumerate(STEPS, 1):
j.extra = {}
tracer.step = n
m_before_set_step = time.perf_counter()
journey_site.STATE.set_step(n) # a held response of the site is released when the walk reaches its step
rec = {"round": round_no, "n": n, "name": name, "ok": False, "error": None}
if step_log is not None:
rec["m_step_start"], rec["t_step_start"] = round(m_before_set_step, 6), round(time.time(), 4)
t0 = time.monotonic()
pg, cleanup = j.page, None
try:
@@ -340,12 +413,19 @@ def run_round(j, tracer, round_no, idle_timeout_ms):
rec["ok"] = True
except Exception as exc:
rec["error"] = first_line(exc)
if step_log is not None:
rec["m_action_end"] = round(time.perf_counter(), 6)
try:
pg.wait_for_load_state("networkidle", timeout=idle_timeout_ms)
rec["idle"] = True
except Exception:
except Exception as exc:
rec["idle"] = False
if step_log is not None:
rec["idle_error"] = first_line(exc)
rec["open_at_idle_end"] = tracer.snapshot() # for the report, not compared
if step_log is not None:
rec["m_idle_end"], rec["t_idle_end"] = round(time.perf_counter(), 6), round(time.time(), 4)
rec["in_flight_at_idle_end"] = tracer.in_flight()
if tracer.events is not None:
rec["client_events"] = tracer.take_events()
snapshot(j, pg, rec)
@@ -359,6 +439,8 @@ def run_round(j, tracer, round_no, idle_timeout_ms):
rec["error"] = rec["error"] or ("cleanup: " + first_line(exc))
rec["seconds"] = round(time.monotonic() - t0, 2)
out.append(rec)
if step_log is not None:
step_log.append(rec)
if tracer.events is not None:
# read once, at the end: a request fired on pagehide reaches the server after its step's own work is done
time.sleep(0.5)
@@ -367,9 +449,11 @@ def run_round(j, tracer, round_no, idle_timeout_ms):
return out
def drive(browser, origin_a, origin_o, rounds=1, idle_timeout_ms=15000, trace=False):
def drive(browser, origin_a, origin_o, rounds=1, idle_timeout_ms=15000, trace=False, client_log=None, step_log=None):
"""`rounds` walks, each in a fresh context and a fresh page. Returns the step records. `trace`: keep, per step, the request
events the client reported and the hits the server saw (for the report; never compared)."""
events the client reported and the hits the server saw (for the report; never compared). `client_log` and `step_log`, two lists
(default None: nothing kept), are filled as the walk goes with what the client heard (`Tracer`) and with each step's record
(`run_round`): for a test that saves evidence when it fails."""
records = []
for r in range(1, rounds + 1):
context = browser.new_context()
@@ -377,9 +461,9 @@ def drive(browser, origin_a, origin_o, rounds=1, idle_timeout_ms=15000, trace=Fa
context.set_default_timeout(TIMEOUT_MS)
context.set_default_navigation_timeout(TIMEOUT_MS)
install_route(context)
tracer = Tracer(context, events=trace)
tracer = Tracer(context, events=trace, log=client_log)
page = context.new_page()
records += run_round(Journey(context, page, origin_a, origin_o), tracer, r, idle_timeout_ms)
records += run_round(Journey(context, page, origin_a, origin_o), tracer, r, idle_timeout_ms, step_log)
finally:
try:
context.close()
+43 -1
View File
@@ -302,11 +302,27 @@ def frame_html(kind, own, other, params):
) % (kind, kind, body)
#: Most records kept per start(): a long run of the fake web is not a memory leak.
MAX_RECORDS = 50000
class State:
def __init__(self):
self.origins = ["", ""]
self.hits = {}
self.lock = threading.Lock()
#: What the server itself saw, in order: one `accept` per TCP connection and one `request` per request, each with its
#: wall times (time.time(): arrival of the request, answer written, handler done; the Windows wall clock ticks every 15 ms, so
#: the same moments are also kept as `m_*`, time.perf_counter() of this process, the scale of the client's log) and, if the
#: client went away, the error.
#: Read by a test that saves it as evidence when it fails (`start(...)[2].state.records`); nothing else reads it.
self.records = []
def note(self, record):
with self.lock:
if len(self.records) < MAX_RECORDS:
self.records.append(record)
return record
def hit(self, path):
with self.lock:
@@ -323,6 +339,11 @@ class Site(ThreadingHTTPServer):
self.idx = idx
self.state = state
def process_request(self, request, client_address):
self.state.note({"ev": "accept", "t": round(time.time(), 4), "m": round(time.perf_counter(), 6), "site": self.idx,
"peer": client_address[1]})
super().process_request(request, client_address)
class Handler(BaseHTTPRequestHandler):
protocol_version = "HTTP/1.1"
@@ -340,15 +361,34 @@ class Handler(BaseHTTPRequestHandler):
for k, v in (extra or {}).items():
self.send_header(k, v)
self.end_headers()
rec = getattr(self, "_rec", None)
if rec is not None:
rec["status"] = code
if body and self.command != "HEAD":
self.wfile.write(body)
if rec is not None:
rec["t_answer"] = round(time.time(), 4)
rec["m_answer"] = round(time.perf_counter(), 6)
def _guard(self, fn):
# Browsers abort requests on purpose; a dropped socket is not an error here.
wanted = ("Host", "Origin", "Referer", "Content-Type", "Content-Length", "Sec-Fetch-Site", "Sec-Fetch-Dest")
rec = self._rec = self.server.state.note({
"ev": "request", "t_arrive": round(time.time(), 4), "m_arrive": round(time.perf_counter(), 6), "site": self.server.idx, "peer": self.client_address[1],
"method": self.command, "path": self.path,
"headers": {k: self.headers.get(k) for k in wanted if self.headers.get(k) is not None},
"status": None, "t_body": None, "t_answer": None, "t_done": None, "error": None})
try:
fn()
except (BrokenPipeError, ConnectionResetError, ConnectionAbortedError, TimeoutError):
except (BrokenPipeError, ConnectionResetError, ConnectionAbortedError, TimeoutError) as exc:
rec["error"] = type(exc).__name__
self.close_connection = True
except BaseException as exc:
rec["error"] = type(exc).__name__
raise
finally:
rec["t_done"] = round(time.time(), 4)
rec["m_done"] = round(time.perf_counter(), 6)
def do_GET(self):
self._guard(self._get)
@@ -367,6 +407,7 @@ class Handler(BaseHTTPRequestHandler):
n = int(self.headers.get("Content-Length") or 0)
if n:
self.rfile.read(n)
self._rec["t_body"] = round(time.time(), 4)
self.server.state.hit(u.path)
self._send(204, None, b"")
@@ -453,6 +494,7 @@ def start(ports=(8311, 8312), bind="127.0.0.1", public_host=("127.0.0.1", "local
s.shutdown()
s.server_close()
stop.state = state # the server's own record (`state.records`), kept after stop()
return state.origins[0], state.origins[1], stop
@@ -0,0 +1,93 @@
"""A real click inside an iframe: `screenX - clientX` is the iframe's own `mozInnerScreenX`.
What it fixes: the relation a page checks with one subtraction on every mouse event, `event.screenX - event.clientX ==
window.mozInnerScreenX` (and the same on Y), INSIDE an iframe placed at (220, 150) of the page. The defect of 2026-08-10:
`mozInnerScreenX/Y` answered the origin of the top-level content to every window, so the iframe read (top origin) while
its events still carried the iframe's offset, and `screenX - clientX` was 220 against a `mozInnerScreenX` of 0.
Engine hook: `fingerprint/screen-window/geometry` of the engine series: `nsGlobalWindowOuter::GetMozInnerScreenX/Y` and
`Event::GetScreenCoords` both add the ONE content origin shift (`nsGlobalWindowOuter::StealthContentOriginShift`, declared
window against real one) to the window's OWN real rectangle, so the offset between frames stays true at every depth.
Control, in the same test: the top window's `mozInnerScreenX/Y` is a different number (the iframe sits 220 and 150 CSS
pixels off it). The test asserts the iframe's `mozInnerScreenX/Y` is the top's plus the iframe's rectangle, and that what
the events carry (`screenX - clientX`) is NOT the top's origin: a window that answered the top origin to every frame fails
both.
The click is a real one (`page.mouse.click` at a point inside the iframe, the pointer events the engine makes), not a
dispatched event. The page and the iframe are one site, so the page may read the iframe's `mozInnerScreenX`.
"""
from __future__ import annotations
import pytest
from _fission_frames import Sites
from _waits import wait_until
pytestmark = pytest.mark.e2e
LEFT, TOP = 220, 150
PARENT = """<!doctype html><meta charset=utf-8><title>parent</title>
<style>html,body{margin:0;padding:0;height:100%%}
#f{position:absolute;left:%dpx;top:%dpx;width:360px;height:220px;border:0}</style>
<body><iframe id=f src="/child"></iframe>
<script>
window.__geom = () => {
const w = document.getElementById('f').contentWindow;
const r = document.getElementById('f').getBoundingClientRect();
return {top_x: window.mozInnerScreenX, top_y: window.mozInnerScreenY,
ifr_x: w.mozInnerScreenX, ifr_y: w.mozInnerScreenY, rect_x: r.x, rect_y: r.y};
};
</script>""" % (LEFT, TOP)
CHILD = """<!doctype html><meta charset=utf-8><title>child</title>
<style>html,body{margin:0;padding:0;height:100%}
#g{position:absolute;left:30px;top:40px;width:220px;height:130px;background:#06c}</style>
<body><div id=g>y</div>
<script>
window.__ev = [];
for (const t of ['mousemove', 'mousedown', 'mouseup', 'click']) {
window.addEventListener(t, e => {
window.__ev.push({t: t, cx: e.clientX, cy: e.clientY, sx: e.screenX, sy: e.screenY});
}, true);
}
window.__inner = () => [window.mozInnerScreenX, window.mozInnerScreenY];
</script>"""
def test_a_real_click_in_an_iframe_has_the_screen_origin_of_the_iframe(firefox_binary):
from invisible_playwright import InvisiblePlaywright
with Sites() as s:
s.route("A", "/parent", PARENT)
s.route("A", "/child", CHILD)
with InvisiblePlaywright(seed=42, binary_path=firefox_binary, headless=True, humanize=False) as browser:
page = browser.new_page()
page.goto(s.url("A", "/parent"), wait_until="load", timeout=30000)
geom = page.evaluate("() => window.__geom()")
frame = page.frames[1]
frame.evaluate("() => { window.__ev = []; }")
# a point inside the blue square of the iframe, in the coordinates of the page
page.mouse.click(LEFT + 30 + 100, TOP + 40 + 60)
kinds = {"mousedown", "mouseup", "click"}
assert wait_until(lambda: kinds <= {e["t"] for e in frame.evaluate("() => window.__ev")}, 30,
lambda: page.wait_for_timeout(100)), (
"the iframe heard %r of the click" % [e["t"] for e in frame.evaluate("() => window.__ev")])
events = frame.evaluate("() => window.__ev")
inner = frame.evaluate("() => window.__inner()")
# the iframe is where it was put, and answers its OWN origin: the top's plus the iframe's rectangle
assert (geom["rect_x"], geom["rect_y"]) == (LEFT, TOP)
assert (geom["ifr_x"], geom["ifr_y"]) == (geom["top_x"] + geom["rect_x"], geom["top_y"] + geom["rect_y"]), (
"the iframe reads mozInnerScreen (%r, %r), the page's is (%r, %r) and the iframe sits at (%d, %d)"
% (geom["ifr_x"], geom["ifr_y"], geom["top_x"], geom["top_y"], LEFT, TOP))
assert (inner[0], inner[1]) != (geom["top_x"], geom["top_y"]), "the iframe answers the origin of the top-level content"
clicks = [e for e in events if e["t"] == "click"]
assert clicks, "no click event in the iframe: %r" % events
for e in events:
assert e["sx"] - e["cx"] == inner[0], (
"%s in the iframe: screenX - clientX = %r against mozInnerScreenX = %r" % (e["t"], e["sx"] - e["cx"], inner[0]))
assert e["sy"] - e["cy"] == inner[1], (
"%s in the iframe: screenY - clientY = %r against mozInnerScreenY = %r" % (e["t"], e["sy"] - e["cy"], inner[1]))
# the control: the top window's origin is NOT what the events carry
assert (e["sx"] - e["cx"], e["sy"] - e["cy"]) != (geom["top_x"], geom["top_y"])
@@ -0,0 +1,162 @@
"""A context's language is the Accept-Language of every request that context makes, byte for byte, whatever the kind of request.
Characterisation of firefox-68 for the hook of fingerprint/locale-time/accept-language (nsHttpHandler.cpp: the list a language override
is prepared into). The sibling file
``test_accept_language_on_the_wire_e2e.py`` pins the LAUNCH language; this one pins the language of a CONTEXT that asks for its own,
which reaches the engine another way (``Browser.setLocaleOverride`` writes the BrowsingContext's LanguageOverride, where the launch
language is seeded from a pref) and which a request that has no BrowsingContext (a fetch of a worker, a service worker's) gets from the
owner's data instead.
The header is read where a server reads it: the raw header line on a local socket. A retail Firefox 151 whose only pref is the
``intl.accept_languages`` the core writes for it-IT ("it-IT, it, en-US, en") sends ``it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7`` on every
request below (measured, see the sibling file). The kinds: the navigation, a sub-frame, an image, a stylesheet, a script, a ``fetch``, an
XHR, a dedicated worker's script and its ``fetch``, a shared worker's script and its ``fetch``, a service worker's script and its ``fetch``.
The control is the other context of the same browser, which asked for nothing and keeps the launch's de-DE: every one of ITS requests
carries the de-DE header and none carries Italian, so the header the first context sends is its own and not the session's.
On firefox-68 the four kinds a shared worker and a service worker make (the worker's script and its ``fetch``) carry the SESSION's de-DE
header even from the it-IT context, on Linux and on Windows alike: the engine does not give those workers the context's language. They
are left out of the it-IT context's check here and pinned, asking for it-IT, in
``test_accept_language_of_the_context_in_shared_and_service_workers_e2e.py``. The de-DE control is checked on all of them.
"""
from __future__ import annotations
import socket
import threading
import pytest
pytestmark = pytest.mark.e2e
#: invisible_core's list for it-IT / de-DE, prepared the way Firefox prepares intl.accept_languages (retail 151, measured).
RETAIL_IT_IT = "it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7"
RETAIL_DE_DE = "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7"
#: A 1x1 PNG.
PNG = bytes.fromhex(
"89504e470d0a1a0a0000000d4948445200000001000000010806000000"
"1f15c4890000000d49444154789c6360f8cfc0f01f0005000201a5f645400000000049454e44ae426082")
PAGE = b"""<!doctype html><meta charset=utf-8><title>al</title>
<link rel=stylesheet href=/style.css><script src=/script.js></script>
<iframe src=/frame></iframe><img src=/image.png>
<script>
(async () => {
await fetch('/fetch').then((r) => r.text());
await new Promise((ok) => { const x = new XMLHttpRequest(); x.open('GET', '/xhr'); x.onloadend = ok; x.send(); });
await new Promise((ok) => { const w = new Worker('/worker.js'); w.onmessage = ok; });
await new Promise((ok) => { const s = new SharedWorker('/shared.js'); s.port.onmessage = ok; });
await navigator.serviceWorker.register('/sw.js');
await navigator.serviceWorker.ready;
document.title = 'done';
})();
</script>"""
BODIES = {
"/": (PAGE, b"text/html"),
"/frame": (b"<!doctype html><title>frame</title>", b"text/html"),
"/style.css": (b"body{}", b"text/css"),
"/script.js": (b"window.loaded = 1;", b"text/javascript"),
"/image.png": (PNG, b"image/png"),
"/worker.js": (b"fetch('/worker-fetch').then((r) => r.text()).then(() => postMessage(1));", b"text/javascript"),
"/shared.js": (b"onconnect = (e) => { fetch('/shared-fetch').then((r) => r.text()).then(() => e.ports[0].postMessage(1)); };",
b"text/javascript"),
# The install waits for the service worker's own fetch, so `ready` resolves after it.
"/sw.js": (b"addEventListener('install', (e) => e.waitUntil(fetch('/sw-fetch').then((r) => r.text())));", b"text/javascript"),
}
#: Every path a page of the site makes a request for (the favicon is the browser's own and is left out).
KINDS = {
"/": "navigation", "/frame": "sub-frame navigation", "/style.css": "stylesheet", "/script.js": "script", "/image.png": "image",
"/fetch": "fetch", "/xhr": "XHR", "/worker.js": "dedicated worker script", "/worker-fetch": "dedicated worker fetch",
"/shared.js": "shared worker script", "/shared-fetch": "shared worker fetch", "/sw.js": "service worker script",
"/sw-fetch": "service worker fetch",
}
#: The kinds that carry the session's header, not the context's, on firefox-68 (the context's own list is asserted for them elsewhere).
SESSION_HEADER_KINDS = {"shared worker script", "shared worker fetch", "service worker script", "service worker fetch"}
def _serve(seen):
"""A server that keeps each request's path and raw Accept-Language lines."""
s = socket.socket()
s.bind(("127.0.0.1", 0))
s.listen(16)
def one(conn):
buf = b""
try:
while True:
while b"\r\n\r\n" not in buf:
chunk = conn.recv(65536)
if not chunk:
return
buf += chunk
head, buf = buf.split(b"\r\n\r\n", 1)
lines = head.split(b"\r\n")
path = lines[0].split(b" ")[1].decode("latin-1").split("?", 1)[0]
seen.append((path, [ln.decode("latin-1") for ln in lines[1:] if ln.lower().startswith(b"accept-language:")]))
body, ctype = BODIES.get(path, (b"ok", b"text/plain"))
conn.sendall(b"HTTP/1.1 200 OK\r\nContent-Type: " + ctype + b"\r\nCache-Control: no-store\r\nContent-Length: "
+ str(len(body)).encode() + b"\r\n\r\n" + body)
except OSError:
return
finally:
conn.close()
def loop():
while True:
try:
conn, _ = s.accept()
except OSError:
return
threading.Thread(target=one, args=(conn,), daemon=True).start()
threading.Thread(target=loop, daemon=True).start()
return s
def _headers_by_kind(seen):
"""Each kind of request -> the Accept-Language lines of EVERY request of that kind (a script is fetched again on an update check)."""
out = {}
for path, lines in seen:
if path in KINDS:
out.setdefault(KINDS[path], []).append(lines)
return out
def test_a_context_list_is_the_retail_accept_language_on_every_request_kind(firefox_binary):
"""⛔ A CONTEXT'S LANGUAGE REACHED THE PAGE AND NOT EVERY REQUEST. ``new_context(locale=...)`` is the language of that context's
pages, and the header of a navigation followed it while the requests that carry no BrowsingContext (a worker's ``fetch``, a service
worker's) kept what the session sent, or the raw list with its spaces and no q-values; a server then saw two languages and two
spellings from one client. The context asks for it-IT inside a de-DE session; every request kind of it carries the retail it-IT
header (but for the four kinds of shared and service workers, see the module docstring), and the other context's, which asked for
nothing, the retail de-DE one on every kind.
"""
from invisible_playwright import InvisiblePlaywright
seen = {"it": [], "de": []}
servers = {name: _serve(log) for name, log in seen.items()}
urls = {name: "http://127.0.0.1:%d/" % srv.getsockname()[1] for name, srv in servers.items()}
try:
with InvisiblePlaywright(seed=5150, binary_path=firefox_binary, headless=True, locale="de-DE", timezone="Europe/Berlin") as browser:
for name, options in (("it", {"locale": "it-IT"}), ("de", {})):
page = browser.new_context(**options).new_page()
page.goto(urls[name], wait_until="load", timeout=30_000)
page.wait_for_function("document.title === 'done'", timeout=30_000)
languages = page.evaluate("[...navigator.languages]")
assert languages == (["it-IT", "it", "en-US", "en"] if name == "it" else ["de-DE", "de", "en-US", "en"]), (
"navigator.languages of the %s context" % name)
finally:
for srv in servers.values():
srv.close()
for name, retail, other, left_out in (("it", RETAIL_IT_IT, RETAIL_DE_DE, SESSION_HEADER_KINDS), ("de", RETAIL_DE_DE, RETAIL_IT_IT, set())):
by_kind = _headers_by_kind(seen[name])
assert set(by_kind) == set(KINDS.values()), "the %s context: kinds of request seen %r" % (name, sorted(by_kind))
checked = {kind: sent for kind, sent in by_kind.items() if kind not in left_out}
wrong = {kind: sent for kind, sent in checked.items() if any(lines != ["Accept-Language: " + retail] for lines in sent)}
assert not wrong, "the %s context must send %r on every request kind: %r" % (name, retail, wrong)
assert not any(other in " ".join(lines) for sent in checked.values() for lines in sent), (
"the %s context sent the other context's language" % name)
assert RETAIL_IT_IT != RETAIL_DE_DE
@@ -16,7 +16,8 @@ from `http://127.0.0.1:<port>`; a site never includes the port). The browser sta
counting every content process, or every one that hosts any site, read them as a leak ([2, 2, 2, 5, 5] on the e2e
of the 0.50.0 commit, three "Web Content" and no site left; a process for a Mozilla site started by the New Tab
page). If the name were not what the test expects, the count while the page is open would be 0 and the first assert
says so. Off Linux the test skips: no other system names the process.
says so. On Windows, which names no process, the engine is started with `LOG_ENV` and the type each process was given
is read from its log (tests/_processes.py `remote_types`).
The engine that does it is not published when this file is written: `engine_at_least` makes the test wait for
it, and on an older engine it is skipped, never passed.
@@ -25,6 +26,7 @@ from __future__ import annotations
import asyncio
import json
import sys
import threading
import pytest
@@ -32,7 +34,7 @@ import pytest
import websockets # noqa: F401 - the dev extra installs it: a missing one is a failure, never a skip
from websockets.asyncio.client import connect # noqa: E402
from _processes import NAMED_BY_SITE, site_processes_below # noqa: E402
from _processes import LOG_ENV, NAMED_BY_SITE, remote_types, site_processes_below # noqa: E402
from _servers import LocalServer # noqa: E402
from _waits import awatch # noqa: E402
@@ -110,17 +112,23 @@ DEADLINE_S = 30
REGISTERED = ("navigator.serviceWorker.getRegistration().then(r => !!r && !!(r.installing || r.waiting || r.active))")
def test_closed_contexts_with_a_never_stopping_service_worker_leave_no_process(firefox_binary, engine_at_least):
def test_closed_contexts_with_a_never_stopping_service_worker_leave_no_process(firefox_binary, engine_at_least, monkeypatch, tmp_path):
engine_at_least(ENGINE_WITH_THE_FIX)
from invisible_playwright import launch_server
# Windows names no process: the engine's own log says which type (so which site) each one was given
log_base = tmp_path / "process-types"
if sys.platform == "win32":
monkeypatch.setenv("MOZ_LOG", LOG_ENV["MOZ_LOG"])
monkeypatch.setenv("MOZ_LOG_FILE", str(log_base))
server, base = _serve()
launched = launch_server(host="127.0.0.1", port=0, headless=True, virtual_display=False, humanize=False,
seed=4266, binary_path=firefox_binary, launch_timeout_ms=180_000,
extra_prefs=NAMED_BY_SITE)
def sites():
return site_processes_below(launched.process.pid, SITE)
return site_processes_below(launched.process.pid, SITE, types=lambda: remote_types(log_base))
async def drive():
opened, left = [], []
@@ -0,0 +1,185 @@
"""TEMPORARY, with tests/_generation_evidence.py and tests/_crash_cores.py: a generation of the security state that fails through the CORE's own launch leaves its
evidence, gdb's text of the core included.
In run 45014369018 the core's `generate` (called once per module by `_ready` of tests/test_security_state_engine_e2e.py, its outcome shared by three tests)
saw the engine exit with -11 and the evidence folder had nothing of it: the core sends stdout and stderr to the null device, deletes the work profile before it
raises, and starts the engine with the test process's core limit (0 on the runners). Here a fake engine (this Python, a script) goes through the same path, the
core's real `generate` under `the_core_s_generation_keeps_its_evidence`, no browser, and then through what tests/conftest.py does after a test that fails
(`_crash_cores.after_the_report`):
* a fake that writes on stdout and stderr, leaves a file in its profile and ends by SIGSEGV (on Windows `os.kill` ends it with exit code 11): the error of the core
is raised unchanged, and the folder holds the two outputs, the profile's files and the exit code. On Linux the fake's own RLIMIT_CORE is the session's, its soft
limit equal to the hard one (raised once by tests/conftest.py at the start of pytest, not by the launch: the core's Popen is not given a limit), and where a core
lands where it is looked for (`$INVPW_CORE_DIR` under an absolute `kernel.core_pattern` there, as on the e2e jobs, or a relative pattern) and gdb exists, the
evidence holds gdb's TEXT with a backtrace of the SIGSEGV and the core is deleted; where no core can land, the notes say there was none. On Windows the notes say
that cores are Linux only and nothing of them is written;
* a fake that exits 0 but leaves no result: the core refuses AFTER the exit, the profile is already deleted, and its files are saved from what was noted at exit;
* the control: the same crash through the core WITHOUT the wrapper leaves no evidence folder at all (the state of run 45014369018), and the wrapper puts the core's
module back as it found it.
"""
from __future__ import annotations
import json
import os
import re
import subprocess
import sys
from pathlib import Path
import pytest
import _crash_cores
from _generation_evidence import the_core_s_generation_keeps_its_evidence
pytestmark = pytest.mark.unit
NAME = "generation-under-test"
#: The test whose failure `after_the_report` is told about.
NODEID = "tests/test_security_state_engine_e2e.py::the_test_that_failed"
LEFT = "left-by-the-fake-engine.txt"
_FAKE = r'''
import os, signal, sys
profile = sys.argv[sys.argv.index("-profile") + 1]
with open(os.path.join(profile, "left-by-the-fake-engine.txt"), "w") as sink:
sink.write("x")
sys.stdout.write("FAKE-ENGINE-STDOUT\n")
sys.stdout.flush()
if sys.platform.startswith("linux"):
import resource
soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
sys.stderr.write("RLIMIT_CORE %d %d\n" % (soft, hard))
sys.stderr.write("FAKE-ENGINE-STDERR\n")
sys.stderr.flush()
if sys.argv[1] == "crash":
os.kill(os.getpid(), signal.SIGSEGV)
sys.exit(0)
'''
def _inputs(directory):
from invisible_core._security_state_generate import Inputs
files = {"intermediates.json": {"collection_timestamp": 1}, "onecrl.json": {"collection_timestamp": 2},
"crlite.json": {"collection_timestamp": 3, "full": {"sha256": "0" * 64}, "deltas": []}}
for name, document in files.items():
(directory / name).write_text(json.dumps(document), encoding="utf-8")
return Inputs(directory / "intermediates.json", directory / "onecrl.json", directory / "crlite.json")
def _where_a_core_lands(tmp_path, monkeypatch):
"""Linux: the folder where a crash of the fake leaves its core and `after_the_report` looks for it, set as `$INVPW_CORE_DIR`; or None when no core can land
there (a piped `kernel.core_pattern`, a hard limit of 0), with `$INVPW_CORE_DIR` an empty folder. Windows: None, and no `$INVPW_CORE_DIR` (as on the runners)."""
if not sys.platform.startswith("linux"):
monkeypatch.delenv("INVPW_CORE_DIR", raising=False)
return None
import resource
pattern = _crash_cores.core_pattern()
given = (os.environ.get("INVPW_CORE_DIR") or "").rstrip("/")
if resource.getrlimit(resource.RLIMIT_CORE)[1] != 0:
if given and Path(given).is_dir() and pattern.startswith(given + "/") and "/" not in pattern[len(given) + 1:]:
return Path(given)
if not pattern.startswith("|") and "/" not in pattern and not pattern.startswith("unreadable"):
monkeypatch.setenv("INVPW_CORE_DIR", str(tmp_path / "cwd"))
return tmp_path / "cwd"
(tmp_path / "no-core").mkdir()
monkeypatch.setenv("INVPW_CORE_DIR", str(tmp_path / "no-core"))
return None
@pytest.fixture
def setting(tmp_path, monkeypatch):
"""The evidence under `tmp_path/runner` (as `$RUNNER_TEMP` would be), the folder a core lands in, the fake and the inputs. At the end the cores the fakes left
(the control's crash too) are deleted as after a passing test, while `$RUNNER_TEMP` is still `tmp_path/runner`."""
monkeypatch.setenv("RUNNER_TEMP", str(tmp_path / "runner"))
(tmp_path / "cwd").mkdir()
monkeypatch.chdir(tmp_path / "cwd")
lands = _where_a_core_lands(tmp_path, monkeypatch)
fake = tmp_path / "fake_engine.py"
fake.write_text(_FAKE, encoding="utf-8")
inputs_dir = tmp_path / "inputs"
inputs_dir.mkdir()
yield {"root": tmp_path, "fake": fake, "inputs": _inputs(inputs_dir), "folder": tmp_path / "runner" / "invpw-evidence" / NAME, "lands": lands,
"cores": tmp_path / "runner" / "invpw-evidence" / "cores"}
_crash_cores.after_the_report("the fixture of " + NODEID, "teardown", False)
def _generate(setting, mode, *, wrapped):
from invisible_core._security_state_generate import EngineId, GenerationError, generate
argv = [sys.executable, "-I", str(setting["fake"]), mode]
out = setting["root"] / ("out-" + mode)
with pytest.raises(GenerationError) as raised:
if wrapped:
with the_core_s_generation_keeps_its_evidence(setting["root"] / "work", NAME):
generate(argv, setting["inputs"], EngineId(version="1", build_id="1"), out)
else:
generate(argv, setting["inputs"], EngineId(version="1", build_id="1"), out)
return str(raised.value)
def _read(path):
return path.read_text(encoding="utf-8", errors="replace") if path.is_file() else "<%s is not there>" % path.name
def test_a_crash_of_the_core_s_launch_keeps_the_engine_s_output_the_profile_and_gdb_s_text_of_the_core(setting):
error = _generate(setting, "crash", wrapped=True)
_crash_cores.after_the_report(NODEID, "call", True) # what tests/conftest.py does after the test that ran the generation fails
expected_code = -11 if sys.platform != "win32" else 11
assert "exited with %d" % expected_code in error, error
folder = setting["folder"]
notes = _read(folder / "notes.txt")
assert "exit code %d" % expected_code in notes and error in notes, notes
assert "FAKE-ENGINE-STDOUT" in _read(folder / "engine.stdout"), notes
stderr = _read(folder / "engine.stderr")
assert "FAKE-ENGINE-STDERR" in stderr, notes
listing = _read(folder / "profile-files.tsv")
assert LEFT in listing and "user.js" in listing, listing
assert (folder / "user.js").is_file(), sorted(p.name for p in folder.iterdir())
if not sys.platform.startswith("linux"):
assert "core files: Linux only" in notes, notes
assert not setting["cores"].exists(), "a folder of cores on %s: %s" % (sys.platform, sorted(p.name for p in setting["cores"].rglob("*")))
return
import resource
session = resource.getrlimit(resource.RLIMIT_CORE)
limits = [tuple(int(part) for part in line.split()[1:]) for line in stderr.splitlines() if line.startswith("RLIMIT_CORE ")]
assert session[0] == session[1], "the session's core limit was not raised to its hard limit: %r" % (session,)
assert limits == [session], "the fake's core limit %r is not the session's %r" % (limits, session)
assert "read by tests/_crash_cores.py" in notes, notes
cores = setting["cores"] / _crash_cores.folder_name(NODEID)
cores_notes = _read(cores / "notes.txt")
if setting["lands"] is not None and subprocess.run(["sh", "-c", "command -v gdb"], stdout=subprocess.DEVNULL).returncode == 0:
texts = sorted(cores.glob("core*.gdb.txt"))
assert len(texts) == 1, cores_notes
text = _read(texts[0])
assert "SIGSEGV" in text and re.search(r"^#0\s", text, re.M), "gdb's text has no backtrace of the SIGSEGV:\n%s" % text[:4000]
assert "gdb exited" in cores_notes, cores_notes
assert not list(setting["lands"].glob("core*")), "the core was not deleted after gdb read it"
elif setting["lands"] is not None:
assert "gdb is not installed" in cores_notes, cores_notes
else:
assert "no core file" in cores_notes, cores_notes
def test_a_refusal_after_a_clean_exit_keeps_the_profile_the_core_deleted(setting):
error = _generate(setting, "exit0", wrapped=True)
assert "securitystate-result.json" in error, error
folder = setting["folder"]
notes = _read(folder / "notes.txt")
assert "exit code 0" in notes and "the core deleted it afterwards" in notes, notes
assert "FAKE-ENGINE-STDERR" in _read(folder / "engine.stderr"), notes
assert LEFT in _read(folder / "profile-files.tsv"), notes
def test_without_the_wrapper_the_same_crash_leaves_nothing_and_the_core_is_put_back(setting):
import invisible_core._security_state_generate as module
before = (module.subprocess, module._wait_for_exit)
assert before[0] is subprocess
_generate(setting, "crash", wrapped=False)
assert not setting["folder"].exists(), "the core alone saved something: %s" % sorted(p.name for p in setting["folder"].iterdir())
_generate(setting, "crash", wrapped=True)
assert (module.subprocess, module._wait_for_exit) == before, "the wrapper did not put the core's module back"
assert (setting["folder"] / "engine.stderr").is_file()
@@ -0,0 +1,100 @@
"""A `goto` to an address Firefox refuses before it opens a channel ends, and says why.
`http://127.0.0.1:9/` is a restricted port (Firefox's list of ports it will not
connect to): the load is refused inside the docshell, before any channel exists
(`DocumentChannelChild::AsyncOpen` -> `nsDocShell::DoURILoad` fails ->
`InternalLoad` shows the error page). No channel ever reports progress, so
nothing that watches a request can end the navigation: the engine reports the
failure itself, with the load identifier and the status
(`StealthNavigationLoad::Failed` in `nsDocShell::DoURILoad`, folder
`automation/navigation` of the engine series, `docshell/base/StealthNavigation.cpp`),
and the client's `goto` raises with the name of the status,
`NS_ERROR_PORT_ACCESS_NOT_ALLOWED`. Until firefox-55 the navigation was announced
(`Page.navigationStarted`) and never ended: `goto` waited out its timeout, and
the reason was only in the URL of the error page.
**What is asserted, and not a clock.** The `goto` raises, the text of the error
is the status (and not a timeout: a deadline of 30 s is only the longest a
healthy run is given), and the page is usable afterwards.
**Negative control.** A `goto` to an allowed local port where nothing listens
also ends, with a DIFFERENT error (the connection is refused by the peer, a
channel did open): the first test's text is the answer to the port, not what
every failed `goto` says.
Why a page cares: a script that loads a refused address must learn it at once,
by the name Firefox gives, and not hang until its own deadline.
"""
from __future__ import annotations
import socket
import threading
from http.server import BaseHTTPRequestHandler
import pytest
from _servers import LocalServer
pytestmark = pytest.mark.e2e
REFUSED_PORT_URL = "http://127.0.0.1:9/"
PORT_REASON = "NS_ERROR_PORT_ACCESS_NOT_ALLOWED"
REFUSED_REASON = "NS_ERROR_CONNECTION_REFUSED"
class _Page(BaseHTTPRequestHandler):
def log_message(self, *args):
pass
def do_GET(self):
body = b"<html><title>after</title><body>after</body></html>"
self.send_response(200)
self.send_header("content-type", "text/html")
self.send_header("content-length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def _goto_error(page, url):
"""The text of the error a `goto` ends with (the test fails if it ends without one).
A failed `goto` is followed by Firefox's error page, a navigation of its own that commits after the call has
raised (on Windows, late enough to land inside the next `goto`, which then reads as "interrupted by another
navigation to" the refused address). The call is therefore made inside a wait for that navigation's
`framenavigated`: it returns only once the error page has committed and the frame is quiet.
"""
with page.expect_event("framenavigated", timeout=30_000):
with pytest.raises(Exception) as ended:
page.goto(url, timeout=30_000)
return str(ended.value)
def test_a_goto_to_a_refused_port_ends_with_its_reason(firefox_binary):
from invisible_playwright import InvisiblePlaywright
# a port nobody listens on, and that Firefox allows: bound and never listening, so no other program can take it
closed = socket.socket()
closed.bind(("127.0.0.1", 0))
closed_url = "http://127.0.0.1:%d/" % closed.getsockname()[1]
site = LocalServer(("127.0.0.1", 0), _Page)
threading.Thread(target=site.serve_forever, daemon=True).start()
try:
with InvisiblePlaywright(seed=4242, binary_path=firefox_binary, headless=True) as browser:
page = browser.new_context().new_page()
refused = _goto_error(page, REFUSED_PORT_URL)
assert PORT_REASON in refused, refused
assert "Timeout" not in refused, refused
# the control: the same call to an allowed port that is closed ends with another reason
control = _goto_error(page, closed_url)
assert REFUSED_REASON in control, control
assert PORT_REASON not in control, control
# and the page the refused navigation left behind is a page that navigates
page.goto("http://127.0.0.1:%d/" % site.server_address[1], timeout=30_000)
assert page.title() == "after"
finally:
site.shutdown()
site.server_close()
closed.close()
@@ -0,0 +1,156 @@
"""The zone a launch declares, and the one a context asks for, reach everything a page reads the time from.
Characterisation of firefox-68; the hooks of fingerprint/locale-time/timezone in the engine series cite
``test_a_launch_and_a_context_timezone_reach_the_page``. A page learns the zone of a machine from more places than ``Intl``:
* the realm's ``Intl`` and the offset of ``Date`` (``getTimezoneOffset``, ``toLocaleTimeString``), in the page's own realm
(read by an INLINE script, the way a site reads it) and in a dedicated worker;
* ``document.lastModified``, which formats the ``Last-Modified`` of the response, or the present moment when there is none, as a wall
clock in the zone (Document.cpp, GetFormattedTimeString);
* EXSLT's ``date:date-time()`` in an XSLT transform (txEXSLTFunctions.cpp), which is the wall clock too.
None of them may be read from the host. A launch declares its zone (``timezone="Pacific/Chatham"``, a zone with a quarter-hour offset
and daylight time, which no runner has) and a context may ask for its own (``timezone_id="Asia/Kolkata"``, +05:30, no daylight time);
every one of those places answers the zone of the context the page is in.
The control is the same reads on a launch whose declaration is EMPTY (``juggler.timezone.override`` empty, and a context that asks for no
zone): the engine then has nothing to give and the values are the host's, which are not Chatham's. A control that agreed with Chatham
would mean the test cannot tell a declared zone from the host's.
Expected values: the offsets of Pacific/Chatham on a date in January (daylight time, +13:45) and in July (+12:45) and of Asia/Kolkata
(+05:30 all year) are the IANA database's; ``Last-Modified: Mon, 15 Jan 2024 10:00:00 GMT`` is 23:45:00 in Chatham and 15:30:00 in
Kolkata. The present moment, with no ``Last-Modified``, is compared with the page's own offset: the wall clock minus the clock of the
machine, rounded to a quarter of an hour, has to be the offset of the zone.
"""
from __future__ import annotations
import pytest
import _locale_probe as probe
pytestmark = pytest.mark.e2e
CHATHAM = "Pacific/Chatham"
KOLKATA = "Asia/Kolkata"
#: Minutes AHEAD of UTC, the sign of ``-getTimezoneOffset()``: what the zone is on 15 January and on 15 July 2024.
EXPECTED = {
CHATHAM: {"january": 825, "july": 765, "time": "23:45:00", "last_modified": "01/15/2024 23:45:00"},
KOLKATA: {"january": 330, "july": 330, "time": "15:30:00", "last_modified": "01/15/2024 15:30:00"},
}
LAST_MODIFIED = "Mon, 15 Jan 2024 10:00:00 GMT"
#: An XSLT sheet whose only output is the current date-time of EXSLT.
EXSLT_SHEET = (
'<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" '
'xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date">'
'<xsl:output method="text"/><xsl:template match="/"><xsl:value-of select="date:date-time()"/></xsl:template></xsl:stylesheet>'
)
#: What an inline script of the page reads. ``wall`` turns "MM/DD/YYYY HH:MM:SS" or an ISO date-time into the minutes it is AHEAD of the
#: clock of the machine, to a quarter of an hour: the zone's offset, whatever the date.
PAGE_READ = """
const o = Intl.DateTimeFormat().resolvedOptions();
const instant = new Date(Date.UTC(2024, 0, 15, 10, 0, 0));
const ahead = (y, mo, d, h, mi, s) => Math.round((Date.UTC(y, mo - 1, d, h, mi, s) - Date.now()) / 60000 / 15) * 15;
const lm = document.lastModified.match(/(\\d\\d)\\/(\\d\\d)\\/(\\d{4}) (\\d\\d):(\\d\\d):(\\d\\d)/);
const processor = new XSLTProcessor();
processor.importStylesheet(new DOMParser().parseFromString(%(sheet)s, 'application/xml'));
const exslt = processor.transformToDocument(document).documentElement.textContent;
const ex = exslt.match(/(\\d{4})-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)/);
return {
timeZone: o.timeZone,
january: -new Date(Date.UTC(2024, 0, 15, 12)).getTimezoneOffset(),
july: -new Date(Date.UTC(2024, 6, 15, 12)).getTimezoneOffset(),
now: -new Date().getTimezoneOffset(),
time: instant.toLocaleTimeString('en-GB'),
lastModified: document.lastModified,
lastModifiedAhead: lm ? ahead(+lm[3], +lm[1], +lm[2], +lm[4], +lm[5], +lm[6]) : null,
exslt: exslt,
exsltAhead: ex ? ahead(+ex[1], +ex[2], +ex[3], +ex[4], +ex[5], +ex[6]) : null,
};
""" % {"sheet": "`" + EXSLT_SHEET + "`"}
WORKER = b"""
onmessage = () => postMessage({
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
january: -new Date(Date.UTC(2024, 0, 15, 12)).getTimezoneOffset(),
july: -new Date(Date.UTC(2024, 6, 15, 12)).getTimezoneOffset(),
time: new Date(Date.UTC(2024, 0, 15, 10, 0, 0)).toLocaleTimeString('en-GB'),
});
"""
WORKER_JS = """() => new Promise((ok) => {
const w = new Worker('/zone-worker.js');
w.onmessage = (e) => { ok(e.data); w.terminate(); };
w.postMessage(0);
})"""
SITE = {
"/with": (probe.PAGE, "text/html; charset=utf-8", {"Last-Modified": LAST_MODIFIED}),
"/without": probe.PAGE,
"/zone-worker.js": (WORKER, "text/javascript"),
}
def _read(page, base, with_last_modified):
"""The page's reads of the zone, from an inline script of its own realm, and a dedicated worker's."""
page.goto("%s/%s" % (base, "with" if with_last_modified else "without"), wait_until="load", timeout=30_000)
return {"page": probe.read_in_page_realm(page, PAGE_READ), "worker": page.evaluate(WORKER_JS)}
def _assert_zone(read, zone, label):
want = EXPECTED[zone]
page, worker = read["with"]["page"], read["with"]["worker"]
assert page["timeZone"] == zone, "%s: Intl timeZone in the page realm" % label
assert (page["january"], page["july"]) == (want["january"], want["july"]), "%s: getTimezoneOffset in the page realm: %r" % (label, page)
assert page["time"] == want["time"], "%s: a date's wall clock in the page realm" % label
assert page["lastModified"] == want["last_modified"], "%s: document.lastModified with a Last-Modified header" % label
assert worker == {"timeZone": zone, "january": want["january"], "july": want["july"], "time": want["time"]}, (
"%s: a dedicated worker" % label)
# With no Last-Modified the page, the clock of the document and EXSLT's date-time agree on the zone's present offset.
now = read["without"]["page"]
assert now["timeZone"] == zone, "%s: Intl timeZone on a page with no Last-Modified" % label
assert now["lastModifiedAhead"] == now["now"], (
"%s: document.lastModified with no Last-Modified is %r, %d minutes ahead of the machine, the offset says %d"
% (label, now["lastModified"], now["lastModifiedAhead"] or 0, now["now"]))
assert now["exsltAhead"] == now["now"], (
"%s: EXSLT date:date-time() is %r, %r minutes ahead of the machine, the offset says %d" % (label, now["exslt"], now["exsltAhead"], now["now"]))
def test_a_launch_and_a_context_timezone_reach_the_page(firefox_binary):
"""⛔ THE ZONE OF A MACHINE LEAKS FROM MANY PLACES, AND ONE OF THEM IS ALWAYS THE LAST TO BE CLOSED. ``Intl`` and ``Date`` were
declared first; ``document.lastModified`` and EXSLT's ``date:date-time()`` format a time in the C library's local zone, which is the
host's, and a worker's realm took the process's zone. A page reads all of them in one breath.
A launch with ``timezone="Pacific/Chatham"``: its default context reads Chatham in every place above. A second context with
``timezone_id="Asia/Kolkata"`` of the same browser reads Kolkata in every place, with and without a ``Last-Modified`` header. The
control is a launch whose declaration is empty (``juggler.timezone.override`` empty, a context that asks for no zone): there the
values are the host's, and none of them is Chatham's, so the declared zone is what the first reads had.
"""
from invisible_playwright import InvisiblePlaywright
srv, base = probe.serve(SITE)
try:
with InvisiblePlaywright(seed=5150, binary_path=firefox_binary, headless=True, locale="en-US", timezone=CHATHAM) as browser:
for label, zone, options in (("the launch's context", CHATHAM, {}), ("a context with timezone_id", KOLKATA, {"timezone_id": KOLKATA})):
page = browser.new_context(**options).new_page()
read = {"with": _read(page, base, True), "without": _read(page, base, False)}
_assert_zone(read, zone, label)
with InvisiblePlaywright(seed=5150, binary_path=firefox_binary, headless=True, locale="en-US", timezone=CHATHAM,
extra_prefs={"juggler.timezone.override": ""}) as browser:
page = browser.new_context(timezone_id=None).new_page()
host = {"with": _read(page, base, True), "without": _read(page, base, False)}
chatham = EXPECTED[CHATHAM]
seen = host["with"]["page"]
assert seen["timeZone"] != CHATHAM, "the launch with no declared zone reads Chatham: the control cannot tell a declaration from the host"
assert (seen["january"], seen["july"]) != (chatham["january"], chatham["july"]), seen
assert seen["lastModified"] != chatham["last_modified"], seen
assert host["with"]["worker"]["timeZone"] != CHATHAM, host["with"]["worker"]
# What the host reads is consistent with itself: the same clock in every place (the offset the page has now is the wall clock's).
now = host["without"]["page"]
assert now["lastModifiedAhead"] == now["now"] and now["exsltAhead"] == now["now"], now
finally:
probe.stop(srv)
@@ -0,0 +1,69 @@
"""A launch tells the core WHICH ENGINE it runs, so the security state it copies into the profile was generated by that engine.
The core places the security state (intermediates, OneCRL, CRLite) in a profile inside `write_user_js`, and a generation is tied to the engine's build id. The server's one
call `write_user_js(profile, prefs)` named no engine, so the core fell back to the SEALED engine: with an engine the caller chose (`executable_path=`) the state was looked up
and, on a cold cache, generated for another binary. The launch passes `engine=<the executable it runs>`; `engine_argv` stays the core's default, because the line this launch
runs (`-juggler-pipe`, headed or headless, the caller's `args`) is not a line a generation may use.
Known-bad: the call without `engine=`; it reaches `ensure_security_state` with `engine=None`.
"""
from __future__ import annotations
import pytest
from invisible_core.juggler.connection import EventListeners
from invisible_playwright._juggler import server as module
from invisible_playwright._juggler.server import BrowserTypeDispatcher, JugglerServer
from _browser_census import closes_with_the_test
class _Engine(EventListeners):
def __init__(self):
EventListeners.__init__(self)
closes_with_the_test(self)
def send(self, method, params=None, session=None, timeout=30.0):
return {"browserContextId": "ctx-1", "targetId": "t-1"}
def startup_send(self, method, params=None):
return self.send(method, params, timeout=None)
def close(self, timeout=5.0):
pass
def _launch(monkeypatch, **params):
server = JugglerServer()
server.attach(type("R", (), {"emit_message": lambda self, m: None})())
monkeypatch.setattr(module.juggler, "launch", lambda executable, profile_dir, **kwargs: _Engine())
try:
BrowserTypeDispatcher(server).op_launch(dict({"executablePath": "the-engine-of-this-launch", "firefoxUserPrefs": {}}, **params))
finally:
server.shutdown()
@pytest.mark.unit
def test_the_launch_asks_the_core_for_the_security_state_of_the_engine_it_runs(monkeypatch):
"""Through the core's real `write_user_js` and `place_security_state`: what reaches `ensure_security_state` is the engine of the launch and no launch line."""
import invisible_core._security_state as security_state
seen = []
monkeypatch.setattr(security_state, "ensure_security_state", lambda *a, **kw: seen.append(kw) or None)
_launch(monkeypatch)
assert len(seen) == 1, seen
assert seen[0].get("engine") == "the-engine-of-this-launch"
assert seen[0].get("engine_argv") is None, "the launch line of the session is not a generation's line"
@pytest.mark.unit
def test_the_engine_is_the_one_the_caller_chose_for_a_headed_launch_with_arguments_too(monkeypatch):
import invisible_core._security_state as security_state
seen = []
monkeypatch.setattr(security_state, "ensure_security_state", lambda *a, **kw: seen.append(kw) or None)
_launch(monkeypatch, headless=False, args=["-width", "800"])
assert [(kw.get("engine"), kw.get("engine_argv")) for kw in seen] == [("the-engine-of-this-launch", None)]
@@ -1,98 +0,0 @@
"""A launch missing a system font or colour declaration is refused.
The engine reads the CSS system fonts (ui.font.*) and the system colours no
stand-in covers (ui.highlight, ui.-moz-field, ...) from what invisible_core
declares, and never from the toolkit. With the stealth engine on and one of
them missing, the browser must refuse to start - before a page can load - and
say which pref, instead of answering from GTK. With every pref declared the
same launch succeeds (the control).
The profile and its user.js are the ones build_launch_plan writes, with the
named pref removed; the engine is started the way the Juggler connection tests
start it.
"""
from __future__ import annotations
import json
import re
import shutil
import sys
import tempfile
from pathlib import Path
import pytest
MISSING = [
"ui.highlight",
"ui.-moz-field",
"ui.font.menu",
]
def _drop(user_js: Path, names) -> int:
"""Remove the user_pref lines of exactly these names (the .dark and .size
variants are other prefs and stay). Returns how many lines went."""
kept, dropped = [], 0
for line in user_js.read_text(encoding="utf-8").splitlines():
m = re.match(r'user_pref\(("(?:[^"\\]|\\.)*"),', line)
if m and json.loads(m.group(1)) in names:
dropped += 1
else:
kept.append(line)
user_js.write_text("\n".join(kept) + "\n", encoding="utf-8")
return dropped
def _launch(firefox_binary, drop):
from invisible_core.juggler import connection as conn
from invisible_core.launch import build_launch_plan
profile_dir = tempfile.mkdtemp(prefix="system_theme_")
try:
plan = build_launch_plan(6023, profile_dir=profile_dir, binary_path=firefox_binary,
timezone="UTC", locale="en-US")
if drop:
assert _drop(Path(profile_dir) / "user.js", {drop}) == 1, (
"%s is not declared by this core, so there is nothing to remove" % drop)
return conn.launch(firefox_binary, profile_dir, headless=True,
# A refusal ends in an abort on purpose, and the crash reporter would open
# a window on the desktop of whoever runs the test.
env=dict(plan.env, MOZ_CRASHREPORTER_DISABLE="1"),
ready_timeout=60.0), profile_dir
except BaseException:
shutil.rmtree(profile_dir, ignore_errors=True)
raise
# Linux only: on Windows the engine takes these from the Windows toolkit as retail does
# (StealthVerifySystemTheme in widget/StealthSystemFonts.cpp returns unless MOZ_WIDGET_GTK), so a
# missing ui.* pref does not refuse there (candidate 42673795394's Windows gate: DID NOT RAISE).
ON_WINDOWS = sys.platform == "win32"
@pytest.mark.e2e
@pytest.mark.skipif(ON_WINDOWS, reason="the system theme is declared, and its absence refused, on Linux only")
@pytest.mark.parametrize("pref", MISSING)
def test_a_missing_pref_refuses_the_launch(firefox_binary, engine_at_least, pref):
engine_at_least("firefox-68")
with pytest.raises(RuntimeError) as err:
c, profile_dir = _launch(firefox_binary, pref)
# Not reached when the engine refuses: close what must not be running.
c.close()
shutil.rmtree(profile_dir, ignore_errors=True)
message = str(err.value)
assert "exited during startup" in message, message
assert pref in message, "the refusal does not name %s:\n%s" % (pref, message)
assert "is not declared" in message, message
@pytest.mark.e2e
def test_every_pref_declared_the_launch_succeeds(firefox_binary, engine_at_least):
engine_at_least("firefox-68")
c, profile_dir = _launch(firefox_binary, None)
try:
assert c.ready_seen, "the browser did not announce the protocol"
assert c._process.poll() is None, "the browser is not running"
finally:
c.close()
shutil.rmtree(profile_dir, ignore_errors=True)
+78 -47
View File
@@ -48,57 +48,30 @@ from __future__ import annotations
import http.server
import threading
import time
import types
import pytest
import _moving_page
from _moving_page import _goto, _landing, forget
from _evidence_on_failure import FailureEvidence
pytestmark = pytest.mark.e2e
ROUNDS = 5
def _landing(url: str) -> str:
"""Where the page of `url` sends itself: /landed with the query of its round, which no other round of the module has."""
return "/landed" + url[url.index("?"):]
#: What the client heard, for the evidence a failing test leaves (`FailureEvidence`; it only listens and changes no wait or assertion).
_CLIENT_LOG: list = []
#: The address each page (by `id`) was last sent to, or the page it went with instead (`_goto`).
_SENT: dict = {}
def _note(what: str, **fields) -> None:
"""One line of the client's own view of the module: what the test sent or heard, on the clocks of the evidence (`t` wall, `m` perf_counter)."""
_CLIENT_LOG.append({"t": round(time.time(), 4), "m": round(time.perf_counter(), 6), "what": what, **fields})
def _goto(page, url, *, the_page_before_may_move, our_page_may_stop_ours, **kwargs) -> str:
"""`page.goto`, and the address of the page the frame went with: `url` when `goto` answers.
- ``the_page_before_may_move``: the page sent before ours may still be moving (the rounds of the read test go on
while it does, module docstring). Its `location.replace` may win: `goto` says ours was interrupted by it, or
stopped (NS_BINDING_ABORTED), and the frame lands on the landing of THAT page, whose address is returned.
- ``our_page_may_stop_ours``: an engine before firefox-68, where `goto` may say NS_BINDING_ABORTED for our own
document, which had committed and then moved
(`test_networkidle_is_reached_only_on_the_page_that_replaced_a_document_still_arriving`); the frame then lands on
our landing.
Any other answer is red. The detector of a navigation that never answers is the timeout of the `goto` itself (each
caller passes one): a bound of the test stricter than it only judged the speed of the machine."""
from invisible_playwright.sync_api import Error
before = _SENT.get(id(page)) if the_page_before_may_move else None
_SENT[id(page)] = url
try:
page.goto(url, **kwargs)
return url
except Error as e:
text = str(e)
if "NS_BINDING_ABORTED" in text:
ends = tuple(_landing(u) for u in (before, url if our_page_may_stop_ours else None) if u)
assert ends, e
page.wait_for_url(lambda u: u.endswith(ends), timeout=30_000)
went = url if page.url.endswith(_landing(url)) else before
else:
assert before is not None, e
assert "is interrupted by another navigation to" in text, e
assert _landing(before) in text.split("another navigation to")[1], e
went = before
_SENT[id(page)] = went
return went
_moving_page.note = _note
def _replace_after_load(ms: int, cross_site: bool) -> bytes:
@@ -160,12 +133,18 @@ for _name, _held in (("0", False), ("50", True)):
HELD_DOCUMENTS = {"/hdr": _replace_while_the_document_is_held(False), "/hdx": _replace_while_the_document_is_held(True)}
#: The test server's own record of every request it served, in the shape `FailureEvidence.watch_server` reads (`.state.lock`, `.state.records`).
RECORD = types.SimpleNamespace(lock=threading.Lock(), records=[])
@pytest.fixture(scope="module")
def site():
release = threading.Event()
class H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
with RECORD.lock:
RECORD.records.append({"t": round(time.time(), 4), "m": round(time.perf_counter(), 6), "method": "GET", "path": self.path})
if self.path.split("?")[0] == "/hold":
# a response that has begun and does not end: 16 KiB so the first chunk is delivered at once,
# then it stays open until the page that asked for it moves away (or the module's teardown)
@@ -215,17 +194,71 @@ def site():
@pytest.fixture(scope="module")
def page(firefox_binary):
def evidence():
"""What a failing test of this module leaves for a reader (only on a failure; nothing is changed in what the tests wait for or assert):
the client's view of every request and navigation, the Juggler wire, the engine's own trace, the record of the test server.
Armed before the browser is launched (the engine reads its trace folder at launch) and held for the module."""
held = FailureEvidence("a-page-that-moves-on")
held.client_log = _CLIENT_LOG
held.watch_server(types.SimpleNamespace(state=RECORD))
held.arm()
try:
yield held
finally:
held.__exit__(None, None, None)
class _on_failure:
"""``with _on_failure(evidence):`` around the body of a test: when the body raises, the evidence held for the module is saved
(the folder the e2e jobs upload), and the exception goes on."""
def __init__(self, held):
self.held = held
def __enter__(self):
return self
def __exit__(self, exc_type, exc, tb):
if exc_type is not None:
self.held._save(exc_type, exc)
return False
@pytest.fixture(scope="module")
def _browser(firefox_binary, evidence):
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=4321, binary_path=firefox_binary,
headless=True) as browser:
yield browser.new_page()
yield browser
@pytest.fixture
def page(_browser):
"""A page of its own for each test, closed at its end: a page that is still moving when its test ends (`goto` raised for the page before,
and ours went on) cannot reach the next test."""
page = _browser.new_page()
page.on("request", lambda r: _note("request", url=r.url, navigation=r.is_navigation_request()))
page.on("requestfinished", lambda r: _note("requestfinished", url=r.url))
page.on("requestfailed", lambda r: _note("requestfailed", url=r.url, failure=str(r.failure)))
page.on("framenavigated", lambda f: _note("framenavigated", url=f.url, main=f.parent_frame is None))
page.on("domcontentloaded", lambda p: _note("domcontentloaded", url=p.url))
page.on("load", lambda p: _note("load", url=p.url))
try:
yield page
finally:
forget(page)
page.close()
@pytest.mark.parametrize("path", ["/head", "/r0", "/r50", "/r300",
"/x0", "/x50", "/x300"])
def test_a_read_right_after_goto_answers(page, site, path, engine_reaches):
def test_a_read_right_after_goto_answers(page, site, path, engine_reaches, evidence):
with _on_failure(evidence):
_a_read_right_after_goto_answers(page, site, path, engine_reaches)
def _a_read_right_after_goto_answers(page, site, path, engine_reaches):
older = not engine_reaches("firefox-68")
for i in range(ROUNDS):
_goto(page, "%s%s?i=%s-%d" % (site, path, path[1:], i), the_page_before_may_move=True,
@@ -255,8 +288,6 @@ def test_a_read_right_after_goto_answers(page, site, path, engine_reaches):
assert page.evaluate("1 + 1") == 2
except Error as e:
assert "Execution context was destroyed" in str(e), e
# The next test starts on a page that stays: the last page this frame went with has landed.
page.wait_for_url(lambda u, end=_landing(_SENT[id(page)]): u.endswith(end), timeout=30_000)
@pytest.mark.parametrize("path", ["/r0", "/r50", "/x0", "/x50"])
@@ -266,12 +297,12 @@ def test_networkidle_is_reached_on_the_page_that_replaced_ours(page, site, path,
Playwright), or on the page that replaced it. Either way the page then lands, and `networkidle` is reached there.
A `goto` that never answers because the new frame forgot the navigation ([B228]) is still red; the answer that
must never come on the first page is the strict case below. Each round starts on a page that stays (the round
before waited for its landing, and so did the test before)."""
before waited for its landing; the page is the test's own)."""
older = not engine_reaches("firefox-68")
for i in range(ROUNDS):
url = "%s/i%s?n=%s-%d" % (site, path[1:], path[1:], i)
assert _goto(page, url, the_page_before_may_move=False, our_page_may_stop_ours=older,
wait_until="networkidle", timeout=30_000) == url
wait_until="networkidle", timeout=30_000) == {url}
assert page.url.split("?")[0].endswith(("/i" + path[1:], "/landed")), page.url
page.wait_for_url(lambda u, end=_landing(url): u.endswith(end), timeout=30_000)
page.wait_for_load_state("networkidle", timeout=30_000)
@@ -299,7 +330,7 @@ def test_networkidle_is_reached_only_on_the_page_that_replaced_a_document_still_
for i in range(ROUNDS):
url = "%s%s?n=%s-%d" % (site, path, path[1:], i)
assert _goto(page, url, the_page_before_may_move=False, our_page_may_stop_ours=older,
wait_until="networkidle", timeout=30_000) == url
wait_until="networkidle", timeout=30_000) == {url}
assert page.url.endswith(_landing(url)), page.url
@@ -11,12 +11,15 @@ was applied after the page was announced), and the one that answers after 25 s w
"""
from __future__ import annotations
import json
import threading
import time
from http.server import BaseHTTPRequestHandler
from types import SimpleNamespace
import pytest
from _evidence_on_failure import WIRE_LIMIT, FailureEvidence
from _servers import LocalServer
pytestmark = pytest.mark.e2e
@@ -27,15 +30,30 @@ class _Handler(BaseHTTPRequestHandler):
pass
def do_GET(self):
# The destination's own record, for a test that saves evidence when it fails (`server.records`): it only listens.
rec = {"ev": "request", "t_arrive": round(time.time(), 4), "m_arrive": round(time.perf_counter(), 6), "peer": self.client_address[1],
"path": self.path, "status": None, "m_slept": None, "m_answer": None, "m_done": None, "error": None}
records = getattr(self.server, "records", None)
if records is not None:
with self.server.records_lock:
records.append(rec)
try:
self._get(rec)
finally:
rec["m_done"] = round(time.perf_counter(), 6)
def _get(self, rec):
path, _, query = self.path.partition("?")
if path == "/nocontent":
self.send_response(204)
self.send_header("Content-Length", "0")
self.end_headers()
rec["status"] = 204
return
if path == "/slow":
ms = int(query.split("ms=")[1].split("&")[0]) if "ms=" in query else 0
time.sleep(ms / 1000.0)
rec["m_slept"] = round(time.perf_counter(), 6)
body = b"<!doctype html><html><head><title>slow</title></head><body>slow</body></html>"
else:
body = (b"<!doctype html><html><head><title>opener</title></head><body>"
@@ -52,21 +70,29 @@ class _Handler(BaseHTTPRequestHandler):
self.send_header("Cache-Control", "no-store")
self.end_headers()
self.wfile.write(body)
except OSError: # the browser left before a slow answer
pass
rec["status"] = 200
rec["m_answer"] = round(time.perf_counter(), 6)
except OSError as exc: # the browser left before a slow answer
rec["error"] = type(exc).__name__
@pytest.fixture
def site():
def site_server():
srv = LocalServer(("127.0.0.1", 0), _Handler)
srv.records, srv.records_lock = [], threading.Lock()
threading.Thread(target=srv.serve_forever, daemon=True).start()
try:
yield "http://127.0.0.1:%d/" % srv.server_address[1]
yield srv
finally:
srv.shutdown()
srv.server_close()
@pytest.fixture
def site(site_server):
return "http://127.0.0.1:%d/" % site_server.server_address[1]
def _stock_client(module):
import importlib
@@ -132,14 +158,205 @@ def test_a_slow_popup_is_reported_with_the_address_of_its_destination(firefox_bi
_drive(mode, firefox_binary, body)
class _ServerSideLog:
"""What OUR server says to the client and how it decides to, recorded from the test, with nothing changed in `src`: the methods are
wrapped at their class and put back at the end. `messages`: every protocol message the server hands to the client (a served browser:
`RemoteClient.post`, the text sent on the WebSocket; in-process: `InProcessTransport.emit_message`, the dict). `steps`: the adoption of
each engine target (`_Adoption`: attached, every note it makes, with the engine's own event names) and the two calls that decide when
the client hears of a page (`PageDispatcher.wait_until_ready`, `PageDispatcher.announce`). Both carry `t` and `m` like the engine's wire."""
LIMIT = 20000
def __init__(self):
self.messages, self.steps, self.problems = [], [], []
self._lock = threading.Lock()
self._patch = pytest.MonkeyPatch()
def _add(self, where, record):
try:
record["t"], record["m"] = round(time.time(), 4), round(time.perf_counter(), 6)
with self._lock:
if len(where) < self.LIMIT:
where.append(record)
except Exception:
pass
def _sent(self, via, message):
try:
text = message if isinstance(message, str) else json.dumps(message, default=str)
parsed = json.loads(text) if isinstance(message, str) else message
params = parsed.get("params") or {}
self._add(self.messages, {"via": via, "len": len(text), "cut": len(text) > WIRE_LIMIT, "guid": parsed.get("guid"),
"method": parsed.get("method"), "id": parsed.get("id"),
"create_type": params.get("type") if parsed.get("method") == "__create__" else None,
"msg": text[:WIRE_LIMIT]})
except Exception:
pass
def _step(self, event, /, **more):
# `event` is positional-only: a wrapped call records a field called `what` (the adoption's note) and must not collide with it.
record = {"ev": event}
record.update(more)
self._add(self.steps, record)
def _record(self, make):
"""Run `make`, which records something about a call the server makes; a failure of the recording is noted in the evidence and
never reaches the server."""
try:
make()
except BaseException as exc:
with self._lock:
if len(self.problems) < 20:
self.problems.append("recording failed: %r" % (exc,))
def install(self):
log = self
def wrap(owner, name, make):
try:
self._patch.setattr(owner, name, make(getattr(owner, name)))
except Exception as exc: # the rest is still recorded; the problem is saved with it
self.problems.append("%s.%s not wrapped: %r" % (getattr(owner, "__name__", owner), name, exc))
try:
from invisible_playwright._juggler import remote, server, transport
except Exception as exc:
self.problems.append("the server modules could not be imported: %r" % (exc,))
return
# Every wrapper takes (*args, **kwargs) and passes them on unchanged: whatever the real code passes, positional or keyword, reaches
# the wrapped method as it was. What a wrapper reads from the call is read inside `_record`, which never raises.
def post(original):
def wrapper(*args, **kwargs):
log._record(lambda: log._sent("RemoteClient.post", args[1] if len(args) > 1 else kwargs.get("text")))
return original(*args, **kwargs)
return wrapper
def emit_message(original):
def wrapper(*args, **kwargs):
log._record(lambda: log._sent("InProcessTransport.emit_message", args[1] if len(args) > 1 else kwargs.get("message")))
return original(*args, **kwargs)
return wrapper
def adoption_init(original):
def wrapper(*args, **kwargs):
result = original(*args, **kwargs)
adoption = args[0]
log._record(lambda: log._step("adoption_attached", target=adoption.target_id, opener=adoption.opener is not None,
context=adoption.context_id))
return result
return wrapper
def adoption_note(original):
def wrapper(*args, **kwargs):
adoption = args[0]
log._record(lambda: log._step("adoption_note", target=adoption.target_id, state=adoption.state,
what=args[1] if len(args) > 1 else kwargs.get("what")))
return original(*args, **kwargs)
return wrapper
def wait_until_ready(original):
def wrapper(*args, **kwargs):
page = args[0]
log._record(lambda: log._step("wait_until_ready_begin", page=page.guid))
try:
result = original(*args, **kwargs)
except BaseException as exc:
error = repr(exc)[:300]
log._record(lambda: log._step("wait_until_ready_failed", page=page.guid, error=error))
raise
log._record(lambda: log._step("wait_until_ready_end", page=page.guid))
return result
return wrapper
def announce(original):
def wrapper(*args, **kwargs):
page = args[0]
log._record(lambda: log._step("announce_begin", page=page.guid))
try:
return original(*args, **kwargs)
finally:
log._record(lambda: log._step("announce_end", page=page.guid))
return wrapper
wrap(remote.RemoteClient, "post", post)
wrap(transport.InProcessTransport, "emit_message", emit_message)
wrap(server._Adoption, "__init__", adoption_init)
wrap(server._Adoption, "note", adoption_note)
wrap(server.PageDispatcher, "wait_until_ready", wait_until_ready)
wrap(server.PageDispatcher, "announce", announce)
def uninstall(self):
self._patch.undo()
#: What each extra file of the evidence of the test below holds, field by field (written into its meta.json).
_EXTRA_FILES = {
"server-to-client.jsonl": "every protocol message OUR server handed to the client, in order: t (time.time()), m (time.perf_counter(), the scale "
"of every other file), via (RemoteClient.post for a served browser, InProcessTransport.emit_message in-process), "
"guid and method (the event or the __create__ it carries; id for a reply), create_type (the type a __create__ makes: "
"Page, Frame, ...), len, cut (msg was cut at %d characters), msg (the message as JSON text)" % WIRE_LIMIT,
"server-adoption-steps.jsonl": "what the server did with each engine target and when it told the client: t, m, ev = adoption_attached "
"(target, opener, context), adoption_note (target, state, what = the engine's event names Page.frameAttached/"
"navigationCommitted/ready/... without the 'Page.', and the adoption's own steps building/waiting/announced), "
"wait_until_ready_begin / _end / _failed (page = the Page guid), announce_begin / announce_end (page = the Page "
"guid; the `page` event is sent between them), and `problems` lines if a wrapper could not be installed",
"client-events.jsonl": "what the stock client heard, in order: t, m, ev = click, page_event (url = popup.url read in the handler of the context's "
"page event), then for that popup framenavigated (url, main = the main frame), domcontentloaded, load, close (url), and "
"expect_popup_returned (url, took_s, the time since the click)",
}
def _save_extra(folder, files, problems):
"""Add the files of the server's side to the evidence folder `FailureEvidence` saved, and say in its meta.json what each holds."""
for name, records in files.items():
with open(folder / name, "w", encoding="utf-8") as out:
for record in records:
out.write(json.dumps(record, default=str) + "\n")
meta_path = folder / "meta.json"
meta = json.loads(meta_path.read_text(encoding="utf-8"))
meta["files"] = sorted(set(meta.get("files", [])) | set(files))
meta["extra_files"] = _EXTRA_FILES
meta["extra_problems"] = problems
meta["note"] = ("client-request-log.jsonl is empty here (the destination has one request; the client's own events are client-events.jsonl); "
"fakeweb-server-record.jsonl is the destination's record: t_arrive/m_arrive when the request came, m_slept when its wait "
"ended, m_answer when the answer was written, status, error")
meta_path.write_text(json.dumps(meta, indent=1), encoding="utf-8")
@pytest.mark.parametrize("mode", MODES)
def test_a_popup_whose_destination_answers_after_25_seconds_is_reported_then(firefox_binary, site, mode):
def test_a_popup_whose_destination_answers_after_25_seconds_is_reported_then(firefox_binary, site, site_server, mode):
"""When it fails it saves, under `invpw-evidence/popup-25s-<mode>/`, the order in which the engine and then our server told the popup's
story: the engine's Juggler wire and trace (`juggler-wire.jsonl`, `juggler-engine-trace/`), what our server sent to the client
(`server-to-client.jsonl`), what it did with the target (`server-adoption-steps.jsonl`), what the client heard (`client-events.jsonl`),
the destination's record (`fakeweb-server-record.jsonl`) and a summary (`cells.json`)."""
client_events = []
summary = {"mode": mode}
def mark(ev, **more):
client_events.append(dict({"ev": ev, "t": round(time.time(), 4), "m": round(time.perf_counter(), 6)}, **more))
def watch_popups(ctx):
def on_page(popup):
mark("page_event", url=popup.url)
summary["url_at_page_event"] = popup.url
popup.on("framenavigated", lambda frame: mark("framenavigated", url=frame.url, main=frame.parent_frame is None))
popup.on("domcontentloaded", lambda p: mark("domcontentloaded", url=p.url))
popup.on("load", lambda p: mark("load", url=p.url))
popup.on("close", lambda p: mark("close", url=p.url))
ctx.on("page", on_page)
def body(ctx, page):
page.goto(site, wait_until="load", timeout=30000)
watch_popups(ctx)
t0 = time.monotonic()
mark("click")
with page.expect_popup(timeout=45000) as info:
page.click("#open25000")
took = time.monotonic() - t0
mark("expect_popup_returned", url=info.value.url, took_s=round(took, 3))
summary["took_s"] = round(took, 3)
# The lower bound is the server's: it answers after 25 s, so a popup announced before 24 s was announced
# before it was ready. There is no upper bound of ours: the limit above is expect_popup's 45 s (a popup
# dropped at 20 s, the defect this test is red on, ends in its timeout).
@@ -147,7 +364,25 @@ def test_a_popup_whose_destination_answers_after_25_seconds_is_reported_then(fir
assert info.value.url == site + "slow?ms=25000"
info.value.close()
_drive(mode, firefox_binary, body)
evidence = FailureEvidence("popup-25s-" + mode)
evidence.watch_server(SimpleNamespace(state=SimpleNamespace(lock=site_server.records_lock, records=site_server.records)))
evidence.note_cells(summary)
side = _ServerSideLog()
try:
with evidence:
side.install()
evidence.arm()
_drive(mode, firefox_binary, body)
finally:
side.uninstall()
if evidence.saved_to is not None:
try:
_save_extra(evidence.saved_to, {"server-to-client.jsonl": side.messages,
"server-adoption-steps.jsonl": side.steps + [{"ev": "problem", "what": w} for w in side.problems],
"client-events.jsonl": client_events}, side.problems)
except Exception as problem: # the evidence never hides the failure it is about
import sys
sys.stderr.write("popup evidence: the server's side could not be saved: %r\n" % (problem,))
@pytest.mark.parametrize("mode", MODES)
@@ -0,0 +1,88 @@
"""A read whose probe ran out of time ran out of the CALLER's time.
`page.inner_text("#never", timeout=300)` must fail with Playwright's
"Timeout 300ms exceeded ...". The read gives its probe exactly what is left of
the caller's deadline, so the probe's `ReplyTimeout` is the deadline's expiry.
It used to be turned into the read's timeout only when a SECOND reading of the
clock said the deadline had passed; on Windows a threading wait can return
before the monotonic clock (steps of about 15 ms) says the budget is spent, and
the core's "Runtime.callFunction: no response in 0s ..." reached the caller
(whole-e2e runs 44419689591 and 44184494839).
"""
import threading
from types import SimpleNamespace
from unittest.mock import Mock
import pytest
from invisible_core.juggler import connection as juggler
from invisible_core.juggler import deadline as deadline_module
from invisible_core.juggler.connection import EventListeners
from invisible_core.juggler.lifecycle import Lifecycle
from invisible_playwright._juggler.dispatcher import Dispatcher
from invisible_playwright._juggler.server import (
FrameDispatcher,
JugglerServer,
PageDispatcher,
)
pytestmark = pytest.mark.unit
CORE_MESSAGE = ("Runtime.callFunction: no response in 0s. If this is the "
"FIRST command, look at the readiness signal before the pipe.")
@pytest.fixture
def frame():
server = JugglerServer()
server.attach(SimpleNamespace(emit_message=lambda message: None))
context = Dispatcher(server, None)
context.options = {}
page = object.__new__(PageDispatcher)
page.context = context
page.lifecycle = Lifecycle(EventListeners(), "session")
page.injected = Mock()
page.actions = Mock()
page._frames = {}
page._told_attached = set()
page._frames_lock = threading.RLock()
page._announce_lock = threading.RLock()
page._announced = True
page._said_before_announcement = []
page._navigation_requests = {}
page._announced_closed = False
Dispatcher.__init__(page, server, context)
page.frame = FrameDispatcher(server, page, "main")
page.lifecycle._on_event("Page.frameAttached",
{"frameId": "main", "parentFrameId": None})
page.frame.enter_frames = Mock(return_value=("main", "#never"))
return page.frame
def test_a_probe_that_ran_out_is_the_read_timing_out_whatever_the_clock_says(
frame, monkeypatch):
"""The losing interleaving, on purpose: the probe's wait ended, and the
clock the deadline reads has not moved at all, so `deadline.passed()` is
False."""
monkeypatch.setattr(deadline_module, "time",
SimpleNamespace(monotonic=lambda: 100.0))
frame.injected.read_match.side_effect = juggler.ReplyTimeout(CORE_MESSAGE)
with pytest.raises(TimeoutError) as caught:
frame.op_inner_text({"selector": "#never", "timeout": 300})
assert not isinstance(caught.value, juggler.ReplyTimeout)
assert str(caught.value) == (
"Timeout 300ms exceeded waiting for '#never' to match an element")
assert frame.injected.read_match.call_count == 1
def test_a_read_with_no_limit_gave_its_probe_no_bound_and_keeps_what_it_gets(
frame):
"""`timeout=0` is no limit: the probe was given no bound, so a
`ReplyTimeout` is not the caller's deadline and travels as it is."""
frame.injected.read_match.side_effect = juggler.ReplyTimeout(CORE_MESSAGE)
with pytest.raises(juggler.ReplyTimeout, match="no response in 0s"):
frame.op_inner_text({"selector": "#never", "timeout": 0})
assert frame.injected.read_match.call_args.kwargs["timeout"] is None
@@ -0,0 +1,93 @@
"""``measureText`` of a regional-indicator pair does not depend on what the page measured before it (e2e, every OS, firefox-68).
What the engine fixes. A flag (two regional-indicator code points, U+1F1EE U+1F1F9) set in Arial is a run that needs a FALLBACK font. The fallback
search may skip a family whose character maps are not loaded yet, start an asynchronous load and go on (``gfx.font_rendering.fallback.async``);
then the answer depends on which maps this process happens to have loaded already, and a page sees it in the width. Measured on the engine when
the site was missed: the pair through "Arial" gave 52.63 on both platforms when it was the first thing a fresh page measured, and 63.53 (Windows)
against 80.07 (Linux) once other families had been measured first: same binary, same page, another answer by load order. The font list is the
bundle (always bundle-only), so there is nothing to defer: ``gfxPlatformFontList::MayDeferCmapLoading`` answers false and both sites that ask it
(``GlobalFontFallback`` and ``gfxFontGroup::FindFallbackFaceForChar``) search synchronously (folders ``fingerprint/fonts/bundle`` and
``fingerprint/fonts/font-list`` of the series; ``StealthFallbackMayDefer`` in ``gfx/thebes/StealthBundleFontList.cpp``).
What the test reads. A browser is launched and its first page is opened on ``about:blank``; the pair of three flags is measured through
``16px Arial`` and ``40px Arial`` as the FIRST text the page measures. Then the page measures a string of Latin, Han, Arabic and an emoji through
EVERY family of the bundle manifest (the manifest the core hands the engine, ``tests/_font_names.py``), which loads the character maps of the
bundle, and measures the pairs again: the widths must be the same numbers as the first time. A second context's first page of the same browser
measures them as its first text too, and must read the same. Nothing is a timer: each read is the answer of the page to one call.
The negative control, in the same test. The assertion is about what a changed load order does; the same test runs again with the engine not declared
(``zoom.stealth.fpp.hw_seed`` = 0). On 68 bundle-only does not depend on the declaration, so the relation holds in both runs; the widths themselves
are written in the failure message and the test does not fix them (they are measurements of the first CI round: see the report of the filone).
Why a page reads it: ``CanvasRenderingContext2D.measureText().width`` is plain web API, and a flag emoji is in every fingerprinting canvas probe.
Run: pytest tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py -m e2e -v
"""
from __future__ import annotations
import pytest
import _font_names as fn
pytestmark = pytest.mark.e2e
#: Flags of Italy, the United States and Japan: pairs of regional indicators.
PAIRS = ["\U0001F1EE\U0001F1F9", "\U0001F1FA\U0001F1F8", "\U0001F1EF\U0001F1F5"]
SIZES = [16, 40]
#: Latin, Han, Arabic and an emoji: what makes the engine look for a fallback face in every family.
SAMPLE = "Hamburgefonstiv 日本語 中文 مرحبا \U0001F600"
MEASURE_PAIRS = """(args) => {
const [pairs, sizes] = args;
const ctx = document.createElement('canvas').getContext('2d');
const out = {};
for (const size of sizes) {
ctx.font = size + 'px Arial';
for (const pair of pairs) out[size + 'px ' + Array.from(pair).map(c => c.codePointAt(0).toString(16)).join('+')] = ctx.measureText(pair).width;
}
return out;
}"""
MEASURE_FAMILIES = """(args) => {
const [families, sample] = args;
const ctx = document.createElement('canvas').getContext('2d');
const out = {};
for (const family of families) {
ctx.font = '24px "' + family + '"';
out[family] = ctx.measureText(sample).width;
}
return out;
}"""
def _readings(firefox_binary, families, engine_declared):
from invisible_playwright import InvisiblePlaywright
prefs = {} if engine_declared else {"zoom.stealth.fpp.hw_seed": 0}
with InvisiblePlaywright(seed=21, binary_path=firefox_binary, headless=True, extra_prefs=prefs) as browser:
page = browser.new_context().new_page()
page.goto("about:blank", timeout=30_000)
first = page.evaluate(MEASURE_PAIRS, [PAIRS, SIZES])
measured = page.evaluate(MEASURE_FAMILIES, [families, SAMPLE])
after = page.evaluate(MEASURE_PAIRS, [PAIRS, SIZES])
other = browser.new_context().new_page()
other.goto("about:blank", timeout=30_000)
in_a_fresh_page = other.evaluate(MEASURE_PAIRS, [PAIRS, SIZES])
return first, after, in_a_fresh_page, len(measured)
def test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families(firefox_binary):
families = fn.bundle_manifest().families
for declared in (True, False):
mode = "engine declared" if declared else "engine not declared (hw_seed 0)"
first, after, fresh, measured = _readings(firefox_binary, families, declared)
assert measured == len(families), "%s: the page measured %d families, not the %d of the bundle" % (mode, measured, len(families))
assert set(first) == {"%dpx %s" % (size, "+".join(format(ord(c), "x") for c in pair)) for size in SIZES for pair in PAIRS}
assert all(width > 0 for width in first.values()), "%s: a flag measures no width at all: %r" % (mode, first)
assert first == after, (
"%s: the regional-indicator pairs measure %r as the first thing on a fresh page and %r once every family of the bundle was measured: "
"the answer depends on the load order of the character maps" % (mode, first, after))
assert first == fresh, (
"%s: the pairs measure %r in the first page and %r as the first text of another context's page: the answer depends on what the "
"process measured before" % (mode, first, fresh))
@@ -0,0 +1,54 @@
"""`AudioContext.outputLatency` and `destination.maxChannelCount` are the values the session declares.
What it fixes, in the published engine (firefox-68, series folder `fingerprint/audio/context-values`): the hooks at the top of
`AudioContext::OutputLatency` and `AudioContext::MaxChannelCount` (`dom/media/webaudio/AudioContext.cpp`) answer
`zoom.stealth.audio.output_latency_ms` / 1000 and `zoom.stealth.audio.max_channel_count` when the pref is > 0, before the engine
asks the audio device. The core declares both for every persona, because the host's answer is the machine's sound card.
A page reads both on a new `AudioContext()` with no permission. The values declared here (37 ms and 6 channels) are ones no runner
produces: a runner with no audio device answers 0 or 2.
Negative control, in the same test: with the engine off (`hw_seed` 0, stock Firefox: an active engine refuses a declaration pref cleared) the same page reads the host's values,
and they differ from the declared ones. The control reads what the host answers without asserting what it is: a runner with no audio
device may refuse the context, and that refusal is also not the declared value.
The prefs are set through `extra_prefs`, the overlay the core applies last.
"""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.e2e
OUTPUT_LATENCY = "zoom.stealth.audio.output_latency_ms"
MAX_CHANNELS = "zoom.stealth.audio.max_channel_count"
HW_SEED = "zoom.stealth.fpp.hw_seed"
READ = """() => {
try {
const ctx = new (window.AudioContext || window.webkitAudioContext)();
return {outputLatency: ctx.outputLatency, maxChannelCount: ctx.destination.maxChannelCount};
} catch (e) {
return {error: String(e)};
}
}"""
def read(binary, prefs):
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=42, binary_path=binary, headless=True, locale="en-US",
timezone="America/New_York", extra_prefs=prefs) as browser:
page = browser.new_page()
page.goto("about:blank", timeout=60_000)
return page.evaluate(READ)
def test_the_audio_context_answers_the_declared_latency_and_channel_count(firefox_binary):
declared = read(firefox_binary, {OUTPUT_LATENCY: 37, MAX_CHANNELS: 6})
assert declared == {"outputLatency": 0.037, "maxChannelCount": 6}, declared
host = read(firefox_binary, {HW_SEED: 0})
assert host != declared, (host, declared)
assert host.get("outputLatency") != 0.037, host
assert host.get("maxChannelCount") != 6, host
+103
View File
@@ -0,0 +1,103 @@
"""The audio values a page reads follow the seed only when the audio noise is on.
What it fixes, in the published engine (firefox-68, series folder `fingerprint/audio/noise`): the audio noise hooks of
`dom/media/webaudio/` (`AnalyserNode.cpp` for `getFloatFrequencyData` and `getFloatTimeDomainData`, `AudioDestinationNode.cpp` for the
`OfflineAudioContext` render, `DynamicsCompressorNode.h` for `compressor.reduction`). When `zoom.stealth.audio.fp_noise` is true the
engine adds noise derived from `zoom.stealth.fpp.hw_seed` to those four values; the wrapper ships the pref false, so the values
of a product session are the stock ones.
Four values are read in one rendered graph (oscillator, compressor, analyser, destination of an `OfflineAudioContext(1, 5000, 44100)`):
the rendered samples, the analyser's frequency data, the analyser's time-domain data and the compressor's reduction.
Each is hashed over its float bits in the page, so a one-bit change shows.
With the noise ON: the same `hw_seed` gives the same four values on a fresh browser, and two seeds (11 and 22) give different ones;
the values also differ from the noise-off ones. The negative control is the same two seeds with `fp_noise` false: the four values are equal
across seeds, because the noise is the only thing that carries the seed. A page reads these values with no permission and no device (an
offline context renders without an audio output), so a runner with no sound card gives the same answers.
The seed is the engine's `hw_seed`, set directly (`extra_prefs`): the wrapper maps its own seed to a small pool of render seeds, so two
wrapper seeds can share one.
"""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.e2e
NOISE = "zoom.stealth.audio.fp_noise"
HW_SEED = "zoom.stealth.fpp.hw_seed"
VALUES = ("offline", "frequency", "time", "reduction")
# FNV-1a over the 32-bit patterns of a float array, so equality is bit equality and -Infinity (a silent analyser bin) needs no JSON.
RENDER = """async () => {
const hash = (floats) => {
const bits = new Uint32Array(new Float32Array(floats).buffer);
let h = 0x811c9dc5;
for (let i = 0; i < bits.length; i++) { h ^= bits[i]; h = Math.imul(h, 0x01000193) >>> 0; }
return h.toString(16) + ':' + bits.length;
};
const ctx = new OfflineAudioContext(1, 5000, 44100);
const osc = ctx.createOscillator();
osc.type = 'triangle';
osc.frequency.value = 10000;
const comp = ctx.createDynamicsCompressor();
comp.threshold.value = -50;
comp.knee.value = 40;
comp.ratio.value = 12;
comp.attack.value = 0;
comp.release.value = 0.25;
const analyser = ctx.createAnalyser();
osc.connect(comp);
comp.connect(analyser);
analyser.connect(ctx.destination);
osc.start(0);
const rendered = await ctx.startRendering();
const freq = new Float32Array(analyser.frequencyBinCount);
analyser.getFloatFrequencyData(freq);
const time = new Float32Array(analyser.fftSize);
analyser.getFloatTimeDomainData(time);
return {
offline: hash(rendered.getChannelData(0)),
frequency: hash(freq),
time: hash(time),
reduction: hash([comp.reduction]),
};
}"""
def read_values(binary, fixture_server, noise, hw_seed):
from invisible_playwright import InvisiblePlaywright
prefs = {NOISE: noise, HW_SEED: hw_seed}
with InvisiblePlaywright(seed=42, binary_path=binary, headless=True, locale="en-US",
timezone="America/New_York", extra_prefs=prefs) as browser:
page = browser.new_page()
page.goto(fixture_server + "/from-network", timeout=60_000)
return page.evaluate(RENDER)
def test_audio_values_follow_the_seed_only_when_fp_noise_is_on(firefox_binary, fixture_server):
on_11 = read_values(firefox_binary, fixture_server, True, 11)
on_11_again = read_values(firefox_binary, fixture_server, True, 11)
on_22 = read_values(firefox_binary, fixture_server, True, 22)
off_11 = read_values(firefox_binary, fixture_server, False, 11)
off_22 = read_values(firefox_binary, fixture_server, False, 22)
# Every value was read (a hash of N floats, N > 0).
for name in VALUES:
for run in (on_11, on_22, off_11, off_22):
assert not run[name].endswith(":0"), (name, run)
# Noise on: the same seed, the same values, on a fresh browser.
assert on_11 == on_11_again, (on_11, on_11_again)
# Noise on: two seeds, different values, one by one.
for name in VALUES:
assert on_11[name] != on_22[name], (name, on_11, on_22)
# Noise on is not noise off: the noise is what moves each value.
for name in VALUES:
assert on_11[name] != off_11[name], (name, on_11, off_11)
# Control, noise off: the seed carries nothing, the values are equal across seeds.
assert off_11 == off_22, (off_11, off_22)
@@ -0,0 +1,50 @@
"""`new AudioContext().sampleRate` is the rate the session declares.
What it fixes, in the published engine (firefox-68, series folder `fingerprint/audio/sample-rate`): the hook in
`mozilla::CubebUtils::PreferredSampleRate` (`dom/media/CubebUtils.cpp`) returns `zoom.stealth.audio.sample_rate` when it is > 0,
before the resist-fingerprinting 44100 and before the audio device is asked. The core declares a rate for every persona, because the
host's rate is the machine's sound card (44100, 48000, 96000...).
A page reads it on a new `AudioContext()` with no permission. The rate declared here, 22050, is one no sound card reports.
Negative control, in the same test: with the engine off (`hw_seed` 0, stock Firefox: an active engine refuses a declaration pref cleared) the same page reads the host's rate,
which is not 22050. The control does not assert what the host answers: a runner with no audio device answers its fallback, and a
refused context is also not the declared rate.
The pref is set through `extra_prefs`, the overlay the core applies last.
"""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.e2e
SAMPLE_RATE = "zoom.stealth.audio.sample_rate"
HW_SEED = "zoom.stealth.fpp.hw_seed"
READ = """() => {
try {
return {sampleRate: new (window.AudioContext || window.webkitAudioContext)().sampleRate};
} catch (e) {
return {error: String(e)};
}
}"""
def read(binary, prefs):
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=42, binary_path=binary, headless=True, locale="en-US",
timezone="America/New_York", extra_prefs=prefs) as browser:
page = browser.new_page()
page.goto("about:blank", timeout=60_000)
return page.evaluate(READ)
def test_the_audio_context_answers_the_declared_sample_rate(firefox_binary):
declared = read(firefox_binary, {SAMPLE_RATE: 22050})
assert declared == {"sampleRate": 22050}, declared
host = read(firefox_binary, {HW_SEED: 0})
assert host != declared, (host, declared)
assert host.get("sampleRate") != 22050, host
+131
View File
@@ -0,0 +1,131 @@
"""``@font-face { src: local(<name>) }`` finds the faces of the bundle by their PostScript name, and never a font that only the host has (e2e, every OS, firefox-68).
What the engine fixes. A page can ask for an installed font by name with ``src: local("ArialMT")`` (the PostScript name or the full name of a face)
and learn from ``FontFace.status`` whether the browser has it. The font list of the engine is the bundle and nothing else
(``gfxPlatformFontList::mStealthBundleOnly``, set in the constructor, on every platform and whether or not the engine is declared): the face
names the ``local()`` lookup searches are read from the ``name`` tables of the bundle's files (``RecordFaceNamesFromTable``,
``ReadFaceNamesForFamily``; folders ``fingerprint/fonts/font-list`` and ``fingerprint/fonts/bundle`` of the series), never from DirectWrite
or fontconfig. So the PostScript name of a bundled face resolves, a name that only the host's fonts carry does not, and the answer is the same
on every machine: a page that probes ``local()`` learns the bundle, not the machine.
What the test reads. One page declares, for each name, ``@font-face { font-family: <probe>; src: local("<name>") }`` and loads it
(``document.fonts.load``), then reads the ``status`` of that face (``loaded`` or ``error``, an event of the page: no timer) and the width of one
string through the probe family. Four PostScript names of the bundle come from the manifest the core hands to the engine (``ArialMT``,
``TimesNewRomanPSMT``, and the faces ``MS-PGothic`` and ``NSimSun``, which are NOT the first face of their ``.ttc`` file): each must be ``loaded``
and draw with the same width as the family it belongs to (the same face, not another one that happened to load). The host-only face is read from
the host's own font files (``tests/_font_names.py``: the ``name`` table of every file of the folders the system installs fonts in, minus every
name the bundle knows): its PostScript name AND its full name must be ``error``. On Linux the face asked for is DejaVu Sans when the host has
it, on Windows the first font of ``%WINDIR%\\Fonts`` the bundle does not carry; no value is typed in the test, and a host that has no such font
fails the test (there would be nothing the control could find).
The negative control, in the same test. The names the host has are the ones that must NOT resolve, so the same page runs a second time with the
engine not declared (``zoom.stealth.fpp.hw_seed`` = 0, the pref the core uses to tell the engine to stay stock). On firefox-68 bundle-only
does NOT depend on the engine being declared (the member is set unconditionally in the constructor), so the control reads the same: the bundled
names resolve and the host-only names do not, engine on or off. The test asserts that equality; it is the characterization of what 68 does, and
the day the engine changes it (the host fonts reaching ``local()`` with the engine off) this test is red. A name that exists nowhere
(``NoSuchFace-ZZ``) is read in both runs as the control of the probe itself: it is ``error``, so the probe can tell a missing face from a
loaded one.
Why a page reads it: ``FontFace.status`` after ``document.fonts.load()`` is plain web API; fingerprinting scripts probe installed fonts this
way as well as by width.
Run: pytest tests/test_bundle_font_names_e2e.py -m e2e -v
"""
from __future__ import annotations
import sys
import pytest
import _font_names as fn
pytestmark = pytest.mark.e2e
#: PostScript name -> the family it belongs to in the bundle manifest. The last two are faces of a collection that are not face 0 of their file.
BUNDLED = [("ArialMT", "Arial"), ("TimesNewRomanPSMT", "Times New Roman"), ("MS-PGothic", "MS PGothic"), ("NSimSun", "NSimSun")]
#: Declared by no machine: the control of the probe.
NOWHERE = "NoSuchFace-ZZ"
TEXT = "mmmmmmmmmmlliWWW0Oq@"
#: The page. `cases` is [[local name, family it must draw like or null], ...]. It reports, for each: the status of the face once its load settled
#: and the widths of TEXT through the probe family, through the target family, and through the generics (the width of a face that is not there).
PROBE = """async (args) => {
const [cases, text] = args;
const span = document.createElement('span');
span.style.cssText = 'position:absolute;left:-9999px;top:0;white-space:pre;font-size:48px;font-style:normal;font-weight:400;';
span.textContent = text;
document.body.appendChild(span);
const width = (family) => { span.style.fontFamily = family; return span.getBoundingClientRect().width; };
const generics = ['monospace', 'sans-serif', 'serif'].map(width);
const out = [];
let n = 0;
for (const [name, target] of cases) {
const probe = 'LocalProbe' + (n++);
const style = document.createElement('style');
style.textContent = '@font-face { font-family: ' + probe + '; src: local("' + name + '"); }';
document.head.appendChild(style);
await document.fonts.load('48px ' + probe).catch(() => null);
const face = Array.from(document.fonts).find(f => f.family.replace(/["']/g, '') === probe);
out.push({
name: name, status: face ? face.status : 'no-face',
probe: width(probe + ', monospace'),
target: target ? width('"' + target + '", monospace') : null,
generics: generics,
});
}
span.remove();
return out;
}"""
def _read(firefox_binary, cases, engine_declared):
from invisible_playwright import InvisiblePlaywright
prefs = {} if engine_declared else {"zoom.stealth.fpp.hw_seed": 0}
with InvisiblePlaywright(seed=21, binary_path=firefox_binary, headless=True, extra_prefs=prefs) as browser:
page = browser.new_context().new_page()
page.goto("about:blank", timeout=30_000)
return page.evaluate(PROBE, [cases, TEXT])
def test_src_local_resolves_a_bundled_postscript_name_and_not_a_host_only_name(firefox_binary):
manifest = fn.bundle_manifest()
for psname, family in BUNDLED:
assert manifest.family_of_psname(psname) == family, (
"the manifest of the core has no face %r in the family %r: the names this test asks for are not the bundle's" % (psname, family))
known = fn.bundle_file_names(manifest, firefox_binary)
prefer = ["DejaVu Sans"] if sys.platform != "win32" else []
host = fn.a_host_only_face(manifest, prefer=prefer, extra_known=known)
cases = [[psname, family] for psname, family in BUNDLED]
cases += [[host["psname"], None], [host["full"], None], [NOWHERE, None]]
host_names = (host["psname"], host["full"])
runs = {declared: {row["name"]: row for row in _read(firefox_binary, cases, declared)} for declared in (True, False)}
for declared, rows in runs.items():
mode = "engine declared" if declared else "engine not declared (hw_seed 0)"
# the probe tells a missing face from a loaded one
assert rows[NOWHERE]["status"] == "error", "%s: a name that exists nowhere read as %r, not error: the probe cannot tell a missing face" % (mode, rows[NOWHERE])
# the bundle: found, and it is the face of its family
for psname, family in BUNDLED:
row = rows[psname]
assert row["status"] == "loaded", "%s: src:local(%s) is %r, not loaded: a PostScript name of the bundle does not resolve (%r)" % (mode, psname, row["status"], row)
assert row["probe"] == row["target"], (
"%s: src:local(%s) draws %r wide and the family %s %r wide: it loaded another face than the bundle's" % (mode, psname, row["probe"], family, row["target"]))
assert any(row["probe"] != g for g in row["generics"]), (
"%s: src:local(%s) draws as a generic (%r): the face drew nothing of its own" % (mode, psname, row))
# the host: the file is on this machine's disk, and the engine does not know its names
for name in host_names:
row = rows[name]
assert row["status"] == "error", (
"%s: src:local(%s) is %r: the name belongs to the host font %s (%s) and the bundle has no such face, so a page learns the machine "
"from it" % (mode, name, row["status"], host["file"], host["families"]))
# on 68 the bundle-only list does not depend on the engine being declared: the same answers with it off
on = {name: runs[True][name]["status"] for name in runs[True]}
off = {name: runs[False][name]["status"] for name in runs[False]}
assert on == off, "the statuses of src:local() differ between the engine declared (%r) and not declared (%r)" % (on, off)
@@ -0,0 +1,135 @@
"""``createPattern`` of a WebGL canvas reads the pixels the page would read from it, with the engine's projection; a 2D source is untouched (e2e, every OS, firefox-68).
What the engine fixes. The engine's per-seed noise (the projection, ``fingerprint/canvas/noise-projection``) is applied where a WebGL or WebGPU
canvas hands its pixels out: readPixels, toDataURL, and the snapshot a canvas gives when another canvas draws it. ``CanvasRenderingContext2D::
CreatePattern`` used to read its source canvas through the pattern's own context, a path the noise does not pass, so
``createPattern(webglCanvas)`` + ``fill`` + ``getImageData`` returned the CLEAN pixels of the render while ``drawImage(webglCanvas)`` returned the
projected ones: a page compared the two and read the difference. On firefox-68 two lines of ``CreatePattern`` (the HTMLCanvasElement and the
OffscreenCanvas overloads; folder ``fingerprint/canvas/text-metrics`` of the series, ``dom/canvas/CanvasRenderingContext2D.cpp``) read the snapshot
from the element, so the pattern carries the projection. A 2D canvas is not projected at all (a 2D canvas reads back exactly as drawn,
``tests/test_canvas_reads_as_drawn.py``), so a pattern of a 2D canvas is the same pixels with the engine on and off.
What the test reads. One page builds a source (a WebGL canvas, a WebGL OffscreenCanvas, or a 2D canvas), fills a 2D canvas with
``createPattern(source, 'no-repeat')`` and reads it back with ``getImageData``, then clears it and draws the source with ``drawImage`` and reads that.
The WebGL render is a triangle with per-vertex colours and antialiased edges on a white clear (what a fingerprinting page draws, and where the
projection acts: ``tests/test_webgl_noise_active.py``); the 2D source is a gradient, an antialiased arc and a rotated rectangle.
The negative control, in the same module. The same page runs with the engine not declared (``zoom.stealth.fpp.hw_seed`` = 0: no projection): the
WebGL pattern pixels with the engine declared must DIFFER from those (the projection is what changed them), and the 2D pattern pixels must be the
SAME bytes with the engine on and off. A render that is not drawn (a blank source) fails the test: the pixels are checked to hold more than one
colour. WebGL being unavailable on the runner is a failure, not a skip.
Run: pytest tests/test_canvas_create_pattern_projection_e2e.py -m e2e -v
"""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.e2e
SIZE = 64
READ = """(args) => {
const [kind, size] = args;
let source;
if (kind === 'webgl' || kind === 'offscreen-webgl') {
source = kind === 'webgl' ? document.createElement('canvas') : new OffscreenCanvas(size, size);
source.width = size; source.height = size;
const gl = source.getContext('webgl', {preserveDrawingBuffer: true, antialias: true});
if (!gl) return {error: 'no webgl context for ' + kind};
const vs = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vs, 'attribute vec2 p; attribute vec3 c; varying vec3 v; void main(){v=c;gl_Position=vec4(p,0.,1.);}');
gl.compileShader(vs);
const fs = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fs, 'precision mediump float; varying vec3 v; void main(){gl_FragColor=vec4(v,1.);}');
gl.compileShader(fs);
const pr = gl.createProgram(); gl.attachShader(pr, vs); gl.attachShader(pr, fs);
gl.linkProgram(pr); gl.useProgram(pr);
const b = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, b);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(
[-0.9, -0.8, 1, 0, 0, 0.85, -0.6, 0, 1, 0, 0.1, 0.9, 0, 0, 1]), gl.STATIC_DRAW);
const pl = gl.getAttribLocation(pr, 'p'), cl = gl.getAttribLocation(pr, 'c');
gl.enableVertexAttribArray(pl); gl.vertexAttribPointer(pl, 2, gl.FLOAT, false, 20, 0);
gl.enableVertexAttribArray(cl); gl.vertexAttribPointer(cl, 3, gl.FLOAT, false, 20, 8);
gl.clearColor(1, 1, 1, 1); gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.TRIANGLES, 0, 3);
gl.finish();
} else {
source = document.createElement('canvas'); source.width = size; source.height = size;
const s = source.getContext('2d');
const g = s.createLinearGradient(0, 0, size, size);
g.addColorStop(0, '#f60'); g.addColorStop(0.5, '#069'); g.addColorStop(1, '#6c0');
s.fillStyle = g; s.fillRect(0, 0, size, size);
s.strokeStyle = 'rgba(20, 20, 20, 0.8)'; s.lineWidth = 3.3;
s.beginPath(); s.arc(size * 0.5, size * 0.45, size * 0.31, 0, 2 * Math.PI * 0.83); s.stroke();
s.save(); s.translate(size * 0.6, size * 0.6); s.rotate(0.37); s.fillStyle = 'rgba(255, 255, 255, 0.6)';
s.fillRect(-size * 0.2, -size * 0.1, size * 0.4, size * 0.2); s.restore();
}
const dst = document.createElement('canvas'); dst.width = size; dst.height = size;
const d = dst.getContext('2d');
d.fillStyle = d.createPattern(source, 'no-repeat');
d.fillRect(0, 0, size, size);
const viaPattern = Array.from(d.getImageData(0, 0, size, size).data);
d.clearRect(0, 0, size, size);
d.drawImage(source, 0, 0);
const viaDraw = Array.from(d.getImageData(0, 0, size, size).data);
return {viaPattern: viaPattern, viaDraw: viaDraw};
}"""
KINDS = ["webgl", "offscreen-webgl", "2d"]
def _read(firefox_binary, engine_declared):
from invisible_playwright import InvisiblePlaywright
prefs = {} if engine_declared else {"zoom.stealth.fpp.hw_seed": 0}
out = {}
with InvisiblePlaywright(seed=21, binary_path=firefox_binary, headless=True, extra_prefs=prefs) as browser:
page = browser.new_context().new_page()
page.goto("about:blank", timeout=30_000)
for kind in KINDS:
got = page.evaluate(READ, [kind, SIZE])
assert "error" not in got, got["error"]
out[kind] = {name: bytes(values) for name, values in got.items()}
return out
@pytest.fixture(scope="module")
def readings(firefox_binary):
"""kind -> {viaPattern, viaDraw} bytes, with the engine declared and not declared. The browsers are closed before the tests run."""
declared = _read(firefox_binary, True)
stock = _read(firefox_binary, False)
for mode, rows in (("engine declared", declared), ("engine not declared", stock)):
for kind, row in rows.items():
assert len(row["viaPattern"]) == SIZE * SIZE * 4 and len(set(row["viaPattern"])) > 1, (
"%s: the %s pattern read back is blank or has the wrong size: the source was not drawn" % (mode, kind))
return {"declared": declared, "stock": stock}
def test_create_pattern_from_a_webgl_canvas_carries_the_projection(readings):
declared, stock = readings["declared"]["webgl"], readings["stock"]["webgl"]
assert declared["viaPattern"] != stock["viaPattern"], (
"createPattern(webglCanvas) reads the same pixels with the engine declared and not declared: the pattern is the clean render, the "
"projection does not reach it")
def test_create_pattern_from_an_offscreen_webgl_canvas_carries_the_projection(readings):
declared, stock = readings["declared"]["offscreen-webgl"], readings["stock"]["offscreen-webgl"]
assert declared["viaPattern"] != stock["viaPattern"], (
"createPattern(offscreenWebglCanvas) reads the same pixels with the engine declared and not declared: the pattern is the clean render, "
"the projection does not reach it")
@pytest.mark.parametrize("kind", ["webgl", "offscreen-webgl"])
def test_a_pattern_of_a_webgl_canvas_reads_what_drawimage_of_it_reads(readings, kind):
declared = readings["declared"][kind]
assert declared["viaPattern"] == declared["viaDraw"], (
"%s: the pixels of createPattern + fill and of drawImage differ with the engine declared: the two reads of one canvas carry "
"different projections" % kind)
def test_create_pattern_from_a_2d_canvas_reads_the_same_with_the_engine_on_and_off(readings):
declared, stock = readings["declared"]["2d"], readings["stock"]["2d"]
assert declared["viaPattern"] == stock["viaPattern"], (
"createPattern(2dCanvas) differs between the engine declared and not declared: a 2D source must be read as drawn")
assert declared["viaDraw"] == stock["viaDraw"], "drawImage(2dCanvas) differs between the engine declared and not declared"
assert declared["viaPattern"] == declared["viaDraw"], "a pattern of a 2D canvas is not the pixels drawImage reads"
@@ -1,187 +0,0 @@
"""Tagged images drawn on a canvas read back as retail Windows Firefox reads them.
Retail Firefox 159.0 on Windows with the default prefs converts an image that carries a colour
tag (an iCCP chunk, cICP, gAMA + cHRM, an sRGB chunk, a JPEG APP2 profile) from its own space
to the output profile with qcms, and the output profile is the monitor's: on a stock Windows
that is "sRGB Color Space Profile.icm", which qcms does not take for sRGB, so the bytes
getImageData returns for drawImage and createImageBitmap change by a few units. The engine
declares that profile (it never reads the host's) and converts like retail from firefox-64.
Until firefox-59 it skipped the conversion (force_srgb): 27 of the 72 probes below differ
there, and this test fails on such an engine, naming each of them. It is gated on
firefox-64 only so that those releases skip it instead of failing the run.
tests/data/canvas_icc_ref/index.html, a page served on localhost, measures 72 probes:
40 the ten images of gen_images.py (iccp Display P3, Adobe RGB, Rec.2020 primaries,
ProPhoto, sRGB primaries; cicp-p3; gama-chrm-p3; srgb-chunk; untagged; a JPEG with a
Display P3 profile) each drawn with drawImage (16 px), drawImage scaled to 32 px,
createImageBitmap with the default colorSpaceConversion and with "none"
22 fillRect with CSS colours (color(display-p3 ...), color-mix(), oklab, ...)
1 a canvas opened with colorSpace "display-p3"
9 environment values (color-gamut, dynamic-range, colour depth, devicePixelRatio, the
colour scheme); the colour scheme is the machine's theme and is not compared
The 27 that depend on the profile are the drawImage, drawImage at 32 px and
createImageBitmap-default probes of the nine tagged images. Each probe's RGBA bytes
(getImageData) are hashed with SHA-256. The images are not files of the repository: the test
builds them with tests/data/canvas_icc_ref/gen_images.py (standard library, the bytes the
measurement used, checked against refs.json before the browser starts) and serves them.
tests/data/canvas_icc_ref/refs.json holds the hashes retail Firefox 159.0 gave on Windows
(build 20261022150525, firefox.exe sha256 d8b5ed82...) with default prefs, gfx.canvas.accelerated
off and the monitor profile above (sha256 2b3aa164...), measured twice with equal results; for
the 27 probes it also holds the hash without the conversion (force_srgb=true on the same
machine), which the failure message names when the engine gave that value. The file is built
by scripts/build_canvas_icc_refs.py from the run files.
Every differing probe is listed (name, expected hash, hash got), not just the first. Set
INVISIBLE_CANVAS_ICC_OUT to a directory and the run writes the hashes it got there
(canvas_icc_<tag>.json).
Run: pytest tests/test_canvas_icc_readback_is_windows_e2e.py -m e2e -v
"""
from __future__ import annotations
import hashlib
import http.server
import importlib.util
import json
import os
import threading
from pathlib import Path
import pytest
from invisible_playwright import InvisiblePlaywright
ROOT = Path(__file__).resolve().parents[1]
DATA = Path(__file__).parent / "data" / "canvas_icc_ref"
#: The page's result without the pixel hex (only the hashes are compared; the hex of every
#: probe would cross the pipe for nothing).
_RESULT = """
() => {
const strip = (o) => {
if (o === null || typeof o !== "object") return o;
const out = {};
for (const [k, v] of Object.entries(o)) if (k !== "rgba_hex") out[k] = strip(v);
return out;
};
return strip(window.R);
}
"""
def _load(path, name):
spec = importlib.util.spec_from_file_location(name, path)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
return mod
def _serve(imgs, listing):
"""index.html, images.json and the generated images, on 127.0.0.1."""
page = (DATA / "index.html").read_bytes()
routes = {"/": (page, "text/html"), "/index.html": (page, "text/html")}
routes["/images.json"] = (json.dumps(listing).encode(), "application/json")
for iid, ext, data, _what in imgs:
kind = "image/jpeg" if ext == "jpg" else "image/png"
routes["/images/%s.%s" % (iid, ext)] = (data, kind)
class _H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
hit = routes.get(self.path.split("?")[0])
if hit is None:
self.send_error(404)
return
body, kind = hit
self.send_response(200)
self.send_header("Content-Type", kind)
self.send_header("Content-Length", str(len(body)))
self.send_header("Cache-Control", "no-store")
self.end_headers()
self.wfile.write(body)
def log_message(self, *args):
pass
server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), _H)
threading.Thread(target=server.serve_forever, daemon=True).start()
return server
@pytest.mark.e2e
@pytest.mark.timeout(300, method="thread")
def test_tagged_images_read_back_as_retail_windows_reads_them(firefox_binary, engine_at_least):
engine_at_least("firefox-68")
refs_path = DATA / "refs.json"
if not refs_path.is_file():
pytest.fail("tests/data/canvas_icc_ref/refs.json is missing: it is the reference "
"retail Firefox on Windows wrote for this page (see the module docstring)")
refs = json.loads(refs_path.read_text(encoding="utf-8"))
want = refs["probes"]
gen = _load(DATA / "gen_images.py", "canvas_icc_gen_images")
imgs, _profiles = gen.build_images()
drift = ["%s: %s bytes, sha256 %s, the reference was made with %s"
% (iid, len(data), hashlib.sha256(data).hexdigest(), refs["images"][iid]["sha256"])
for iid, _ext, data, _what in imgs
if hashlib.sha256(data).hexdigest() != refs["images"][iid]["sha256"]]
assert not drift, ("gen_images.py no longer writes the images the reference was measured "
"with, so it compares nothing:\n " + "\n ".join(drift))
builder = _load(ROOT / "scripts" / "build_canvas_icc_refs.py", "canvas_icc_build_refs")
server = _serve(imgs, gen.images_json(imgs))
try:
url = "http://127.0.0.1:%d/" % server.server_address[1]
with InvisiblePlaywright(seed=21, binary_path=firefox_binary, headless=True,
pin={"screen.dpr": 1.0}) as b:
page = b.new_context().new_page()
page.goto(url, timeout=60_000)
page.wait_for_function("window.DONE === true || window.ERR", timeout=240_000)
err = page.evaluate("window.ERR || null")
assert err is None, "the reference page failed: %s" % err
result = page.evaluate(_RESULT)
finally:
server.shutdown()
try:
got = builder.probes(result)
except builder.RefError as e:
pytest.fail("the page did not give a hash for every probe: %s" % e)
out_dir = os.environ.get("INVISIBLE_CANVAS_ICC_OUT")
if out_dir:
from invisible_core.seal import active_seal
Path(out_dir).mkdir(parents=True, exist_ok=True)
(Path(out_dir) / ("canvas_icc_%s.json" % active_seal().tag)).write_text(
json.dumps({k: v["sha256"] for k, v in got.items()}, indent=1, sort_keys=True),
encoding="utf-8")
compared = sorted(k for k, v in want.items() if v.get("compared", True))
missing = sorted(k for k in want if k not in got)
extra = sorted(set(got) - set(want))
differ = [k for k in compared if k in got and got[k]["sha256"] != want[k]["sha256"]]
lines = []
for k in differ:
note = ""
if got[k]["sha256"] == want[k].get("without_conversion_sha256"):
note = " (the value without the conversion: qcms did not convert)"
elif "without_conversion_sha256" in want[k]:
note = " (depends on the display profile)"
shown = ("; reference value %r, got %r" % (want[k]["value"], got[k]["value"])
if want[k]["kind"] == "env" else "")
lines.append("%s: expected %s, got %s%s%s"
% (k, want[k]["sha256"], got[k]["sha256"], shown, note))
lines += ["not drawn: " + k for k in missing]
if extra:
lines.append("drawn but not in the reference: " + ", ".join(extra))
unconverted = [k for k in differ
if got[k]["sha256"] == want[k].get("without_conversion_sha256")]
assert not lines, (
"%d of %d canvas colour probes differ from retail Firefox 159.0 on Windows, %d were not "
"drawn; %d of the %d that depend on the display profile gave the value without the "
"conversion.\n %s"
% (len(differ), len(compared), len(missing), len(unconverted),
refs["profile_dependent_count"], "\n ".join(lines)))
@@ -0,0 +1,122 @@
"""``measureText`` answers the vertical metrics of the bundled font as whole numbers, as retail Windows Firefox does (e2e, every OS, firefox-68).
What the engine fixes. With the engine declared, ``CanvasRenderingContext2D::DrawOrMeasureText`` hands the run to ``StealthHostIndepTextMetrics``
(``fingerprint/canvas/text-metrics``, ``dom/canvas/StealthCanvasTextMetrics.h`` of the series), which takes the font's vertical metrics from the
bundled font's own OS/2 table (usWinAscent and usWinDescent, from the manifest the core hands to the engine) instead of the host's rasteriser, and
ROUNDS them the way a Windows Firefox does (``gfxDWriteFont::ComputeMetrics`` rounds the pair, then derives the em box from the rounded pair). On
retail, ``fontBoundingBoxAscent`` and ``fontBoundingBoxDescent`` are therefore whole numbers at every size, and so are the four
``actualBoundingBox*`` of the empty string (it has no ink); a public fingerprinting page measures exactly that
string and flags any value that is not whole. Fractional values (65.1796875 for 72px Arial) are what a FreeType host computes from the same table.
What the test reads. One page measures ``Hamburgefonstiv`` and the empty string through ``Arial`` at 10, 12, 16, 20 and 72 px
(``ctx.font = "<n>px Arial"``) and returns the twelve fields of every TextMetrics. The expected font-box values are the rounded
``usWin`` metrics of the Arial face in the bundle manifest (``tests/_font_names.py``: ascent 1854, descent 434, unit 2048): round(1854 x px / 2048)
and round(434 x px / 2048); four of them are also written as the retail measurements recorded with the engine source (72px ascent 65, 20px
ascent 18, 12px ascent 11, 10px descent 2).
The negative control, in the same test. The page runs again with the engine not declared (``zoom.stealth.fpp.hw_seed`` = 0), which keeps the
stock code. The control is adapted to the OS because the stock code is a different one on each:
* Linux: the stock path is FreeType's, which does not round like DirectWrite: the twelve fields over the five sizes DIFFER from the engine's.
The page is the one that tells the host's values from the declared ones.
* Windows: the stock path IS DirectWrite's (the retail path the engine reproduces), so the font box with the engine off is the same whole numbers
the engine declares: the test asserts that they are equal, which is the engine matching the Windows rasteriser and not an invented rounding.
Why a page reads it: ``CanvasRenderingContext2D.measureText`` is plain web API; ``fontBoundingBoxAscent`` is in the probe of every canvas
fingerprint.
Run: pytest tests/test_canvas_measure_text_metrics_e2e.py -m e2e -v
"""
from __future__ import annotations
import math
import sys
import pytest
import _font_names as fn
pytestmark = pytest.mark.e2e
SIZES = [10, 12, 16, 20, 72]
TEXT = "Hamburgefonstiv"
FIELDS = ["width", "actualBoundingBoxLeft", "actualBoundingBoxRight", "actualBoundingBoxAscent", "actualBoundingBoxDescent",
"fontBoundingBoxAscent", "fontBoundingBoxDescent", "emHeightAscent", "emHeightDescent", "hangingBaseline", "alphabeticBaseline",
"ideographicBaseline"]
#: Retail Windows Firefox, Arial, recorded with the engine source: (size, field) -> value.
RETAIL = {(72, "fontBoundingBoxAscent"): 65, (20, "fontBoundingBoxAscent"): 18, (12, "fontBoundingBoxAscent"): 11,
(10, "fontBoundingBoxDescent"): 2}
MEASURE = """(args) => {
const [sizes, text, fields] = args;
const ctx = document.createElement('canvas').getContext('2d');
const read = (m) => { const o = {}; for (const f of fields) o[f] = m[f]; return o; };
const out = {};
for (const size of sizes) {
ctx.font = size + 'px Arial';
out[size] = {text: read(ctx.measureText(text)), empty: read(ctx.measureText(''))};
}
return out;
}"""
def _read(firefox_binary, engine_declared):
from invisible_playwright import InvisiblePlaywright
prefs = {} if engine_declared else {"zoom.stealth.fpp.hw_seed": 0}
with InvisiblePlaywright(seed=21, binary_path=firefox_binary, headless=True, extra_prefs=prefs) as browser:
page = browser.new_context().new_page()
page.goto("about:blank", timeout=30_000)
raw = page.evaluate(MEASURE, [SIZES, TEXT, FIELDS])
return {int(size): rows for size, rows in raw.items()}
def _whole(value):
return float(value).is_integer()
def _round(value):
"""std::round: halves away from zero (the values here are positive)."""
return int(math.floor(value + 0.5))
def test_measure_text_vertical_metrics_are_whole_and_retail(firefox_binary):
arial = fn.bundle_manifest().face_with_psname("ArialMT")
upem, ascent, descent = arial["upem"], arial["ascent"], arial["descent"]
expected = {size: {"fontBoundingBoxAscent": _round(ascent * size / upem), "fontBoundingBoxDescent": _round(descent * size / upem)}
for size in SIZES}
for (size, field), value in RETAIL.items():
assert expected[size][field] == value, (
"the rounded OS/2 metric of the manifest's Arial (%s at %dpx = %r) is not the retail value %r the engine source records: the manifest "
"is not the face this test was written for" % (field, size, expected[size][field], value))
declared = _read(firefox_binary, True)
for size in SIZES:
for kind in ("text", "empty"):
row = declared[size][kind]
for field in ("fontBoundingBoxAscent", "fontBoundingBoxDescent"):
assert _whole(row[field]), "engine declared: %dpx Arial %s of %r is %r, not a whole number" % (size, field, kind, row[field])
assert row[field] == expected[size][field], (
"engine declared: %dpx Arial %s of %r is %r, the rounded OS/2 metric of the bundled face is %r"
% (size, field, kind, row[field], expected[size][field]))
for field in ("actualBoundingBoxLeft", "actualBoundingBoxRight", "actualBoundingBoxAscent", "actualBoundingBoxDescent"):
assert _whole(declared[size]["empty"][field]), (
"engine declared: %dpx Arial %s of the empty string is %r, not a whole number: a page that measures the empty string reads a "
"host rasteriser" % (size, field, declared[size]["empty"][field]))
stock = _read(firefox_binary, False)
if sys.platform == "win32":
for size in SIZES:
for kind in ("text", "empty"):
for field in ("fontBoundingBoxAscent", "fontBoundingBoxDescent"):
assert stock[size][kind][field] == declared[size][kind][field], (
"engine not declared: %dpx Arial %s of %r is %r on the DirectWrite path and %r with the engine: the engine's rounding is "
"not the Windows rasteriser's" % (size, field, kind, stock[size][kind][field], declared[size][kind][field]))
else:
different = [(size, kind, field) for size in SIZES for kind in ("text", "empty") for field in FIELDS
if stock[size][kind][field] != declared[size][kind][field]]
assert different, (
"engine not declared: the twelve fields over five sizes are the same as with the engine declared: the page cannot tell the host's "
"values from the declared ones, so the control proves nothing")
+84
View File
@@ -15,6 +15,9 @@ known-bad:
same text canvas: what separates two machines is how they draw, never a
per-seed change at readback.
* A toDataURL PNG carries the deBG chunk retail 151 writes.
* A WebGL canvas that is not premultiplied (premultipliedAlpha:false, half
transparent) reads the same pixels through toDataURL and toBlob, noised with the
engine on (hw_seed > 0); the control is the engine off (hw_seed 0: as drawn).
Runs against about:blank and a local http page, no network/proxy. Part of the
e2e release gate.
@@ -154,3 +157,84 @@ def test_two_seeds_on_the_same_machine_draw_the_same_text(firefox_binary):
assert hashlib.sha256(bytes(a)).digest() == hashlib.sha256(bytes(b)).digest(), (
"two seeds declaring the same display scale and ClearType tuning read "
"different text pixels: something per-seed still changes a 2D canvas")
_NON_PREMULTIPLIED_JS = """async () => {
const c = document.createElement('canvas'); c.width = 128; c.height = 128;
const gl = c.getContext('webgl', {premultipliedAlpha: false, alpha: true,
preserveDrawingBuffer: true, antialias: true});
if (!gl) return null;
const alpha = 128 / 255;
const vs = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vs, 'attribute vec2 p; attribute vec3 c; varying vec3 v;'
+ ' void main(){v=c;gl_Position=vec4(p,0.,1.);}');
gl.compileShader(vs);
const fs = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fs, 'precision mediump float; varying vec3 v; void main(){gl_FragColor=vec4(v,'
+ alpha.toFixed(8) + ');}');
gl.compileShader(fs);
const pr = gl.createProgram(); gl.attachShader(pr, vs); gl.attachShader(pr, fs);
gl.linkProgram(pr); gl.useProgram(pr);
const b = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, b);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(
[-0.9, -0.8, 1, 0, 0, 0.85, -0.6, 0, 1, 0, 0.1, 0.9, 0, 0, 1]), gl.STATIC_DRAW);
const pl = gl.getAttribLocation(pr, 'p'), cl = gl.getAttribLocation(pr, 'c');
gl.enableVertexAttribArray(pl); gl.vertexAttribPointer(pl, 2, gl.FLOAT, false, 20, 0);
gl.enableVertexAttribArray(cl); gl.vertexAttribPointer(cl, 3, gl.FLOAT, false, 20, 8);
gl.clearColor(1, 1, 1, alpha); gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.TRIANGLES, 0, 3);
gl.finish();
const url = c.toDataURL();
const blob = await new Promise(resolve => c.toBlob(resolve, 'image/png'));
const bytes = new Uint8Array(await blob.arrayBuffer());
let binary = '';
for (let i = 0; i < bytes.length; i += 8192) binary += String.fromCharCode.apply(null, bytes.subarray(i, i + 8192));
return {url, blob: btoa(binary), premultipliedAlpha: gl.getContextAttributes().premultipliedAlpha};
}"""
def _non_premultiplied(firefox_binary, hw_seed):
"""(the pixels of toDataURL, the pixels of toBlob) of one half-transparent, non-premultiplied WebGL canvas,
as 128x128 RGBA bytes, with the engine on (hw_seed > 0) or off (0)."""
import base64
from _page_bytes import unfiltered
with InvisiblePlaywright(
seed=7, binary_path=firefox_binary, headless=True,
extra_prefs={"zoom.stealth.fpp.hw_seed": hw_seed},
) as b:
p = b.new_context().new_page()
p.goto("about:blank", timeout=30_000)
got = p.evaluate(_NON_PREMULTIPLIED_JS)
assert got is not None, "webgl is unavailable: a WebGL canvas cannot be read"
assert got["premultipliedAlpha"] is False, "the context is premultiplied: %r" % got["premultipliedAlpha"]
images = [unfiltered(base64.b64decode(got["url"].split(",", 1)[1])), unfiltered(base64.b64decode(got["blob"]))]
for png in images:
assert (png["w"], png["h"], png["channels"]) == (128, 128, 4), png
return images[0]["data"], images[1]["data"]
@pytest.mark.e2e
def test_a_non_premultiplied_webgl_canvas_reads_the_same_through_todataurl_and_toblob(firefox_binary):
"""toDataURL and toBlob of a premultipliedAlpha:false WebGL canvas give the same pixels, noised with the engine on.
The canvas noise is applied to the snapshot with its alpha type: a context that is not premultiplied stores
the colours as drawn, and a reader that took it for premultiplied would noise (or convert) them wrongly.
Both PNG readers go through the same hook (GetImageBuffer, GetInputStream in ClientWebGLContext.cpp). The
canvas is half transparent (alpha 128/255, colours as drawn), so a premultiplied reading changes the bytes.
Negative control, in the same test: with the engine off the two readers are the bytes as drawn, their alpha is
the 128 drawn, and the engine-on PNG differs from them."""
on_url, on_blob = _non_premultiplied(firefox_binary, 12345)
off_url, off_blob = _non_premultiplied(firefox_binary, 0)
alphas = {off_url[i] for i in range(3, len(off_url), 4)}
assert alphas <= set(range(126, 131)), (
"engine off: the alpha of the PNG is %s, not the 128 that was drawn" % sorted(alphas))
differing = lambda a, b: sum(1 for x, y in zip(a, b) if x != y)
assert off_blob == off_url, (
"engine off: %d of %d bytes of toBlob differ from toDataURL" % (differing(off_blob, off_url), len(off_url)))
assert differing(on_url, off_url), (
"toDataURL of a non-premultiplied WebGL canvas is the same with the engine on and off: no noise reaches "
"the page, so comparing the two readers says nothing")
assert on_blob == on_url, (
"engine on: %d of %d bytes of toBlob differ from toDataURL of the same non-premultiplied WebGL canvas"
% (differing(on_blob, on_url), len(on_url)))
@@ -1,143 +0,0 @@
"""Coloured canvas text, and text under other ClearType keys, is what retail Windows draws.
tests/test_canvas_text_is_windows_e2e.py compares 342 cases of black text on white, drawn
with one ClearType state (the seed's: gamma 1.8, contrast 1.0). The text of a page is not
always black, and a machine's ClearType gamma and contrast are not always the untuned ones
(the registry values the Windows tuner writes), so this test adds what that one does not
reach, each with the hashes retail Firefox 159.0 on Windows gave for the same page:
coloured text tests/data/canvas_text_ref_colors/index.html draws Arial 16 and 33 px, fillText,
of seven colour pairs (black, teal, rgba(102,204,0,0.2) on white, grey, white on
black, red, white on blue): 14 cases, with the seed's configuration. An
engine that quantises its A8 text masks to 17 levels (a hook, which firefox-64
removes) moves a coloured edge pixel by a few units, and black on white hides
it: 12 of the 14 differ on such an engine.
ClearType keys gamma/contrast 1800/100 (the seed's), 1400/50 and 2200/0: 39 cases for each,
the 14 coloured ones and 25 black ones of tests/data/canvas_text_ref (Arial,
Calibri, Consolas, Segoe UI at 9, 12.5, 16 and 33 px; stroke, opaque canvas
above 48 px, rotated and scaled, Twemoji COLR v0). The engine is launched with
the pins font.cleartype_gamma and font.cleartype_contrast of the key, one
launch for each; the page is the same, the bytes are not (the keys give
different hashes in refs.json, which tests/unit/test_canvas_text_colors_refs.py
checks, so the test tells them apart).
Each canvas is read back with getImageData and its RGBA bytes are hashed with SHA-256. The
fonts are the engine's own bundled files, served by this test (their sha256 is checked
against the reference first). tests/data/canvas_text_ref_colors/refs.json is built by
scripts/build_canvas_text_colors_refs.py from the bytes retail drew.
Every differing case is listed (name, expected hash, hash got), not just the first.
Run: pytest tests/test_canvas_text_colors_and_cleartype_is_windows_e2e.py -m e2e -v
"""
from __future__ import annotations
import json
from pathlib import Path
import pytest
from _canvas_text import DATA as BASE_DATA, diff_lines, only_cases, pin, serve, wrong_fonts
from invisible_playwright import InvisiblePlaywright
DATA = Path(__file__).parent / "data" / "canvas_text_ref_colors"
SEED = 21
def _refs():
path = DATA / "refs.json"
if not path.is_file():
pytest.fail("tests/data/canvas_text_ref_colors/refs.json is missing: it is the reference "
"retail Firefox on Windows wrote for these pages (see the module docstring)")
return json.loads(path.read_text(encoding="utf-8"))
def _draw(url, page):
"""The sha256 of each case the page at ``url`` draws, by case id."""
page.goto(url, timeout=60_000)
page.wait_for_function("window.DONE === true || window.ERR", timeout=300_000)
err = page.evaluate("window.ERR || null")
assert err is None, "the reference page %s failed: %s" % (url, err)
return page.evaluate(
"Object.fromEntries(Object.entries(window.R).map(([k, v]) => [k, v.sha256]))")
def _launch(firefox_binary, refs, key, pages_for):
"""One engine launch with the persona's pin (and the ClearType ``key`` when given, a
(gamma, contrast) pair); returns what each page of ``pages_for`` ({name: (path, ids)})
drew."""
base = json.loads((BASE_DATA / "refs.json").read_text(encoding="utf-8"))
fonts_dir = Path(firefox_binary).parent / "fonts"
wrong = wrong_fonts(fonts_dir, base["fonts"])
assert not wrong, (
"the reference was measured with other font files than the engine's bundle, so it "
"compares nothing; rebuild the references from the bundled files:\n "
+ "\n ".join(wrong))
prefs = pin(base)
if key is not None:
prefs["font.cleartype_gamma"], prefs["font.cleartype_contrast"] = key
colors_page = (DATA / "index.html").read_bytes()
black_page = only_cases((BASE_DATA / "index.html").read_text(encoding="utf-8"),
pages_for.get("black", []))
server = serve(fonts_dir, base["fonts"],
{"/": colors_page, "/index.html": colors_page,
"/black.html": black_page.encode("utf-8")})
try:
root = "http://127.0.0.1:%d" % server.server_address[1]
with InvisiblePlaywright(seed=SEED, binary_path=firefox_binary, headless=True,
pin=prefs) as b:
page = b.new_context().new_page()
got = {}
if pages_for.get("black"):
got["black"] = _draw(root + "/black.html", page)
got["colors"] = _draw(root + "/", page)
return got
finally:
server.shutdown()
def _want(cases):
return {cid: c["sha256"] for cid, c in cases.items()}
@pytest.mark.e2e
@pytest.mark.timeout(600, method="thread")
def test_coloured_text_is_what_retail_windows_draws(firefox_binary, engine_at_least):
engine_at_least("firefox-68")
refs = _refs()
assert refs["colors"]["count"] == len(refs["colors"]["cases"]) == 14
got = _launch(firefox_binary, refs, None, {})
lines = diff_lines(_want(refs["colors"]["cases"]), got["colors"])
assert not lines, (
"%d of %d coloured canvas text cases differ from retail Firefox on Windows "
"(seed ClearType state, gamma 1800 contrast 100):\n %s"
% (len(lines), len(refs["colors"]["cases"]), "\n ".join(lines)))
def _keys():
# collected without the reference file: a missing one fails the test, not the collection
path = DATA / "refs.json"
if not path.is_file():
return ["1800_100", "1400_50", "2200_0"]
return list(json.loads(path.read_text(encoding="utf-8"))["keys"])
@pytest.mark.e2e
@pytest.mark.timeout(900, method="thread")
@pytest.mark.parametrize("tag", _keys())
def test_text_under_a_cleartype_key_is_what_retail_windows_draws(
tag, firefox_binary, engine_at_least):
engine_at_least("firefox-68")
refs = _refs()
k = refs["keys"][tag]
want_black, want_colors = _want(k["black"]), _want(k["colors"])
assert len(want_black) + len(want_colors) == k["count"] == 39
got = _launch(firefox_binary, refs, (k["gamma"], k["contrast"]), {"black": list(want_black)})
lines = (diff_lines(want_black, got["black"], "black ")
+ diff_lines(want_colors, got["colors"], "colour "))
assert not lines, (
"%d of %d canvas text cases differ from retail Firefox on Windows under ClearType "
"gamma %d contrast %d:\n %s"
% (len(lines), k["count"], k["gamma"], k["contrast"], "\n ".join(lines)))
-119
View File
@@ -1,119 +0,0 @@
"""Canvas 2D text is drawn as retail Firefox on Windows draws it, on every OS.
Retail Firefox on Windows draws canvas text with Skia over DirectWrite. The engine draws it
with Skia over idwr (DirectWrite 10.0.26100.9711 in portable C) from firefox-64, so the
same page gives the same RGBA bytes on Windows, on Debian 12 and on Ubuntu 24.04.
tests/data/canvas_text_ref/index.html draws 342 cases, in groups (the ``gruppo`` field of
each case in refs.json):
0_base 211 Arial, Segoe UI, Times New Roman, Consolas and Calibri at 9,
12.5, 16, 33, 72 and 300 px, with and without a rotate(15deg)
scale(1.5, 2) transform; fillText, strokeText, synthetic
italic and bold
1_alpha_false 25 the same faces at 5 sizes on getContext('2d', {alpha: false})
(an opaque canvas, where LCD text is possible)
2a_rot_alpha_true_controllo 25 rotated and scaled, alpha true (the base's cases, drawn once)
2b_rot_alpha_false 25 rotated and scaled, alpha false
3_emoji_colr0 12 COLR v0 emoji, Twemoji Mozilla, alpha true and false
4_soglie 20 255, 256, 257, 300 and 400 px, fillText and strokeText
5_variabile_bahnschrift 12 font-weight 300/400/700 by font-stretch 75%/100%
6_variabile_seguivar 12 Segoe UI Variable, font-weight 300/400/700 at 9, 12.5, 16 and
33 px (opsz follows the size): the instance the scaled font
asks of idwr, on every OS
Each canvas is read back with getImageData and its RGBA bytes are hashed with SHA-256. The
fonts are @font-face webfonts: the files of the engine's own ``fonts`` directory, served by
this test, so the comparison does not depend on what the host has installed.
tests/data/canvas_text_ref/refs.json holds the hashes retail Firefox 159.0 on Windows gave for
the same page and the same bundled files (gfx.canvas.accelerated off, white background), and
the ClearType state of that machine, which the test declares as the persona (system text
quality 5). Its ``fonts`` entries carry the sha256 of each file, which must be the engine's
bundled one (Arial 05c7da5fe195...; Twemoji Mozilla, Bahnschrift and Segoe UI Variable too): a reference made with
other font files compares nothing. The file is built by scripts/build_canvas_text_refs.py from
the two measurements.
The largest canvases (400 px: 7727 x 3373, 100 MB of RGBA) are drawn one at a time and
released after their hash is taken, as the measuring page did.
Every differing case is listed, group by group, not just the first. Set INVISIBLE_CANVAS_TEXT_OUT to a
directory and the run writes its hashes there (canvas_text_<tag>.json); scripts/
compare_canvas_text_runs.py says which cases two runs, the Debian one and the Ubuntu one,
draw differently.
Run: pytest tests/test_canvas_text_is_windows_e2e.py -m e2e -v
"""
from __future__ import annotations
import json
import os
from pathlib import Path
import pytest
from _canvas_text import DATA, pin as _pin, serve as _serve, wrong_fonts
from invisible_playwright import InvisiblePlaywright
@pytest.mark.e2e
@pytest.mark.timeout(1800, method="thread")
def test_canvas_text_is_what_retail_windows_draws(firefox_binary, engine_at_least):
engine_at_least("firefox-68")
refs_path = DATA / "refs.json"
if not refs_path.is_file():
pytest.fail("tests/data/canvas_text_ref/refs.json is missing: it is the reference "
"retail Firefox on Windows wrote for this page (see the module docstring)")
refs = json.loads(refs_path.read_text(encoding="utf-8"))
fonts_dir = Path(firefox_binary).parent / "fonts"
wrong = wrong_fonts(fonts_dir, refs["fonts"])
assert not wrong, (
"the reference was measured with other font files than the engine's bundle, so it "
"compares nothing; rebuild refs.json from the bundled files:\n " + "\n ".join(wrong))
pin = _pin(refs)
page = (DATA / "index.html").read_bytes()
server = _serve(fonts_dir, refs["fonts"], {"/": page, "/index.html": page})
try:
url = "http://127.0.0.1:%d/" % server.server_address[1]
with InvisiblePlaywright(seed=21, binary_path=firefox_binary, headless=True,
pin=pin) as b:
page = b.new_context().new_page()
page.goto(url, timeout=60_000)
page.wait_for_function("window.DONE === true || window.ERR", timeout=1_500_000)
err = page.evaluate("window.ERR || null")
assert err is None, "the reference page failed: %s" % err
got = page.evaluate(
"Object.fromEntries(Object.entries(window.R).map(([k, v]) => [k, v.sha256]))")
finally:
server.shutdown()
out_dir = os.environ.get("INVISIBLE_CANVAS_TEXT_OUT")
if out_dir:
from invisible_core.seal import active_seal
Path(out_dir).mkdir(parents=True, exist_ok=True)
(Path(out_dir) / ("canvas_text_%s.json" % active_seal().tag)).write_text(
json.dumps(got, indent=1, sort_keys=True), encoding="utf-8")
cases = refs["cases"]
want = {k: v["sha256"] for k, v in cases.items()}
missing = sorted(set(want) - set(got))
extra = sorted(set(got) - set(want))
differ = sorted(k for k in want if k in got and got[k] != want[k])
lines = []
for group in sorted({v["gruppo"] for v in cases.values()}):
ids = sorted(k for k, v in cases.items() if v["gruppo"] == group)
bad = [k for k in ids if k in differ]
gone = [k for k in ids if k in missing]
if bad or gone:
lines.append("%s: %d of %d differ, %d not drawn" % (group, len(bad), len(ids), len(gone)))
lines += [" differs: " + k for k in bad[:40]]
if len(bad) > 40:
lines.append(" ... and %d more" % (len(bad) - 40))
lines += [" not drawn: " + k for k in gone[:20]]
if extra:
lines.append("drawn but not in the reference: " + ", ".join(extra[:20]))
assert not lines, (
"%d of %d canvas text cases differ from retail Firefox on Windows, %d were not drawn.\n%s"
% (len(differ), len(want), len(missing), "\n".join(lines)))
+15 -77
View File
@@ -1,7 +1,10 @@
"""scripts/ci_lab_intermediates.py: a CI leg launches with a fixed list of intermediates that the repository holds, and the core is told so."""
import hashlib
import importlib.util
import json
"""The intermediates lab of the CI is gone: the security state replaced it (scripts/ci_lab_security_state.py, ci/security-state/).
The core no longer declares an intermediates list: it copies a ready security state (intermediates, OneCRL and the CRLite filters, generated by the
engine) into every profile, and a CI leg points STEALTHFOX_SECURITY_STATE at a fixed directory of the repository. A leftover of the old lab (the
script, its pinned list, a workflow that still exports STEALTHFOX_INTERMEDIATES) would be a second road that nothing reads. The file keeps its name
because ci/required-suites.json only grows (scripts/ci_verdict.py, against main): its tests now guard that the old road stays gone.
"""
from pathlib import Path
import pytest
@@ -11,78 +14,13 @@ pytestmark = pytest.mark.unit
ROOT = Path(__file__).resolve().parents[1]
def _load():
spec = importlib.util.spec_from_file_location("ci_lab_intermediates_under_test", ROOT / "scripts" / "ci_lab_intermediates.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
def test_the_files_of_the_intermediates_lab_are_gone():
for rel in ("scripts/ci_lab_intermediates.py", "ci/intermediates.json", "ci/intermediates.pin.json"):
assert not (ROOT / rel).exists(), "%s is a leftover of the intermediates lab" % rel
lab = _load()
PIN = ROOT / "ci" / "intermediates.pin.json"
LIST = ROOT / "ci" / "intermediates.json"
RUN = "python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json"
def test_the_pin_is_the_hash_of_the_file_it_names():
pin = lab.load_pin(PIN)
assert pin["file"] == "ci/intermediates.json" and pin["comment"]
assert hashlib.sha256(LIST.read_bytes()).hexdigest() == pin["sha256"]
assert len(LIST.read_bytes()) == pin["bytes"]
def test_the_file_is_a_valid_list_of_format_1_with_no_certificate():
raw = LIST.read_bytes()
listing = json.loads(raw)
assert listing["format"] == 1 and listing["collection"] == "security-state/intermediates"
assert listing["count"] == len(listing["certs"]) == 0
assert listing["set_sha256"] == hashlib.sha256(b"").hexdigest() # the hash of no derHash at all
assert list(listing) == ["format", "collection", "collection_timestamp", "fetched_utc", "count", "set_sha256", "certs"]
assert raw == json.dumps(listing, separators=(",", ":"), ensure_ascii=True).encode("utf-8"), "not written as the core writes it (compact, no final newline)"
def test_set_writes_the_variable_with_the_absolute_path_to_github_env(tmp_path, monkeypatch):
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(PIN)]) == 0
assert env_file.read_text(encoding="utf-8") == "STEALTHFOX_INTERMEDIATES=%s\n" % LIST.resolve()
assert Path(LIST.resolve()).is_absolute()
def test_without_github_env_it_prints_the_line(monkeypatch, capsys):
monkeypatch.delenv("GITHUB_ENV", raising=False)
assert lab.main(["set", "--pin", str(PIN)]) == 0
assert capsys.readouterr().out == "STEALTHFOX_INTERMEDIATES=%s\n" % LIST.resolve()
def test_a_file_that_is_not_the_pinned_one_is_refused_and_exports_nothing(tmp_path, monkeypatch, capsys):
other = tmp_path / "other.json"
other.write_bytes(LIST.read_bytes() + b"\n")
pin = tmp_path / "pin.json"
pin.write_text(json.dumps({"file": str(other), "sha256": lab.load_pin(PIN)["sha256"]}), encoding="utf-8")
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(pin)]) == 1
assert not env_file.exists()
assert "change both in one commit" in capsys.readouterr().err
def test_a_pin_that_is_not_a_pin_or_names_a_missing_file_is_refused(tmp_path, monkeypatch):
monkeypatch.delenv("GITHUB_ENV", raising=False)
bad = tmp_path / "pin.json"
for text in ("not json", "{}", json.dumps({"file": "x", "sha256": "xyz"}), json.dumps({"sha256": "0" * 64})):
bad.write_text(text, encoding="utf-8")
with pytest.raises(lab.Refused):
lab.load_pin(bad)
assert lab.main(["set", "--pin", str(bad)]) == 1
bad.write_text(json.dumps({"file": str(tmp_path / "nowhere.json"), "sha256": "0" * 64}), encoding="utf-8")
assert lab.main(["set", "--pin", str(bad)]) == 1
def test_the_command_runs_as_the_workflows_run_it():
import subprocess
import sys
done = subprocess.run([sys.executable] + RUN.split()[1:], cwd=ROOT, capture_output=True, text=True, env={k: v for k, v in __import__("os").environ.items() if k != "GITHUB_ENV"})
assert done.returncode == 0, done.stderr
assert done.stdout == "STEALTHFOX_INTERMEDIATES=%s\n" % LIST.resolve()
def test_no_workflow_names_the_intermediates_lab():
for wf in sorted((ROOT / ".github" / "workflows").glob("*.yml")):
text = wf.read_text(encoding="utf-8")
for word in ("STEALTHFOX_INTERMEDIATES", "ci_lab_intermediates", "intermediates.pin.json"):
assert word not in text, "%s still names %s" % (wf.name, word)
+110
View File
@@ -0,0 +1,110 @@
"""scripts/ci_lab_security_state.py: a CI leg launches with a fixed, ready security state that the repository holds, and the core is told so."""
import hashlib
import importlib.util
import json
import os
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
pytestmark = pytest.mark.unit
ROOT = Path(__file__).resolve().parents[1]
def _load():
spec = importlib.util.spec_from_file_location("ci_lab_security_state_under_test", ROOT / "scripts" / "ci_lab_security_state.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
lab = _load()
PIN = ROOT / "ci" / "security-state.pin.json"
RESULT = ROOT / "ci" / "security-state" / "securitystate-result.json"
RUN = "python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json"
def test_the_pin_is_the_hash_of_the_file_it_names():
pin = lab.load_pin(PIN)
assert pin["file"] == "ci/security-state/securitystate-result.json" and pin["comment"]
assert hashlib.sha256(RESULT.read_bytes()).hexdigest() == pin["sha256"]
assert len(RESULT.read_bytes()) == pin["bytes"]
def test_the_directory_is_a_ready_state_with_no_data():
"""A result with no data: ok, no engine, zero timestamps, no CRLite hashes; and no `security_state/`, so a launch copies nothing."""
result = json.loads(RESULT.read_bytes())
assert result["format"] == 1 and result["ok"] is True and result["error"] is None
assert result["engine"] == {"version": "", "build_id": ""}
assert result["crlite_filter_hashes"] == []
assert all(c["collection_timestamp"] == 0 for c in result["collections"].values())
assert sorted(p.name for p in RESULT.parent.iterdir()) == ["securitystate-result.json"]
def test_set_writes_the_variable_with_the_absolute_directory_to_github_env(tmp_path, monkeypatch):
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(PIN)]) == 0
assert env_file.read_text(encoding="utf-8") == "STEALTHFOX_SECURITY_STATE=%s\n" % RESULT.parent.resolve()
assert Path(RESULT.parent.resolve()).is_absolute()
def test_without_github_env_it_prints_the_line(monkeypatch, capsys):
monkeypatch.delenv("GITHUB_ENV", raising=False)
assert lab.main(["set", "--pin", str(PIN)]) == 0
assert capsys.readouterr().out == "STEALTHFOX_SECURITY_STATE=%s\n" % RESULT.parent.resolve()
def _copy_of_the_state(tmp_path):
directory = tmp_path / "state"
directory.mkdir()
shutil.copy(RESULT, directory / RESULT.name)
pin = tmp_path / "pin.json"
pin.write_text(json.dumps({"file": str(directory / RESULT.name), "sha256": lab.load_pin(PIN)["sha256"]}), encoding="utf-8")
return directory, pin
def test_a_file_that_is_not_the_pinned_one_is_refused_and_exports_nothing(tmp_path, monkeypatch, capsys):
directory, pin = _copy_of_the_state(tmp_path)
(directory / RESULT.name).write_bytes(RESULT.read_bytes() + b"\n")
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(pin)]) == 1
assert not env_file.exists()
assert "change both in one commit" in capsys.readouterr().err
def test_a_directory_that_holds_anything_else_is_refused_and_exports_nothing(tmp_path, monkeypatch, capsys):
"""Data in the directory would be copied into every profile of the leg: the leg launches with NO data, and the pin only vouches for the one file."""
directory, pin = _copy_of_the_state(tmp_path)
env_file = tmp_path / "github_env"
monkeypatch.setenv("GITHUB_ENV", str(env_file))
assert lab.main(["set", "--pin", str(pin)]) == 0
env_file.unlink()
(directory / "security_state").mkdir()
(directory / "security_state" / "data.safe.bin").write_bytes(b"x")
assert lab.main(["set", "--pin", str(pin)]) == 1
assert not env_file.exists()
assert "security_state" in capsys.readouterr().err
def test_a_pin_that_is_not_a_pin_or_names_a_missing_file_is_refused(tmp_path, monkeypatch):
monkeypatch.delenv("GITHUB_ENV", raising=False)
bad = tmp_path / "pin.json"
for text in ("not json", "{}", json.dumps({"file": "x", "sha256": "xyz"}), json.dumps({"sha256": "0" * 64})):
bad.write_text(text, encoding="utf-8")
with pytest.raises(lab.Refused):
lab.load_pin(bad)
assert lab.main(["set", "--pin", str(bad)]) == 1
bad.write_text(json.dumps({"file": str(tmp_path / "nowhere.json"), "sha256": "0" * 64}), encoding="utf-8")
assert lab.main(["set", "--pin", str(bad)]) == 1
def test_the_command_runs_as_the_workflows_run_it():
done = subprocess.run([sys.executable] + RUN.split()[1:], cwd=ROOT, capture_output=True, text=True, env={k: v for k, v in os.environ.items() if k != "GITHUB_ENV"})
assert done.returncode == 0, done.stderr
assert done.stdout == "STEALTHFOX_SECURITY_STATE=%s\n" % RESULT.parent.resolve()
+162
View File
@@ -0,0 +1,162 @@
"""scripts/ci_suite_run.py runs one row of the whole-e2e suite and hands the judge ONE junit (no browser here: the run of the core is a fake).
What is held: the arguments of the run are the files and node ids of the row, in its order, and nothing else of the row (the passes bring their own marker); the
two junit files of the passes become one xunit2 file with every testcase kept as pytest wrote it, counted from the cases and not from the headers, and the judge
reads it; the run reaches the judge when a test is red (exit 0 for the passes that ran to their end) and does not when a pass did not run to its end or nothing
was written; the variable that tells the core where its junit goes is set for the run and put back after it.
Known-bad inputs: a pass that wrote nothing, a second pass with no test, a skipped and a failed case among the passed, a row that is not in the list, a row of
the other system, a pass that died (exit 2), a run that wrote no junit at all.
"""
from __future__ import annotations
import importlib.util
import json
import xml.etree.ElementTree as ET
from pathlib import Path
import pytest
pytestmark = pytest.mark.unit
ROOT = Path(__file__).resolve().parents[1]
def _load(name):
spec = importlib.util.spec_from_file_location(name + "_under_test", ROOT / "scripts" / (name + ".py"))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
suite_run = _load("ci_suite_run")
from invisible_core.testing import e2e as core_e2e # noqa: E402
ROW = "s.e2e.one"
TESTS = ["tests/test_a_e2e.py", "tests/test_b_e2e.py::test_one", "tests/test_c_e2e.py"]
def _required(tmp_path, **over):
row = {"id": ROW, "giro": "G2", "os": ["linux"], "min_tests": 4, "exact": True, "tests": TESTS, "marker": "e2e", "needs_root": False}
row.update(over)
path = tmp_path / "required.json"
path.write_text(json.dumps([row]), encoding="utf-8")
return str(path)
def _case(classname, name, outcome="passed", seconds="1.500"):
case = ET.Element("testcase", {"classname": classname, "name": name, "time": seconds})
if outcome != "passed":
ET.SubElement(case, outcome, {"message": "x"})
return case
def _write(path, cases):
suite = ET.Element("testsuite", {"name": "pytest", "errors": "0", "failures": "0", "skipped": "0", "tests": str(len(cases)), "time": "9.999"})
suite.extend(cases)
root = ET.Element("testsuites")
root.append(suite)
ET.ElementTree(root).write(path, encoding="utf-8", xml_declaration=True)
def _fake_run(code, per_pass, seen):
"""A stand-in for ``invisible_core.testing.e2e.main``: records its call and writes the junit of each pass where the core would."""
def run(argv, repo):
seen.append({"argv": list(argv), "repo": repo, "dir": suite_run.os.environ.get(core_e2e.JUNIT_DIR_ENV)})
for (_width, selection), cases in zip(core_e2e.passes("4"), per_pass):
if cases is not None:
_write(core_e2e.junit_file(Path(seen[-1]["dir"]), selection), cases)
return code
return run
def test_the_arguments_are_the_files_and_the_nodes_of_the_row_in_its_order(tmp_path):
assert suite_run.row_arguments(_required(tmp_path), ROW, "linux") == TESTS
def test_a_row_that_is_not_in_the_list_or_is_of_the_other_system_is_refused(tmp_path):
required = _required(tmp_path)
for suite, os_name in (("s.e2e.none", "linux"), (ROW, "windows")):
with pytest.raises(suite_run.ci_verdict.Usage):
suite_run.row_arguments(required, suite, os_name)
assert suite_run.main(["--required", required, "--suite", "s.e2e.none", "--os", "linux", "--binary", "x", "--junit", str(tmp_path / "o.xml")]) == 2
def test_the_two_junit_files_of_the_passes_become_one_xunit2_file_the_judge_reads(tmp_path):
first, second, out = tmp_path / "a.xml", tmp_path / "b.xml", tmp_path / "out" / "merged.xml"
_write(first, [_case("tests.test_a_e2e", "test_x"), _case("tests.test_b_e2e", "test_one[p1]", "failure"), _case("tests.test_c_e2e", "test_y", "skipped")])
_write(second, [_case("tests.test_c_e2e", "test_clock", "error", "2.000")])
assert suite_run.merge_junits([first, second], out) == 4
root = ET.parse(out).getroot()
suites = list(root.iter("testsuite"))
assert len(suites) == 1 and suites[0].attrib["tests"] == "4"
assert (suites[0].attrib["failures"], suites[0].attrib["errors"], suites[0].attrib["skipped"]) == ("1", "1", "1")
assert suites[0].attrib["time"] == "6.500"
cases, no_class = suite_run.ci_verdict.parse_junit(out)
assert no_class == [] and [n for n, _o in cases] == ["tests/test_a_e2e.py::test_x", "tests/test_b_e2e.py::test_one[p1]", "tests/test_c_e2e.py::test_y",
"tests/test_c_e2e.py::test_clock"]
assert [o for _n, o in cases] == ["passed", "failed", "skipped", "errors"]
def test_a_pass_that_wrote_nothing_is_not_an_error_of_the_merge_and_a_pass_with_no_test_adds_none(tmp_path):
first, empty, out = tmp_path / "a.xml", tmp_path / "e.xml", tmp_path / "m.xml"
_write(first, [_case("tests.test_a_e2e", "test_x")])
_write(empty, [])
assert suite_run.merge_junits([first, tmp_path / "never.xml", empty], out) == 1
assert suite_run.merge_junits([tmp_path / "never.xml"], out) == 0
assert ET.parse(out).getroot().find("testsuite").attrib["tests"] == "0"
def test_the_counts_are_those_of_the_cases_and_not_of_the_headers(tmp_path):
path, out = tmp_path / "a.xml", tmp_path / "m.xml"
_write(path, [_case("tests.test_a_e2e", "test_x")])
root = ET.parse(path).getroot()
root.find("testsuite").attrib.update(tests="99", failures="7")
ET.ElementTree(root).write(path)
suite_run.merge_junits([path], out)
attrs = ET.parse(out).getroot().find("testsuite").attrib
assert (attrs["tests"], attrs["failures"]) == ("1", "0")
def test_a_run_with_a_red_test_still_hands_the_junit_to_the_judge_and_exits_zero(tmp_path):
seen, out = [], tmp_path / "result" / "s.xml"
run = _fake_run(1, [[_case("tests.test_a_e2e", "test_x"), _case("tests.test_c_e2e", "test_z", "failure")], [_case("tests.test_c_e2e", "test_clock")]], seen)
code = suite_run.run(_required(tmp_path), ROW, "linux", "/ff/firefox", str(out), repo=tmp_path, run_e2e=run)
assert code == 0
assert seen[0]["argv"] == ["/ff/firefox"] + TESTS and seen[0]["repo"] == tmp_path
assert [o for _n, o in suite_run.ci_verdict.parse_junit(out)[0]] == ["passed", "failed", "passed"]
def test_the_number_of_browsers_is_passed_to_the_run_only_when_asked(tmp_path):
seen = []
suite_run.run(_required(tmp_path), ROW, "linux", "ff", str(tmp_path / "o.xml"), repo=tmp_path, procs="2", run_e2e=_fake_run(0, [[_case("tests.t", "a")], None], seen))
assert seen[0]["argv"][:3] == ["ff", "-n", "2"] and seen[0]["argv"][3:] == TESTS
def test_a_pass_that_did_not_run_to_its_end_is_not_zero(tmp_path):
seen, out = [], tmp_path / "o.xml"
code = suite_run.run(_required(tmp_path), ROW, "linux", "ff", str(out), repo=tmp_path, run_e2e=_fake_run(2, [[_case("tests.t", "a")], None], seen))
assert code == 2
assert out.is_file(), "what the passes wrote is still handed to the judge, which says the suite is short"
def test_a_run_that_wrote_no_junit_is_not_zero(tmp_path):
out = tmp_path / "o.xml"
assert suite_run.run(_required(tmp_path), ROW, "linux", "ff", str(out), repo=tmp_path, run_e2e=_fake_run(0, [None, None], [])) == 3
assert suite_run.run(_required(tmp_path), ROW, "linux", "ff", str(out), repo=tmp_path, run_e2e=_fake_run(5, [None, None], [])) == 3
def test_the_directory_of_the_junit_is_set_for_the_run_and_put_back_after_it(tmp_path, monkeypatch):
monkeypatch.delenv(core_e2e.JUNIT_DIR_ENV, raising=False)
seen = []
suite_run.run(_required(tmp_path), ROW, "linux", "ff", str(tmp_path / "o.xml"), repo=tmp_path, run_e2e=_fake_run(0, [[_case("tests.t", "a")], None], seen))
assert seen[0]["dir"] and core_e2e.JUNIT_DIR_ENV not in suite_run.os.environ
monkeypatch.setenv(core_e2e.JUNIT_DIR_ENV, "somewhere")
suite_run.run(_required(tmp_path), ROW, "linux", "ff", str(tmp_path / "o.xml"), repo=tmp_path, run_e2e=_fake_run(0, [[_case("tests.t", "a")], None], seen))
assert suite_run.os.environ[core_e2e.JUNIT_DIR_ENV] == "somewhere"
def test_the_passes_of_the_run_are_the_core_s_and_the_junit_names_are_its_own():
names = [p.name for p in suite_run.pass_junits(Path("d"))]
assert names == ["e2e-junit-e2e-and-not-wall_clock.xml", "e2e-junit-e2e-and-wall_clock.xml"], names
assert [p.name for p in suite_run.pass_junits(Path("d"), "1")] == ["e2e-junit-e2e.xml"]
+116
View File
@@ -256,6 +256,95 @@ def test_a_main_list_older_than_the_format_is_still_compared(tmp_path):
assert _judge(tmp_path, GREEN, extra=["--main-required", str(main)])[0] == 0
# --- retired files: the one way a test leaves a row -----------------------------------------------------------
GONE = "tests/test_d.py"
def _main_with(tmp_path, rows, retired=None):
"""main's list in its own folder, and the retired list of main next to it."""
folder = tmp_path / "main"
folder.mkdir()
required = _write_required(folder / "required.json", rows)
if retired is not None:
(folder / verdict.RETIRED_NAME).write_text(json.dumps(retired), encoding="utf-8")
return required
def _retired(file=GONE, n=1, row="s.one"):
return {"file": file, "reason": "feature cancelled", "date": "2026-11-21", "tests": {row: n}}
def _main_that_had_d(tmp_path, retired, min_tests=5):
return _main_with(tmp_path, [_suite(min_tests=min_tests, tests=[FILE_A, FILE_B, NODE, GONE])], retired)
def test_a_retired_file_that_is_gone_may_leave_its_row_with_its_tests_is_green(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
main = _main_that_had_d(tmp_path, [_retired()])
assert _judge(tmp_path, GREEN, extra=["--main-required", str(main)])[0] == 0
def test_a_file_that_main_did_not_retire_leaving_its_row_is_red(tmp_path, monkeypatch, capsys):
monkeypatch.chdir(tmp_path)
main = _main_that_had_d(tmp_path, [_retired("tests/test_other.py")])
code, _r = _judge(tmp_path, GREEN, extra=["--main-required", str(main)])
assert code == 1 and GONE in capsys.readouterr().out
def test_a_main_with_no_retired_list_excuses_nothing(tmp_path, monkeypatch, capsys):
monkeypatch.chdir(tmp_path)
main = _main_that_had_d(tmp_path, None)
code, _r = _judge(tmp_path, GREEN, extra=["--main-required", str(main)])
assert code == 1 and GONE in capsys.readouterr().out
def test_a_retired_file_that_is_still_on_disk_is_not_excused(tmp_path, monkeypatch, capsys):
monkeypatch.chdir(tmp_path)
(tmp_path / "tests").mkdir()
(tmp_path / GONE).write_text("def test_d(): pass", encoding="utf-8")
main = _main_that_had_d(tmp_path, [_retired()])
code, _r = _judge(tmp_path, GREEN, extra=["--main-required", str(main)])
out = capsys.readouterr().out
assert code == 1 and GONE in out and "went down" in out
def test_a_minimum_that_went_down_by_more_than_the_retired_tests_is_red(tmp_path, monkeypatch, capsys):
monkeypatch.chdir(tmp_path)
main = _main_that_had_d(tmp_path, [_retired(n=1)], min_tests=6) # the file had 1 test: 6 - 1 = 5, and the row says 4
code, _r = _judge(tmp_path, GREEN, extra=["--main-required", str(main)])
assert code == 1 and "went down" in capsys.readouterr().out
def test_the_tests_of_a_retired_file_are_counted_per_row(tmp_path, monkeypatch, capsys):
monkeypatch.chdir(tmp_path)
main = _main_that_had_d(tmp_path, [_retired(row="s.another")]) # the file had its tests in another row: none here
code, _r = _judge(tmp_path, GREEN, extra=["--main-required", str(main)])
assert code == 1 and "went down" in capsys.readouterr().out
def test_a_retired_list_of_the_branch_excuses_nothing(tmp_path, monkeypatch, capsys):
"""The judge reads the retired list next to main's list: a branch that writes its own next to its own list gets nothing."""
monkeypatch.chdir(tmp_path)
main = _main_that_had_d(tmp_path, None)
(tmp_path / verdict.RETIRED_NAME).write_text(json.dumps([_retired()]), encoding="utf-8")
code, _r = _judge(tmp_path, GREEN, extra=["--main-required", str(main)])
assert code == 1 and GONE in capsys.readouterr().out
def test_a_malformed_retired_list_of_main_is_red(tmp_path, monkeypatch, capsys):
monkeypatch.chdir(tmp_path)
main = _main_that_had_d(tmp_path, [{"file": GONE}])
code, _r = _judge(tmp_path, GREEN, extra=["--main-required", str(main)])
assert code == 1 and "retired list of main" in capsys.readouterr().out
def test_a_retired_file_does_not_excuse_another_loss_in_the_same_row(tmp_path, monkeypatch, capsys):
monkeypatch.chdir(tmp_path)
main = _main_with(tmp_path, [_suite(min_tests=6, tests=[FILE_A, FILE_B, NODE, GONE, "tests/test_e.py"])], [_retired()])
code, _r = _judge(tmp_path, GREEN, extra=["--main-required", str(main)])
assert code == 1 and "tests/test_e.py" in capsys.readouterr().out
# --- args --------------------------------------------------------------------------------------------------------
def test_args_prints_the_files_and_node_ids_one_per_line(tmp_path, capsys):
required = _write_required(tmp_path / "required.json", [_suite()])
@@ -592,6 +681,33 @@ def test_the_real_list_has_unique_ids_and_sane_rows():
assert isinstance(root, bool) or (isinstance(root, list) and set(root) <= set(r["os"])), r["id"]
RETIRED = ROOT / "ci" / verdict.RETIRED_NAME
def test_the_real_retired_list_is_well_formed_and_names_rows_that_exist():
data = json.loads(RETIRED.read_text(encoding="utf-8"))
assert verdict.validate_retired(data) == []
ids = {r["id"] for r in _real()}
for entry in data:
assert set(entry["tests"]) <= ids, entry["file"]
def test_the_tests_a_retired_file_had_are_what_the_collection_counts_while_it_exists():
"""The number that lets a minimum go down is exact: for a retired file still in the tree (the one that retires it deletes it, and this
asks nothing of a file that is gone) it is the number of tests the row's marker collects in it."""
import subprocess
import sys
markers = {r["id"]: r["marker"] for r in _real()}
for entry in json.loads(RETIRED.read_text(encoding="utf-8")):
if not (ROOT / entry["file"]).is_file():
continue
for row, declared in entry["tests"].items():
done = subprocess.run([sys.executable, "-m", "pytest", "--collect-only", "-q", "-p", "no:cacheprovider", "-o", "addopts=",
"-m", markers[row], entry["file"]], cwd=str(ROOT), capture_output=True, text=True)
counted = sum(1 for line in done.stdout.splitlines() if "::" in line)
assert counted == declared, "%s in %s: declared %d, collected %d" % (entry["file"], row, declared, counted)
WHOLE_SUITE_MARKER = "not slow and not e2e" # the exact expression of the unit job of tests.yml (pyproject addopts)
@@ -1,9 +1,8 @@
"""The workflows that run the wrapper's tests launch with the intermediates list of ci/intermediates.json, so the core asks Mozilla for nothing.
"""No workflow sets an intermediates list any more: the legs that did set the security state in its place.
Without STEALTHFOX_INTERMEDIATES the core downloads Mozilla's intermediates list on a cold cache (`invisible_playwright fetch` and the first launch) and checks
it once a week. tests.yml and e2e.yml (its Linux run, its Windows parts and the Windows job of Control+A) set the variable (scripts/ci_lab_intermediates.py set) ONCE, before the step that
runs pytest and, where the leg has one, before the step that fetches the engine (`fetch` makes the list present, so it would be the first to download).
user-install.yml proves the installation a user gets and is left as it is.
The step "The intermediates list (a fixed file of the repository)" of e2e.yml, fakeweb.yml and tests.yml became "The security state (a fixed
directory of the repository)" (tests/test_ci_workflows_set_the_security_state.py says where and how). The file keeps its name because
ci/required-suites.json only grows (scripts/ci_verdict.py, against main): its test now guards that no leg goes back to the old step.
"""
from pathlib import Path
@@ -12,48 +11,11 @@ import pytest
pytestmark = pytest.mark.unit
WORKFLOWS = Path(__file__).resolve().parents[1] / ".github" / "workflows"
SET = "python scripts/ci_lab_intermediates.py set --pin ci/intermediates.pin.json"
FETCH = " - name: Fetch the published firefox binary\n"
RUNS_PYTEST = {
"tests.yml": " - name: Run pytest\n",
"e2e.yml": " - name: Run the full e2e suite under a virtual display, without the root ones\n",
"e2e.yml#windows": " - name: Run this part of the e2e\n",
"e2e.yml#control-a": " - name: The keyboard shortcut selects all",
"fakeweb.yml": " - name: Profile P2, stock first and ours second",
}
COMMAND = "python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json"
def _scope(name):
"""The text of one workflow, or of one leg of it: `e2e.yml` is its Linux job, `e2e.yml#windows` its Windows parts, `e2e.yml#control-a` the
Windows job of the keyboard shortcut (it fetches and launches too)."""
file, _, leg = name.partition("#")
text = (WORKFLOWS / file).read_text(encoding="utf-8")
if file != "e2e.yml":
return text
windows = text.index("\n e2e-windows:\n")
if leg == "windows":
return text[windows:]
if leg == "control-a":
start = text.index("\n e2e-windows-control-a:\n")
return text[start:windows] if start < windows else text[start:]
ends = [i for i in (text.find("\n e2e-windows-control-a:\n"), windows) if i >= 0]
return text[:min(ends)]
@pytest.mark.parametrize("name, pytest_step", sorted(RUNS_PYTEST.items()))
def test_the_list_is_set_once_before_the_step_that_runs_the_tests(name, pytest_step):
text = _scope(name)
assert text.count(SET) == 1, "%s sets the intermediates list %d times" % (name, text.count(SET))
assert pytest_step in text, "the step that runs the tests of %s moved: update this test with it" % name
assert text.index(SET) < text.index(pytest_step), "%s sets the list after the tests started" % name
@pytest.mark.parametrize("name", ["e2e.yml", "e2e.yml#windows", "e2e.yml#control-a", "fakeweb.yml"])
def test_the_list_is_set_before_the_engine_is_fetched(name):
text = _scope(name)
assert FETCH in text, "the fetch step of %s moved: update this test with it" % name
assert text.index(SET) < text.index(FETCH), "%s fetches before the list is set: `fetch` would download Mozilla's" % name
def test_the_workflow_that_proves_the_installation_is_left_alone():
assert SET not in (WORKFLOWS / "user-install.yml").read_text(encoding="utf-8")
@pytest.mark.parametrize("name", ["e2e.yml", "fakeweb.yml", "tests.yml"])
def test_the_leg_sets_the_security_state_and_no_intermediates_list(name):
text = (WORKFLOWS / name).read_text(encoding="utf-8")
assert "- name: The intermediates list" not in text, "%s still has the intermediates step" % name
assert COMMAND in text, "%s does not set the security state" % name
@@ -0,0 +1,60 @@
"""The workflows that run the wrapper's tests launch with the ready security state of ci/security-state/, so the core asks Mozilla for nothing and runs no generation.
Without STEALTHFOX_SECURITY_STATE the core downloads Mozilla's security-state collections on a cold cache (`invisible_playwright fetch` and the first launch) and has the
engine generate the state from them. tests.yml, fakeweb.yml and e2e.yml (its Linux run, its Windows parts and the Windows job of Control+A) set the variable
(scripts/ci_lab_security_state.py set) ONCE, before the step that runs pytest and, where the leg has one, before the step that fetches the engine (`fetch` makes the state
present, so it would be the first to download and generate).
user-install.yml proves the installation a user gets and is left as it is.
"""
from pathlib import Path
import pytest
pytestmark = pytest.mark.unit
WORKFLOWS = Path(__file__).resolve().parents[1] / ".github" / "workflows"
SET = "python scripts/ci_lab_security_state.py set --pin ci/security-state.pin.json"
FETCH = " - name: Fetch the published firefox binary\n"
RUNS_PYTEST = {
"tests.yml": " - name: Run pytest\n",
"e2e.yml": " - name: Run the full e2e suite under a virtual display, without the root ones\n",
"e2e.yml#windows": " - name: Run this part of the e2e\n",
"e2e.yml#control-a": " - name: The keyboard shortcut selects all",
"fakeweb.yml": " - name: Profile P2, stock first and ours second",
}
def _scope(name):
"""The text of one workflow, or of one leg of it: `e2e.yml` is its Linux job, `e2e.yml#windows` its Windows parts, `e2e.yml#control-a` the
Windows job of the keyboard shortcut (it fetches and launches too)."""
file, _, leg = name.partition("#")
text = (WORKFLOWS / file).read_text(encoding="utf-8")
if file != "e2e.yml":
return text
windows = text.index("\n e2e-windows:\n")
if leg == "windows":
return text[windows:]
if leg == "control-a":
start = text.index("\n e2e-windows-control-a:\n")
return text[start:windows] if start < windows else text[start:]
ends = [i for i in (text.find("\n e2e-windows-control-a:\n"), windows) if i >= 0]
return text[:min(ends)]
@pytest.mark.parametrize("name, pytest_step", sorted(RUNS_PYTEST.items()))
def test_the_security_state_is_set_once_before_the_step_that_runs_the_tests(name, pytest_step):
text = _scope(name)
assert text.count(SET) == 1, "%s sets the security state %d times" % (name, text.count(SET))
assert pytest_step in text, "the step that runs the tests of %s moved: update this test with it" % name
assert text.index(SET) < text.index(pytest_step), "%s sets the security state after the tests started" % name
@pytest.mark.parametrize("name", ["e2e.yml", "e2e.yml#windows", "e2e.yml#control-a", "fakeweb.yml"])
def test_the_security_state_is_set_before_the_engine_is_fetched(name):
text = _scope(name)
assert FETCH in text, "the fetch step of %s moved: update this test with it" % name
assert text.index(SET) < text.index(FETCH), "%s fetches before the security state is set: `fetch` would download Mozilla's and generate" % name
def test_the_workflow_that_proves_the_installation_is_left_alone():
assert SET not in (WORKFLOWS / "user-install.yml").read_text(encoding="utf-8")
+15 -13
View File
@@ -8,9 +8,9 @@ from invisible_playwright import cli
@pytest.fixture(autouse=True)
def _fetch_does_not_download_the_intermediates(monkeypatch):
"""`fetch` also looks for a newer intermediates list (`update_intermediates`), which reaches Mozilla: a test that is not about it does not."""
monkeypatch.setattr("invisible_playwright.cli.update_intermediates", lambda *a, **k: (None, False), raising=False)
def _fetch_does_not_download_the_security_state(monkeypatch):
"""`fetch` also looks for a newer security state (`update_security_state`), which reaches Mozilla and runs the engine: a test that is not about it does not."""
monkeypatch.setattr("invisible_playwright.cli.update_security_state", lambda *a, **k: (None, False))
@pytest.mark.unit
@@ -105,27 +105,29 @@ def test_fetch_prints_the_path_as_its_last_line(tmp_path, monkeypatch, capsys):
@pytest.mark.unit
def test_fetch_looks_for_a_newer_intermediates_list_after_the_engine(tmp_path, monkeypatch, capsys):
"""The known-bad is a `fetch` that only makes sure a list is cached (`ensure_intermediates`, no request on a warm cache): a user who runs `fetch` asking for
what is current keeps a stale list. The engine is made present, then `update_intermediates` is called (and `ensure_intermediates` is not), in that
order, and the path of the engine is still the last line."""
def test_fetch_looks_for_a_newer_security_state_after_the_engine_and_for_that_engine(tmp_path, monkeypatch, capsys):
"""The known-bad is a `fetch` that still calls the removed `update_intermediates` (or none at all): a user who runs `fetch` asking for what is current keeps a stale
state, or the engine is never asked to generate one. The engine is made present, then `update_security_state` is called with THAT engine (and
`update_intermediates` is not), in that order, and the path of the engine is still the last line."""
fake = tmp_path / "firefox.exe"
fake.write_text("x")
calls = []
monkeypatch.setattr("invisible_playwright.cli.ensure_binary", lambda: calls.append("engine") or fake)
monkeypatch.setattr("invisible_playwright.cli.update_intermediates", lambda *a, **k: calls.append("update") or (None, False), raising=False)
monkeypatch.setattr("invisible_playwright.cli.ensure_intermediates", lambda *a, **k: calls.append("ensure"), raising=False)
monkeypatch.setattr("invisible_playwright.cli.update_security_state", lambda *a, **k: calls.append(("update", a, k)) or (None, False))
monkeypatch.setattr("invisible_core.update_security_state", lambda *a, **k: calls.append(("core", a, k)) or (None, False))
monkeypatch.setattr("invisible_core.update_intermediates", lambda *a, **k: calls.append("intermediates"), raising=False)
monkeypatch.setattr("invisible_playwright.cli.update_intermediates", lambda *a, **k: calls.append("intermediates"), raising=False)
monkeypatch.setattr("invisible_core.download.iter_cached_engines", lambda: [])
rc = cli.main(["fetch"])
assert rc == 0
assert calls == ["engine", "update"]
assert calls == ["engine", ("update", (), {"engine": fake})]
assert capsys.readouterr().out.strip().splitlines()[-1] == str(fake)
@pytest.mark.unit
def test_a_failing_intermediates_list_is_a_warning_and_changes_neither_the_exit_nor_the_last_line(tmp_path, monkeypatch, capsys):
def test_a_failing_security_state_is_a_warning_and_changes_neither_the_exit_nor_the_last_line(tmp_path, monkeypatch, capsys):
fake = tmp_path / "firefox.exe"
fake.write_text("x")
@@ -133,14 +135,14 @@ def test_a_failing_intermediates_list_is_a_warning_and_changes_neither_the_exit_
raise RuntimeError("no route to host")
monkeypatch.setattr("invisible_playwright.cli.ensure_binary", lambda: fake)
monkeypatch.setattr("invisible_playwright.cli.update_intermediates", refuses)
monkeypatch.setattr("invisible_playwright.cli.update_security_state", refuses)
monkeypatch.setattr("invisible_core.download.iter_cached_engines", lambda: [])
rc = cli.main(["fetch"])
cap = capsys.readouterr()
assert rc == 0
assert "no route to host" in cap.err and "intermediates" in cap.err
assert "no route to host" in cap.err and "security state" in cap.err
assert cap.out.strip().splitlines()[-1] == str(fake)
@@ -21,8 +21,11 @@ that could not see a held loop does not pass the test for nothing.
Nothing here is judged by how long it took (that is a verdict on the runner: a loop that a starved machine runs late is late without
a defect). The loop is held when its thread was SEEN inside a step of the close that waits (`_close_loop_verdicts.blocked_by`), and the
other browsers keep answering when, in the order of the events, a call of each began and ended while the close was in flight and
while the removal of the closing browser's profile was held.
other browsers keep answering when, in the order of the events, the loop read replies of them while the close was in flight (a reply
that ARRIVED inside it counts, whenever its call began: a call that straddles the start of the close is a call the loop answered) and
every one of them answered while the removal of the closing browser's profile was held. A browser that is silent inside the close
while the others answer and the loop was never seen held is an engine the machine did not run (the printed spans say where it was):
it is red only with a loop seen held, or with every browser silent (nothing shows that the loop ran).
THE REMOVAL OF THE PROFILE IS NOT THE CLOSE'S. `close()` returns once the browser has exited; the removal of its session's directories
is handed to the launch's reaper (`invisible_core.process.Reaper.then`) and runs on the thread that ends the tree, or on the
@@ -211,14 +214,22 @@ _CLIENT = textwrap.dedent("""
async def pinger(page, record, closing, gate, records):
# A call counts as answered DURING the close when it began after the close began and ended before it ended, and as answered
# DURING THE REMOVAL when it began after the removal of the profile was reached and ended while it was still held: the order
# of the events, not how long it took. The close has returned by then or not: the removal is the reaper's, not the close's.
# A reply counts as ARRIVED DURING the close (`answered`) when the close was in flight at the moment the loop read it, whenever
# its call began: that is what shows the loop ran then. `inside` counts the calls that began AND ended in the close (printed,
# not judged); `spans` keeps (began, ended) of every call and `open_since` the call that is still waiting, to say WHERE a silent
# browser was (its engine did not reply, or the loop did not read it). A call is answered DURING THE REMOVAL when it began after
# the removal of the profile was reached and ended while it was still held. The order of the events, not how long it took. The
# close has returned by then or not: the removal is the reaper's, not the close's.
while not record["stop"]:
while_closing = closing.is_set()
started = time.monotonic()
started = record["open_since"] = time.monotonic()
await page.evaluate("1 + 1")
took = time.monotonic() - started
record["open_since"] = None
ended = time.monotonic()
took = ended - started
record["spans"].append((started, ended))
if closing.is_set():
record["answered"] += 1
if while_closing and closing.is_set():
record["inside"] += 1
record["slowest"] = max(record["slowest"], took) # printed, never judged
@@ -322,7 +333,7 @@ _CLIENT = textwrap.dedent("""
records = []
tasks = []
for page in pages[1:]:
record = {"stop": False, "inside": 0, "during_removal": 0, "slowest": 0.0}
record = {"stop": False, "answered": 0, "inside": 0, "during_removal": 0, "slowest": 0.0, "open_since": None, "spans": []}
records.append(record)
tasks.append(asyncio.create_task(pinger(page, record, closing, gate, records)))
await asyncio.sleep(0.5)
@@ -333,9 +344,12 @@ _CLIENT = textwrap.dedent("""
closing.set()
started = time.monotonic()
await sessions[0].__aexit__(None, None, None)
took = time.monotonic() - started
returned = time.monotonic()
took = returned - started
with gate_lock:
gate["order"].append("close_returned")
# Where each other browser was when the close returned: the age of the call it was still waiting for, if any.
open_for = [round(returned - r["open_since"], 3) if r["open_since"] is not None else 0.0 for r in records]
closing.clear()
await instrument.finish()
report = instrument.report()
@@ -360,7 +374,12 @@ _CLIENT = textwrap.dedent("""
"took": took, "launched": launched,
"control": control.report(),
"unscheduled": unscheduled.report(),
"others": [{"inside": r["inside"], "during_removal": r["during_removal"], "slowest": r["slowest"]} for r in records],
"others": [{"answered": r["answered"], "inside": r["inside"], "during_removal": r["during_removal"],
"slowest": r["slowest"], "open_for": open_for[i],
# the calls that touched the close, as (began, ended) in seconds from the close's start; the first eight
"spans": [[round(a - started, 3), round(b - started, 3)] for a, b in r["spans"]
if b >= started and a <= returned][:8]}
for i, r in enumerate(records)],
"gate": {"reached": gate["since"] is not None, "released_by": gate["released_by"], "order": gate["order"],
"removal": gate["removal"]},
"ended": {"reaped": reaped, "profile_gone": gone},
@@ -492,12 +511,18 @@ def test_no_blocking_step_of_the_close_runs_on_the_loop_s_thread(report):
def test_the_other_three_keep_answering_during_the_close(report):
"""Each of the other three browsers answers a call that began and ended while the first one closes, the removal of the first one's
profile is held until every one of them has answered, and the three are alive after. The order of the events decides; the
seconds a call took are printed."""
problem = others_answered_problem(report["others"], report["gate"])
assert problem is None, "%s\n(printed, not judged: the slowest call of each browser inside the close, in s: %s)" % (
problem, [round(r["slowest"], 3) for r in report["others"]])
"""The loop reads replies of the other three browsers while the first one closes (a reply that ARRIVED inside the close counts,
whenever its call began), the removal of the first one's profile is held until every one of them has answered, and the three are
alive after. A browser whose engine did not reply during the close while the others did, and the loop was never seen held, is a
browser the machine did not run: it is the removal's hold that asks every one of them to answer afterwards. The order of the
events decides; the seconds are printed."""
problem = others_answered_problem(report["others"], report["gate"], report["inside"])
assert problem is None, (
"%s\n(printed, not judged: the close took %.0f ms; per browser: replies that arrived inside the close, calls that began and "
"ended inside it, the slowest of those in s, the age in s of the call still waiting when the close returned, and the calls that "
"touched the close as (began, ended) in s from its start: %s)" % (
problem, report["took"] * 1000,
[(r["answered"], r["inside"], round(r["slowest"], 3), r["open_for"], r["spans"]) for r in report["others"]]))
assert report["texts"] == ["browser 1", "browser 2", "browser 3"]
+266
View File
@@ -163,3 +163,269 @@ def test_a_context_locale_reaches_navigator_intl_and_the_header(firefox_binary):
ctx.close()
finally:
srv.shutdown()
# ---------------------------------------------------------------------------------------------------------------------------------
# What a worker, a worklet, a canvas and the page's own realm say of the language and the zone of their context.
#
# Characterisation of firefox-68 (the hooks of fingerprint/locale-time/{workers,language,timezone} in the engine series cite these
# tests by name): each one is green on the published engine and has to stay green on the one that replaces its hooks. The language
# and the zone are read where a page reads them (a worker's own `navigator` and `Intl`, a worklet's processor, a canvas's text
# metrics, an inline script of the page). Where a context's value is compared with another value, the other is a control that can
# fail: the context left on the launch language, or a context with a language of its own that the change must not reach.
# ---------------------------------------------------------------------------------------------------------------------------------
import _locale_probe as probe # noqa: E402
DE_LIST = ["de-DE", "de", "en-US", "en"]
#: One page for every tab the tests below open: the URL is what tells the tabs apart for the chrome scope, so each one carries a query.
SITE = {
"/page": probe.PAGE,
"/lang-worker.js": (probe.LANG_WORKER, "text/javascript"),
"/measure-worker.js": (probe.MEASURE_WORKER, "text/javascript"),
}
def _wait_for(condition, page):
"""True once ``condition()`` holds, polled with the page's event loop as the pump; the deadline is the one of ``wait_until``."""
from _waits import wait_until
return wait_until(condition, 30, lambda: page.wait_for_timeout(100))
@pytest.mark.e2e
def test_a_worker_with_its_own_language_ignores_the_accept_languages_pref(firefox_binary, monkeypatch):
"""⛔ ``intl.accept_languages`` IS THE LANGUAGE OF A BROWSER THAT DECLARED NONE. When the pref changes Firefox tells every worker, and
a worker that has no language of its own takes the new list. A worker whose context declares a language reads that list from its
owner and has to ignore the broadcast (WorkerPrivate::UpdateLanguagesInternal): a site cannot see two languages move apart in
one browser because a pref moved. The engine's own refusal is what is pinned here.
One session with nothing declared at launch (``juggler.locale.override`` empty: no language falls back to the session) and two
contexts: one asks for de-DE, the other for nothing (``locale=None``). The pref goes to "ja, en-US" from the chrome scope. The worker
of the context with nothing declared takes it (the control: the broadcast reaches workers, so the other worker's silence is
its own); the worker with de-DE keeps de-DE and its four entries. The two contexts are in different content processes, so the change of
the other worker proves nothing about the process of the silent one: before the silent worker is read, the test waits on the
CONDITION "the content process of each of the two tabs reports ``intl.accept_languages`` = "ja, en-US"" (a process script reads the pref
in each process). A process that reports it has applied the change and queued the broadcast to its workers before it answered, so the
answer of the worker with de-DE comes after the broadcast was handled in its own process.
"""
import webfont_probe
from invisible_playwright import InvisiblePlaywright
monkeypatch.setenv("MOZ_REMOTE_ALLOW_SYSTEM_ACCESS", "1") # the chrome-scope write below
srv, base = probe.serve(SITE)
marionette = None
try:
with InvisiblePlaywright(seed=5150, binary_path=firefox_binary, headless=True, locale="it-IT", timezone="Europe/Rome",
extra_args=probe.MARIONETTE_ARGS,
extra_prefs={"marionette.port": 0, "juggler.locale.override": ""}) as browser:
own = browser.new_context(locale="de-DE").new_page()
none = browser.new_context(locale=None).new_page()
for name, page in (("own", own), ("none", none)):
page.goto("%s/page?%s" % (base, name), wait_until="load", timeout=30_000)
page.evaluate(probe.START_LANG_WORKER_JS)
kept = {"languages": DE_LIST, "intl": "de-DE"}
assert own.evaluate(probe.ASK_LANG_WORKER_JS) == kept, "the worker with its own language before the pref moves"
before = none.evaluate(probe.ASK_LANG_WORKER_JS)["languages"]
assert before != ["ja", "en-US"], "the control worker already speaks the list the pref is about to take: %r" % (before,)
marionette = probe.open_chrome(webfont_probe.marionette_active_port())
assert probe.set_pref(marionette, "intl.accept_languages", "ja, en-US") == "ja, en-US"
# The barrier: the content process of EACH tab holds the new value (read in that process), so the worker with de-DE is read after its
# own process handled the change.
processes = []
def every_process_has_it():
processes.append(probe.content_process_prefs(marionette, "intl.accept_languages", ("own", "none")))
return processes[-1].get("prefs") == {"own": "ja, en-US", "none": "ja, en-US"}
assert _wait_for(every_process_has_it, none), (
"a content process never reported the new intl.accept_languages (last answers: %r)" % (processes[-3:],))
seen = []
def follows():
seen.append(none.evaluate(probe.ASK_LANG_WORKER_JS)["languages"])
return seen[-1] == ["ja", "en-US"]
assert _wait_for(follows, none), (
"the worker with no language of its own never took the pref (it answered %r): the broadcast does not reach workers, "
"so the silence of the other worker proves nothing" % (seen[-3:],))
assert own.evaluate(probe.ASK_LANG_WORKER_JS) == kept, (
"the worker with its own language followed intl.accept_languages instead of its context")
finally:
if marionette is not None:
marionette.close()
probe.stop(srv)
SW_ZONE = b"""
const read = () => ({timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
january: new Date(Date.UTC(2024, 0, 15, 12)).getTimezoneOffset()});
onmessage = (e) => e.source.postMessage(read());
"""
SW_JS = """async () => {
const reg = await navigator.serviceWorker.register('/sw-zone.js');
const sw = reg.active || reg.waiting || reg.installing;
return await new Promise((ok) => {
navigator.serviceWorker.onmessage = (e) => ok(e.data);
const send = () => sw.postMessage(0);
if (sw.state === 'activated') send();
else sw.addEventListener('statechange', () => sw.state === 'activated' && send());
});
}"""
@pytest.mark.e2e
def test_a_service_worker_of_a_context_with_its_own_zone_has_it(firefox_binary):
"""⛔ A SERVICE WORKER IS BORN FAR FROM ITS PAGE. It has no window; the engine hands it the language and the zone of its context in
the data it is started with (ServiceWorkerPrivate::RefreshRemoteWorkerData), and a worker that missed them told a site the
SESSION's zone while the page in the same context told another: the one clock of a context, read twice. A context asks for its own
zone with ``timezone_id``; the service worker it registers reads it back in ``Intl`` and in the offset of a date.
An Europe/Rome session, a context with ``timezone_id="Asia/Tokyo"``: its service worker answers Asia/Tokyo and -540 (no daylight
time, one answer all year). The control is the session's own context: its service worker answers Europe/Rome and -60 in January.
"""
from invisible_playwright import InvisiblePlaywright
srv, base = probe.serve(dict(SITE, **{"/sw-zone.js": (SW_ZONE, "text/javascript")}))
try:
with InvisiblePlaywright(seed=5150, binary_path=firefox_binary, headless=True, locale="it-IT",
timezone="Europe/Rome") as browser:
answers = {}
for name, options in (("session", {}), ("tokyo", {"timezone_id": "Asia/Tokyo"})):
page = browser.new_context(**options).new_page()
page.goto("%s/page?%s" % (base, name), wait_until="load", timeout=30_000)
answers[name] = page.evaluate(SW_JS)
assert answers["tokyo"] == {"timeZone": "Asia/Tokyo", "january": -540}, "the service worker of the Asia/Tokyo context"
assert answers["session"] == {"timeZone": "Europe/Rome", "january": -60}, (
"the service worker of the context that asked for no zone (the session's)")
finally:
probe.stop(srv)
WORKLET = b"""
class Probe extends AudioWorkletProcessor {
constructor() {
super();
const options = Intl.DateTimeFormat().resolvedOptions();
this.port.postMessage({locale: options.locale, timeZone: options.timeZone,
january: new Date(Date.UTC(2024, 0, 15, 12)).getTimezoneOffset()});
}
process() { return false; }
}
registerProcessor('probe', Probe);
"""
# An OfflineAudioContext: a worklet needs no sound device, and the processor is built when its node is.
WORKLET_JS = """async () => {
const ctx = new OfflineAudioContext(1, 128, 44100);
await ctx.audioWorklet.addModule('/worklet.js');
const node = new AudioWorkletNode(ctx, 'probe');
const heard = new Promise((ok) => { node.port.onmessage = (e) => ok(e.data); });
node.connect(ctx.destination);
ctx.startRendering();
return await heard;
}"""
@pytest.mark.e2e
def test_an_audio_worklet_of_a_context_speaks_its_language_and_zone(firefox_binary):
"""⛔ A WORKLET IS A GLOBAL OF ITS OWN AND ASKS ITS OWN QUESTIONS. An AudioWorkletProcessor runs on the audio thread in a realm that is
not the page's and not a worker's (WorkletGlobalScope::CreateRealmOptions); a realm built from the process's sources told a site that
reads ``Intl`` in a processor the host's language and zone. The engine reads the language and the zone from the window that added the
module (WorkletLoadInfo) and gives them to the realm it builds.
An it-IT, Europe/Rome session; a context with ``locale="de-DE"`` and ``timezone_id="Asia/Tokyo"``; the processor posts what its own
``Intl`` says. The context's worklet answers de-DE, Asia/Tokyo and -540 for a January date. The control is the context that asked
for neither: its worklet answers it-IT, Europe/Rome and -60. The two answers differ in each field.
"""
from invisible_playwright import InvisiblePlaywright
srv, base = probe.serve(dict(SITE, **{"/worklet.js": (WORKLET, "text/javascript")}))
try:
with InvisiblePlaywright(seed=5150, binary_path=firefox_binary, headless=True, locale="it-IT",
timezone="Europe/Rome") as browser:
answers = {}
for name, options in (("session", {}), ("own", {"locale": "de-DE", "timezone_id": "Asia/Tokyo"})):
page = browser.new_context(**options).new_page()
page.goto("%s/page?%s" % (base, name), wait_until="load", timeout=30_000)
answers[name] = page.evaluate(WORKLET_JS)
assert answers["own"] == {"locale": "de-DE", "timeZone": "Asia/Tokyo", "january": -540}, (
"the worklet of the de-DE, Asia/Tokyo context")
assert answers["session"] == {"locale": "it-IT", "timeZone": "Europe/Rome", "january": -60}, (
"the worklet of the context that asked for neither (the session's)")
assert all(answers["own"][key] != answers["session"][key] for key in answers["own"]), answers
finally:
probe.stop(srv)
def _canvas_widths(page):
return page.evaluate(probe.MEASURE_PAGE_JS, ["ja", "en"])
@pytest.mark.e2e
def test_text_without_lang_takes_the_language_group_of_the_session_language(firefox_binary):
"""⛔ TEXT WITH NO ``lang`` TAKES THE LANGUAGE OF THE MACHINE, AND THE MACHINE IS THE SESSION. An OffscreenCanvas on the main thread has
no element and no document: its font comes from nsLanguageAtomService::GetLocaleLanguage, which asked the host's regional settings
and now asks the language the session declares. Two sessions launched with two languages measure the same strings differently, each
as the canvas of its own language group.
A ja-JP launch and an en-US launch (one browser at a time). In each, a main-thread OffscreenCanvas with no ``lang`` measures as the
canvas element with the session's language and not as the one with the other language, and as a worker of the session's own context
(another reader of the same language). The control is the pair of sessions: their OffscreenCanvases do not measure alike.
"""
from invisible_playwright import InvisiblePlaywright
srv, base = probe.serve(SITE)
try:
read = {}
for name, locale, zone in (("ja", "ja-JP", "Asia/Tokyo"), ("en", "en-US", "America/New_York")):
with InvisiblePlaywright(seed=5150, binary_path=firefox_binary, headless=True, locale=locale, timezone=zone) as browser:
page = browser.new_context().new_page()
page.goto("%s/page?%s" % (base, name), wait_until="load", timeout=30_000)
read[name] = _canvas_widths(page)
for name, other in (("ja", "en"), ("en", "ja")):
got = read[name]
assert got["element"]["ja"] != got["element"]["en"], (
"the two language groups draw these strings alike here, so nothing can tell them apart: %r" % (got["element"],))
assert got["offscreen"] == got["element"][name], (
"the %s session's OffscreenCanvas measures %r, a canvas of the %s group %r" % (name, got["offscreen"], name, got["element"][name]))
assert got["offscreen"] != got["element"][other], "the %s session's OffscreenCanvas measures as the %s group" % (name, other)
assert got["offscreen"] == got["worker"], "the %s session: the main thread and a worker of the session's context disagree" % name
assert read["ja"]["offscreen"] != read["en"]["offscreen"], "the two sessions' OffscreenCanvases measure alike"
finally:
probe.stop(srv)
INTL_JS = "const o = Intl.DateTimeFormat().resolvedOptions(); return {locale: o.locale, timeZone: o.timeZone};"
@pytest.mark.e2e
def test_intl_in_the_page_realm_follows_the_language_and_zone_of_its_context(firefox_binary):
"""The page's own global is built from the language and the zone of its context (xpc::InitGlobalObjectOptions, fed by
nsGlobalWindowOuter::CreateNativeGlobalForInner), and that realm is the one a site's inline script runs in. It is read here the way a
site reads it: an INLINE script writes ``Intl.DateTimeFormat().resolvedOptions()`` into the DOM (``page.evaluate`` is not necessarily
that realm on this engine, so a read through it would say nothing about it).
An it-IT, Europe/Rome launch: the default context's page realm says it-IT and Europe/Rome. A context with ``locale="de-DE"`` and
``timezone_id="Asia/Tokyo"``: de-DE and Asia/Tokyo. The control is the pair: the two contexts' answers differ in both fields.
"""
from invisible_playwright import InvisiblePlaywright
srv, base = probe.serve(SITE)
try:
with InvisiblePlaywright(seed=5150, binary_path=firefox_binary, headless=True, locale="it-IT",
timezone="Europe/Rome") as browser:
read = {}
for name, options in (("session", {}), ("own", {"locale": "de-DE", "timezone_id": "Asia/Tokyo"})):
page = browser.new_context(**options).new_page()
page.goto("%s/page?%s" % (base, name), wait_until="load", timeout=30_000)
read[name] = probe.read_in_page_realm(page, INTL_JS)
assert read["session"] == {"locale": "it-IT", "timeZone": "Europe/Rome"}, "the page realm of the default context"
assert read["own"] == {"locale": "de-DE", "timeZone": "Asia/Tokyo"}, "the page realm of the de-DE, Asia/Tokyo context"
assert all(read["own"][key] != read["session"][key] for key in read["own"]), read
finally:
probe.stop(srv)
-88
View File
@@ -1,88 +0,0 @@
"""CSS calc() functions give Windows' text on every OS.
The style engine evaluates ``calc(1px * sin(x))``, ``asin``, ``pow``, ``log``
and the others in f32 with the C library's f32 functions (sinf, asinf, powf,
logf...), and writes the number with 6 significant digits. Windows Firefox gets
them from ucrtbase.dll; Linux Firefox got glibc's, whose last f32 bit differs
for some inputs - and for some of those the difference moves the 6th digit,
which is what a page reads with getComputedStyle.
tests/data/ucrt_css_calc.txt holds, per function, inputs where ucrtbase.dll and
glibc write a different text (and a few where they agree), with the text
ucrtbase.dll gives; scripts/ucrt_css_calc.py makes it. A function with no
differing input in the searched grid (tan, atan, atan2, exp: 0 of 65,000 to
90,000 each; hypot is a sum and a square root, exact) is in the file with
control inputs only, so it checks that the page computes at all.
A number is read with ``word-spacing`` (px) and an angle with ``rotate``
(deg): both are computed values that getComputedStyle writes as the style
engine serialized them, with no layout in between.
Every mismatch is listed in the failure, not just the first.
"""
from __future__ import annotations
from pathlib import Path
import pytest
DATA = Path(__file__).parent / "data" / "ucrt_css_calc.txt"
ANGLE_FUNCTIONS = ("asin", "acos", "atan", "atan2")
READ = """
(cases) => cases.map(([prop, value]) => {
const el = document.createElement("div");
el.style.setProperty(prop, value);
document.body.appendChild(el);
const got = getComputedStyle(el).getPropertyValue(prop);
el.remove();
return got;
})
"""
def _cases():
out = []
for line in DATA.read_text().splitlines():
if line and not line.startswith("#"):
parts = line.split()
out.append((parts[0], parts[1:-1], parts[-1]))
return out
def _css(fn, args):
"""(property, value) that makes the style engine compute fn(args)."""
call = "%s(%s)" % (fn, ", ".join(args))
if fn in ANGLE_FUNCTIONS:
return "rotate", call
return "word-spacing", "calc(1px * %s)" % call
@pytest.mark.unit
def test_the_data_has_every_function_and_the_inputs_that_tell_the_libraries_apart():
cases = _cases()
assert {c[0] for c in cases} == {
"sin", "cos", "tan", "asin", "acos", "atan", "atan2", "exp", "log", "pow", "hypot"}
# The cases that make this test about the library and not only the engine.
for fn in ("sin", "cos", "asin", "acos", "log", "pow"):
assert sum(1 for c in cases if c[0] == fn) >= 4, fn
# sin(-12.2958984375): ucrtbase 0.267186, glibc 0.267187.
assert ("sin", ["-12.2958984375"], "0.267186px") in cases
@pytest.mark.e2e
def test_css_calc_functions_are_ucrtbase_bytes(firefox_binary, engine_at_least):
engine_at_least("firefox-68")
from invisible_playwright import InvisiblePlaywright
cases = _cases()
with InvisiblePlaywright(seed=6021, binary_path=firefox_binary, headless=True) as browser:
page = browser.new_page()
page.goto("about:blank")
got = page.evaluate(READ, [list(_css(fn, args)) for fn, args, _ in cases])
wrong = ["%s(%s): page %r, ucrtbase %r" % (fn, ", ".join(args), g, want)
for (fn, args, want), g in zip(cases, got) if g != want]
assert not wrong, ("%d of %d calc() results are not ucrtbase's:\n %s"
% (len(wrong), len(cases), "\n ".join(wrong)))
@@ -0,0 +1,136 @@
"""The size and pointer media queries answer the declaration, not the host.
What it fixes, from the page's side (`matchMedia`):
* `(device-width: Wpx)` / `(device-height: Hpx)` are the declared screen (`zoom.stealth.screen.width/height`), not the
host's monitor.
* `(pointer: ...)` / `(any-pointer: ...)` / `(hover: ...)` are the declared pointer capabilities
(`zoom.stealth.pointer.primary` / `.all`, the bitmask Coarse 1, Fine 2, Hover 4), not the host's (a Windows machine
with a digitizer adds Coarse by itself).
* A context made with `has_touch=True` (Juggler's touch override) still reads a COARSE pointer when a fine one is
declared: the override of the context decides before the declaration does.
Engine hook: `fingerprint/screen-window/css-media` of the engine series (`layout/style/nsMediaFeatures.cpp`:
`GetDeviceSize`, `GetPointerCapabilities`; the declarations in `StealthMediaFeatures.h`).
Negative controls, in the same test: the device size is read on a launch declared with ANOTHER screen (2623x1411): the
wrapper hands the declared screen to the browser by two roads (the screen prefs and the screen of the context, which Juggler
emulates), so a launch with the prefs at 0 still reads the pinned screen; the queries must follow each declaration. The
pointer is read with the engine off (`hw_seed` 0, stock Firefox: an active engine refuses a declaration cleared with -1), the
host's answer; and has_touch is read in a context without it, on the same launch.
Linux and Windows run the same assertions: the declared values are the ones no runner has (a 2731x1537 screen; a coarse
primary pointer on a machine with a mouse).
"""
from __future__ import annotations
import pytest
pytestmark = pytest.mark.e2e
#: A screen no runner has.
SCREEN = {"screen.width": 2731, "screen.height": 1537, "screen.dpr": 1.0}
#: Another screen no runner has: the control of the device size is a launch declared with this one.
OTHER_SCREEN = {"screen.width": 2623, "screen.height": 1411, "screen.dpr": 1.0}
#: The engine off (stock Firefox): the control of the pointer. The engine refuses an active launch with a declaration cleared.
ENGINE_OFF = {"zoom.stealth.fpp.hw_seed": 0}
COARSE, FINE, HOVER = 1, 2, 4
QUERIES = {name: "matchMedia('%s').matches" % query for name, query in {
"pointer_coarse": "(pointer: coarse)", "pointer_fine": "(pointer: fine)",
"any_coarse": "(any-pointer: coarse)", "any_fine": "(any-pointer: fine)",
"hover_none": "(hover: none)", "any_hover_none": "(any-hover: none)"}.items()}
READ_POINTER = "() => ({%s})" % ", ".join("%s: %s" % (k, v) for k, v in QUERIES.items())
def _launch(binary, pin=None, extra_prefs=None):
from invisible_playwright import InvisiblePlaywright
return InvisiblePlaywright(seed=42, pin=pin, binary_path=binary, headless=True, humanize=False,
extra_prefs=extra_prefs)
def _read_pointer(binary, primary=None, every=None):
"""Declared pointer prefs, or (both None) the engine off."""
prefs = ENGINE_OFF if primary is None else {"zoom.stealth.pointer.primary": primary, "zoom.stealth.pointer.all": every}
with _launch(binary, extra_prefs=prefs) as browser:
page = browser.new_page()
page.goto("about:blank", timeout=30000)
return page.evaluate(READ_POINTER)
def test_a_declared_pointer_is_what_the_media_queries_read(firefox_binary):
declared = _read_pointer(firefox_binary, COARSE, COARSE)
assert declared == {"pointer_coarse": True, "pointer_fine": False, "any_coarse": True, "any_fine": False,
"hover_none": True, "any_hover_none": True}, (
"a coarse pointer without hover is declared and the page reads %r" % declared)
# The control: the engine off is not that machine. A fine pointer with hover is the declaration of a desktop; the host
# with no declaration answers its own, and it is not a coarse one without hover.
undeclared = _read_pointer(firefox_binary)
assert undeclared != declared, "with no pointer declared the page reads the same as with a coarse one: %r" % undeclared
assert undeclared["pointer_coarse"] is False and undeclared["any_coarse"] is False, (
"with no pointer declared the page reads %r" % undeclared)
fine = _read_pointer(firefox_binary, FINE | HOVER, FINE | HOVER)
assert fine == {"pointer_coarse": False, "pointer_fine": True, "any_coarse": False, "any_fine": True,
"hover_none": False, "any_hover_none": False}, (
"a fine pointer with hover is declared and the page reads %r" % fine)
def test_has_touch_reads_a_coarse_pointer_even_when_a_fine_one_is_declared(firefox_binary):
with _launch(firefox_binary, extra_prefs={"zoom.stealth.pointer.primary": FINE | HOVER,
"zoom.stealth.pointer.all": FINE | HOVER}) as browser:
plain = browser.new_context().new_page()
plain.goto("about:blank", timeout=30000)
touch = browser.new_context(has_touch=True).new_page()
touch.goto("about:blank", timeout=30000)
without = plain.evaluate(READ_POINTER)
with_touch = touch.evaluate(READ_POINTER)
# the control: the same launch, a context without the override, reads the declared fine pointer
assert without["pointer_fine"] is True and without["pointer_coarse"] is False, (
"a context without has_touch reads %r under a declared fine pointer" % without)
assert with_touch["pointer_coarse"] is True and with_touch["pointer_fine"] is False, (
"a context with has_touch reads %r under a declared fine pointer: the touch override must win" % with_touch)
assert with_touch["any_coarse"] is True, "any-pointer in a has_touch context reads %r" % with_touch
def _read_device_size(binary, pin, ask):
"""The page of a launch pinned to ``pin``, asked for the device size ``ask`` (width, height) and for its own."""
with _launch(binary, pin=pin) as browser:
page = browser.new_page()
page.goto("about:blank", timeout=30000)
return page.evaluate("""([w, h]) => ({
screen_w: screen.width, screen_h: screen.height,
device_width: matchMedia('(device-width: ' + w + 'px)').matches,
device_height: matchMedia('(device-height: ' + h + 'px)').matches,
own_width: matchMedia('(device-width: ' + screen.width + 'px)').matches,
own_height: matchMedia('(device-height: ' + screen.height + 'px)').matches})""", list(ask))
def test_the_device_size_media_queries_read_the_declared_screen(firefox_binary):
first = (SCREEN["screen.width"], SCREEN["screen.height"])
second = (OTHER_SCREEN["screen.width"], OTHER_SCREEN["screen.height"])
declared = _read_device_size(firefox_binary, SCREEN, first)
assert declared["device_width"] is True and declared["device_height"] is True, (
"(device-width: 2731px) and (device-height: 1537px) do not match under a declared 2731x1537 screen: %r" % declared)
assert (declared["screen_w"], declared["screen_h"]) == first
assert declared["own_width"] is True and declared["own_height"] is True, (
"the device size the media queries read is not the screen the page reads: %r" % declared)
# The control: the wrapper hands the declared screen to the browser by two roads (the prefs, and the screen of the context
# that Juggler emulates), so the absent declaration is not a control. A launch with ANOTHER declared screen is: the same
# query for the first size does not match there, and the queries follow that declaration.
other = _read_device_size(firefox_binary, OTHER_SCREEN, first)
assert (other["screen_w"], other["screen_h"]) == second, other
assert other["device_width"] is False and other["device_height"] is False, (
"(device-width: 2731px) matches under a declared %dx%d screen: the media queries do not follow the declaration, %r"
% (second + (other,)))
assert other["own_width"] is True and other["own_height"] is True, (
"the device size the media queries read is not the screen the page reads: %r" % other)
assert second != first and other != declared
+104 -31
View File
@@ -25,11 +25,17 @@ retail and died with no usable interface. Hermetic: a local TCP-only SOCKS5 prox
"""
from __future__ import annotations
import json
import os
import shutil
import statistics
import time
import pytest
from _e2e_verdicts import MDNS_RETRY_MS, opened_at_the_retry_problem
from _evidence_with_files import FailureEvidenceWithFiles
from _mdns_listener import MdnsListener
from test_webrtc_realness import _e2e_binary, _launch, candidates, decode_priority, host_candidates, is_mdns # noqa: F401
pytestmark = [pytest.mark.e2e, pytest.mark.usefixtures("the_udp_line")]
@@ -64,24 +70,45 @@ _GATHER_JS = r"""async () => {
}"""
# Two connections on one page, connected to each other in script (the loopback test many demos use).
# ``events`` is the page's own timeline for the failure evidence (``at``: ``performance.now()`` since the start of the script, ``origin``:
# ``performance.timeOrigin``, so the wall clock of an event is ``origin + at``): every ``icecandidate`` of both connections with the candidate string,
# every state change, when each ``addIceCandidate`` was called and when it settled. It only listens: nothing waits on it.
_LOOPBACK_JS = r"""async () => {
const t0 = performance.now();
const events = [];
const at = (what, extra) => { events.push(Object.assign({at: Math.round((performance.now() - t0) * 10) / 10, what}, extra || {})); };
const pc1 = new RTCPeerConnection(), pc2 = new RTCPeerConnection();
pc1.onicecandidate = e => { if (e.candidate) pc2.addIceCandidate(e.candidate).catch(() => {}); };
pc2.onicecandidate = e => { if (e.candidate) pc1.addIceCandidate(e.candidate).catch(() => {}); };
for (const [name, pc] of [['pc1', pc1], ['pc2', pc2]]) {
pc.addEventListener('icecandidate', e => at('icecandidate', {pc: name, candidate: e.candidate ? e.candidate.candidate : null}));
pc.addEventListener('iceconnectionstatechange', () => at('iceconnectionstatechange', {pc: name, state: pc.iceConnectionState}));
pc.addEventListener('connectionstatechange', () => at('connectionstatechange', {pc: name, state: pc.connectionState}));
pc.addEventListener('icegatheringstatechange', () => at('icegatheringstatechange', {pc: name, state: pc.iceGatheringState}));
pc.addEventListener('signalingstatechange', () => at('signalingstatechange', {pc: name, state: pc.signalingState}));
}
const add = (target, targetName, candidate) => {
at('addIceCandidate called', {to: targetName, candidate: candidate.candidate});
return target.addIceCandidate(candidate).then(
() => at('addIceCandidate resolved', {to: targetName, candidate: candidate.candidate}),
err => at('addIceCandidate rejected', {to: targetName, candidate: candidate.candidate, error: String(err)}));
};
pc1.onicecandidate = e => { if (e.candidate) add(pc2, 'pc2', e.candidate); };
pc2.onicecandidate = e => { if (e.candidate) add(pc1, 'pc1', e.candidate); };
const gathered = {pc1: [], pc2: []};
const keep = (name, e) => { if (e.candidate && e.candidate.candidate) gathered[name].push(e.candidate.candidate); };
pc1.addEventListener('icecandidate', e => keep('pc1', e));
pc2.addEventListener('icecandidate', e => keep('pc2', e));
const dc = pc1.createDataChannel('x');
let opened = null, echoed = false;
dc.onopen = () => { opened = Math.round(performance.now() - t0); dc.send('ping'); };
pc2.ondatachannel = ev => { ev.channel.onmessage = m => ev.channel.send('pong:' + m.data); };
dc.onmessage = m => { echoed = (m.data === 'pong:ping'); };
dc.onopen = () => { opened = Math.round(performance.now() - t0); at('datachannel open'); dc.send('ping'); };
pc2.ondatachannel = ev => { at('datachannel announced on pc2'); ev.channel.onmessage = m => ev.channel.send('pong:' + m.data); };
dc.onmessage = m => { echoed = (m.data === 'pong:ping'); at('datachannel echo', {echoed}); };
await pc1.setLocalDescription(await pc1.createOffer());
at('pc1 local description set');
await pc2.setRemoteDescription(pc1.localDescription);
await pc2.setLocalDescription(await pc2.createAnswer());
at('pc2 local description set');
await pc1.setRemoteDescription(pc2.localDescription);
at('pc1 remote description set');
// Until the channel has opened and echoed, for 30 s (the deadline of the wait). The loop also keeps the longest time it did not run: a page that
// was stopped by the machine says so, and the time the connection took is not judged then (`_e2e_verdicts.opened_at_the_retry_problem`).
const deadline = performance.now() + 30000;
@@ -92,13 +119,20 @@ _LOOPBACK_JS = r"""async () => {
stalled = Math.max(stalled, now - last);
last = now;
}
at('wait over', {opened, echoed});
// The road the connection took, read from the browser's own statistics: the nominated pair, and the protocol of each end.
let pair = null;
const pairs = [];
try {
const stats = await pc1.getStats();
const byId = {};
stats.forEach(r => { byId[r.id] = r; });
stats.forEach(r => {
if (r.type === 'candidate-pair') {
const l = byId[r.localCandidateId] || {}, rm = byId[r.remoteCandidateId] || {};
pairs.push({state: r.state, nominated: r.nominated, local: [l.protocol, l.candidateType, l.address, l.port],
remote: [rm.protocol, rm.candidateType, rm.address, rm.port], requestsSent: r.requestsSent, responsesReceived: r.responsesReceived});
}
if (r.type === 'candidate-pair' && r.state === 'succeeded' && (r.nominated || !pair)) {
const l = byId[r.localCandidateId] || {}, rm = byId[r.remoteCandidateId] || {};
pair = {local: l.protocol, remote: rm.protocol, localType: l.candidateType, remoteType: rm.candidateType,
@@ -107,7 +141,7 @@ _LOOPBACK_JS = r"""async () => {
});
} catch (e) {}
pc1.close(); pc2.close();
return {opened, echoed, pair, gathered, stalled: Math.round(stalled)};
return {opened, echoed, pair, gathered, stalled: Math.round(stalled), events, pairs, origin: performance.timeOrigin, started_at: Math.round(t0 * 10) / 10};
}"""
# Retail 159 on Windows, 12 cold launches (``captures/mdns-loopback/retail-159-win-12``): 37-52 ms in ten of twelve, two
@@ -117,14 +151,28 @@ _LOOPBACK_JS = r"""async () => {
# the machine. What the test judges is the ROAD, which the machine cannot change (see the test), and a ceiling under the
# first retry of the mDNS responder (3 s), which no machine is slow enough to reach by being slow.
RETAIL_MEDIAN_WINDOW_MS = (30, 55) # printed beside the measure, for the reader
# What the engine logs for the failure evidence of the loopback test, by its own names (MOZ_LOG; the file is MOZ_LOG_FILE, one per process and
# per launch). ``mdns_service::*`` is the Rust crate of the mDNS responder (dom/media/webrtc/transport/mdns_service/src/lib.rs, crate ``mdns_service``,
# which logs with the ``log`` macros at the crate root, so the module path is ``mdns_service``): a Rust module reaches MOZ_LOG only by a name that
# contains ``::`` (xpcom/base/Logging.cpp, ``LogModule::SetLevel`` calls ``set_rust_log_level`` only then). ``mtransport`` is the module of nICEr's own
# log and of the transport layers (``MOZ_MTLOG_MODULE("mtransport")``, dom/media/webrtc/transport/nricectx.cpp:100, nriceresolver.cpp:67 ...), ML_DEBUG is level 5.
# The engine's ``log`` crate is built with ``release_max_level_info`` (toolkit/library/rust/shared/Cargo.toml:41): a release engine keeps the info, warn and
# error lines of the responder (the ``warn!`` of a failed send, a bad packet, an interface it could not use), not its ``trace!`` lines (questions, answers,
# registrations). ``timestamp`` writes the wall clock (UTC) on each line, ``sync`` writes each line at once, ``rotate:30`` keeps at most 30 MB per process.
MDNS_MOZ_LOG = "timestamp,sync,rotate:30,mdns_service::*:5,mtransport:5"
def _session(declaration, socks, page_url, monkeypatch, seed, script):
"""One proxied launch with the declaration in the environment; runs ``script`` on the page and returns the result."""
def _session(declaration, socks, page_url, monkeypatch, seed, script, engine_log=None):
"""One proxied launch with the declaration in the environment; runs ``script`` on the page and returns the result.
``engine_log``: a folder where the engine writes its own log of this launch (failure evidence, ``MDNS_MOZ_LOG``)."""
binary = _e2e_binary()
if not binary:
pytest.skip("no patched binary (set STEALTHFOX_E2E_BINARY)")
monkeypatch.setenv(NETWORK_ENV, declaration)
if engine_log is not None:
os.makedirs(engine_log, exist_ok=True)
monkeypatch.setenv("MOZ_LOG", MDNS_MOZ_LOG)
monkeypatch.setenv("MOZ_LOG_FILE", os.path.join(engine_log, "engine-%PID.log"))
prefs = {"network.proxy.allow_hijacking_localhost": True, "network.proxy.no_proxies_on": ""}
proxy = {"server": "socks5://127.0.0.1:%d" % socks.port}
with _launch(binary_path=binary, proxy=proxy, extra_prefs=prefs, seed=seed) as browser:
@@ -231,29 +279,54 @@ def test_two_connections_on_one_page_connect_in_the_time_of_retail(local_https_p
The time itself is printed with the retail window beside it: a fast machine shows 30-55 ms, a runner shows more, and
neither is a verdict (an absolute time failed on both GitHub runners with a healthy engine)."""
runs = []
for n in range(5):
res = _session(V4_ONLY, socks5_tcp_only, local_https_page, monkeypatch, 100 + n,
lambda page: page.evaluate(_LOOPBACK_JS))
assert res["echoed"] and res["opened"] is not None, "run %d: the data channel did not open: %r" % (n, res)
runs.append(res)
for side in ("pc1", "pc2"):
hosts = [c for c in res["gathered"][side] if " typ host" in c]
udp = [c for c in hosts if " UDP " in c.upper() or " udp " in c]
assert udp, "run %d: %s gathered no UDP host candidate (the road without UDP): %r" % (n, side, res["gathered"][side])
assert any(c.split()[4].endswith(".local") for c in udp), (
"run %d: %s has no mDNS name among its UDP host candidates: %r" % (n, side, udp))
pair = res["pair"]
assert pair, "run %d: the browser reports no nominated pair: %r" % (n, res)
assert pair["local"] == "udp" and pair["remote"] == "udp", (
"run %d: the connection did not take UDP at both ends (the road through TCP): %r" % (n, pair))
# DIRECT and local: each end is a host candidate, or a peer-reflexive one. The remote end is prflx when the other connection's mDNS
# name was not resolved yet and its connectivity check arrived first: the address the check came from is learned as prflx, and
# that is the same road. What it must never be is a relay or a server-reflexive candidate (a road through the proxy or the
# network), and never TCP (checked above).
assert pair["localType"] in ("host", "prflx") and pair["remoteType"] in ("host", "prflx"), (
"run %d: the pair is not direct and local (a relay or a server-reflexive road): %r" % (n, pair))
problem = opened_at_the_retry_problem(res["opened"], res["stalled"], MDNS_RETRY_MS)
assert problem is None, "run %d: %s" % (n, problem)
launches = []
# Failure evidence (tests/_evidence_with_files.py): per launch, the engine's own log (the mDNS responder and mtransport), kept only for the launch that
# fails; and ``launches.json``, the timings and the page's timeline of EVERY launch up to it (the loop stops at the first red).
with FailureEvidenceWithFiles("declared-host-two-connections-open-in-time") as evidence:
try:
for n in range(5):
log_dir = evidence.files / ("engine-log-run-%d" % n)
launch = {"run": n, "seed": 100 + n, "moz_log": MDNS_MOZ_LOG, "started_m": round(time.perf_counter(), 6),
"started_t": round(time.time(), 4)}
launches.append(launch)
# The lab's own ear on the mDNS group (tests/_mdns_listener.py), started BEFORE the browser so that the engine's socket is the later one:
# it only listens, and what it heard of this launch is ``mdns-wire-run-N.jsonl`` (``m`` is the scale of ``started_m`` above).
listener = MdnsListener().start()
try:
res = _session(V4_ONLY, socks5_tcp_only, local_https_page, monkeypatch, 100 + n,
lambda page: page.evaluate(_LOOPBACK_JS), engine_log=str(log_dir))
finally:
launch.update(returned_m=round(time.perf_counter(), 6), returned_t=round(time.time(), 4))
listener.stop()
listener.write(evidence.files / ("mdns-wire-run-%d.jsonl" % n))
launch["mdns_wire"] = listener.summary()
page_timeline = {key: res.pop(key, None) for key in ("events", "pairs", "origin", "started_at")}
launch.update(opened=res["opened"], echoed=res["echoed"], stalled=res["stalled"], pair=res["pair"], gathered=res["gathered"],
page=page_timeline)
assert res["echoed"] and res["opened"] is not None, "run %d: the data channel did not open: %r" % (n, res)
runs.append(res)
for side in ("pc1", "pc2"):
hosts = [c for c in res["gathered"][side] if " typ host" in c]
udp = [c for c in hosts if " UDP " in c.upper() or " udp " in c]
assert udp, "run %d: %s gathered no UDP host candidate (the road without UDP): %r" % (n, side, res["gathered"][side])
assert any(c.split()[4].endswith(".local") for c in udp), (
"run %d: %s has no mDNS name among its UDP host candidates: %r" % (n, side, udp))
pair = res["pair"]
assert pair, "run %d: the browser reports no nominated pair: %r" % (n, res)
assert pair["local"] == "udp" and pair["remote"] == "udp", (
"run %d: the connection did not take UDP at both ends (the road through TCP): %r" % (n, pair))
# DIRECT and local: each end is a host candidate, or a peer-reflexive one. The remote end is prflx when the other connection's mDNS
# name was not resolved yet and its connectivity check arrived first: the address the check came from is learned as prflx, and
# that is the same road. What it must never be is a relay or a server-reflexive candidate (a road through the proxy or the
# network), and never TCP (checked above).
assert pair["localType"] in ("host", "prflx") and pair["remoteType"] in ("host", "prflx"), (
"run %d: the pair is not direct and local (a relay or a server-reflexive road): %r" % (n, pair))
problem = opened_at_the_retry_problem(res["opened"], res["stalled"], MDNS_RETRY_MS)
assert problem is None, "run %d: %s" % (n, problem)
# This launch is right: its engine log is no evidence of anything.
shutil.rmtree(log_dir, ignore_errors=True)
finally:
(evidence.files / "launches.json").write_text(json.dumps(launches, indent=1, default=str), encoding="utf-8")
times = sorted(r["opened"] for r in runs)
low, high = RETAIL_MEDIAN_WINDOW_MS
with capsys.disabled():
Loaded 100 of 175 files, more files were not shown because too many files have changed in this diff. Show more