Compare commits

..
Author SHA1 Message Date
feder-cr 27f0501cea tests: the proof of the hidden-display pointer test is an outcome after a count of frames, not a clock window 2026-12-02 11:47:28 +01:00
feder-cr 585acedecc tests: a page on the hidden display sees no pointer or mouse event before the test's first input, and its first event is the one that input makes 2026-12-02 11:44:49 +01:00
feder-cr 05149cb8c8 Merge branch 'e72/r6-pwwidth' into e72/r6-wrapper 2026-12-02 08:49:39 +01:00
feder-cr 95bcd4d1c3 tests: the password-mask extraction test is listed among the tests that hash a file, and the page it hashes is a pinned fixture (-text) 2026-12-02 08:49:29 +01:00
feder-cr 4afd02e305 Merge branch 'e72/r6-b2' into e72/r6-wrapper 2026-12-02 08:48:00 +01:00
feder-cr 570d9997ad Merge branch 'e72/r6-twinctl' into e72/r6-wrapper
Unit rows re-summed: +9 cases of the popup move-to extraction test (first and later popup positions), 4586 + 9 = 4595 linux, 4598 + 9 = 4607 windows.
2026-12-02 08:48:00 +01:00
feder-cr 0eff758320 tests: each phase of the popup move/resize test expects what retail reads in the position the phase has in the browser's life (phase 1 the first popup, phase 3 a later one), from the popup-move-to capture of four launches
Retail Firefox 159.0 at a real 150% opens the first popup of a browser one device pixel narrower than every popup after it (inner 499, outer 514, against 500 and 515), and moveTo(99999, 0) stops at 766 for it and 765 for a later one. The old expected values of phase 1 came from rounds
that ran resizeBy(0, 0) in a LATER popup (500, then 501), while the test runs phase 1 as the FIRST popup the browser opens (nothing is opened before it: launch_case, new_page, goto, then the three phases in this order, each popup closed before the next).

The capture (RetailCaptures hunt/popup-move-to, run 46833539990, commit 8a78d95c461c84d9c11fcbd0596b120bbcb102f4; runs 46832090474 and 46821521582 read the same except the one value below) has per display case four launches: a the test's order, b phase 3 alone, c a throwaway
popup opened and closed first and then the three phases, d phase 2 alone, so every phase is read as the first popup of a browser and as a later one. scripts/extract_retail_popup_move_resize.py writes ci/retail-popup-move-resize.json from it (cases[case][phase][first|later],
the launches each reading came from, the sha256 of every raw.json checked against its meta.json, popups of one position that disagree fail the extraction) and cross-checks the window-geometry rounds against it. The test reads only: MOMENTS is phase 1 first, MOVE_TO is
phase 3 later; no assertion changed.

Old and new expected values: phase 1 at scale 1.5 was inner 500x400, outer 515x478 before and inner 501 after resizeBy(0, 0); it is now inner 499x400, outer 514x478 before and after. Scales 1, 1.25 and 2 and phase 3 (moved 13,13; moved_to 765,0; outer 515 at 1.5) are unchanged.

The "501 after resizeBy(0, 0)" case is not asserted any more because this test never opens a non-first popup with resizeBy. It is not lost: launch c (resizeBy(0, 0) in the second popup of its browser) reads 500 then 501 at 1.5 in runs 46832090474 and 46833539990, and the extraction
fails if the old rounds' readings are reproduced by no position (they are, by later, in all four cases).

Unit tests (red on the old script, green after): 26 -> 35 in test_the_retail_popup_moves_and_resizes_are_extracted_from_the_capture_not_typed.py; ci/required-suites.json wrapper.unit.all.linux 4564 -> 4573 and wrapper.unit.all.windows 4576 -> 4585.
2026-12-02 08:42:21 +01:00
feder-cr 6bb7df2ba3 tests: TEMP evidence, a listener made by another script world and the page's own throwing listener, and what window.onerror is told, run on retail and on ours, side by side
On candidate 46792115974 (linux.3, windows.3) the two listener cases of
test_a_page_function_called_by_the_client_sees_only_page_frames_e2e.py fail: the error of the
listener the client's evaluate registered never reaches window.onerror, the page's own does.
This test registers the same listener from the default sandbox of Marionette's ExecuteScript on
retail Firefox 159 (not wrappedJSObject.eval, which is the page's realm) and from the client's
evaluate on ours, fires it by a real click on the page's trigger, and saves per case (Error,
throw 5) whether window.onerror was called and what it was told, with the page's own listener as
control. It asserts nothing about ours.
It is the third file of the row wrapper.e2e.stock_twin.tooltip (min_tests 6) and a named exclusion
of the whole-suite rows (30).
2026-12-02 07:36:17 +01:00
feder-cr 71ddb27003 Merge branch 'e72/r6-b2' into e72/r6-wrapper 2026-12-02 07:26:52 +01:00
feder-cr 1509415d7a Merge branch 'e72/r6-pwwidth' into e72/r6-wrapper
Unit rows re-summed: 4558 + 6 (twin control) + 14 (popup move-to extraction) + 8 (password-mask extraction) = 4586 linux; 4570 + 28 = 4598 windows.
2026-12-02 07:26:51 +01:00
feder-cr 0072328944 Merge branch 'e72/r6-twinctl' into e72/r6-wrapper 2026-12-02 07:26:21 +01:00
feder-cr 197a3e4f49 tests: phase 3 of the popup move/resize test expects what retail reads in its own order (the third popup of one launch, moveBy(10, 10), moveTo(99999, 0)), extracted from the popup-move-to capture with every raw.json checked against its meta.json sha256, not from rounds that ran resizeBy(0, 0) first 2026-12-02 07:12:56 +01:00
feder-cr f0b83b089c tests: the retail window of a twin is sized by the content area of ours plus its frame read in device pixels, and only the inner equality is the hard control
The control was wrong against its source. size_by_content took the retail frame as outerWidth/outerHeight less innerWidth/innerHeight and demanded retail outer == asked. outerWidth and
outerHeight are whole CSS pixels (Firefox nsGlobalWindowOuter::GetOuterSize returns RoundedToInt(GetSize() / CSSToDevScale), nsGlobalWindowOuter.cpp:3573 in the engine tree), innerWidth and
innerHeight are fractional, so the frame read that way is off by up to half a CSS pixel, and a content area of an odd number of device pixels at a scale of 2 (558.5 CSS = 1117 device) has no
outer size that reads back as asked. Candidate 46792115974: linux dpr2.0 asked outer [800, 558.5], answers outer [800, 559] and inner [800, 558.5] = ours; windows dpr1.25 asked [1548.4, 829.2],
answers [1549, 830]; linux dpr1.25 and dpr1.5: the frame from the whole outer less the fractional inner made the retail inner 0.4 and 0.33 CSS smaller than ours (a real mismatch).

RetailSession.set_inner_size reads the window frame in device pixels in one chrome script (nsIBaseWindow.getSize less the content area times the scale) and sets the window to ours' inner
size plus that frame (CONTENT_JS). run_retail_twin keeps the inner equality as the hard control (BROKEN CONTROL when the inner sizes differ); the outer readback is no longer a condition.
Nothing about ours changes. Unit tests: the odd device height at dpr2.0 is not broken when inner is equal, an inner that differs is broken; red on 674ba823, green here.
Unit rows: +6 tests (4564 linux, 4576 windows).
2026-12-02 06:50:50 +01:00
feder-cr b165ac7e90 tests: TEMP evidence, the plant and the page's own read of the getters of the handle test run on retail and on ours, side by side
The control of test_a_client_call_on_a_handle_reads_none_of_the_getters_the_page_planted fails before
any client call on candidate 46792115974 (linux.3, windows.3): properties off the prototype chain
count 1, properties on it count 0. This test runs the same pages and the same plant and read on retail
Firefox 159 (Marionette) and on ours, and saves per property the count, where it is defined before
and after the plant, and a second read, in the evidence folder. It asserts nothing about ours.
It is the second file of the row wrapper.e2e.stock_twin.tooltip (min_tests 5) and a named exclusion of the
whole-suite rows (29).
2026-12-02 06:50:39 +01:00
feder-cr c1c0a84214 tests: a password field of 40 characters is as wide as on retail Windows (the engine masks with U+25CF, not '*'), the retail width extracted from the capture by a script
- test_a_password_field_is_as_wide_as_on_retail_windows_e2e.py: the page of the retail capture, byte for byte (tests/data/password_mask_page.html), read in the product launch (seed 4, scale 1): the scrollWidth of a password field of 40 x "a" in Arial 16px must equal the retail value, on Linux and Windows. Red where the widget layer masks with '*' (249 px against 387 px).
- scripts/extract_retail_password_mask.py writes ci/retail-password-mask.json from the capture (result.json and meta.json, sha256 checked, page sha256 checked); nothing is typed.
- test_the_retail_password_mask_width_is_extracted_from_the_capture_not_typed.py: the extraction on a small sample, known-bad captures refused, the e2e test holds no number (8 unit cases).
- ci/required-suites.json: the e2e in wrapper.e2e.suite.linux.3 (394) and windows.3 (297); the unit file in wrapper.unit.all.linux (4566) and windows (4578).
2026-12-02 06:49:05 +01:00
feder-cr 674ba82359 tests: the login list not open before the click on #user ends, or before the press on #pass, is a broken control, not a finding about ours 2026-12-02 06:32:59 +01:00
feder-cr 7ee01460c3 tests: the login autocomplete case is launched with signon.rememberSignons true, as a default Firefox, since -marionette sets it false, and its failure message prints the pref 2026-12-02 06:32:13 +01:00
feder-cr 476da7c8d0 Merge commit 'eb052e74397795bf8588be1d6e72f8034fb87e06' into e72/r5-wrapper 2026-12-02 06:30:35 +01:00
feder-cr eb052e7439 tests: the fontconfig rules of the host enter through /etc/fonts/local.conf, since the core owns XDG_CONFIG_HOME
The test of the fontconfig rules (E1) injected each launch's rules through $XDG_CONFIG_HOME/fontconfig/fonts.conf and held the precondition that
XDG_CONFIG_HOME reached the engine (/proc/<pid>/environ). The core now points XDG_CONFIG_HOME and XDG_CONFIG_DIRS of the engine at empty folders of
its own, so that route no longer reaches the engine.

Now each launch writes its rules to /etc/fonts/local.conf with sudo (the e2e job runs on ubuntu-24.04 runners with passwordless sudo: e2e.yml
already uses it) and puts the original file back, or removes it if there was none, when the launch ends. The positive control stays: fc-match on
the host, in the environment of the test process, must obey each rule, or the launch fails. The engine-environment precondition is replaced by that
control. Every pixel assertion is unchanged: same launches, canvases, families, sizes and hashes compared with launch 1, plus the system-ui
assertion. Same three tests, same ids.

Why this is not a weakened test: the source of the test changed, not its bar. The test's route (the user's XDG config folder) is no longer a
route a host can use on the new engine, because the core owns that variable; the system-wide file is where a host can still put a rule, and the
test reads the same effect there. The check that the rule is in force in fontconfig itself is kept as the host control, and a rule fontconfig
does not apply still fails the launch.

The row note of ci/required-suites.json and the docstring of the host-files test say how it is now.
2026-12-02 03:25:15 +01:00
feder-cr c8b3b086fa tests: the datalist twin runs in the leg of the dnd twin (a 2-minute leg), so no new leg is needed in the series' gate matrix 2026-12-02 00:59:07 +01:00
feder-cr 5e4adfbcfa tests: a press outside the open list of a datalist ends as on stock Firefox (stock twin, 4 scales, list open asserted in chrome on both) 2026-12-02 00:57:28 +01:00
feder-cr f73432d5ed tests: the timer the client's evaluate starts in the timer-callback frames test is a reviewed stimulus (the callback's stack and caller are what it asserts), debt 0 2026-12-02 00:13:55 +01:00
feder-cr 03dde48c06 tests: a click on the password field under the open login autocomplete list reaches the page and opens no tab
The login list (#PopupAutoComplete) opens by itself on a username field and covers the field below it. Stock Playwright sends the press to the page through it; an engine whose door lets the list take part put the press on its insecure-login warning row, which opens a tab. The e2e opens the list with a click on #user (read from the chrome, so the case cannot pass for nothing), clicks #pass, and asks for the whole click and the focus on #pass and for the number of pages to stay as it was. Three scales; added to linux.2 (460 to 463) and windows.2 (324 to 327).
2026-12-02 00:12:26 +01:00
feder-cr e9d4f95d54 tests: the listeners of the client's evaluate are fired by the page when the test clicks a trigger, not from a timer of the page 2026-12-01 23:51:09 +01:00
feder-cr 728bcbe5d7 tests: print the launcher registry values and the Firefox Launcher event log entries when the first-launch test fails
Diagnostic output only: the assert expressions are unchanged, the evidence is
appended to their messages. It never raises.
2026-12-01 23:19:01 +01:00
feder-cr 633b72bbcf Merge branch 'e72/fontconfig-candidate' of https://github.com/oss-invisible/playwright into e72/r5-wrapper
# Conflicts:
#	ci/required-suites.json
2026-12-01 23:17:20 +01:00
feder-cr 516edfc15c tests: the retail window of the select and tooltip twins gets the content area of ours plus its own frame, not the outer size of ours
Ours is a real window with the frame of a Windows window; the retail reference has the frame of its own system, so the same outer size gave a different content area and both
legs ended BROKEN CONTROL (candidate run 46711902888: Linux outer 1936x1040 -> retail inner 1936x1040 against ours 1920x1032; Windows at 2.0 retail inner 805x561 against ours 800x558.5).
run_retail_twin now asks the outer size of ours, reads the retail frame (outer less inner) and asks ours' inner size plus that frame; a fractional size is set from chrome scope in
device pixels. The inner-equality control and the outer check are unchanged. Unit rows: +8 tests (4528 linux, 4540 windows).
2026-12-01 22:40:20 +01:00
feder-cr a3e647bf2f tests: the page-bytes reference holds Windows 11's Highlight and SelectedItem, rgb(0, 120, 212)
Source: retail capture run 46676225172 (windows-2025 10.0.26100.33828): retail Highlight and SelectedItem rgb(0, 120, 212); GetSysColor(COLOR_HIGHLIGHT) #0078D4; Control Panel Colors Hilight 0 120 212; aero.theme 0XC40078D4. The core declares it since core PR 376.
2026-12-01 22:39:24 +01:00
feder-cr fee389c299 ci: the unit rows count the 30 cases of test_fontconfig_host_files_criterion.py (4529 linux, 4541 windows)
Source: the file's own collected cases (pytest --collect-only: 30), added to the rows of 029eb855 (4499, 4511); candidate run 46711856312 collected 4529 and 4541, the rows had been raised by 25.
2026-12-01 22:39:18 +01:00
feder-cr db40654e73 tests: the popup move/resize test expects what retail reads (inner width 501 after resizeBy(0, 0) at 150%), extracted from four capture rounds, not typed 2026-12-01 22:32:47 +01:00
feder-cr 1c8c1bcbe7 tests: the retail numbers of the maximized-window popup test are extracted from the capture by a script, not typed (outer width at scale 1.5 was 514, retail reads 515) 2026-12-01 22:04:32 +01:00
feder-cr 8805cb8978 tests: the control of the import() case runs from an inline script, so its referrer is the document as the evaluate's 2026-12-01 19:56:59 +01:00
feder-cr 185c386b79 tests: a non-Error thrown by a listener of the client's evaluate and an import() of its code name no location of its world and ask like the page's own 2026-12-01 19:56:05 +01:00
feder-cr bee003ef27 tests: a violation the client's evaluate causes and an error thrown by a listener it registered name no location of the client's world 2026-12-01 19:53:12 +01:00
feder-cr 4ba9c5e4e4 tests: the atoms, sent raw, call nothing of the page's wrapped methods and getters, or are seen with page frames and a null caller only 2026-12-01 19:48:40 +01:00
feder-cr 365f7da7e3 tests: a page function called by the client's evaluate, a timer it starts and a click it makes see only the page's own frames in their stacks, and a thrown error still reaches the client 2026-12-01 19:47:03 +01:00
feder-cr b60a2a89c5 tests: an exposed function reads the getters of its argument as the page's own clone does, and a client call on a handle reads none of the getters the page planted on what each PageAgent block reads 2026-12-01 18:56:42 +01:00
feder-cr 27374a6a8f tests: the page's own Error.prototype message and stack getters are not read when an evaluate throws or rejects, and the client still gets the message 2026-12-01 18:44:17 +01:00
feder-cr d667c6b55d tests: the page's own RegExp and Date Symbol.hasInstance are never called while the client listens to console events, in linux.3 and windows.3 2026-12-01 18:40:49 +01:00
feder-cr 2df8b8f773 tests: the host's fontconfig reaches neither the text pixels nor the screenshot, and no fontconfig file of the host is opened (Linux e2e)
- test_the_host_fontconfig_rules_do_not_reach_the_text_pixels_linux_e2e.py: rules in the user's own fontconfig config (rgba none and bgr, lcdfilter none, embeddedbitmap off, autohint, hintfull without antialias, a strong system-ui prepend) leave the pixel hashes of the opaque and the default canvas, and system-ui's family and widths, as they are with no rule; fc-match proves each rule is in force.
- test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py: with poisoned caches in HOME and XDG_CACHE_HOME, no browser process opens /etc/fonts, a fonts.conf or a fontconfig cache, and the screenshot of a bundled face equals the content's drawing.
- test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py keeps its ids and asserts the 72's engine: no fontconfig cache is written or read. It retires after the 72's release.
2026-12-01 13:14:43 +01:00
feder-cr 029eb855e7 headless: the server API never starts the browser with -headless; headless=True is a real window on the hidden display 2026-12-01 11:43:58 +01:00
feder-cr eed0facf61 headless: INVPW_TRUE_HEADLESS is retired and refused at launch
The product always runs a real browser window on a hidden display. Setting the variable now stops the launch (sync, async and the server) with a clear error, before the network, a display or a browser starts. The true-headless branch of _resolve_headless is gone.
2026-12-01 11:43:57 +01:00
feder-cr 063222b682 tests: screen.left, screen.top, screen.availLeft and screen.availTop read 0 at every scale, on both systems 2026-12-01 11:43:44 +01:00
feder-cr 675ca17161 wrapper: a page or context made with no_viewport=True is not pinned to the declared viewport, as in Playwright; the declared geometry is merged by one helper for the launchers and the served browser, and the engine gets no default viewport for it 2026-12-01 11:43:43 +01:00
feder-cr 7b5a7fd182 tests: the main window with no viewport reads the retail inner and outer sizes at every scale, on both systems 2026-12-01 11:43:43 +01:00
feder-cr 685db8ffb7 tests: a click on a page element under an open notification panel reaches the page (the door must not hit-test an arrow panel); the select rollup file counts three more on each system 2026-12-01 11:07:53 +01:00
feder-cr ca6f2bef5b tests: an e2e test fails when its browser writes that a release went on without its press handled 2026-12-01 11:07:53 +01:00
feder-cr 4ebb18c26a ci: the unit rows count the persona cover's screen-size test (one more on each system) 2026-12-01 10:14:54 +01:00
feder-cr 6017f94910 tests: every fixture whose bytes a test pins is -text, so Windows checks it out byte for byte; a check holds every pinned fixture to it 2026-12-01 10:14:25 +01:00
feder-cr 62d623a816 udp: a command that waits answers from a thread of its own, so four proxied contexts leave the transport workers free 2026-12-01 07:45:59 +01:00
feder-cr e1ef053355 udp: a context proxy being measured holds up no other command of the served browser 2026-12-01 07:15:00 +01:00
feder-cr 2ea8c602e5 udp: one exit cache per served browser, as the core's browser keeps one 2026-12-01 07:13:06 +01:00
feder-cr 3ebc864346 tests: an e2e test fails when its browser writes the expired popupshown wait
A tee in front of the core's reader of the browser output matches the engine's warning line; the conftest installs it for every e2e test and the teardown fails naming the line. The unit rows go up by the five tests of the new file.
2026-12-01 06:09:59 +01:00
feder-cr e5798ba80c tests: a press and a release at once on a select reach the page as retail does, and the contextmenu of a right click follows its release
The select case is the second press of the retail double click with nothing between the press and the release; the suite minimum of the two rows that hold the file goes up by the three scales.
2026-12-01 06:09:46 +01:00
feder-cr f0a2a8d304 popups: a popup the engine did not pin is told no viewport, and the hand reads its window when it plans
page.viewport_size of a popup under the declared default is None, as for a
page whose viewport is not emulated. The size the hand plans inside is read
from the window at the time of use, since a popup can still change size after
its first script. A size the client sets on the popup pins it again.
2026-12-01 06:09:33 +01:00
feder-cr 7cc5a4494a popups: a popup that names no size is left to its own window under the declared viewport, and pinned to one the user chose
The session marks the viewport of its defaults as the core's; a viewport the
user passes replaces it. The server sends the mark to the engine as
isDeclaredDefault of Browser.setDefaultViewport and never to the client. A popup
the engine did not pin tells the client the size its window has.

Tests: unit for the mark, the engine command and the size a popup is told; an
e2e case for a popup with no size under a user viewport. Both are in the suite
rows.
2026-12-01 06:09:33 +01:00
feder-cr 6b5f5c78a0 tests: the webgl ranges are checked as Float32Array of the page's own realm, with DEPTH_RANGE as the control 2026-12-01 06:09:33 +01:00
feder-cr 9437e06399 persona cover: the screen size test reads the formula from the core's screen profile, not from a copy of the taskbar 2026-12-01 05:22:07 +01:00
feder-cr 2d0620e33e persona cover: the screen size in device pixels is derived from the screen dimension
zoom.stealth.screen.device_width and device_height are the panel's work area plus the taskbar
(the core declares the screen as the whole panel and the work area as the screen minus the
taskbar). They were left unclassified, so every recompute of the cover stopped. A test checks
the formula over many seeds and scales.
2026-12-01 05:20:52 +01:00
feder-cr 6aebe0eb15 ci: the crash-record parser of the known-defects judge says it moves to the core, and the list says it is read from main once main holds it
The parser lives in one place next to the core's matcher after S1, fetched by sha, so the series and the wrapper share it. The list of the wrapper under test is read only until the wrapper's main holds the first row; then it comes from main, so a branch cannot excuse its own crash.
2026-12-01 02:45:08 +01:00
feder-cr 039c2e8bdc ci: the wrapper's list of known Mozilla defects holds D31, the FSBroker crash at the exit of a -backgroundtask process of Firefox 159
ci/mozilla-defects.json has the one row seen in run 46539190316 (process
backgroundtask, phase exit, thread FSBroker, the MOZ_CRASH reason, no frames:
the top frames are libc's and an unsymbolized libxul address, which depend on
the runner), for Firefox 159.0 to 159.*. The core's matcher accepts the file
for 159.0 and 159.0.1 and refuses it for 160.0. Four cases check that and that
the A/A judges the core of the real run with this list; the unit suites count
them (4443 on Linux, 4455 on Windows).
2026-12-01 02:36:33 +01:00
feder-cr c4d5ffe903 ci: the cores a browser leaves are judged against the known Mozilla defects with the core's matcher; the A/A reports a matched crash by its D<n> and is not red
scripts/ci_crash_evidence.py: every core the probe finds becomes a crash record
(process from the `Core was generated by` line, with the cut-line rule; thread
from gdb's header or %e of the core's name without its instance number; frames
of the crashing thread; the MOZ_CRASH reason; phase exit or run from the moment
the launch began to close the browser, recorded in the launch entry before the
original close runs). exit_problems judges the cores of a launch whose parent
ended with 0 with the core's main matcher (MOZILLA_DEFECTS_CHECKER, else
fetched once from main by sha) and the wrapper's ci/mozilla-defects.json for the
Version= of the application.ini beside the binary. The judge is closed: no
matcher, no API, no list or no version keeps every core red and says why. A
launch whose parent did not end with 0, a minidump, a core with no record and a
caller that does not say whether its measurements are complete (None) stay red
exactly as before.

scripts/ci_ab_oracle.py: only the A/A control (the two dumps of the published
engine) judges; its measurements are complete when the dump ended with 0 and
every asked visit has its result and no tab died (visits_complete). A matched
crash is a note, printed and kept in diff-a-a.json.

Tests: test_known_mozilla_defects_in_crash_evidence.py (64 cases, the real gdb
text of the FSBroker core and a copy of the matcher with its sha256); both
unit suites count them (4439 on Linux, 4451 on Windows).
2026-12-01 02:35:59 +01:00
feder-cr 73add864d3 tests: a popup with a position and no size opens normal at the stored size, at the retail position, at the four scales
window.open with left=100,top=100 and with left=5000,top=5000 from a maximized
main window whose state is stored: the popup reads the retail inner and outer
sizes and screenX, screenY (Firefox 159 on Windows, measured), in its first
script and at load. The two suite rows holding the file count eight tests more.
2026-12-01 02:04:38 +01:00
feder-cr 49838e1df3 tests: a popup of a maximized main window reads the retail inner, outer and visual viewport sizes for six feature strings at the four scales 2026-12-01 00:55:58 +01:00
feder-cr 66530eadba tests: a stencil mask wider than the stencil bits reads back whole, the four masks after each write on a fresh WebGL1 context 2026-11-30 23:50:35 +01:00
feder-cr 49f9ac900c tests: a press or a wheel with a popup open follows the platform's rollup, no popup outlives its page, the WebGL ranges are Float32Array
A real press, release, double click, right press, wheel turn or item press while a select dropdown, a datalist list or the page context menu is open reaches the page as retail Firefox 159 on Windows measured it, at the scales 1, 1.25 and 1.5, in the top document and in a frame of another site. Closing a page with a dropdown, a context menu or a datalist list open leaves no popup open and no browser element with pointer-events changed. The declared aliased line width and point size ranges are Float32Array of the page. The two new files are in the second whole-e2e rows of each system (447 on Linux, 318 on Windows).
2026-11-30 21:07:32 +01:00
Federico Elia a0d7c627a6 Merge pull request #633 from oss-invisible/ledger/0.61.0
record 0.61.0 as published
2026-11-30 16:52:48 +01:00
feder-cr 704fd5f98c record 0.61.0 as published 2026-11-30 12:28:40 +00:00
Federico Elia 262937350f Merge pull request #632 from oss-invisible/release/0.61.0-firefox-71
release 0.61.0: engine firefox-71, core 71.85.0
2026-11-30 10:01:32 +01:00
feder-cr 50cda456cb release 0.61.0: pins invisible-core 71.85.0 (engine firefox-71), the core release whose proof reads main's retired tests; persona seeds and the gate lock for that core 2026-11-30 02:39:56 +01:00
feder-cr ce913bbf4b release 0.61.0: pins invisible-core 71.84.0 (engine firefox-71); persona seeds and the gate lock for that core 2026-11-30 00:40:08 +01:00
feder-cr a6fe4ea53b release 0.61.0: version and changelog (engine firefox-71, core 71.84.0) 2026-11-29 22:29:07 +01:00
feder-cr 34f02cdcdc ci: the unit suites count the five cases of the drag twin's frame rule (4375 on Linux, 4387 on Windows) 2026-11-29 22:02:46 +01:00
feder-cr a3ff6087f1 tests: the move with a button down starts outside the context menu that the right click left open
Juggler closes a menu on a press only, as the platform does, so the context menu of "frame right click" is still open at the next action. Its first move, to (300, 200), lay over the menu and the page never saw it, on retail or on ours. The points of "move with button down" are now left of and above the right click's point, inside the iframe and on its button; the press of the action closes the menu. The expected event list is unchanged.
2026-11-29 19:59:52 +01:00
feder-cr d7b0cb8638 tests: the dropdown test waits for the trusted mouseup and click that the page gets after a release the parent handled alone
A release that the parent handles in chrome (the select dropdown is open) is answered without the content ack. On retail the page then gets a trusted mouseup and click on the select, dispatched by SelectChild after the parent's Forms:MouseUp, asynchronously. The pages of the stays-open test record both on the select, and the test waits for them in the page's own log with the deadline of the file (never assuming they arrived when the call returned), in the top document and in the frame of another site. What the tests already assert is unchanged. The negative control (popup hidden between the press and the release) does not wait for them.
2026-11-29 19:59:52 +01:00
feder-cr 66a682cfe6 tests: the back-forward cache bench leaves the page when the frame's report request is over, not when the server has recorded it
The frame page /shown sent its pageshow report with a fetch, and the test left the top as soon as the server had recorded the report. The response was still on its way, the fetch was still in the frame's load group, and Firefox refuses the back-forward cache for a page left with a request in flight (BFCacheStatus::REQUEST, CanonicalBrowsingContext::AllowedInBFCache): both reports came with persisted=false. Stock Firefox does the same, and the product never promised the cache for a page left like that.

The page keeps the request in window.__sent; the test waits in the frame until it settles (the request is over, so the frame's load group is empty), then leaves. The sequence is a helper with the condition to leave on ("finished" or "recorded"). The server fixture gets a knob that holds the first pageshow response for 2 s after recording it, and a new e2e runs the sequence with the knob on: the old sequence (leave on "recorded") with the knob is the red case, which runs on the candidate; the new one is green.

e2e rows: wrapper.e2e.suite.linux.2 419 to 420 and wrapper.e2e.suite.windows.3 276 to 277 (+1 each).
2026-11-29 19:59:23 +01:00
feder-cr 1717c2063c tests: the drag twin declares the top's leave into an in-process frame and the dropEffect of the frame drop
In the drop in a frame of another site, two fields of the top document depend on stock's frame
being in its own process model: the top's dragleave whose element under the cursor is the frame
(stock's event manager fires a leave at the body when the cursor enters the subdocument; retail
with the frame out of process and ours have none), and the dropEffect of the top dragend (the
frame's drop result, which crosses processes). Before the comparison they leave top.once for
top.into_frame and top.dragend_effect, both declared IN_PROCESS_FRAME, so the event lists line up
and the rest of the top is still compared. In the drop in the top document the record is compared
whole, dragend's effect included. split, compare, recorded and verdict take the kind of the drop.

The frame page of the twin was served raw with height:100%%, an invalid length, so body had height
0 and the twin read html where retail reads body; it is height:100% now.

The unit test of the twin gets the leave under the frame in its frame fixture, a case with stock
leave and copy against ours without it and move (green, recorded as declared), and the same
dragend effect difference in the top drop (red).
2026-11-29 19:56:25 +01:00
feder-cr 5ea88e57d5 tests: a select dropdown stays open after the release, and a context menu closes on the next press with no input call hanging
Menus are closed by the platform on a press outside them and on the wheel (nsWindow::DealWithPopups), not on a release or a move. Per place (select of the top document, select of a frame of another site): press, wait for the popup to be open, release, and the state read over the next second must be open at every look; a chrome hidePopup between the press and the release is the negative control and must read closed. The pages and reads are those of the select twin, imported.

One more e2e for the case an unguarded call in the input path was there for: a chrome context menu that captures the mouse. A right click opens the chrome context menu, then moves across the page, a left click elsewhere and a move again must each return (each duration is in the message of a failure), and the menu is closed after the press of that click.

Red on an engine whose input closes menus on a release or a move: the dropdown reads closed after the button went up. e2e rows: wrapper.e2e.suite.linux.2 414 to 419 and wrapper.e2e.suite.windows.2 286 to 291 (+5 each).
2026-11-29 16:47:15 +01:00
feder-cr b7ef739d56 tests: the intersection twin does not compare the box of a frame that is fully out of view with stock
In Mozilla's code a fission frame scrolled fully out of view reads an empty boundingClientRect: DOMIntersectionObserver.cpp 792-794 returns early when there is no in-process root frame, after the transform chain HitTestingTreeNode.cpp 298-328, BrowserChild.cpp 3751-3778 and UnitTransforms.h 343-351; Mozilla's own web-platform meta (cross-origin-iframe.sub.html.ini) marks that step FAIL under fission. Stock's frame is in-process, so it reads the rectangle. The declared list of the twin now has the box of the steps all above and all below (in-process frame in stock); the box of the steps where the frame is in view and every other field stay compared, and the retail capture decides the declared ones.

Red on the old list: the declared-list test and the two out-of-view tests fail with nothing declared. unit.all rows: +13 (Linux 4370, Windows 4382).
2026-11-29 16:39:04 +01:00
feder-cr 23548f5822 tests: the select twin records the window's activation and focus at the click
For each select the record now has, before the click and right after it: chrome Services.focus.activeWindow === win, win.document.hasFocus(), the browsing context's isActive (win.gBrowser.selectedBrowser.browsingContext.isActive), the top content document's hasFocus() and visibilityState, and the driver's ack of the click when it keeps one. A popup that does not open for a window that was not active is then told apart from a popup at the wrong place. A read that fails is recorded and never raised.

Red on the old code: the six new tests and the existing ones that use the fake chrome fail without the read. unit.all rows: +6 (Linux 4357, Windows 4369).
2026-11-29 16:27:40 +01:00
feder-cr 5f58bdf808 tests: a field that depends on stock's frame being in-process is recorded, not compared with stock
Stock Playwright's Firefox sets fission.webContentIsolationStrategy=0, so its cross-site frame shares the top's process, and its drag is Juggler's synthetic one (no OLE loop). A field that depends on either is not what stock reads, and the retail capture decides it.

_stock_twin.split_differences splits the differences of a twin by a declared list per twin (a pattern of canonical paths and one of two reasons: in-process frame in stock, synthetic drag in stock); a declared field that differs is recorded (recorded_differences in the report) and a field that is not declared and differs is red.

The drag twin declares the buttons, drag at the source (count and presence), the dragend point less the last drag, and in the frame effectAllowed, dropEffect and mozSourceNode; routing, targets, client points, rel, types, trusted, the input source and the effects of the top document stay compared. The intersection twin has the list and declares nothing yet (moving boundingClientRect is one line).

Red on the old code: the new tests fail at their import of the declared list and of split_differences. unit.all rows: +43 (Linux 4351, Windows 4363).
2026-11-29 16:26:35 +01:00
feder-cr e0273aac56 tests: the retail driver's synthesized input reaches a frame in another process
SEND_JS called Window.synthesizeMouseEvent without isAsyncEnabled. With the webidl default (false) the event goes through widget->DispatchEvent and never through APZ (nsContentUtils.cpp 10552-10560 at FIREFOX_159_0_RELEASE), has no layers id, and EventStateManager::DispatchCrossProcessEvent falls back to the top process (EventStateManager.cpp 2199): a frame in another process never got the move or the click. The options now carry isAsyncEnabled: true, Mozilla's own mechanism (EventUtils.js asyncEnabled).

A static check reads every synthesize call of code that runs on retail or stock Firefox and is red when its options literal lacks isAsyncEnabled: true. Red on the old SEND_JS (two tests of the file), green on the new.
2026-11-29 16:22:44 +01:00
feder-cr 622f0d3eaf tests: the drag twin records every drag event the page reads, for a drop in a frame and for a drop in the top document
The twin of the drag kept a few numbers (the count of dragstart, the drop target and the client
point of the drop, the end point less the last drag point) and only for a drop in a frame of another
site. A dragenter at the wrong element, an empty dataTransfer, a dropEffect of none or an untrusted
event read as the same as stock's, and a drop in the top document was not covered at all.

Now both pages keep every event they hear (dragstart and drag at the source; dragenter, dragover,
dragleave and drop where the drag goes; dragend at the source) with its type, target id, the id of
the element under the cursor, client and screen points, buttons, mozInputSource,
dataTransfer.types, effectAllowed, dropEffect, mozUserCancelled, whether mozSourceNode is null and
isTrusted, plus the count of drag events at the source and the dragend point. The same test does
the drag twice on a fresh page, once ending in the frame and once in the top document, on stock
and on ours, and the verdict prints both records whole.

Ours is compared with stock exactly in every field that is the same on every machine; in one CSS
pixel in a client point (the tolerance the drop point already had); and through the relation of the
screen point to the client point, because screenX/Y is where the window stands (real on stock,
declared on ours). The counts of dragover and of drag events are recorded and not compared: retail
fires both from a timer (OLE calls DragOver periodically, and nsNativeDragTarget fires drag at the
source each time). What is compared is that drag fired at the source at least once on both sides.

Regression test (54 tests, no browser, fake pages): red on the old files (the module of the record
does not exist and the old twin has no DROPS or recorder), and red on each mutation of the
comparison. In the two unit rows: 4250 -> 4304 on Linux, 4262 -> 4316 on Windows (collect-only on
the row's files). The e2e row keeps its 4 tests.
2026-11-29 14:16:39 +01:00
feder-cr e0e620e8d5 tests: a select twin that fails says where it clicked and what the geometry was, and every case leaves its numbers
The steps of the select twin said "the dropdown did not open after a click on the select of the
frame document" and nothing about the click, so a red case at one display scale could not be told
from a wrong point, a wrong scale or a window that moved. Now, for each select, every failure of the
steps carries: the click point (CSS, and the point the driver sent with its unit and its device
point), the scales record, the select's box in its own document and the frame element's box in the
top document, mozInnerScreenX/Y of the top and of the frame, and the popup's state after the click,
at the deadline and at a second look. The verdict of the twin prints both browsers' records whole.
The same record is written for every case, red or green, to
$RUNNER_TEMP/invpw-evidence/popup-diagnostics/<case>-<browser>.json, the folder the jobs upload, so
a green run leaves the numbers to compare with a red one. A read of the diagnosis that fails is
recorded in the record and never replaces the finding.

The drivers keep the point they sent (last_click), and the retail driver reads a frame through
Marionette and is back in the top document when the read ends or fails.

Regression test (13 tests, no browser, a fake driver): red on the old files (11 of the 13 fail on
the old steps and drivers, the module of the record does not exist). In the two unit rows: 4237 ->
4250 on Linux, 4249 -> 4262 on Windows (collect-only on the row's files, not OS-specific).
2026-11-29 11:09:11 +01:00
feder-cr a7f84eded4 tests: the intersection twin routes the page of its frame again, and a check reads every page a test asks the fake sites for
The frame of the intersection twin is sites.url("B", "/io") and nothing routed B /io: the route was
dropped in an earlier commit and _register did not get it back. The fake sites answer an unrouted
path with a 404 and an empty body, so the frame had no #t and IntersectionObserver.observe threw.
_register routes B /io (FRAME_IO, which was defined and unused) again.

Regression test (9 tests, no browser): in every test module that builds Sites(), each
X.url(site, path) and each wait_frame/frame_of that names a site and a path has an X.route for it
in the same module; a computed part of a path is a wildcard on both sides; one exemption (the
expected scope of a service worker, compared and never requested) is listed with its reason and is
itself red when no call uses it any more. Red on the old file: the module without the route reads
B /io asked and not routed (two lines: the page of A and the frame lookup), and a snippet of the same
shape; green with the route. In the two unit rows: 4228 -> 4237 on Linux, 4240 -> 4249 on Windows
(collect-only on the row's files: 4240 before, 4249 after).
2026-11-29 11:01:13 +01:00
feder-cr 06c2428572 tests: the retail twin sends its input with Window.synthesizeMouseEvent, and a check reads every chrome call against Mozilla's sources
The four cases of wrapper.e2e.stock_twin.tooltip died on the engine candidate with "win.windowUtils.sendMouseEvent is not a function": Firefox 159 has no
nsIDOMWindowUtils.sendMouseEvent, its chrome input is Window.synthesizeMouseEvent. SEND_JS of the retail reference now calls
win.synthesizeMouseEvent(type, x, y, {button, clickCount, modifiers, inputSource}, {ignoreRootScrollFrame, isDOMEventSynthesized}), with Mozilla's own field names
and the same offsets (CSS pixels of the browser window).

Static check, no browser: scripts/extract_mozilla_chrome_api.py reads nsIDOMWindowUtils.idl and Window.webidl at the release tag into ci/mozilla-chrome-api.json
(path, tag, commit and sha256 of each source; what only our engine tree has is listed apart under "ours"). tests/test_the_chrome_calls_of_the_tests_exist_in_firefox.py
scans the strings of every test and script for windowUtils.<name>, .synthesize<...>( and the keys of the dictionaries those calls pass: a name that no Firefox
has is red, a name only our engine has is red in code that runs on retail or stock Firefox. Red on the old SEND_JS (sendMouseEvent is not in 159), green on this
one. The extractor has its own unit test on a small IDL and WebIDL sample.

Both files join wrapper.unit.all.linux and wrapper.unit.all.windows, min_tests raised by 18 each (12 + 6).
2026-11-29 10:40:14 +01:00
feder-cr 3e082e07d7 tests: the stack watchdog's log lands in the evidence folder that every job uploads
INVPW_TEST_WATCHDOG_FILE is set only by the wrapper's own e2e workflow, so a run of the gate
wrote the stacks of a hung test to the temporary folder, which nothing uploads, and they were
gone with the runner. With RUNNER_TEMP set and no file named, the log is now
$RUNNER_TEMP/invpw-evidence/watchdog/e2e-watchdog.log, inside the folder the gate keeps as
"what the tests saved"; a named file still wins, and off a runner nothing changes.

Regression test (5 tests, red on the old files: the module does not exist and conftest.py
opens the temporary folder). In the two unit rows: 4205 -> 4210 on Linux, 4217 -> 4222 on
Windows (not OS-specific).
2026-11-29 08:59:28 +01:00
feder-cr 3366497f7d tests: the twins open their page before they ask Marionette for a session
The wrapper launches the engine with -silent, so there is no window at start-up, and
Marionette's WebDriver:NewSession is answered only when the browser's start-up ends, which
only a window ends. run_retail_twin and _on_ours created Chrome() before browser.new_page(),
so the session never got its answer and the socket timed out after 300 s (every retail twin
and every stock twin of the engine candidate).

Chrome now takes the page of the launch as a required argument, so the wrong order cannot be
written, and both twins open the page first. scales() reads that page.

Regression test (red on the old files, 4 of 9 fail): an ast scan of every test and script
refuses a function that asks for a session before its first new_page; the scan is itself
proved on the old order; a fake Marionette that answers NewSession only once a window exists
shows _on_ours and run_retail_twin get their answer. In the two unit rows: 4196 -> 4205 on
Linux, 4208 -> 4217 on Windows (9 tests, not OS-specific).
2026-11-29 08:59:28 +01:00
feder-cr aaf5863598 ci: the host oracle takes each side's own install folder as that side's own package, and the row of the graphics probe is out of the file
Engine final candidate (run 46227711139), ab_host on Linux, two defects of the harness:

1. DIFF on invisible_core/branding/official/branding.zip: <published set venv>/site-packages/... on the published side, <hostedtoolcache python>/site-packages/... on the candidate's.
   Each side's engine reads the branding of ITS OWN core, in the folder that core is installed in, and since the control side is the published set (0b23228e) the two folders
   differ. The classifier knew one own package, the folder of the engine. It now also knows the install folders of the python that runs the side (ci_ab_host.install_folders:
   sysconfig's purelib and platlib, the link and the real folder; the side's launch runs in that side's python), in the same class `package`, so the same read is the same
   file of the package on both sides and no path is named. Anything else stays the host's and red: the other side's folder, the python's own library under the same prefix,
   a sibling folder that only starts with the same text, any path declared nowhere.
2. FAIL the declared difference 'gfxtest-69' ... is stale, remove it: the published engine is the 70, which no longer spawns gfxtest either. ci/ab-host-expected.json declares nothing.
   The mechanism of a declared `proc` difference is tested with the row as a row of the tests' own (tests/_ab_host_declared.py), and a test takes the run's case as data: a row that
   does not show is red as stale, in the wording of the run, and the same run is green against the empty file.

tests/test_ab_host.py (+10, 9 of them red on the old classifier): the pair of the run is the same package on both sides and no difference; each of five reads outside a side's own
install folder is a difference; the install folders of a process; the stale row. tests/test_ab_oracle.py: the new helper is one of the host oracle's files for a pull request.
wrapper.unit.all.linux 4196 and wrapper.unit.all.windows 4208 (+11).
2026-11-29 08:59:28 +01:00
feder-cr dfd35bb47e ci: the page oracle's A/B allows the differences a release is known to make, declared per os, seed, dpr and leaf, and is red on a row that does not show
Engine final candidate (run 46227711139): ab_oracle was red on Linux and Windows on the same 24 differences, all of them the bar of a main window above the content.
Seed 6 at 1.25: the bar is 106 device px as retail Firefox 159 measures it, the published engine's core said 107; the candidate's core rounds the bar once on the sum in app units
(window_frame.chrome_height_device). Seed 63 at 1.5: the work area is under 720 CSS px, so retail chooses the compact density by itself (browser.js gUIDensity) and the bar is
73 CSS px, not the normal 85 (constants.ui_density, window_frame.chrome_height_device(1.5, 'compact')).

- ci/ab-oracle-expected.json (ab-oracle-expected/1): 48 rows, one per os x seed x leaf of those 24 (Linux and Windows read the same), each with exactly id, os, seed, dpr, leaf,
  published, candidate and reason (the retail source, the core function that produces the value, what the leaf is).
- scripts/ci_ab_oracle.py: the A/B (run, run_ab, compare) allows a difference only when a row matches it exactly (os of the leg, seed, dpr, leaf and both values); any other
  difference is red, and so is a row that does not show in the run (stale: "remove it", the wording of the host oracle). The rows apply to the A/B only: the A/A is judged without
  them. A row of a visit the run did not make (another shard or seed set) is not judged. The rows name no tag: when the published set moves to the release that holds the work, the two
  sides agree, every row is stale and the check forces them out. compare takes --leg (default: this machine's).
- tests/test_ab_oracle_declared_differences.py (16, red on the old judge) with the 24 DIFF lines of the run as data: the old judge is red on them and the new one green with the
  rows; an undeclared extra difference, another value than the row's, another seed, dpr or os, are red; a stale row is red; the A/A ignores the rows; the file's keys and rows.
  tests/test_ab_oracle.py: the fake pages of its tests have no rows (a fixture), the leg of one test is a real leg, and the file of the rows is one of the oracle's files for a pull request.
- wrapper.unit.all.linux 4185 and wrapper.unit.all.windows 4197 (+17: the 16 tests and the case of the new file in the oracle's pull-request file list).
2026-11-29 08:48:49 +01:00
feder-cr 76c33a9e0a tests: the stock browser and the retail reference of the twins get a display from the wrapper's mechanism
The engine gate runs the stock twin rows' pytest without xvfb-run (only wrapper.e2e.suite.* rows get it), and the docstrings said the browsers drew on "the display of the job".
Ours gets a display of its own from the wrapper (make_virtual_display, started per session), so ours drew and stock and retail died on Linux with
"no DISPLAY environment variable specified" (wrapper.e2e.stock_twin.intersection, all four cases).

_stock_twin.OwnDisplay starts the core's make_virtual_display() on Linux (1920x1080x24 Xvfb, access control on), one per launch, and gives the browser's environment its
DISPLAY and XAUTHORITY (the Wayland variables removed), stopped after the browser, also when the launch fails. Stock gets it through the env of p.firefox.launch, the retail
reference through its Popen env. On Windows nothing is made: a stock client cannot be spawned on another desktop. The docstrings of _stock_twin, _retail_reference and the
select and tooltip twins say what is true.

test_the_stock_and_retail_browsers_get_a_display_from_the_wrapper.py (4 tests, red on the old code) is in wrapper.unit.all.linux and wrapper.unit.all.windows, min_tests +4 each.
_fake_stock_playwright.py is the recorder both unit files of the stock twin share.

The exact counts of the two unit rows are corrected by 2: since the published-set commit the two rows were 2 below the real collect (the new published-set.yml workflow adds one case to
test_ci_linux_legs_read_no_mirror.py and one to test_ci_windows_temp_is_on_d.py, which are parametrized by workflow file, and that commit counted only the 36 tests of its own file).
wrapper.unit.all.linux is 4168 and wrapper.unit.all.windows is 4180, as the run of the engine's final candidate collected (4160 and 4172) plus the 8 of the two commits above.
2026-11-29 07:44:35 +01:00
feder-cr ce6db02d36 tests: the stock twins get layout.css.devPixelsPerPx as the string ours gets
The pref is a string pref of Firefox. The stock client sends user prefs through Browser.enable and Playwright's Juggler sets a number with setIntPref, so
the float of the case failed every stock twin launch on Windows with NS_ERROR_UNEXPECTED [nsIPrefBranch.setIntPref], a broken control on all four cases.
Stock now gets the scale from _window_origin.scale_pref, the form the core declares for ours (str(profile.screen.dpr)).

test_the_stock_twin_gets_the_display_scale_as_ours_does.py records the stock launch and compares it with ours composed by the core for each of the four cases
(4 tests, red on the number the old code passed); it is in wrapper.unit.all.linux and wrapper.unit.all.windows, min_tests +4 each.
2026-11-29 07:32:38 +01:00
feder-cr a1711b9802 ci: the published set is installed from published/ only, by hash, checked with pip check, and verify names the file installed
The wheelhouse's own folder holds the candidate's wheels of invisible-core and invisible-playwright,
built from core_ref and wrapper_ref; at an equal version they have the file names of the published
ones. With real pip, two --find-links and --require-hashes take the first local file of a name and
fail on a hash mismatch, they do not choose by hash.

- install: the gate lock's dependencies from the wheelhouse, then the two published wheels from
  <house>/published ONLY (one --find-links per pip call, --no-deps, by the hashes of
  ci/py-lock/published.txt), then pip check over the venv with the set's python: red, with what pip
  reports, when a requirement of the published wheels is not met. The wheel of each package is
  chosen by the sha256 the lock holds (a file with the name and another hash is refused, naming both)
  and recorded with the digest of its package files in <venv>/published-set.json.
- verify: reads that record and the disk. It names the file installed (wheel name, sha256), is red
  when that sha256 is not one the lock holds (naming both), and when a file of the package on disk is
  not, byte for byte, the wheel's. A version says nothing of which file is installed.
- tests (real pip, offline, wheels made with zipfile): the same name and version in the house root
  (the candidate's) and in published/ installs the published one and verify is green; a venv holding
  the candidate's wheels is red naming the file, its sha256 and the lock's; a record that says
  published over candidate bytes is red; a lock naming neither is red; a published wheel requiring
  what the house lacks is red at pip check, the normal house green. 42 tests in the file (+6), the
  rows of the whole unit suite raised by 6.

Red on the old install: the real-pip same-name test fails with pip's "THESE PACKAGES DO NOT MATCH
THE HASHES FROM THE REQUIREMENTS FILE" on the candidate's wheel of the same name (8 of the 42 fail
on the previous script).
2026-11-29 05:52:46 +01:00
feder-cr c4dbbe8faf ci: the stock twin row is four rows, one file and one leg each
The row wrapper.e2e.stock_twin (4 files, 20 tests) ran past the 25 minutes of a leg. It is now wrapper.e2e.stock_twin.dnd (4 tests),
.select (4), .tooltip (4) and .intersection (8), each with the file, the marker, the systems and stock_firefox of the old row, and the old note split by file.
The table of leg fields, the accounting of the e2e suite and the retail reference's messages name the new rows.
2026-11-29 03:54:02 +01:00
feder-cr b916990a33 e2e: a popup moved to the far right stops where retail's does, the capture's numbers per case
The phase ran moveBy(10, 10) and moveTo(99999, 0) in one popup and expected availLeft + availWidth - outerWidth, which is not retail's clamp:
Mozilla's CheckSecurityLeftAndTop uses the outer width rounded by its edges (CSSIntRect::Round), then the device rounding and the read-back.
The phase now runs the sequence of the retail capture (popup_move_resize, retail-window-geometry, Firefox 159.0) and expects the screenX and screenY
retail read after each call, per case, with the derivation for scale 1.25 written next to the table.
2026-11-29 03:50:11 +01:00
feder-cr 0b23228eb8 ci: the control side of every A/B oracle is the published set, as a user installs it
Engine candidate 5 (run 46208549074): ab_oracle, ab_network and ab_host were all red on a BROKEN
CONTROL. The published engine (labelled firefox-68, a tag written in the harness, when firefox-70
was the last published) was launched by the CANDIDATE's core, which no longer declares
zoom.stealth.screen.popup_position, and the engine refuses a launch whose declarations its core does
not emit (rule 7). A pairing no user has.

The control is now the set a user gets: the last invisible-playwright on the index, the
invisible-core it pins exactly, the engine that core's seal pins, in a venv of their own.

- ci/py-lock/published.txt: the set as a hash lock (every file of the two versions, the requirements
  each declares); scripts/ci_published_set.py makes it (resolve), compares it with the index (check),
  installs it offline over the gate's lock from the run's wheelhouse (install) and verifies what the
  venv imports (verify); fetch/tag run BY the set's python: its own core fetches its own engine.
- .github/workflows/published-set.yml: daily and on a pull request that touches the lock, red when
  the committed lock is not the index's last release.
- ci_ab_oracle, ci_ab_host, ci_ab_network: the published side runs in the set's python
  (INVPW_PUBLISHED_PYTHON) with an environment that carries nothing of the candidate's job
  (PYTHONPATH, VIRTUAL_ENV, its seal, its pin switches); the candidate side is unchanged. No tag is
  written in a harness file: the label and the file names (dump-<N>.json, ...) come from the seal of
  the set. A candidate without a set is refused, never run against its own core.
- ci_poison_host: the by-product files are named for the tag of the set as well.
- tests/test_ci_published_set.py (36, in wrapper.unit.all.linux and .windows): the defect on fake
  cores and a fake engine that refuses as rule 7 (red on the old harness with that refusal), the
  three seams, the lock on known-bad inputs, the resolver on synthetic index documents, the install
  commands, no tag written in a harness file.

Red on the old harness: the defect test fails with "stealth: zoom.stealth.screen.popup_position is
not declared by the core candidate-core (rule 7)" on the scripts of df491f2e. The regression
registry of the wrapper is not on this base: its row follows with the registry.
2026-11-29 03:40:21 +01:00
feder-cr df491f2e67 Merge commit '8e342a1378e9da0a8e6340411f42dbe66c39a5ed' into candidate/wrapper-71-final 2026-11-29 01:48:12 +01:00
feder-cr 8e342a1378 tests: the e2e stack watchdog holds the GIL (a Python thread), not faulthandler's dump_traceback_later, whose GIL-free copy of every thread's frames crashed the Windows part 3 worker
Five workers of the Windows part 3 of the e2e died, all on tests/test_fakeweb_p4_e2e.py::test_the_journey_leaves_every_page_only_once_its_noise_is_done, which runs 122-171 s with about 50 threads. tests/conftest.py armed faulthandler.dump_traceback_later(150 s, repeat=True) for every e2e test: a C thread that copies the frames of every thread WITHOUT the GIL (_Py_DumpTracebackThreads, documented "for debug purpose only ... after a segmentation fault, at fatal error") while the process keeps running and the other threads keep changing their frames. Two full dumps of a crashed worker show the process dead inside dump_frame, called from faulthandler_thread, reading a frame another thread was changing.

tests/_stack_watchdog.py is the same watchdog as a Python daemon thread: one per process, reused by every test; arm(nodeid, threshold_s, period_s, file) and cancel(); past the threshold, and then every period until cancelled, it writes "Timeout (h:mm:ss)!" and the frames of every thread (sys._current_frames(), holding the GIL, threads named from threading.enumerate()) to the same e2e-watchdog.log, in the format of faulthandler's dump; nothing to stdout or stderr; nothing after cancel() returns. Known limit, in the module: a thread that never releases the GIL keeps it from writing, which is pytest's faulthandler.enable() at the death of the process. tests/conftest.py calls it in place of dump_traceback_later and cancel_dump_traceback_later (setup, teardown, unconfigure).

Tests (all in the rows of wrapper.unit.all.linux and wrapper.unit.all.windows, min_tests 4061 -> 4116 and 4073 -> 4128, counted with the selector of the judge):
- tests/test_no_file_arms_a_gil_free_thread_dump.py: no .py of tests/, scripts/ or src/ calls faulthandler.dump_traceback_later, or dump_traceback with all_threads true or defaulted (ast, through any import form); pytest's faulthandler_timeout is set in no pyproject, pytest.ini, setup.cfg, tox.ini, conftest string, script string or workflow line (parsers, not text). Red on the conftest of 03425bb8, naming tests/conftest.py and the line, with how to fix and the rule; each form has its known-bad and its green twin. The only exclusion is norecursedirs of pyproject.toml.
- tests/test_the_stack_watchdog_writes_every_thread_after_its_threshold.py: in a child python, a blocked call gets the header and the stack of every thread, a test cancelled before its threshold leaves no dump, nothing is written after cancel (judged on the bytes of the file, waiting on the second test's first dump), the second test reuses the thread.
- tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py: 32 threads churning frames; dump_traceback_later at 1 ms ends the child with a crash status (red on the old mechanism), the new watchdog at a 1 ms period lets it run 6 s (60 times longer) and writes its dumps.
2026-11-29 01:20:27 +01:00
feder-cr 03425bb898 ci: every pytest process of a Windows e2e job clears SEM_NOGPFAULTERRORBOX, so a crashing worker reaches the LocalDumps
#629 sets WER LocalDumps for python.exe in each Windows e2e job, and a crashing pytest-xdist worker still left no dump. The pytest controllers of the runner are born with the
error mode 0x0003 (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX), every child inherits the mode of its parent, and a process with SEM_NOGPFAULTERRORBOX (0x0002) never
invokes Windows Error Reporting, so no worker crash reached LocalDumps.
https://learn.microsoft.com/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode

The "Windows Error Reporting keeps a full dump..." step of each Windows job now also exports INVPW_WER_DUMPS=<the dumps folder> to $GITHUB_ENV. tests/conftest.py calls
tests/_wer_error_mode.py in pytest_configure (the controller and every xdist worker run it): when that variable names an existing folder on Windows, the process clears bit
0x0002 of its error mode and keeps the others, and appends "pid <n> error mode born 0x.., now 0x.." to invpw-evidence/dumps/error-mode.log. Nothing is written to stdout or
stderr, and nothing happens on Linux or in a job that did not set LocalDumps.

Tests: the rule test of the Windows jobs (tests/test_every_windows_job_keeps_a_dump_of_a_crashing_python.py) now requires the export in the LocalDumps step of every Windows
job, with the folder of DumpFolder and no other place that sets it (red on the previous e2e.yml, naming the job); a real child python born with 0x0003 (and 0x8003, 0x0002,
0x0001, 0x0000) ends with the born mode minus 0x0002 and leaves its evidence line, and without the variable or with a missing folder the mode is unchanged
(tests/test_every_pytest_process_clears_the_gp_fault_error_box_on_windows.py, a Windows file: only the row of Windows names it, min_tests 4061 on Linux, 4073 on Windows).
2026-11-29 00:34:35 +01:00
feder-cr 67b2ad3188 tests: the table of the leg fields carries the stock_firefox of the row wrapper.e2e.stock_twin, which the gate reads 2026-11-28 22:30:13 +01:00
feder-cr fe50cdc118 e2e: the retail reference gets the outer size of ours before anything is measured and both inner sizes are compared (a difference is a broken control); the launcher and the messages cover the Linux binary (firefox, no .exe, the job's display) 2026-11-28 21:52:21 +01:00
feder-cr e4aa743af3 e2e: the select dropdown and the tooltip are measured against RETAIL Firefox 159 driven by Marionette alone, headed (tests/_retail_reference.py, INVPW_RETAIL_FIREFOX set by the leg), not against Playwright's own Firefox; the tooltip joins the row wrapper.e2e.stock_twin (20 tests) and its rule is a cross-check in the record 2026-11-28 21:41:56 +01:00
feder-cr 5298149cd0 e2e: the stock twin runs headed, in the mode of ours (a real window on the display of the job), not in Firefox's headless mode 2026-11-28 21:36:40 +01:00
feder-cr 9140845e4d e2e: the select, drag and IntersectionObserver/lazy-frame tests are stock twins (the same steps on Playwright's own Firefox first, ours second, the verdict is the same as stock), in the new row wrapper.e2e.stock_twin (stock_firefox) and out of the whole-suite rows; each record keeps the page's and the chrome's devicePixelRatio and the real screen scale 2026-11-28 21:35:33 +01:00
feder-cr cb67c18332 e2e: a popup's position is Firefox's own rule (retail round 5: 4, 4 at scale 1.0), no popup_position pref is set; the second popup's stagger waits for capture round 8 2026-11-28 21:35:33 +01:00
feder-cr 652c911514 persona_cover: popup_client_top is a pref of the dpr dimension, the ui_normal and ui_compact rows of DERIVED go (no core writes them), persona-seeds.json regenerated with the core of c58efd7 2026-11-28 21:28:31 +01:00
feder-cr 229cfb7da2 Merge remote-tracking branch 'origin/main' into e2e/oop-frame-71
# Conflicts:
#	ci/required-suites.json
2026-11-28 20:47:26 +01:00
feder-cr 3259840c7c e2e: the tooltip's vertical offset is computed by Firefox's own rule (kDefaultTooltipOffset scaled by the system cursor size on Windows), not typed as 21 2026-11-28 19:56:28 +01:00
feder-cr c39a976a44 e2e: a tooltip opens at the real pointer, in the top document and in a frame of another site, at the four scales (red without the tooltip map), in the rows of the maximized-window test 2026-11-28 19:54:44 +01:00
Federico Elia df35204915 Merge pull request #629 from oss-invisible/ci/windows-worker-dumps
ci: every Windows e2e job leaves a full dump of a crashing python.exe in its evidence
2026-11-28 19:06:47 +01:00
feder-cr de9c19b578 ci: every Windows e2e job leaves a full dump of a crashing python.exe in its evidence
A pytest-xdist worker (python.exe) dies on the Windows e2e jobs with "node down: Not properly terminated" (a native "Windows fatal exception: access violation",
jobs 138402013609 and 138966622085) and nothing names the faulting native module. Each of the six Windows jobs that run pytest now sets, before its tests,
HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\python.exe (DumpType 2 = full, DumpCount 3, DumpFolder RUNNER_TEMP/invpw-evidence/dumps/python,
WER made enabled, no dialog), so the dump travels in the evidence artifact the job already uploads (the Control+A job gets that upload). After the tests
scripts/ci_wer_dumps.py lists the dumps with their size and reads the minidump header (thread, exception code, faulting module+offset, failed access) into summary.txt.
Docs: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps

Tests: the Windows jobs' rule test (red on the previous e2e.yml) and the reader on a synthetic minidump.
2026-11-28 18:39:32 +01:00
feder-cr 678978399c e2e: three new test files stored with LF, as the index of the repository has them (they were committed with CRLF) 2026-11-28 02:40:48 +01:00
feder-cr 310b88e81d e2e: the input test takes no tolerance: clientX/clientY of every click, hover, drag and wheel equal the requested whole CSS point exactly, and the message prints the requested point, the received one and the scale 2026-11-28 02:40:28 +01:00
feder-cr 6f84d62290 e2e: a page cannot reach the three chrome-only methods of the window-origin map (window, document, reachable objects, prototype chains, CanonicalBrowsingContext), in the rows of the maximized-window test 2026-11-28 02:40:28 +01:00
feder-cr eb2629fea1 e2e: the consumers of the window origin (early readings of a frame, popup moveBy/resizeBy/moveTo, drag into a frame, IntersectionObserver and lazy loading in a frame, input at four scales, select dropdown anchor), in the rows of the maximized-window test 2026-11-28 01:26:31 +01:00
Federico Elia 465386fd7d Merge pull request #625 from oss-invisible/tests/webgl-reference-on-our-gl
tests: the control launch of two WebGL e2e tests runs on the engine's own GL
2026-11-28 00:15:47 +01:00
feder-cr ce55e15e60 Merge remote-tracking branch 'origin/main' into tests/webgl-reference-on-our-gl
# Conflicts:
#	ci/required-suites.json
2026-11-27 23:45:45 +01:00
Federico Elia 21b5276c4d Merge pull request #624 from oss-invisible/tests/neutral-names-for-public-pages
tests: neutral names for the tests of public fingerprint and detector pages; one bundle and its two tests removed
2026-11-27 23:35:33 +01:00
feder-cr abfc2d2764 tests: the host-GL probe test writes down the page's WebGL at engine off and does not judge it
With the engine off the context comes from the host's Mesa, which a runner may not
serve (hunt run 45998187350: once in 3083 launches). The page still asks for WebGL,
which is what makes Firefox read GfxInfo; with the engine declared a missing context
is still red.
2026-11-27 23:35:16 +01:00
feder-cr 025ae12b72 tests: the control launch of two WebGL e2e tests runs on the engine's own GL
The control of the non-premultiplied WebGL canvas test and of the createPattern projection test had the engine off
(hw_seed 0), so WebGL ran on the host's Mesa: once in 3503 launches a runner gave no context. The control now keeps the
engine on, with the same declared GPU, and declares only the canvas noise off (zoom.stealth.canvas.substitute_pixels
false), as test_webgl_noise_active.py does. Both launches of both files, on Linux, check the maps of the engine's
processes with the rule of test_webgl_draws_on_the_engine_s_own_gl, now written once in engine_process_tree.py.
2026-11-27 23:17:13 +01:00
feder-cr 28841856d0 tests/vendor: the rules scanner's MIT notice is the copyright holder and year and the full permission text, verbatim from upstream; the contact address is left out (pm, 27/11) 2026-11-27 21:01:47 +01:00
feder-cr 9ba446ed3c e2e: the maximized window, its frames (also transformed) and its popups read as retail
The restored-window part of the retail window-geometry test is dropped
with the feature. What stays is read against retail Firefox 159.0 on
Windows at the four display scales: the maximized window and its probe
(round 4), fullscreen in and out from it, the same-origin and cross-site
frames and the popups (round 5).

New, from round 6 (GitHub run oss-invisible/core 46052782097,
RetailCaptures 4a37f5f, WINDOW_GEOMETRY_TRANSFORMED_FRAME.csv): a
cross-site frame under scale(1.5) and under rotate(10deg), one at a time,
read from inside after three real mouse moves to retail's CSS points. Its
mozInnerScreen equals retail's, and clientX/Y and screenX/Y equal retail's
at scale 1.0 and are within one pixel at the others.

A cross-site frame that reads the top's own mozInnerScreen now fails by
name: the out-of-process frame lost its own place in the top.

Registered in wrapper.e2e.suite.linux.3 and wrapper.e2e.suite.windows.4
with four tests each.
2026-11-27 20:56:16 +01:00
feder-cr 5e535d9faa tests/vendor: the headless detector bundle and its one test are removed (its required licence notice cannot ship without a studied system's name, and the local scanner is not changed); the rules scanner carries its upstream MIT notice verbatim in its header; min_tests of wrapper.e2e.suite.linux.1 (-2), wrapper.e2e.suite.windows.1 (-1), wrapper.e2e.suite.windows.4 (-1), wrapper.e2e.realness (-1) lowered by the tests removed (the headless detector test and the realness test that loaded its page) 2026-11-27 20:51:40 +01:00
feder-cr 0c43c7ec60 tests/vendor: the two upstream notices are left out until their place is decided; the README stays neutral 2026-11-27 20:51:28 +01:00
feder-cr 08f7fd91c7 tests: the licence notices of the two vendored bundles without a header are copied verbatim from the upstream LICENSE at the commit of the vendored version 2026-11-27 20:51:28 +01:00
feder-cr 90449bbdb2 tests: the README of the vendored bundles lists each with version, license, sha256 and where its licence notice lives; a test is red if a bundle changes without its row; unit counts +3 2026-11-27 20:51:28 +01:00
feder-cr dbdd7c7c6d tests: neutral names for the tests of public fingerprint and detector pages (file, functions, ids, references); behaviour and counts unchanged 2026-11-27 20:51:07 +01:00
Federico Elia 244fdcf0a8 Merge pull request #621 from oss-invisible/ci/retired-tests-by-nodeid
ci_verdict: retired single tests by nodeid, each declared once against the floor it lowers
2026-11-27 20:20:57 +01:00
feder-cr 53b5a1ef17 ci_verdict: a retired-test entry carries from_min_tests and allows its drop only while main's floor of the suite is still that value, so it is inert once the removal is on main; the five entries are written at 449, 333, 274 and 32 2026-11-27 13:42:20 +01:00
feder-cr eef12eb659 ci_verdict: ci/retired-tests.json declares single retired tests (nodeid, suite, count, reason, decided_by); a floor drops by exactly the declared count, any other lost test stays red; the entries of the two tests the rename removes 2026-11-27 13:42:20 +01:00
Federico Elia 54ce892a60 record 0.60.0 as published (#618) 2026-11-27 13:41:57 +01:00
Federico Elia f3f35ea0c3 Merge pull request #619 from oss-invisible/ci/install-job-deps-from-lock
user-install: the install-from-index harness comes from the hashed lock; every module the tests import is held to it
2026-11-27 13:06:40 +01:00
feder-cr 11c1b4573f CHANGELOG: 0.60.0 is dated 2026-11-27, the UTC day of its upload to the index (the line the ledger PR writes) 2026-11-27 08:09:12 +01:00
feder-cr 8a6ef83ef4 user-install: the harness comment names the helper and the rule test in words, not by path (the install-job gate reads every tests/ path of the file as a test the job runs) 2026-11-27 08:09:12 +01:00
feder-cr 4b97532753 user-install: the test harness of the install-from-index job comes from the wrapper's hashed lock, and a rule test holds every third-party module the tests import to that lock (psutil was missing, ledger PR #618) 2026-11-27 08:09:12 +01:00
Federico Elia 67648a9eb6 Merge pull request #617 from oss-invisible/tests/fission-frames-evidence
tests/fission frames: every test of the module keeps the module's evidence when it fails
2026-11-27 07:39:45 +01:00
feder-cr b4f7cde592 Merge remote-tracking branch 'origin/main' into tests/fission-frames-evidence 2026-11-27 07:07:10 +01:00
Federico Elia fb8a407084 Merge pull request #607 from oss-invisible/tests/webgl-engine-off-evidence
tests/canvas: an engine-off WebGL canvas that cannot be made says why, and the run keeps its gfx log
2026-11-27 00:27:59 +01:00
feder-cr 603ca155c9 tests/fission frames: every test of the module keeps the module's evidence when it fails (the wire, the engine trace, every frame's lifecycle)
Main run 45823271010 (linux part 1) saw the goto of /workers (A, its frame B, B's frame C: three processes) reach commit and domcontentloaded but not load in 30 s, with nothing in flight, in test_a_dedicated_worker_reports_the_identity_of_the_window_in_every_frame[blob]. The module arms FailureEvidence for all of its tests but only the one test that opened OnFailure saved it: that run kept nothing. Each test now runs in OnFailure with its page listened to (frameattached / framenavigated / framedetached, domcontentloaded, load). Diagnostic only: no wait or assertion changes; the 9 e2e nodes are the same.
2026-11-26 23:54:25 +01:00
feder-cr d12d722975 Merge remote-tracking branch 'origin/main' into tests/webgl-engine-off-evidence
# Conflicts:
#	ci/required-suites.json
2026-11-26 23:52:46 +01:00
Federico Elia c5709c6bd8 Merge pull request #616 from oss-invisible/release/0.60.0-firefox-70
release 0.60.0: pins invisible-core 70.83.0 on the engine firefox-70
2026-11-26 23:07:32 +01:00
feder-cr b39b7f65e1 release 0.60.0: the gate lock names core 70.83.0 (no locked distribution changes), the CHANGELOG heading is dated 2026-11-26 22:05:21 +01:00
feder-cr 1d21e84954 release 0.60.0: pins invisible-core 70.83.0 (engine firefox-70); persona seeds for that core 2026-11-26 21:55:59 +01:00
feder-cr 6e3e166bb7 CHANGELOG 0.60.0: the restored-window frame leaves (it ships with firefox-71) 2026-11-26 19:18:39 +01:00
feder-cr 91346ececc release 0.60.0: version and changelog (the unpublished 0.59.1 entry folds into 0.60.0; the core version and the engine tag are placeholders until they are published) 2026-11-26 19:18:32 +01:00
Federico Elia cccef5dadb Merge pull request #547 from oss-invisible/ci/windows-temp-on-d
ci: on Windows the browser's profiles and temp files go on D:, not on the saturated C:
2026-11-26 13:49:28 +01:00
feder-cr bb610da22e ci: the four Windows e2e jobs added since (network, host, page oracle, final seeds) also keep TEMP and TMP on D:
tests/test_ci_windows_temp_is_on_d.py was red on them on today's main (e2e-network-windows, e2e-host-windows,
e2e-page-windows, e2e-page-final-windows had TEMP on C:); green with the job env every other Windows job has.
2026-11-26 13:14:38 +01:00
feder-cr c3c1fcee2a ci: the unit rows count the test of the Windows temp folder (3949 -> 3964, 3953 -> 3968) 2026-11-26 13:14:38 +01:00
feder-cr c1b9c5392d Windows jobs keep the browser profiles on D:, not on C:
The profile of every Firefox the tests launch is made in TEMP. On the GitHub
Windows runners TEMP is on C:, and four browsers at once saturate that disk
(queue up to 144, latencies up to 4 s): the parent's main thread stays still
40-60 s and the e2e fail at random. Hunt of 20/11: profiles on C: took 5 of
4 shards, TEMP and TMP on D:\a\_temp took none.

Every Windows job that launches a browser (e2e, e2e-hunt, fakeweb, tests,
firefox-launch-matrix, real-sites, user-install) sets TEMP and TMP to
D:\a\_temp in its job env (matrix jobs: D: on Windows, /tmp on Linux).
tests/test_ci_windows_temp_is_on_d.py fails on the workflows of main.
2026-11-26 13:14:28 +01:00
Federico Elia cb31015dd5 Merge pull request #575 from oss-invisible/fix/screenshot-refuses-what-would-touch-the-page
Screenshot refuses by name the parameters Playwright honours by modifying the page
2026-11-26 13:14:09 +01:00
feder-cr 6834f16734 CHANGELOG 0.59.1: the screenshot refusal joins the entry #606 opened (the version is already 0.59.1 on main) 2026-11-26 12:45:10 +01:00
feder-cr d348c347f6 tests: omitBackground with png is compared with stock's exact first line, the API name included
The e2e asserted `^Not implemented`, and the client prefixes every server error with the API name, so the line is
`Page.screenshot: Not implemented` (and `Locator.screenshot`, `ElementHandle.screenshot`): red on every system in run 45081196889.
Stock Playwright 1.61.1 answers the same line: `FFPage.setBackgroundColor` throws `new Error("Not implemented")` and the Python
client writes `f"{apiName}: {error}"`. The test now compares the first line with that exact text for each way of asking.
2026-11-26 12:45:10 +01:00
feder-cr fe26fca02c fix: a refused screenshot of an element or a locator is refused before the page is scrolled or measured
The refusals of mask, style, animations="disabled", caret="initial" and omitBackground with png were inside PageDispatcher.op_screenshot, which the element's
screenshot reaches only after scrolling the element into view, taking its box and reading the document's scroll: a call that was going to be refused had moved the
page. They are now one function, _refuse_unserved_screenshot_parameters, called first by the page's screenshot and first by the element's (a locator's is the
element's). It reads the parameters and nothing else, so the element's second pass through the page's is the same answer. The required-suites counts follow the
13 unit and 10 e2e tests added.
2026-11-26 12:45:10 +01:00
feder-cr 2206289d7e tests: a refused screenshot of an element or a locator neither scrolls nor measures the page (red: the refusal came after the scroll)
ElementHandleDispatcher.op_screenshot scrolled the element into view, took its box and read the document's scroll before handing the call to the page's
screenshot, where the refusal of mask, style, animations="disabled", caret="initial" and omitBackground with png is. A refused call therefore moved the page. Unit:
for each refused parameter the element's call sends nothing to the engine, not a scroll, not a measure, not a picture (the page's call is held to the same, and the
call that is taken still scrolls and measures first). E2E: on a page scrolled to a known position with the element below the fold, a refused locator.screenshot and
element.screenshot leave window.scrollY as it was; the same call without the parameter does scroll.
2026-11-26 12:45:09 +01:00
feder-cr 3b362bab4b fix: a screenshot refuses what Playwright does by modifying the page: mask, style, animations="disabled", caret="initial"
PageDispatcher.op_screenshot never read these parameters, so the call succeeded with a picture that ignored them. It now refuses each by name with what to do
instead, and answers Firefox's own `Not implemented` for omitBackground with png (jpeg is a no-op, as in stock). caret="hide" and an absent caret are served: the
engine never draws the caret, which is what stock's default produces. The element's and a locator's screenshot reach the same call. The sentences are declared by
(operation, parameter) in perimeter.REFUSED_PARAMETERS and raised through _refuse_parameter, which the declared-refusals test holds to that table both ways.
2026-11-26 12:45:09 +01:00
feder-cr 020fe74328 tests: a screenshot refuses what would touch the page (red: mask, style, animations, caret="initial" and omitBackground were silently ignored)
Stock Playwright takes mask, style and animations="disabled" by modifying the page and draws the caret only for "initial"; its Firefox throws "Not implemented" for
omitBackground with png. PageDispatcher.op_screenshot never read any of them, so the call succeeded with a picture that ignored the parameter. Unit: the page, full
page, clip, element and locator calls refuse each parameter by name (and what is harmless passes), omitBackground png answers "Not implemented"; the refusals are
declared by (operation, parameter) in perimeter.REFUSED_PARAMETERS, both directions. E2E: the same through the client on a page, a locator and an element handle, the
page left untouched, and a measurement that no caret is in the picture with caret absent and "hide". Registered in wrapper.unit.all.* and wrapper.e2e.suite.{linux,windows}.1.
2026-11-26 12:45:09 +01:00
Federico Elia 250ac6919d Merge pull request #615 from oss-invisible/tests/the-tree-guard-names-the-launch-by-its-line-not-by-the-clock
tests: the tree guard's launch time is judged from the launch line, not by a window of seconds
2026-11-26 12:44:52 +01:00
feder-cr 444cf1128d tests: a process that exits between being listed and being read is gone for the tree guard's test, not an error
Wrapper #603's round (pytest ubuntu py3.13, job 139861116959): the same test failed with `psutil.NoSuchProcess: process PID
not found` from its helper `_alive`, which asked `pid_exists` and then `Process(pid).status()`: the grandchild the guard had
just killed was there for the first question and gone for the second. The guard itself already treats such a process as
gone (`kill_tree` suppresses `NoSuchProcess` and `psutil.Error`); the helper now does too.

Red on old: `test_a_process_that_exits_between_being_listed_and_being_read_is_gone` makes the race on purpose (a pid that
exists when listed and raises `NoSuchProcess` when read): the old `_alive` raised it (1 failed), the new one answers gone; a
process that is really there is still alive (the control). wrapper.unit.all rows +1.
2026-11-26 12:10:36 +01:00
feder-cr 2703848a44 tests: the tree guard's launch time is judged from the launch line, not by a window of seconds
`test_the_tree_guard_returns_at_the_timeout_kills_the_grandchild_and_names_the_launch_that_was_alive` asserted
`2 <= alive_s < 8`. `alive_s` is the time from the launch line the child writes to the moment the run is read; a child
that a loaded machine starts late writes that line late, so it was alive for less than 2 s when the tree was killed
and the check failed although the guard had done everything right (this repo's pre-push under the load of the whole
suite, twice in a row: `2 <= 1.75824`). A test cannot fail for the speed of the machine.

What holds whatever the load is asserted instead: the line cannot have been written before the run began nor after it
was read, and its `at` is whole seconds (`launch_line`, timespec="seconds"), so `0 <= alive_s <= spent + 1`; and the
message gives that number. The kill and the naming of the launch were already asserted and stay.

Red on the old check, on purpose: `test_a_launch_that_began_late_is_named_with_the_time_since_its_own_line` is a child
slowed until its launch line comes one second before the kill (`last_launch` read at a fixed `now`): the guard names it
alive for 1 s, the old window rejects it (asserted), the new check accepts it. A control shows the check refuses a time
the line cannot give (a line 30 s before a 3 s run, a line after the read). wrapper.unit.all rows +2.
2026-11-26 11:48:17 +01:00
Federico Elia 7369fffa53 Merge pull request #612 from oss-invisible/fix/core-328-frame-fields
persona cover and launcher test read the window frame of core #328 (ui_normal/ui_compact derived, the bar through declared_maximized_ui)
2026-11-26 07:48:56 +01:00
feder-cr e02024933a tests: the fake clock of the index wait stays out of the real subprocess.run (Popen.wait polls through time.sleep: a child not yet reaped moved the fake time past the deadline after one all-yes round); two tests, wrapper.unit.all counts 3855 linux, 3859 windows 2026-11-26 06:58:26 +01:00
feder-cr 5140ecd424 required suites: wrapper.unit.all counts the four new persona-cover tests (linux 3853, windows 3857, as collected by the round of #612) 2026-11-26 06:58:16 +01:00
feder-cr c39077a050 tests: persona cover derives the window-bar prefs from their dimension, so the stored seeds hold on the pinned core and on the core with the window-frame rule
The core now declares the maximized window's bar from the panel as well as the
scale (declared_maximized_ui) and adds ui_normal/ui_compact. persona_cover has a
DERIVED category: a pref that is a function of a dimension, checked to take one
value per value of it and kept out of the stored features. maximized_ui is of
screen_panel, ui_normal and ui_compact are of dpr. test_launcher_config reads
the bar through the core when it has declared_maximized_ui.
2026-11-26 06:57:59 +01:00
Federico Elia d1cf338a2f Merge pull request #613 from oss-invisible/tests/ab-network-dealloc-early-evidence
ab network: a TURN deallocation before the page began closing is evidence, not a problem
2026-11-26 06:56:56 +01:00
feder-cr 411c2ad6ae ab network: a TURN deallocation before the page began closing is evidence, not a problem: the page's reduced-precision clock cannot order it (published engine against itself on Windows, wrapper #612's round) 2026-11-26 06:24:49 +01:00
Federico Elia 8ca47cba13 Merge pull request #609 from oss-invisible/tests/the-os-cursor-is-parked-outside-the-window
tests: on Windows the OS cursor is parked outside the browser window before every e2e, and the gestures that record pointer events require it
2026-11-26 03:00:00 +01:00
feder-cr e2e1c49db6 ci: every Windows e2e job sets the runner's screen to 1920x1080 before its e2e, so the window leaves a strip to park the cursor in
Run 45719708645 of this pull request: the runner's screen is 1024x768 and the browser window of a 1920x1080 identity is 1936x1048, so
it covered the whole screen and the cursor parked at (1023,767), inside it; the gestures' precondition said so. Parking the cursor over
the browser's own chrome does not help: hunt 45724307513 showed native moves over the tab strip reach the page too (clientY < 0,
buttons=0) once Juggler input is in it. Hunt 45730213378: 1920x1080 is the largest mode the runner's video device accepts (Microsoft
Hyper-V Video; 2560x1440 is refused) on windows-2022 and windows-latest.

The six Windows jobs of e2e.yml set it with a declared step (Set-DisplayResolution, read back, red if the screen is smaller), before
their e2e. The engine's gate runs the same step, byte for byte, in its Windows wrapper.e2e rows. Two unit tests: the runner's
1920x1080 arrangement parks the cursor in the strip below the window, and every Windows job of e2e.yml declares the screen before it
starts pytest (red on main's e2e.yml). wrapper.unit.all rows +2.
2026-11-26 02:26:32 +01:00
feder-cr 041010070c tests: every e2e test on Windows starts with the OS cursor parked outside the browser window
An autouse fixture per e2e test, and one per module that has an e2e test (a module-scoped browser opens its window before the first test of the module),
calls tests/_os_cursor.py park: the cursor goes to the bottom-right corner of the virtual screen, where no window of the engine is, and is read back. The
window then opens away from the cursor and no native mouse move reaches the page in the middle of a recorded gesture; require_outside at the start of the
drag test and the humanise move count (previous commit) is green. Windows only: the Linux e2e run under xvfb-run, whose pointer is virtual.
2026-11-26 02:26:32 +01:00
feder-cr 9ea819445f tests: a gesture the page records starts with the OS cursor outside the browser window (red: on a Windows runner nothing parks it and it sits inside)
A headed window that appears under the real cursor gets a native WM_MOUSEMOVE for it; the first native move of a process passes Gecko's filter, so the
page saw `mousemove 512,299 buttons=0` after the press in the middle of test_a_real_page_sees_a_drag_that_travelled. The runner's cursor is at (512, 384),
inside the window (-8, -8) to (1928, 1040) of a 1920x1080 screen.

tests/_os_cursor.py: park_outside (a pure choice of a point of the virtual screen beyond every window rectangle plus a margin, a clear error when none
exists), cursor_is_outside, park (SetCursorPos read back with GetCursorPos) and require_outside, over user32 on Windows and no-ops elsewhere (the Linux e2e
run under xvfb-run, whose pointer is virtual). The drag test and the humanise move count (which asserts `off <= 2` page moves) call require_outside at
the start of their gesture. The unit rows of required-suites count the new file (+20 on each OS).
2026-11-26 02:26:31 +01:00
Federico Elia 2ec1a9026b Merge pull request #611 from oss-invisible/tests/ab-network-webrtc-evidence
ab network: the TURN path really works and the A/A proves it; the udp leaf counts STUN transactions
2026-11-26 02:25:59 +01:00
feder-cr f0d25a86ff ab network: the gateway marks the TURN deallocation from its payload (one shared reading), the count drops it by that mark, and one before the page began closing is a problem 2026-11-26 01:54:35 +01:00
feder-cr ca0c6e33f8 ab network: the TURN deallocation (a Refresh with lifetime 0, one best-effort send at teardown) is evidence, not a compared leaf; two of them, or one without an allocation, is a problem 2026-11-26 01:50:11 +01:00
feder-cr 46cf6a579a ab network: the A/A proves the TURN path it compares: a walk with no relay candidate, an error for the lab TURN, or a request the lab TURN refused is a problem on either side 2026-11-26 01:09:41 +01:00
feder-cr 0a031d2688 ab network: the probe uses the lab TURN's credential so the relay is really made; the fake TURN refuses a request whose integrity is wrong; the udp leaf counts STUN transactions, and a transaction over the engine's 7 transmits is a problem 2026-11-26 01:07:54 +01:00
feder-cr a9e56c0b21 ab network: the hunt also keeps the TURN server's answers, the relay's return datagrams and nICEr's log 2026-11-26 01:07:53 +01:00
feder-cr 04b7a79b66 ab network: the webrtc walk keeps, as evidence never compared, each datagram's time and STUN transaction and the page's own ICE times; e2e-hunt can repeat that walk alone 2026-11-26 01:07:53 +01:00
Federico Elia 2c5cd5ea79 Merge pull request #610 from oss-invisible/tests/worker-cache-back-evidence
tests/worker-cache: a red go_back keeps the Juggler record, the engine's session-history log and what the page says
2026-11-26 00:53:52 +01:00
feder-cr 877027f9f4 tests/worker-cache: the helpers of the evidence come after the test, so the guard reads wait_cacheable before the first go_back 2026-11-26 00:28:44 +01:00
feder-cr 0e48424da8 tests/worker-cache: a red go_back keeps the Juggler record, the engine's session-history log and what the page says
Candidate 45691494388 (job 139520127265) saw go_back end with "no new navigation on frame mainframe-11 in 30s" for top/other-site/goto and kept nothing. A hunt of 2960 iterations on that engine did not reproduce it (run 45711081489). The test now arms FailureEvidence with SHIPBFCache, nsSHistory, SessionHistory, BCWebProgress, DocumentChannel and BrowsingContext, and records what the page says when go_back raises and 2 s later. Diagnostic only: no assertion changes.
2026-11-26 00:19:44 +01:00
Federico Elia 43e1b355a3 Merge pull request #604 from oss-invisible/tests/unit-tests-never-reach-the-network
tests: a test that is not e2e never leaves the machine (socket and asyncio doors guarded, four tests declare the lab's exit)
2026-11-26 00:01:57 +01:00
feder-cr ebfd0fa573 tests: the ten unit tests that compose a launch declare the engine instead of asking GitHub for it
Run 45708815163 (this pull request, every pytest leg): the guard refused `api.github.com` in ten unit tests. Without
`binary_path=` a launch resolves the engine through `ensure_binary` (`_engine.resolve_executable`): with an engine in the
machine's cache it answers at once, with none it asks GitHub's release index and downloads the archive. So these
tests passed on any machine that had run `fetch` and went to the internet on a fresh runner (reproduced here with
INVISIBLE_PLAYWRIGHT_CACHE_DIR on an empty folder: 10 failed, 10 errors; with the fixture: all pass).

A fixture, `declared_engine` (tests/conftest.py), declares an empty executable in the test's folder as the answer of
`ensure_binary`; the file is never run. The ten tests take it:
  test_launcher_helpers.py: test_build_env_carries_the_declared_network, test_build_env_caller_env_override_wins,
    test_build_env_never_injects_font_env, test_build_env_no_font_keys_when_absent
  test_launcher_config.py: test_enter_with_profile_dir_calls_launch_persistent_context,
    test_enter_without_profile_dir_calls_launch_not_persistent, test_persistent_context_user_data_dir_is_created_if_missing,
    test_teardown_closes_persistent_context
  test_async_api.py: test_the_async_api_stamps_the_session_token_into_the_browser_env
  test_virtual_display_start_off_the_loop.py: test_a_second_browser_is_served_while_the_first_starts_its_display
The whole non-e2e selection with an empty engine cache and the guard: 3763 passed, 8 skipped (Windows).
2026-11-25 23:30:27 +01:00
feder-cr b699439355 tests: the version gate is the one declared third party of the guard (pypi.org, for its own file only)
Run 45647282454, job version: tests/test_version_is_not_taken.py asks the index whether the proposed version is
already published, which only the index can answer; the guard refused its lookup of pypi.org and the gate went red.
It is skipped unless IPW_CHECK_VERSION is set, which only the version job of tests.yml does.

tests/_no_network.py: DECLARED_THIRD_PARTIES names that file and that host alone. Its lookup of pypi.org passes and
the addresses it answered may be connected to; any other host, and pypi.org from any other file, stay refused.
Three cases (faked under the guard, nothing leaves the machine): the gate may ask the index and only the index; no
other file may ask it; the declared table is that one entry, so a new one changes a test in the same diff.
wrapper.unit.all rows +3 (3688 linux, 3692 windows).
2026-11-25 22:45:35 +01:00
feder-cr 7031c911c7 tests: the four tests that compose prefs through the core declare the exit of the lab
A new fixture, lab_exit (tests/conftest.py), declares the exit and the GeoIP database of the lab for one test that
is not e2e, as the e2e session has them (tests/_lab_egress.py). With no proxy the core asks the network where this
machine leaves from on every composition, even with a declared zone (zone, language and position come from the
exit): that is the product's rule, so the tests declare the answer instead of asking the internet.
2026-11-25 22:45:33 +01:00
feder-cr 464e0b132b tests: a test that is not e2e never leaves the machine (red: four tests asked the internet where this machine leaves from)
pyproject.toml says unit and integration are "no network", and nothing enforced it: the pre-push of the wrapper
failed on tests/unit/test_config_public.py where the network refused api.ipify.org and icanhazip.com.

tests/_no_network.py patches the four doors every client in the process goes through (socket.socket.connect,
connect_ex, sendto and socket.getaddrinfo) for every test that is not e2e (an autouse fixture of tests/conftest.py):
loopback, the unspecified address, localhost names, the documentation ranges and the address this host sends from
pass; anything else is refused (ConnectionRefusedError, what an offline machine shows) and recorded, and the record
fails the test at its teardown, with WHERE (the test), WHAT (door and destination), FIX and RULE, even when the code
under test swallowed the refusal.

Red on this commit, all through the core's one discovery of the exit (prepare_session_geo, no proxy):
  tests/unit/test_config_public.py::test_public_import_matches_direct_import
  tests/test_launcher_helpers.py::test_default_context_screen_matches_profile
  tests/test_launcher_helpers.py::test_default_context_color_scheme_follows_dark_theme
  tests/test_prefs_composition_arm.py::test_the_wrapper_composes_what_the_public_api_composes (green before: the
  core swallows the failed discovery when the zone is given, only the record catches it)

tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py (35 on Linux, 38 on Windows: the asyncio cases run on the selector loop, and on Windows on the Proactor loop too, which connects with ConnectEx and sends with WSASendTo, never through socket.socket) tests the guard; wrapper.unit.all rows +35 / +38.
2026-11-25 22:45:33 +01:00
Federico Elia a480b58677 Merge pull request #602 from oss-invisible/tests/h3-attempt-read-at-the-port
tests: h3 that was never tried is read as no datagram at the h3 port, not as a load time
2026-11-25 22:01:33 +01:00
feder-cr 995e2da01e tests: five h2 visits with no datagram at the h3 port are clean on a loaded runner, and a datagram there is an attempt whatever the load times
The verdict of an h2-only road is the judge of the protocols plus the attempt read at the port of the server; the time a visit took is no input of it.
One visit loaded in 2500 ms against 719 ms (a loaded runner) with nothing at the h3 port is clean; every visit fast with one datagram at the port is an
attempt. Four roads each; the unit rows of required-suites count the eight.
2026-11-25 21:00:48 +01:00
feder-cr 13286044c7 tests: the non-coherent SOCKS5 roads also read the attempt at h3 at the gateway (UDP ASSOCIATE asked, datagram into the relay)
The server's UDP port does not see an engine that tries h3 through the relay of a gateway: it asks for a UDP ASSOCIATE or sends into the relay.
relay_activity() is taken before the first visit (after the core's own measurement) and after the last; h3_attempts() reports what the engine
asked of the gateway in between. A unit test covers a granted and a refused ASSOCIATE and a datagram into the relay; the unit rows of
required-suites count it (+1 again).
2026-11-25 21:00:47 +01:00
feder-cr 4f4b8ab7a3 tests: behind an HTTP proxy (and where UDP is dropped) h3 is never tried, read as a datagram at the h3 port, not as a load time
The e2e judged the fallback by an absolute margin on page.goto (visit 2 loaded in 2500 ms against 719 ms), which is red on a loaded runner with
five visits that all read h2. The attempt is now read where it is born: H3Server records every datagram that reaches its UDP port
(udp_datagrams), a QUIC Initial included whether or not a handshake follows, and the h2 roads assert there is none. judge_visits no longer takes
load times, LOAD_MARGIN_MS and its debt entry in the clock exceptions are gone. A unit test proves the server sees an attempt that never
completes; the unit rows of required-suites count it (+1).
2026-11-25 21:00:47 +01:00
Federico Elia 46054486c9 Merge pull request #606 from oss-invisible/fix/element-handle-actions-walk-like-a-hand
ElementHandle pointer actions walk onto the element the way selector actions do (one click path, one fingerprint)
2026-11-25 21:00:14 +01:00
feder-cr 3e43f597e4 tests: the handle e2e prints what the page saw of the pointer and the core's turns when its opening sequence is wrong
Evidence only; the verdict is unchanged (`ordine[:2] == ['hover', 'click']`). Candidate 45621332479 recorded
['hover', 'hover', 'click'] once, and nothing told an exit and re-entry of the pointer from a spurious second
mouseover. The page now also keeps every mouseover, mouseout and click of the button with its relatedTarget, its
point and the button's box at that instant, and the first moves of the document; the test wraps the core's
actionability loop (Actions._retry, _center_point, hit_target: the originals are called with the same arguments) and
records the turns of each action, their hit-target verdicts and how they ended. All three go into the failure message.
2026-11-25 19:56:37 +01:00
feder-cr 8bcc2a9ca1 ElementHandle pointer actions walk onto the element the way selector actions do, one hand for every door
click, dblclick, hover, tap, check and uncheck (and so set_checked) of an ElementHandle called the core's actions directly: with no client cursor the approach is one mousemove onto the exact centre of the quad and a press there, while the selector actions go through Frame._by_hand / Pointer.act (a drawn path, a landing point of the session's own). The handle now goes through the same _by_hand with element=<its object id>: Pointer.act aims at that node (no selector looked up, the handle not disposed), and trial/force/strict/position/modifiers are read as before. The keyboard and text actions (fill, type, press, focus, selectText, setInputFiles) already end in the same core action as their selector twins and are unchanged. The comment that said a handle click was the humanised pointer is now true. Version 0.59.1.
2026-11-25 19:56:37 +01:00
feder-cr 292d86a15a tests: a handle's pointer action walks like a selector's (red: a handle click is one jump to the exact centre)
ElementHandle.click/dblclick/hover/tap/check/uncheck go straight to the core's actions, which with engine_approach off send one mousemove onto the exact quad centre and press there; the selector actions go through the server's hand. A unit test over the real core Actions and the real Pointer (only the connection and the injected script stubbed) and an e2e that asks the page. Both rows of wrapper.unit.all and one row per system of the e2e partition name the new files.
2026-11-25 19:56:37 +01:00
Federico Elia 2f5216b4c0 Merge pull request #605 from oss-invisible/fakeweb/stock-unsettled
fake web P2: a stock round that lost the end of a fetch the page aborted is stock unsettled, not a broken control
2026-11-25 19:56:04 +01:00
feder-cr c2c3d3c289 tests: the engine-off WebGL canvas test says why it got no context
The probe listens for webglcontextcreationerror and returns what it heard instead of null; after a first null the test waits 2 s and records a second attempt (statusMessages, renderer). The verdict stays the first attempt's. The test runs inside FailureEvidence with MOZ_LOG gfx2d.
2026-11-25 19:05:33 +01:00
feder-cr 4d0cbc8d08 fake web P2: a stock round that lost the end of a fetch the page aborted is stock unsettled, not a broken control; ours is judged against the declared outcome there 2026-11-25 18:16:44 +01:00
Federico Elia 7c4a9c0702 Merge pull request #599 from oss-invisible/tests/occlusion-cover-without-focus
tests/occlusion: on Linux the cover is a window of the test's own, and neither the pointer nor the focus may move
2026-11-25 18:15:17 +01:00
feder-cr 8fd5d8ae7d Merge remote-tracking branch 'origin/main' into tests/occlusion-cover-without-focus
# Conflicts:
#	ci/required-suites.json
2026-11-25 15:28:21 +01:00
feder-cr 2706c29676 tests/occlusion: the pointer, not the focus, is what the cover must not move
Run 45620136865 refuted the focus reading: with an X cover over the pointer 458 of 463 runs were red, FocusOut 0 of 40 on the old arrangement. With no window manager the focus is PointerRoot, the pointer sits inside the covered window, and a window mapped over it makes the pointer leave the toplevel; GDK turns that crossing into a GTK focus-out that redraws the window after FullyObscured.

- the display: the test warps the pointer to the bottom-right pixel of the root (from its read-back geometry) before any session starts.
- cover_rectangle keeps the pointer outside the cover (the margin shrinks on that side) and cover_window fails with "the pointer is inside the covered window, no free point on the screen".
- watch also selects Enter/LeaveWindowMask; crossings and focus events are kept with time, mode and detail; the pointer is read back once after the cover is up.
- precondition (both halves, before the page is judged): no crossing and no focus event on the covered toplevel, pointer outside both rectangles; message starts "arrangement: the covering moved the pointer or the focus".
- unit cases for all of it; min_tests of wrapper.unit.all.* raised by 11.
2026-11-25 15:27:21 +01:00
feder-cr 063a507a9c tests/occlusion: the cover on Linux is a window of the test's own and the focus must not move
The covering window was the second Firefox session's. When it mapped it took the X focus; the covered toplevel got FocusOut and GTK draws a window that loses the focus (nsWindow::OnExposeEvent -> NotifyOcclusionState(VISIBLE)). When X delivered Partially, FocusOut and Fully in one batch, that draw ran after the Fully and the page never recorded hidden (hunt run 45603211231, 58 reds of 1294).

- _x_visibility: override-redirect InputOutput cover (cover_window, destroy_window), FocusChangeMask with VisibilityChangeMask on the covered toplevel, FocusIn/FocusOut kept with their time, focus_moved for the precondition.
- test_window_occlusion_e2e: on Linux no second session; both halves assert that no FocusOut reached the covered toplevel before the page is judged ("arrangement: the covering moved the focus"). Windows unchanged.
- _evidence_on_failure: MOZ_LOG_FILE carries %PID, one log file per process.
- unit cases for all of it; min_tests of wrapper.unit.all.* raised by 13.
2026-11-25 13:49:56 +01:00
211 changed files with 29916 additions and 11767 deletions

No files matched your search

+13
View File
@@ -24,3 +24,16 @@ tests/gates/wire_method_debt.json text eol=lf
# The lock of the gate is hashed byte for byte: its header names the sha256 of gate.in, so neither file may be rewritten with CRLF on a Windows checkout.
ci/py-lock/** text eol=lf
# The vendored bundles are third-party bytes whose sha256 is pinned in tests/vendor/README.md: no checkout converts their line endings
# (a Windows runner with core.autocrlf=true would hand them over with CRLF and the hash would no longer match).
tests/vendor/*.js -text
# The evidence of the known-defects tests and the copy of the core's matcher are hashed byte for byte against tests/data/known_mozilla_defects/sources.json: no checkout converts their line endings.
tests/data/known_mozilla_defects/** -text
# The ready security state is hashed byte for byte against ci/security-state.pin.json.
ci/security-state/** -text
# The page of the password-mask e2e is the same bytes as the page of the retail capture (its sha256 is checked), so no checkout may change its line endings.
tests/data/password_mask_page.html -text
@@ -1,104 +0,0 @@
# ─────────────────────────────────────────────────────────────────────────────
# candidate-handle-double-hover-hunt.yml - a MEASUREMENT, not a gate: on Windows, on the binary of an ENGINE CANDIDATE, is the double `mouseover` that
# `tests/test_element_handle_actions.py::test_the_nine_actions_reach_the_page_through_a_handle` saw once (page record ['hover', 'hover', 'click'])
# an EXIT AND RE-ENTRY of the pointer (a mouseout between the two) or a SPURIOUS second mouseover (none between)?
#
# The scenario is the first `query_selector("#bottone").click()` of that test, repeated with a fresh browser each time (tests/hunt_handle_double_hover_e2e.py):
# the page listens to mouseover, mouseout, mouseenter, mouseleave, every mousemove and the button's rect, and the core's retry loop is hooked (it logs nothing
# of its turns). 60 runs one after the other, then 60 four at a time (xdist -n 4, as the suite runs). One line of JSON per run, a verdict
# (single | exit-reentry | spurious | other | error), a table in the log.
#
# The candidate is named by two files of this branch (ci/candidate-run.txt, ci/candidate-core-ref.txt): the artifact asset-win-x86_64 of that run of `release`
# in oss-invisible/firefox_antidetect_patch, sealed as the gate of the candidate seals it (scripts/hunt_candidate_binary.py). The wrapper is this branch's code,
# installed with that core ref, as the gate installs it.
#
# ONE job, on a push to its own branch only. Green whatever it finds; red only when the scenario itself errored (a launch, a goto or a click that raised).
# ─────────────────────────────────────────────────────────────────────────────
name: candidate-handle-double-hover-hunt
on:
push:
branches: [hunt/handle-double-hover]
permissions:
contents: read
actions: read
# A hunt has a group of its own, unique to the run: a newer push never cancels a measurement that is half done (tests/test_ci_runs_once_per_commit.py).
concurrency:
group: ${{ github.workflow }}-${{ github.run_id }}
cancel-in-progress: false
env:
# reads the artifacts and the log of the candidate's run (the engine repository is public)
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
# the core of the candidate, not the one the wrapper pins: the pair is mismatched on purpose, as the gate of the candidate runs it
INVISIBLE_CORE_PIN: allow
INVISIBLE_CORE_AUTOFIX: "off"
jobs:
handle-double-hover:
name: candidate-handle-double-hover (windows)
runs-on: windows-2022 # the image of wrapper.e2e.suite.windows.1 in the gate of the candidate
timeout-minutes: 75
defaults:
run:
shell: bash
env:
HUNT_OUT: ${{ github.workspace }}/hunt-out
PYTHONUNBUFFERED: "1"
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
- name: The candidate is named (ci/candidate-run.txt, ci/candidate-core-ref.txt)
run: python scripts/hunt_candidate_binary.py check
- name: Install the core of the candidate, the wrapper and the test deps
run: |
set -e
CORE_GIT="git+https://github.com/oss-invisible/core@$(python scripts/hunt_candidate_binary.py core-ref)"
python -m pip install --upgrade pip
python -m pip install --quiet "$CORE_GIT"
python -m pip install --quiet ".[dev]"
python -m pip install --quiet --force-reinstall "$CORE_GIT"
python -m pip install --quiet "playwright==$(cat scripts/playwright_pin.txt)"
python scripts/hunt_candidate_binary.py verify-core
- name: The binary of the candidate (asset-win-x86_64), sealed
run: python scripts/hunt_candidate_binary.py fetch --leg win-x86_64 --dest "$RUNNER_TEMP/candidate"
- name: The GeoIP database (made by the repository, same bytes every run)
run: python scripts/ci_lab_geoip.py build --pin ci/geoip.json
- 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: Which candidate this hunt ran on
run: |
mkdir -p "$HUNT_OUT"
cp "$RUNNER_TEMP/candidate/candidate.json" "$HUNT_OUT/"
cat "$HUNT_OUT/candidate.json"
# no PYTEST_ADDOPTS, no rerun plugin, no suite's options: the file is named by its path and is in no row of ci/required-suites.json
- name: 60 runs one after the other (a fresh browser each)
run: |
HUNT_MODE=sequential HUNT_RUNS=60 python -m pytest tests/hunt_handle_double_hover_e2e.py -o addopts="" -p no:cacheprovider -p no:rerunfailures \
-m e2e -q -rf --timeout 420 --timeout-method thread
- name: 60 runs four at a time (xdist -n 4, as the suite runs)
if: always()
run: |
HUNT_MODE=parallel HUNT_RUNS=60 python -m pytest tests/hunt_handle_double_hover_e2e.py -o addopts="" -p no:cacheprovider -p no:rerunfailures \
-m e2e -q -rf --timeout 420 --timeout-method thread -n 4 --dist load
- name: Close every Firefox left
if: always()
run: |
taskkill //F //IM firefox.exe //T 2>/dev/null || true
echo "left: $(tasklist //FI 'IMAGENAME eq firefox.exe' 2>/dev/null | grep -ci firefox || true)"
- name: The summary (the verdicts, the retry turns, the sequence of every run that is not single)
if: always()
run: python scripts/hunt_handle_double_hover_summary.py "$HUNT_OUT"
- name: Upload the runs
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: handle-double-hover-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ github.workspace }}/hunt-out
if-no-files-found: warn
retention-days: 14
+46
View File
@@ -22,6 +22,15 @@
# Windows runner separates the two without asking anyone to stay off it
# for six hours.
#
# A second use, chosen by the input `ab_network_webrtc_seed` (empty = the loop
# above, as always): the network oracle's WebRTC walk of that seed, alone,
# `runs` times for each engine of its A/A (the published engine twice). It
# exists to tell two readings apart when the A/A of that walk differs from
# itself in the number of TURN Allocate datagrams (scripts/ci_ab_network.py:
# AB_NETWORK_HUNT): each repetition keeps every datagram with its time and its
# STUN transaction id and the page's own ICE times (network/hunt/<engine>-<i>.json,
# summary in network/hunt/summary.json). It decides nothing: the step exits 0.
#
# Doesn't start on its own: `workflow_dispatch` only. It's not a gate, it's
# an investigation tool, and it must not be added to the required contexts.
# ─────────────────────────────────────────────────────────────────────────────
@@ -34,6 +43,10 @@ on:
description: "How many runs at most (at 12% it takes ~18 for a 90% chance)"
required: false
default: "18"
ab_network_webrtc_seed:
description: "A seed (e.g. 4) to repeat ONLY the network oracle's WebRTC walk of, `runs` times for each engine of its A/A, instead of the e2e loop. Empty: the e2e loop."
required: false
default: ""
os:
description: "Where to hunt. windows-latest answers a DIFFERENT question: are the interaction retries seen on the dev machine the product or contention?"
required: false
@@ -75,6 +88,11 @@ jobs:
needs: linux-deps-hunt
if: ${{ !cancelled() && (needs.linux-deps-hunt.result == 'success' || needs.linux-deps-hunt.result == 'skipped') }}
runs-on: ${{ inputs.os }}
# 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: ${{ startsWith(inputs.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
TMP: ${{ startsWith(inputs.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
# 18 runs of ~6 minutes plus install time. Deliberately generous: the
# ceiling here must NEVER be the thing that stops the hunt, or we're back
# to a killed job that explains nothing, which is the original defect.
@@ -121,10 +139,29 @@ jobs:
sudo apt-get $APT update
sudo cp /tmp/linux-deps/*.deb /var/cache/apt/archives/
sudo apt-get $APT install -y --no-download --no-install-recommends $(cat /tmp/linux-deps/roots.txt)
- name: The security state (a fixed directory of the repository)
if: inputs.ab_network_webrtc_seed != ''
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 GeoIP database (made by the repository, same bytes every run)
if: inputs.ab_network_webrtc_seed != ''
run: python scripts/ci_lab_geoip.py build
# The hunt of the network oracle's WebRTC walk: instead of the loop below, never with it. `runs` is the number of repetitions per engine.
- name: The network oracle's WebRTC walk of one seed, repeated (decides nothing)
if: inputs.ab_network_webrtc_seed != ''
env:
PYTHONUNBUFFERED: "1"
AB_NETWORK_HUNT: webrtc:${{ inputs.ab_network_webrtc_seed }}:${{ inputs.runs }}
run: |
set -u
if [ "$RUNNER_OS" = "Linux" ]; then PRE="xvfb-run -a"; else PRE=""; fi
mkdir -p network
$PRE python -u scripts/ci_ab_network.py ab --a-a --out network --published-binary "$FF"
- name: Loop until it catches one
if: inputs.ab_network_webrtc_seed == ''
env:
PYTHONUNBUFFERED: "1"
INVPW_TEST_WATCHDOG_FILE: evidence/e2e-watchdog.log
@@ -179,3 +216,12 @@ jobs:
evidence/e2e-watchdog.log
if-no-files-found: warn
retention-days: 14
- name: Upload the hunt of the network oracle's WebRTC walk
if: always() && inputs.ab_network_webrtc_seed != ''
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: e2e-hunt-network-webrtc-${{ inputs.os }}-${{ github.run_id }}-${{ github.run_attempt }}
path: network/hunt
if-no-files-found: warn
retention-days: 14
+264
View File
@@ -411,8 +411,44 @@ jobs:
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
# The runner's screen (1024x768 by default) is smaller than the browser window the e2e open (1936x1048 for a 1920x1080 identity), so the
# OS cursor cannot be parked outside it (tests/_os_cursor.py) and a native move for it reaches the page. 1920x1080 is the largest mode the
# runner's video device accepts (run 45730213378 of oss-invisible/playwright): it leaves the strip below the window free. Declared here, read back.
- name: The runner's screen is 1920x1080, larger than the browser window is tall (read back)
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Add-Type -AssemblyName System.Windows.Forms
$b = [System.Windows.Forms.SystemInformation]::VirtualScreen
"the runner's screen: $($b.Width)x$($b.Height) at $($b.X),$($b.Y)"
if ($b.Width -lt 1920 -or $b.Height -lt 1080) { Write-Error "the runner's screen is $($b.Width)x$($b.Height), not 1920x1080: the OS cursor could not be parked outside the browser window"; exit 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
# The native crash of the pytest worker ("node down: Not properly terminated", "Windows fatal exception: access violation" in a thread Python has no state for, jobs
# 138402013609 and 138966622085): Windows Error Reporting writes a FULL dump of a python.exe that dies from an unhandled exception, into the evidence folder the job
# uploads (dumps/python), so the faulting module and stack can be read. HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<image>, DumpType 2 = full,
# DumpCount = how many are kept: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps . faulthandler (pytest enables it) is a vectored handler that
# returns EXCEPTION_CONTINUE_SEARCH, so WER still sees the exception. BEFORE the first pytest step; the summary step before the upload reads what it left.
- name: Windows Error Reporting keeps a full dump of a python.exe that crashes (into the evidence)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$dumps = Join-Path $env:RUNNER_TEMP 'invpw-evidence\dumps\python'
New-Item -ItemType Directory -Force -Path $dumps | Out-Null
$wer = 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting'
New-Item -Force -Path $wer | Out-Null
New-ItemProperty -Force -Path $wer -Name Disabled -PropertyType DWord -Value 0 | Out-Null
New-ItemProperty -Force -Path $wer -Name DontShowUI -PropertyType DWord -Value 1 | Out-Null
$key = "$wer\LocalDumps\python.exe"
New-Item -Force -Path $key | Out-Null
New-ItemProperty -Force -Path $key -Name DumpFolder -PropertyType ExpandString -Value $dumps | Out-Null
New-ItemProperty -Force -Path $key -Name DumpType -PropertyType DWord -Value 2 | Out-Null
New-ItemProperty -Force -Path $key -Name DumpCount -PropertyType DWord -Value 3 | Out-Null
Get-ItemProperty -Path $key | Format-List DumpFolder, DumpType, DumpCount
Get-ItemProperty -Path $wer | Format-List Disabled, DontShowUI
# The one variable tests/conftest.py reads (tests/_wer_error_mode.py): every pytest process of the later steps clears SEM_NOGPFAULTERRORBOX of its error mode, which the
# runner gives it and which would keep a crashing worker from ever reaching the LocalDumps above, and says so in dumps/error-mode.log.
"INVPW_WER_DUMPS=$dumps" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Install wrapper + test deps (the stock client is in the dev extra)
run: |
python -m pip install --upgrade pip
@@ -428,6 +464,18 @@ jobs:
env:
PYTHONUNBUFFERED: "1"
run: INVPW_BINARY_PATH="$FF" python -u -m pytest -m e2e -p no:cacheprovider -v tests/test_control_a_selects_all_in_a_field_e2e.py
- name: What Windows Error Reporting kept of a crashing python.exe (size, faulting module, in the evidence)
if: always()
shell: bash
run: python scripts/ci_wer_dumps.py "$RUNNER_TEMP/invpw-evidence/dumps/python"
- name: Upload what the tests saved
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: invpw-evidence-windows-control-a-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/invpw-evidence
if-no-files-found: ignore
retention-days: 14
# 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
@@ -457,8 +505,44 @@ jobs:
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
# The runner's screen (1024x768 by default) is smaller than the browser window the e2e open (1936x1048 for a 1920x1080 identity), so the
# OS cursor cannot be parked outside it (tests/_os_cursor.py) and a native move for it reaches the page. 1920x1080 is the largest mode the
# runner's video device accepts (run 45730213378 of oss-invisible/playwright): it leaves the strip below the window free. Declared here, read back.
- name: The runner's screen is 1920x1080, larger than the browser window is tall (read back)
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Add-Type -AssemblyName System.Windows.Forms
$b = [System.Windows.Forms.SystemInformation]::VirtualScreen
"the runner's screen: $($b.Width)x$($b.Height) at $($b.X),$($b.Y)"
if ($b.Width -lt 1920 -or $b.Height -lt 1080) { Write-Error "the runner's screen is $($b.Width)x$($b.Height), not 1920x1080: the OS cursor could not be parked outside the browser window"; exit 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
# The native crash of the pytest worker ("node down: Not properly terminated", "Windows fatal exception: access violation" in a thread Python has no state for, jobs
# 138402013609 and 138966622085): Windows Error Reporting writes a FULL dump of a python.exe that dies from an unhandled exception, into the evidence folder the job
# uploads (dumps/python), so the faulting module and stack can be read. HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<image>, DumpType 2 = full,
# DumpCount = how many are kept: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps . faulthandler (pytest enables it) is a vectored handler that
# returns EXCEPTION_CONTINUE_SEARCH, so WER still sees the exception. BEFORE the first pytest step; the summary step before the upload reads what it left.
- name: Windows Error Reporting keeps a full dump of a python.exe that crashes (into the evidence)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$dumps = Join-Path $env:RUNNER_TEMP 'invpw-evidence\dumps\python'
New-Item -ItemType Directory -Force -Path $dumps | Out-Null
$wer = 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting'
New-Item -Force -Path $wer | Out-Null
New-ItemProperty -Force -Path $wer -Name Disabled -PropertyType DWord -Value 0 | Out-Null
New-ItemProperty -Force -Path $wer -Name DontShowUI -PropertyType DWord -Value 1 | Out-Null
$key = "$wer\LocalDumps\python.exe"
New-Item -Force -Path $key | Out-Null
New-ItemProperty -Force -Path $key -Name DumpFolder -PropertyType ExpandString -Value $dumps | Out-Null
New-ItemProperty -Force -Path $key -Name DumpType -PropertyType DWord -Value 2 | Out-Null
New-ItemProperty -Force -Path $key -Name DumpCount -PropertyType DWord -Value 3 | Out-Null
Get-ItemProperty -Path $key | Format-List DumpFolder, DumpType, DumpCount
Get-ItemProperty -Path $wer | Format-List Disabled, DontShowUI
# The one variable tests/conftest.py reads (tests/_wer_error_mode.py): every pytest process of the later steps clears SEM_NOGPFAULTERRORBOX of its error mode, which the
# runner gives it and which would keep a crashing worker from ever reaching the LocalDumps above, and says so in dumps/error-mode.log.
"INVPW_WER_DUMPS=$dumps" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
# The A/A of the three A/B oracles (page, network, host) runs on the first seeds of the candidate set on a pull request, and on ALL of them when the pull request
# changes a file of that oracle (scripts/ci_ab_pr_seeds.py holds the lists). The checkout is shallow, so the script fetches the base commit and lists the files that
# differ from it (`git diff --name-only <base> HEAD`: HEAD is the merge commit, so this is the pull request's own change); the tests read the variables it prints.
@@ -522,6 +606,10 @@ jobs:
path: ${{ runner.temp }}/e2e-junit-*.xml
if-no-files-found: warn
retention-days: 14
- name: What Windows Error Reporting kept of a crashing python.exe (size, faulting module, in the evidence)
if: always()
shell: bash
run: python scripts/ci_wer_dumps.py "$RUNNER_TEMP/invpw-evidence/dumps/python"
- name: Upload what the tests saved
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -634,14 +722,54 @@ jobs:
runs-on: windows-2022
# the network oracle's own guard (2197 s, two engine runs: the measured runs 45121964904 and 45153612447 plus 25%) and the job's own steps, with room for a slow runner
timeout-minutes: 50
# TEMP and TMP on D:\a\_temp, as every Windows job that launches a browser (see e2e-windows): on C: the profiles saturate the disk.
env:
TEMP: 'D:\a\_temp'
TMP: 'D:\a\_temp'
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
# The runner's screen (1024x768 by default) is smaller than the browser window the e2e open (1936x1048 for a 1920x1080 identity), so the
# OS cursor cannot be parked outside it (tests/_os_cursor.py) and a native move for it reaches the page. 1920x1080 is the largest mode the
# runner's video device accepts (run 45730213378 of oss-invisible/playwright): it leaves the strip below the window free. Declared here, read back.
- name: The runner's screen is 1920x1080, larger than the browser window is tall (read back)
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Add-Type -AssemblyName System.Windows.Forms
$b = [System.Windows.Forms.SystemInformation]::VirtualScreen
"the runner's screen: $($b.Width)x$($b.Height) at $($b.X),$($b.Y)"
if ($b.Width -lt 1920 -or $b.Height -lt 1080) { Write-Error "the runner's screen is $($b.Width)x$($b.Height), not 1920x1080: the OS cursor could not be parked outside the browser window"; exit 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
# The native crash of the pytest worker ("node down: Not properly terminated", "Windows fatal exception: access violation" in a thread Python has no state for, jobs
# 138402013609 and 138966622085): Windows Error Reporting writes a FULL dump of a python.exe that dies from an unhandled exception, into the evidence folder the job
# uploads (dumps/python), so the faulting module and stack can be read. HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<image>, DumpType 2 = full,
# DumpCount = how many are kept: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps . faulthandler (pytest enables it) is a vectored handler that
# returns EXCEPTION_CONTINUE_SEARCH, so WER still sees the exception. BEFORE the first pytest step; the summary step before the upload reads what it left.
- name: Windows Error Reporting keeps a full dump of a python.exe that crashes (into the evidence)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$dumps = Join-Path $env:RUNNER_TEMP 'invpw-evidence\dumps\python'
New-Item -ItemType Directory -Force -Path $dumps | Out-Null
$wer = 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting'
New-Item -Force -Path $wer | Out-Null
New-ItemProperty -Force -Path $wer -Name Disabled -PropertyType DWord -Value 0 | Out-Null
New-ItemProperty -Force -Path $wer -Name DontShowUI -PropertyType DWord -Value 1 | Out-Null
$key = "$wer\LocalDumps\python.exe"
New-Item -Force -Path $key | Out-Null
New-ItemProperty -Force -Path $key -Name DumpFolder -PropertyType ExpandString -Value $dumps | Out-Null
New-ItemProperty -Force -Path $key -Name DumpType -PropertyType DWord -Value 2 | Out-Null
New-ItemProperty -Force -Path $key -Name DumpCount -PropertyType DWord -Value 3 | Out-Null
Get-ItemProperty -Path $key | Format-List DumpFolder, DumpType, DumpCount
Get-ItemProperty -Path $wer | Format-List Disabled, DontShowUI
# The one variable tests/conftest.py reads (tests/_wer_error_mode.py): every pytest process of the later steps clears SEM_NOGPFAULTERRORBOX of its error mode, which the
# runner gives it and which would keep a crashing worker from ever reaching the LocalDumps above, and says so in dumps/error-mode.log.
"INVPW_WER_DUMPS=$dumps" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
if: github.event_name == 'pull_request'
shell: bash
@@ -684,6 +812,10 @@ jobs:
run: |
Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
"left: " + @(Get-Process firefox -ErrorAction SilentlyContinue).Count
- name: What Windows Error Reporting kept of a crashing python.exe (size, faulting module, in the evidence)
if: always()
shell: bash
run: python scripts/ci_wer_dumps.py "$RUNNER_TEMP/invpw-evidence/dumps/python"
- name: Upload what the test saved
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -816,14 +948,54 @@ jobs:
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
runs-on: windows-2022
timeout-minutes: 45
# TEMP and TMP on D:\a\_temp, as every Windows job that launches a browser (see e2e-windows): on C: the profiles saturate the disk.
env:
TEMP: 'D:\a\_temp'
TMP: 'D:\a\_temp'
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
# The runner's screen (1024x768 by default) is smaller than the browser window the e2e open (1936x1048 for a 1920x1080 identity), so the
# OS cursor cannot be parked outside it (tests/_os_cursor.py) and a native move for it reaches the page. 1920x1080 is the largest mode the
# runner's video device accepts (run 45730213378 of oss-invisible/playwright): it leaves the strip below the window free. Declared here, read back.
- name: The runner's screen is 1920x1080, larger than the browser window is tall (read back)
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Add-Type -AssemblyName System.Windows.Forms
$b = [System.Windows.Forms.SystemInformation]::VirtualScreen
"the runner's screen: $($b.Width)x$($b.Height) at $($b.X),$($b.Y)"
if ($b.Width -lt 1920 -or $b.Height -lt 1080) { Write-Error "the runner's screen is $($b.Width)x$($b.Height), not 1920x1080: the OS cursor could not be parked outside the browser window"; exit 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
# The native crash of the pytest worker ("node down: Not properly terminated", "Windows fatal exception: access violation" in a thread Python has no state for, jobs
# 138402013609 and 138966622085): Windows Error Reporting writes a FULL dump of a python.exe that dies from an unhandled exception, into the evidence folder the job
# uploads (dumps/python), so the faulting module and stack can be read. HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<image>, DumpType 2 = full,
# DumpCount = how many are kept: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps . faulthandler (pytest enables it) is a vectored handler that
# returns EXCEPTION_CONTINUE_SEARCH, so WER still sees the exception. BEFORE the first pytest step; the summary step before the upload reads what it left.
- name: Windows Error Reporting keeps a full dump of a python.exe that crashes (into the evidence)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$dumps = Join-Path $env:RUNNER_TEMP 'invpw-evidence\dumps\python'
New-Item -ItemType Directory -Force -Path $dumps | Out-Null
$wer = 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting'
New-Item -Force -Path $wer | Out-Null
New-ItemProperty -Force -Path $wer -Name Disabled -PropertyType DWord -Value 0 | Out-Null
New-ItemProperty -Force -Path $wer -Name DontShowUI -PropertyType DWord -Value 1 | Out-Null
$key = "$wer\LocalDumps\python.exe"
New-Item -Force -Path $key | Out-Null
New-ItemProperty -Force -Path $key -Name DumpFolder -PropertyType ExpandString -Value $dumps | Out-Null
New-ItemProperty -Force -Path $key -Name DumpType -PropertyType DWord -Value 2 | Out-Null
New-ItemProperty -Force -Path $key -Name DumpCount -PropertyType DWord -Value 3 | Out-Null
Get-ItemProperty -Path $key | Format-List DumpFolder, DumpType, DumpCount
Get-ItemProperty -Path $wer | Format-List Disabled, DontShowUI
# The one variable tests/conftest.py reads (tests/_wer_error_mode.py): every pytest process of the later steps clears SEM_NOGPFAULTERRORBOX of its error mode, which the
# runner gives it and which would keep a crashing worker from ever reaching the LocalDumps above, and says so in dumps/error-mode.log.
"INVPW_WER_DUMPS=$dumps" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
if: github.event_name == 'pull_request'
shell: bash
@@ -932,6 +1104,10 @@ jobs:
run: |
Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
"left: " + @(Get-Process firefox -ErrorAction SilentlyContinue).Count
- name: What Windows Error Reporting kept of a crashing python.exe (size, faulting module, in the evidence)
if: always()
shell: bash
run: python scripts/ci_wer_dumps.py "$RUNNER_TEMP/invpw-evidence/dumps/python"
- name: Upload what the test saved
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -1045,14 +1221,54 @@ jobs:
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
runs-on: windows-2022
timeout-minutes: 45
# TEMP and TMP on D:\a\_temp, as every Windows job that launches a browser (see e2e-windows): on C: the profiles saturate the disk.
env:
TEMP: 'D:\a\_temp'
TMP: 'D:\a\_temp'
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
# The runner's screen (1024x768 by default) is smaller than the browser window the e2e open (1936x1048 for a 1920x1080 identity), so the
# OS cursor cannot be parked outside it (tests/_os_cursor.py) and a native move for it reaches the page. 1920x1080 is the largest mode the
# runner's video device accepts (run 45730213378 of oss-invisible/playwright): it leaves the strip below the window free. Declared here, read back.
- name: The runner's screen is 1920x1080, larger than the browser window is tall (read back)
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Add-Type -AssemblyName System.Windows.Forms
$b = [System.Windows.Forms.SystemInformation]::VirtualScreen
"the runner's screen: $($b.Width)x$($b.Height) at $($b.X),$($b.Y)"
if ($b.Width -lt 1920 -or $b.Height -lt 1080) { Write-Error "the runner's screen is $($b.Width)x$($b.Height), not 1920x1080: the OS cursor could not be parked outside the browser window"; exit 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
# The native crash of the pytest worker ("node down: Not properly terminated", "Windows fatal exception: access violation" in a thread Python has no state for, jobs
# 138402013609 and 138966622085): Windows Error Reporting writes a FULL dump of a python.exe that dies from an unhandled exception, into the evidence folder the job
# uploads (dumps/python), so the faulting module and stack can be read. HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<image>, DumpType 2 = full,
# DumpCount = how many are kept: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps . faulthandler (pytest enables it) is a vectored handler that
# returns EXCEPTION_CONTINUE_SEARCH, so WER still sees the exception. BEFORE the first pytest step; the summary step before the upload reads what it left.
- name: Windows Error Reporting keeps a full dump of a python.exe that crashes (into the evidence)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$dumps = Join-Path $env:RUNNER_TEMP 'invpw-evidence\dumps\python'
New-Item -ItemType Directory -Force -Path $dumps | Out-Null
$wer = 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting'
New-Item -Force -Path $wer | Out-Null
New-ItemProperty -Force -Path $wer -Name Disabled -PropertyType DWord -Value 0 | Out-Null
New-ItemProperty -Force -Path $wer -Name DontShowUI -PropertyType DWord -Value 1 | Out-Null
$key = "$wer\LocalDumps\python.exe"
New-Item -Force -Path $key | Out-Null
New-ItemProperty -Force -Path $key -Name DumpFolder -PropertyType ExpandString -Value $dumps | Out-Null
New-ItemProperty -Force -Path $key -Name DumpType -PropertyType DWord -Value 2 | Out-Null
New-ItemProperty -Force -Path $key -Name DumpCount -PropertyType DWord -Value 3 | Out-Null
Get-ItemProperty -Path $key | Format-List DumpFolder, DumpType, DumpCount
Get-ItemProperty -Path $wer | Format-List Disabled, DontShowUI
# The one variable tests/conftest.py reads (tests/_wer_error_mode.py): every pytest process of the later steps clears SEM_NOGPFAULTERRORBOX of its error mode, which the
# runner gives it and which would keep a crashing worker from ever reaching the LocalDumps above, and says so in dumps/error-mode.log.
"INVPW_WER_DUMPS=$dumps" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
if: github.event_name == 'pull_request'
shell: bash
@@ -1095,6 +1311,10 @@ jobs:
run: |
Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
"left: " + @(Get-Process firefox -ErrorAction SilentlyContinue).Count
- name: What Windows Error Reporting kept of a crashing python.exe (size, faulting module, in the evidence)
if: always()
shell: bash
run: python scripts/ci_wer_dumps.py "$RUNNER_TEMP/invpw-evidence/dumps/python"
- name: Upload what the test saved
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -1234,6 +1454,10 @@ jobs:
if: needs.core-on-index.outputs.available == 'true' && needs.e2e-page-final-touched.outputs.touched == 'true'
runs-on: windows-2022
timeout-minutes: 40
# TEMP and TMP on D:\a\_temp, as every Windows job that launches a browser (see e2e-windows): on C: the profiles saturate the disk.
env:
TEMP: 'D:\a\_temp'
TMP: 'D:\a\_temp'
strategy:
fail-fast: false
matrix:
@@ -1244,8 +1468,44 @@ jobs:
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with: { fetch-depth: 1 }
# The runner's screen (1024x768 by default) is smaller than the browser window the e2e open (1936x1048 for a 1920x1080 identity), so the
# OS cursor cannot be parked outside it (tests/_os_cursor.py) and a native move for it reaches the page. 1920x1080 is the largest mode the
# runner's video device accepts (run 45730213378 of oss-invisible/playwright): it leaves the strip below the window free. Declared here, read back.
- name: The runner's screen is 1920x1080, larger than the browser window is tall (read back)
shell: pwsh
run: |
Set-DisplayResolution -Width 1920 -Height 1080 -Force
Add-Type -AssemblyName System.Windows.Forms
$b = [System.Windows.Forms.SystemInformation]::VirtualScreen
"the runner's screen: $($b.Width)x$($b.Height) at $($b.X),$($b.Y)"
if ($b.Width -lt 1920 -or $b.Height -lt 1080) { Write-Error "the runner's screen is $($b.Width)x$($b.Height), not 1920x1080: the OS cursor could not be parked outside the browser window"; exit 1 }
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with: { python-version: '3.11' }
# The native crash of the pytest worker ("node down: Not properly terminated", "Windows fatal exception: access violation" in a thread Python has no state for, jobs
# 138402013609 and 138966622085): Windows Error Reporting writes a FULL dump of a python.exe that dies from an unhandled exception, into the evidence folder the job
# uploads (dumps/python), so the faulting module and stack can be read. HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\<image>, DumpType 2 = full,
# DumpCount = how many are kept: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps . faulthandler (pytest enables it) is a vectored handler that
# returns EXCEPTION_CONTINUE_SEARCH, so WER still sees the exception. BEFORE the first pytest step; the summary step before the upload reads what it left.
- name: Windows Error Reporting keeps a full dump of a python.exe that crashes (into the evidence)
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$dumps = Join-Path $env:RUNNER_TEMP 'invpw-evidence\dumps\python'
New-Item -ItemType Directory -Force -Path $dumps | Out-Null
$wer = 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting'
New-Item -Force -Path $wer | Out-Null
New-ItemProperty -Force -Path $wer -Name Disabled -PropertyType DWord -Value 0 | Out-Null
New-ItemProperty -Force -Path $wer -Name DontShowUI -PropertyType DWord -Value 1 | Out-Null
$key = "$wer\LocalDumps\python.exe"
New-Item -Force -Path $key | Out-Null
New-ItemProperty -Force -Path $key -Name DumpFolder -PropertyType ExpandString -Value $dumps | Out-Null
New-ItemProperty -Force -Path $key -Name DumpType -PropertyType DWord -Value 2 | Out-Null
New-ItemProperty -Force -Path $key -Name DumpCount -PropertyType DWord -Value 3 | Out-Null
Get-ItemProperty -Path $key | Format-List DumpFolder, DumpType, DumpCount
Get-ItemProperty -Path $wer | Format-List Disabled, DontShowUI
# The one variable tests/conftest.py reads (tests/_wer_error_mode.py): every pytest process of the later steps clears SEM_NOGPFAULTERRORBOX of its error mode, which the
# runner gives it and which would keep a crashing worker from ever reaching the LocalDumps above, and says so in dumps/error-mode.log.
"INVPW_WER_DUMPS=$dumps" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
run: |
python -m pip install --upgrade pip
@@ -1284,6 +1544,10 @@ jobs:
run: |
Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
"left: " + @(Get-Process firefox -ErrorAction SilentlyContinue).Count
- name: What Windows Error Reporting kept of a crashing python.exe (size, faulting module, in the evidence)
if: always()
shell: bash
run: python scripts/ci_wer_dumps.py "$RUNNER_TEMP/invpw-evidence/dumps/python"
- name: Upload what the test saved
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
+5
View File
@@ -69,6 +69,11 @@ jobs:
needs: [core-on-index, linux-deps-fakeweb]
if: needs.core-on-index.outputs.available == 'true'
runs-on: ${{ matrix.runner }}
# 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: ${{ startsWith(matrix.runner, 'windows') && 'D:\a\_temp' || '/tmp' }}
TMP: ${{ startsWith(matrix.runner, 'windows') && 'D:\a\_temp' || '/tmp' }}
timeout-minutes: 30
strategy:
fail-fast: false
@@ -50,6 +50,11 @@ jobs:
needs: core-on-index
if: needs.core-on-index.outputs.available == 'true'
runs-on: ${{ matrix.os }}
# 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:
+44
View File
@@ -0,0 +1,44 @@
# ─────────────────────────────────────────────────────────────────────────────
# published-set.yml - the control side of the A/B oracles is the last PUBLISHED SET, and this keeps its lock equal to the index.
#
# An A/B oracle holds a candidate against the engine published before it, and that engine is launched by the core it was built for (it refuses a launch whose
# declarations that core does not emit). So the control is a set: the last `invisible-playwright` on the index, the `invisible-core` it pins exactly, and the engine
# that core's seal pins, in a venv of their own, installed by hash (ci-03): ci/py-lock/published.txt, made by scripts/ci_published_set.py. Nothing in it is chosen
# by hand; a new release is the new baseline.
#
# The lock is a committed file so that a run installs it offline (the wheelhouse of the run holds the files it names). What can go stale is the lock, the day a
# release is published: this reads the index (the JSON of the two packages, nothing is installed or run) and is RED when the committed lock is not the index's last
# release. The fix is one command, `python scripts/ci_published_set.py resolve --write`, in the pull request that records the release.
# ─────────────────────────────────────────────────────────────────────────────
name: published-set
on:
schedule:
- cron: "41 5 * * *"
pull_request:
paths:
- ci/py-lock/published.txt
- scripts/ci_published_set.py
- .github/workflows/published-set.yml
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
lock-is-the-index:
name: the committed published set is the index's last release
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out the lock and the script
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 (v4.4.0)
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 (v5.6.0)
with:
python-version: "3.12"
- name: The lock against the index (reads the index, installs nothing)
run: python scripts/ci_published_set.py check
+9
View File
@@ -164,7 +164,11 @@ jobs:
fail-fast: false # one system failing must not hide the other's table
matrix:
os: [ubuntu-24.04, windows-latest]
# 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: ${{ startsWith(matrix.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
TMP: ${{ startsWith(matrix.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
VERSION: ${{ needs.plan.outputs.version }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@@ -272,6 +276,11 @@ jobs:
needs: [plan, linux-deps-real-sites]
if: needs.plan.outputs.admission == 'true'
runs-on: ${{ matrix.os }}
# 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: ${{ startsWith(matrix.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
TMP: ${{ startsWith(matrix.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
timeout-minutes: 40
strategy:
fail-fast: false
+5
View File
@@ -171,6 +171,11 @@ jobs:
needs: core-on-index
if: needs.core-on-index.outputs.available == 'true'
runs-on: ${{ matrix.os }}
# 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: ${{ startsWith(matrix.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
TMP: ${{ startsWith(matrix.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
strategy:
fail-fast: false
matrix:
+11 -3
View File
@@ -91,6 +91,11 @@ jobs:
needs: linux-deps-user-install
name: ${{ matrix.os }} - install from ${{ github.event.inputs.source || 'index' }} and launch
runs-on: ${{ matrix.os }}
# 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: ${{ startsWith(matrix.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
TMP: ${{ startsWith(matrix.os, 'windows') && 'D:\a\_temp' || '/tmp' }}
timeout-minutes: 45
strategy:
fail-fast: false # one OS failing must not hide the other's result
@@ -103,12 +108,15 @@ jobs:
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 (v5.6.0)
with: { python-version: '3.11' }
# Only what the TEST needs (and `uv`, for the wait below to ask uv, which the release test installs the package with). The package under test is installed by the
# Only what the TEST needs, from the wrapper's hashed lock (ci/py-lock/gate.txt), the one the other test jobs read: never a hand list, which is how
# `psutil` (imported by the OS-cursor helper of the tests since #609) was missing here and ledger #618 was red. The lock holds `uv` (the wait below asks it, and the
# release test installs the package with it) and holds neither invisible-playwright nor invisible-core: the package under test is installed by the
# test itself, into a venv it creates, from the index - installing it
# here as well would put a second copy on the path and the assertions
# would be reading the wrong one.
# would be reading the wrong one. The runner's own pip, nothing unhashed.
# A rule test of the unit suite (the install job has every module its tests import) holds every third-party module the tests import to that lock.
- name: Test harness only
run: python -m pip install --upgrade pip pytest packaging uv
run: python -m pip install --require-hashes -r ci/py-lock/gate.txt
# ⛔ THE VERSION OF A LEDGER PULL REQUEST IS THE ONE IT ADDS TO PUBLISHED.json, NOT THE ONE THE TREE DECLARES.
# The ledger PR of a release is merged after this job is green, and the next release's tree can already be on main: ledger #534 recorded
+44
View File
@@ -4,6 +4,50 @@ 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).
## [Unreleased]
### Changed
- **Breaking:** the environment variable `INVPW_TRUE_HEADLESS` is retired and is now refused at launch, on the sync, the async and the server
entry points, with an error that says to unset it. The product always runs a real browser window on a hidden display; it no longer
has a second mode that runs without a window.
## [0.61.0] - 2026-11-30
### Changed
- Pins invisible-core 71.85.0 on the engine firefox-71 (Firefox 159.0).
- The window origin is declared by the core, and the screen coordinates a page reads go through it, in the top document and in an
out-of-process frame of another site: such a frame used to read the top document's origin without its own position.
- The end point of a drag is mapped through the window of the drag source, and tooltips and autoscroll open at the real pointer.
- A popup's position and outer size are set when it opens by Firefox's own rule, and a positioned popup is kept on the declared screen by
Firefox's own clamp; the core no longer declares a popup position.
- The height of the maximized browser chrome follows Firefox's toolbar density rule, and the window frame is computed from the system
metrics at the declared scale: at 125% the bar above the page is 106 device pixels, as in retail Firefox 159, where 0.60.0 declared 107.
- The core accepts exactly the display scales Windows offers (100% to 500%), and refuses a scale the declared screen does not offer.
### Fixed
- The load of a frame waits for the processes below it, a navigation that does not create a new document no longer releases a frame, and
the ready of a page is told once, after its document.
- Drag and drop driven by the client reaches a frame of another site: the drag has one session, owned by the browser process, as a real
drag does; `dragend` ends at the screen point of the declared window, the drag events carry the buttons held, and `drag` fires at the
source.
- A select dropdown opened by a click no longer closes on that click's own release: menus close on the next press or wheel, as with a
real mouse, never on a release or a move.
- `wait_for_selector(state="hidden")` returns at once when nothing matches and never returns a handle, as stock Playwright does.
- A font face that our text code used after it could be released (a dangling HarfBuzz face pointer) is now held by its own type.
- Through a UDP proxy, an IPv6 socket reaches its IPv4 relay after the association too.
## [0.60.0] - 2026-11-27
### Changed
- Pins invisible-core 70.83.0 on the engine firefox-70 (Firefox 159.0).
- The engine carries Firefox's fix for the race between the start and the shutdown of its telemetry (Glean): a browser closed while it was
still starting no longer leaves that work half done.
- ElementHandle pointer actions (`click`, `dblclick`, `hover`, `tap`, `check`, `uncheck`, `set_checked`) now use the same humanised pointer walk as selector actions (they used to jump to the exact centre of the element in one move).
- Screenshot parameters that Playwright honours by modifying the page (`mask`/`maskColor`, `style`, `animations="disabled"`,
`caret="initial"`) are now refused by name with a clear error instead of being silently ignored; `omitBackground` with PNG answers
Firefox's own `Not implemented`, as stock Playwright does. A refused screenshot of an element or a locator is refused before the page is
scrolled or measured.
## [0.59.0] - 2026-11-24
### Changed
+1630
View File
File diff suppressed because it is too large. Load diff
+1 -11
View File
@@ -1,14 +1,4 @@
{
"format": "ab-host-expected/1",
"differences": [
{
"id": "gfxtest-69",
"os": "linux",
"category": "proc",
"name": "gfxtest",
"published": "present",
"candidate": "absent",
"reason": "the 69 no longer spawns the graphics probe gfxtest (GFX_PROBE_BINARY, widget/gtk/GfxInfo.cpp:55; commit 0e896e4ee1, the probe never reads the host); the paths only that process touched go with it"
}
]
"differences": []
}
+749
View File
@@ -0,0 +1,749 @@
{
"format": "ab-oracle-expected/1",
"differences": [
{
"id": "linux-seed6-state.after_fullscreen.events.mousemove",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "state.after_fullscreen.events.mousemove",
"published": [
[
0,
86
],
[
0,
85
]
],
"candidate": [
[
0,
85
],
[
0,
84
]
],
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: the distinct (screenY - clientY) that a mousemove event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed6-state.after_fullscreen.innerHeight",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "state.after_fullscreen.innerHeight",
"published": 730,
"candidate": 731,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "linux-seed6-state.after_fullscreen.mozInnerScreenY",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "state.after_fullscreen.mozInnerScreenY",
"published": 85.5999984741211,
"candidate": 84.80000305175781,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "linux-seed6-state.normal.events.mousemove",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "state.normal.events.mousemove",
"published": [
[
0,
86
],
[
0,
85
]
],
"candidate": [
[
0,
85
],
[
0,
84
]
],
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: the distinct (screenY - clientY) that a mousemove event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed6-state.normal.innerHeight",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "state.normal.innerHeight",
"published": 730,
"candidate": 731,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "linux-seed6-state.normal.mozInnerScreenY",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "state.normal.mozInnerScreenY",
"published": 85.5999984741211,
"candidate": 84.80000305175781,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "linux-seed6-surface.visualViewport.height",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "surface.visualViewport.height",
"published": 730.4000244140625,
"candidate": 731.2000122070312,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: visualViewport.height, the viewport height in CSS px."
},
{
"id": "linux-seed6-surface.window.innerHeight",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "surface.window.innerHeight",
"published": 730,
"candidate": 731,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "linux-seed6-surface.window.mozInnerScreenY",
"os": "linux",
"seed": 6,
"dpr": 1.25,
"leaf": "surface.window.mozInnerScreenY",
"published": 85.5999984741211,
"candidate": 84.80000305175781,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "linux-seed63-state.after_fullscreen.events.click",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.events.click",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a click event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed63-state.after_fullscreen.events.mousedown",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.events.mousedown",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mousedown event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed63-state.after_fullscreen.events.mousemove",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.events.mousemove",
"published": [
[
0,
85
],
[
0,
84
]
],
"candidate": [
[
0,
73
],
[
0,
72
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mousemove event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed63-state.after_fullscreen.events.mouseup",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.events.mouseup",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mouseup event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed63-state.after_fullscreen.innerHeight",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.innerHeight",
"published": 587,
"candidate": 599,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "linux-seed63-state.after_fullscreen.mozInnerScreenY",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.mozInnerScreenY",
"published": 84.66666412353516,
"candidate": 72.66666412353516,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "linux-seed63-state.normal.events.click",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.events.click",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a click event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed63-state.normal.events.mousedown",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.events.mousedown",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mousedown event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed63-state.normal.events.mousemove",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.events.mousemove",
"published": [
[
0,
85
],
[
0,
84
]
],
"candidate": [
[
0,
72
],
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mousemove event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed63-state.normal.events.mouseup",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.events.mouseup",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mouseup event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "linux-seed63-state.normal.innerHeight",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.innerHeight",
"published": 587,
"candidate": 599,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "linux-seed63-state.normal.mozInnerScreenY",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.mozInnerScreenY",
"published": 84.66666412353516,
"candidate": 72.66666412353516,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "linux-seed63-surface.visualViewport.height",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "surface.visualViewport.height",
"published": 587.3333129882812,
"candidate": 599.3333129882812,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: visualViewport.height, the viewport height in CSS px."
},
{
"id": "linux-seed63-surface.window.innerHeight",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "surface.window.innerHeight",
"published": 587,
"candidate": 599,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "linux-seed63-surface.window.mozInnerScreenY",
"os": "linux",
"seed": 63,
"dpr": 1.5,
"leaf": "surface.window.mozInnerScreenY",
"published": 84.66666412353516,
"candidate": 72.66666412353516,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "windows-seed6-state.after_fullscreen.events.mousemove",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "state.after_fullscreen.events.mousemove",
"published": [
[
0,
86
],
[
0,
85
]
],
"candidate": [
[
0,
85
],
[
0,
84
]
],
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: the distinct (screenY - clientY) that a mousemove event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed6-state.after_fullscreen.innerHeight",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "state.after_fullscreen.innerHeight",
"published": 730,
"candidate": 731,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "windows-seed6-state.after_fullscreen.mozInnerScreenY",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "state.after_fullscreen.mozInnerScreenY",
"published": 85.5999984741211,
"candidate": 84.80000305175781,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "windows-seed6-state.normal.events.mousemove",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "state.normal.events.mousemove",
"published": [
[
0,
86
],
[
0,
85
]
],
"candidate": [
[
0,
85
],
[
0,
84
]
],
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: the distinct (screenY - clientY) that a mousemove event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed6-state.normal.innerHeight",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "state.normal.innerHeight",
"published": 730,
"candidate": 731,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "windows-seed6-state.normal.mozInnerScreenY",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "state.normal.mozInnerScreenY",
"published": 85.5999984741211,
"candidate": 84.80000305175781,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "windows-seed6-surface.visualViewport.height",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "surface.visualViewport.height",
"published": 730.4000244140625,
"candidate": 731.2000122070312,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: visualViewport.height, the viewport height in CSS px."
},
{
"id": "windows-seed6-surface.window.innerHeight",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "surface.window.innerHeight",
"published": 730,
"candidate": 731,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "windows-seed6-surface.window.mozInnerScreenY",
"os": "windows",
"seed": 6,
"dpr": 1.25,
"leaf": "surface.window.mozInnerScreenY",
"published": 85.5999984741211,
"candidate": 84.80000305175781,
"reason": "Seed 6 is at 1.25. The bar of a main window, client top to content top, is 106 device px in retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406), not the 107 that the published engine's core declares; the candidate's core computes it with window_frame.chrome_height_device(1.25, 'normal'), which rounds the tab strip, the nav bar and the content border once, on the sum in app units (_offset_device), and the page gets 106 device px = 84.8 CSS px. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "windows-seed63-state.after_fullscreen.events.click",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.events.click",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a click event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed63-state.after_fullscreen.events.mousedown",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.events.mousedown",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mousedown event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed63-state.after_fullscreen.events.mousemove",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.events.mousemove",
"published": [
[
0,
85
],
[
0,
84
]
],
"candidate": [
[
0,
73
],
[
0,
72
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mousemove event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed63-state.after_fullscreen.events.mouseup",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.events.mouseup",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mouseup event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed63-state.after_fullscreen.innerHeight",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.innerHeight",
"published": 587,
"candidate": 599,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "windows-seed63-state.after_fullscreen.mozInnerScreenY",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.after_fullscreen.mozInnerScreenY",
"published": 84.66666412353516,
"candidate": 72.66666412353516,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "windows-seed63-state.normal.events.click",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.events.click",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a click event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed63-state.normal.events.mousedown",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.events.mousedown",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mousedown event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed63-state.normal.events.mousemove",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.events.mousemove",
"published": [
[
0,
85
],
[
0,
84
]
],
"candidate": [
[
0,
72
],
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mousemove event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed63-state.normal.events.mouseup",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.events.mouseup",
"published": [
[
0,
85
]
],
"candidate": [
[
0,
73
]
],
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: the distinct (screenY - clientY) that a mouseup event of the page was seen with, in CSS px: the bar above the content as the page reads it from a pointer event."
},
{
"id": "windows-seed63-state.normal.innerHeight",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.innerHeight",
"published": 587,
"candidate": 599,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "windows-seed63-state.normal.mozInnerScreenY",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "state.normal.mozInnerScreenY",
"published": 84.66666412353516,
"candidate": 72.66666412353516,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
},
{
"id": "windows-seed63-surface.visualViewport.height",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "surface.visualViewport.height",
"published": 587.3333129882812,
"candidate": 599.3333129882812,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: visualViewport.height, the viewport height in CSS px."
},
{
"id": "windows-seed63-surface.window.innerHeight",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "surface.window.innerHeight",
"published": 587,
"candidate": 599,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.innerHeight, the viewport height in CSS px."
},
{
"id": "windows-seed63-surface.window.mozInnerScreenY",
"os": "windows",
"seed": 63,
"dpr": 1.5,
"leaf": "surface.window.mozInnerScreenY",
"published": 84.66666412353516,
"candidate": 72.66666412353516,
"reason": "Seed 63 is at 1.5, and the work area of its screen is under 720 CSS px high (about 693 on a 1920x1080 panel), so retail Firefox 159 chooses the compact density by itself (browser.js gUIDensity: compact while 36 CSS px over the reference height is more than browser.compactmode.auto.threshold 0.05, that is below 720 CSS px; RetailCaptures analysis/window-geometry/chrome-density; retail Firefox 159 on Windows, measured by the core's retail window-geometry capture workflow (rounds 2 and 3, runs 45672953042 and 45679625406)). The bar is the compact 109 device px = 73 CSS px, not the normal 127 device px = 85 CSS px that the published engine's core declares: the core's constants.ui_density and declared_maximized_ui pick the density, window_frame.chrome_height_device(1.5, 'compact') gives the bar. This leaf: window.mozInnerScreenY, the screen Y of the content's top in CSS px (the bar above the content)."
}
]
}
-1
View File
@@ -1 +0,0 @@
v69.82.0
-1
View File
@@ -1 +0,0 @@
45621332479
File diff suppressed because it is too large. Load diff
+18
View File
@@ -0,0 +1,18 @@
[
{
"id": "D31",
"bug": "",
"firefox": {
"from": "159.0",
"to": "159.*"
},
"signature": {
"process": "backgroundtask",
"phase": "exit",
"thread": "FSBroker",
"reason": "MOZ_CRASH(mozilla::detail::MutexImpl::mutexLock: pthread_mutex_lock failed)"
},
"seen": "oss-invisible/firefox_antidetect_patch/actions/runs/46539190316/job/142310624770",
"why": "at the exit of a -backgroundtask process the FSBroker thread unregisters from the profiler after the static destructors ran and locks a destroyed mutex"
}
]
+32 -32
View File
@@ -6,7 +6,7 @@
6,
63
],
"core_version": "69.82.0",
"core_version": "71.85.0",
"counts": {
"audio": {
"audio.sample_rate=44100|audio.output_latency_ms=20|audio.max_channel_count=2": 4315,
@@ -50,9 +50,9 @@
"ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0": 40144
},
"dpr": {
"layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72": 70210,
"layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.maximized_ui=107|screen.popup_ui=90": 18299,
"layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.maximized_ui=127|screen.popup_ui=106": 11491
"layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31": 70210,
"layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.popup_ui=89|screen.popup_client_top=38": 18299,
"layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.popup_ui=106|screen.popup_client_top=45": 11491
},
"gfx_device": {
"adliris_7085": 7197,
@@ -156,9 +156,9 @@
"ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0"
],
"dpr": [
"layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.maximized_ui=107|screen.popup_ui=90",
"layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.maximized_ui=127|screen.popup_ui=106"
"layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.popup_ui=89|screen.popup_client_top=38",
"layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.popup_ui=106|screen.popup_client_top=45"
],
"gfx_device": [
"adliris_7085",
@@ -254,7 +254,7 @@
"codecs": "media.av1.enabled=false|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:9c24a8728f",
"cores": "hw_concurrency=12",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "rtx5070_62101",
"gfx_feature_status": "gfx.feature_status=sha:b153aef69f",
"render_noise": "fpp.hw_seed=5",
@@ -266,7 +266,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=22",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "uhd630_2145",
"gfx_feature_status": "gfx.feature_status=sha:80c00ab015",
"render_noise": "fpp.hw_seed=6",
@@ -278,7 +278,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=32",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.maximized_ui=127|screen.popup_ui=106",
"dpr": "layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.popup_ui=106|screen.popup_client_top=45",
"gfx_device": "rpl770_7092",
"gfx_feature_status": "gfx.feature_status=sha:05ce56d3c0",
"render_noise": "fpp.hw_seed=16",
@@ -290,7 +290,7 @@
"codecs": "media.av1.enabled=false|media.encoder.webm.enabled=false|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:9c24a8728f",
"cores": "hw_concurrency=5",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "gtx980_58278",
"gfx_feature_status": "gfx.feature_status=sha:b153aef69f",
"render_noise": "fpp.hw_seed=6",
@@ -302,7 +302,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=24",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.maximized_ui=107|screen.popup_ui=90",
"dpr": "layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.popup_ui=89|screen.popup_client_top=38",
"gfx_device": "adliris_7085",
"gfx_feature_status": "gfx.feature_status=sha:05ce56d3c0",
"render_noise": "fpp.hw_seed=5",
@@ -314,7 +314,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=false|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=6",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "gtx1650_62101",
"gfx_feature_status": "gfx.feature_status=sha:b153aef69f",
"render_noise": "fpp.hw_seed=20",
@@ -326,7 +326,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=20",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "uhd620_2145",
"gfx_feature_status": "gfx.feature_status=sha:d1db3983c9",
"render_noise": "fpp.hw_seed=28",
@@ -338,7 +338,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=false|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=8",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "renoir_21925",
"gfx_feature_status": "gfx.feature_status=sha:2f5fe3776b",
"render_noise": "fpp.hw_seed=16",
@@ -350,7 +350,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=14",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "rtx3060_62101",
"gfx_feature_status": "gfx.feature_status=sha:b153aef69f",
"render_noise": "fpp.hw_seed=19",
@@ -362,7 +362,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=false|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=16",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.maximized_ui=107|screen.popup_ui=90",
"dpr": "layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.popup_ui=89|screen.popup_client_top=38",
"gfx_device": "rx580_21925",
"gfx_feature_status": "gfx.feature_status=sha:2f5fe3776b",
"render_noise": "fpp.hw_seed=20",
@@ -374,7 +374,7 @@
"codecs": "media.av1.enabled=false|media.encoder.webm.enabled=false|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:9c24a8728f",
"cores": "hw_concurrency=28",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "irisxe_7085",
"gfx_feature_status": "gfx.feature_status=sha:05ce56d3c0",
"render_noise": "fpp.hw_seed=6",
@@ -386,7 +386,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=false|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=4",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "icl_2145",
"gfx_feature_status": "gfx.feature_status=sha:80c00ab015",
"render_noise": "fpp.hw_seed=11",
@@ -398,7 +398,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=12",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "uhd630_2145",
"gfx_feature_status": "gfx.feature_status=sha:80c00ab015",
"render_noise": "fpp.hw_seed=5",
@@ -410,7 +410,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=8",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "rx6600_32015",
"gfx_feature_status": "gfx.feature_status=sha:2f5fe3776b",
"render_noise": "fpp.hw_seed=5",
@@ -422,7 +422,7 @@
"codecs": "media.av1.enabled=false|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:9c24a8728f",
"cores": "hw_concurrency=4",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "rtx5060_62101",
"gfx_feature_status": "gfx.feature_status=sha:b153aef69f",
"render_noise": "fpp.hw_seed=28",
@@ -434,7 +434,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=8",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.maximized_ui=127|screen.popup_ui=106",
"dpr": "layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.popup_ui=106|screen.popup_client_top=45",
"gfx_device": "arl_6629",
"gfx_feature_status": "gfx.feature_status=sha:098c0bf836",
"render_noise": "fpp.hw_seed=19",
@@ -446,7 +446,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=false|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=3",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "rtx5080l_61742",
"gfx_feature_status": "gfx.feature_status=sha:b153aef69f",
"render_noise": "fpp.hw_seed=28",
@@ -458,7 +458,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=false|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=12",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.maximized_ui=107|screen.popup_ui=90",
"dpr": "layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.popup_ui=89|screen.popup_client_top=38",
"gfx_device": "adliris_7085",
"gfx_feature_status": "gfx.feature_status=sha:05ce56d3c0",
"render_noise": "fpp.hw_seed=19",
@@ -470,7 +470,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=false|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=7",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.maximized_ui=107|screen.popup_ui=90",
"dpr": "layout.css.devPixelsPerPx=\"1.25\"|screen.frame_border=9|screen.popup_ui=89|screen.popup_client_top=38",
"gfx_device": "rx7600_32015",
"gfx_feature_status": "gfx.feature_status=sha:2f5fe3776b",
"render_noise": "fpp.hw_seed=11",
@@ -482,7 +482,7 @@
"codecs": "media.av1.enabled=false|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:9c24a8728f",
"cores": "hw_concurrency=32",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.maximized_ui=127|screen.popup_ui=106",
"dpr": "layout.css.devPixelsPerPx=\"1.5\"|screen.frame_border=11|screen.popup_ui=106|screen.popup_client_top=45",
"gfx_device": "rx7600_32015",
"gfx_feature_status": "gfx.feature_status=sha:2f5fe3776b",
"render_noise": "fpp.hw_seed=5",
@@ -494,7 +494,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=4",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "rtx5060ti_62101",
"gfx_feature_status": "gfx.feature_status=sha:b153aef69f",
"render_noise": "fpp.hw_seed=11",
@@ -506,7 +506,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=10",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "uhd770_7092",
"gfx_feature_status": "gfx.feature_status=sha:05ce56d3c0",
"render_noise": "fpp.hw_seed=5",
@@ -518,7 +518,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=true|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=9",
"dark_theme": "ui.systemUsesDarkTheme=0|layout.css.prefers-color-scheme.content-override=1",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "rtx4060_62101",
"gfx_feature_status": "gfx.feature_status=sha:b153aef69f",
"render_noise": "fpp.hw_seed=6",
@@ -530,7 +530,7 @@
"codecs": "media.av1.enabled=true|media.encoder.webm.enabled=true|media.mp4.enabled=true|media.webm.enabled=false|media.decode_support=sha:960968735a",
"cores": "hw_concurrency=2",
"dark_theme": "ui.systemUsesDarkTheme=1|layout.css.prefers-color-scheme.content-override=0",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.maximized_ui=85|screen.popup_ui=72",
"dpr": "layout.css.devPixelsPerPx=\"1.0\"|screen.frame_border=8|screen.popup_ui=72|screen.popup_client_top=31",
"gfx_device": "renoir_21925",
"gfx_feature_status": "gfx.feature_status=sha:2f5fe3776b",
"render_noise": "fpp.hw_seed=9",
@@ -562,5 +562,5 @@
],
"format": "persona-seeds/1",
"max_seed": 100000,
"sha256": "8de3d8a621389f707181b9c9569b4d3266931e26f4cb3ea6b64e8f40f3e9dc29"
"sha256": "82547e9f34ece0c17075d812dcc009c7e8e6f348eb33fb4cc5cdbff6253cc4f0"
}
+4 -2
View File
@@ -1,11 +1,12 @@
# Input of the gate lock; `python scripts/ci_py_lock.py` writes it and gate.txt from the sources below. Wrapper-owned (ci-03), read at the wrapper_ref.
# python-version: 3.11
# exclude-newer: 2026-11-25T00:00:00Z
# wrapper: pyproject.toml sha256 3b2ba212158746aeb37a92a36d013b31327d4b5ecf1d2806f19810cccc2f1a37 (at generation); its dependencies without invisible_core, and its `dev` extra
# core: invisible_core==69.82.0, tag v69.82.0, pyproject.toml sha256 c0d14a4d26d3650005076ab72347eb24fba4b89e643f514e7f7334bd0a2ac174 (at generation); the core is a wheel of ours, only what it depends on is locked
# wrapper: pyproject.toml sha256 93d8d0940284352ad53e189e17b9ad6e3109ce52e54ab138ecdfa01d8571b193 (at generation); its dependencies without invisible_core, and its `dev` extra
# core: invisible_core==71.85.0, tag v71.85.0, pyproject.toml sha256 c0d14a4d26d3650005076ab72347eb24fba4b89e643f514e7f7334bd0a2ac174 (at generation); the core is a wheel of ours, only what it depends on is locked
# core-requires: platformdirs>=4 | psutil>=5.9 | requests[socks]>=2.31 | maxminddb>=2.2 | tzdata>=2024.1
# playwright: 1.61.0 from scripts/playwright_pin.txt (the stock client the gate drives the engine with)
# cryptography: 44.0.3 (the lab's PKI)
# harness: uv>=0.5 (the installers of the install-from-index job)
aioquic>=1.2
build>=1
cryptography==44.0.3
@@ -23,4 +24,5 @@ pytest-xdist>=3
requests[socks]>=2.31
ruff>=0.6
tzdata>=2024.1
uv>=0.5
websockets>=13
+21 -1
View File
@@ -1,5 +1,5 @@
# Generated by `python scripts/ci_py_lock.py`: do not edit. Wrapper-owned (ci-03).
# input: ci/py-lock/gate.in sha256 31b110a3356c66a0cb6e9a56b5f27849541f9956ed813b73516e13965ae64081
# input: ci/py-lock/gate.in sha256 7de18cd95f842ff5df52b931d6fb2f318936f54b0ff1be1c8d66df1d6706d9df
# resolver: uv pip compile --universal --generate-hashes --no-build --python-version 3.11 --exclude-newer 2026-11-25T00:00:00Z
# Every file of each version is hashed (Linux and Windows wheels of every Python from 3.11, and the sdist): one lock for every OS.
# A consumer installs it with: pip install --no-index --find-links <wheelhouse> --require-hashes -r <this file>
@@ -668,6 +668,26 @@ tzdata==2026.6 \
urllib3==2.8.0 \
--hash=sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3 \
--hash=sha256:63bf2ead4c879426ebf22ef2a781eeb4aa3b4ae798a0435506f8687fd5bb9b63
uv==0.13.10 \
--hash=sha256:19a76fd50a6a2bba38ee088d8336566856569be08196865f98132a08806581fc \
--hash=sha256:2a9ff188b442419c7aadebc445fcc1f287b25f99af50fa6d563b90cc0047b7cf \
--hash=sha256:30e75714a9cff3aa56281c7bf533a4e93cb5bdfcc0325d3aae54b9106460bd63 \
--hash=sha256:3bf1c1b13cac2533a342ca16b1c5f41347cd399404c9477a04ff79c5f7cb4dea \
--hash=sha256:50bee2a59ea9422b493aabc0cde9288f58fbcf6e8d688c30c4ecd8309459cac1 \
--hash=sha256:5bcf77c50760146ff7b41022ab7aeb1954d42dd47b89fad36b43a1a8a43da994 \
--hash=sha256:771a749b34477501092c9fe6d5e52f45cef944d875b0f2e2c989047a2ee647ab \
--hash=sha256:7cc9c41b43d583e34c781fd3446405b06e9c5fa2db468ce2a534d353db6429e5 \
--hash=sha256:7fa025c4b0f33b9a5357252e1be058d94157e13bfb8ae45d7e27cfce3759c65d \
--hash=sha256:8b0a15613aae9a3e1c134bb5ee706583af0addced7eb1add992f8b1b3e3a92a0 \
--hash=sha256:a52ee170c00d4de1d42026c4dbb00c5d7f327edcf2b2bddeecd0cfb169868ac7 \
--hash=sha256:a9636b4430a9b8a37ecc4d85111d1fd2560ef616edf5301b84f474073bf89e2f \
--hash=sha256:bf7174b00c88879d4a1019b51256bbdb2dd61c55c7dc896031e16d090e380ce6 \
--hash=sha256:c85a2ecb62d09d61904f5405b525fcc51f971d081f8508a881fa2f9bae7543a7 \
--hash=sha256:d87b9cf8165f2b3cc596e856b5bf794da9cfad6d1b110ca9d87eed42a15b3684 \
--hash=sha256:e52a1af7f97b717572f9e2bd69e54eb253b2c88a705500e35811c21106c439d4 \
--hash=sha256:e89dd26ea831dde70639ba0a798fa04a4c7c0226fd2b241da86218bfa370e495 \
--hash=sha256:ee3bca6523ed93c3ae0d1a90c2733be307f5f7cc5287c746214e93a3bae0da13 \
--hash=sha256:ee403b6bbcfda1bc7db269be5c40c1624df27b3b838d3f8a416648e00e2de5d4
websockets==17.4 \
--hash=sha256:00ad98e4bb0df7a6711c645eec16d5a9fdf99f0692bd4f5b6cb85a68677ba8df \
--hash=sha256:0132e3cbd3f5cfc1ec77588961b302d72a02e2603b82c2c23fd5fb59dc4fa206 \
+9
View File
@@ -0,0 +1,9 @@
# The PUBLISHED SET, the control side of the A/B oracles (scripts/ci_published_set.py): the last published invisible-playwright and the invisible-core it pins (its seal pins the engine). Written by `python scripts/ci_published_set.py resolve --write`; .github/workflows/published-set.yml keeps it equal to the index.
# wrapper-requires: greenlet<4.0.0,>=3.1.1 | psutil>=5.9 | pyee<14,>=13
# core-requires: maxminddb>=2.2 | platformdirs>=4 | psutil>=5.9 | requests[socks]>=2.31 | tzdata>=2024.1
invisible-core==70.83.0 \
--hash=sha256:1dff040e41f5aba5aa07e086328ca436291fddbd31514d1bc9a9dbfc4ba7fb6a \
--hash=sha256:f7144262686adf54a4a1c85a8d17f76b31dc4ddcfbd6636d777c5c39963d3293
invisible-playwright==0.60.0 \
--hash=sha256:00509578944ff0d742761d4d5f19fcde21b7657197fa24ab0718e076ebdf9aa6 \
--hash=sha256:7285f5756ad2031087d12f339c2e89b76bdb953449c9151c0edc11a58d96d9c6
+19 -15
View File
@@ -6,27 +6,31 @@
{"id": "wrapper.e2e.doh", "giro": "G2", "os": ["linux", "windows"], "min_tests": 19, "exact": true, "tests": ["tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_ice_names_by_the_context_proxy_e2e.py"], "marker": "e2e", "needs_root": ["linux"], "note": "Linux needs root: the resolver trap of the file (ResolverTrap) points /etc/resolv.conf at a counting resolver on port 53. Su Windows il resolver trap non gira: l'asserzione sul resolver di sistema è l'unica omessa. Run it without xdist (port 53 is one per host). On the Linux leg the gate exports INVPW_REQUIRE_TRAP=1: a trap that cannot run or bind port 53 is a failure, not a skipped assertion."},
{"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": 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.realness", "giro": "G2", "os": ["linux", "windows"], "min_tests": 31, "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": 282, "exact": true, "tests": ["tests/test_a_served_browser_keeps_the_udp_verdicts_of_its_proxies.py", "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.", "moz_log": "DocumentChannel:5,ProcessIsolation:5,nsDocShell:4,DocLoader:4", "juggler_trace": true},
{"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.", "runner_image": {"windows": "windows-2022"}},
{"id": "wrapper.e2e.fakeweb", "giro": "G2", "os": ["linux", "windows"], "min_tests": 7, "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: every step as stock, and every page left only once its noise is done), each judged against what stock Firefox does, as tests/fakeweb/pages.json declares it. 7 = 3 + 4 (the last two: a `load` that takes 20 s is a step that succeeds, and a `load` that never comes ends in an error that names the wait and the page). 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).", "stock_firefox": true, "extra_steps": ["fakeweb_profiles"]},
{"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.e2e.stock_twin.dnd", "giro": "G2", "os": ["linux", "windows"], "min_tests": 8, "exact": true, "tests": ["tests/test_a_drag_from_the_top_into_a_frame_of_another_site_e2e.py", "tests/test_a_press_outside_an_open_datalist_list_ends_as_on_stock_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Split from the row wrapper.e2e.stock_twin, which ran past the 25-minute limit of a leg: one leg. The twin of the real drag from the top into a frame of another site (4 scales): the same steps first on Playwright's own Firefox (stock_firefox), headed, driven by the stock Playwright client, and second on ours; the verdict is 'the same as the reference' (tests/_stock_twin.py). Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The file is in no whole-suite row: the references are installed only for this row's legs. Second file: the twin of a press outside the open list of a datalist (4 scales): the list must be open in chrome on both before the press (else BROKEN CONTROL), and the events the page hears and the state of the list after must be the reference's (the leg took 2 minutes with one file).", "stock_firefox": true},
{"id": "wrapper.e2e.stock_twin.select", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_a_select_dropdown_opens_at_its_element_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Split from the row wrapper.e2e.stock_twin, which ran past the 25-minute limit of a leg: one file, one leg. The twin of the select dropdown (4 scales), measured from chrome scope against RETAIL Firefox 159 driven by Marionette alone, headed (the leg sets INVPW_RETAIL_FIREFOX to its firefox.exe), the reference first and ours second; the verdict is 'the same as the reference' (tests/_stock_twin.py, tests/_retail_reference.py). Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The file is in no whole-suite row: the references are installed only for this row's legs.", "stock_firefox": true},
{"id": "wrapper.e2e.stock_twin.tooltip", "giro": "G2", "os": ["linux", "windows"], "min_tests": 6, "exact": true, "tests": ["tests/test_a_tooltip_opens_at_the_pointer_e2e.py", "tests/test_temp_a_listener_of_a_sandbox_world_is_recorded_on_retail_and_on_ours_e2e.py", "tests/test_temp_the_planted_getters_are_recorded_on_retail_and_on_ours_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Split from the row wrapper.e2e.stock_twin, which ran past the 25-minute limit of a leg: one file, one leg. The twin of the tooltip (4 scales), measured from chrome scope against RETAIL Firefox 159 driven by Marionette alone, headed (the leg sets INVPW_RETAIL_FIREFOX to its firefox.exe), the reference first and ours second; the verdict is 'the same as the reference' (tests/_stock_twin.py, tests/_retail_reference.py). Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The file is in no whole-suite row: the references are installed only for this row's legs. Second file (TEMPORARY, remove with the control it explains): the plant and the page's own read of the getters planted by tests/test_a_pages_own_hasinstance_is_never_called_while_the_client_listens_to_console_e2e.py, run on retail and on ours, dumped side by side to the evidence folder, no verdict about ours. Third file (TEMPORARY, same): what window.onerror is told when a listener registered from another script world (retail: the default sandbox of Marionette's ExecuteScript; ours: the client's evaluate) throws an Error and a non-error, against the page's own throwing listener as control, for the two listener cases of tests/test_a_page_function_called_by_the_client_sees_only_page_frames_e2e.py.", "stock_firefox": true},
{"id": "wrapper.e2e.stock_twin.intersection", "giro": "G2", "os": ["linux", "windows"], "min_tests": 8, "exact": true, "tests": ["tests/test_intersection_and_lazy_loading_in_a_frame_of_another_site_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Split from the row wrapper.e2e.stock_twin, which ran past the 25-minute limit of a leg: one file, one leg. The twin of what the IntersectionObserver of a scrolled frame of another site reads (8 steps, 4 scales) and of when a lazy frame is requested (4 distances, 4 scales): the same steps first on Playwright's own Firefox (stock_firefox), headed, driven by the stock Playwright client, and second on ours; the verdict is 'the same as the reference' (tests/_stock_twin.py). Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The file is in no whole-suite row: the references are installed only for this row's legs.", "stock_firefox": true},
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 9, "exact": true, "tests": ["tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py", "tests/test_the_host_fontconfig_rules_do_not_reach_the_text_pixels_linux_e2e.py", "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 engine runs it on its own empty configuration, and the rules of a user and the files of the host are what these tests try to make reach it. On Windows DirectWrite draws the text from the path of the font, with no rule of a user and no configuration or cache of fonts to read, so these tests have no Windows counterpart.", "note": "7 = (1-3) the fontconfig rules of a user do not reach the pixels of the text a page reads: seven launches of one seed, each with its own system-wide rule file (/etc/fonts/local.conf, written with sudo before the launch and put back after it; not the environment, which the core owns: it strips FONTCONFIG_*, and points XDG_CONFIG_HOME and XDG_CONFIG_DIRS at empty folders): nothing; rgba=none with lcdfilter=lcdnone; rgba=bgr; embeddedbitmap=false; autohint=true; hintstyle=hintfull with antialias=false; a strong prepend rule on system-ui. fc-match, in the same environment, must show each rule in force (a launch that measures nothing is red). Three tests: every rule in force in fc-match on the host; the hashes of the pixels of getImageData (an opaque canvas and the default one, Arial, SimSun, MS Gothic at 9-16 px) equal to those of the launch with nothing; the computed family and the widths of system-ui equal. (4-7) no fontconfig file of the host is opened and the screenshot draws the bundle: the stand-in that runs the engine under strace stays in the engine's place (a fake engine with a child, no browser); the caches $HOME/.fontconfig and $XDG_CACHE_HOME/fontconfig hold a valid cache of the bundle that lacks msgothic5_32.ttc (fc-list proves it); under strace no process opens a path under /etc/fonts, a fonts.conf or a *.cache-* file; the screenshot of Japanese text in MS PGothic equals the content's own drawing. Needs strace, fc-cache, fc-list, fc-match and sudo without a password on the runner: without them the tests are red, not skipped. Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-rules and fontconfig-host-files. Also in the row until the 72 is released: the old file of the warm-cache test (2 tests, same ids), rewritten to assert the 72's behaviour: the stand-in, and two launches with the same XDG_CACHE_HOME and HOME under strace write no fontconfig cache file (*.cache-*, .NEW, .TMP-*) and no process opens one. E1 and E2 replace it; its retirement entry goes to main after the release of the 72."},
{"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": 3650, "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_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.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_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.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_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.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_host_gate_ab.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_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.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_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.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_every_wire_method_is_served_or_refused.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_glean_ready.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/tesLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 3651, "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_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.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_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.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_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.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_host_gate_ab.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_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.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_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.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_every_wire_method_is_served_or_refused.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_glean_ready.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", "testsLine truncated
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 4595, "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_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.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_marionette_session_is_asked_after_the_first_window.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_popup_under_the_declared_viewport_is_not_pinned.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_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_served_browser_keeps_the_udp_verdicts_of_its_proxies.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_an_expired_popupshown_wait_fails_the_e2e_test_that_launched_the_browser.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_host_gate_ab.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_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.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_windows_temp_is_on_d.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_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_fixture_a_test_pins_is_checked_out_byte_for_byte.py", Line truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4607, "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_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.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_marionette_session_is_asked_after_the_first_window.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_popup_under_the_declared_viewport_is_not_pinned.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_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_served_browser_keeps_the_udp_verdicts_of_its_proxies.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_an_expired_popupshown_wait_fails_the_e2e_test_that_launched_the_browser.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_host_gate_ab.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_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.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_windows_temp_is_on_d.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_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_fixture_a_test_pins_is_checked_out_byte_for_byte.pLine 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).", "core_dumps": "invpw-cores"},
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 415, "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_held_ice_port_blinds_the_loopback_checks_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_screenshot_honours_its_scale_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_Line truncated
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 414, "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": 310, "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_file_chooser_reaches_every_client_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_navigation_that_moved_is_told_by_the_engine_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_an_element_handle_serves_every_method_of_the_client_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_argument_reaches_the_page_e2e.py", "tests/test_every_reader_of_a_webgl_canvas_agrees_e2e.py", "tests/test_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_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_host_gl_probe_runs_only_on_an_undeclared_engine_linux_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).", "run": "suite_run"},
{"id": "wrapper.e2e.suite.windows.1", "giro": "G2", "os": ["windows"], "min_tests": 299, "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_held_ice_port_blinds_the_loopback_checks_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_screenshot_honours_its_scale_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).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
{"id": "wrapper.e2e.suite.windows.2", "giro": "G2", "os": ["windows"], "min_tests": 286, "exact": true, "tests": ["tests/test_a_file_chooser_reaches_every_client_e2e.py", "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_navigation_that_moved_is_told_by_the_engine_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_element_handle_serves_every_method_of_the_client_e2e.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_every_argument_reaches_the_page_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).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
{"id": "wrapper.e2e.suite.windows.3", "giro": "G2", "os": ["windows"], "min_tests": 276, "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).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
{"id": "wrapper.e2e.suite.windows.4", "giro": "G2", "os": ["windows"], "min_tests": 271, "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_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_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).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 447, "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_held_ice_port_blinds_the_loopback_checks_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_screenshot_honours_its_scale_e2e.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page_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_throuLine truncated
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 463, "exact": true, "tests": ["tests/test_a_click_under_the_login_autocomplete_list_reaches_the_page_e2e.py", "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_press_on_an_open_select_follows_windows_rollup_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_select_dropdown_stays_open_after_the_release_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_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py", "tests/test_no_popup_is_left_when_a_page_closes_e2e.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_host_fontconfig_rules_do_not_reach_the_text_pixels_linux_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 Line truncated
{"id": "wrapper.e2e.suite.linux.3", "giro": "G2", "os": ["linux"], "min_tests": 396, "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_file_chooser_reaches_every_client_e2e.py", "tests/test_a_frame_reads_only_declared_origins_while_it_loads_e2e.py", "tests/test_a_goto_to_a_refused_port_ends_with_its_reason_e2e.py", "tests/test_a_handle_action_walks_like_a_selector_action_e2e.py", "tests/test_a_launch_and_a_context_timezone_reach_the_page_e2e.py", "tests/test_a_navigation_that_moved_is_told_by_the_engine_e2e.py", "tests/test_a_page_function_called_by_the_client_sees_only_page_frames_e2e.py", "tests/test_a_page_sees_no_pointer_event_before_the_first_input_on_the_hidden_display_e2e.py", "tests/test_a_pages_own_hasinstance_is_never_called_while_the_client_listens_to_console_e2e.py", "tests/test_a_password_field_is_as_wide_as_on_retail_windows_e2e.py", "tests/test_a_popup_moves_and_resizes_as_declared_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_popup_reads_the_retail_sizes_of_a_maximized_main_window_e2e.py", "tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py", "tests/test_an_element_handle_serves_every_method_of_the_client_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_argument_reaches_the_page_e2e.py", "tests/test_every_reader_of_a_webgl_canvas_agrees_e2e.py", "tests/test_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_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_input_reaches_the_top_and_a_frame_of_another_site_at_every_scale_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_host_gl_probe_runs_only_on_an_undeclared_engine_linux_e2e.py", "tests/test_the_launch_counter_is_one_plain_get_before_any_page_e2e.py", "tests/test_the_maximized_window_frames_and_popups_read_retail_e2e.py", "tests/test_the_parent_methods_of_the_window_origin_are_not_exposed_to_a_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).", "run": "suite_run"},
{"id": "wrapper.e2e.suite.windows.1", "giro": "G2", "os": ["windows"], "min_tests": 332, "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_held_ice_port_blinds_the_loopback_checks_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_screenshot_honours_its_scale_e2e.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page_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).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
{"id": "wrapper.e2e.suite.windows.2", "giro": "G2", "os": ["windows"], "min_tests": 327, "exact": true, "tests": ["tests/test_a_click_under_the_login_autocomplete_list_reaches_the_page_e2e.py", "tests/test_a_file_chooser_reaches_every_client_e2e.py", "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_navigation_that_moved_is_told_by_the_engine_e2e.py", "tests/test_a_press_on_an_open_select_follows_windows_rollup_e2e.py", "tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py", "tests/test_a_select_dropdown_stays_open_after_the_release_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_element_handle_serves_every_method_of_the_client_e2e.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_every_argument_reaches_the_page_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_no_popup_is_left_when_a_page_closes_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 fLine truncated
{"id": "wrapper.e2e.suite.windows.3", "giro": "G2", "os": ["windows"], "min_tests": 299, "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_function_called_by_the_client_sees_only_page_frames_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_page_sees_no_pointer_event_before_the_first_input_on_the_hidden_display_e2e.py", "tests/test_a_pages_own_hasinstance_is_never_called_while_the_client_listens_to_console_e2e.py", "tests/test_a_password_field_is_as_wide_as_on_retail_windows_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).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
{"id": "wrapper.e2e.suite.windows.4", "giro": "G2", "os": ["windows"], "min_tests": 334, "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_frame_reads_only_declared_origins_while_it_loads_e2e.py", "tests/test_a_handle_action_walks_like_a_selector_action_e2e.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_moves_and_resizes_as_declared_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_popup_reads_the_retail_sizes_of_a_maximized_main_window_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_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_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_input_reaches_the_top_and_a_frame_of_another_site_at_every_scale_e2e.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_the_maximized_window_frames_and_popups_read_retail_e2e.py", "tests/test_the_parent_methods_of_the_window_origin_are_not_exposed_to_a_page_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).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
{"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.", "run": "suite_run"},
{"id": "wrapper.e2e.ab_oracle", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_oracle_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Same seed, same bytes: the engine published as firefox-68 against the candidate, on one machine, with the same core and wrapper, after the control: the published engine against ITSELF (the A/A; a difference is a broken control, exit 2, and the A/B is not run). On a pull request (no candidate: INVPW_BINARY_PATH is the published engine, no INVISIBLE_SEAL_FILE) the A/A is the whole test, on the first two seeds of the candidate set (all five when the pull request changes a file of this oracle: the step of e2e.yml that runs scripts/ci_ab_pr_seeds.py exports AB_ORACLE_PR_SEEDS), and saves both dumps and the diff under $AB_ORACLE_OUT or $RUNNER_TEMP/invpw-evidence/ab-oracle. scripts/ci_ab_oracle.py runs the host gate's dump (scripts/ci_host_gate.py dump: the persona seeds of ci/persona-seeds.json, each at its own DPR with nothing pinned, the whole page of scripts/host_gate; the `candidate` set of 5 seeds that reach every webgl renderer and every DPR, or with AB_ORACLE_SEED_SET=final and AB_ORACLE_SHARD=i/n the 20 seeds that reach every value of every dimension split over n jobs) twice, once with the firefox-68 binary (the release's seal.json, then the core's own download.ensure_binary under that seal: the archive's sha256 is checked against the seal) and once with the candidate binary of the leg under its own seal, and compares every leaf of every visit: the only differences allowed are the `noise` entries of scripts/host_gate/exceptions.json and the diag. keys; anything else is red with the leaf, the two values and the seed; fewer leaves than the host gate's reference holds (16439 per visit; a DPR the reference does not record is held to the least of those it does) is red. The files (dump-68.json, dump-68-again.json, diff-a-a.json and, with a candidate, dump-candidate.json and diff.json) are the artifact ab-oracle-<os> of the leg. 1 = the one test; the comparator's own cases (51, the A/A's among them) are in tests/test_ab_oracle.py, the persona seeds' (15) in tests/test_persona_cover.py, in the rows of the whole unit suite. Needs the engine's binary (INVPW_BINARY_PATH) and, for the A/B, the candidate's seal (INVISIBLE_SEAL_FILE) and the network (the release assets of firefox-68). The engine of the candidate must accept the core of the leg and the 68 engine must accept it too: a core that declares something the published engine refuses is a red of this suite, not of the engine.", "timeout_minutes": 50, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"], "artifact": "ab-oracle"},
{"id": "wrapper.e2e.ab_network", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_network_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Network A/B oracle: the P4 journey, HTTPS h1/h2 (ClientHello, h2 frames, header order), HTTP/3 (transport parameters, H3 SETTINGS), WebRTC through the coherent SOCKS5 lab gateway, DNS through the fake DoH, and an idle launch; transcripts compared leaf by leaf, direct connections red on either side. A/A first (the published engine twice: a difference is a broken control; ci/ab-network-volatile.json holds the leaves the A/A proved volatile, and may only shrink), then the published engine against the candidate. Without a candidate (a PR's e2e) the A/A alone, on the first seed (all five when the pull request changes a file of this oracle: AB_NETWORK_PR_SEEDS), in jobs of its own in e2e.yml on Linux and on Windows (the shared e2e jobs leave this file out).", "timeout_minutes": 75, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"]},
{"id": "wrapper.e2e.ab_host", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_host_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Host A/B oracle: the whole TRACE of a closed run, from the launch to the exit of the browser, after the same journey. Compared: the processes by kind (the parent, -contentproc type, sandboxingKind, isForBrowser, the helpers by what they ran) with their count, except for the kinds of type tab whose count follows the idle time (only their presence counts), and the host paths the tree touched, judged by one rule (red if and only if a path is in all the measured launches of one engine and in no launch of the other, the long launches included; every other path that differs is listed in not-judged.json, not judged); what is ours (the package, the profile and temp dirs of the launch, the run cache, its own shared memory) leaves the comparison as a class. Linux: strace of the whole tree. Windows: the process-creation audit (event 4688, with the command line) and an ETW file trace of Kernel-File, which need an administrator. It has jobs of its own in e2e.yml on Linux and on Windows (a measurement shares the machine with no other browser), and its footprints keep the lifecycle of the tree (who started and ended when, how) and how the close ended. Each engine run starts with a discarded warm-up launch whose trace is kept and listed apart (what only the warm-up did, with the process that did it); only the tree of the launch is compared (a Windows service's paths are counted by process name and left out), and a path or a kind that differs names the processes to blame. A/A first, then the published engine against the candidate; the one declared difference (Linux glxtest, gone on the 69) is in ci/ab-host-expected.json, applied by kind, a list that may only shrink. There is no list of noise. Without a candidate (a PR e2e) the A/A alone, on the first two seeds (all five when the pull request changes a file of this oracle: AB_HOST_PR_SEEDS).", "runner_image": {"windows": "windows-2022"}, "timeout_minutes": 50, "core_dumps": "cores", "stock_firefox": ["windows"], "location_service": ["windows"], "extra_steps": ["keep_oracle_files"]},
{"id": "wrapper.e2e.ab_oracle", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_oracle_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Same seed, same bytes: the engine of the published set (the last published engine, with its own core and wrapper) against the candidate (with core_ref and wrapper_ref), on one machine, after the control: the published engine against ITSELF (the A/A; a difference is a broken control, exit 2, and the A/B is not run). On a pull request (no candidate: INVPW_BINARY_PATH is the published engine, no INVISIBLE_SEAL_FILE) the A/A is the whole test, on the first two seeds of the candidate set (all five when the pull request changes a file of this oracle: the step of e2e.yml that runs scripts/ci_ab_pr_seeds.py exports AB_ORACLE_PR_SEEDS), and saves both dumps and the diff under $AB_ORACLE_OUT or $RUNNER_TEMP/invpw-evidence/ab-oracle. scripts/ci_ab_oracle.py runs the host gate's dump (scripts/ci_host_gate.py dump: the persona seeds of ci/persona-seeds.json, each at its own DPR with nothing pinned, the whole page of scripts/host_gate; the `candidate` set of 5 seeds that reach every webgl renderer and every DPR, or with AB_ORACLE_SEED_SET=final and AB_ORACLE_SHARD=i/n the 20 seeds that reach every value of every dimension split over n jobs) twice, once with the published engine (fetched by the published set's own core under its own seal, which checks the archive's sha256, and dumped in that set's venv) and once with the candidate binary of the leg under its own seal, and compares every leaf of every visit: the only differences allowed are the `noise` entries of scripts/host_gate/exceptions.json and the diag. keys; anything else is red with the leaf, the two values and the seed; fewer leaves than the host gate's reference holds (16439 per visit; a DPR the reference does not record is held to the least of those it does) is red. The files (dump-<N>.json, dump-<N>-again.json for the tag of the published set, diff-a-a.json and, with a candidate, dump-candidate.json and diff.json) are the artifact ab-oracle-<os> of the leg. 1 = the one test; the comparator's own cases (51, the A/A's among them) are in tests/test_ab_oracle.py, the persona seeds' (15) in tests/test_persona_cover.py, in the rows of the whole unit suite. Needs the engine's binary (INVPW_BINARY_PATH) and, for the A/B, the candidate's seal (INVISIBLE_SEAL_FILE) and the network (the release assets of the published engine, and INVPW_PUBLISHED_PYTHON). Each engine runs with the core it was built for: a core that declares less than the published engine requires is no longer a red of this suite (it was: engine candidate 5, every A/B a broken control). THE CONTROL IS THE PUBLISHED SET, as a user installs it: the last invisible-playwright on the index, the invisible-core it pins exactly and the engine that core's seal pins, in a venv of their own (ci/py-lock/published.txt, installed by hash from the run's wheelhouse; scripts/ci_published_set.py; INVPW_PUBLISHED_PYTHON is its python). The candidate's side is the candidate engine with core_ref and wrapper_ref. No tag is written in a harness file.", "timeout_minutes": 50, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"], "artifact": "ab-oracle"},
{"id": "wrapper.e2e.ab_network", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_network_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Network A/B oracle: the P4 journey, HTTPS h1/h2 (ClientHello, h2 frames, header order), HTTP/3 (transport parameters, H3 SETTINGS), WebRTC through the coherent SOCKS5 lab gateway, DNS through the fake DoH, and an idle launch; transcripts compared leaf by leaf, direct connections red on either side. A/A first (the published engine twice: a difference is a broken control; ci/ab-network-volatile.json holds the leaves the A/A proved volatile, and may only shrink), then the published engine against the candidate. Without a candidate (a PR's e2e) the A/A alone, on the first seed (all five when the pull request changes a file of this oracle: AB_NETWORK_PR_SEEDS), in jobs of its own in e2e.yml on Linux and on Windows (the shared e2e jobs leave this file out). THE CONTROL IS THE PUBLISHED SET, as a user installs it: the last invisible-playwright on the index, the invisible-core it pins exactly and the engine that core's seal pins, in a venv of their own (ci/py-lock/published.txt, installed by hash from the run's wheelhouse; scripts/ci_published_set.py; INVPW_PUBLISHED_PYTHON is its python). The candidate's side is the candidate engine with core_ref and wrapper_ref. No tag is written in a harness file.", "timeout_minutes": 75, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"]},
{"id": "wrapper.e2e.ab_host", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_host_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Host A/B oracle: the whole TRACE of a closed run, from the launch to the exit of the browser, after the same journey. Compared: the processes by kind (the parent, -contentproc type, sandboxingKind, isForBrowser, the helpers by what they ran) with their count, except for the kinds of type tab whose count follows the idle time (only their presence counts), and the host paths the tree touched, judged by one rule (red if and only if a path is in all the measured launches of one engine and in no launch of the other, the long launches included; every other path that differs is listed in not-judged.json, not judged); what is ours (the package, the profile and temp dirs of the launch, the run cache, its own shared memory) leaves the comparison as a class. Linux: strace of the whole tree. Windows: the process-creation audit (event 4688, with the command line) and an ETW file trace of Kernel-File, which need an administrator. It has jobs of its own in e2e.yml on Linux and on Windows (a measurement shares the machine with no other browser), and its footprints keep the lifecycle of the tree (who started and ended when, how) and how the close ended. Each engine run starts with a discarded warm-up launch whose trace is kept and listed apart (what only the warm-up did, with the process that did it); only the tree of the launch is compared (a Windows service's paths are counted by process name and left out), and a path or a kind that differs names the processes to blame. A/A first, then the published engine against the candidate; the one declared difference (Linux glxtest, gone on the 69) is in ci/ab-host-expected.json, applied by kind, a list that may only shrink. There is no list of noise. Without a candidate (a PR e2e) the A/A alone, on the first two seeds (all five when the pull request changes a file of this oracle: AB_HOST_PR_SEEDS). THE CONTROL IS THE PUBLISHED SET, as a user installs it: the last invisible-playwright on the index, the invisible-core it pins exactly and the engine that core's seal pins, in a venv of their own (ci/py-lock/published.txt, installed by hash from the run's wheelhouse; scripts/ci_published_set.py; INVPW_PUBLISHED_PYTHON is its python). The candidate's side is the candidate engine with core_ref and wrapper_ref. No tag is written in a harness file.", "runner_image": {"windows": "windows-2022"}, "timeout_minutes": 50, "core_dumps": "cores", "stock_firefox": ["windows"], "location_service": ["windows"], "extra_steps": ["keep_oracle_files"]},
{"id": "wrapper.e2e.ab_host_crash", "giro": "G2", "os": ["linux"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_host_crash_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "A signal sent to the parent of the browser with os.kill, the core the kernel writes and gdb reads, and the signal line of strace exist on Linux only: Windows has no counterpart of this test. What a Windows launch that did not end with 0 leaves (the `.extra` files and the minidump names, read from the crash folders) is held by the unit tests of the recorder with fake launches, and by every Windows leg of the three oracles, which are red on any parent that does not end with 0.", "note": "The recorder of the host oracle, tested on a launch that dies on purpose: scripts/ci_ab_host.py crash-probe launches the engine once under the oracle's stand-in (strace of the tree, cores enabled, a crash watcher), sends SIGSEGV to the browser's parent with os.kill and closes it as the oracle closes its launches; the test passes when the oracle reports RED (exit 1, `FAIL the parent process exited with code ...: seed N, launch crash`) and the artifact (RUNNER_TEMP/invpw-evidence/ab-host-crash) holds the signal line of the strace log (strace-signals.txt, strace-tail.txt), the core run through gdb (gdb-core.*.txt: `thread apply all bt`, the MOZ_CRASH reason, `info sharedlibrary`), the build ids and what the collectors did not find (said.txt). It fails when the oracle says green for a launch that died, when the evidence is missing and when the probe did not run; the red of the probe does not make the job red. It runs in the job of the host oracle on Linux (e2e-host: strace, gdb and elfutils installed, kernel.core_pattern pointed at INVPW_CORE_DIR), after the A/A, and is left out of the shared e2e job (OWN_JOB_FILES).", "timeout_minutes": 35, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"]}
]
+43
View File
@@ -0,0 +1,43 @@
{
"about": "What retail Firefox on Windows reads on a password field in the page tests/data/password_mask_page.html (the width of 40 x 'a' in Arial 16px, which is 40 times the advance of the mask character), extracted by scripts/extract_retail_password_mask.py. Never edited by hand.",
"capture": {
"folder": "captures/firefox-159.0/windows-server-2025/password-mask/2026-12-02",
"retail_captures_commit": "e81da117a01c8d05b00beb62cd544dc057d40f85",
"run": "https://github.com/oss-invisible/core/actions/runs/46769343558",
"browser": {
"firefox_version": "159.0",
"build_id": "20261022150525",
"installer_sha256": "8776887b79925abbdd407fcdfe257d8382b54e24be52a6466426b95a804d6790",
"firefox_exe_sha256": "d8b5ed82fcd9c0f159dc86dc1c4526ceae981c4d9651f21908b6de90d0a56d85",
"xul_dll_sha256": "fec21f3e7c281c836ff4fb9658bf321857e101750bc4a6280d1b419996ce7e29"
},
"host": {
"runner_image": "windows-2025",
"os_version": "10.0.26100",
"os_ubr": "33828"
}
},
"files": [
{
"path": "result.json",
"sha256": "980ac7f4ee06ffeef80c3aa3ddb594216b30c4b221b43156b1fa39f92153571a"
},
{
"path": "meta.json",
"sha256": "3ecefececdca063d84b48f7bb8905039077356b5c6c46e59e2a7551e1bdaf2ad"
}
],
"page": {
"path": "tests/data/password_mask_page.html",
"sha256": "4b0c454f723392003e75325036effc576627a71f29c8d82cb01033a963e8de2a"
},
"n": 40,
"cases": {
"arial16": {
"password_scrollWidth": 387,
"mask": "U+25CF",
"devicePixelRatio": 1,
"platform": "Win32"
}
}
}
File diff suppressed because it is too large. Load diff
+541
View File
@@ -0,0 +1,541 @@
{
"about": "What retail Firefox reads in a popup opened from a maximized main window, per display case and feature string, extracted by scripts/extract_retail_popup_sizes.py. Never edited by hand.",
"capture": {
"round": "2026-12-01-window-geometry-r12",
"run": "https://github.com/oss-invisible/core/actions/runs/46545487209",
"retail_captures_commit": "ef2250dee8704d3023c36661e39ea9525fe41a04",
"browser": {
"firefox_version": "159.0",
"build_id": "20261022150525",
"installer_sha256": "8776887b79925abbdd407fcdfe257d8382b54e24be52a6466426b95a804d6790"
}
},
"files": [
{
"path": "dpr1/1920x1080/a/raw.json",
"sha256": "1e4413e6e06ff1a8fc49eba8d87cd2c1e3642550bd67242fcd8ebd03777baf6a"
},
{
"path": "dpr1/1920x1080/b/raw.json",
"sha256": "ee2d4d2b60dea8e56450fca62446a5c3135e358b6f47ead030b55eea174a35a8"
},
{
"path": "dpr1.25/1920x1080/a/raw.json",
"sha256": "440d03adc9782905764e34e983c202f816d79059e81f298316e7a0d9d19f29ab"
},
{
"path": "dpr1.25/1920x1080/b/raw.json",
"sha256": "4110bbc9b49f5f5c47b340b4a3e6f91328fe14f10247f888fbb301f9f3ff6f80"
},
{
"path": "dpr1.5/1920x1080/a/raw.json",
"sha256": "69ba9333f235aab0cf6ef86ddf14f076d67e23aec22616b5a95dabd67680a19f"
},
{
"path": "dpr1.5/1920x1080/b/raw.json",
"sha256": "ac9200c9ed122b35ba448149f08e2a560b868e80e20fa92fc2864a3b3856a1f3"
},
{
"path": "dpr2/1600x1200/a/raw.json",
"sha256": "947921aac122dd18dab3227b83b47146a9016ac5591adaa956a6bd11d9c3aa64"
},
{
"path": "dpr2/1600x1200/b/raw.json",
"sha256": "7566628ff7822d7de6d9233cb4d2e94e3d129fd79df6920dd39cee3c96c07dac"
}
],
"csv_checked": {
"path": "WINDOW_GEOMETRY_POPUP_FRAME.csv",
"sha256": "205b2f62aa4d721967a011738fefb505e6a09bfc79e014d2479010756ed2ea77"
},
"cases": {
"1920x1080-dpr1.0": {
"width=500,height=400": {
"inner": [
500,
400
],
"outer": [
516,
480
],
"screen": [
4,
4
],
"vv_height": 400
},
"popup": {
"inner": [
1920,
968
],
"outer": [
1936,
1048
],
"screen": [
-8,
-8
],
"vv_height": 968
},
"width=500": {
"inner": [
500,
856
],
"outer": [
516,
936
],
"screen": [
4,
4
],
"vv_height": 856
},
"height=400": {
"inner": [
1280,
400
],
"outer": [
1296,
480
],
"screen": [
4,
4
],
"vv_height": 400
},
"width=300,height=200": {
"inner": [
300,
200
],
"outer": [
316,
280
],
"screen": [
4,
4
],
"vv_height": 200
},
"width=800,height=600": {
"inner": [
800,
600
],
"outer": [
816,
680
],
"screen": [
4,
4
],
"vv_height": 600
},
"left=100,top=100": {
"inner": [
1280,
856
],
"outer": [
1296,
936
],
"screen": [
100,
96
],
"vv_height": 856
},
"left=5000,top=5000": {
"inner": [
1280,
856
],
"outer": [
1296,
936
],
"screen": [
624,
96
],
"vv_height": 856
}
},
"1920x1080-dpr1.25": {
"width=500,height=400": {
"inner": [
500,
400
],
"outer": [
514,
478
],
"screen": [
3,
3
],
"vv_height": 400
},
"popup": {
"inner": [
1536,
752
],
"outer": [
1550,
830
],
"screen": [
-7,
-7
],
"vv_height": 752
},
"width=500": {
"inner": [
500,
662
],
"outer": [
514,
741
],
"screen": [
3,
3
],
"vv_height": 662.4000244140625
},
"height=400": {
"inner": [
1280,
401
],
"outer": [
1294,
479
],
"screen": [
3,
3
],
"vv_height": 400.79998779296875
},
"width=300,height=200": {
"inner": [
300,
200
],
"outer": [
314,
278
],
"screen": [
3,
3
],
"vv_height": 200
},
"width=800,height=600": {
"inner": [
800,
600
],
"outer": [
814,
678
],
"screen": [
3,
3
],
"vv_height": 600
},
"left=100,top=100": {
"inner": [
1280,
662
],
"outer": [
1294,
741
],
"screen": [
100,
75
],
"vv_height": 662.4000244140625
},
"left=5000,top=5000": {
"inner": [
1280,
662
],
"outer": [
1294,
741
],
"screen": [
242,
75
],
"vv_height": 662.4000244140625
}
},
"1920x1080-dpr1.5": {
"width=500,height=400": {
"inner": [
500,
400
],
"outer": [
515,
478
],
"screen": [
3,
3
],
"vv_height": 400
},
"popup": {
"inner": [
1280,
609
],
"outer": [
1295,
687
],
"screen": [
-7,
-7
],
"vv_height": 608.6666870117188
},
"width=500": {
"inner": [
501,
533
],
"outer": [
515,
611
],
"screen": [
3,
3
],
"vv_height": 533.3333129882812
},
"height=400": {
"inner": [
1153,
400
],
"outer": [
1168,
478
],
"screen": [
3,
3
],
"vv_height": 400
},
"width=300,height=200": {
"inner": [
300,
200
],
"outer": [
315,
278
],
"screen": [
3,
3
],
"vv_height": 200
},
"width=800,height=600": {
"inner": [
800,
594
],
"outer": [
815,
672
],
"screen": [
3,
0
],
"vv_height": 594
},
"left=100,top=100": {
"inner": [
1153,
533
],
"outer": [
1168,
611
],
"screen": [
100,
61
],
"vv_height": 533.3333129882812
},
"left=5000,top=5000": {
"inner": [
1153,
533
],
"outer": [
1168,
611
],
"screen": [
112,
61
],
"vv_height": 533.3333129882812
}
},
"1600x1200-dpr2.0": {
"width=500,height=400": {
"inner": [
500,
400
],
"outer": [
513,
476
],
"screen": [
2,
2
],
"vv_height": 399.5
},
"popup": {
"inner": [
800,
489
],
"outer": [
813,
565
],
"screen": [
-6,
-6
],
"vv_height": 488.5
},
"width=500": {
"inner": [
500,
428
],
"outer": [
513,
504
],
"screen": [
2,
2
],
"vv_height": 427.5
},
"height=400": {
"inner": [
720,
400
],
"outer": [
733,
476
],
"screen": [
2,
2
],
"vv_height": 399.5
},
"width=300,height=200": {
"inner": [
300,
200
],
"outer": [
313,
276
],
"screen": [
2,
2
],
"vv_height": 199.5
},
"width=800,height=600": {
"inner": [
787,
476
],
"outer": [
800,
552
],
"screen": [
0,
0
],
"vv_height": 475.5
},
"left=100,top=100": {
"inner": [
720,
428
],
"outer": [
733,
504
],
"screen": [
67,
48
],
"vv_height": 427.5
},
"left=5000,top=5000": {
"inner": [
720,
428
],
"outer": [
733,
504
],
"screen": [
67,
48
],
"vv_height": 427.5
}
}
}
}
+6 -1
View File
@@ -8,5 +8,10 @@
{"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}}
{"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}},
{"nodeid": "tests/test_detectors_e2e.py::test_the_headless_detector_sees_no_headless_and_no_proxy_tell", "suite": "wrapper.e2e.suite.linux.1", "count": 1, "from_min_tests": 449, "reason": "removed with the vendored bundle whose licence notice cannot ship without a studied system's name (pm, 27/11)", "decided_by": "pm", "date": "2026-11-27"},
{"nodeid": "tests/test_realness_behind_a_declared_exit_e2e.py::test_the_vendored_detection_page_finds_nothing_behind_the_gateway", "suite": "wrapper.e2e.suite.linux.1", "count": 1, "from_min_tests": 449, "reason": "removed with the vendored bundle whose licence notice cannot ship without a studied system's name (pm, 27/11)", "decided_by": "pm", "date": "2026-11-27"},
{"nodeid": "tests/test_detectors_e2e.py::test_the_headless_detector_sees_no_headless_and_no_proxy_tell", "suite": "wrapper.e2e.suite.windows.1", "count": 1, "from_min_tests": 333, "reason": "removed with the vendored bundle whose licence notice cannot ship without a studied system's name (pm, 27/11)", "decided_by": "pm", "date": "2026-11-27"},
{"nodeid": "tests/test_realness_behind_a_declared_exit_e2e.py::test_the_vendored_detection_page_finds_nothing_behind_the_gateway", "suite": "wrapper.e2e.suite.windows.4", "count": 1, "from_min_tests": 274, "reason": "removed with the vendored bundle whose licence notice cannot ship without a studied system's name (pm, 27/11)", "decided_by": "pm", "date": "2026-11-27"},
{"nodeid": "tests/test_realness_behind_a_declared_exit_e2e.py::test_the_vendored_detection_page_finds_nothing_behind_the_gateway", "suite": "wrapper.e2e.realness", "count": 1, "from_min_tests": 32, "reason": "removed with the vendored bundle whose licence notice cannot ship without a studied system's name (pm, 27/11)", "decided_by": "pm", "date": "2026-11-27"}
]
+2 -2
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "invisible_playwright"
version = "0.59.0"
version = "0.61.0"
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==69.82.0",
"invisible_core==71.85.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
+30 -18
View File
@@ -116,6 +116,7 @@ import re
import shutil
import subprocess
import sys
import sysconfig
import tempfile
import time
import threading
@@ -1996,11 +1997,23 @@ def default_seeds() -> list:
return list(gate.SEEDS)
def install_folders() -> set:
"""The folders the python of THIS process installs its packages in (sysconfig's purelib and platlib, the link and the real folder): the install prefix of the side that runs.
Each side's engine reads the branding of ITS OWN core, in the install folder of that core. The published side runs in the venv of the published set and the candidate in the
python of the job (`run_subprocess`), so the two folders differ, and the same read of one file is a different path on each side. That folder is the side's own package, as the
folder of its engine is; any other path under the install prefix (the python's own library, another folder of the machine, the other side's folder) stays the host's."""
paths = sysconfig.get_paths()
folders = {paths[name] for name in ("purelib", "platlib") if paths.get(name)}
return folders | {os.path.realpath(folder) for folder in folders}
def _context(binary: str, windows: bool, work: Path) -> Context:
"""The run's own folders: the package (the link and the real folder), the temp root of this process (the oracle's subprocess runs with a
TMPDIR / TEMP of its own, `run_subprocess`) and the folder of the work of the seed, and the cache folder of the run."""
"""The run's own folders: the package (the link and the real folder) and the install folders of this process's python (`install_folders`: the core and the wrapper this
engine is launched by), the temp root of this process (the oracle's subprocess runs with a TMPDIR / TEMP of its own, `run_subprocess`) and the folder of the work of the seed,
and the cache folder of the run."""
real = os.path.realpath(binary)
app = {os.path.dirname(real), os.path.dirname(os.path.abspath(binary))}
app = {os.path.dirname(real), os.path.dirname(os.path.abspath(binary))} | install_folders()
temp = {tempfile.gettempdir(), str(work)}
if windows:
folders = [*app, *temp, os.path.expanduser("~"), *(os.environ.get(v, "") for v in ("USERPROFILE", "LOCALAPPDATA", "APPDATA", "TEMP", "TMP", "ProgramData", "SystemRoot"))]
@@ -2706,17 +2719,14 @@ def staged_engine(binary: str, base=None):
shutil.rmtree(dest, ignore_errors=True)
def run_subprocess(binary: str, seal: Path | None, leg: str, out: Path, label: str, seeds: list, crash_with: str | None = None) -> int:
def run_subprocess(binary: str, seal: Path | None, leg: str, out: Path, label: str, seeds: list, crash_with: str | None = None, python: str | None = None) -> int:
"""`run` in a process of its own, with a cache folder and a temp root of its own: they are the run's, so what the engine does in them is `ours`
(the cache of the bundle's fonts, the profile and the temp dirs of the launch) and the rest of the machine is the host's.
`crash_with` (a signal name) makes the run the recorder's own test: one launch, whose parent is sent that signal (`crash-probe`)."""
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
if seal:
env["INVISIBLE_SEAL_FILE"] = str(seal)
for name in ("MOZ_LOG", "MOZ_LOG_FILE"):
env.pop(name, None)
cmd = [sys.executable, "-u", str(Path(__file__).resolve()), "run", binary, "--leg", leg, "--out", str(out), "--label", label,
`crash_with` (a signal name) makes the run the recorder's own test: one launch, whose parent is sent that signal (`crash-probe`). `python` is the published set's
(scripts/ci_published_set.py): the control side runs in the venv that holds the published core and wrapper, never in the candidate's."""
env = oracle.process_env(seal, python)
cmd = [python or sys.executable, "-u", str(Path(__file__).resolve()), "run", binary, "--leg", leg, "--out", str(out), "--label", label,
"--seeds", ",".join(str(s) for s in seeds)]
if crash_with:
cmd += ["--crash-with", crash_with]
@@ -2844,18 +2854,18 @@ def ab(candidate: str | None, candidate_seal: Path | None, leg: str, out: Path,
out.mkdir(parents=True, exist_ok=True)
work = Path(tempfile.mkdtemp(prefix="ab-host-fetch-"))
try:
binary, seal = published or oracle.fetch_published(engine_tag, work)
runs = [(engine_tag, "footprint-%s.json" % engine_tag.rsplit("-", 1)[-1], binary, seal),
(engine_tag + " again", "footprint-%s-again.json" % engine_tag.rsplit("-", 1)[-1], binary, seal)]
binary, seal, python = oracle.split_published(published or oracle.fetch_published(engine_tag, work))
runs = [(engine_tag, "footprint-%s.json" % engine_tag.rsplit("-", 1)[-1], binary, seal, python),
(engine_tag + " again", "footprint-%s-again.json" % engine_tag.rsplit("-", 1)[-1], binary, seal, python)]
if candidate:
runs.append((oracle.CANDIDATE, "footprint-candidate.json", candidate, candidate_seal))
runs.append((oracle.CANDIDATE, "footprint-candidate.json", candidate, candidate_seal, None))
failed = []
for label, name, exe, seal_file in runs:
for label, name, exe, seal_file, side_python in runs:
print("=== footprint with %s: %s (run from %s)" % (label, exe, stage_dir()))
sys.stdout.flush()
try:
with staged_engine(exe) as staged:
rc = run_subprocess(staged, Path(seal_file) if seal_file else None, leg, out / name, label, seeds)
rc = run_subprocess(staged, Path(seal_file) if seal_file else None, leg, out / name, label, seeds, **({"python": side_python} if side_python else {}))
except OSError as e:
print("the engine of %s could not be staged: %s" % (label, e))
rc = 125
@@ -2921,7 +2931,7 @@ def main(argv=None) -> int:
x.add_argument("--candidate-seal", type=Path, default=os.environ.get("INVISIBLE_SEAL_FILE"))
x.add_argument("--leg", required=True)
x.add_argument("--out", type=Path, required=True)
x.add_argument("--engine-tag", default=oracle.ENGINE_TAG)
x.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
x.add_argument("--seeds", default=None)
x.add_argument("--published-binary", type=Path, help="use this binary for the published engine instead of fetching it")
x.add_argument("--published-seal", type=Path, help="its seal (default: the environment's)")
@@ -2947,6 +2957,8 @@ def main(argv=None) -> int:
return 3
return crash_probe(args.binary, args.leg, args.out, args.seed if args.seed is not None else default_seeds()[0])
seeds = [int(s) for s in args.seeds.split(",")] if args.seeds else default_seeds()
if args.cmd == "ab":
args.engine_tag = args.engine_tag or oracle.default_tag()
if args.cmd == "run":
if sys.platform.startswith("linux") and not shutil.which("strace"):
print("needs strace (apt install strace): without it the processes and the files of the run are not seen")
+522 -39
View File
@@ -49,6 +49,11 @@ under ``exits``, outside the leaves that are compared, and a parent that did not
the side, the seed, the launch and the code. What a launch that died left is kept beside the transcript (``transcript-68.json`` -> ``transcript-68.crash/``): the core through gdb with
the build ids, the ``.extra`` and the minidump names, ``said.txt`` for what the collectors did not find. This oracle runs no strace (a trace would change the outcome it observes).
THE WEBRTC EVIDENCE AND THE HUNT. The WebRTC walk keeps, under ``transcript["evidence"]["seeds"][<seed>]["webrtc"]`` (never compared: the comparison reads ``seeds`` and nothing else), every datagram the gateway
routed in it (when, target, message, STUN transaction id), the moments of its stages and of the page's call, and the page's own ``performance.now()`` at each step of the gather. With
``AB_NETWORK_HUNT=webrtc:<seed>:<n>`` the command ``ab`` runs ONLY that walk of that seed, ``n`` times for each engine of the A/A, and writes ``<out>/hunt/<engine>-<i>.json`` and ``<out>/hunt/summary.json``;
it decides nothing and exits 0 (e2e-hunt.yml: the input ``ab_network_webrtc_seed``).
Exit codes: 0 green, 1 red (a finding), 2 broken control (the A/A is red) or a run that could not run.
"""
from __future__ import annotations
@@ -79,13 +84,24 @@ import ci_crash_evidence as crash # noqa: E402 (how each launch's parent ended
FORMAT = "ab-network/1"
DIFF_FORMAT = "ab-network-diff/1"
EVIDENCE_FORMAT = "ab-network-evidence/1"
HUNT_FORMAT = "ab-network-hunt/1"
HUNT_SUMMARY_FORMAT = "ab-network-hunt-summary/1"
#: The environment variable that makes ``ab`` repeat one walk of one seed and nothing else (``cmd_hunt``): ``webrtc:<seed>:<n>``.
HUNT_ENV = "AB_NETWORK_HUNT"
#: The engine's own log in a hunt (the launch's environment, in hunt mode only): nICEr's reasons for accepting or rejecting an answer or ending a transaction, and the signaling.
#: ``sync`` makes each line reach the file as it is written, so a process that ends (or is killed) loses none.
HUNT_MOZ_LOG = "sync,timestamp,nicer:5,signaling:5"
VOLATILE_FORMAT = "ab-network-volatile/1"
VOLATILE_FILE = ROOT / "ci" / "ab-network-volatile.json"
SEEDS_FILE = ROOT / "ci" / "persona-seeds.json"
#: The seeds the A/B oracle of the page uses today (scripts/ci_host_gate.py: SEEDS), when ci/persona-seeds.json has no "candidate" key.
FALLBACK_SEEDS = (11, 12, 13)
ENGINE_TAG = "firefox-68"
CANDIDATE = "candidate"
#: The most times the engine sends one STUN request (a transmit and its retransmissions) before it gives the transaction up: the pref
#: ``media.peerconnection.ice.stun_client_maximum_transmits`` (modules/libpref/init/all.js), 7. The first RTO is 100 ms and doubles, so how
#: MANY transactions a walk has is the engine's and is compared, and how many datagrams each took is the network's timing and is not: a
#: transaction over this number is a problem of the run (``udp_summary``'s ``over_limit``, ``_udp_overruns``), never a compared leaf.
STUN_MAX_TRANSMITS = 7
#: What a leaf that one side does not have reads as.
MISSING = "<missing>"
#: A value longer than this in diff.json is replaced by its length and its sha256.
@@ -267,6 +283,68 @@ def _udp_attribution(la: Dict[str, Any], lb: Dict[str, Any]) -> Tuple[set, List[
return paths, differences, unattributed
_UDP_OVER_LIMIT = re.compile(r"^(?P<where>.*/udp)/over_limit/(?P<target>[^/]+)/\d+$")
def _udp_overruns(la: Dict[str, Any], lb: Dict[str, Any], label_a: str, label_b: str) -> Tuple[set, List[str]]:
"""The STUN transactions that were sent more times than the engine's maximum (``udp_summary``'s ``over_limit``: per destination, the number of transmits of each such
transaction). They are not compared leaf by leaf: how many datagrams a transaction took is the network's timing, but more than the engine's own maximum is not
timing, it is a client that does not stop. Returns the paths that take part and one problem line for each."""
paths: set = set()
problems: List[str] = []
for label, leaves in ((label_a, la), (label_b, lb)):
for path, value in sorted(leaves.items()):
m = _UDP_OVER_LIMIT.match(path)
if m:
paths.add(path)
problems.append("%s: a STUN transaction to %s was sent %s times, more than the engine's maximum of %d transmits (%s)"
% (label, m.group("target"), value, STUN_MAX_TRANSMITS, m.group("where")))
return paths, problems
def turn_path_problems(transcript: Dict[str, Any], label: str) -> List[str]:
"""Whether the TURN path of the lab WORKED in each WebRTC walk of a transcript: a relay candidate was made, no error names the lab's TURN server (701 is what a browser reports when
every answer it got was thrown away as invalid, as with a wrong credential), and the server refused no request (``webrtc/turn/refused``, written by ``walk_webrtc``). An A/A that
compared two runs in which the TURN path failed the same way would pass; this is the line that says it did not work. A transcript with no WebRTC walk says nothing."""
out: List[str] = []
for seed, body in sorted((transcript.get("seeds") or {}).items()):
walk = body.get("webrtc")
if not isinstance(walk, dict):
continue
errors = [e for e in walk.get("errors") or [] if TURN_TARGET in str(e)]
refused = (walk.get("turn") or {}).get("refused") or 0
if "relay" in (walk.get("candidate_types") or []) and not errors and not refused:
continue
seen = (errors + ["the lab TURN refused %d request(s)" % refused] * bool(refused)) or ["no error"]
out.append("seeds/%s/webrtc: %s made no relay candidate through the lab TURN (%s). Fix: the probe's credential must be the lab TURN's (tests/_turn_chain.py PASSWORD) "
"and the lab's answers must reach the browser. Rule: the A/A proves the TURN path it compares" % (seed, label, "; ".join(seen)))
return out
def turn_deallocation_problems(transcript: Dict[str, Any], label: str) -> List[str]:
"""What the lab's TURN server heard of deallocations (``webrtc/turn/deallocation``, written by ``walk_webrtc`` with :func:`deallocation_facts`) that a walk must not have: an allocation ended
by more than one deallocation, a deallocation from an address that has no allocation. One deallocation, or none, is the engine's best effort at teardown and is evidence, not a leaf; so is
``early`` (see the comment below)."""
out: List[str] = []
for seed, body in sorted((transcript.get("seeds") or {}).items()):
walk = body.get("webrtc")
facts = ((walk or {}).get("turn") or {}).get("deallocation") if isinstance(walk, dict) else None
if not isinstance(facts, dict):
continue
for key, what, fix in (("repeated", "%d allocation(s) of the lab TURN were ended by more than one deallocation (a Refresh with LIFETIME 0)",
"find what sends the teardown twice; the engine sends it once"),
("unallocated", "the lab TURN heard %d deallocation(s) (a Refresh with LIFETIME 0) from an address that has no allocation",
"find what deallocates an allocation it never made; the lab's record is TurnServer.deallocations in tests/_turn_chain.py")):
# ``early`` (a deallocation before the page began closing) is evidence, never a problem: the bound maps the page's performance.now() onto the recorder's clock,
# and the page's clock is the engine's reduced-precision timer, not the recorder's. On Windows the published engine against itself was "early" on seeds 63 and 6
# (wrapper #612's round, e2e (network, windows)), so the two events cannot be ordered on that mapping. Ordering them on one clock would take a marker the page
# sends through the gateway before pc.close(), and that request would itself become a compared leaf of the walk.
if facts.get(key):
out.append("seeds/%s/webrtc: %s: %s. Fix: %s. Rule: the TURN deallocation is one best-effort send at teardown (nICEr nr_turn_client_deallocate)"
% (seed, label, what % facts[key], fix))
return out
def exit_lines(transcript: Dict[str, Any], label: str, side: str) -> List[str]:
"""The red lines of the launches of one side that did not end with 0 (``exits``, which ``run`` writes: scripts/ci_crash_evidence.py). A transcript that has no ``exits``
was not made by ``run`` and says nothing about it; one that has it and no launch in it is a run whose probe saw no browser, which is red."""
@@ -286,7 +364,11 @@ def compare_transcripts(a: Dict[str, Any], b: Dict[str, Any], volatile: List[Dic
run the same seeds, when fewer than ``floor`` leaves were compared, or when an entry of the volatile list matches no leaf of either transcript (``stale``)."""
la, lb = flatten(a.get("seeds") or {}), flatten(b.get("seeds") or {})
attribution, attribution_differences, unattributed = _udp_attribution(la, lb)
paths = sorted((set(la) | set(lb)) - attribution)
overrun_paths, overruns = _udp_overruns(la, lb, label_a, label_b)
turn_problems = (turn_path_problems(a, label_a) + turn_path_problems(b, label_b) +
turn_deallocation_problems(a, label_a) + turn_deallocation_problems(b, label_b))
refused_paths = {p for p in set(la) | set(lb) if re.match(r"^seeds/[^/]+/webrtc/turn/(refused|deallocation/(repeated|unallocated|early))$", p)}
paths = sorted((set(la) | set(lb)) - attribution - overrun_paths - refused_paths)
problems: List[str] = []
if set(a.get("seeds") or {}) != set(b.get("seeds") or {}):
problems.append("the sides ran different seeds: %s and %s" % (sorted(a.get("seeds") or {}), sorted(b.get("seeds") or {})))
@@ -324,6 +406,8 @@ def compare_transcripts(a: Dict[str, Any], b: Dict[str, Any], volatile: List[Dic
problems += ["a direct connection: " + d for d in direct]
problems += exit_lines(a, label_a, "A") + exit_lines(b, label_b, "B")
problems += invariants
problems += overruns
problems += turn_problems
problems += ["the volatile entry %r matches no leaf of either transcript: it is stale, drop it" % p for p in stale]
problems += ["%s: %s %s | %s %s" % (d["path"], label_a, json.dumps(d["a"], sort_keys=True)[:160], label_b, json.dumps(d["b"], sort_keys=True)[:160])
for d in differences]
@@ -468,17 +552,31 @@ def dns_summary(queries: List[Tuple[str, int, str]], openers: Optional[List[Opti
def udp_summary(events: List[Dict[str, Any]], norm: Normalizer) -> Dict[str, Any]:
"""The datagrams the relay carried in one phase: per destination, the kinds of message and how many."""
"""The datagrams the relay carried in one phase: per destination, the kinds of message and how many.
``counts`` is the number of STUN TRANSACTIONS (distinct transaction ids) per destination, plus one for each datagram that is not STUN: a retransmission carries the
transaction id of the request it repeats, and how many times a request is repeated is the timing of the network (the first RTO is 100 ms and doubles; a late answer
on a loaded host adds one), so it is not what the engine decides. ``over_limit`` (only when there is one) lists, per destination, the transmits of each transaction
that has more than ``STUN_MAX_TRANSMITS``: ``compare_transcripts`` reports it as a problem and never compares it."""
kinds: Dict[str, set] = collections.defaultdict(set)
counts: collections.Counter = collections.Counter()
transmits: Dict[str, collections.Counter] = collections.defaultdict(collections.Counter)
plain: collections.Counter = collections.Counter()
order: List[str] = []
for e in events:
target = norm.text(e["target"])
if target not in kinds:
order.append(target)
kinds[target].add(e["message"])
counts[target] += 1
out: Dict[str, Any] = {"order": order, "messages": {t: sorted(kinds[t]) for t in sorted(kinds)}, "counts": dict(sorted(counts.items()))}
if e.get("tid") is None:
plain[target] += 1
else:
transmits[target][e["tid"]] += 1
counts = {t: plain[t] + len(transmits[t]) for t in sorted(kinds)}
out: Dict[str, Any] = {"order": order, "messages": {t: sorted(kinds[t]) for t in sorted(kinds)}, "counts": counts}
over = {t: sorted((n for n in transmits[t].values() if n > STUN_MAX_TRANSMITS), reverse=True) for t in sorted(kinds)}
over = {t: v for t, v in over.items() if v}
if over:
out["over_limit"] = over
who = _openers([norm.text(e["target"]) for e in events], [e.get("opener") for e in events])
if who:
out["openers"] = who
@@ -544,6 +642,93 @@ def message_kind(payload: bytes) -> str:
return "other"
def stun_tid(payload: bytes) -> Optional[str]:
"""The transaction id of a STUN message (bytes 8 to 20 of the datagram) in hex: what ties a retransmission to the request it repeats. None when the datagram is not STUN
(the same test as :func:`message_kind`: the magic cookie at bytes 4 to 8). Written in the evidence of the WebRTC walk, never compared."""
if len(payload) >= 20 and payload[4:8] == b"\x21\x12\xa4\x42":
return payload[8:20].hex()
return None
def stun_attributes(data: bytes) -> Dict[int, bytes]:
"""The attributes of a STUN message by type (RFC 8489: type, length, value padded to 4 bytes); what a truncated tail says is left out."""
out: Dict[int, bytes] = {}
i = 20
while i + 4 <= len(data):
kind, length = int.from_bytes(data[i:i + 2], "big"), int.from_bytes(data[i + 2:i + 4], "big")
if i + 4 + length > len(data):
break
out[kind] = data[i + 4:i + 4 + length]
i += 4 + ((length + 3) & ~3)
return out
def xor_address(value: Optional[bytes]) -> Optional[str]:
"""An XOR-MAPPED-ADDRESS or XOR-RELAYED-ADDRESS value (IPv4) as ``ip:port``; None for a missing value or another family."""
if value is None or len(value) < 8 or value[1] != 1:
return None
cookie = b"\x21\x12\xa4\x42"
port = int.from_bytes(value[2:4], "big") ^ int.from_bytes(cookie[:2], "big")
return "%s:%d" % (socket.inet_ntoa(bytes(a ^ b for a, b in zip(value[4:8], cookie))), port)
def turn_request_record(data: bytes, source: Tuple[str, int], t: float) -> Optional[Dict[str, Any]]:
"""What the lab's TURN server writes down of a datagram it receives (None when it is not STUN): when, from where, the transaction id, the message type, whether it carried
USERNAME and MESSAGE-INTEGRITY, and (``responses``, filled by :func:`turn_response_record`) what the server answered."""
if stun_tid(data) is None:
return None
attrs = stun_attributes(data)
return {"t": t, "src": "%s:%d" % (source[0], source[1]), "tid": stun_tid(data), "type": "0x%04x" % int.from_bytes(data[:2], "big"),
"username": 0x0006 in attrs, "integrity": 0x0008 in attrs, "responses": []}
def turn_response_record(data: bytes, destination: Tuple[str, int], t: float) -> Optional[Dict[str, Any]]:
"""What the lab's TURN server sends: when, the type (0x0113 an Allocate error, 0x0103 its success), the address it is sent to and, of a success, the XOR-RELAYED-ADDRESS and the
XOR-MAPPED-ADDRESS it carries (of an error, its code)."""
if stun_tid(data) is None:
return None
attrs = stun_attributes(data)
error = attrs.get(0x0009)
return {"t": t, "tid": stun_tid(data), "type": "0x%04x" % int.from_bytes(data[:2], "big"), "to": "%s:%d" % (destination[0], destination[1]),
"relayed": xor_address(attrs.get(0x0016)), "mapped": xor_address(attrs.get(0x0020)),
"error": (error[2] * 100 + error[3]) if error is not None and len(error) >= 4 else None}
class ExchangeSocket:
"""The UDP socket of the lab's TURN server with a record of what it receives and sends (``owner.exchanges``): the server's own code runs on it unchanged, and a failure of the record
is never a failure of the server. ``owner.clock`` is the moment (the recorder's)."""
def __init__(self, sock: socket.socket, owner: Any) -> None:
self._sock, self._owner = sock, owner
def recvfrom(self, size: int) -> Tuple[bytes, Any]:
data, source = self._sock.recvfrom(size)
try:
record = turn_request_record(data, source, self._owner.clock())
if record is not None:
self._owner.exchanges.append(record)
except Exception: # noqa: BLE001 - evidence, never the road
pass
return data, source
def sendto(self, data: bytes, address: Any) -> int:
try:
record = turn_response_record(data, address, self._owner.clock())
if record is not None:
for exchange in reversed(self._owner.exchanges):
if exchange.get("tid") == record["tid"]:
exchange["responses"].append(record)
break
else:
self._owner.exchanges.append({"t": record["t"], "src": None, "tid": record["tid"], "type": None, "username": None, "integrity": None, "responses": [record]})
except Exception: # noqa: BLE001 - evidence, never the road
pass
return self._sock.sendto(data, address)
def __getattr__(self, name: str) -> Any:
return getattr(self._sock, name)
# ---------------------------------------------------------------------------------------------------------------------------------
# The seeds, the transcript and its files
# ---------------------------------------------------------------------------------------------------------------------------------
@@ -591,6 +776,12 @@ class Recorder:
self._t0 = time.monotonic()
self._sources: Dict[str, list] = {}
self._marks: List[Tuple[str, Dict[str, int]]] = []
#: The moment (``t``, as an event's) at which each stage began: the evidence of the WebRTC walk says where its stages sit among the datagrams.
self.phase_t: Dict[str, float] = {}
def now(self) -> float:
"""The recorder's clock, the ``t`` of an event: seconds since the recorder started."""
return round(time.monotonic() - self._t0, 3)
def attach(self, name: str, items: list) -> None:
self._sources[name] = items
@@ -600,6 +791,7 @@ class Recorder:
with self._lock:
self._marks.append((name, {k: len(v) for k, v in self._sources.items()}))
self.phase = name
self.phase_t[name] = self.now()
def event(self, kind: str, **fields: Any) -> None:
with self._lock:
@@ -707,7 +899,7 @@ def make_lab_classes() -> Tuple[type, type, type]:
import _doh_servers as ds
from _socks_servers import MEASURE_NUMBER, STUN_NAME, STUN_NUMBER, STUN_PORT, WHOAMI4, WHOAMI6, WEB_NAME
from _turn_chain import TURN_IP, TURN_PORT, TurnServer
from _turn_chain import TURN_IP, TURN_PORT, TurnServer, is_deallocation
class LabGateway(ds.DohGateway):
"""A coherent SOCKS5 gateway with the DoH road. Past loopback it carries only what the lab names: the CONNECTs to the servers of the lab that stand at the
@@ -727,6 +919,17 @@ def make_lab_classes() -> Tuple[type, type, type]:
self.opener_lookup: Callable[..., str] = self._look_up_opener
super().__init__("lab", doh, udp="relay", tcp_exit=exit_ip, udp_exit=exit_ip, relay_host=host, exit_host=host)
def _deliver(self, relay: socket.socket, to: Any, host: str, port: int, payload: bytes) -> None:
"""Every datagram the relay sends BACK to the browser is written down (``udp_back``: the address it claims in the SOCKS UDP header, where it is sent, from which relay
socket, the STUN type and transaction id), then sent as it always was."""
try:
local = relay.getsockname()
self.rec.event("udp_back", claimed="%s:%d" % (host, port), to="%s:%d" % (to[0], to[1]), relay="%s:%d" % (local[0], local[1]),
message=message_kind(payload), tid=stun_tid(payload))
except Exception: # noqa: BLE001 - evidence, never the road
pass
super()._deliver(relay, to, host, port, payload)
def _attributing(self) -> bool:
phase = self.rec.phase
return any(phase == p or phase.startswith(p + ".") for p in self.attribute_in)
@@ -782,7 +985,9 @@ def make_lab_classes() -> Tuple[type, type, type]:
def _route(self, host: str, dport: int, atyp: int, payload: bytes, out_port: int, answer: Any) -> Any:
association = getattr(self._dgram, "index", None)
self.rec.event("udp", target="%s:%d" % (host, dport), message=message_kind(payload), opener=self._association_openers.get(association) if association is not None else None)
# ``deallocation``: the datagram is a TURN deallocation by what it means (``_turn_chain.is_deallocation``, the reading the lab's TURN server uses): marked here, where the payload is.
self.rec.event("udp", target="%s:%d" % (host, dport), message=message_kind(payload), tid=stun_tid(payload), deallocation=is_deallocation(payload),
opener=self._association_openers.get(association) if association is not None else None)
if atyp == 1 and (host, dport) == (TURN_IP, TURN_PORT):
return self.turn.address, (host, dport)
if (host, dport) in ((STUN_NAME, STUN_PORT), (STUN_NUMBER, STUN_PORT), (MEASURE_NUMBER, STUN_PORT)):
@@ -796,12 +1001,18 @@ def make_lab_classes() -> Tuple[type, type, type]:
from an address of the host to loopback."""
def __init__(self, address: str) -> None:
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.bind((address, 0))
self.address = self.sock.getsockname()
raw = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
raw.bind((address, 0))
self.address = raw.getsockname()
#: Every STUN datagram it received with the answers it sent (``turn_request_record``), by the clock the lab sets (``Lab``): evidence of the WebRTC walk, never compared.
self.exchanges: list = []
self.clock: Callable[[], float] = time.monotonic
self.sock = ExchangeSocket(raw, self)
self.seen: list = []
self.allocations: list = []
self.requests: list = []
self.deallocations: list = []
self.refused: list = []
self._closed = False
threading.Thread(target=self._serve, daemon=True).start()
@@ -852,25 +1063,42 @@ JOURNEY_A, JOURNEY_O = "journey-a.test", "journey-o.test"
PAGE_NAME, H1_NAME, H2_NAME, H3_NAME = "page.lab.test", "h1.lab.test", "h2.lab.test", "h3.lab.test"
STUN_URL = "stun:198.51.100.5:19302"
TURN_URL = "turn:198.51.100.7:3478?transport=udp"
#: The probe of the WebRTC page: one STUN and one TURN server by address (the relay answers both), a data channel, and the page waits for the end of the gather (the
#: The TURN server of ``TURN_URL`` as the gateway names the target of a datagram (a test holds it equal to ``tests/_turn_chain.py``).
TURN_TARGET = "198.51.100.7:3478"
#: The user name the probe gives the TURN server (the lab's server takes any: the key is made from it and the password of ``tests/_turn_chain.py``, which the walk passes as the credential).
TURN_USERNAME = "lab"
#: The probe of the WebRTC page: one STUN and one TURN server by address (the relay answers both; the TURN's user name and credential are its arguments, never written here), a data channel, and the page waits for the end of the gather (the
#: timer is the safety net of a gather that never ends, not a measure of it).
RTC_JS = r"""async (urls) => {
const pc = new RTCPeerConnection({iceServers: [{urls: [urls[0]]}, {urls: [urls[1]], username: 'lab', credential: 'lab'}]});
RTC_JS = r"""async (args) => {
const [stunUrl, turnUrl, username, credential] = args;
const T = {start: performance.now(), offer: null, local: null, candidates: [], errors: [], gathered: null, closing: null, closed: null};
const pc = new RTCPeerConnection({iceServers: [{urls: [stunUrl]}, {urls: [turnUrl], username, credential}]});
pc.createDataChannel('');
const cands = [], errors = [];
pc.addEventListener('icecandidate', e => { if (e.candidate && e.candidate.candidate) cands.push(e.candidate.candidate); });
pc.addEventListener('icecandidateerror', e => { errors.push({code: e.errorCode, url: e.url}); });
await pc.setLocalDescription(await pc.createOffer());
pc.addEventListener('icecandidate', e => {
if (e.candidate && e.candidate.candidate) cands.push(e.candidate.candidate);
T.candidates.push({t: performance.now(), type: e.candidate ? (e.candidate.type || null) : 'end'});
});
pc.addEventListener('icecandidateerror', e => {
errors.push({code: e.errorCode, url: e.url});
T.errors.push({t: performance.now(), code: e.errorCode, url: e.url});
});
const offer = await pc.createOffer();
T.offer = performance.now();
await pc.setLocalDescription(offer);
T.local = performance.now();
await new Promise(resolve => {
const timer = setTimeout(resolve, 30000);
const done = () => { clearTimeout(timer); resolve(); };
const done = () => { clearTimeout(timer); if (T.gathered === null) T.gathered = performance.now(); resolve(); };
if (pc.iceGatheringState === 'complete') done();
pc.addEventListener('icegatheringstatechange', () => { if (pc.iceGatheringState === 'complete') done(); });
});
const sdp = (pc.localDescription && pc.localDescription.sdp) || '';
const gathering = pc.iceGatheringState;
T.closing = performance.now();
try { pc.close(); } catch (e) {}
return {candidates: cands, errors, sdp, gathering};
T.closed = performance.now();
return {candidates: cands, errors, sdp, gathering, times: T};
}"""
FETCH_JS = r"""async () => {
await (await fetch('/api?x=1', {cache: 'no-store'})).text();
@@ -975,6 +1203,8 @@ class Lab:
self.roles: Dict[int, str] = {}
self.collisions: List[Tuple[int, str, str]] = []
self.norm = Normalizer(self.roles)
#: What the WebRTC walk measured about itself (``walk_webrtc``), for ``webrtc_evidence``: never a leaf.
self.webrtc: Dict[str, Any] = {}
self._closers: List[Callable[[], None]] = []
self.h1 = self.h2 = self.h3 = None
self.origin_a = self.origin_o = ""
@@ -991,6 +1221,7 @@ class Lab:
self._closers.append(self.witness.close)
self._claim(self.witness.port, "witness")
self.turn = turn_class(self.host)
self.turn.clock = self.rec.now
self._closers.append(self.turn.close)
self.gateway = gateway_class(self.rec, self.doh, self.turn, self.host, self.exit_ip)
self.gateway.attribute_in = attribute_in
@@ -1078,9 +1309,10 @@ def guarded(fn: Callable[[], Any]) -> Any:
return {"error": _first_line(exc)}
def phase_data(lab: Lab, phase: str, skip_connects: Callable[[str], bool] = lambda target: False) -> Dict[str, Any]:
def phase_data(lab: Lab, phase: str, skip_connects: Callable[[str], bool] = lambda target: False,
skip_udp: Callable[[Dict[str, Any]], bool] = lambda event: False) -> Dict[str, Any]:
"""What the lab saw in a stage and the stages under it: the CONNECTs, the DoH questions, the datagrams, the HTTP requests of the tees. Where the lab looked who opened an entry
(``Lab(attribute_in=...)``), each summary says so: ``openers``. ``skip_connects`` leaves out the CONNECTs it is true of."""
(``Lab(attribute_in=...)``), each summary says so: ``openers``. ``skip_connects`` leaves out the CONNECTs it is true of, ``skip_udp`` the datagrams (events) it is true of."""
queries = [(q.name, q.qtype, q.via) for q in lab.rec.slice("doh", phase)]
gateway = getattr(lab, "gateway", None)
attributing = bool(gateway is not None and gateway.attribute_in)
@@ -1088,7 +1320,7 @@ def phase_data(lab: Lab, phase: str, skip_connects: Callable[[str], bool] = lamb
connects = [e for e in lab.rec.of(phase, "connect") if not skip_connects(e["target"])]
return {"connects": connect_summary([e["target"] for e in connects], lab.norm, [e.get("opener") for e in connects]),
"dns": dns_summary(queries, [gateway.opener_of_connection(i) for i in asked_on] if attributing else None),
"udp": udp_summary(lab.rec.of(phase, "udp"), lab.norm), "requests": request_summary(lab.rec.of(phase, "http"), lab.norm)}
"udp": udp_summary([e for e in lab.rec.of(phase, "udp") if not skip_udp(e)], lab.norm), "requests": request_summary(lab.rec.of(phase, "http"), lab.norm)}
def launch_data(lab: Lab) -> Dict[str, Any]:
@@ -1403,22 +1635,89 @@ def walk_h3(browser: Any, lab: Lab, guard_ms: int = LEAVE_GUARD_MS) -> Dict[str,
def walk_webrtc(browser: Any, lab: Lab) -> Dict[str, Any]:
from _turn_chain import PASSWORD as TURN_PASSWORD # the one the lab's TURN server signs its answers with: a browser with another finds every success invalid and makes no relay
lab.rec.set_phase("webrtc")
context = browser.new_context(ignore_https_errors=True)
try:
page = context.new_page()
page.goto("http://%s:%d/rtc" % (PAGE_NAME, lab.site.port), wait_until="load", timeout=60000)
result = page.evaluate(RTC_JS, [STUN_URL, TURN_URL])
lab.webrtc["evaluate"] = {"called": lab.rec.now()}
result = page.evaluate(RTC_JS, [STUN_URL, TURN_URL, TURN_USERNAME, TURN_PASSWORD])
lab.webrtc["evaluate"]["returned"] = lab.rec.now()
finally:
context.close()
lab.rec.set_phase("webrtc.end")
data = phase_data(lab, "webrtc")
# What the page measured of itself goes to the evidence and to nothing that is compared: ``webrtc_summary`` reads the fields it always read.
lab.webrtc["page"] = result.pop("times", None)
# The TURN deallocation (a Refresh with LIFETIME 0) is one best-effort send at teardown, so it is evidence (``webrtc_evidence``) and no leaf. Source: dom/media/webrtc/transport/third_party/
# nICEr/src/stun/turn_client_ctx.cpp:693-730, ``nr_turn_client_deallocate``: ONE request, no retransmission, sent while the TURN context is destroyed. It reaches the lab in some walks and
# not in others for the same engine, so it is out of the datagrams counted for the TURN address (told by the mark the gateway wrote on it from its payload, not by when it came) and out
# of the messages (told by the transaction id the lab's TURN server wrote for it, recorded before the request itself).
ended = {tid.hex() for tid in lab.turn.deallocation_tids()}
data = phase_data(lab, "webrtc", skip_udp=lambda event: event["target"] == TURN_TARGET and bool(event.get("deallocation")))
lab.webrtc["counted"] = len(lab.rec.of("webrtc", "udp"))
out = webrtc_summary(result, lab.exit_ip)
marked = [e for e in lab.rec.of("webrtc", "udp") if e["target"] == TURN_TARGET and e.get("deallocation")]
out.update(connects=data["connects"], dns=data["dns"], udp=data["udp"],
turn={"messages": sorted({"0x%04x" % t for _ip, _port, t in lab.turn.seen}), "allocated": bool(lab.turn.allocations)})
turn={"messages": sorted({"0x%04x" % t for _when, tid, t, _credentials in lab.turn.requests if tid.hex() not in ended}), "allocated": bool(lab.turn.allocations),
"refused": len(lab.turn.refused), "deallocation": deallocation_facts(lab.turn, marked, closing_began(lab.webrtc["evaluate"]["called"], lab.webrtc["page"]))})
return lab.norm.walk(out)
def closing_began(called: float, page: Optional[Dict[str, Any]]) -> Optional[float]:
"""The moment, on the recorder's clock, from which the page was closing its connection: the recorder's time at which the walk called the page (``evaluate.called``) plus the time the page
measured from its start to its ``closing`` (``performance.now()`` in milliseconds, of the page's own clock: ``start`` and ``closing`` are both read there, so their difference is a length
of time and needs no common origin). The script starts at or after the call, so this is never later than the real moment: a deallocation before it was surely sent before the close.
None when the page did not return its times."""
if not isinstance(page, dict) or page.get("start") is None or page.get("closing") is None:
return None
return called + (page["closing"] - page["start"]) / 1000.0
def deallocation_facts(turn: Any, marked: List[Dict[str, Any]], began_closing: Optional[float]) -> Dict[str, int]:
"""What the lab heard of deallocations that a walk must not have: ``repeated`` allocations that were ended by more than one transaction, ``unallocated`` deallocations from an address
that has no allocation (both from the lab's TURN server), and ``early`` deallocation transactions that the gateway carried (``marked``, its events of them) before the page began closing
(``began_closing``, :func:`closing_began`; unknown: none is early). ``repeated`` and ``unallocated`` are 0 in a healthy walk and ``turn_deallocation_problems`` says it when they are not;
``early`` is evidence only (the page's clock cannot order it, see ``turn_deallocation_problems``). None of them is compared."""
ends: collections.Counter = collections.Counter()
unallocated = 0
for _ip, _port, _tid, _t, allocation in turn.deallocation_transactions():
if allocation is None:
unallocated += 1
else:
ends[allocation] += 1
first: Dict[Any, float] = {}
for event in marked:
first.setdefault(event.get("tid"), event["t"])
early = sum(1 for t in first.values() if began_closing is not None and t < began_closing)
return {"repeated": sum(1 for n in ends.values() if n > 1), "unallocated": unallocated, "early": early}
def webrtc_evidence(lab: Lab) -> Dict[str, Any]:
"""The WebRTC walk of a seed as it happened, outside the leaves that are compared: every datagram the gateway routed in its stages (when, to whom, the message, the STUN transaction id,
its stage, and whether it was already there when the summary of the walk was taken: ``counted``), the moments of the stages and of the page's call on the recorder's clock, and the
page's own ``performance.now()`` at each step of the gather (``page``: the offer, each candidate with its type, each error with its code and url, the end of the gather, the close).
It exists to tell two readings of a run that differs from itself apart: a close that cuts the retransmissions of the TURN server short at a variable point, and a retransmission of the
first request whose answer came late."""
info = getattr(lab, "webrtc", None) or {}
began = lab.rec.phase_t.get("webrtc")
counted = info.get("counted")
datagrams = [{"t": e["t"], "phase": e["phase"], "target": e["target"], "message": e["message"], "tid": e.get("tid"), "counted": counted is None or i < counted}
for i, e in enumerate(lab.rec.of("webrtc", "udp"))]
# The lab's TURN server: each request with what it carried and what it answered; the relay's datagrams back to the browser: the address each claims and the 5-tuple it goes to.
exchanges = [e for e in getattr(getattr(lab, "turn", None), "exchanges", None) or [] if began is None or e["t"] >= began]
returned = [{"t": e["t"], "phase": e["phase"], "claimed": e["claimed"], "to": e["to"], "relay": e["relay"], "message": e["message"], "tid": e.get("tid")} for e in lab.rec.of("webrtc", "udp_back")]
# The deallocation (a Refresh with LIFETIME 0, sent once at teardown): whether the lab's TURN server heard it, and for each transaction when (the recorder's clock, from the exchange of
# the same transaction id) and which. It is no leaf: the walk leaves it out of what it compares.
heard = getattr(getattr(lab, "turn", None), "deallocation_transactions", None)
when = {e["tid"]: e["t"] for e in reversed(exchanges)}
records = [{"t": when.get(tid.hex()), "tid": tid.hex(), "src": "%s:%d" % (ip, port), "allocation": allocation} for ip, port, tid, _t, allocation in (heard() if heard else [])]
return {"phase_t": {name: lab.rec.phase_t.get(name) for name in ("webrtc", "webrtc.end")}, "evaluate": info.get("evaluate"), "page": info.get("page"), "datagrams": datagrams,
"turn": exchanges, "returned": returned, "send_errors": list(getattr(getattr(lab, "gateway", None), "send_errors", None) or []),
"deallocation": {"seen": bool(records), "records": records}}
def direct_report(lab: Lab, watcher: Any, trap: Any) -> Dict[str, Any]:
"""Everything that reached the lab or the network around the proxy. Each list is empty on a browser that keeps its word; a watcher that never saw the
browser is a list with that fact in it (a sink that sees nothing proves nothing)."""
@@ -1515,7 +1814,7 @@ def wire_evidence(lab: Lab) -> Dict[str, Any]:
for q in lab.h3.snapshot()["quic"]:
h3.append({"phase": q["phase"], "requests": [{"t": r.get("t"), "written": r.get("written_t"),
"request": "%s %s" % (dict(r["headers"]).get(":method"), lab.norm.text(dict(r["headers"]).get(":path", "")))} for r in q["requests"]]})
return {"journey": journey, "https": https, "h3": h3}
return {"journey": journey, "https": https, "h3": h3, "webrtc": webrtc_evidence(lab)}
def sentinel_signature(lab: Lab) -> Dict[str, Any]:
@@ -1726,15 +2025,28 @@ def judge(report: Dict[str, Any], control: bool) -> int:
return 2 if control else 1
def run_engine(binary: str, seal: Optional[str], label: str, seeds: Tuple[int, ...], out: Path) -> int:
"""``run`` in a process of its own: the seal a process runs under is read at import, so each engine gets its own."""
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
def engine_env(seal: Optional[str], python: Optional[str] = None) -> Dict[str, str]:
"""The environment of a process that runs one engine: its seal, no autofix, no pin check, no browser logging. With `python` (the published set's venv,
scripts/ci_published_set.py) it is the set's: nothing of the candidate's job that makes it import another core or run another seal, and the pin check stays on."""
if python:
from ci_published_set import clean_env
env = clean_env({"INVISIBLE_CORE_AUTOFIX": "off"})
else:
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
if seal:
env["INVISIBLE_SEAL_FILE"] = str(seal)
for name in ("MOZ_LOG", "MOZ_LOG_FILE"):
env.pop(name, None)
return env
def run_engine(binary: str, seal: Optional[str], label: str, seeds: Tuple[int, ...], out: Path, python: Optional[str] = None) -> int:
"""``run`` in a process of its own: the seal a process runs under is read at import, so each engine gets its own. `python` is the published set's: the control
side runs in the venv that holds the published core and wrapper, never in the candidate's."""
env = engine_env(seal, python)
env[crash.CRASH_DIR_ENV] = str(Path(out).parent / (Path(out).stem + ".crash")) # footprint-68.json -> transcript-68.crash/: what a launch that did not end with 0 left
command = [sys.executable, "-u", str(Path(__file__).resolve()), "run", "--binary", binary, "--label", label, "--seeds", ",".join(map(str, seeds)), "--out", str(out)]
command = [python or sys.executable, "-u", str(Path(__file__).resolve()), "run", "--binary", binary, "--label", label, "--seeds", ",".join(map(str, seeds)), "--out", str(out)]
print("=== run %s: %s (seal %s)" % (label, binary, seal or "the one this process has"))
sys.stdout.flush()
from ci_ab_oracle import own_cache_env
@@ -1746,6 +2058,168 @@ def run_engine(binary: str, seal: Optional[str], label: str, seeds: Tuple[int, .
return 124
# ---------------------------------------------------------------------------------------------------------------------------------
# The hunt: one walk of one seed, repeated, and the evidence of each repetition (never a verdict)
# ---------------------------------------------------------------------------------------------------------------------------------
def parse_hunt(text: str) -> Tuple[str, int, int]:
"""``webrtc:<seed>:<n>`` -> ``("webrtc", seed, n)``. Anything else is a usage error: the walk is named, the seed and the count are whole numbers, and n is at least 1."""
parts = (text or "").strip().split(":")
if len(parts) != 3 or parts[0] != "webrtc":
raise ValueError("%s is %r: expected webrtc:<seed>:<n>" % (HUNT_ENV, text))
try:
seed, n = int(parts[1]), int(parts[2])
except ValueError:
raise ValueError("%s is %r: the seed and n are whole numbers" % (HUNT_ENV, text)) from None
if n < 1:
raise ValueError("%s is %r: n is at least 1" % (HUNT_ENV, text))
return parts[0], seed, n
def hunt_counts(evidence: Optional[Dict[str, Any]]) -> Dict[str, int]:
"""Datagrams to the TURN server in a repetition: ``counted`` as the summary of the walk (what the A/A compares) took them, ``all`` with the ones that came after."""
turn = [d for d in (evidence or {}).get("datagrams") or [] if d.get("target") == TURN_TARGET]
return {"counted": sum(1 for d in turn if d.get("counted")), "all": len(turn)}
def hunt_repetition(binary: str, label: str, i: int, seed: int, patch: Any, out_dir: Optional[Path] = None) -> Dict[str, Any]:
"""One repetition: a launch behind a lab as the main launch has it, the WebRTC walk only, the close, and what the lab saw of it. A failure is the ``error`` of the record."""
record: Dict[str, Any] = {"format": HUNT_FORMAT, "engine": label, "i": i, "seed": seed, "error": None, "evidence": None}
if out_dir is not None:
# The engine logs to ``<out_dir>/<engine>-<i>-mozlog`` (its child processes to the same name with ``.child-N``): the launch inherits this process's environment.
record["mozlog"] = "%s-%d-mozlog" % (label, i)
patch.setenv("MOZ_LOG", HUNT_MOZ_LOG)
patch.setenv("MOZ_LOG_FILE", str(Path(out_dir) / record["mozlog"]))
try:
with open_lab(journey=True, wire=True) as lab:
begin_launch(seed, "hunt")
session = launch(binary, seed, lab, patch)
with session as browser:
browser.new_context(ignore_https_errors=True).new_page() # Glean is born when a window opens (``glean_ready``); the walk opens its own context
record.update(glean_ready(session, seed, "hunt"))
record["walk"] = guarded(lambda: walk_webrtc(browser, lab))
record["evidence"] = webrtc_evidence(lab) # after the close: the datagrams the close leaves in flight are in it
except Exception as exc: # noqa: BLE001 - evidence, never a verdict
record["error"] = _first_line(exc)
finally:
if out_dir is not None:
patch.delenv("MOZ_LOG", raising=False)
patch.delenv("MOZ_LOG_FILE", raising=False)
record["counts"] = hunt_counts(record["evidence"])
return record
def hunt_run(binary: str, label: str, seed: int, n: int, out_dir: Path) -> int:
"""``n`` repetitions of the WebRTC walk of ``seed`` with one engine, each written to ``<out_dir>/<label>-<i>.json``. Exits 0: it decides nothing."""
import pytest
patch = pytest.MonkeyPatch()
work = Path(tempfile.mkdtemp(prefix="ab-network-hunt-"))
try:
import _lab_egress
_lab_egress.install(patch, work)
global RUN_LABEL
RUN_LABEL = label
out_dir.mkdir(parents=True, exist_ok=True)
for i in range(1, n + 1):
record = hunt_repetition(binary, label, i, seed, patch, out_dir)
write_json(out_dir / ("%s-%d.json" % (label, i)), record)
print("hunt %s %d/%d: %d datagrams to the TURN server (%d with the late ones)%s" % (
label, i, n, record["counts"]["counted"], record["counts"]["all"], "" if record["error"] is None else ", ERROR " + record["error"]))
sys.stdout.flush()
return 0
finally:
patch.undo()
shutil.rmtree(work, ignore_errors=True)
def hunt_summary(records: List[Dict[str, Any]]) -> Dict[str, Any]:
"""The summary of the repetition files: per repetition the count of datagrams to the TURN server (``count_3478``: as the A/A counts them; ``count_3478_all``: with the late ones) and, per
target, the transaction ids in the order they first appeared with the number of datagrams each carried (``[tid, n]``: a retransmission repeats its request's id); per engine, how often
each count came."""
repetitions = []
distribution: Dict[str, collections.Counter] = {}
for record in records:
counts = hunt_counts(record.get("evidence"))
groups: Dict[str, Dict[Any, int]] = {}
for d in (record.get("evidence") or {}).get("datagrams") or []:
tids = groups.setdefault(d["target"], {})
tids[d.get("tid")] = tids.get(d.get("tid"), 0) + 1
repetitions.append({"engine": record["engine"], "i": record["i"], "count_3478": counts["counted"], "count_3478_all": counts["all"],
"targets": {t: [[tid, n] for tid, n in groups[t].items()] for t in sorted(groups)}, "error": record.get("error")})
distribution.setdefault(record["engine"], collections.Counter())[counts["counted"]] += 1
return {"format": HUNT_SUMMARY_FORMAT, "target": TURN_TARGET, "repetitions": repetitions,
"count_3478_by_engine": {engine: {str(k): v for k, v in sorted(c.items())} for engine, c in sorted(distribution.items())}}
def read_hunt_records(folder: Path) -> List[Dict[str, Any]]:
"""The repetition files of a folder, by engine and repetition."""
records = []
for path in sorted(Path(folder).glob("*.json")):
document = json.loads(path.read_text(encoding="utf-8"))
if document.get("format") == HUNT_FORMAT:
records.append(document)
return sorted(records, key=lambda r: (r["engine"], r["i"]))
#: The safety net of a hunt's engine run, in seconds: a base and a share per repetition (a launch, Glean, the gather's own 30 s). Never a verdict.
HUNT_BASE_S = 600
HUNT_PER_REPETITION_S = 120
def hunt_engine(binary: str, seal: Optional[str], label: str, seed: int, n: int, out_dir: Path, python: Optional[str] = None) -> int:
"""``hunt_run`` in a process of its own, as ``run_engine`` runs ``run``: each engine its own seal and its own cache."""
env = engine_env(seal, python)
command = [python or sys.executable, "-u", str(Path(__file__).resolve()), "hunt-run", "--binary", binary, "--label", label, "--seed", str(seed), "--n", str(n), "--out", str(out_dir)]
print("=== hunt %s: %s (seal %s), %d repetitions of the WebRTC walk of seed %d" % (label, binary, seal or "the one this process has", n, seed))
sys.stdout.flush()
from ci_ab_oracle import own_cache_env
try:
with tempfile.TemporaryDirectory(prefix="ab-network-cache-") as cache:
return subprocess.run(command, env=own_cache_env(env, cache), timeout=HUNT_BASE_S + n * HUNT_PER_REPETITION_S).returncode
except subprocess.TimeoutExpired:
return 124
def published_engine(args: argparse.Namespace, work: Path) -> Tuple[str, Optional[str], Optional[str]]:
"""The published engine of an ``ab``: the binary the caller gave (run as this process is), or the one the published set fetches with its own core (its seal and its
python: the control side runs in that venv)."""
if args.published_binary:
return str(args.published_binary), (str(args.published_seal) if args.published_seal else None), None
import ci_ab_oracle as oracle
binary, seal, python = oracle.split_published(oracle.fetch_published(args.engine_tag, work))
return binary, (str(seal) if seal else None), python
def cmd_hunt(args: argparse.Namespace, spec: str) -> int:
"""``ab`` with ``AB_NETWORK_HUNT=webrtc:<seed>:<n>``: the WebRTC walk of that seed, ``n`` times, for each engine of the A/A (the published engine twice), written to ``<out>/hunt``:
``<engine>-<i>.json`` per repetition and ``summary.json``. It decides nothing and exits 0 (2 only for a spec that does not read)."""
try:
_walk, seed, n = parse_hunt(spec)
except ValueError as exc:
print("FAIL " + str(exc))
return 2
out = Path(args.out) / "hunt"
out.mkdir(parents=True, exist_ok=True)
work = Path(tempfile.mkdtemp(prefix="ab-network-"))
try:
binary, seal, python = published_engine(args, work)
for label in (args.engine_tag, args.engine_tag + "-again"):
code = hunt_engine(binary, seal, label, seed, n, out, **({"python": python} if python else {}))
if code != 0:
print("hunt %s ended with %s" % (label, code))
summary = hunt_summary(read_hunt_records(out))
write_json(out / "summary.json", summary)
for r in summary["repetitions"]:
print("hunt %s %d: %d to the TURN server (%d with the late ones); %s" % (r["engine"], r["i"], r["count_3478"], r["count_3478_all"], r["targets"].get(TURN_TARGET)))
print("hunt summary written: %s" % (out / "summary.json"))
return 0
finally:
shutil.rmtree(work, ignore_errors=True)
def compare_files(a: Path, b: Path, out: Optional[Path], floor: int, volatile_path: Path, control: bool) -> Dict[str, Any]:
ta, tb = read_transcript(a), read_transcript(b)
report = compare_transcripts(ta, tb, load_volatile(volatile_path), floor, ta.get("label", "A"), tb.get("label", "B"))
@@ -1757,6 +2231,13 @@ def compare_files(a: Path, b: Path, out: Optional[Path], floor: int, volatile_pa
def cmd_ab(args: argparse.Namespace) -> int:
if args.engine_tag is None:
from ci_ab_oracle import default_tag
args.engine_tag = default_tag()
spec = os.environ.get(HUNT_ENV)
if spec:
return cmd_hunt(args, spec)
out = Path(args.out)
out.mkdir(parents=True, exist_ok=True)
seeds = parse_seeds(args.seeds)
@@ -1768,18 +2249,12 @@ def cmd_ab(args: argparse.Namespace) -> int:
return 2
work = Path(tempfile.mkdtemp(prefix="ab-network-"))
try:
if args.published_binary:
binary, seal = str(args.published_binary), (str(args.published_seal) if args.published_seal else None)
else:
import ci_ab_oracle as oracle
binary, seal = oracle.fetch_published(args.engine_tag, work)
seal = str(seal)
binary, seal, python = published_engine(args, work)
tag = args.engine_tag.rsplit("-", 1)[-1]
first, again = out / ("transcript-%s.json" % tag), out / ("transcript-%s-again.json" % tag)
problems = []
for path, label in ((first, args.engine_tag), (again, args.engine_tag + "-again")):
if run_engine(binary, seal, label, seeds, path) != 0 or not path.is_file():
if run_engine(binary, seal, label, seeds, path, **({"python": python} if python else {})) != 0 or not path.is_file():
problems.append("the run %s did not produce a transcript" % label)
if problems:
print("\n".join("FAIL " + p for p in problems))
@@ -1810,6 +2285,12 @@ def main(argv: Optional[List[str]] = None) -> int:
r.add_argument("--label", default="engine")
r.add_argument("--seeds", default=None)
r.add_argument("--out", type=Path, required=True)
h = sub.add_parser("hunt-run", help="one engine: the WebRTC walk of one seed, n times (what AB_NETWORK_HUNT makes `ab` run)")
h.add_argument("--binary", required=True)
h.add_argument("--label", required=True)
h.add_argument("--seed", type=int, required=True)
h.add_argument("--n", type=int, required=True)
h.add_argument("--out", type=Path, required=True)
c = sub.add_parser("compare", help="two transcripts: the diff and the leaf count")
c.add_argument("a", type=Path)
c.add_argument("b", type=Path)
@@ -1826,7 +2307,7 @@ def main(argv: Optional[List[str]] = None) -> int:
a.add_argument("--candidate-seal", default=os.environ.get("INVISIBLE_SEAL_FILE"))
a.add_argument("--published-binary", type=Path, default=None, help="use this binary as the published engine instead of fetching it")
a.add_argument("--published-seal", type=Path, default=None)
a.add_argument("--engine-tag", default=ENGINE_TAG)
a.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
a.add_argument("--seeds", default=None)
a.add_argument("--floor", type=int, default=0)
a.add_argument("--volatile", type=Path, default=VOLATILE_FILE)
@@ -1835,6 +2316,8 @@ def main(argv: Optional[List[str]] = None) -> int:
args = ap.parse_args(argv)
if args.cmd == "run":
return run(args.binary, args.label, parse_seeds(args.seeds), args.out)
if args.cmd == "hunt-run":
return hunt_run(args.binary, args.label, args.seed, args.n, args.out)
if args.cmd == "compare":
return judge(compare_files(args.a, args.b, args.out, args.floor, args.volatile, args.a_a), args.a_a)
if args.cmd == "judge":
+229 -75
View File
@@ -3,17 +3,19 @@
A page reads the same values from two engines that differ only by the work of one
release. This runs the host gate's dump (scripts/ci_host_gate.py dump: the page in
scripts/host_gate, whole APIs) twice on the SAME machine, with the same core and the same
wrapper, over the persona seeds (ci/persona-seeds.json, computed by scripts/persona_cover.py
scripts/host_gate, whole APIs) twice on the SAME machine, each engine with ITS OWN core and wrapper
(the published engine with the published set, the candidate with core_ref and wrapper_ref), over the persona seeds (ci/persona-seeds.json, computed by scripts/persona_cover.py
from the prefs the core emits: the `candidate` set, 5 seeds that reach every webgl renderer
and every DPR, or the `final` set, 20 seeds that reach every value of every dimension). Each
seed runs at its OWN DPR (nothing is pinned):
1. with the published engine (firefox-68 by default): its seal and its archive are
downloaded the way the core downloads an engine (the release's seal.json, then
invisible_core.download.ensure_binary under that seal, which checks the sha256 of
the archive against the seal and the engine against the seal);
2. with the candidate binary the gate already holds, under its own seal.
1. with the published engine: the one the PUBLISHED SET carries (scripts/ci_published_set.py:
the last wrapper on the index, the core it pins, the engine that core's seal pins). The
set's venv fetches its own engine the way a user's core does (ensure_binary under its
own seal, which checks the sha256 of the archive and the engine against the seal) and
the dump runs in that venv: the engine is launched by the core it was built for;
2. with the candidate binary the gate already holds, under its own seal, in the venv of
the job (core_ref, wrapper_ref).
The dump also reads what the host gate's retail comparison leaves alone, the ab. leaves (ci_host_gate.is_ab): ab.poison on every seed (zone, language, colour scheme, a
canary font and the audio context, which scripts/ci_poison_host.py holds to the declared identity on a poisoned host) and, on seeds 0 and 63, the extra visit of every realm and
@@ -27,8 +29,15 @@ the two values and the seed. It is also red when a visit is missing on one side,
visit compares fewer leaves than MIN_LEAVES says: a page that dumped less than the host gate's
own reference would pass anything.
DECLARED DIFFERENCES. ci/ab-oracle-expected.json (format ab-oracle-expected/1) lists, one row per os x seed x dpr x leaf, the differences between the published engine and the candidate that a
release is known to make, each with the two values and the reason. They are applied to the A/B only, never to the A/A (the engine against itself has none). A difference is allowed only
when a row matches it exactly: the same os (the leg's), seed, dpr and leaf, and both values. Any other difference is red, and so is a row that does not show in the run (its os, a visit the
run made, and no matching difference): it is STALE and the verdict says "remove it". The rows say what the published engine reads and what the candidate reads, never a tag: when the published set
moves to the release that holds the candidate's work, the two sides agree on those leaves, every row is stale, and the stale check forces them out. A row for a visit this run did not make (another
shard, another seed set) is not judged here.
python ci_ab_oracle.py run <candidate-firefox> --candidate-seal gate.seal.json \\
--leg linux-x86_64 --out ab-oracle [--engine-tag firefox-68] [--seed-set candidate|final] [--shard i/n]
--leg linux-x86_64 --out ab-oracle [--engine-tag <the set's tag>] [--seed-set candidate|final] [--shard i/n]
python ci_ab_oracle.py run --published-binary <firefox> --leg linux-x86_64 --out ab-oracle --limit 2 (the A/A alone)
python ci_ab_oracle.py compare ab-oracle [--a-a] [--seed-set ...] [--shard i/n] (again, from the dumps)
@@ -83,11 +92,21 @@ from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
import ci_crash_evidence as crash # noqa: E402
import ci_host_gate as gate # noqa: E402
import ci_published_set as published_set # noqa: E402
import persona_cover as personas # noqa: E402
FORMAT = "ab-oracle/1"
#: The engine the candidate is held to: the last one published.
ENGINE_TAG = "firefox-68"
EXPECTED_FORMAT = "ab-oracle-expected/1"
EXPECTED_FILE = Path(__file__).resolve().parents[1] / "ci" / "ab-oracle-expected.json"
#: What a row of the file has, and nothing else.
EXPECTED_KEYS = ("id", "os", "seed", "dpr", "leaf", "published", "candidate", "reason")
#: The legs the gate runs, and the os a row names for each.
LEG_OS = {"linux-x86_64": "linux", "win-x86_64": "windows"}
#: The control side is the PUBLISHED SET (scripts/ci_published_set.py): the wrapper the index published last, the core that wrapper pins, and the engine that core's seal pins, in a venv
#: of their own. The variable names that venv's python; the job sets it (or the oracle's test makes the venv from the run's wheelhouse). No tag is written in this file: the engine the
#: candidate is held to is the one the set carries, so a new release is the new baseline.
PUBLISHED_PYTHON_ENV = "INVPW_PUBLISHED_PYTHON"
SET_SCRIPT = Path(__file__).resolve().parent / "ci_published_set.py"
CANDIDATE = "candidate"
#: What the host gate's own reference holds per visit (non-diag leaves at each DPR, today).
#: A visit that compares fewer leaves than this is red. Moves by hand with the reference
@@ -192,8 +211,68 @@ def tab_crashes(leaves: dict) -> list:
return [(launch, f.get("error"), f.get("step")) for (_second, launch), f in sorted(found.items())]
def os_of_leg(leg: str) -> str:
"""The os a row of the declared differences names for this leg ("linux-x86_64" is linux, "win-x86_64" is windows); any other leg is refused."""
if leg not in LEG_OS:
raise SystemExit("--leg is one of %s, not %r: the declared differences are per os" % ("/".join(sorted(LEG_OS)), leg))
return LEG_OS[leg]
def load_expected(path: Path | None = None) -> list:
"""The rows of ci/ab-oracle-expected.json (EXPECTED_FILE when no path is given). Refused: another format, a row that does not have exactly EXPECTED_KEYS, an os that is not
linux or windows, an empty reason, two rows with one id or with one (os, seed, dpr, leaf)."""
path = Path(path or EXPECTED_FILE)
document = json.loads(path.read_text(encoding="utf-8"))
if document.get("format") != EXPECTED_FORMAT:
raise SystemExit("%s is not an %s file" % (path, EXPECTED_FORMAT))
rows, ids, places = document["differences"], set(), set()
for row in rows:
if sorted(row) != sorted(EXPECTED_KEYS):
raise SystemExit("%s: the row %r has the keys %s, it must have exactly %s" % (path, row.get("id"), sorted(row), sorted(EXPECTED_KEYS)))
if row["os"] not in LEG_OS.values():
raise SystemExit("%s: the row %r names the os %r, it is linux or windows" % (path, row["id"], row["os"]))
if not str(row["reason"]).strip():
raise SystemExit("%s: the row %r has no reason" % (path, row["id"]))
place = (row["os"], row["seed"], row["dpr"], row["leaf"])
if row["id"] in ids or place in places:
raise SystemExit("%s: the row %r is declared twice (by id, or by os, seed, dpr and leaf)" % (path, row["id"]))
ids.add(row["id"])
places.add(place)
return rows
def _same_value(a, b) -> bool:
"""Equal as JSON says it (1 is not true, a list is its elements in order)."""
return json.dumps(a, sort_keys=True) == json.dumps(b, sort_keys=True)
def declared_covers(entry: dict, os_name: str, diff: dict) -> bool:
"""A row covers a difference only when os, seed, dpr, leaf and BOTH values are the row's."""
return (entry["os"] == os_name and entry["seed"] == diff["seed"] and entry["dpr"] == diff["dpr"] and entry["leaf"] == diff["leaf"]
and _same_value(entry["published"], diff["a"]) and _same_value(entry["candidate"], diff["b"]))
def apply_declared(differences: list, declared: list, os_name: str, seen: set, expected) -> tuple:
"""(the differences no row covers, the differences the rows cover with the id of the row, the stale rows).
A row is judged only when it names this os and a visit this run asked for and both sides have (`seen`); it is stale when no difference of the run is exactly its own."""
left, covered, stale = list(differences), [], []
for entry in declared:
visit = (entry["dpr"], entry["seed"])
if entry["os"] != os_name or visit not in expected or visit not in seen:
continue
hit = [d for d in left if declared_covers(entry, os_name, d)]
if not hit:
stale.append(entry)
for d in hit:
left.remove(d)
covered.append(dict(d, id=entry["id"]))
return left, covered, stale
def compare_visits(a: dict, b: dict, noise: list, min_leaves: dict | None = None,
expected: tuple | None = None, relaunch: tuple | None = None) -> dict:
expected: tuple | None = None, relaunch: tuple | None = None,
declared: list | None = None, os_name: str | None = None) -> dict:
"""a and b map (dpr, seed) to the items of that visit (as the dump returns them).
Returns the report: {"verdict": "green"|"red", "problems": [str], "differences":
@@ -202,7 +281,12 @@ def compare_visits(a: dict, b: dict, noise: list, min_leaves: dict | None = None
fewest leaves a visit of that dpr may compare; `expected` is the visits both sides must have
(default: every seed at every DPR of the host gate). `relaunch` is the visits that were launched twice on one profile (default: those of RELAUNCH_SEED among the expected ones): each side must have the
second launch's leaves (prefix `relaunch.`) in them, as many as the floor, counted apart (report["relaunch"]), and a side must not have them in a visit that
was not asked to."""
was not asked to.
`declared` is the rows of ci/ab-oracle-expected.json, applied only with the `os_name` of the leg: the A/B passes them, the A/A never does. A difference that a row covers exactly
is not a problem and is listed in report["declared"] with the row's id; a row that this run does not show is a problem (stale) and its id is in report["stale"]."""
if declared and os_name is None:
raise ValueError("declared differences are per os: say which (os_name)")
min_leaves = MIN_LEAVES if min_leaves is None else min_leaves
if expected is None:
expected = tuple((dpr, seed) for dpr in gate.DPRS for seed in gate.SEEDS)
@@ -262,10 +346,14 @@ def compare_visits(a: dict, b: dict, noise: list, min_leaves: dict | None = None
" (the %d leaves of this visit that the tab could not read, or that only the other side has, are not compared)" % cascade[visit_name(c["dpr"], c["seed"])]
if visit_name(c["dpr"], c["seed"]) in cascade else "") for c in crashes]
problems = tab_lines + problems # the tab crash is the first line of the verdict, before anything it caused
covered, stale = [], []
if declared:
differences, covered, stale = apply_declared(differences, declared, os_name, {k for k in a if k in b}, expected)
problems += ["the declared difference %r (%s) does not show in this run: it is stale, remove it" % (e["id"], e["reason"]) for e in stale]
for d in differences:
problems.append("seed %d dpr %s %s: %s" % (d["seed"], d["dpr"], d["leaf"], d["what"]))
return {"verdict": "red" if problems else "green", "problems": problems, "differences": differences, "tab_crashes": crashes,
"compared": compared, "relaunch": relaunched, "excused": excused}
"compared": compared, "relaunch": relaunched, "excused": excused, "declared": covered, "stale": [e["id"] for e in stale]}
# -
@@ -292,8 +380,9 @@ def unpack(document: dict) -> dict:
def judge(published: dict, candidate: dict, noise: list, extra_problems=(), expected: tuple | None = None,
relaunch: tuple | None = None) -> dict:
report = compare_visits(published, candidate, noise, expected=expected, relaunch=relaunch)
relaunch: tuple | None = None, declared: list | None = None, os_name: str | None = None) -> dict:
"""The verdict on two sets of visits. `declared` and `os_name` are the A/B's: the rows of ci/ab-oracle-expected.json and the os of the leg; the A/A is judged without them."""
report = compare_visits(published, candidate, noise, expected=expected, relaunch=relaunch, declared=declared, os_name=os_name)
if extra_problems:
crashed = [x for x in report["problems"] if x.startswith(TAB_CRASH)] # a tab that died is named before the exit code of the dump it left
report["problems"] = crashed + list(extra_problems) + report["problems"][len(crashed):]
@@ -312,6 +401,11 @@ def print_report(report: dict, published: str, other: str = CANDIDATE, title: st
report["excused"]))
if report.get("relaunch"):
print("second launch on a reused profile, leaves per visit: %s" % ", ".join("%s %d" % kv for kv in sorted(report["relaunch"].items())))
if report.get("declared"):
print("%d differences declared in ci/ab-oracle-expected.json (the A/B only), each one exactly as its row says:" % len(report["declared"]))
for d in report["declared"]:
print("DECLARED %s seed %d dpr %s leaf %s: %s | %s" % (d["id"], d["seed"], d["dpr"], d["leaf"],
json.dumps(d["a"], sort_keys=True)[:80], json.dumps(d["b"], sort_keys=True)[:80]))
for d in report["differences"][:PRINT_LIMIT]:
print("DIFF seed %d dpr %s leaf %s: %s %s | %s %s" % (d["seed"], d["dpr"], d["leaf"], published,
json.dumps(d["a"], sort_keys=True)[:160],
@@ -327,35 +421,68 @@ def print_report(report: dict, published: str, other: str = CANDIDATE, title: st
# -
# The run: two dumps, one per engine, as subprocesses (the seal a process runs under is read at import).
def fetch_published(tag: str, work: Path) -> tuple:
"""(binary, seal path) of the published engine `tag`, fetched the way the core fetches an engine."""
os.environ.setdefault("INVISIBLE_CORE_AUTOFIX", "off")
os.environ.setdefault("INVISIBLE_CORE_PIN", "allow")
from invisible_core import download
from invisible_core.constants import RELEASE_URL_TEMPLATE
from invisible_core.seal import load_seal
def published_python() -> str:
"""The python of the published set's venv (INVPW_PUBLISHED_PYTHON). RuntimeError when there is none: a candidate held to a control that is not the published set is
the broken control this file used to run (the candidate's core with the published engine, which refuses a launch whose declarations that core does not emit)."""
python = os.environ.get(PUBLISHED_PYTHON_ENV)
if not python or not Path(python).is_file():
raise RuntimeError("%s names no python (%r): the control side of an A/B is the PUBLISHED SET in a venv of its own (scripts/ci_published_set.py install --house <the "
"run's wheelhouse> --venv <dir>, then export the python it prints), never the core and the wrapper of the candidate" % (PUBLISHED_PYTHON_ENV, python))
return python
owner, repo = download._parse_owner_repo(RELEASE_URL_TEMPLATE)
seal_path = work / ("seal-%s.json" % tag)
sources = download.release_asset_urls(owner, repo, tag, "seal.json",
RELEASE_URL_TEMPLATE.format(tag=tag, asset="seal.json"))
download._download_file(sources, seal_path)
seal = load_seal(seal_path)
if seal.tag != tag or seal.is_local:
raise SystemExit("the seal of the release %s says tag %r (local: %s)" % (tag, seal.tag, seal.is_local))
print("published engine %s: %s" % (tag, seal.describe()))
def set_command(python: str, *argv: str) -> list:
"""`python scripts/ci_published_set.py <argv>`, run BY the set's python: stdlib and its own invisible_core."""
return [python, str(SET_SCRIPT)] + list(argv)
def default_tag() -> str:
"""The tag of the engine the control side runs: the one the seal of the published set's core names; without a set (a pull request, whose engine IS the published one and
runs under the core the wrapper pins) the seal of the core of this process."""
python = os.environ.get(PUBLISHED_PYTHON_ENV)
if python and Path(python).is_file():
done = subprocess.run(set_command(python, "tag"), capture_output=True, text=True, env=published_set.clean_env(), timeout=120)
if done.returncode != 0:
raise RuntimeError("the published set's core names no seal tag: %s" % (done.stderr or done.stdout)[-600:])
return done.stdout.strip().splitlines()[-1]
from invisible_core.seal import active_seal
return active_seal().tag
def fetch_published(tag: str | None, work: Path) -> tuple:
"""(binary, None, python) of the published set: the engine its own core fetches under its own seal, and the python that is its venv's. `tag`, when given, is held
to the seal of the set (a label that names another engine than the one the set carries is a wrong control, said here)."""
python = published_python()
done = subprocess.run(set_command(python, "fetch", "--work", str(work)), capture_output=True, text=True, env=published_set.clean_env(), timeout=DUMP_TIMEOUT_S)
if done.returncode != 0:
raise RuntimeError("the published set could not fetch its engine (exit %s): %s" % (done.returncode, (done.stderr or done.stdout)[-800:]))
fetched = json.loads(done.stdout.strip().splitlines()[-1])
if tag and fetched["tag"] != tag:
raise RuntimeError("the control is labelled %s but the published set carries %s" % (tag, fetched["tag"]))
print("published engine %s: %s (core and wrapper of the published set, %s)" % (fetched["tag"], fetched["describe"], python))
sys.stdout.flush()
# the engine store of this fetch only: the dumps that follow run under the environment they were given
before = os.environ.get(download.ENGINE_DIR_ENV)
os.environ[download.ENGINE_DIR_ENV] = str(work / "engines")
try:
binary = download.ensure_binary(seal=seal)
finally:
if before is None:
os.environ.pop(download.ENGINE_DIR_ENV, None)
else:
os.environ[download.ENGINE_DIR_ENV] = before
return str(binary), seal_path
return fetched["binary"], None, python
def process_env(seal, python: str | None = None) -> dict:
"""The environment of a process that runs ONE engine: no autofix, no browser logging, and the seal of that engine. With `python` (the published set's venv) the process is the
set's: nothing of the candidate's job that could make it import another core or run another seal reaches it, and the core's pin check stays ON (a set whose wrapper and
core do not agree is refused, as it is on a user's machine). Without it (the candidate, or a pull request's published engine) it is as it always was."""
if python:
env = published_set.clean_env({"INVISIBLE_CORE_AUTOFIX": "off"})
else:
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
if seal: # None: the engine runs under the seal of the core it is launched with (the published set's, a pull request's published engine)
env["INVISIBLE_SEAL_FILE"] = str(seal)
for name in ("MOZ_LOG", "MOZ_LOG_FILE"): # the e2e legs log the engine; a run is as the host gate's
env.pop(name, None)
return env
def split_published(published: tuple) -> tuple:
"""(binary, seal, python or None) of a `published` tuple: two items (a binary given, run in this process's environment) or three (the published set)."""
return (published[0], published[1], published[2] if len(published) > 2 else None)
def own_cache_env(env: dict, folder: str, platform: str | None = None) -> dict:
@@ -381,27 +508,44 @@ def own_cache_env(env: dict, folder: str, platform: str | None = None) -> dict:
return out
def dump_with_exits(name: str, exe: str, seal_file, leg: str, visits, target: Path, out: Path) -> tuple:
def visits_complete(rc, target: Path, expected) -> tuple:
"""`(True, [])` when the dump ended with 0 and every visit of `expected` ([(dpr, seed)]) has its result in `target` and none of them lost its tab; else `(False, [what is missing])`.
This is where a run learns that its measurements are all there: the A/A's verdict on a known Mozilla defect depends on it (a crash that cost a measurement stays red)."""
missing = [] if rc == 0 else ["the dump process ended with %s" % (rc,)]
try:
got = read_visits(target) if target.is_dir() else {}
except (OSError, ValueError, KeyError, TypeError) as exc:
got = {}
missing.append("the dumps of %s cannot be read (%s: %s)" % (target.name, type(exc).__name__, exc))
missing += ["no dump of %s" % visit_name(*key) for key in expected if key not in got]
for key in expected:
if key in got and tab_crashes(comparable(got[key])):
missing.append("the tab of %s died: its leaves are not all there" % visit_name(*key))
return not missing, missing
def dump_with_exits(name: str, exe: str, seal_file, leg: str, visits, target: Path, out: Path, python: str | None = None, notes: list | None = None, control: bool = False) -> tuple:
"""The dump of one engine run as `run_dump` makes it, with the folder where its probe writes how each browser ended (`<out>/crash/<name>`, named to the dump process by
AB_CRASH_DIR): `(rc or "timeout", the red lines of the launches that did not end with 0, or that nobody saw)`. A dump process whose probe wrote nothing is red: an oracle
that does not see how its browsers end does not see them."""
that does not see how its browsers end does not see them.
`control` is the A/A's: a core a browser left while its parent ended with 0 is then judged against the known Mozilla defects (ci/mozilla-defects.json), with the run's measurements
complete only when every visit has its result (`visits_complete`); a crash that matches is a line of `notes` and not a red line. Any other dump judges no core: every core is red."""
crash_dir = out / "crash" / name
try:
with crash.environment(**{crash.CRASH_DIR_ENV: crash_dir}):
rc = run_dump(exe, Path(seal_file) if seal_file else None, leg, target, visits)
rc = run_dump(exe, Path(seal_file) if seal_file else None, leg, target, visits, **({"python": python} if python else {}))
except subprocess.TimeoutExpired:
rc = "timeout"
return rc, crash.exits_of_run(crash_dir, name, windows=leg.startswith("win"), needed=(rc == 0))
complete, missing = visits_complete(rc, target, visits) if control else (None, [])
return rc, crash.exits_of_run(crash_dir, name, windows=leg.startswith("win"), needed=(rc == 0), notes=notes, measurements_complete=complete, missing=missing, binary=exe)
def run_dump(binary: str, seal: Path | None, leg: str, out: Path, visits: list | None = None) -> int:
"""The host gate's dump of `visits` ([(dpr, seed)], each seed at its own DPR) as a subprocess; None is the host gate's own grid."""
env = dict(os.environ, INVISIBLE_CORE_AUTOFIX="off", INVISIBLE_CORE_PIN="allow")
if seal is not None: # None: the engine runs under the seal of the core it is launched with (a pull request's published engine)
env["INVISIBLE_SEAL_FILE"] = str(seal)
for name in ("MOZ_LOG", "MOZ_LOG_FILE"): # the e2e legs log the engine; a dump runs as the host gate's does
env.pop(name, None)
cmd = [sys.executable, str(Path(gate.__file__)), "dump", binary, "--leg", leg, "--out", str(out)]
def run_dump(binary: str, seal: Path | None, leg: str, out: Path, visits: list | None = None, python: str | None = None) -> int:
"""The host gate's dump of `visits` ([(dpr, seed)], each seed at its own DPR) as a subprocess; None is the host gate's own grid. `python` is the published set's: the
dump of the control side runs in the venv that holds the published core and wrapper, never in the candidate's."""
env = process_env(seal, python)
cmd = [python or sys.executable, str(Path(gate.__file__)), "dump", binary, "--leg", leg, "--out", str(out)]
if visits is not None:
if relaunch_visits(visits):
cmd += ["--relaunch-seed", str(RELAUNCH_SEED)]
@@ -419,13 +563,13 @@ def run(candidate: str, candidate_seal: Path, leg: str, out: Path, engine_tag: s
started = time.time()
problems, dumps = [], {}
try:
binary, seal = published or fetch_published(engine_tag, work)
for name, exe, seal_file in ((engine_tag, binary, seal), (CANDIDATE, candidate, candidate_seal)):
binary, seal, python = split_published(published or fetch_published(engine_tag, work))
for name, exe, seal_file, side_python in ((engine_tag, binary, seal, python), (CANDIDATE, candidate, candidate_seal, None)):
target = work / name
print("=== dump with %s: %s (seal %s), seeds %s"
% (name, exe, seal_file, " ".join("%d@%s" % (seed, dpr) for dpr, seed in visits)))
sys.stdout.flush()
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out)
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out, side_python)
if rc != 0:
problems.append("the dump with %s ended with %s" % (name, rc))
problems += exits
@@ -441,7 +585,7 @@ def run(candidate: str, candidate_seal: Path, leg: str, out: Path, engine_tag: s
finally:
shutil.rmtree(work, ignore_errors=True)
noise = gate.load_exceptions().get("noise", [])
report = judge(dumps[engine_tag], dumps[CANDIDATE], noise, problems, expected=tuple(visits))
report = judge(dumps[engine_tag], dumps[CANDIDATE], noise, problems, expected=tuple(visits), declared=load_expected(), os_name=os_of_leg(leg))
report.update(format=FORMAT, engine=engine_tag, leg=leg, seconds=round(time.time() - started),
visits=["%d@%s" % (seed, dpr) for dpr, seed in visits])
write_json(out / "diff.json", report)
@@ -454,13 +598,14 @@ def again_name(engine_tag: str) -> str:
return dump_name(engine_tag)[:-len(".json")] + "-again.json"
def _dump_visits(name: str, exe: str, seal_file, leg: str, visits: list, work: Path, out: Path, file_name: str) -> tuple:
"""One engine's dump of `visits`: ({(dpr, seed): items}, problems); the packed dump is written to out/file_name."""
def _dump_visits(name: str, exe: str, seal_file, leg: str, visits: list, work: Path, out: Path, file_name: str, python: str | None = None,
notes: list | None = None, control: bool = False) -> tuple:
"""One engine's dump of `visits`: ({(dpr, seed): items}, problems); the packed dump is written to out/file_name. `control` (the A/A's dumps) and `notes` are `dump_with_exits`'."""
target = work / name
print("=== dump with %s: %s (seal %s), seeds %s"
% (name, exe, seal_file or "of the core", " ".join("%d@%s" % (seed, dpr) for dpr, seed in visits)))
sys.stdout.flush()
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out)
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out, python, notes, control)
problems = ([] if rc == 0 else ["the dump with %s ended with %s" % (name, rc)]) + exits
dumped = read_visits(target) if target.is_dir() else {}
write_json(out / file_name, pack(name, dumped))
@@ -472,7 +617,8 @@ def run_ab(leg: str, out: Path, engine_tag: str, published: tuple | None = None,
"""The A/A (the published engine twice), then, with a candidate, the A/B against the first dump. 0 green, 1 a finding,
2 a broken control (the A/A differs, or a dump of it did not run: the A/B is not run) .
`published` is (binary, seal or None); without it the engine is fetched the way the core fetches one."""
`published` is (binary, seal or None) of a binary the caller gave, run in this process's environment, or (binary, None, python) of the published set; without it the
set the job made (INVPW_PUBLISHED_PYTHON) fetches its own engine."""
visits = select_visits() if visits is None else visits
expected = tuple(visits)
out.mkdir(parents=True, exist_ok=True)
@@ -480,20 +626,24 @@ def run_ab(leg: str, out: Path, engine_tag: str, published: tuple | None = None,
started = time.time()
noise = gate.load_exceptions().get("noise", [])
asked = ["%d@%s" % (seed, dpr) for dpr, seed in visits]
notes: list = [] # the cores of the A/A that the list of known Mozilla defects names: said, not red
try:
try:
binary, seal = published or fetch_published(engine_tag, work)
first, p1 = _dump_visits(engine_tag, binary, seal, leg, visits, work, out, dump_name(engine_tag))
again, p2 = _dump_visits(engine_tag + "-again", binary, seal, leg, visits, work, out, again_name(engine_tag))
binary, seal, python = split_published(published or fetch_published(engine_tag, work))
first, p1 = _dump_visits(engine_tag, binary, seal, leg, visits, work, out, dump_name(engine_tag), notes=notes, control=True, **({"python": python} if python else {}))
again, p2 = _dump_visits(engine_tag + "-again", binary, seal, leg, visits, work, out, again_name(engine_tag), notes=notes, control=True,
**({"python": python} if python else {}))
problems = p1 + p2
except SystemExit:
raise
except Exception as e: # noqa: BLE001 - a run that could not get its engine is red and says why
first, again, problems = {}, {}, ["%s: %s" % (type(e).__name__, str(e)[:500])]
control = judge(first, again, noise, problems, expected=expected)
control.update(format=FORMAT, engine=engine_tag, leg=leg, control=True, seconds=round(time.time() - started), visits=asked)
control.update(format=FORMAT, engine=engine_tag, leg=leg, control=True, seconds=round(time.time() - started), visits=asked, known_defects=notes)
write_json(out / "diff-a-a.json", control)
print_report(control, engine_tag, engine_tag + "-again", "AB ORACLE A/A")
for note in notes:
print("NOTE " + note)
if control["verdict"] != "green":
print("BROKEN CONTROL: the published engine differs from itself (or did not run twice), so what is compared is not stable: "
"the A/B is not run, and the candidate is not judged")
@@ -501,7 +651,7 @@ def run_ab(leg: str, out: Path, engine_tag: str, published: tuple | None = None,
if candidate is None:
return 0
cand, pc = _dump_visits(CANDIDATE, candidate, candidate_seal, leg, visits, work, out, "dump-%s.json" % CANDIDATE)
report = judge(first, cand, noise, pc, expected=expected)
report = judge(first, cand, noise, pc, expected=expected, declared=load_expected(), os_name=os_of_leg(leg))
report.update(format=FORMAT, engine=engine_tag, leg=leg, seconds=round(time.time() - started), visits=asked)
write_json(out / "diff.json", report)
print_report(report, engine_tag)
@@ -521,8 +671,8 @@ def run_clean(leg: str, out: Path, engine_tag: str, visits: list, published: tup
out.mkdir(parents=True, exist_ok=True)
work = Path(tempfile.mkdtemp(prefix="ab-oracle-clean-"))
try:
binary, seal = published or fetch_published(engine_tag, work)
_, problems = _dump_visits(engine_tag + "-clean", binary, seal, leg, visits, work, out, clean_name(engine_tag))
binary, seal, python = split_published(published or fetch_published(engine_tag, work))
_, problems = _dump_visits(engine_tag + "-clean", binary, seal, leg, visits, work, out, clean_name(engine_tag), **({"python": python} if python else {}))
except SystemExit:
raise
except Exception as e: # noqa: BLE001 - said, not raised: this is a by-product
@@ -534,7 +684,8 @@ def run_clean(leg: str, out: Path, engine_tag: str, visits: list, published: tup
return 1 if problems else 0
def recompare(directory: Path, engine_tag: str, visits: list | None = None, a_a: bool = False) -> int:
def recompare(directory: Path, engine_tag: str, visits: list | None = None, a_a: bool = False, leg: str | None = None) -> int:
"""`leg` (default: the os this runs on) says which rows of the declared differences apply to the A/B; the A/A takes none."""
visits = select_visits() if visits is None else visits
published = unpack(json.loads((directory / dump_name(engine_tag)).read_text(encoding="utf-8")))
if a_a:
@@ -545,7 +696,8 @@ def recompare(directory: Path, engine_tag: str, visits: list | None = None, a_a:
print_report(report, engine_tag, engine_tag + "-again", "AB ORACLE A/A")
return 0 if report["verdict"] == "green" else 2
candidate = unpack(json.loads((directory / ("dump-%s.json" % CANDIDATE)).read_text(encoding="utf-8")))
report = judge(published, candidate, gate.load_exceptions().get("noise", []), expected=tuple(visits))
leg = leg or ("win-x86_64" if sys.platform == "win32" else "linux-x86_64")
report = judge(published, candidate, gate.load_exceptions().get("noise", []), expected=tuple(visits), declared=load_expected(), os_name=os_of_leg(leg))
report.update(format=FORMAT, engine=engine_tag, visits=["%d@%s" % (seed, dpr) for dpr, seed in visits])
write_json(directory / "diff.json", report)
print_report(report, engine_tag)
@@ -568,7 +720,7 @@ def main(argv=None) -> int:
help="the candidate's seal (default: INVISIBLE_SEAL_FILE)")
r.add_argument("--leg", required=True)
r.add_argument("--out", type=Path, required=True)
r.add_argument("--engine-tag", default=ENGINE_TAG)
r.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
r.add_argument("--seed-set", choices=SEED_SETS, default=SEED_SET,
help="the persona seeds to visit (ci/persona-seeds.json), each at its own DPR")
r.add_argument("--shard", help="i/n: every n-th seed of the set from the i-th (the final set over n jobs)")
@@ -580,17 +732,18 @@ def main(argv=None) -> int:
k = sub.add_parser("clean", help="the published engine's dump on this (clean) machine, for the poisoned run's by-product")
k.add_argument("--leg", required=True)
k.add_argument("--out", type=Path, required=True)
k.add_argument("--engine-tag", default=ENGINE_TAG)
k.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
k.add_argument("--seed-set", choices=SEED_SETS, default=SEED_SET)
k.add_argument("--shard")
k.add_argument("--limit", type=int)
c = sub.add_parser("compare")
c.add_argument("directory", type=Path)
c.add_argument("--engine-tag", default=ENGINE_TAG)
c.add_argument("--engine-tag", default=None, help="the label of the control side (default: the tag the published set's seal names)")
c.add_argument("--seed-set", choices=SEED_SETS, default=SEED_SET)
c.add_argument("--shard")
c.add_argument("--limit", type=int)
c.add_argument("--a-a", action="store_true", help="compare the two dumps of the published engine (the control)")
c.add_argument("--leg", help="the leg the dumps are of, which says the os of the declared differences (default: this machine's)")
args = ap.parse_args(argv)
if args.cmd == "touched":
import ci_ab_pr_seeds as pr
@@ -598,10 +751,11 @@ def main(argv=None) -> int:
sys.stdout.reconfigure(newline="\n") # the line goes to $GITHUB_OUTPUT: a carriage return would be part of the value
print("touched=%s" % ("true" if touched(pr.changed_files(args.base)) else "false"))
return 0
args.engine_tag = args.engine_tag or default_tag()
if args.cmd == "clean":
return run_clean(args.leg, args.out, args.engine_tag, select_visits(args.seed_set, args.shard, limit=args.limit))
if args.cmd == "compare":
return recompare(args.directory, args.engine_tag, select_visits(args.seed_set, args.shard, limit=args.limit), args.a_a)
return recompare(args.directory, args.engine_tag, select_visits(args.seed_set, args.shard, limit=args.limit), args.a_a, args.leg)
if args.published_seal and not args.published_binary:
ap.error("--published-seal goes with --published-binary")
if args.candidate:
+2 -2
View File
@@ -28,10 +28,10 @@ ROOT = Path(__file__).resolve().parent.parent
SHARED = ("scripts/ci_ab_oracle.py", "scripts/ci_crash_evidence.py", "scripts/ci_ab_pr_seeds.py", "scripts/persona_cover.py", "ci/persona-seeds.json")
#: variable -> (oracle, seeds by default on a pull request that does not touch it, the files of the oracle: exact paths or fnmatch patterns).
ORACLES = {
"AB_ORACLE_PR_SEEDS": ("page", 2, SHARED + ("scripts/ci_host_gate.py", "scripts/ci_poison_host.py", "scripts/host_gate/*", "tests/test_ab_oracle*", "tests/test_ci_host_gate*",
"AB_ORACLE_PR_SEEDS": ("page", 2, SHARED + ("scripts/ci_host_gate.py", "scripts/ci_poison_host.py", "scripts/host_gate/*", "ci/ab-oracle-expected.json", "tests/test_ab_oracle*", "tests/test_ci_host_gate*",
"tests/test_ci_poison_host.py")),
"AB_NETWORK_PR_SEEDS": ("network", 1, SHARED + ("scripts/ci_ab_network.py", "ci/ab-network-volatile.json", "tests/test_ab_network*")),
"AB_HOST_PR_SEEDS": ("host", 2, SHARED + ("scripts/ci_ab_host.py", "tests/_strace_stand_in.py", "ci/ab-host-expected.json", "tests/test_ab_host*")),
"AB_HOST_PR_SEEDS": ("host", 2, SHARED + ("scripts/ci_ab_host.py", "tests/_strace_stand_in.py", "tests/_ab_host_declared.py", "ci/ab-host-expected.json", "tests/test_ab_host*")),
}
FALLBACK_SEEDS = 5
+325 -7
View File
@@ -117,9 +117,18 @@ def exit_problem(code, windows: bool | None = None, **who) -> str | None:
return "the parent process exited with code %s: %s" % (describe_exit(code, windows), where or "launch not named")
def exit_problems(launches, run: str, windows: bool | None = None, side: str | None = None) -> list:
"""The red lines of the launches a probe recorded (`LaunchProbe.launches`, or the `launches` of an exits file) for the run `run`."""
def exit_problems(launches, run: str, windows: bool | None = None, side: str | None = None, notes: list | None = None,
measurements_complete: bool | None = None, missing=(), binary: str | None = None, judge=None) -> list:
"""The red lines of the launches a probe recorded (`LaunchProbe.launches`, or the `launches` of an exits file) for the run `run`.
A launch whose parent ended with 0 and that left cores is judged against the known Mozilla defects when the caller says whether its measurements are complete
(`measurements_complete` True or False; `missing` names what is not there): every core is a crash record (`crash_record`), and the list's matcher (`defects_judge`,
the engine of `binary` for the version) rules on all of them at once. A launch whose crashes all match a defect and whose measurements are complete is not red: a
line `known Mozilla defect D<n> (<bug or not filed>): <why>: <who>` goes into `notes`. Any other result is the red line below plus the lines of the verdict. A caller that
does not know (`measurements_complete` None) judges nothing: its cores are red as ever. A launch whose parent did not end with 0, a minidump and a core with no record are
never excused."""
out = []
judges: list = []
for launch in launches or []:
who = {"run": run, "side": side or side_of(run)}
label = launch.get("label") or {}
@@ -132,12 +141,25 @@ def exit_problems(launches, run: str, windows: bool | None = None, side: str | N
out.append(line)
elif launch.get("cores") or launch.get("dmp"):
# the parent ended with 0 and a process of the browser left a core or a minidump: a content process died (the parent does not say so)
where = ", ".join("%s %s" % kv for kv in who.items() if kv[1] not in (None, ""))
line = "a process of the browser crashed while the parent ended with 0: %s left %s" % (
", ".join("%s %s" % kv for kv in who.items() if kv[1] not in (None, "")),
where,
" and ".join(x for x in ("core " + ", ".join(launch["cores"]) if launch.get("cores") else "", "minidump " + ", ".join(launch["dmp"]) if launch.get("dmp") else "") if x))
if launch.get("evidence"):
line += " (evidence: %s)" % launch["evidence"]
out.append(line)
if measurements_complete is None or not launch.get("cores") or launch.get("dmp"):
out.append(line)
continue
if not judges:
judges.append(judge if judge is not None else defects_judge(binary))
excused, lines = _judge_launch(judges[0], launch, measurements_complete, missing)
if excused:
for found in lines:
if notes is not None:
notes.append("known Mozilla defect %s: %s" % (found[len("MATCHED "):], where))
else:
out.append(line)
out.extend(lines)
return out
@@ -154,6 +176,269 @@ def parent_exit_problems(lifecycle, root_code, **who) -> list:
return out
# -
# Known Mozilla defects: a core of a crash that the list names is reported by its D<n>, never silently.
#
# The crash-record parser of this section (process_type, function_name, crashing_thread, reason_of, thread_name, phase_of, crash_record) moves to
# the core in S1, next to the matcher, and is fetched by sha like it; the series' gtest_run then uses the same one. Until then this is the wrapper's copy.
#: The matcher is the core's main `scripts/ci_mozilla_defects.py`: the judge is never the branch being judged. A caller that has it on disk names its path here; otherwise it is fetched once
#: per process from the core's main (the sha is resolved with `git ls-remote` and printed).
MATCHER_ENV = "MOZILLA_DEFECTS_CHECKER"
CORE_REPO = "oss-invisible/core"
MATCHER_PATH_IN_CORE = "scripts/ci_mozilla_defects.py"
MATCHER_API = ("load", "problems", "verdict")
#: The wrapper's own list of known Mozilla defects, next to the scripts that run: the list of the wrapper under test. It is read from the wrapper's
#: main once main holds it (after the engine release that carries the first row), so that a branch cannot excuse its own crash.
DEFECTS_LIST = Path(__file__).resolve().parent.parent / "ci" / "mozilla-defects.json"
FETCH_TIMEOUT_S = 60
#: The process types a Firefox child is started as (`-contentproc ... <type>`).
CHILD_TYPES = ("tab", "gpu", "rdd", "socket", "utility", "forkserver", "vr", "inference", "gmplugin")
#: The kernel keeps 80 bytes of a process's arguments with the NUL: a `Core was generated by` line of 79 visible characters or more is cut.
CUT_LINE = 79
#: The shortest prefix of a flag that names it: `back` is the start of `backgroundtask`, the one Firefox flag that begins with it.
FLAG_PREFIX_MIN = 4
_HEADER = re.compile(r"Core was generated by `([^']*)'")
_THREAD_HEADER = re.compile(r"^Thread (\d+) \((.*)\):\s*$")
_CURRENT_THREAD = re.compile(r"\[Current thread is (\d+) ")
_FRAME = re.compile(r"^#\d+\s+(.*)$")
_REASON_LINE = re.compile(r'^0x[0-9a-fA-F]+(?: <[^>]*>)?:\s+"(.*)"\s*$')
_CORE_NAME = re.compile(r"^core\.(.+)\.(\d+)\.(\d+)$")
_SHA = re.compile(r"^[0-9a-f]{40}$")
_FETCHED: dict = {}
def process_type(text: str) -> str | None:
"""The process type of the crashed process, from gdb's `Core was generated by` line; None when the line cannot say.
`-backgroundtask` (one or two dashes) gives `backgroundtask`. `-contentproc` gives its last token when that is a whole child type (`tab`, `gpu`, ...) and the line is not cut.
A line with neither flag and not cut is the `parent`. A cut line (the kernel keeps 80 bytes of the arguments with the NUL, so 79 visible characters or more) whose last token,
without its leading dashes, is a prefix of `backgroundtask` of at least 4 characters gives `backgroundtask` (no other Firefox flag begins with `back`); anything else cut gives None."""
found = _HEADER.search(text or "")
if not found:
return None
line = found.group(1)
tokens = line.split()[1:]
cut = len(line) >= CUT_LINE
if any(t in ("-backgroundtask", "--backgroundtask") for t in tokens):
return "backgroundtask"
if any(t in ("-contentproc", "--contentproc") for t in tokens):
return tokens[-1] if not cut and tokens[-1] in CHILD_TYPES else None
if not cut:
return "parent"
last = tokens[-1].lstrip("-") if tokens else ""
return "backgroundtask" if len(last) >= FLAG_PREFIX_MIN and "backgroundtask".startswith(last) else None
def function_name(frame: str) -> str:
"""The function of a gdb frame line (after `#N `): `0x.. in ns::f<T> (args) at file:7` is `ns::f<T>`; `?? () from lib` is `??`; `<signal handler called>` is itself."""
text = re.sub(r"^0x[0-9a-fA-F]+ in ", "", frame.strip())
depth = 0
for i, ch in enumerate(text):
depth += ch == "<"
depth -= ch == ">" and depth > 0
if ch == " " and depth == 0 and text[i + 1:i + 2] == "(":
return text[:i]
cut = text.find(" (")
text = text[:cut] if cut > 0 else text
return text.split(" from ")[0].split(" at ")[0].strip()
def crashing_thread(text: str) -> tuple:
"""(the name gdb quotes in the header of the crashing thread or None, the function names of its frames top first or None): the thread `[Current thread is N` names, found in the
`thread apply all bt` blocks."""
current = _CURRENT_THREAD.search(text or "")
if not current:
return None, None
name, frames, inside = None, [], False
for line in text.splitlines():
head = _THREAD_HEADER.match(line)
if head:
inside = head.group(1) == current.group(1)
if inside:
quoted = re.search(r'"([^"]+)"\s*$', head.group(2))
name, frames = (quoted.group(1) if quoted else None), []
continue
frame = _FRAME.match(line) if inside else None
if frame:
frames.append(function_name(frame.group(1)))
return name, frames or None
def reason_of(text: str) -> str | None:
"""The MOZ_CRASH text: the quoted string of the line `x/s *(char**)&gMozCrashReason` prints (`0x...:<tab>"MOZ_CRASH(...)"`), else None."""
for line in (text or "").splitlines():
found = _REASON_LINE.match(line)
if found and found.group(1):
return found.group(1)
return None
def core_name_parts(name: str) -> tuple:
"""(%e, %p, %t) of a core named by the job's `core.%e.%p.%t`: the crashing thread's name, the pid and the time as text; (None, None, None) for any other name."""
found = _CORE_NAME.match(name or "")
return found.groups() if found else (None, None, None)
def thread_name(text: str, core_name: str) -> str | None:
"""The name of the crashing thread without Mozilla's instance number: the name gdb quotes in the thread's header when it does, else %e of the core's name; then a trailing run of
decimal digits is dropped. Mozilla names a thread of a process with its instance number appended (the broker thread `FSBroker` is `FSBroker14298`), so the name a row holds is
the name without it. None when no name is known or nothing is left."""
name = crashing_thread(text)[0] or core_name_parts(core_name)[0]
name = re.sub(r"\d+$", "", name or "")
return name or None
def phase_of(core_name: str, mtime: float | None, closing_at: float | None) -> str | None:
"""`exit` when the core was written at or after the moment the launch began to close the browser, `run` when before; None when either moment cannot be known.
The core's time is %t of its name (whole seconds: a core of the second the close began is an exit), else the file's mtime."""
if closing_at is None:
return None
stamp = core_name_parts(core_name)[2]
if stamp is not None:
return "exit" if int(stamp) + 1 > closing_at else "run"
if mtime is None:
return None
return "exit" if mtime >= closing_at else "run"
def crash_record(text: str, core_name: str, mtime: float | None = None, closing_at: float | None = None) -> dict:
"""The record the matcher takes for one core: {process, phase, thread, frames, reason}; a field the evidence cannot give is left out, so a row that names it cannot match.
`text` is gdb's text of the core (`gdb_report`), `core_name` the core's file name, `mtime` its modification time, `closing_at` the moment the launch began to close."""
frames = crashing_thread(text)[1]
out = {"process": process_type(text), "phase": phase_of(core_name, mtime, closing_at), "thread": thread_name(text, core_name), "frames": frames, "reason": reason_of(text)}
return {key: value for key, value in out.items() if value is not None}
class DefectsUnavailable(Exception):
"""The matcher of known Mozilla defects cannot be had: every crash stays red and the message says why."""
def _download_matcher(run, urlopen, say) -> Path:
"""The matcher of the core's main, written to a temporary file: main's sha is resolved with `git ls-remote`, then that exact file is downloaded."""
try:
done = run(["git", "ls-remote", "https://github.com/%s" % CORE_REPO, "refs/heads/main"], capture_output=True, text=True, timeout=FETCH_TIMEOUT_S, check=False)
except (OSError, subprocess.SubprocessError) as exc:
raise DefectsUnavailable("main of %s cannot be resolved (%s: %s)" % (CORE_REPO, type(exc).__name__, exc)) from exc
words = (done.stdout or "").split()
if done.returncode != 0 or not words or not _SHA.match(words[0]):
raise DefectsUnavailable("main of %s cannot be resolved (git ls-remote exited %s: %s)" % (CORE_REPO, done.returncode, ((done.stdout or "") + (done.stderr or "")).strip()[:200]))
sha = words[0]
url = "https://raw.githubusercontent.com/%s/%s/%s" % (CORE_REPO, sha, MATCHER_PATH_IN_CORE)
if urlopen is None:
import urllib.request
urlopen = urllib.request.urlopen
try:
with urlopen(url, timeout=FETCH_TIMEOUT_S) as response:
data = response.read()
path = Path(tempfile.mkdtemp(prefix="mozilla-defects-checker-")) / Path(MATCHER_PATH_IN_CORE).name
path.write_bytes(data)
except Exception as exc: # noqa: BLE001 - whatever the download does, the judge is not available
raise DefectsUnavailable("%s cannot be downloaded (%s: %s)" % (url, type(exc).__name__, exc)) from exc
say("known Mozilla defects: the matcher is %s of %s main, sha %s" % (MATCHER_PATH_IN_CORE, CORE_REPO, sha))
return path
def matcher_path(environ=None, run=subprocess.run, urlopen=None, say=print) -> Path:
"""Where the matcher is: `$MOZILLA_DEFECTS_CHECKER` when set, else the core's main fetched once per process. DefectsUnavailable when it cannot be had."""
env = os.environ if environ is None else environ
if env.get(MATCHER_ENV):
return Path(env[MATCHER_ENV])
if "result" not in _FETCHED:
try:
_FETCHED["result"] = _download_matcher(run, urlopen, say)
except DefectsUnavailable as exc:
_FETCHED["result"] = exc
if isinstance(_FETCHED["result"], Exception):
raise _FETCHED["result"]
return _FETCHED["result"]
def load_matcher(path):
"""The matcher module imported by path; DefectsUnavailable when it is not a file, does not import or lacks `load`, `problems` or `verdict`."""
import importlib.util
if not Path(path).is_file():
raise DefectsUnavailable("the matcher %s does not exist" % path)
try:
spec = importlib.util.spec_from_file_location("ci_mozilla_defects_of_the_core", str(path))
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
except Exception as exc: # noqa: BLE001 - whatever the file does, the judge is not available
raise DefectsUnavailable("the matcher %s cannot be imported (%s: %s)" % (path, type(exc).__name__, exc)) from exc
lacking = [name for name in MATCHER_API if not callable(getattr(module, name, None))]
if lacking:
raise DefectsUnavailable("the matcher %s has no %s: it is not the matcher of known Mozilla defects" % (path, ", ".join(lacking)))
return module
def engine_version(binary) -> str:
"""The `Version=` of the `application.ini` beside the browser binary (159.0); DefectsUnavailable when there is none."""
if not binary:
raise DefectsUnavailable("the browser binary is not known, so the engine version is not known")
ini = Path(binary).parent / "application.ini"
try:
text = ini.read_text(encoding="utf-8", errors="replace")
except OSError as exc:
raise DefectsUnavailable("%s cannot be read (%s): the engine version is not known" % (ini, exc)) from exc
found = re.search(r"^Version=(\S+)\s*$", text, re.M)
if not found:
raise DefectsUnavailable("%s has no Version= line: the engine version is not known" % ini)
return found.group(1)
class DefectsJudge:
"""The matcher, the wrapper's list of known defects and the engine's version, ready to rule on the crashes of one launch; or, with `why`, the reason it is not available (then
every crash is red)."""
def __init__(self, module=None, rows=None, version: str = "", why: str = "") -> None:
self.module, self.rows, self.version, self.why = module, rows, version, why
def verdict(self, records: list, measurements_complete: bool) -> tuple:
"""(red, lines) as the matcher's `verdict` gives them; without a matcher, red and the reason."""
if self.module is None:
return True, ["known Mozilla defects: not judged, every crash stays red: %s" % self.why]
try:
red, lines = self.module.verdict(self.rows, self.version, records, measurements_complete)
except Exception as exc: # noqa: BLE001 - a crash that cannot be judged stays red
return True, ["known Mozilla defects: the matcher cannot rule (%s: %s): the crash stays red" % (type(exc).__name__, exc)]
return bool(red), [str(line) for line in lines]
def defects_judge(binary, environ=None, list_path=None, run=subprocess.run, urlopen=None, say=print) -> DefectsJudge:
"""The judge for the engine whose browser binary is `binary`. Closed: no matcher, a matcher without the API, a list that cannot be read or no engine version is a judge
that keeps every crash red and says why."""
try:
module = load_matcher(matcher_path(environ, run, urlopen, say))
path = Path(list_path) if list_path else DEFECTS_LIST
try:
rows = module.load(path)
except Exception as exc: # noqa: BLE001
raise DefectsUnavailable("the list of known defects %s cannot be read (%s)" % (path, exc)) from exc
version = engine_version(binary)
try:
module.problems([], version)
except Exception as exc: # noqa: BLE001
raise DefectsUnavailable("the matcher cannot use the engine version %s (%s)" % (version, exc)) from exc
except DefectsUnavailable as exc:
return DefectsJudge(why=str(exc))
return DefectsJudge(module, rows, version)
def _judge_launch(judge, launch: dict, measurements_complete: bool, missing=()) -> tuple:
"""(excused, lines) of one launch that left cores. The records are the probe's (`launch["crash_records"]`, one per core name); a core with no record is not judged and stays red."""
names = list(dict.fromkeys(launch.get("cores") or []))
by_core = {c.get("core"): c.get("record") for c in launch.get("crash_records") or [] if isinstance(c, dict)}
absent = [n for n in names if not isinstance(by_core.get(n), dict)]
if absent:
return False, ["known Mozilla defects: no crash record for core %s: the crash stays red" % ", ".join(absent)]
red, lines = judge.verdict([by_core[n] for n in names], bool(measurements_complete))
if not measurements_complete and missing:
lines = list(lines) + ["measurement missing: %s" % "; ".join(str(m) for m in missing)]
return (not red), lines
# -
# What a crash leaves: the folders, the files, the cores (the collectors that scripts/ci_ab_host.py and the probe's launches share live here).
@@ -570,6 +855,7 @@ class LaunchProbe:
probe._began(conn)
def close(conn, *args, **kwargs):
probe._closing(conn)
try:
return original_close(conn, *args, **kwargs)
finally:
@@ -620,6 +906,16 @@ class LaunchProbe:
except Exception: # noqa: BLE001 - a probe never breaks a launch
pass
def _closing(self, conn) -> None:
"""The launch begins to close the browser (before the close it already makes runs): the moment is the line between a core of the run and a core of the exit."""
try:
with self._lock:
state = self._open.get(id(conn))
if state is not None:
state.setdefault("closing", self.clock())
except Exception: # noqa: BLE001 - a probe never breaks a launch
pass
def _core_folders(self) -> list:
if self.core_folders is not None:
return list(self.core_folders() if callable(self.core_folders) else self.core_folders)
@@ -644,6 +940,8 @@ class LaunchProbe:
# EVERY launch: what the browser wrote is saved, and the cores since it began (a content process can die and the parent still end with 0)
self._save_output(conn, entry)
entry["cores"], entry["dmp"] = [c.name for c in cores], dmp
if state.get("closing") is not None:
entry["closing_at"] = state["closing"]
if not cores:
entry["core_said"] = core_said(folders, kernel_core_pattern(), self.windows)
if entry["returncode"] != 0 or cores or dmp:
@@ -654,11 +952,29 @@ class LaunchProbe:
write_crash_files(crash, self.crash_dir / name)
entry["evidence"] = "%s/%s" % (self.crash_dir.name, name)
entry["said"] = crash["said"]
if cores:
entry["crash_records"] = self._crash_records(cores, crash, entry.get("closing_at"))
except Exception as e: # noqa: BLE001 - what could not be collected is said
entry["probe_error"] = "%s: %s" % (type(e).__name__, e)
with self._lock:
self.launches.append(entry)
@staticmethod
def _crash_records(cores, crash: dict, closing_at) -> list:
"""One record per core name (`crash_record`), from the text gdb gave of that core and the core's own name and time: what `exit_problems` judges."""
texts = (crash.get("cores") or {}).get("backtraces") or {}
records, done = [], set()
for core in cores:
if core.name in done:
continue
done.add(core.name)
try:
mtime = core.stat().st_mtime
except OSError:
mtime = None
records.append({"core": core.name, "record": crash_record(texts.get(core.name, ""), core.name, mtime, closing_at)})
return records
# -
# What the browsers wrote.
@@ -946,9 +1262,11 @@ def read_exits(path) -> dict | None:
return document if document.get("format") == FORMAT else None
def exits_of_run(crash_dir, run: str, windows: bool | None = None, needed: bool = True) -> list:
def exits_of_run(crash_dir, run: str, windows: bool | None = None, needed: bool = True, notes: list | None = None, measurements_complete: bool | None = None,
missing=(), binary: str | None = None) -> list:
"""The red lines of the launches a run process recorded in `crash_dir/exits.json`. No file, or no launch in it, is red when the run was to make some: an oracle
that did not see how its browsers ended did not see them."""
that did not see how its browsers ended did not see them. `notes`, `measurements_complete`, `missing` and `binary` are `exit_problems`': the cores of the launches are judged against
the known Mozilla defects only when the caller says whether the run's measurements are complete."""
if not crash_dir:
return []
document = read_exits(Path(crash_dir) / "exits.json")
@@ -956,7 +1274,7 @@ def exits_of_run(crash_dir, run: str, windows: bool | None = None, needed: bool
return ["the run %s left no record of how its browsers ended (%s/exits.json): the probe did not see them" % (run, Path(crash_dir).name)] if needed else []
if not document["launches"] and needed:
return ["the run %s recorded no launch in %s/exits.json: the probe did not see a browser" % (run, Path(crash_dir).name)]
problems = exit_problems(document["launches"], run, windows)
problems = exit_problems(document["launches"], run, windows, notes=notes, measurements_complete=measurements_complete, missing=missing, binary=binary)
if document.get("stderr_said"):
problems.append("the run %s could not save what its browsers wrote: %s" % (run, document["stderr_said"]))
for launch in document["launches"]:
+17 -7
View File
@@ -248,8 +248,15 @@ def dump_findings(dump: dict, wants: Callable = declared) -> list:
# the same seeds. Every leaf that differs is a host dependency the published engine ALREADY has: not a failure of the candidate and never red,
# a finding, kept in a file of its own and summarised in the job's summary.
CLEAN_FILE = "poison-clean-68.json"
DEPENDENCE_FILE = "poison-host-dependence-68.json"
def clean_file(engine_tag: str) -> str:
"""poison-clean-70.json for firefox-70: the published engine's dump on the clean runner (ci_ab_oracle.clean_name). The tag is the one the published set carries."""
return "poison-clean-%s.json" % engine_tag.rsplit("-", 1)[-1]
def dependence_file(engine_tag: str) -> str:
return "poison-host-dependence-%s.json" % engine_tag.rsplit("-", 1)[-1]
DEPENDENCE_FORMAT = "poison-host-dependence/1"
CLIP = 300
@@ -305,14 +312,17 @@ def dependence_markdown(report: dict | None) -> str:
return "\n".join(lines + [""])
def write_dependence(out: Path, summary: Path | None = None) -> dict | None:
"""Write DEPENDENCE_FILE in `out` from CLEAN_FILE and dump-68.json there, and the markdown to `summary` (the job's $GITHUB_STEP_SUMMARY).
Returns the report, or None when there is no clean dump. Never a verdict."""
clean, poisoned = out / CLEAN_FILE, out / "dump-68.json"
def write_dependence(out: Path, summary: Path | None = None, engine_tag: str | None = None) -> dict | None:
"""Write the dependence file in `out` from the clean dump and the published engine's dump there (named for `engine_tag`, by default the tag the published set carries),
and the markdown to `summary` (the job's $GITHUB_STEP_SUMMARY). Returns the report, or None when there is no clean dump. Never a verdict."""
import ci_ab_oracle as oracle
engine_tag = engine_tag or oracle.default_tag()
clean, poisoned = out / clean_file(engine_tag), out / oracle.dump_name(engine_tag)
report = None
if clean.is_file() and poisoned.is_file():
report = host_dependence(json.loads(clean.read_text(encoding="utf-8")), json.loads(poisoned.read_text(encoding="utf-8")))
(out / DEPENDENCE_FILE).write_text(json.dumps(report, sort_keys=True, ensure_ascii=False), encoding="utf-8")
(out / dependence_file(engine_tag)).write_text(json.dumps(report, sort_keys=True, ensure_ascii=False), encoding="utf-8")
text = dependence_markdown(report)
if summary:
with open(summary, "a", encoding="utf-8", newline="\n") as f:
+442
View File
@@ -0,0 +1,442 @@
#!/usr/bin/env python3
"""The PUBLISHED SET: the control side of every A/B oracle, exactly as a user installs it.
An A/B oracle holds a candidate against the engine published before it. That engine is not a binary alone: it is launched by the core that declares the prefs it
requires (the engine refuses a launch whose declarations are not the ones it was built for), and that core is the one the published wrapper pins. So the control
side is a SET, and nothing in it is chosen by hand: the last published `invisible-playwright` on PyPI pins its core exactly, and that core's seal pins its engine.
ci/py-lock/published.txt the set as a lock (ci-03): the wrapper and the core it pins, each at an exact version with the sha256 of EVERY file of that
version on the index, and the requirements each declares (the headers), which the gate's own lock must satisfy.
python scripts/ci_published_set.py resolve [--write] reads PyPI (the only command that does), prints the lock, or writes it
python scripts/ci_published_set.py check PyPI's last release against the committed lock: red when they differ (.github/workflows/published-set.yml)
python scripts/ci_published_set.py install --house DIR --venv DIR [--lock FILE]
OFFLINE and hash-checked: a venv of its own with the gate's third-party lock (DIR/lock.txt), then the two wheels of the set by their hashes
(`--no-deps`, from DIR/published: the wheelhouse of the run, whose job downloaded the files this lock names there). Prints the venv's python.
DIR itself holds the candidate's wheels of the same two packages (built from core_ref and wrapper_ref, and at an equal version with the SAME
file names): the set never takes a file of invisible-core or invisible-playwright from DIR, only from DIR/published.
python scripts/ci_published_set.py verify --python PY what that python imports is the lock's set, from its own venv and from nowhere else
python scripts/ci_published_set.py fetch --work DIR (run BY the set's python) fetches the engine the way a user's core does: its own seal
python scripts/ci_published_set.py tag (run BY the set's python) the tag its seal names
Exit codes: 0 green, 1 red (a finding), 2 the command could not run.
The candidate's side is untouched: its core is core_ref's, its wrapper is wrapper_ref's, its engine is the candidate.
"""
from __future__ import annotations
import argparse
import base64
import hashlib
import json
import os
import re
import subprocess
import sys
import urllib.request
import zipfile
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
LOCK_PATH = ROOT / "ci" / "py-lock" / "published.txt"
GATE_LOCK_PATH = ROOT / "ci" / "py-lock" / "gate.txt"
#: Where the wheelhouse of the run keeps the two wheels of the published set (the wheelhouse's own folder holds the candidate's wheels of the same names).
PUBLISHED_DIR = "published"
#: What install writes in the venv: which wheel of each package it installed (file name, sha256) and the digest of every file of the package as that wheel holds it. verify reads it
#: and holds it to the lock and to the disk: the lock and the candidate's lock can name the same package at the same version, so a version says nothing of WHICH file is installed.
RECORD_FILE = "published-set.json"
RECORD_FORMAT = "published-set-installed/1"
WRAPPER = "invisible-playwright"
CORE = "invisible-core"
INDEX = "https://pypi.org/pypi"
HASH_RE = re.compile(r"^--hash=sha256:([0-9a-f]{64})$")
PIN_RE = re.compile(r"^([A-Za-z0-9][A-Za-z0-9._-]*)==([0-9][A-Za-z0-9.!+_-]*)$")
HEADER = ("The PUBLISHED SET, the control side of the A/B oracles (scripts/ci_published_set.py): the last published invisible-playwright and the invisible-core it pins "
"(its seal pins the engine). Written by `python scripts/ci_published_set.py resolve --write`; .github/workflows/published-set.yml keeps it equal to the index.")
#: What a process of the published set must not inherit from the candidate's job: anything that makes its python import another wrapper or another core, or run
#: another engine's seal. The set is what its venv holds, as it is on a user's machine.
SET_LEAKS = ("PYTHONPATH", "PYTHONHOME", "PYTHONSTARTUP", "PYTHONUSERBASE", "VIRTUAL_ENV", "INVISIBLE_SEAL_FILE", "INVISIBLE_CORE_PIN", "INVISIBLE_CORE_AUTOFIX",
"INVISIBLE_PLAYWRIGHT_ENGINE_DIR")
def norm(name: str) -> str:
return re.sub(r"[-_.]+", "-", name).lower()
# -
# The lock: text <-> parts (pure, no network)
def _release_parts(release: dict, name: str) -> tuple:
"""(version, [sha256 of every file], [requirements without extras]) of a PyPI release document (`/pypi/<name>/<version>/json`)."""
info = release.get("info") or {}
if norm(info.get("name") or "") != norm(name):
raise ValueError("the document is of %r, not %s" % (info.get("name"), name))
files = [f for f in release.get("urls") or [] if not f.get("yanked")]
hashes = sorted({(f.get("digests") or {}).get("sha256", "") for f in files})
if not files or not all(re.fullmatch(r"[0-9a-f]{64}", h) for h in hashes):
raise ValueError("%s %s has no file with a sha256 on the index" % (name, info.get("version")))
if not any(f.get("packagetype") == "bdist_wheel" for f in files):
raise ValueError("%s %s has no wheel on the index" % (name, info.get("version")))
requires = [r for r in (info.get("requires_dist") or []) if "extra ==" not in r]
return info["version"], hashes, requires
def core_pin_of(requires: list) -> str:
"""The version of `invisible-core==X` among the requirements of the wrapper; ValueError when there is not exactly one exact pin."""
pins = []
for r in requires:
m = re.fullmatch(r"\s*invisible[-_.]core\s*==\s*([0-9][A-Za-z0-9.!+_-]*)\s*(?:;.*)?", r)
if m:
pins.append(m.group(1))
if len(pins) != 1:
raise ValueError("the published wrapper does not pin invisible-core exactly once with `==` (it declares %s)" % (requires or "nothing"))
return pins[0]
def lock_text(wrapper_release: dict, core_release: dict) -> str:
version, hashes, requires = _release_parts(wrapper_release, WRAPPER)
core_version, core_hashes, core_requires = _release_parts(core_release, CORE)
pin = core_pin_of(requires)
if pin != core_version:
raise ValueError("%s %s pins invisible-core==%s but the core document is of %s" % (WRAPPER, version, pin, core_version))
others = [r for r in requires if not re.match(r"\s*invisible[-_.]core\b", r, re.I)]
out = ["# " + HEADER,
"# wrapper-requires: " + " | ".join(sorted(others)),
"# core-requires: " + " | ".join(sorted(core_requires))]
for name, v, hs in ((CORE, core_version, core_hashes), (WRAPPER, version, hashes)):
out.append("%s==%s \\" % (name, v))
out.append(" \\\n".join(" --hash=sha256:" + h for h in hs))
return "\n".join(out) + "\n"
def parse_lock(text: str) -> dict:
"""{"wrapper": (version, hashes), "core": (version, hashes), "wrapper_requires": [...], "core_requires": [...]}; ValueError names what is wrong.
Every entry is `name==version` with at least one sha256: no range, no URL, no entry without a hash."""
meta, entries, current = {}, {}, None
joined = text.replace("\\\n", " ")
for raw in joined.splitlines():
line = raw.strip()
if not line:
continue
m = re.match(r"^#\s*(wrapper-requires|core-requires):\s*(.*)$", line)
if m:
meta[m.group(1)] = [r.strip() for r in m.group(2).split(" | ") if r.strip()]
continue
if line.startswith("#"):
continue
parts = line.split()
pin = PIN_RE.match(parts[0])
if not pin:
raise ValueError("a line that is not `name==version --hash=sha256:...`: %r" % line[:80])
hashes = []
for p in parts[1:]:
h = HASH_RE.match(p)
if not h:
raise ValueError("%s: %r is not a --hash=sha256:<64 hex>" % (parts[0], p[:40]))
hashes.append(h.group(1))
if not hashes:
raise ValueError("%s has no hash: an entry without a hash is an unchecked install" % parts[0])
current = norm(pin.group(1))
if current in entries:
raise ValueError("%s is listed twice" % current)
entries[current] = (pin.group(2), sorted(hashes))
if sorted(entries) != sorted([CORE, WRAPPER]):
raise ValueError("the lock holds %s, it must hold exactly %s and %s" % (sorted(entries), CORE, WRAPPER))
for key in ("wrapper-requires", "core-requires"):
if key not in meta:
raise ValueError("the header line `# %s:` is missing" % key)
return {"wrapper": entries[WRAPPER], "core": entries[CORE], "wrapper_requires": meta["wrapper-requires"], "core_requires": meta["core-requires"]}
def locked_versions(gate_text: str) -> dict:
"""{normalized name: version} of the pinned entries of a lock (ci/py-lock/gate.txt)."""
out = {}
for line in gate_text.replace("\\\n", " ").splitlines():
m = PIN_RE.match(line.split()[0]) if line.strip() and not line.lstrip().startswith("#") else None
if m:
out[norm(re.sub(r"\[.*\]", "", m.group(1)))] = m.group(2)
return out
def problems_of_lock(parsed: dict, gate_text: str) -> list:
"""What makes the set not installable, offline, over the gate's lock: the wrapper's pin of the core is not the core in the lock, or a requirement of either is
not met by the third-party package the gate's lock holds (the venv of the set is the gate's lock plus these two wheels, `--no-deps`)."""
from packaging.requirements import Requirement # the gate lock installs it (pytest needs it); resolve/check do not come here
problems = []
try:
pin = core_pin_of(parsed["wrapper_requires"] + ["%s==%s" % (CORE, parsed["core"][0])])
if pin != parsed["core"][0]:
problems.append("the lock names core %s" % parsed["core"][0])
except ValueError as e:
problems.append(str(e))
held = locked_versions(gate_text)
for owner, requires in (("the published wrapper", parsed["wrapper_requires"]), ("the published core", parsed["core_requires"])):
for text in requires:
req = Requirement(text)
if req.marker is not None and not req.marker.evaluate({"extra": ""}):
continue
version = held.get(norm(req.name))
if version is None:
problems.append("%s requires %s: the gate's lock (ci/py-lock/gate.txt) does not hold it, so the set cannot be installed offline" % (owner, text))
elif not req.specifier.contains(version, prereleases=True):
problems.append("%s requires %s: the gate's lock holds %s==%s" % (owner, text, req.name, version))
return problems
# -
# The index (the only network here)
def fetch_json(url: str) -> dict:
request = urllib.request.Request(url, headers={"User-Agent": "ci-published-set"})
with urllib.request.urlopen(request, timeout=60) as response: # noqa: S310 - the index of the package, https
return json.loads(response.read().decode("utf-8"))
def resolve(get=fetch_json) -> str:
"""The lock of the last published set: PyPI's latest release of the wrapper, and the core that wrapper pins."""
latest = get("%s/%s/json" % (INDEX, WRAPPER))
version = (latest.get("info") or {}).get("version")
if not version:
raise ValueError("the index names no latest version of %s" % WRAPPER)
wrapper = get("%s/%s/%s/json" % (INDEX, WRAPPER, version))
pin = core_pin_of(_release_parts(wrapper, WRAPPER)[2])
return lock_text(wrapper, get("%s/%s/%s/json" % (INDEX, CORE, pin)))
def check(get=fetch_json, path: Path = LOCK_PATH) -> list:
"""[] when the committed lock is the index's last release; else the lines that say how it differs (and how to fix it)."""
committed = path.read_text(encoding="utf-8") if path.is_file() else ""
try:
wanted = resolve(get)
except (ValueError, OSError) as e:
return ["the index could not be read or is not what a release is: %s" % e]
if committed == wanted:
return []
old = parse_lock(committed) if committed else None
new = parse_lock(wanted)
now = "%s %s + %s %s" % (WRAPPER, new["wrapper"][0], CORE, new["core"][0])
was = "%s %s + %s %s" % (WRAPPER, old["wrapper"][0], CORE, old["core"][0]) if old else "nothing"
return ["%s holds %s but the index's last release is %s. Fix: python scripts/ci_published_set.py resolve --write, and commit it. "
"Rule: the control side of an A/B is the last published set" % (path.name, was, now)]
# -
# The venv of the set (offline) and what it must be
def venv_python(venv: Path) -> Path:
return venv / ("Scripts/python.exe" if os.name == "nt" else "bin/python")
def clean_env(extra: dict | None = None) -> dict:
env = {k: v for k, v in os.environ.items() if k not in SET_LEAKS}
env.update(extra or {})
return env
def install(house: Path, venv: Path, lock: Path = LOCK_PATH, run=subprocess.run) -> Path:
"""A venv of its own: the gate's third-party lock from the wheelhouse (`house/lock.txt`, the lock of the run), then the two wheels of the set by their hashes, from
`house/published` ONLY. Offline: `--no-index` and `--require-hashes` on both; the two are installed `--no-deps` because the first step holds everything they need.
The wheelhouse's own folder holds the candidate's wheels of invisible-core and invisible-playwright, built from core_ref and wrapper_ref; at an equal version they have
the file names of the published ones, so the published ones live in their own folder and are the only place the second step looks: a wheel of ours taken from the wheelhouse
would be the candidate's core in the control's venv, or a hash refused. pip never sees the wheelhouse's folder and `published/` in one call: with two `--find-links` it takes
the first local file of a name and fails on a hash mismatch, it does not choose by hash. Then `pip check` over the venv: red, with what pip reports, when a requirement of
the two wheels is not met."""
parse_lock(lock.read_text(encoding="utf-8")) # a lock that does not read is no install
house_lock = house / "lock.txt"
if not house_lock.is_file():
raise FileNotFoundError("the wheelhouse %s has no lock.txt (the gate's lock): it is not a py-deps wheelhouse" % house)
published = house / PUBLISHED_DIR
if not published.is_dir():
raise FileNotFoundError("the wheelhouse %s has no %s/ folder: the two wheels of the published set (the files ci/py-lock/published.txt names) are kept there, "
"apart from the candidate's wheels of the same names" % (house, PUBLISHED_DIR))
parsed = parse_lock(lock.read_text(encoding="utf-8"))
chosen = {name: published_wheel(published, name, *parsed[key]) for key, name in (("core", CORE), ("wrapper", WRAPPER))}
run([sys.executable, "-m", "venv", str(venv)], check=True)
python = str(venv_python(venv))
base = [python, "-m", "pip", "install", "--quiet", "--no-index", "--require-hashes"]
run(base + ["--find-links", str(house), "-r", str(house_lock)], check=True, env=clean_env())
run(base + ["--find-links", str(published), "--no-deps", "-r", str(lock)], check=True, env=clean_env())
# `--no-deps` installs the two wheels without looking at what they declare: pip check does, over the whole venv (the third-party lock and the two wheels).
checked = run([python, "-m", "pip", "check"], capture_output=True, text=True, env=clean_env())
if checked.returncode != 0:
raise RuntimeError("pip check of the published set's venv %s is red (the requirements of the published wheels are not met by the wheelhouse's dependencies): %s"
% (venv, (checked.stdout + checked.stderr).strip()[-1500:]))
write_record(venv, chosen)
return venv_python(venv)
def file_digest(data: bytes) -> str:
"""The digest of a file as a wheel's RECORD writes it: `sha256=<urlsafe base64, no padding>`."""
return "sha256=" + base64.urlsafe_b64encode(hashlib.sha256(data).digest()).rstrip(b"=").decode()
def published_wheel(published: Path, name: str, version: str, hashes: list) -> tuple:
"""(path, sha256) of the wheel of `name` `version` in `published` whose sha256 is one the lock holds. FileNotFoundError names what was there and what the lock holds."""
stem = name.replace("-", "_").lower() + "-" + version + "-"
seen = []
for path in sorted(published.glob("*.whl")):
if path.name.lower().startswith(stem):
sha = hashlib.sha256(path.read_bytes()).hexdigest()
if sha in hashes:
return path, sha
seen.append("%s sha256 %s" % (path.name, sha))
raise FileNotFoundError("%s %s: no wheel in %s has a sha256 the lock (ci/py-lock/published.txt) holds (%s); there %s"
% (name, version, published, ", ".join(hashes), "is " + "; ".join(seen) if seen else "is none of that name"))
def package_digests(wheel: Path, package: str) -> dict:
"""{path: digest} of every file of the package `package` in the wheel, taken from the bytes of the wheel (its RECORD is not believed)."""
with zipfile.ZipFile(wheel) as z:
return {n: file_digest(z.read(n)) for n in sorted(z.namelist()) if n.startswith(package + "/") and not n.endswith("/")}
def write_record(venv: Path, chosen: dict) -> Path:
"""`chosen` is {distribution: (wheel path, sha256)}: what was installed into `venv`, written where verify reads it."""
packages = {name: {"wheel": path.name, "sha256": sha, "files": package_digests(path, name.replace("-", "_"))} for name, (path, sha) in chosen.items()}
target = Path(venv) / RECORD_FILE
Path(venv).mkdir(parents=True, exist_ok=True)
target.write_text(json.dumps({"format": RECORD_FORMAT, "packages": packages}, sort_keys=True, indent=1) + "\n", encoding="utf-8", newline="\n")
return target
def installed_problems(prefix: str, parsed: dict, site_files: dict) -> list:
"""What the record of the venv `prefix` says was installed, against the lock and against the disk. `site_files` is {distribution: the folder that holds its package}.
A package the record names with a sha256 the lock does not hold is red, naming the file and both hashes; so is a file of the package that is not, byte for byte, the wheel's."""
path = Path(prefix) / RECORD_FILE
if not path.is_file():
return ["%s has no %s: nothing says which wheel of invisible-core and invisible-playwright was installed (install writes it); the same version can be a "
"different file (the candidate's wheels have the names of the published ones)" % (prefix, RECORD_FILE)]
record = json.loads(path.read_text(encoding="utf-8"))
problems = []
for key, name in (("core", CORE), ("wrapper", WRAPPER)):
entry = (record.get("packages") or {}).get(name)
if not entry:
problems.append("%s: the record of the venv does not name the wheel it installed" % name)
continue
lock_hashes = parsed[key][1]
if entry["sha256"] not in lock_hashes:
problems.append("%s: the file installed is %s with sha256 %s, and ci/py-lock/published.txt holds %s (the published set is %s %s)"
% (name, entry["wheel"], entry["sha256"], ", ".join(lock_hashes), name, parsed[key][0]))
for rel, digest in sorted(entry["files"].items()):
target = Path(site_files[name]) / rel
actual = file_digest(target.read_bytes()) if target.is_file() else "missing"
if actual != digest:
problems.append("%s: %s on disk is %s, the wheel %s (sha256 %s) holds %s" % (name, rel, actual, entry["wheel"], entry["sha256"], digest))
break
return problems
IDENTITY_CODE = """
import importlib.metadata as md, json, sys
import invisible_core, invisible_playwright
from invisible_core.seal import active_seal
seal = active_seal()
print(json.dumps({"prefix": sys.prefix, "core": md.version("invisible-core"), "core_version": invisible_core.__version__, "core_file": invisible_core.__file__,
"wrapper": md.version("invisible-playwright"), "wrapper_file": invisible_playwright.__file__, "seal_tag": seal.tag, "seal_local": seal.is_local}))
"""
def identity(python: str, run=subprocess.run) -> dict:
"""What `python` is when it imports the set: versions, files and the tag of the seal its core carries (read in isolated mode, with no variable of the job)."""
done = run([python, "-I", "-c", IDENTITY_CODE], capture_output=True, text=True, env=clean_env(), timeout=120)
if done.returncode != 0:
raise RuntimeError("%s could not import the published set (exit %s): %s" % (python, done.returncode, (done.stderr or done.stdout)[-800:]))
return json.loads(done.stdout.strip().splitlines()[-1])
def verify(python: str, lock: Path = LOCK_PATH, run=subprocess.run) -> list:
"""[] when `python` runs the lock's wrapper and the lock's core, both from its own prefix, under the seal its core was published with, and the files they are made of
are the wheels the lock's sha256 name (read from the record install wrote and from the disk, never assumed from the version)."""
parsed = parse_lock(lock.read_text(encoding="utf-8"))
ident = identity(python, run)
problems = []
if ident["wrapper"] != parsed["wrapper"][0] or not ident["wrapper_file"].startswith(ident["prefix"]):
problems.append("the wrapper it runs is %s from %s, the set says %s from its own venv" % (ident["wrapper"], ident["wrapper_file"], parsed["wrapper"][0]))
if ident["core"] != parsed["core"][0] or ident["core_version"] != parsed["core"][0] or not ident["core_file"].startswith(ident["prefix"]):
problems.append("the core it runs is %s (reports %s) from %s, the set says %s from its own venv"
% (ident["core"], ident["core_version"], ident["core_file"], parsed["core"][0]))
if ident["seal_local"]:
problems.append("its core runs under a local seal: a published core carries a release seal")
problems += installed_problems(ident["prefix"], parsed, {CORE: str(Path(ident["core_file"]).parent.parent), WRAPPER: str(Path(ident["wrapper_file"]).parent.parent)})
return problems
# -
# What the set's own python does (the commands below are run BY it: they import the published core)
def fetch(work: Path) -> dict:
"""The engine of the core this python has, fetched the way a user's core fetches it: its own seal, its own download, its own verification."""
from invisible_core import download
from invisible_core.seal import active_seal
work = Path(work)
os.environ[download.ENGINE_DIR_ENV] = str(work / "engines")
seal = active_seal()
binary = download.ensure_binary()
return {"binary": str(binary), "tag": seal.tag, "describe": seal.describe()}
def main(argv=None) -> int:
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
sub = ap.add_subparsers(dest="cmd", required=True)
r = sub.add_parser("resolve")
r.add_argument("--write", action="store_true")
sub.add_parser("check")
i = sub.add_parser("install")
i.add_argument("--house", type=Path, required=True)
i.add_argument("--venv", type=Path, required=True)
i.add_argument("--lock", type=Path, default=LOCK_PATH)
v = sub.add_parser("verify")
v.add_argument("--python", required=True)
v.add_argument("--lock", type=Path, default=LOCK_PATH)
f = sub.add_parser("fetch")
f.add_argument("--work", type=Path, required=True)
sub.add_parser("tag")
args = ap.parse_args(argv)
try:
if args.cmd == "resolve":
text = resolve()
if args.write:
LOCK_PATH.write_text(text, encoding="utf-8", newline="\n")
print("wrote %s" % LOCK_PATH)
else:
sys.stdout.write(text)
return 0
if args.cmd == "check":
problems = check()
print("\n".join("FAIL " + p for p in problems) if problems else "OK the committed published set is the index's last release")
return 1 if problems else 0
if args.cmd == "install":
python = install(args.house, args.venv, args.lock)
problems = verify(str(python), args.lock)
for name, entry in sorted(json.loads((args.venv / RECORD_FILE).read_text(encoding="utf-8"))["packages"].items()):
print("installed %s: %s sha256 %s" % (name, entry["wheel"], entry["sha256"]), file=sys.stderr)
if problems:
print("\n".join("FAIL " + p for p in problems))
return 1
print(python)
return 0
if args.cmd == "verify":
problems = verify(args.python, args.lock)
print("\n".join("FAIL " + p for p in problems) if problems else "OK")
return 1 if problems else 0
if args.cmd == "fetch":
print(json.dumps(fetch(args.work)))
return 0
if args.cmd == "tag":
from invisible_core.seal import active_seal
print(active_seal().tag)
return 0
except (ValueError, OSError, RuntimeError, subprocess.CalledProcessError) as e:
print("ERROR %s: %s" % (type(e).__name__, e))
return 2
return 2
if __name__ == "__main__":
sys.exit(main())
+7 -2
View File
@@ -7,7 +7,9 @@ THIRD-PARTY distribution the gate installs from the wrapper:
* the wrapper's dependencies (`[project].dependencies` of pyproject.toml, without `invisible_core`, which is built as a wheel of ours) and its `dev` extra;
* the dependencies of the core the wrapper pins (`invisible_core==X`: the `[project].dependencies` of the core's pyproject.toml at the tag vX);
* playwright at scripts/playwright_pin.txt (the stock client the gate drives the engine with) and cryptography at CRYPTOGRAPHY (the lab's PKI).
* playwright at scripts/playwright_pin.txt (the stock client the gate drives the engine with) and cryptography at CRYPTOGRAPHY (the lab's PKI);
* the installer the install-from-index job needs beside pytest (HARNESS: `uv`, which the release test installs the package with and the wait asks), so that
job installs its test harness from this lock and from nothing else (tests/test_the_install_job_has_every_module_its_tests_import.py).
One command regenerates both files after a dependency change or a bump of the core pin:
@@ -36,6 +38,8 @@ PLAYWRIGHT_PIN = ROOT / "scripts" / "playwright_pin.txt"
#: What the lab's PKI needs, as the series' gate installs it today.
CRYPTOGRAPHY = "cryptography==44.0.3"
#: Installers the install-from-index job (user-install.yml) needs and no dependency of the wrapper brings: the README's way in (`uv`) and the wait on the index.
HARNESS = ["uv>=0.5"]
#: The floor of the lock: the Python the unit job judges; `--universal` covers every Linux and Windows wheel of every Python from it.
PYTHON_VERSION = "3.11"
DEFAULT_EXCLUDE_NEWER = "2026-11-25T00:00:00Z"
@@ -124,7 +128,7 @@ def core_dependencies(core_pyproject_text: str) -> list:
def expected_requirements(pyproject_text: str, core_requires: list, playwright_pin: str) -> list:
"""The requirements the lock must cover, in the order the input prints them."""
src = wrapper_sources(pyproject_text)
reqs = set(src["dependencies"]) | set(src["dev"]) | set(core_requires) | {"playwright==%s" % playwright_pin.strip(), CRYPTOGRAPHY}
reqs = set(src["dependencies"]) | set(src["dev"]) | set(core_requires) | set(HARNESS) | {"playwright==%s" % playwright_pin.strip(), CRYPTOGRAPHY}
return sorted(reqs, key=lambda r: (base_name(r), r))
@@ -141,6 +145,7 @@ def make_in(pyproject_text: str, core_pyproject_text: str, playwright_pin: str,
"# core-requires: %s" % SEP.join(core_requires),
"# playwright: %s from scripts/playwright_pin.txt (the stock client the gate drives the engine with)" % playwright_pin.strip(),
"# cryptography: %s (the lab's PKI)" % CRYPTOGRAPHY.split("==")[1],
"# harness: %s (the installers of the install-from-index job)" % SEP.join(HARNESS),
]
return "\n".join(head + expected_requirements(pyproject_text, core_requires, playwright_pin)) + "\n"
+93 -11
View File
@@ -24,6 +24,11 @@ pytest wrote and fails on every one of them.
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.
The same file may also retire single tests whose file stays: {"nodeid": "<file>::<test>", "suite": <row id>, "count": n, "reason",
"decided_by", "date", "from_min_tests"}. The minimum of that row may go down by the sum of the `count` of its entries and by no more, and
only for a nodeid whose file the row of main lists, and only while main's minimum of that row still equals `from_min_tests` (once the removal
is on main and its floor is lower, the entry is inert); a declared nodeid that the judged leg still collects is red, and so is any test that
goes without an entry.
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
@@ -333,17 +338,25 @@ def _int(value):
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)."""
def validate_retired(data, suite_ids=None):
"""-> the reasons why `data` is not a well-formed list of retired tests (empty if it is). Two kinds of entry, in one list:
a FILE that is gone ({file, reason, date, tests: {row id: number of tests the file had in that row on main, counted with the row's marker}}), and
a single TEST whose file stays ({nodeid: "<file>::<test>", suite: row id, count > 0, reason, decided_by, date, from_min_tests: the minimum of
the row on main when the entry was written, an integer >= count, the same for every entry of a suite}). `suite_ids`, when given, are the row
ids of main's list: the suite of a nodeid entry must be one of them."""
if not isinstance(data, list):
return ["the retired list must be a JSON list"]
problems, seen = [], set()
problems, seen, seen_nodes, froms = [], set(), 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
if "nodeid" in e or "suite" in e:
problems += _validate_retired_node(e, where, suite_ids, seen_nodes)
if isinstance(e.get("suite"), str) and _is_int(e.get("from_min_tests")):
froms.setdefault(e["suite"], set()).add(e["from_min_tests"])
continue
f = e.get("file")
if not isinstance(f, str) or not f.strip():
problems.append("%s has no file" % where)
@@ -358,12 +371,44 @@ def validate_retired(data):
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)
for suite, values in sorted(froms.items()):
if len(values) > 1:
problems.append("the retired tests of %s disagree on from_min_tests (%s): one suite, one floor of main" % (suite, sorted(values)))
return problems
def _validate_retired_node(e, where, suite_ids, seen):
problems = []
nid, suite = e.get("nodeid"), e.get("suite")
if "file" in e or "tests" in e:
problems.append("%s: an entry is a retired file (file, tests) or a retired test (nodeid, suite, count), not both" % where)
parts = nid.split("::", 1) if isinstance(nid, str) else []
if len(parts) != 2 or not parts[0].strip() or not parts[1].strip():
problems.append("%s: nodeid must be \"<file>::<test>\"" % where)
else:
where = "retired test %s" % nid
if not isinstance(suite, str) or not suite.strip():
problems.append("%s: suite must be a non-empty string (the id of a row)" % where)
elif suite_ids is not None and suite not in suite_ids:
problems.append("%s: the suite %s is not a row of main's required list" % (where, suite))
if isinstance(nid, str) and isinstance(suite, str):
if (nid, suite) in seen:
problems.append("%s: appears more than once for the suite %s" % (where, suite))
seen.add((nid, suite))
if not _is_int(e.get("count")) or e.get("count") < 1:
problems.append("%s: count must be an integer >= 1 (the tests the suite loses)" % where)
for key in ("reason", "decided_by", "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))
frm = e.get("from_min_tests")
if not _is_int(frm) or frm < 1 or (_is_int(e.get("count")) and frm < e["count"]):
problems.append("%s: from_min_tests must be an integer >= count (the minimum of the suite on main when the entry was written)" % 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)."""
"""The retired files and tests 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 [], []
@@ -371,22 +416,55 @@ def retired_of_main(main_required):
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)
try:
rows = json.loads(Path(main_required).read_text(encoding="utf-8"))
suite_ids = {r.get("id") for r in rows if isinstance(r, dict)} if isinstance(rows, list) else None
except (OSError, ValueError):
suite_ids = None # the list of main itself is read (and refused) by the caller
bad = validate_retired(data, suite_ids)
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):
def _retired_tests_of(row, retired, collected, judged):
"""-> (the number of tests the row may lose because main retired them one by one, problems). An entry counts only if the file of its nodeid is
in the row of main (a nodeid that the row does not run is not a test the row loses). The judge has the junit of the leg it judges and only
counts of main, so a declared nodeid that the judged leg still collects is red (and counts for nothing), and the nodeid of another row is taken
on its count, the leg of that row checking it. An entry counts only while the minimum of the row on main is still its `from_min_tests`: once
the removal is on main the floor is lower and the entry is inert (it allows nothing and asks nothing)."""
allowed, problems = 0, []
listed = row.get("tests", [])
for e in retired:
if not (isinstance(e, dict) and isinstance(e.get("nodeid"), str) and e.get("suite") == row.get("id")):
continue
nid = e["nodeid"]
if _int(row.get("min_tests")) != e.get("from_min_tests"):
continue
if nid not in listed and nid.split("::", 1)[0] not in listed:
continue
if collected is not None and judged == row.get("id") and any(n == nid or _base(n) == nid for n in collected):
problems.append("the test %s is declared retired for %s, but the suite still collects it: it did not leave" % (nid, row.get("id")))
continue
allowed += _int(e.get("count"))
return allowed, problems
def against_main(current, main, retired=(), exists=os.path.exists, collected=None, judged=None):
"""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).
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."""
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.
The other way is a single retired test (``nodeid``, ``suite``, ``count``) whose file stays in the row: the minimum of the suite may go down by
the ``count`` of its entries, and by no more. ``collected`` (the node ids of the junit of the judged leg) and ``judged`` (that leg's suite) let
the judge see that a declared nodeid is gone from the leg; of the collection of main it has only the count."""
problems = []
if not isinstance(main, list):
return ["the list of main is not a JSON list: it cannot be compared"]
retired = list(retired)
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)}
@@ -402,10 +480,13 @@ def against_main(current, main, retired=(), exists=os.path.exists):
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)
by_test, why = _retired_tests_of(old, retired, collected, judged)
allowed += by_test
problems += why
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 ""))
" (retired files and tests 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)
if lost:
@@ -547,7 +628,8 @@ def cmd_judge(ns):
try:
retired, retired_problems = retired_of_main(ns.main_required)
problems += retired_problems
problems += against_main(suites, _read_json_list(ns.main_required), retired)
problems += against_main(suites, _read_json_list(ns.main_required), retired,
collected={n for n, _o in cases}, judged=ns.suite)
except Usage as exc:
problems.append(str(exc))
elif ns.main_has_no_list:
+122
View File
@@ -0,0 +1,122 @@
r"""Read the full user-mode dumps Windows Error Reporting left for a python.exe that died, and say what each one holds (CI evidence, no debugger needed).
The Windows e2e jobs set ``HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\python.exe`` (full dump, folder ``<evidence>/dumps/python``)
before their tests; when a pytest-xdist worker dies from an unhandled exception ("node down: Not properly terminated", "Windows fatal exception: access violation")
WER writes ``python.exe.<pid>.dmp`` there and the evidence artifact carries it. This script runs after the tests (``if: always()``): it lists every dump with its size
and reads the header of the MINIDUMP file, with ``struct`` only, to name what a debugger would name first: the thread that raised, the exception code, the faulting
address and the module that holds it (with the offset in it), plus the access that failed for an access violation. The summary goes to stdout and to
``summary.txt`` beside the dumps. It never fails the job: no dump is the normal case.
Format of the file: https://learn.microsoft.com/windows/win32/api/minidumpapiset/ (MINIDUMP_HEADER, MINIDUMP_DIRECTORY, MINIDUMP_EXCEPTION_STREAM,
MINIDUMP_MODULE). Dump types and the LocalDumps key: https://learn.microsoft.com/windows/win32/wer/collecting-user-mode-dumps
"""
from __future__ import annotations
import shutil
import struct
import sys
import time
from pathlib import Path
SIGNATURE = b"MDMP"
MODULE_LIST_STREAM = 4
EXCEPTION_STREAM = 6
MODULE_SIZE = 108 # sizeof(MINIDUMP_MODULE)
EXCEPTION_NAMES = {
0xC0000005: "EXCEPTION_ACCESS_VIOLATION",
0xC0000374: "STATUS_HEAP_CORRUPTION",
0xC0000409: "STATUS_STACK_BUFFER_OVERRUN (fail fast)",
0xC00000FD: "EXCEPTION_STACK_OVERFLOW",
0xC000001D: "EXCEPTION_ILLEGAL_INSTRUCTION",
0xC0000094: "EXCEPTION_INT_DIVIDE_BY_ZERO",
0xC0000026: "STATUS_INVALID_DISPOSITION",
0xC0000096: "EXCEPTION_PRIV_INSTRUCTION",
0xC0000006: "EXCEPTION_IN_PAGE_ERROR",
0x80000003: "EXCEPTION_BREAKPOINT",
0xE06D7363: "C++ exception",
}
ACCESS = {0: "read", 1: "write", 8: "execute (DEP)"}
def read_dump(path: Path) -> dict:
"""The facts of one minidump: thread id, exception code and address, the module holding the address. Raises ValueError on a file that is not a minidump."""
with open(path, "rb") as f:
head = f.read(32)
if len(head) < 32 or head[:4] != SIGNATURE:
raise ValueError("not a minidump (no MDMP signature)")
_sig, _version, n_streams, dir_rva = struct.unpack_from("<4sIII", head, 0)
f.seek(dir_rva)
directory = [struct.unpack("<III", f.read(12)) for _ in range(n_streams)]
out: dict = {"streams": n_streams}
modules: list[tuple[int, int, str]] = []
for kind, size, rva in directory:
if kind == MODULE_LIST_STREAM:
f.seek(rva)
(count,) = struct.unpack("<I", f.read(4))
records = f.read(count * MODULE_SIZE)
for i in range(count):
base, image_size, _cs, _ts, name_rva = struct.unpack_from("<QIIII", records, i * MODULE_SIZE)
here = f.tell()
f.seek(name_rva)
(nbytes,) = struct.unpack("<I", f.read(4))
name = f.read(nbytes).decode("utf-16-le", "replace")
f.seek(here)
modules.append((base, image_size, name))
elif kind == EXCEPTION_STREAM:
f.seek(rva)
raw = f.read(8 + 8 + 8 + 8 + 8 + 15 * 8)
tid, _pad, code, flags, _chain, address, n_params, _pad2 = struct.unpack_from("<IIIIQQII", raw, 0)
params = struct.unpack_from("<15Q", raw, 8 + 32)
out.update(thread_id=tid, code=code, flags=flags, address=address, params=list(params[:n_params]))
out["module_count"] = len(modules)
if "address" in out:
for base, image_size, name in modules:
if base <= out["address"] < base + image_size:
out["module"] = name
out["offset"] = out["address"] - base
break
return out
def describe(path: Path) -> str:
size = path.stat().st_size
head = "%s: %.1f MB" % (path.name, size / 1e6)
try:
d = read_dump(path)
except (ValueError, OSError, struct.error) as e:
return "%s, unreadable header: %s" % (head, e)
if "code" not in d:
return "%s, %d modules, no exception stream (a dump taken on request, not on a fault)" % (head, d["module_count"])
name = EXCEPTION_NAMES.get(d["code"], "unknown")
lines = [
head,
" exception 0x%08X %s on thread %d" % (d["code"], name, d["thread_id"]),
" at 0x%016X in %s" % (d["address"], ("%s+0x%X" % (d["module"], d["offset"])) if "module" in d else "no module of the dump (JIT or freed code)"),
]
p = d["params"]
if d["code"] in (0xC0000005, 0xC0000006) and len(p) >= 2:
lines.append(" failed access: %s of 0x%016X" % (ACCESS.get(p[0], str(p[0])), p[1]))
return "\n".join(lines)
def summarize(folder: Path) -> str:
dumps = sorted(folder.glob("*.dmp")) if folder.is_dir() else []
cdb = shutil.which("cdb") or shutil.which("windbg")
lines = ["WER dumps of python.exe in %s: %d" % (folder, len(dumps)), "debugger on the runner: %s" % (cdb or "none (the header reader above is all there is)")]
for p in dumps:
lines.append(describe(p) + "\n written %s" % time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(p.stat().st_mtime)))
return "\n".join(lines) + "\n"
def main(argv: list[str]) -> int:
folder = Path(argv[1]) if len(argv) > 1 else Path(".")
text = summarize(folder)
sys.stdout.write(text)
if folder.is_dir():
(folder / "summary.txt").write_text(text, encoding="utf-8", newline="\n")
return 0
if __name__ == "__main__":
sys.exit(main(sys.argv))
+227
View File
@@ -0,0 +1,227 @@
#!/usr/bin/env python3
"""Extracts, from Mozilla's own sources at a release tag, the names a chrome-scope script of a test may call, into ci/mozilla-chrome-api.json.
A twin of the retail Firefox runs chrome JS (through Marionette) on a Firefox that is NOT ours. A call to a name that this Firefox does not have fails there only, at the run:
``win.windowUtils.sendMouseEvent`` is not in Firefox 159 (its chrome input is ``Window.synthesizeMouseEvent``), and nothing red said so before the twins ran. The names are therefore read
from the source of the release the twins use, never typed:
* ``dom/interfaces/base/nsIDOMWindowUtils.idl``: the methods, attributes and constants of ``nsIDOMWindowUtils`` (what ``win.windowUtils.<name>`` reaches);
* ``dom/webidl/Window.webidl``: the members of ``interface Window`` and ``partial interface Window`` (with the parameter types and whether the member is ``ChromeOnly``), and every
dictionary with its fields, parents included (what the options of ``win.synthesizeMouseEvent`` may carry).
The same two files of OUR engine tree are read the same way, and what they carry that Mozilla's do not is written apart, under ``ours``: ``jugglerSendMouseEvent``, the fields of the
latency line. A call to one of those from code that runs on retail Firefox is red (tests/test_the_chrome_calls_of_the_tests_exist_in_firefox.py).
The file records, for every source, its path, the tag or commit and the sha256 of the bytes read. The wrapper's CI has no Firefox source, so the test reads the committed file and this
module's functions are tested on a small sample (tests/test_the_extractor_of_the_chrome_names_reads_idl_and_webidl.py). One command regenerates the file:
python scripts/extract_mozilla_chrome_api.py --mozilla-repo <git repository with the Mozilla tag> --tag FIREFOX_159_0_RELEASE --ours-repo <our engine tree> --ours-ref <commit> --write
"""
from __future__ import annotations
import argparse
import hashlib
import json
import re
import subprocess
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
ROOT = Path(__file__).resolve().parent.parent
DATA_PATH = ROOT / "ci" / "mozilla-chrome-api.json"
WINDOW_UTILS_IDL = "dom/interfaces/base/nsIDOMWindowUtils.idl"
WINDOW_WEBIDL = "dom/webidl/Window.webidl"
SOURCES = (WINDOW_UTILS_IDL, WINDOW_WEBIDL)
_BLOCK_COMMENT = re.compile(r"/\*.*?\*/", re.S)
_LINE_COMMENT = re.compile(r"//[^\n]*")
_LEADING_ATTRS = re.compile(r"^\s*(?:\[[^\]]*\]\s*)*")
_WORD = re.compile(r"[A-Za-z_]\w*")
def strip_comments(text: str) -> str:
"""The text without comments and without preprocessor lines."""
text = _BLOCK_COMMENT.sub(" ", text)
text = _LINE_COMMENT.sub("", text)
return "\n".join(line for line in text.splitlines() if not line.lstrip().startswith("#"))
def _bodies(text: str, header: "re.Pattern[str]") -> List[Tuple[re.Match, str]]:
"""Every ``header { body }`` of ``text`` (braces matched), with the header's match."""
out: List[Tuple[re.Match, str]] = []
for m in header.finditer(text):
depth, i = 1, m.end()
while i < len(text) and depth:
depth += {"{": 1, "}": -1}.get(text[i], 0)
i += 1
out.append((m, text[m.end():i - 1]))
return out
def _statements(body: str) -> List[str]:
"""The ``;``-terminated statements at the top level of ``body`` (a nested ``{}`` or ``()`` does not end one)."""
out, depth, cur = [], 0, []
for ch in body:
if ch in "{(":
depth += 1
elif ch in "})":
depth -= 1
if ch == ";" and depth == 0:
out.append("".join(cur).strip())
cur = []
else:
cur.append(ch)
return [s for s in out if s]
def _split_params(text: str) -> List[str]:
out, depth, cur = [], 0, []
for ch in text:
if ch in "<([":
depth += 1
elif ch in ">)]":
depth -= 1
if ch == "," and depth == 0:
out.append("".join(cur).strip())
cur = []
else:
cur.append(ch)
tail = "".join(cur).strip()
return out + [tail] if tail else out
def _params(signature: str) -> List[List[str]]:
"""``[[name, type], ...]`` of the parameters of the call in ``signature`` (``optional`` and defaults dropped, ``in`` of the IDL dropped)."""
start = signature.index("(")
depth, i = 0, start
while i < len(signature):
depth += {"(": 1, ")": -1}.get(signature[i], 0)
if depth == 0:
break
i += 1
out = []
for raw in _split_params(signature[start + 1:i]):
raw = re.sub(r"\[[^\]]*\]", " ", raw.split("=")[0])
words = [w for w in raw.replace("<", " < ").replace(">", " > ").split() if w not in ("optional", "in", "out", "inout", "required")]
text = " ".join(words).replace(" < ", "<").replace(" > ", ">").replace(" ,", ",")
if not text:
continue
m = re.search(r"(\w+)$", text)
out.append([m.group(1), text[:m.start()].strip()])
return out
def window_utils(idl_text: str) -> Dict[str, List[str]]:
"""The methods, attributes and constants of ``nsIDOMWindowUtils`` in the text of its IDL file."""
text = strip_comments(idl_text)
methods, attributes, constants = set(), set(), set()
for _m, body in _bodies(text, re.compile(r"interface\s+nsIDOMWindowUtils\b[^{;]*\{")):
for statement in _statements(body):
rest = _LEADING_ATTRS.sub("", statement).strip()
if rest.startswith("const "):
constants.add(_WORD.findall(rest.split("=")[0])[-1])
elif re.search(r"\battribute\b", rest):
attributes.add(_WORD.findall(rest.split("=")[0])[-1])
elif "(" in rest:
methods.add(_WORD.findall(rest.split("(")[0])[-1])
return {"methods": sorted(methods), "attributes": sorted(attributes), "constants": sorted(constants)}
def window(webidl_text: str) -> Dict[str, Any]:
"""The members of ``Window`` (``interface`` and ``partial interface``) and every dictionary, parents folded in, from the text of a WebIDL file."""
text = strip_comments(webidl_text)
methods: Dict[str, Dict[str, Any]] = {}
attributes: Dict[str, Dict[str, Any]] = {}
for _m, body in _bodies(text, re.compile(r"(?:partial\s+)?interface\s+Window\b[^{;]*\{")):
for statement in _statements(body):
attrs = re.match(r"^\s*((?:\[[^\]]*\]\s*)*)", statement).group(1)
rest = _LEADING_ATTRS.sub("", statement).strip()
chrome_only = bool(re.search(r"\bChromeOnly\b", attrs))
if re.search(r"\battribute\b", rest):
attributes[_WORD.findall(rest.split("=")[0])[-1]] = {"chrome_only": chrome_only}
elif "(" in rest and not rest.startswith("constructor"):
name = _WORD.findall(rest.split("(")[0])[-1]
methods[name] = {"chrome_only": chrome_only, "params": _params(rest)}
own: Dict[str, Tuple[Optional[str], List[str]]] = {}
for m, body in _bodies(text, re.compile(r"dictionary\s+(\w+)\s*(?::\s*(\w+))?\s*\{")):
fields = []
for statement in _statements(body):
rest = _LEADING_ATTRS.sub("", statement.split("=")[0]).strip()
if rest:
fields.append(_WORD.findall(rest)[-1])
own[m.group(1)] = (m.group(2), fields)
def flat(name: str) -> List[str]:
parent, fields = own[name]
return sorted(set(fields) | (set(flat(parent)) if parent in own else set()))
return {
"methods": {k: methods[k] for k in sorted(methods)},
"attributes": {k: attributes[k] for k in sorted(attributes)},
"dictionaries": {k: flat(k) for k in sorted(own)},
}
def extract(idl_text: str, webidl_text: str) -> Dict[str, Any]:
return {"window_utils": window_utils(idl_text), "window": window(webidl_text)}
def only_in_ours(mozilla: Dict[str, Any], ours: Dict[str, Any]) -> Dict[str, Any]:
"""What the extraction of our tree carries and Mozilla's does not."""
out: Dict[str, Any] = {"window_utils": {}, "window": {"methods": [], "attributes": [], "dictionaries": {}}}
for kind in ("methods", "attributes", "constants"):
out["window_utils"][kind] = sorted(set(ours["window_utils"][kind]) - set(mozilla["window_utils"][kind]))
for kind in ("methods", "attributes"):
out["window"][kind] = sorted(set(ours["window"][kind]) - set(mozilla["window"][kind]))
for name, fields in ours["window"]["dictionaries"].items():
extra = sorted(set(fields) - set(mozilla["window"]["dictionaries"].get(name, [])))
if extra:
out["window"]["dictionaries"][name] = extra
return out
def _git_show(repo: Path, ref: str, path: str) -> bytes:
return subprocess.run(["git", "-C", str(repo), "show", "%s:%s" % (ref, path)], check=True, capture_output=True).stdout
def _read_source(repo: Path, ref: str) -> Tuple[Dict[str, Any], Dict[str, Any]]:
blobs = {path: _git_show(repo, ref, path) for path in SOURCES}
parsed = extract(blobs[WINDOW_UTILS_IDL].decode("utf-8"), blobs[WINDOW_WEBIDL].decode("utf-8"))
sources = [{"path": path, "sha256": hashlib.sha256(blobs[path]).hexdigest()} for path in SOURCES]
commit = subprocess.run(["git", "-C", str(repo), "rev-parse", "%s^{commit}" % ref], check=True, capture_output=True, text=True).stdout.strip()
return parsed, {"ref": ref, "commit": commit, "files": sources}
def build(mozilla_repo: Path, tag: str, ours_repo: Path, ours_ref: str) -> Dict[str, Any]:
mozilla, mozilla_source = _read_source(mozilla_repo, tag)
ours, ours_source = _read_source(ours_repo, ours_ref)
return {
"about": "Names a chrome-scope script of a test may call on the retail Firefox of the twins, extracted by scripts/extract_mozilla_chrome_api.py. Never edited by hand.",
"mozilla": dict(mozilla_source, **mozilla),
"ours": dict(ours_source, **only_in_ours(mozilla, ours)),
}
def main(argv: Optional[List[str]] = None) -> int:
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
ap.add_argument("--mozilla-repo", type=Path, required=True)
ap.add_argument("--tag", required=True)
ap.add_argument("--ours-repo", type=Path, required=True)
ap.add_argument("--ours-ref", required=True)
ap.add_argument("--write", action="store_true", help="write ci/mozilla-chrome-api.json; without it the file is compared and the exit is 1 when it differs")
args = ap.parse_args(argv)
data = build(args.mozilla_repo, args.tag, args.ours_repo, args.ours_ref)
text = json.dumps(data, indent=2, sort_keys=True) + "\n"
if args.write:
DATA_PATH.write_text(text, encoding="utf-8", newline="\n")
print("wrote %s" % DATA_PATH)
return 0
same = DATA_PATH.read_text(encoding="utf-8") == text
print("%s %s" % (DATA_PATH, "is what the sources give" if same else "DIFFERS from what the sources give: regenerate it with --write"))
return 0 if same else 1
if __name__ == "__main__":
sys.exit(main())
+134
View File
@@ -0,0 +1,134 @@
#!/usr/bin/env python3
"""Extracts, from the retail capture of the password-mask probe, the width retail Firefox on Windows gives a password field, into ci/retail-password-mask.json.
The e2e test ``tests/test_a_password_field_is_as_wide_as_on_retail_windows_e2e.py`` compares the width a page reads on a password field of our engine with the width RETAIL Firefox 159 on
Windows read in the same page. That number is typed nowhere: it is read here from the capture,
``captures/firefox-159.0/windows-server-2025/password-mask/<date>/result.json``: the page's whole reading (``fonts.arial16.password["40"].scrollWidth``, the ``scrollWidth`` of an
``<input type=password>`` of 40 x "a" in Arial 16px, the number a page reads) and ``meta.json`` (the sha256 of every file of the capture, of the page, of the binaries).
What is refused rather than filled in: a ``result.json`` whose sha256 is not the one ``meta.json`` lists; a page that is not the page of the capture (the sha256 of
``tests/data/password_mask_page.html`` must be ``meta.json``'s ``page.sha256``); a result with an ``error``, another ``n``, or no ``arial16`` reading; a reading that disagrees with itself (the width of
the password field in its own box and in the box of the 1, 10, 40 series; the verdict of the page, which must name U+25CF alone, the character Windows masks with).
The file records the capture's commit and run, the browser (version, build id, installer, ``firefox.exe`` and ``xul.dll`` sha256) and the sha256 of every file read. The wrapper's CI has no capture, so the
tests read the committed file and this module's functions are tested on a small sample (tests/test_the_retail_password_mask_width_is_extracted_from_the_capture_not_typed.py). One command regenerates it:
python scripts/extract_retail_password_mask.py --capture <RetailCaptures>/captures/firefox-159.0/windows-server-2025/password-mask/2026-12-02 --commit <RetailCaptures commit> --write
and the same without ``--write`` compares the committed file with what the capture gives (the check).
"""
from __future__ import annotations
import argparse
import hashlib
import json
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional
ROOT = Path(__file__).resolve().parent.parent
DATA_PATH = ROOT / "ci" / "retail-password-mask.json"
PAGE_PATH = ROOT / "tests" / "data" / "password_mask_page.html"
#: The characters of the field: ``N`` copies of "a", read in the font case ``arial16`` (``font-family:Arial;font-size:16px``).
N = 40
FONT_CASE = "arial16"
#: What Windows masks a password field with, and what the page's verdict must therefore name.
MASK = "U+25CF"
FORMAT = "password-mask/1"
class ExtractError(Exception):
"""What the capture does not give, or gives two ways: nothing is invented in its place."""
def sha256_of(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def reading(result: Dict[str, Any], where: str) -> Dict[str, Any]:
"""The width of the password field in ``arial16``, after the checks of the reading against itself."""
if "error" in result:
raise ExtractError("%s: the page recorded an error: %s" % (where, str(result["error"])[:200]))
if result.get("format") != FORMAT or result.get("n") != N:
raise ExtractError("%s: format %r and n %r, not %r and %r" % (where, result.get("format"), result.get("n"), FORMAT, N))
try:
font = result["fonts"][FONT_CASE]
width = font["password"][str(N)]["scrollWidth"]
main = font["password"][str(N)]["scrollWidth_main"]
mask_width = font["refs"][MASK]["text_input"][str(N)]["scrollWidth"]
verdict = font["verdict"]["by_text_input_scrollWidth"]
platform, dpr = result["env"]["platform"], result["env"]["devicePixelRatio"]
except (KeyError, TypeError) as exc:
raise ExtractError("%s: the reading lacks %s: no retail value, none invented" % (where, exc))
if not isinstance(width, int) or width <= 0:
raise ExtractError("%s: the width %r is not a positive integer" % (where, width))
if main != width:
raise ExtractError("%s: the password field reads %r in its own box and %r in the series box" % (where, main, width))
if mask_width != width or verdict != [MASK]:
raise ExtractError("%s: the password field is %r wide, %s in a text input is %r and the page's verdict is %r: not the mask character of Windows" % (where, width, MASK, mask_width, verdict))
if platform != "Win32":
raise ExtractError("%s: navigator.platform is %r, not Win32: not a Windows capture" % (where, platform))
return {"password_scrollWidth": width, "mask": MASK, "devicePixelRatio": dpr, "platform": platform}
def build(capture: Path, commit: str, page: Path = PAGE_PATH) -> Dict[str, Any]:
result_path, meta_path = capture / "result.json", capture / "meta.json"
for path in (result_path, meta_path, page):
if not path.is_file():
raise ExtractError("missing %s" % path)
meta = json.loads(meta_path.read_text(encoding="utf-8"))
listed = meta.get("files", {}).get("result.json", {}).get("sha256")
if listed != sha256_of(result_path):
raise ExtractError("%s is %s and meta.json lists %r: not the file the capture recorded" % (result_path, sha256_of(result_path), listed))
page_sha = sha256_of(page)
if page_sha != meta.get("page", {}).get("sha256"):
raise ExtractError("%s is %s and the capture's page is %r: the test would not read the page retail read" % (page, page_sha, meta.get("page", {}).get("sha256")))
got = reading(json.loads(result_path.read_text(encoding="utf-8")), str(result_path))
binaries = meta.get("binaries", {})
return {
"about": "What retail Firefox on Windows reads on a password field in the page tests/data/password_mask_page.html (the width of 40 x 'a' in Arial 16px, which is 40 times the advance of the mask character), extracted by scripts/extract_retail_password_mask.py. Never edited by hand.",
"capture": {
"folder": "captures/firefox-159.0/windows-server-2025/password-mask/%s" % capture.name,
"retail_captures_commit": commit,
"run": "https://github.com/%s/actions/runs/%s" % (meta["source_run"]["repo"], meta["source_run"]["run_id"]),
"browser": {"firefox_version": meta["firefox_version"], "build_id": meta["build_id"], "installer_sha256": binaries.get("installer_sha256"),
"firefox_exe_sha256": binaries.get("firefox_exe_sha256"), "xul_dll_sha256": binaries.get("xul_dll_sha256")},
"host": {"runner_image": meta["host"]["runner_image"], "os_version": meta["host"]["os_version"], "os_ubr": meta["host"]["os_ubr"]},
},
"files": [{"path": "result.json", "sha256": sha256_of(result_path)}, {"path": "meta.json", "sha256": sha256_of(meta_path)}],
"page": {"path": "tests/data/password_mask_page.html", "sha256": page_sha},
"n": N,
"cases": {FONT_CASE: got},
}
def dumps(data: Dict[str, Any]) -> str:
return json.dumps(data, indent=2, sort_keys=False) + "\n"
def main(argv: Optional[List[str]] = None) -> int:
parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
parser.add_argument("--capture", required=True, type=Path, help="the folder of the capture in RetailCaptures (result.json and meta.json)")
parser.add_argument("--commit", required=True, help="the RetailCaptures commit the capture is in")
parser.add_argument("--write", action="store_true", help="write ci/retail-password-mask.json; without it the committed file is compared with the capture")
args = parser.parse_args(argv)
try:
text = dumps(build(args.capture.resolve(), args.commit))
except ExtractError as exc:
print("EXTRACTION FAILED: %s" % exc, file=sys.stderr)
return 2
if args.write:
DATA_PATH.write_text(text, encoding="utf-8", newline="\n")
print("wrote %s" % DATA_PATH)
return 0
if DATA_PATH.read_text(encoding="utf-8") != text:
print("%s is not what the capture gives" % DATA_PATH, file=sys.stderr)
return 1
print("%s is what the capture gives" % DATA_PATH)
return 0
if __name__ == "__main__":
sys.exit(main())
+337
View File
@@ -0,0 +1,337 @@
#!/usr/bin/env python3
"""Extracts, from the retail capture ``popup-move-to``, what a popup of the maximized window reads after ``resizeBy(0, 0)``, ``moveBy(10, 10)`` and ``moveTo(99999, 0)``, per display case, per phase of the wrapper test and
per POSITION in the browser's life, into ci/retail-popup-move-resize.json.
The e2e test ``tests/test_a_popup_moves_and_resizes_as_declared_e2e.py`` compares a popup of ours with what RETAIL Firefox 159 on Windows read. An expected value comes from a capture of the SAME sequence,
position in the browser's life included: at a real 150% retail opens the FIRST popup of a browser one device pixel narrower (inner width 499, outer 514) than every popup after it (500, 515), ``resizeBy(0, 0)``
leaves the first at 499 and takes a later one to 501, and ``moveTo(99999, 0)`` stops at 766 for the first and 765 for a later one. The numbers are read from the capture, never typed:
* ``popup-move-to/<date>/<dpr>/<panel>/<launch>/raw.json`` (format ``retail-popup-move-to/1``), four launches per display case, each popup opened by a real click with ``width=500,height=400`` and closed before the next:
``a`` the test's order (phase 1 ``resizeBy(0, 0)``, phase 2 ``moveBy(10, 10)``, phase 3 ``moveBy(10, 10)`` then ``moveTo(99999, 0)``: phase 1 is the first popup of the browser), ``b`` phase 3 alone, ``c`` a throwaway
popup (no call) and then the three phases, ``d`` phase 2 alone. Every phase is thus read as the first popup of a browser (``first``: a, d, b) and as a later popup (``later``: c; a and c; a and c). Each step carries
its ordinal; the plan of every launch, the calls, the features, the close of every popup and the order of the moments are checked, and popups of the same phase and position must read the same, or the extraction fails.
* The sha256 of every raw.json is checked against the ``meta.json`` of its scale before it is read, and the run id, the browser (version, build id, installer sha256) and the sha256 of ``firefox.exe`` and
``xul.dll`` (``run-info.json``) are recorded.
* The window-geometry rounds named on the command line (``--rounds``; step ``popup_move_resize``: ``initial`` and ``resized`` as a later popup after many steps) are cross-checked: what they read after
``resizeBy(0, 0)`` must be what some position of the capture reads (at 1.5: 500 then 501, the ``later`` popup), or the extraction fails, an anomaly reported and not chosen. They must agree with each other
(all rounds, launches ``a`` and ``b``). The test does not read them.
Each phase of the test asserts against the position it has in the test: phase 1 is the first popup of its browser (``first``), phases 2 and 3 are later ones.
The wrapper's CI has no capture, so the tests read the committed file and this module's functions are tested on a small sample (tests/test_the_retail_popup_moves_and_resizes_are_extracted_from_the_capture_not_typed.py).
One command regenerates the file:
python scripts/extract_retail_popup_move_resize.py --captures <RetailCaptures>/captures --rounds 2026-11-29-window-geometry-r8 2026-11-30-window-geometry-r9 2026-11-30-window-geometry-r11 2026-12-01-window-geometry-r12 --commit <RetailCaptures commit> --move-to-capture <RetailCaptures>/captures/firefox-159.0/windows-server-2025/popup-move-to/2026-12-02 --move-to-run-id <id of the run> --move-to-commit <RetailCaptures commit> --write
and the same without ``--write`` compares the committed file with what the captures give (the check).
"""
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
sys.path.insert(0, str(Path(__file__).resolve().parent))
from extract_retail_popup_sizes import BROWSER_DIR, DISPLAYS, ExtractError, case_id, sha256_of # noqa: E402
ROOT = Path(__file__).resolve().parent.parent
DATA_PATH = ROOT / "ci" / "retail-popup-move-resize.json"
MOMENTS = ("initial", "resized", "moved", "moved_to")
FEATURES = "width=500,height=400"
#: ``popup-move-to`` capture: the format of its raw.json and meta.json, the phase, and the order of phases of launch ``a`` (the test's order: phase 3 is the third popup).
MOVE_TO_FORMAT = "retail-popup-move-to/1"
MOVE_TO_META_FORMAT = "retail-popup-move-to-meta/1"
POSITION_FIRST = "first"
POSITION_LATER = "later"
MOVE_TO_PHASES = ["resize_by_zero", "move_by", "move_to_far_right"]
#: The launches of the capture and the popups each opens in order (``scripts/popup_move_to/run.py``, LAUNCHES): a is the test's order (phase 1 is the first popup of the browser); b phase 3 alone; c a throwaway
#: popup opened and closed first (no call), then the three phases; d phase 2 alone. Every phase is thus read as the first popup of a browser and as a later one.
MOVE_TO_LAUNCHES = {
"a": ["resize_by_zero", "move_by", "move_to_far_right"],
"b": ["move_to_far_right"],
"c": ["throwaway", "resize_by_zero", "move_by", "move_to_far_right"],
"d": ["move_by"],
}
MOVE_TO_MOMENTS = {
"throwaway": ("initial",),
"resize_by_zero": ("initial", "resized"),
"move_by": ("initial", "moved"),
"move_to_far_right": ("initial", "moved", "moved_to"),
}
MOVE_TO_CALLS = {
"throwaway": {},
"resize_by_zero": {"resized": "window.resizeBy(0, 0)"},
"move_by": {"moved": "window.moveBy(10, 10)"},
"move_to_far_right": {"moved": "window.moveBy(10, 10)", "moved_to": "window.moveTo(99999, 0)"},
}
MOVE_TO_BINARIES = ("firefox.exe", "xul.dll")
def moment_reading(moment: Dict[str, Any], where: str) -> Dict[str, Any]:
try:
return {
"inner": [moment["innerWidth"], moment["innerHeight"]],
"outer": [moment["outerWidth"], moment["outerHeight"]],
"screen": [moment["screenX"], moment["screenY"]],
"avail": [moment["availLeft"], moment["availWidth"]],
}
except (KeyError, TypeError) as exc:
raise ExtractError("%s: the moment lacks %s" % (where, exc))
def read_step(raw: Dict[str, Any], where: str) -> Dict[str, Dict[str, Any]]:
try:
step = raw["steps"]["popup_move_resize"]
moments = step["moments"]
except (KeyError, TypeError):
raise ExtractError("%s has no step popup_move_resize with moments" % where)
if step.get("features") != FEATURES:
raise ExtractError("%s: the popup was opened with %r, not %r" % (where, step.get("features"), FEATURES))
missing = [m for m in MOMENTS if m not in moments]
if missing:
raise ExtractError("%s lacks the moments %r: no retail value, none invented" % (where, missing))
readings = {m: moment_reading(moments[m], "%s %s" % (where, m)) for m in MOMENTS}
opened, resized, moved, moved_to = (readings[m]["screen"] for m in MOMENTS)
if not (opened == resized and moved != opened and moved_to != moved):
raise ExtractError("%s: the positions %r do not follow the order initial, resized, moved, moved_to" % (where, {m: readings[m]["screen"] for m in MOMENTS}))
return readings
def build(captures: Path, rounds: List[str], commit: str) -> Dict[str, Any]:
if len(rounds) < 2:
raise ExtractError("at least two rounds are needed to say that rounds agree")
cases: Dict[str, Dict[str, Any]] = {}
files: List[Dict[str, str]] = []
browser: Optional[Dict[str, Any]] = None
for dpr_dir, panel, scale in DISPLAYS:
first: Optional[Dict[str, Any]] = None
for round_name in rounds:
for launch in ("a", "b"):
path = captures / BROWSER_DIR / round_name / dpr_dir / panel / launch / "raw.json"
if not path.is_file():
raise ExtractError("missing %s" % path)
raw = json.loads(path.read_text(encoding="utf-8"))
if raw.get("dpr_asked") != scale:
raise ExtractError("%s asks scale %r, not %r" % (path, raw.get("dpr_asked"), scale))
meta = {"firefox_version": raw["firefox_version"], "build_id": raw["build_id"], "installer_sha256": raw["installer_sha256"]}
if browser not in (None, meta):
raise ExtractError("%s is not the same browser as the others: %r and %r" % (path, meta, browser))
browser = meta
readings = read_step(raw, str(path))
if first is None:
first = readings
elif readings != first:
raise ExtractError("%s %s: round %s launch %s reads %r, the first one read %r" % (dpr_dir, panel, round_name, launch, readings, first))
files.append({"path": "%s/%s/%s/%s/raw.json" % (round_name, dpr_dir, panel, launch), "sha256": sha256_of(path)})
cases[case_id(panel, scale)] = first or {}
return {
"about": "What retail Firefox reads in a popup of the maximized window after resizeBy(0, 0), moveBy(10, 10) and moveTo(99999, 0), per display case, extracted by scripts/extract_retail_popup_move_resize.py. Never edited by hand.",
"capture": {"rounds": rounds, "retail_captures_commit": commit, "popup_features": FEATURES, "moments_in_order": list(MOMENTS), "browser": browser},
"files": files,
"cases": cases,
}
def move_to_reading(moment: Dict[str, Any], where: str) -> Dict[str, Any]:
"""One moment of the ``popup-move-to`` format (short keys: ``iw``, ``ih``, ``ow``, ``oh``, ``sx``, ``sy``, ``availL``, ``availW``), in the shape of ``moment_reading``."""
try:
return {
"inner": [moment["iw"], moment["ih"]],
"outer": [moment["ow"], moment["oh"]],
"screen": [moment["sx"], moment["sy"]],
"avail": [moment["availL"], moment["availW"]],
}
except (KeyError, TypeError) as exc:
raise ExtractError("%s: the moment lacks %s" % (where, exc))
def position_of(ordinal: int) -> str:
"""``first``: the first popup the browser opens; ``later``: any popup after it (a throwaway popup counts)."""
return POSITION_FIRST if ordinal == 1 else POSITION_LATER
def read_launch(raw: Dict[str, Any], launch: str, where: str) -> List[Tuple[str, int, Dict[str, Dict[str, Any]]]]:
"""``[(phase, ordinal, readings)]`` of one launch of the ``popup-move-to`` capture, each phase checked against the plan of the launch, its calls and the order of its moments."""
if raw.get("format") != MOVE_TO_FORMAT:
raise ExtractError("%s has the format %r, not %r" % (where, raw.get("format"), MOVE_TO_FORMAT))
if raw.get("error") is not None:
raise ExtractError("%s ends with the error %r" % (where, raw.get("error")))
if raw.get("launch") != launch:
raise ExtractError("%s is launch %r, not %r" % (where, raw.get("launch"), launch))
if raw.get("phases_planned") != MOVE_TO_LAUNCHES[launch]:
raise ExtractError("%s ran the popups %r, not %r: the position of a phase in the browser's life is not the one this launch is for" % (
where, raw.get("phases_planned"), MOVE_TO_LAUNCHES[launch]))
found = []
for ordinal, phase in enumerate(MOVE_TO_LAUNCHES[launch], 1):
label = "%s step phase_%s" % (where, phase)
try:
step = raw["steps"]["phase_" + phase]
moments = step["moments"]
except (KeyError, TypeError):
raise ExtractError("%s is missing: no retail value, none invented" % label)
if step.get("ordinal") != ordinal:
raise ExtractError("%s is popup number %r of the browser, the plan says %r" % (label, step.get("ordinal"), ordinal))
if step.get("features") != FEATURES:
raise ExtractError("%s: the popup was opened with %r, not %r" % (label, step.get("features"), FEATURES))
if step.get("closed") is not True:
raise ExtractError("%s: the popup was not closed (%r), the next popup would not be the next one of a test that closes each" % (label, step.get("closed")))
if step.get("calls") != MOVE_TO_CALLS[phase]:
raise ExtractError("%s: the calls are %r, not %r" % (label, step.get("calls"), MOVE_TO_CALLS[phase]))
wanted = MOVE_TO_MOMENTS[phase]
missing = [m for m in wanted if m not in moments]
if missing:
raise ExtractError("%s lacks the moments %r: no retail value, none invented" % (label, missing))
readings = {m: move_to_reading(moments[m], "%s %s" % (label, m)) for m in wanted}
at = {m: readings[m]["screen"] for m in wanted}
if phase == "resize_by_zero":
in_order = at["resized"] == at["initial"]
elif phase == "move_by":
in_order = at["moved"] != at["initial"]
elif phase == "move_to_far_right":
in_order = at["moved"] != at["initial"] and at["moved_to"] != at["moved"]
else:
in_order = True
if not in_order:
raise ExtractError("%s: the positions %r do not follow the order %r" % (label, at, list(wanted)))
if phase != "throwaway":
found.append((phase, ordinal, readings))
return found
def build_move_to(capture: Path, run_id: str, commit: str) -> Dict[str, Any]:
"""The readings of every phase as the first popup of a browser and as a later popup: the four launches of the four display cases of one ``popup-move-to`` capture folder (the date folder), each
raw.json checked against the sha256 of its ``meta.json``. Popups of the same phase and the same position (``first``, ``later``) must read the same, or the extraction fails."""
run_info_path = capture / "run-info.json"
if not run_info_path.is_file():
raise ExtractError("missing %s" % run_info_path)
run_info = json.loads(run_info_path.read_text(encoding="utf-8"))
try:
binaries = {name: run_info["binaries"][name]["sha256"] for name in MOVE_TO_BINARIES}
except (KeyError, TypeError) as exc:
raise ExtractError("%s lacks the sha256 of %s" % (run_info_path, exc))
cases: Dict[str, Dict[str, Dict[str, Dict[str, Any]]]] = {}
sources: Dict[str, Dict[str, Dict[str, List[str]]]] = {}
files: List[Dict[str, str]] = []
browser: Optional[Dict[str, Any]] = None
for dpr_dir, panel, scale in DISPLAYS:
meta_path = capture / dpr_dir / "meta.json"
if not meta_path.is_file():
raise ExtractError("missing %s" % meta_path)
meta_file = json.loads(meta_path.read_text(encoding="utf-8"))
if meta_file.get("format") != MOVE_TO_META_FORMAT:
raise ExtractError("%s has the format %r, not %r" % (meta_path, meta_file.get("format"), MOVE_TO_META_FORMAT))
groups: Dict[Tuple[str, str], List[Tuple[str, int, Dict[str, Dict[str, Any]]]]] = {}
for launch in MOVE_TO_LAUNCHES:
path = capture / dpr_dir / panel / launch / "raw.json"
if not path.is_file():
raise ExtractError("missing %s" % path)
want = (meta_file.get("raw_sha256") or {}).get("%s/%s/raw.json" % (panel, launch))
have = sha256_of(path)
if want != have:
raise ExtractError("%s has the sha256 %s, its meta.json says %s: the file is not the one the capture wrote" % (path, have, want))
raw = json.loads(path.read_text(encoding="utf-8"))
if raw.get("dpr_asked") != scale:
raise ExtractError("%s asks scale %r, not %r" % (path, raw.get("dpr_asked"), scale))
found = {"firefox_version": raw["firefox_version"], "build_id": raw["build_id"], "installer_sha256": raw["installer_sha256"]}
if found != {k: meta_file.get(k) for k in found}:
raise ExtractError("%s is not the browser its meta.json names: %r" % (path, found))
if browser not in (None, found):
raise ExtractError("%s is not the same browser as the others: %r and %r" % (path, found, browser))
browser = found
for phase, ordinal, readings in read_launch(raw, launch, str(path)):
groups.setdefault((phase, position_of(ordinal)), []).append((launch, ordinal, readings))
files.append({"path": "%s/%s/%s/raw.json" % (dpr_dir, panel, launch), "sha256": have})
case: Dict[str, Dict[str, Dict[str, Any]]] = {}
origin: Dict[str, Dict[str, List[str]]] = {}
for phase in MOVE_TO_PHASES:
for position in (POSITION_FIRST, POSITION_LATER):
group = groups.get((phase, position))
if not group:
raise ExtractError("%s %s: no capture of %s as the %s popup of a browser: no retail value, none invented" % (dpr_dir, panel, phase, position))
first_launch, first_ordinal, first_readings = group[0]
for launch, ordinal, readings in group[1:]:
if readings != first_readings:
raise ExtractError("%s %s %s: the %s popup number %d of launch %s reads %r, popup number %d of launch %s read %r: popups of one position must agree" % (
dpr_dir, panel, phase, position, ordinal, launch, readings, first_ordinal, first_launch, first_readings))
case.setdefault(phase, {})[position] = first_readings
origin.setdefault(phase, {})[position] = ["%s#%d" % (launch, ordinal) for launch, ordinal, _ in group]
cases[case_id(panel, scale)] = case
sources[case_id(panel, scale)] = origin
named = (run_info.get("build") or {}).get("build_id")
if named != (browser or {}).get("build_id"):
raise ExtractError("%s names the build %r, the raw files %r" % (run_info_path, named, (browser or {}).get("build_id")))
return {
"about": "What retail Firefox reads in a popup of the maximized window, per display case, per phase of the wrapper test (resize_by_zero, move_by, move_to_far_right) and per position in the browser's life "
"(first: the first popup the browser opens; later: any popup after it), from the popup-move-to capture; a test phase asserts against the position it has in the test. Extracted by "
"scripts/extract_retail_popup_move_resize.py. Never edited by hand.",
"capture": {
"run_id": run_id,
"retail_captures_commit": commit,
"folder": capture.name,
"format": MOVE_TO_FORMAT,
"popup_features": FEATURES,
"launches": MOVE_TO_LAUNCHES,
"browser": browser,
"binaries_sha256": binaries,
},
"files": files,
"sources": sources,
"cases": cases,
}
def cross_check(rounds: Dict[str, Any], cases: Dict[str, Any]) -> Dict[str, List[str]]:
"""What the window-geometry rounds read for a popup after ``resizeBy(0, 0)`` (``initial``, ``resized``) must be what SOME position of the popup-move-to capture reads (the rounds ran it as a later popup,
after other popups): a value no position reproduces is an anomaly, reported, not chosen. Returns, per case, the positions that reproduce it."""
reproduced_by: Dict[str, List[str]] = {}
for case, moments in rounds["cases"].items():
reproduced_by[case] = [pos for pos, got in cases[case]["resize_by_zero"].items() if all(got[m] == moments[m] for m in ("initial", "resized"))]
if not reproduced_by[case]:
raise ExtractError("%s: the rounds read %r after resizeBy(0, 0), no position of the popup-move-to capture reads that (%r)" % (
case, {m: moments[m] for m in ("initial", "resized")}, cases[case]["resize_by_zero"]))
return reproduced_by
def dumps(data: Dict[str, Any]) -> str:
return json.dumps(data, indent=2) + "\n"
def main(argv: Optional[List[str]] = None) -> int:
parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
parser.add_argument("--captures", required=True, type=Path, help="the captures folder of RetailCaptures")
parser.add_argument("--rounds", required=True, nargs="+")
parser.add_argument("--commit", required=True, help="the RetailCaptures commit the rounds are in")
parser.add_argument("--move-to-capture", required=True, type=Path, help="the date folder of the popup-move-to capture (with run-info.json and the dpr folders)")
parser.add_argument("--move-to-run-id", required=True, help="the id of the run that made the popup-move-to capture")
parser.add_argument("--move-to-commit", required=True, help="the RetailCaptures commit the popup-move-to capture is in")
parser.add_argument("--write", action="store_true", help="write ci/retail-popup-move-resize.json; without it the committed file is compared with the captures")
args = parser.parse_args(argv)
try:
rounds = build(args.captures, args.rounds, args.commit)
data = build_move_to(args.move_to_capture, args.move_to_run_id, args.move_to_commit)
data["rounds_cross_check"] = {
"about": "The window-geometry rounds (a popup after resizeBy(0, 0) as a later popup of a long browser life) read what the positions listed in reproduced_by read in the popup-move-to capture; they are not read by the test.",
"capture": rounds["capture"],
"files": rounds["files"],
"reproduced_by": cross_check(rounds, data["cases"]),
}
text = dumps(data)
except ExtractError as exc:
print("EXTRACTION FAILED: %s" % exc, file=sys.stderr)
return 2
if args.write:
DATA_PATH.write_text(text, encoding="utf-8", newline="\n")
print("wrote %s" % DATA_PATH)
return 0
if DATA_PATH.read_text(encoding="utf-8") != text:
print("%s is not what the captures give" % DATA_PATH, file=sys.stderr)
return 1
print("%s is what the captures give" % DATA_PATH)
return 0
if __name__ == "__main__":
sys.exit(main())
+175
View File
@@ -0,0 +1,175 @@
#!/usr/bin/env python3
"""Extracts, from a retail capture of the window geometry, the sizes retail Firefox gives a popup opened from a maximized main window, into ci/retail-popup-sizes.json.
The e2e test ``tests/test_a_popup_reads_the_retail_sizes_of_a_maximized_main_window_e2e.py`` compares what a popup reads with what RETAIL Firefox 159 on Windows read. Those numbers were a table typed
by hand, and one was wrong (outer width 514 at scale 1.5, the value of 1.25; retail read 515). They are therefore read from the capture, never typed:
* ``<round>/<dpr>/<panel>/<launch>/raw.json``, step ``popup_sizes``, variant by variant (one variant per feature string; the variant says which string it is in ``features``): the popup at
one second after its load (``at_1s``: inner, outer, ``screenX``/``screenY``) and the visual viewport at ``load`` (``early.load``). Launch ``a`` is the one extracted; launch ``b`` (a second
launch of the same display case) must give the same values, or the extraction fails: a value the two launches disagree on is not a value.
* ``captures/WINDOW_GEOMETRY_POPUP_FRAME.csv`` (when given): its rows of step ``popup`` (``width=500,height=400``, launch ``a``, every round) must give the inner, outer and screen position that
``popup_sizes`` gives for the same string, or the extraction fails.
The file records the round, the browser (version, build id, installer sha256), the sha256 of every raw.json and of the CSV that were read. The wrapper's CI has no capture, so the tests read the
committed file and this module's functions are tested on a small sample (tests/test_the_retail_popup_sizes_are_extracted_from_the_capture_not_typed.py). One command regenerates the file:
python scripts/extract_retail_popup_sizes.py --captures <RetailCaptures>/captures --round 2026-12-01-window-geometry-r12 --run-url <url of the run> --commit <RetailCaptures commit> --write
and the same without ``--write`` compares the committed file with what the capture gives (the check).
"""
from __future__ import annotations
import argparse
import csv
import hashlib
import json
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
ROOT = Path(__file__).resolve().parent.parent
DATA_PATH = ROOT / "ci" / "retail-popup-sizes.json"
BROWSER_DIR = "firefox-159.0/github-runner"
CSV_NAME = "WINDOW_GEOMETRY_POPUP_FRAME.csv"
#: The four display cases, in the order of their scale: (folder of the dpr, panel, scale).
DISPLAYS = (("dpr1", "1920x1080", 1.0), ("dpr1.25", "1920x1080", 1.25), ("dpr1.5", "1920x1080", 1.5), ("dpr2", "1600x1200", 2.0))
#: The feature strings the e2e test opens popups with (the tab, ``''``, is not a popup).
FEATURES = ("width=500,height=400", "popup", "width=500", "height=400", "width=300,height=200", "width=800,height=600", "left=100,top=100", "left=5000,top=5000")
class ExtractError(Exception):
"""What the capture does not give, or gives two ways: nothing is invented in its place."""
def case_id(panel: str, scale: float) -> str:
return "%s-dpr%s" % (panel, scale)
def sha256_of(path: Path) -> str:
return hashlib.sha256(path.read_bytes()).hexdigest()
def variants_of(raw: Dict[str, Any], where: str) -> Dict[str, Dict[str, Any]]:
"""``{features: variant}`` of the step ``popup_sizes`` of one raw.json."""
try:
found = raw["steps"]["popup_sizes"]["variants"]
except (KeyError, TypeError):
raise ExtractError("%s has no step popup_sizes with variants" % where)
return {v["features"]: v for v in found.values() if isinstance(v, dict) and "features" in v}
def reading(variant: Dict[str, Any], where: str) -> Dict[str, Any]:
"""What retail read for one variant: inner, outer, screen (one second after the load) and the visual viewport height (at ``load``)."""
try:
at, load = variant["at_1s"], variant["early"]["load"]
return {
"inner": [at["innerWidth"], at["innerHeight"]],
"outer": [at["outerWidth"], at["outerHeight"]],
"screen": [at["screenX"], at["screenY"]],
"vv_height": load["visualViewportHeight"],
}
except (KeyError, TypeError) as exc:
raise ExtractError("%s: the variant lacks %s" % (where, exc))
def extract_display(capture: Path, dpr_dir: str, panel: str, scale: float) -> Tuple[Dict[str, Dict[str, Any]], List[Dict[str, str]], Dict[str, Any]]:
"""The readings of one display case, from launch ``a``, checked against launch ``b``; the files read; the browser they come from."""
files, per_launch, meta = [], {}, {}
for launch in ("a", "b"):
path = capture / dpr_dir / panel / launch / "raw.json"
if not path.is_file():
raise ExtractError("missing %s" % path)
raw = json.loads(path.read_text(encoding="utf-8"))
if raw.get("dpr_asked") != scale:
raise ExtractError("%s asks scale %r, not %r" % (path, raw.get("dpr_asked"), scale))
found = variants_of(raw, str(path))
per_launch[launch] = {}
for features in FEATURES:
if features not in found:
raise ExtractError("%s has no popup_sizes variant for %r: no retail value, none invented" % (path, features))
per_launch[launch][features] = reading(found[features], "%s %r" % (path, features))
files.append({"path": "%s/%s/%s/raw.json" % (dpr_dir, panel, launch), "sha256": sha256_of(path)})
meta[launch] = {"firefox_version": raw["firefox_version"], "build_id": raw["build_id"], "installer_sha256": raw["installer_sha256"]}
for features in FEATURES:
if per_launch["a"][features] != per_launch["b"][features]:
raise ExtractError("%s %s %r: launch a reads %r and launch b reads %r" % (dpr_dir, panel, features, per_launch["a"][features], per_launch["b"][features]))
if meta["a"] != meta["b"]:
raise ExtractError("%s %s: the two launches are not the same browser: %r" % (dpr_dir, panel, meta))
return per_launch["a"], files, meta["a"]
def check_csv(csv_path: Path, cases: Dict[str, Dict[str, Dict[str, Any]]]) -> None:
"""Every ``popup`` row of launch ``a`` of the CSV (``width=500,height=400``, every round) agrees with the extracted reading of the same display case."""
seen = 0
with csv_path.open(encoding="utf-8", newline="") as handle:
for number, row in enumerate(csv.DictReader(handle), start=2):
if row["step"] != "popup" or row["launch"] != "a":
continue
panel = row["path"].split("/")[-3]
case = case_id(panel, float(row["dpr_asked"]))
got = cases.get(case, {}).get(row["features"])
if got is None:
raise ExtractError("%s row %d: no extracted reading for %s, %r" % (csv_path.name, number, case, row["features"]))
seen += 1
have = {"inner": [int(row["innerWidth"]), int(row["innerHeight"])], "outer": [int(row["outerWidth"]), int(row["outerHeight"])], "screen": [int(row["screenX"]), int(row["screenY"])]}
for key, value in have.items():
if got[key] != value:
raise ExtractError("%s row %d (%s, %r): %s is %r in the CSV and %r in popup_sizes" % (csv_path.name, number, case, row["features"], key, value, got[key]))
if not seen:
raise ExtractError("%s has no popup row of launch a" % csv_path.name)
def build(captures: Path, round_name: str, run_url: str, commit: str) -> Dict[str, Any]:
capture = captures / BROWSER_DIR / round_name
cases: Dict[str, Dict[str, Dict[str, Any]]] = {}
files: List[Dict[str, str]] = []
browser: Optional[Dict[str, Any]] = None
for dpr_dir, panel, scale in DISPLAYS:
readings, read, meta = extract_display(capture, dpr_dir, panel, scale)
if browser not in (None, meta):
raise ExtractError("the display cases come from two browsers: %r and %r" % (browser, meta))
browser = meta
cases[case_id(panel, scale)] = readings
files.extend(read)
csv_path = captures / CSV_NAME
check_csv(csv_path, cases)
return {
"about": "What retail Firefox reads in a popup opened from a maximized main window, per display case and feature string, extracted by scripts/extract_retail_popup_sizes.py. Never edited by hand.",
"capture": {"round": round_name, "run": run_url, "retail_captures_commit": commit, "browser": browser},
"files": files,
"csv_checked": {"path": CSV_NAME, "sha256": sha256_of(csv_path)},
"cases": cases,
}
def dumps(data: Dict[str, Any]) -> str:
return json.dumps(data, indent=2, sort_keys=False) + "\n"
def main(argv: Optional[List[str]] = None) -> int:
parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
parser.add_argument("--captures", required=True, type=Path, help="the captures folder of RetailCaptures")
parser.add_argument("--round", required=True)
parser.add_argument("--run-url", required=True)
parser.add_argument("--commit", required=True, help="the RetailCaptures commit the round is in")
parser.add_argument("--write", action="store_true", help="write ci/retail-popup-sizes.json; without it the committed file is compared with the capture")
args = parser.parse_args(argv)
try:
text = dumps(build(args.captures, args.round, args.run_url, args.commit))
except ExtractError as exc:
print("EXTRACTION FAILED: %s" % exc, file=sys.stderr)
return 2
if args.write:
DATA_PATH.write_text(text, encoding="utf-8", newline="\n")
print("wrote %s" % DATA_PATH)
return 0
if DATA_PATH.read_text(encoding="utf-8") != text:
print("%s is not what the capture gives" % DATA_PATH, file=sys.stderr)
return 1
print("%s is what the capture gives" % DATA_PATH)
return 0
if __name__ == "__main__":
sys.exit(main())
-199
View File
@@ -1,199 +0,0 @@
#!/usr/bin/env python3
"""The engine of an ENGINE CANDIDATE for a hunt, instead of the published one.
A candidate is a run of the `release` workflow of oss-invisible/firefox_antidetect_patch (kind=candidate): it builds both legs and
uploads each as the artifact `asset-<leg>`. A hunt branch names the run in two one-line files, written when the hunt is launched:
ci/candidate-run.txt the id of that run
ci/candidate-core-ref.txt the ref of oss-invisible/core the candidate was gated with (its `core_ref` input)
Both hold `TODO` until then, and every command here refuses `TODO` first, so a push before the launch fails at once and says why.
python scripts/hunt_candidate_binary.py check # both files are filled in: exit 1 and a message if not
python scripts/hunt_candidate_binary.py core-ref # prints the core ref
python scripts/hunt_candidate_binary.py verify-core # the installed core IS the git install of that ref (as gate.yml asserts)
python scripts/hunt_candidate_binary.py seal-tag # prints the tag the candidate is sealed under, firefox-N-candidate
python scripts/hunt_candidate_binary.py fetch --leg win-x86_64 --dest DIR
# downloads asset-<leg>, extracts it, seals the binary, exports the env
`fetch` does what the gate of the candidate does with its own artifact (gate.yml of the engine repository): the one
`firefox-*-stealth-<leg>.*` archive of the artifact is extracted (zip on Windows, tar.gz on Linux), and
`python -m invisible_core seal --binary <exe> --tag <seal tag>` writes the seal the wrapper's launch is checked under, and DEST/candidate.json
says which run, core ref, seal tag and bytes the hunt ran on. It then writes to
$GITHUB_ENV (when set) and prints: FF and INVPW_BINARY_PATH (the binary) and INVISIBLE_SEAL_FILE (the seal).
The seal tag is the one the plan job of the candidate's run printed (`seal_tag=firefox-N-candidate`); when that log cannot be read it is
the last published `firefox-N` tag plus one, which is how the plan makes it, and the line says so.
Needs the GitHub CLI with GH_TOKEN (the engine repository is public: the token of the workflow reads its artifacts and logs).
"""
from __future__ import annotations
import argparse
import hashlib
import json
import os
import re
import subprocess
import sys
import zipfile
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
ENGINE_REPO = "oss-invisible/firefox_antidetect_patch"
CORE_URL = "https://github.com/oss-invisible/core"
RUN_FILE = ROOT / "ci" / "candidate-run.txt"
CORE_FILE = ROOT / "ci" / "candidate-core-ref.txt"
LEGS = ("win-x86_64", "linux-x86_64")
class Refused(Exception):
"""What the hunt cannot start without; the message is the whole explanation."""
def _line(path: Path, what: str) -> str:
try:
text = path.read_text(encoding="utf-8")
except OSError as exc:
raise Refused("%s cannot be read: %s" % (path.relative_to(ROOT).as_posix(), exc))
lines = [line.strip() for line in text.splitlines() if line.strip()]
if len(lines) != 1:
raise Refused("%s must hold exactly one line (%s), it holds %d" % (path.relative_to(ROOT).as_posix(), what, len(lines)))
if lines[0] == "TODO":
raise Refused("%s says TODO: this hunt has no candidate yet. Write %s there, commit and push again."
% (path.relative_to(ROOT).as_posix(), what))
return lines[0]
def run_id() -> str:
value = _line(RUN_FILE, "the id of the candidate's run of the release workflow of %s" % ENGINE_REPO)
if not re.fullmatch(r"[0-9]{6,}", value):
raise Refused("ci/candidate-run.txt must be a run id (digits only), it says %r" % value)
return value
def core_ref() -> str:
value = _line(CORE_FILE, "the core_ref the candidate was gated with (a branch, a tag or a 40-character sha of oss-invisible/core)")
if not re.fullmatch(r"[A-Za-z0-9._/-]+", value) or value.startswith(("-", "/")):
raise Refused("ci/candidate-core-ref.txt must be one ref of the core, it says %r" % value)
return value
def _gh(*args: str) -> str:
done = subprocess.run(["gh", *args], capture_output=True, text=True, encoding="utf-8", errors="replace")
if done.returncode:
raise Refused("gh %s failed: %s" % (" ".join(args[:3]), (done.stderr or done.stdout).strip()[:400]))
return done.stdout
def seal_tag(run: str) -> str:
try:
jobs = json.loads(_gh("api", "repos/%s/actions/runs/%s/jobs?per_page=100" % (ENGINE_REPO, run)))["jobs"]
plan = next(j["id"] for j in jobs if j["name"] == "plan")
log = _gh("api", "--allow-escape-sequences", "repos/%s/actions/jobs/%s/logs" % (ENGINE_REPO, plan))
found = re.findall(r"seal_tag=(firefox-[0-9]+-candidate)\b", log)
if found:
print("seal tag %s (the plan job of run %s)" % (found[-1], run), file=sys.stderr)
return found[-1]
raise Refused("the plan job's log has no seal_tag line")
except (Refused, StopIteration, KeyError, ValueError) as exc:
print("::warning::the seal tag could not be read from run %s (%s); using the last published tag plus one" % (run, exc), file=sys.stderr)
rows = subprocess.run(["git", "ls-remote", "--tags", "--refs", "https://github.com/%s" % ENGINE_REPO, "refs/tags/firefox-*"],
capture_output=True, text=True, check=True).stdout.splitlines()
numbers = [int(m.group(1)) for line in rows for m in [re.search(r"refs/tags/firefox-([0-9]+)$", line)] if m]
if not numbers:
raise Refused("no firefox-N tag in %s: the number of the candidate is unknown" % ENGINE_REPO)
return "firefox-%d-candidate" % (max(numbers) + 1)
def verify_core(ref: str) -> None:
"""The installed core is the git install of exactly `ref` (the assertion of gate.yml), read after importing the wrapper."""
from importlib.metadata import distribution, version
if re.fullmatch(r"[0-9a-f]{40}", ref):
want = ref
else:
rows = [line.split() for line in subprocess.run(["git", "ls-remote", CORE_URL, ref, ref + "^{}"], capture_output=True, text=True,
check=True).stdout.splitlines() if line.strip()]
peeled = [sha for sha, name in rows if name.endswith("^{}")] # an annotated tag: its commit, not the tag object
want = (peeled or [sha for sha, _ in rows] or [""])[0]
import invisible_playwright # noqa: F401 - the import-time pin repair runs here, as under pytest
raw = distribution("invisible-core").read_text("direct_url.json")
got = (json.loads(raw).get("vcs_info") or {}).get("commit_id") if raw else None
print("core under test: %s from %s" % (version("invisible-core"), got or "the index"))
if not want or got != want:
raise Refused("THE CORE UNDER TEST IS NOT %s: installed %s from %s, the ref is %s"
% (ref, version("invisible-core"), got or "the index", want or "not a ref of the core"))
def fetch(leg: str, dest: Path) -> dict:
run = run_id()
tag = seal_tag(run)
dest.mkdir(parents=True, exist_ok=True)
art = dest / "art"
_gh("run", "download", run, "-R", ENGINE_REPO, "-n", "asset-%s" % leg, "-D", str(art))
archives = sorted(art.glob("firefox-*-stealth-%s.*" % leg))
if len(archives) != 1:
raise Refused("expected one firefox-*-stealth-%s archive in the artifact asset-%s of run %s, found: %s"
% (leg, leg, run, [p.name for p in archives] or sorted(p.name for p in art.iterdir())))
ff = dest / "ff"
ff.mkdir(exist_ok=True)
if leg.startswith("win"):
with zipfile.ZipFile(archives[0]) as z:
z.extractall(ff)
exe = ff / "firefox.exe"
else:
subprocess.run(["tar", "xzf", str(archives[0]), "-C", str(ff)], check=True)
exe = ff / "firefox"
if exe.exists():
exe.chmod(exe.stat().st_mode | 0o111)
if not exe.exists():
raise Refused("the archive %s has no %s at its root" % (archives[0].name, exe.name))
seal = dest / "candidate.seal.json"
subprocess.run([sys.executable, "-m", "invisible_core", "seal", "--binary", str(exe), "--tag", tag, "-o", str(seal)], check=True)
record = {"engine_repo": ENGINE_REPO, "run_id": run, "core_ref": core_ref(), "seal_tag": tag, "leg": leg, "archive": archives[0].name,
"archive_sha256": hashlib.sha256(archives[0].read_bytes()).hexdigest(),
"binary_sha256": hashlib.sha256(exe.read_bytes()).hexdigest()}
(dest / "candidate.json").write_text(json.dumps(record, indent=2), encoding="utf-8")
env = {"FF": exe.resolve().as_posix(), "INVPW_BINARY_PATH": exe.resolve().as_posix(), "INVISIBLE_SEAL_FILE": seal.resolve().as_posix()}
target = os.environ.get("GITHUB_ENV")
if target:
with open(target, "a", encoding="utf-8", newline="\n") as handle:
handle.writelines("%s=%s\n" % kv for kv in env.items())
for key, value in env.items():
print("%s=%s" % (key, value))
print("candidate run %s, archive %s, sealed as %s" % (run, archives[0].name, tag), file=sys.stderr)
return env
def main(argv=None) -> int:
parser = argparse.ArgumentParser(description=__doc__.split("\n\n")[0], formatter_class=argparse.RawDescriptionHelpFormatter)
sub = parser.add_subparsers(dest="command", required=True)
sub.add_parser("check")
sub.add_parser("core-ref")
sub.add_parser("verify-core")
sub.add_parser("seal-tag")
f = sub.add_parser("fetch")
f.add_argument("--leg", choices=LEGS, required=True)
f.add_argument("--dest", required=True, type=Path)
args = parser.parse_args(argv)
try:
if args.command == "check":
print("candidate run %s, core ref %s" % (run_id(), core_ref()))
elif args.command == "core-ref":
print(core_ref())
elif args.command == "verify-core":
verify_core(core_ref())
elif args.command == "seal-tag":
print(seal_tag(run_id()))
else:
fetch(args.leg, args.dest)
except Refused as exc:
print("::error::%s" % exc)
return 1
return 0
if __name__ == "__main__":
sys.exit(main())
-103
View File
@@ -1,103 +0,0 @@
#!/usr/bin/env python3
"""The summary of tests/hunt_handle_double_hover_e2e.py: reads every run-<mode>-<index>.json of a directory, writes runs.jsonl (one line per run)
and summary.txt, and prints the table: verdicts per mode, the retry turns against the verdict, and the sequence of every run that is not `single`.
python scripts/hunt_handle_double_hover_summary.py DIR
It judges nothing: the exit code is 0 whatever it finds (the pytest steps say whether the scenario itself errored).
"""
from __future__ import annotations
import collections
import json
import sys
from pathlib import Path
VERDICTS = ("single", "exit-reentry", "spurious", "other", "error")
def _brief(record: dict) -> str:
"""The page's events up to the first click on one line: `over(412,310 rel=body t=..) move... out(..) over(..) click(..)`."""
parts = []
for e in record.get("events", []):
name = e["type"].replace("mouse", "")
extra = ""
if e["type"] in ("mouseover", "mouseout", "mouseenter", "mouseleave"):
rel = e.get("rel") or {}
extra = "(%s,%s rel=%s t=%.1f)" % (e["x"], e["y"], rel.get("id") or rel.get("tag"), e["ts"])
elif e["type"] == "click":
extra = "(%s,%s t=%.1f)" % (e["x"], e["y"], e["ts"])
elif e["type"].startswith("doc-"):
extra = "(%s)" % e.get("target")
parts.append(name + extra)
if e["type"] == "click":
break
return " ".join(parts)
def main(argv=None) -> int:
root = Path((argv or sys.argv[1:] or ["."])[0])
records = []
for path in sorted(root.glob("run-*.json")):
try:
records.append(json.loads(path.read_text(encoding="utf-8")))
except (OSError, ValueError) as exc:
records.append({"mode": "?", "index": path.name, "verdict": "error", "error": "unreadable: %s" % exc})
with open(root / "runs.jsonl", "w", encoding="utf-8", newline="\n") as handle:
for record in records:
handle.write(json.dumps(record, separators=(",", ":")) + "\n")
lines = []
out = lines.append
modes = sorted({r.get("mode", "?") for r in records}) or ["-"]
out("== VERDICTS per mode (run = one fresh browser, one first button.click() of a handle)")
out("%-12s %6s " % ("mode", "runs") + " ".join("%12s" % v for v in VERDICTS) + " test-rule-red")
for mode in modes:
rows = [r for r in records if r.get("mode") == mode]
count = collections.Counter(r.get("verdict") for r in rows)
red = sum(1 for r in rows if r.get("ok") and not r.get("test_rule_passes"))
out("%-12s %6d " % (mode, len(rows)) + " ".join("%12d" % count.get(v, 0) for v in VERDICTS) + " %d" % red)
total = collections.Counter(r.get("verdict") for r in records)
out("HUNTTOTAL runs=%d %s" % (len(records), " ".join("%s=%d" % (v, total.get(v, 0)) for v in VERDICTS)))
live = sum(1 for r in records if r.get("hooks_live"))
out("the hooks on the core's retry loop saw the click in %d of %d runs" % (live, len(records)))
out("")
out("== RETRY TURNS (turns = center-point computations of the click's _retry) against the verdict")
by = collections.defaultdict(list)
for r in records:
if r.get("ok"):
by[r["verdict"]].append(r)
for verdict in VERDICTS:
rows = by.get(verdict, [])
if not rows:
continue
turns = collections.Counter(r.get("turns") for r in rows)
wrong = sum(1 for r in rows if r.get("wrong_hit_target"))
out("%-13s n=%-4d turns: %s runs with a WrongHitTarget: %d" % (
verdict, len(rows), ", ".join("%s turn(s) x%d" % (k, v) for k, v in sorted(turns.items(), key=lambda kv: str(kv[0]))), wrong))
out("")
out("== RUNS THAT ARE NOT single")
odd = [r for r in records if r.get("verdict") != "single"]
if not odd:
out("none")
for r in odd:
out("%s #%s [%s] verdict=%s word=%s turns=%s ordine=%s" % (r.get("mode"), r.get("index"), r.get("worker"), r.get("verdict"), r.get("word"),
r.get("turns"), r.get("ordine")))
if r.get("verdict") == "error":
out(" %s" % r.get("error"))
continue
out(" page: " + _brief(r))
out(" core sent: " + " ".join("%s(%.0f,%.0f)" % (m["type"].replace("mouse", ""), m["x"], m["y"]) for m in r.get("core_mouse", [])))
out(" rect changes: %s resize: %s layout-shifts: %s" % (r.get("rect_changes"), r.get("resize"), r.get("layout_shifts")))
for t in r.get("retries", []):
out(" retry: turns=%s runs=%s act=%s hit=%s exc=%s" % (t["center_point_calls"], t["run_calls"], t["act_on_target_calls"],
[v for _, v in t["hit_verdicts"]], [e[1] for e in t["exceptions"]]))
text = "\n".join(lines) + "\n"
(root / "summary.txt").write_text(text, encoding="utf-8")
sys.stdout.write(text)
return 0
if __name__ == "__main__":
sys.exit(main())
+43 -6
View File
@@ -10,7 +10,9 @@ seeds. This computes them from the prefs themselves, never from a list of the ta
is a seed dimension);
* every pref whose value differs between two seeds must belong to a DIMENSION below (a group of prefs read
together: the renderer, the screen panel, the audio chain...) or be named in EXCLUDED with its reason. A pref
that varies and is in neither is an error, so a new pref of a later core cannot go uncovered unnoticed;
that varies and is in neither is an error, so a new pref of a later core cannot go uncovered unnoticed. A pref that
is a function of a dimension (the bar of a maximized window is of the panel) is in DERIVED instead: it is checked to
take one value per value of its dimension, and it is no part of the stored features;
* a dimension's value for a seed is the joint value of its prefs; the reachable values of a dimension are the
ones some seed in range produces.
@@ -56,7 +58,7 @@ DIMENSIONS = {
"gfx_feature_status": (P + "gfx.feature_status",),
"screen_panel": (P + "screen.width", P + "screen.height", P + "screen.avail_device_width",
P + "screen.avail_device_height", "layout.css.devPixelsPerPx"),
"dpr": ("layout.css.devPixelsPerPx", P + "screen.frame_border", P + "screen.maximized_ui", P + "screen.popup_ui"),
"dpr": ("layout.css.devPixelsPerPx", P + "screen.frame_border", P + "screen.popup_ui", P + "screen.popup_client_top"),
"cores": (P + "hw_concurrency",),
"audio": (P + "audio.sample_rate", P + "audio.output_latency_ms", P + "audio.max_channel_count"),
"codecs": ("media.av1.enabled", "media.encoder.webm.enabled", "media.mp4.enabled", "media.webm.enabled",
@@ -73,6 +75,22 @@ EXCLUDED = {
P + "media.enumeration_ms": "the time of the first enumerateDevices(): a draw from its own stream, hundreds of values, "
"no class of seeds to cover",
}
#: Prefs that are a function of a dimension: {pref: the dimension}. They are not part of the dimension's value (so the
#: stored features do not depend on which core emits them) and compute() CHECKS that, across the seeds, each takes exactly
#: one value per value of its dimension, like the webgl prefs per renderer. A derived pref the core does not emit at all is
#: fine: it is the pref of a core that comes later than the one in use (or earlier than the one that added it), and the pair
#: of cores must give the same file. maximized_ui is of the panel because the core declares the bar from the work area's
#: height as well as from the scale (declared_maximized_ui: compact when the work area is short in CSS px).
#: The screen's size in device pixels is of the panel too: the core declares it as the whole panel (device_width and
#: device_height of ScreenProfile, invisible_core/_fpforge/profile.py:121 and :126; the prefs, invisible_core/prefs.py:1293-1294)
#: and the work area as the screen minus the taskbar (profile.py:131-145). So, from the panel's own prefs, the width is
#: avail_device_width and the height is avail_device_height plus the taskbar in device pixels. The test compares the prefs with
#: the core's own ScreenProfile for each seed: no copy of the taskbar or of the formula lives here.
DERIVED = {
P + "screen.maximized_ui": "screen_panel",
P + "screen.device_width": "screen_panel",
P + "screen.device_height": "screen_panel",
}
#: What the candidate run visits: the smallest set that reaches every one of these dimensions' values.
CANDIDATE_DIMENSIONS = ("webgl_renderer", "dpr")
WEBGL = P + "webgl."
@@ -106,6 +124,7 @@ def seed_features(seed: int) -> tuple:
features["gfx_device"] = profile.gpu.device or "<none>"
webgl = {k: json.dumps(v, sort_keys=True) for k, v in prefs.items() if k.startswith(WEBGL)}
features["_webgl"] = hashlib.sha256(json.dumps(webgl, sort_keys=True).encode()).hexdigest()[:12]
features["_derived"] = {k: json.dumps(prefs.get(k, "<absent>"), sort_keys=True) for k in DERIVED}
return features, {k: json.dumps(v, sort_keys=True) for k, v in prefs.items()}
@@ -125,11 +144,25 @@ def _range(bounds: tuple) -> tuple:
return features, seen
def check_derived(features: dict) -> None:
"""Raises when a DERIVED pref takes two values within one value of its dimension. features: {seed: {dimension: value,
"_derived": {pref: value}}}. A pref no seed has is skipped (a core that does not emit it)."""
for pref, dim in DERIVED.items():
seen = {}
for seed in sorted(features):
value = features[seed]["_derived"][pref]
if seen.setdefault(features[seed][dim], (value, seed))[0] != value:
first = seen[features[seed][dim]]
raise SystemExit("the derived pref %s is not a function of the dimension %s (seed %d: %s, seed %d: %s, "
"both with %s): it belongs to a wider dimension" % (
pref, dim, first[1], first[0], seed, value, features[seed][dim]))
def compute(max_seed: int = MAX_SEED, workers: int | None = None) -> dict:
"""The features of every seed 0..max_seed-1: {seed: {dimension: value}} (the dimensions of ALL_DIMENSIONS).
Raises when a pref varies across the seeds and is in no dimension and not in EXCLUDED, or when the webgl prefs are
not a function of the renderer."""
Raises when a pref varies across the seeds and is in no dimension and not in EXCLUDED or DERIVED, when a DERIVED
pref is not a function of its dimension, or when the webgl prefs are not a function of the renderer."""
workers = workers or max(1, min(os.cpu_count() or 1, 8))
step = max(1, -(-max_seed // (workers * 4)))
bounds = [(lo, min(lo + step, max_seed)) for lo in range(0, max_seed, step)]
@@ -145,10 +178,12 @@ def compute(max_seed: int = MAX_SEED, workers: int | None = None) -> dict:
seen.setdefault(k, set()).update(vs)
covered = {k for keys in DIMENSIONS.values() for k in keys}
varying = sorted(k for k, vs in seen.items() if len(vs) > 1)
loose = [k for k in varying if k not in covered and k not in EXCLUDED and not k.startswith(WEBGL)]
loose = [k for k in varying if k not in covered and k not in EXCLUDED and k not in DERIVED and not k.startswith(WEBGL)]
if loose:
raise SystemExit("prefs that vary across seeds and belong to no dimension and are not excluded: %s\n"
"add each to a DIMENSION or to EXCLUDED (with the reason) in scripts/persona_cover.py" % loose)
"add each to a DIMENSION, to DERIVED (a function of one) or to EXCLUDED (with the reason) in "
"scripts/persona_cover.py" % loose)
check_derived(features)
byrenderer = {}
for seed in sorted(features):
f = features[seed]
@@ -156,6 +191,8 @@ def compute(max_seed: int = MAX_SEED, workers: int | None = None) -> dict:
raise SystemExit("the webgl prefs are not a function of the renderer (seed %d, %s): split the dimension"
% (seed, f["webgl_renderer"]))
del f["_webgl"]
for f in features.values():
del f["_derived"]
stale = [k for k in EXCLUDED if k not in seen or len(seen[k]) < 2]
if stale:
raise SystemExit("excluded prefs that no longer vary: %s: remove them from EXCLUDED" % stale)
+25 -4
View File
@@ -10,6 +10,12 @@ red when our engine does not idle where stock does. Profile P4: a user journey o
(tests/fakeweb/journey_site.py); stock Firefox runs first, then our engine, and the verdict compares every step field by
field (ok, url, title, marker, cookies, history length, open pages, idle, the step's own values). --repetitions is the
number of walks (P4: default 1). The stock client drives both.
The bound of a P2 wait: a P2 page is finite (MAX_DELAY_MS, 3000 ms, is its longest response) and networkidle needs 500 ms of quiet,
so the 10 s default is a cap with margin, never to be read as a cause. A stock cell that does not idle is a broken control or, by
pages.json `stock_firefox_may_lose` (a request the page itself aborts, which stock may never report the end of), stock unsettled:
not red, and ours is then judged against the outcome the page declares. The report keeps `stock_unsettled`, `platform` and the
`stock_unsettled_rate` per pattern, so the rate per platform can be followed across runs from the artifacts.
"""
from __future__ import annotations
@@ -101,16 +107,31 @@ def main(argv=None):
if args.no_stock: # stock is what pages.json says it is
stock = [dict(c, idle=declared.get(c["pattern"], "idle") == "idle") for c in candidate]
fails, broken = profile_p2.verdict(candidate, stock, declared)
report = {"profile": args.profile, "patterns": patterns, "repetitions": args.repetitions,
"candidate": candidate, "stock": stock, "fails": fails, "broken_control": broken}
may_lose = pages.get("stock_firefox_may_lose", {})
fails, broken, unsettled = profile_p2.verdict(candidate, stock, declared, may_lose)
return finish_p2(args, patterns, candidate, stock, fails, broken, unsettled, may_lose)
def finish_p2(args, patterns, candidate, stock, fails, broken, unsettled, may_lose):
"""The report of a P2 run (written to --out), the lines printed, and the exit code: 1 on a fail or a broken control, never on unsettled alone."""
by_key = {(c["round"], c["pattern"], c["canary"], c["after"]): c for c in stock}
unsettled_cells = [{"round": key[0], "pattern": key[1], "in_flight": [r.get("url") for r in by_key[key].get("in_flight") or []]}
for key, _err in unsettled]
rate = {pattern: {"unsettled": sum(1 for u in unsettled_cells if u["pattern"] == pattern),
"rounds": sum(1 for c in stock if c["pattern"] == pattern and not c["canary"])}
for pattern in may_lose}
report = {"profile": args.profile, "patterns": patterns, "repetitions": args.repetitions, "platform": sys.platform,
"candidate": candidate, "stock": stock, "fails": fails, "broken_control": broken,
"stock_unsettled": unsettled_cells, "stock_unsettled_rate": rate}
if args.out:
pathlib.Path(args.out).write_text(json.dumps(report, indent=1), encoding="utf-8")
for key, err in fails:
print("FAIL round %d %s%s: %s" % (key[0], key[1], " (canary after %s)" % key[3] if key[2] else "", err))
for key, err in broken:
print("BROKEN CONTROL stock did not idle on %s round %d: %s" % (key[1], key[0], err))
print("cells: %d, fails: %d, broken controls: %d" % (len(candidate), len(fails), len(broken)))
for cell in unsettled_cells:
print("STOCK UNSETTLED %s round %d: %s (pages.json stock_firefox_may_lose)" % (cell["pattern"], cell["round"], ", ".join(map(str, cell["in_flight"]))))
print("cells: %d, fails: %d, broken controls: %d, stock unsettled: %d" % (len(candidate), len(fails), len(broken), len(unsettled_cells)))
return 1 if (fails or broken) else 0
@@ -109,6 +109,57 @@ class ExpectNotMet(ProtocolException):
self.log = list(log or [])
class Deferred:
"""An answer that comes LATER: what a command returns when it has to wait for something long and must not hold the worker that
took it.
⛔ THE TRANSPORT'S WORKERS ARE FEW (`InProcessTransport.WORKERS` is 4, the remote server's 8) and shared by every command of a
client. A command that waits (a proxied `newContext` waits for the final UDP verdict of its proxy: ~11 s for a first endpoint)
held one for the whole wait, and four of them left no worker for a `page.evaluate`. A command that answers LATER hands its work to a
thread of its own (started by the server's one starter, like the engine reader's adoptions) and returns this object at once; the
worker is free, and the transport posts the reply when the work ends, the way a worker posts it (`begin`). Nothing else changes:
the object that answers is still the one the client addressed, and the reply is still the one with the client's id.
The work runs in the context the call had (`contextvars`: the call's log, the remote server's client), and the thread ends with
the work. It is counted by the server, and `Server.shutdown` waits for it (bounded) after the engine's connection is closed, so
a session that ends leaves none behind."""
def __init__(self, server: "Server", work: Callable[[], Any]) -> None:
self._server = server
self._work = work
self._context = contextvars.copy_context()
#: Set when the work has ended and its answer has been handed over (or when it could never begin).
self.finished = threading.Event()
def begin(self, done: Callable[[Any, Optional[BaseException]], None]) -> None:
"""Run the work on its own thread and hand `done(result, failure)` its end. Called by the worker that took the command: it
returns at once (the thread is only queued to the starter)."""
server = self._server
def run() -> None:
try:
try:
result = self._context.run(self._work)
except Exception as failure: # noqa: BLE001 - the client is told, as for a command answered at once
done(None, failure)
else:
done(result, None)
finally:
server._deferred_ended(self)
def could_not_begin(why: str) -> None:
try:
done(None, ProtocolException("the answer could not be started: %s" % why))
finally:
server._deferred_ended(self)
if not server._deferred_begun(self):
self.finished.set() # the session is ending: there is nobody to answer
return
server.thread_starter.start_built(
threading.Thread(target=run, name="invpw-answer-later", daemon=True), could_not_begin)
class CallLog:
"""What one call did, line by line: the log Playwright's server keeps per
call (its progress, `metadata.log`) and sends with a failure, where the
@@ -229,6 +280,8 @@ class Dispatcher:
# ── routing ─────────────────────────────────────────────────────────────
def call(self, method: str, params: Dict) -> Any:
name = self.METHODS.get(method)
if name is not None and self.answers_later(method, params):
return self.server.later(lambda: getattr(self, name)(params))
if name is None:
# ⛔ NAME THE FEATURE, not just the missing method. "Page has no
# method X" reads like a bug in this package; "X is part of HAR,
@@ -245,6 +298,12 @@ class Dispatcher:
return getattr(self, name)(params)
def answers_later(self, method: str, params: Dict) -> bool:
"""Whether this call waits for something long and must be answered from a thread of its own (`Deferred`), not by the worker
that took it. Nothing does, unless an object says so."""
return False
class Server:
"""The guid registry, and the entry point the transport calls."""
@@ -281,6 +340,8 @@ class Server:
self._starter: Optional[ThreadStarter] = None
self._starter_lock = threading.Lock()
self._is_shut_down = False
#: The answers that are being worked out on a thread of their own (`later`), until each ends.
self._deferred: set = set()
#: Why a thread the starter was handed could not be started (the last few).
self.start_errors: list = []
@@ -302,6 +363,35 @@ class Server:
if len(self.start_errors) < 32:
self.start_errors.append(why)
#: How long `shutdown` waits for the answers still being worked out (`later`) once the engine's connection is closed: the longest wait of
#: a command (a proxy's UDP verdict ends at nICEr's schedule, ~11 s after the TCP exit is known) with a margin. Their threads are daemons:
#: past this the process is not held.
DEFERRED_WAIT_S = 15.0
def later(self, work: Callable[[], Any]) -> Deferred:
"""The answer of a command whose `work` takes long: a call returns this instead of its result and the transport posts the reply
when `work` ends (see `Deferred`). Called from the worker that took the command."""
return Deferred(self, work)
def _deferred_begun(self, deferred: Deferred) -> bool:
with self._starter_lock:
if self._is_shut_down:
return False
self._deferred.add(deferred)
return True
def _deferred_ended(self, deferred: Deferred) -> None:
with self._starter_lock:
self._deferred.discard(deferred)
deferred.finished.set()
def _wait_for_deferred(self) -> None:
deadline = time.monotonic() + self.DEFERRED_WAIT_S
with self._starter_lock:
pending = list(self._deferred)
for deferred in pending:
deferred.finished.wait(max(0.0, deadline - time.monotonic()))
def attach(self, transport: Any) -> None:
self._transport = transport
@@ -477,6 +567,9 @@ class Server:
except Exception:
pass
self._after_shutdown.clear()
# The engine's connection is closed (the hooks above): an answer still being worked out fails at its next command, and the wait
# of its own (a measurement) is the only thing left to wait for.
self._wait_for_deferred()
with self._starter_lock:
self._is_shut_down = True
starter = self._starter
@@ -215,3 +215,45 @@ def refusal(operation):
"invisible_playwright does not implement: the package covers the "
"automation core, and " + feature + " is outside it by decision, "
"not by omission. See 32-stacco-da-playwright.md section 5.4.")
#: ⛔ A PARAMETER OF A SERVED OPERATION THAT IS REFUSED, keyed by (operation, parameter), and the sentence a caller reads.
#: The operations above are refused whole; these are refused one parameter (or one value of it) at a time, and the call
#: without them is served. They are raised in `server.py` by `_refuse_parameter(operation, parameter)`, the one function
#: that reads this table, and `tests/test_every_refusal_is_declared.py` holds the two sides to each other.
#:
#: ⛔ WHY THESE FIVE. Stock Playwright honours `mask`, `style` and `animations="disabled"` by MODIFYING THE PAGE (an overlay,
#: an injected `<style>`, animations finished or cancelled) before the picture and putting it back after. This package does
#: not touch a page to photograph it, and until now it did not read them either: the call succeeded and the picture was as
#: if they had not been written, which a caller cannot see. `caret="initial"` asks for the text caret to be drawn, and the
#: engine never draws it (the capture does not set the flag that draws it), so the picture it takes is the one `"hide"`
#: asks for, which is also Playwright's default: `"hide"` and an absent `caret` are served. `omitBackground` with png is
#: Firefox's own `Not implemented` in stock (`FFPage.setBackgroundColor`), word for word; with jpeg stock does nothing and
#: neither do we.
REFUSED_PARAMETERS = {
("screenshot", "mask"):
"screenshot(mask=...) is not served: Playwright covers the masked elements by modifying the page (an overlay is "
"put on it before the picture), and this package does not touch a page to take a picture. maskColor goes with "
"mask and is refused with it. Hide the elements yourself before the screenshot (for example set their "
"visibility to hidden in your own script) and restore them after.",
("screenshot", "style"):
"screenshot(style=...) is not served: Playwright applies it by modifying the page (a <style> element is "
"injected before the picture and removed after), and this package does not touch a page to take a picture. Add "
"the style yourself with page.add_style_tag() before the screenshot and remove the element it returns after.",
("screenshot", "animations"):
'screenshot(animations="disabled") is not served: Playwright does it by modifying the page (the finite '
"animations are finished and the infinite ones cancelled), and this package does not touch a page to take a "
"picture. Wait for the animations to end, or pause them in your own script (document.getAnimations()), before "
'the screenshot. animations="allow" is what is served.',
("screenshot", "caret"):
'screenshot(caret="initial") is not served: it asks for the text caret to be drawn in the picture, and the '
'engine never draws it (the picture is the one caret="hide" asks for, which is the default of Playwright). Leave '
'caret out or pass "hide".',
("screenshot", "omitBackground"):
"Not implemented",
}
def parameter_refusal(operation, parameter):
"""The sentence for a refused (operation, parameter): `KeyError` for one that is not declared."""
return REFUSED_PARAMETERS[(operation, parameter)]
+31 -11
View File
@@ -22,9 +22,12 @@ used to answer, carried over unchanged):
* NOT `Mouse.move`: an explicit move is the caller's. (The in-process client
marks its own with `humanise`, see `_cursor._wrap_mouse_move`; a client that
does not say so is answered with exactly the point it named.)
* NOT the actions of an ElementHandle (they name a node, never a selector, and
the in-process client never walked onto them either) and NOT `dragAndDrop`,
whose travel the core's `Actions` already draws.
* `ElementHandle.click / dblclick / hover / tap / check / uncheck` (and so
`set_checked`): the same walk, onto the node the handle already names
(`act(..., element=)`: the node is not looked up again and is not disposed).
One click path is one fingerprint, so a handle click and a selector click
arrive as the same kind of stroke;
* NOT `dragAndDrop`, whose travel the core's `Actions` already draws.
HOW IT STAYS THE SAME AS THE CLIENT WAS. The stroke generator, the planners
(`_behaviour`) and the discipline events are delivered under (`Pacer`) are the
@@ -391,9 +394,14 @@ class Pointer:
# -- the probes --------------------------------------------------------
def _element_box(self, frame_id: str, selector: str) -> Tuple[Optional[str], Optional[dict]]:
def _element_box(self, frame_id: str, selector: str,
element: Optional[str] = None) -> Tuple[Optional[str], Optional[dict]]:
"""Resolve the element and its box, or (None, None). Never raises.
``element`` is a node the caller already holds (an ElementHandle's): it is
measured as it is, never looked up again from ``selector``, and it is not
ours to dispose.
Deliberately non-blocking and deliberately forgiving: this is a hint
used to aim a mouse path, never a correctness step. It resolves the
element if it is already there and gives up otherwise, so it can
@@ -401,6 +409,12 @@ class Pointer:
failing one - the action itself still does its own waiting and raises
its own errors.
"""
if element is not None:
try:
box = self.injected.bounding_box(frame_id, element)
except _PROBE_ERRORS:
return None, None # the handle's node is gone: the action meets that itself
return (element, box) if box else (None, None)
try:
handle = self.injected.query_selector(frame_id, selector)
except _PROBE_ERRORS:
@@ -442,10 +456,11 @@ class Pointer:
return False
def _choose_landing(self, frame_id: str, selector: str,
position: Optional[dict]) -> Optional[_Aim]:
position: Optional[dict],
element: Optional[str] = None) -> Optional[_Aim]:
"""Pick the point on the element this action will land on."""
hand = self.hand
handle, box = self._element_box(frame_id, selector)
handle, box = self._element_box(frame_id, selector, element)
if handle is None or box is None:
return None
try:
@@ -476,7 +491,8 @@ class Pointer:
return _Aim(box, (box["x"] + box["width"] / 2.0,
box["y"] + box["height"] / 2.0), None)
finally:
self._dispose(frame_id, handle)
if element is None: # a node the caller holds stays the caller's
self._dispose(frame_id, handle)
# -- travelling --------------------------------------------------------
@@ -582,7 +598,8 @@ class Pointer:
# -- the entry points --------------------------------------------------
def approach(self, frame_id: str, selector: str, position: Optional[dict],
trial: bool = False) -> Optional[Dict[str, float]]:
trial: bool = False,
element: Optional[str] = None) -> Optional[Dict[str, float]]:
"""Walk the pointer onto the element this action is about to touch.
Returns the `position` the action should run with, or None.
@@ -598,7 +615,7 @@ class Pointer:
hand.busy = True
hand.action += 1
try:
aim = self._choose_landing(frame_id, selector, position)
aim = self._choose_landing(frame_id, selector, position, element)
if aim is None:
return None
w, h = self._viewport()
@@ -614,9 +631,12 @@ class Pointer:
def act(self, frame_id: str, selector: str, position: Optional[dict],
timeout: Optional[float], run: Callable[[Optional[dict], Optional[float]], Any],
*, trial: bool = False) -> Any:
*, trial: bool = False, element: Optional[str] = None) -> Any:
"""Run a pointer action on an element the way a hand would.
``element`` is the object id of a node the caller already holds (an
ElementHandle): the walk aims at THAT node and `selector` is not looked up.
`run(position, timeout)` performs the plain action with those two
arguments. The approach comes first; if it chose a landing point the
action is told to click it, within a bounded slice of the caller's
@@ -626,7 +646,7 @@ class Pointer:
"""
override = None
try:
override = self.approach(frame_id, selector, position, trial)
override = self.approach(frame_id, selector, position, trial, element)
except _PROBE_ERRORS as exc: # motion never fails an action for what the engine or the page answers; a bug of ours is not that
_cursor._warn_once(
"approach-failed",
+29 -9
View File
@@ -70,9 +70,9 @@ from typing import Any, Callable, Dict, List, Optional
from urllib.parse import parse_qs, urlsplit
from . import memprobe, wire
from .dispatcher import ProtocolException
from .dispatcher import Deferred, ProtocolException
from .server import (BrowserDispatcher, BrowserTypeDispatcher, JugglerServer,
LocalUtilsDispatcher, RefusingDispatcher)
LocalUtilsDispatcher, RefusingDispatcher, context_defaults_for)
from .transport import _error_payload
#: The client whose call a worker thread is answering.
@@ -450,7 +450,16 @@ class RemoteEndpoint:
except Exception as failure: # noqa: BLE001
self._reply_error(client, msg_id, failure)
else:
self._reply(client, msg_id, result)
if isinstance(result, Deferred):
# The answer comes later (see `Deferred`): this worker is free at once, the thread that works it out posts the reply.
def done(value: Any, failure: Optional[BaseException]) -> None:
if failure is not None:
self._reply_error(client, msg_id, failure)
else:
self._reply(client, msg_id, value)
result.begin(done)
else:
self._reply(client, msg_id, result)
def _dispatch(self, client: RemoteClient, message: Dict) -> Any:
guid = message.get("guid")
@@ -475,9 +484,7 @@ class RemoteEndpoint:
if method == "newPage" and "pageNumber" not in params:
params["pageNumber"] = next(self._pages)
if message.get("guid") == self.browser.guid:
for key, value in self.context_defaults.items():
if key in ("viewport", "screen") and params.get("noDefaultViewport"):
continue
for key, value in context_defaults_for(self.context_defaults, params.get("noDefaultViewport")).items():
if self.context_options_override or key not in params:
params[key] = value
return dict(message, params=params)
@@ -733,8 +740,16 @@ def _launch_params(session: Any, *, virtual_display: bool, headless: bool,
session._geolocation = geo.geolocation_override()
session._udp_exit = geo.udp_exit
executable = resolve_executable(session._binary_path)
pw_headless = bool(headless)
if not headless and virtual_display:
# The engine is never told `-headless`: the browser always has a real window. `headless=True` puts that window on the hidden
# display, by the one decision every entry point shares (`_resolve_headless`); `headless=False` keeps the window where the caller
# is, or on a private display when `virtual_display` asks for one.
pw_headless = False
if headless:
session._resolve_headless()
if session._virtual_display is None:
notes.append("headless: no hidden display to make on this platform "
"(the browser runs on the caller's desktop)")
elif virtual_display:
if sys.platform == "win32":
notes.append("virtual_display ignored: Windows has no virtual "
"display in this server (the browser runs on the "
@@ -799,7 +814,8 @@ def launch_server(host: str = DEFAULT_HOST, port: int = 0, *,
launch; the egress (exit IP -> timezone, locale
"auto"; the GeoIP database offline from
STEALTHFOX_GEOIP_MMDB) is measured here through it.
headless True = true headless; False = headed.
headless True = a real window on a hidden display (the browser is never
started with -headless); False = the window is shown.
virtual_display with headless=False: a private virtual display (Xvfb
with its own launch env). Windows: ignored, with the
reason in `server.notes`.
@@ -821,8 +837,12 @@ def launch_server(host: str = DEFAULT_HOST, port: int = 0, *,
and the launch FAILS if the version it reports is not the seal's.
"""
from invisible_playwright import InvisiblePlaywright
from invisible_playwright import _session
from invisible_playwright._engine import assert_wire_version
# A retired variable is refused before anything starts (the network, a display, a process).
_session.refuse_retired_true_headless()
if humanize and motion_budget_s:
humanize = float(motion_budget_s)
session = InvisiblePlaywright(
+208 -35
View File
@@ -47,7 +47,7 @@ from invisible_core.juggler import PageActs, popup_number
from invisible_core.juggler import connection as juggler
from invisible_core.juggler.actions import Actions
from invisible_core.juggler.deadline import Deadline
from . import _bindings, dialogs
from . import _bindings, dialogs, perimeter
from ._reaped import SessionRemoval
from ._threads import ThreadStarterLease
from .pointer import Pointer
@@ -77,7 +77,7 @@ from ._marshal import (_js_number, _as_script, _button, _caller_timeout,
# the same duplication that produced the defect, one layer down.
from invisible_core import SessionLocale, parse_proxy
from invisible_core._proxy import UDP_EXIT_VALUES
from invisible_core._udp_exit import context_proxy_command, launch_proxy_command, stun_servers
from invisible_core._udp_exit import UdpExitCache, context_proxy_command, launch_proxy_command, stun_servers
from invisible_core import write_user_js
from invisible_core.juggler import (SessionFiles, domain_matches, host_of,
@@ -676,6 +676,37 @@ def _run_callers_code(injected: InjectedScript, frame_id: str, params: Dict,
argument.release()
def _refuse_parameter(operation: str, parameter: str):
"""Refuse one parameter of a served operation with the sentence `perimeter.REFUSED_PARAMETERS` holds for it.
⛔ THE ONLY WAY A PARAMETER IS REFUSED, so that the inventory and the code cannot drift: the test of the refusals reads
every call of this function in the file and holds it to that table, both ways."""
raise ProtocolException(perimeter.parameter_refusal(operation, parameter))
def _refuse_unserved_screenshot_parameters(params: Dict) -> None:
"""⛔ WHAT STOCK DOES BY MODIFYING THE PAGE IS REFUSED, NOT IGNORED, AND BEFORE THE PAGE IS TOUCHED. `mask`, `style` and
`animations="disabled"` change the page before the picture in Playwright; this server took them without reading them, and the
picture came back as if they had not been written. `caret="initial"` asks for the text caret to be drawn, which the engine never
does. `omitBackground` with png is Firefox's own `Not implemented` (stock reaches it only for png). The sentences are
`perimeter.REFUSED_PARAMETERS`'.
⛔ THE ONE CHECK, CALLED FIRST BY THE PAGE'S SCREENSHOT AND BY THE ELEMENT'S (a locator's is the element's): the element's call
scrolls the element into view and measures it, and a call that is going to be refused must not have done either. It reads
`params` and nothing else, so calling it again with the same parameters, as the element's call does through the page's, answers
the same."""
if params.get("mask"):
_refuse_parameter("screenshot", "mask")
if params.get("style"):
_refuse_parameter("screenshot", "style")
if params.get("animations") == "disabled":
_refuse_parameter("screenshot", "animations")
if params.get("caret") == "initial":
_refuse_parameter("screenshot", "caret")
if params.get("omitBackground") and params.get("type") != "jpeg":
_refuse_parameter("screenshot", "omitBackground")
def _round_px(value: float) -> int:
"""To the nearest whole pixel, halves up (Python's `round` goes to even: 0.5 -> 0, 1.5 -> 2)."""
import math
@@ -1071,6 +1102,8 @@ class ElementHandleDispatcher(Dispatcher):
Playwright's screenshotter does: the left and top edges to the nearest
pixel, the size from the rounded right and bottom edges.
"""
# ⛔ THE REFUSAL COMES BEFORE THE SCROLL AND THE MEASURE: a call that is refused must not have moved the page.
_refuse_unserved_screenshot_parameters(params)
# An element with no layout object (display: none, detached) cannot be scrolled to: the engine says so
# with an exception of its own. For the caller that is the same answer as an empty box.
try:
@@ -1123,17 +1156,24 @@ class ElementHandleDispatcher(Dispatcher):
# `page.query_selector(...).click()` is ordinary code - and the rest keep
# reporting themselves as missing rather than being filled in for symmetry.
#
# ⛔ THEY GO THROUGH THE SAME `actions` AS THE SELECTOR VERSIONS, and that is
# the whole design. `click` here is the humanised pointer: approach, hover,
# press, release, with the hit-target check and the actionability retry. A
# second, simpler path would be quicker to write and would give this package
# two click behaviours with two fingerprints, which is the one thing it
# exists not to have.
# ⛔ THEY GO THROUGH THE SAME `actions` AND THE SAME HAND AS THE SELECTOR
# VERSIONS, and that is the whole design. The pointer actions (click,
# dblclick, hover, tap, check, uncheck) are drawn by `FrameDispatcher._by_hand`
# (`Pointer.act`): a path onto the element, a landing point of the session's
# own, and then the core's action with the hit-target check and the
# actionability retry. They used to call `actions` directly, and the core's
# approach with no client cursor is ONE `mousemove` onto the exact centre of the
# element's box and a press there: a handle click was a jump to the centre where
# the selector's was a walk, two click behaviours with two fingerprints, which
# is the one thing this package exists not to have.
#
# What differs from a selector click is exactly what SHOULD differ: the node
# is not looked up again, because a handle names one node and re-querying
# would find a different element with the same description; and the node is
# not disposed afterwards, because the caller still holds it.
# would find a different element with the same description (the hand aims at
# the handle's own object, `element=`); and the node is not disposed
# afterwards, because the caller still holds it. The keyboard and text
# actions (fill, type, press, focus, selectText, setInputFiles) have no hand to
# draw: their rhythm lives in the core's action, which both doors call.
#
# The parameter helpers are the frame's. `self.frame._timeout` rather than a
# copy: the rules for reading a timeout, a position and the pointer flags out
@@ -1151,29 +1191,37 @@ class ElementHandleDispatcher(Dispatcher):
"element_id": self.object_id,
**self.frame._act_opts(params)}
def _by_hand(self, params: Dict, run: Callable[[Any, Any], Any]) -> Any:
"""A pointer action of THIS node with the session's hand in front of it: the Frame's own (`FrameDispatcher._by_hand`, the one
walk), aimed at the handle's object and not at a selector. `run(position, timeout)` is the plain action; it takes the position
and the timeout the hand chose, and everything else from `_act_args`."""
return self.frame._by_hand(params, self.frame.frame_id, _HANDLE, run, element=self.object_id)
def op_click(self, params: Dict) -> Any:
self.frame._waiting_after(params, lambda: self.frame.actions.click(
_HANDLE, position=self.frame._position(params),
**self.frame._pointer(params), **self._act_args(params)))
pointer = self.frame._pointer(params)
self.frame._waiting_after(params, lambda: self._by_hand(
params, lambda position, timeout: self.frame.actions.click(
_HANDLE, **{**self._act_args(params), "timeout": timeout},
position=position, **pointer)))
return None
def op_hover(self, params: Dict) -> Any:
self.frame.actions.hover(_HANDLE, position=self.frame._position(params),
**self._act_args(params))
self._by_hand(params, lambda position, timeout: self.frame.actions.hover(
_HANDLE, **{**self._act_args(params), "timeout": timeout}, position=position))
return None
def op_dblclick(self, params: Dict) -> Any:
pointer = self.frame._pointer(params)
# dblclick sets its own clickCount; the caller's is not a second one.
pointer.pop("clicks", None)
self.frame.actions.dblclick(
_HANDLE, position=self.frame._position(params), **pointer,
**self._act_args(params))
self._by_hand(params, lambda position, timeout: self.frame.actions.dblclick(
_HANDLE, **{**self._act_args(params), "timeout": timeout},
position=position, **pointer))
return None
def op_tap(self, params: Dict) -> Any:
self.frame.actions.tap(_HANDLE, position=self.frame._position(params),
**self._act_args(params))
self._by_hand(params, lambda position, timeout: self.frame.actions.tap(
_HANDLE, **{**self._act_args(params), "timeout": timeout}, position=position))
return None
def op_select_text(self, params: Dict) -> Any:
@@ -1187,13 +1235,13 @@ class ElementHandleDispatcher(Dispatcher):
return None
def op_check(self, params: Dict) -> Any:
self.frame.actions.check(_HANDLE, position=self.frame._position(params),
**self._act_args(params))
self._by_hand(params, lambda position, timeout: self.frame.actions.check(
_HANDLE, **{**self._act_args(params), "timeout": timeout}, position=position))
return None
def op_uncheck(self, params: Dict) -> Any:
self.frame.actions.uncheck(_HANDLE, position=self.frame._position(params),
**self._act_args(params))
self._by_hand(params, lambda position, timeout: self.frame.actions.uncheck(
_HANDLE, **{**self._act_args(params), "timeout": timeout}, position=position))
return None
def op_fill(self, params: Dict) -> Any:
@@ -1807,7 +1855,7 @@ class FrameDispatcher(Dispatcher):
return result
def _by_hand(self, params: Dict, frame_id: str, selector: str,
run: Callable[[Any, Any], Any]) -> Any:
run: Callable[[Any, Any], Any], *, element: Optional[str] = None) -> Any:
"""Run a pointer action with the hand of the session in front of it.
⛔ THE WALK ONTO THE ELEMENT IS DRAWN HERE, once, for every client: it
@@ -1816,13 +1864,17 @@ class FrameDispatcher(Dispatcher):
`run(position, timeout)` is the plain action; with no hand (humanising
off, the engine's own expansion) it is all that happens, with the
caller's own arguments.
⛔ ONE WALK FOR EVERY DOOR. An ElementHandle's pointer actions come through
here too, with `element` the object id of the node they name: the hand then
aims at THAT node (`selector` is not looked up) and leaves it undisposed.
"""
hand = self.page.pointer
if hand is None or not hand.active:
return run(self._position(params), self._timeout(params))
return hand.act(frame_id, selector, self._position(params),
self._timeout(params), run,
trial=self._act_opts(params)["trial"])
trial=self._act_opts(params)["trial"], element=element)
def op_click(self, params: Dict) -> Any:
frame_id, selector = self.enter_frames(params["selector"])
@@ -3102,6 +3154,55 @@ def _with_trace(failure: BaseException, trace: str) -> BaseException:
return RuntimeError("%s [%s]" % (failure, trace))
#: The key of a context's `viewport` that says the size is only the one the core declares for the main window (`context_geometry`), not one
#: the user chose. The session puts it on its default context options (`_default_context_kwargs`); a viewport the user passes has no such
#: key, so it replaces the declared one whole. It travels to the engine as `isDeclaredDefault` of `Browser.setDefaultViewport`, where a popup
#: that names no size is then left to its own window; it never reaches the client (`_viewport_as_told`).
DECLARED_VIEWPORT_KEY = "isDeclaredDefault"
def declared_viewport(viewport: Dict[str, Any]) -> Dict[str, Any]:
"""`viewport` (the core's `{"width", "height"}`) marked as the declared default of the session."""
return dict(viewport, **{DECLARED_VIEWPORT_KEY: True})
def _viewport_is_declared(viewport: Optional[Dict[str, Any]]) -> bool:
return bool(viewport and viewport.get(DECLARED_VIEWPORT_KEY))
#: The keys of a context's declared geometry that a context with NO viewport emulation does not get: in Playwright `no_viewport=True` means no pin, so the
#: window keeps its own size (the engine gives the real window the declared frame and maximizes it). The ONE list of the three paths that merge the
#: declared defaults into a context: the in-process launchers (`merged_context_kwargs`), the served browser (`remote.py`) and the engine commands
#: (`_apply_context_options`).
NO_VIEWPORT_DROPS = ("viewport", "screen")
def context_defaults_for(defaults: Dict[str, Any], no_viewport: Any) -> Dict[str, Any]:
"""The session's declared context defaults for a context that asks for `no_viewport` (Playwright's `noViewport` / `noDefaultViewport`) or not."""
if not no_viewport:
return dict(defaults)
return {key: value for key, value in defaults.items() if key not in NO_VIEWPORT_DROPS}
def merged_context_kwargs(defaults: Dict[str, Any], user: Dict[str, Any]) -> Dict[str, Any]:
"""The keywords a `new_context` / `new_page` is made with: the declared defaults (none of the pinned geometry under `no_viewport=True`), then the user's."""
merged = context_defaults_for(defaults, user.get("no_viewport"))
merged.update(user)
return merged
def _context_has_no_viewport(options: Dict[str, Any]) -> bool:
"""Whether the context was made with `no_viewport=True` (the client says it as `noDefaultViewport`): its pages are not pinned."""
return bool(options.get("noDefaultViewport"))
def _viewport_as_told(viewport: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
"""The size the client is told: the width and the height, never the mark."""
if not viewport:
return None
return {"width": viewport["width"], "height": viewport["height"]}
def _target_is_gone(error: BaseException) -> bool:
"""Whether a failed command failed because the target or its session no longer exists (the engine closed the tab under it)."""
if isinstance(error, juggler.TargetClosedError):
@@ -3370,16 +3471,22 @@ class PageDispatcher(Dispatcher):
self.actions = context.browser.actions_for_page(
session, self.lifecycle, self.injected, self.number)
#: The viewport as the client was told it (the initializer's, then
#: `setViewportSize`): the hand plans inside it.
self.viewport_size = context.options.get("viewport") or {
#: `setViewportSize`): the hand plans inside it, unless the page is not pinned (`planning_viewport`).
self.viewport_size = _viewport_as_told(context.options.get("viewport")) or {
"width": 1280, "height": 720}
#: ⛔ A POPUP THE ENGINE DID NOT PIN has no viewport of its own: its size is its window's, which can still change after its first
#: script, so the client is told none (`viewport_size` None, Playwright's meaning of a page whose viewport is not emulated) and
#: the wrapper reads the size when it needs it (`planning_viewport`). True from birth for a popup under the declared default;
#: `setViewportSize` pins the page and ends it.
self.viewport_unpinned = self._is_unpinned(context, opener)
self._last_window_size: Optional[Dict[str, int]] = None
#: ⛔ THE HAND, built where the page's number and the session's seed
#: meet: one stream per page, the seed the client's cursor drew from
#: (`_cursor.page_motion_seed`). See `pointer.py`.
self.pointer = Pointer(
self.actions, self.injected, self.number,
context.browser.session_seed, context.browser.motion_budget_s,
lambda: self.viewport_size,
self.planning_viewport,
draws=context.browser.pointer_draws)
self._frames: Dict[str, Any] = {}
#: The child frames the client was told of (`frameAttached`), to tell it of the ones born before the hook was in.
@@ -3429,14 +3536,15 @@ class PageDispatcher(Dispatcher):
name=getattr(known, "name", "") or "",
load_states=sorted(getattr(known, "states", []) or []) or None,
told_commit=self._last_commit(known))
viewport = self.viewport_size
viewport = self.told_viewport()
# `pageNumber` is ours, not Playwright's: the number the page's
# rhythms are drawn under (`pointer.py` and the actions' nonce read it
# from `self.number`), told to the client so that it can name the page
# the way the server does.
initializer = {"mainFrame": self.frame.channel,
"viewportSize": viewport, "isClosed": False,
initializer = {"mainFrame": self.frame.channel, "isClosed": False,
"pageNumber": self.number}
if viewport is not None:
initializer["viewportSize"] = viewport
if opener is not None:
# ⛔ THE OPENER TRAVELS IN THE INITIALIZER, and nowhere else. The
# client resolves `page.opener()` from it and emits `popup` on the
@@ -4385,11 +4493,46 @@ class PageDispatcher(Dispatcher):
return None
# ── viewport, media, capture ────────────────────────────────────────────
@staticmethod
def _is_unpinned(context: "BrowserContextDispatcher", opener: Optional["PageDispatcher"]) -> bool:
"""Whether the engine did not pin this page: any page of a context made with `no_viewport=True`, or a popup whose context viewport is only the
declared default."""
return _context_has_no_viewport(context.options) or (opener is not None and _viewport_is_declared(context.options.get("viewport")))
def told_viewport(self) -> Optional[Dict[str, int]]:
"""The viewport the client is told (`page.viewport_size`): none for a popup the engine did not pin."""
return None if self.viewport_unpinned else self.viewport_size
def planning_viewport(self) -> Dict[str, int]:
"""The size the hand plans inside and the bounds checks use, at the time of use: the window's own for a popup the engine did not
pin (the last one read when the window cannot be read now), else the viewport the client was told."""
if not self.viewport_unpinned:
return self.viewport_size
size = self._window_size()
if size is not None:
self._last_window_size = size
return self._last_window_size or self.viewport_size
def _window_size(self) -> Optional[Dict[str, int]]:
"""The content size of this page's window, as the page reads it (`innerWidth`, `innerHeight`), or None when it cannot be read."""
try:
box = self.injected.evaluate(
self.main_frame_id,
"({width: window.innerWidth, height: window.innerHeight})")
except Exception:
return None
if (isinstance(box, dict) and isinstance(box.get("width"), (int, float))
and isinstance(box.get("height"), (int, float))
and box["width"] > 0 and box["height"] > 0):
return {"width": int(box["width"]), "height": int(box["height"])}
return None
def op_set_viewport_size(self, params: Dict) -> Any:
self.send("Page.setViewportSize", only_set(
{"viewportSize": params.get("viewportSize")}))
if params.get("viewportSize"):
self.viewport_size = params["viewportSize"]
self.viewport_unpinned = False # a size the client set pins the page
return None
def op_emulate_media(self, params: Dict) -> Any:
@@ -4458,6 +4601,10 @@ class PageDispatcher(Dispatcher):
# A clip the CALLER supplied is passed through untouched. Playwright
# documents it in page coordinates, which is what the engine wants, so
# there is nothing to translate.
# ⛔ THE REFUSALS ARE `_refuse_unserved_screenshot_parameters`, THE FIRST THING HERE AND THE FIRST THING IN THE ELEMENT'S SCREENSHOT.
# It is idempotent, so the element's call, which hands its rectangle and the caller's parameters to this one, passes it twice
# and the second pass is the same answer.
_refuse_unserved_screenshot_parameters(params)
clip = params.get("clip")
if not clip:
box = self.injected.evaluate(
@@ -5557,6 +5704,18 @@ class BrowserDispatcher(Dispatcher):
METHODS = {"newContext": "op_new_context", "close": "op_close",
"newPage": "op_new_page"}
def answers_later(self, method: str, params: Dict) -> bool:
"""A context given a SOCKS5 proxy waits for the final UDP verdict of that endpoint (the core measures it before the proxy is
declared: ~11 s for a first endpoint), so `newContext` and `newPage` with one are answered from a thread of their own (`Deferred`),
never by the transport worker that took them. The context's guid reaches the client in the reply, so nothing can name it before
its proxy is applied."""
if method not in ("newContext", "newPage"):
return False
try:
return UdpExitCache.key(params.get("proxy")) is not None
except ValueError:
return False # a proxy that cannot be read is refused at once, by the command itself
#: How long the engine's reader waits for the gate of the events before it delivers the event anyway (see `events_gate`).
GATE_WAIT_S = 5.0
#: How long a page that is being built waits for the gate before it is built without it.
@@ -5624,6 +5783,10 @@ class BrowserDispatcher(Dispatcher):
#: Where this session measures a proxy's UDP exit from (the launch's `udp_stun_servers`, "ip:port"
#: strings; None = the two public defaults): the launch and every context proxy use the same list.
self.udp_stun_servers = udp_stun_servers
#: The final UDP verdicts this served browser has measured, per proxy endpoint (the core's `UdpExitCache`, kept the way
#: the core's own `Browser` keeps one): the first context given an endpoint waits for its measurement, the later ones
#: reuse it. ONE per browser, never shared with another one, and it dies with it.
self.udp_exit_cache = UdpExitCache()
#: Chosen for this browser: the prefix of the native names of its exposed functions (see `_bindings`), and the
#: directory of its engine (set by `launch`), which says whether the engine has what they need.
self.binding_token = secrets.token_hex(6)
@@ -6410,8 +6573,10 @@ class BrowserDispatcher(Dispatcher):
# proxy. The core discovers the TCP exit through the proxy and measures the UDP beside it, once per
# proxy (cached by endpoint, a hash of the credentials and the servers), from the STUN servers the
# SESSION was launched with: this is the ONE place a context's proxy is applied, for the sync and
# async clients and for a remote one alike. A `udp` key in what the caller wrote is not read.
proxy = context_proxy_command(params["proxy"], self.udp_stun_servers)
# async clients and for a remote one alike. A `udp` key in what the caller wrote is not read. The core WAITS for
# the final verdict before it returns, and this browser's cache keeps it: only the first context given an
# endpoint pays the wait.
proxy = context_proxy_command(params["proxy"], self.udp_stun_servers, self.udp_exit_cache)
except ValueError as exc:
raise ProtocolException(
"new_context(proxy=...) cannot be applied: %s" % exc)
@@ -6466,7 +6631,7 @@ class BrowserDispatcher(Dispatcher):
self._context_send("Browser.grantPermissions",
{"browserContextId": context_id, "origin": "*",
"permissions": _engine_permissions(permissions)})
viewport = params.get("viewport")
viewport = None if _context_has_no_viewport(params) else params.get("viewport")
if viewport:
# ⛔ `screen` is a SEPARATE option from `viewport` and rides in
# the same command. Without it the page reports a screen the size
@@ -6474,6 +6639,10 @@ class BrowserDispatcher(Dispatcher):
# this project spends a pref on getting right.
wanted: Dict[str, Any] = {"viewportSize": {
"width": viewport["width"], "height": viewport["height"]}}
# ⛔ ONE BIT: the size is the core's declaration for the main window, not the user's. The engine pins a tab to it either way;
# a popup that names no size is pinned only to a size the user chose, as upstream does.
if _viewport_is_declared(viewport):
wanted["isDeclaredDefault"] = True
screen = params.get("screen")
if screen:
wanted["screenSize"] = {"width": screen["width"],
@@ -6846,6 +7015,10 @@ class BrowserTypeDispatcher(Dispatcher):
except BaseException:
conn.close()
raise
# The verdict the launch's geo step measured for the session's proxy is the browser's first one, as the core's `launch`
# keeps it: a context given the same endpoint does not measure it again.
if params.get("proxy"):
browser.udp_exit_cache.remember(params["proxy"], udp_exit)
browser.engine_dir = os.path.dirname(str(executable))
return {"browser": browser.channel}
+15 -1
View File
@@ -56,6 +56,7 @@ from invisible_playwright._pw._impl._helper import parse_error
from invisible_playwright._pw._impl._transport import Transport
from . import wire
from .dispatcher import Deferred
def _error_payload(failure: BaseException) -> Dict[str, str]:
@@ -222,7 +223,20 @@ class InProcessTransport(Transport):
except Exception as failure:
self.reply_error(message.get("id"), failure)
else:
self.reply(message.get("id"), result)
if isinstance(result, Deferred):
# ⛔ THE ANSWER COMES LATER: this worker goes back to the queue at once, and the reply is posted from the thread that
# works it out, the same way (`reply`/`reply_error` hand it to the loop with `call_soon_threadsafe`).
result.begin(self._reply_later(message.get("id")))
else:
self.reply(message.get("id"), result)
def _reply_later(self, msg_id: Optional[int]) -> Any:
def done(result: Any, failure: Optional[BaseException]) -> None:
if failure is not None:
self.reply_error(msg_id, failure)
else:
self.reply(msg_id, result)
return done
# ── what the server calls back ──────────────────────────────────────────
def emit_message(self, message: Dict) -> None:
+29 -42
View File
@@ -11,7 +11,7 @@ That is a defect GENERATOR, and it has already produced three:
* the 0.4.0 process-leak fix reached the sync class only, and shipped to the
other half of the users under a release note saying it was fixed;
* `INVPW_TRUE_HEADLESS`, a documented env var, worked on the async API alone;
* `INVPW_TRUE_HEADLESS`, a documented env var, worked on the async API alone (it is retired now: see below);
* `_build_prefs` was a method on one side and twenty inline lines on the other.
Anything here must stay free of Playwright imports: it is the part that has
@@ -26,7 +26,8 @@ from ._cursor import (ENGINE_PYTHON,
enable_for as _enable_cursor_engine,
max_seconds_for as _cursor_max_seconds)
from ._engine import resolve_executable
from ._juggler.server import COMPOSED_PREF, MOTION_BUDGET_PREF, POINTER_PREF, SESSION_SEED_PREF, UDP_EXIT_PREF, UDP_STUN_PREF
from ._juggler.server import (COMPOSED_PREF, MOTION_BUDGET_PREF, POINTER_PREF, SESSION_SEED_PREF, UDP_EXIT_PREF, UDP_STUN_PREF,
declared_viewport, merged_context_kwargs)
from typing import Any, Dict, Optional
from invisible_core import compose_session_prefs, context_geometry, make_virtual_display
@@ -35,33 +36,14 @@ from invisible_core.launch import (FontManifestMismatch,
cached_font_manifest_path,
verify_font_manifest)
__all__ = ["build_prefs", "true_headless_requested", "TRUE_HEADLESS_ENV",
__all__ = ["build_prefs", "refuse_retired_true_headless", "TRUE_HEADLESS_ENV",
"ProxyEgressDrifted", "egress_ancora_valido"]
#: Opt-in to real headless. Read HERE rather than in one of the two classes,
#: because reading it in one of them is exactly how it came to work on the async
#: API only.
#:
#: ⛔ THE REASON THIS USED TO BE A WORKAROUND IS NOW KNOWN, AND FIXED. This
#: comment said: "the default headful+cloak path intermittently hangs
#: launch_persistent_context on Windows (~40%, a window/compositor race with a
#: persistent profile); true headless ... is reliable". It had the right
#: neighbourhood - window and compositor - and no mechanism, so it stood as an
#: escape hatch for months.
#:
#: The mechanism, measured 2026-08-14: Windows declared the chrome window FULLY
#: OCCLUDED and in the hanging runs the verdict was never revoked
#: (`nsWindow::NotifyOcclusionState() mIsFullyOccluded 1` with no later 0). An
#: inactive BrowsingContext never paints, so delayed startup never finishes,
#: `browser-delayed-startup-finished` never fires, no target is created and the
#: launch times out at 180 s. True headless was reliable for a reason nobody had
#: named: there is no window to occlude.
#:
#: Fixed by `widget.windows.window_occlusion_tracking.enabled=false`, applied to
#: EVERY session by invisible_core - 24 relaunches out of 24 against 6 hangs in 9.
#: So this variable is no longer a workaround for that hang; it remains as a
#: deliberate choice of a different rendering path. Full account:
#: `71-bug-archive.md` [B150].
#: The name of a retired variable. This product runs ONE path, the tested one: a real browser window on a hidden display. The
#: variable used to opt into a different rendering path (Firefox `-headless`, no window at all); that path is gone, and a variable
#: that is set and no longer does anything is a setting that does nothing while the caller believes it does something, so it is
#: refused at launch (`refuse_retired_true_headless`), never ignored. Read HERE rather than in one of the two classes: reading it
#: in one of them is exactly how it once came to work on the async API only.
TRUE_HEADLESS_ENV = "INVPW_TRUE_HEADLESS"
@@ -112,8 +94,16 @@ def declared_network(session: Any) -> str:
return network_to_declare(session.seed)
def true_headless_requested(env: Optional[Dict[str, str]] = None) -> bool:
return (env if env is not None else os.environ).get(TRUE_HEADLESS_ENV) == "1"
def refuse_retired_true_headless(env: Optional[Dict[str, str]] = None) -> None:
"""Raise ValueError when the retired `INVPW_TRUE_HEADLESS` is set to anything but empty.
Called first by every entry point (sync, async, the server's launch), before the network, a display or a process is
started, so the refusal costs nothing and leaves nothing behind."""
if (env if env is not None else os.environ).get(TRUE_HEADLESS_ENV):
raise ValueError(
"invisible_playwright: %s is set, but it was retired in this version. This product always runs a real "
"browser window on a hidden display; there is no other mode to choose. Unset %s."
% (TRUE_HEADLESS_ENV, TRUE_HEADLESS_ENV))
#: The IANA -> POSIX conversion comes from the core, which is where the table
@@ -387,7 +377,7 @@ class CommonLaunch:
⛔ THE DUPLICATION THIS CLOSES IS THE ONE THIS FILE WAS CREATED FOR, and it
survived the file's own creation. `_session` was written on 2026-07-27 to
hold what the sync and async classes share, and it did extract the
functions - `build_env`, `build_prefs`, `true_headless_requested`. What it
functions - `build_env`, `build_prefs`. What it
left behind were the METHODS that call them: six of them, in both classes,
with bodies that are identical byte for byte once the docstrings are
removed. 222 lines saying the same thing twice.
@@ -398,10 +388,8 @@ class CommonLaunch:
ratios between 32% and 69% - was entirely comments worded differently.
⛔ AND THE COST OF THE SPLIT IS NOT HYPOTHETICAL. The three defects listed
at the top of this file all have the same shape, and one of them is in the
code that moved here: `INVPW_TRUE_HEADLESS` was honoured by the async class
alone, so a documented environment variable worked or not depending on
which entry point the caller had picked.
at the top of this file all have the same shape: a documented knob that
worked or not depending on which entry point the caller had picked.
⛔ WHAT THIS CLASS EXPECTS, said out loud because a mixin's contract is
otherwise invisible: both subclasses set `seed`, `_binary_path`,
@@ -454,19 +442,13 @@ class CommonLaunch:
``pw_headless`` is what Playwright is told; ``display`` is the hidden
surface the caller must START (and then record in
``self._virtual_display``, which `_build_prefs` reads), or None when
none is wanted: headless off, true headless asked for, or a platform
none is wanted: headless off, or a platform
with no display to make. The two callers only decide WHERE the start
runs - inline in the sync client, in a worker in the async one - so
the decision cannot drift between them (B172 was one such drift).
"""
if not self._headless:
return False, None
# Opt-in TRUE headless, shared with the async class. It existed on the
# async API ONLY until 2026-07-27: a documented env var that worked
# depending on which entry point the caller happened to pick, which is
# the same drift that shipped the process-leak fix to half the users.
if true_headless_requested():
return True, None
return False, make_virtual_display()
async def _resolve_headless_async(self) -> bool:
@@ -514,8 +496,13 @@ class CommonLaunch:
# the profile's screen is the PANEL, and until wrapper 0.28.0 the
# panel's device pixels went out here as CSS (screen.width 1920 at
# DPR 1.25).
geometry = context_geometry(self._profile)
kwargs: Dict[str, Any] = {
**context_geometry(self._profile),
**geometry,
# ⛔ THE VIEWPORT IS MARKED AS THE CORE'S, not the user's: a viewport the user passes to `new_context` / `new_page` replaces
# this one whole, mark included, so what reaches the server without the mark is a choice. A popup that names no size is
# pinned to a chosen viewport as in Playwright and left to its own window under this one (`declared_viewport`).
"viewport": declared_viewport(geometry["viewport"]),
# ⛔ device_scale_factor and color_scheme are NO LONGER passed.
# They were a second source for two facts invisible_core already
# declares (layout.css.devPixelsPerPx and, since 2026-08-24,
+4 -4
View File
@@ -109,6 +109,8 @@ class InvisiblePlaywright(_session.CommonLaunch):
self._uscite_non_misurabili: int = 0
async def __aenter__(self) -> Union[Browser, BrowserContext]:
# A retired variable is refused before anything starts (the network, a display, a process).
_session.refuse_retired_true_headless()
# Resolve timezone="auto" AND discover the proxy egress IP in one
# round-trip, off the event loop, before anything reads self._timezone
# or builds prefs/env. Fail-early if a proxy is set but the egress
@@ -257,8 +259,7 @@ class InvisiblePlaywright(_session.CommonLaunch):
async def patched(**kw):
await self._assert_uscita_invariata()
merged = dict(defaults)
merged.update(kw)
merged = _session.merged_context_kwargs(defaults, kw)
ctx = await original(**merged)
if prep:
await seed_cookies(ctx)
@@ -295,8 +296,7 @@ class InvisiblePlaywright(_session.CommonLaunch):
# Reserved before the check, for `_new_page_guarded`'s reason.
with page_number_reserved(browser._impl_obj):
await self._assert_uscita_invariata()
merged = dict(defaults)
merged.update(kw) # user-supplied wins, same rule as new_context
merged = _session.merged_context_kwargs(defaults, kw)
page = await original_page(**merged)
ctx = page.context
if prep:
+4 -4
View File
@@ -264,6 +264,8 @@ class InvisiblePlaywright(_session.CommonLaunch):
self._uscite_non_misurabili: int = 0
def __enter__(self) -> Union[Browser, BrowserContext]:
# A retired variable is refused before anything starts (the network, a display, a process).
_session.refuse_retired_true_headless()
# Resolve timezone="auto" (and the proxy-set-but-unset default) to a
# concrete IANA zone AND discover the proxy egress IP - one round-trip,
# before anything reads self._timezone or builds prefs/env. Fail-early
@@ -501,8 +503,7 @@ class InvisiblePlaywright(_session.CommonLaunch):
def patched(**kw):
self._assert_uscita_invariata()
merged = dict(defaults)
merged.update(kw) # user-supplied wins
merged = _session.merged_context_kwargs(defaults, kw)
ctx = original(**merged)
if prep:
seed_cookies(ctx)
@@ -536,8 +537,7 @@ class InvisiblePlaywright(_session.CommonLaunch):
def patched_page(**kw):
self._assert_uscita_invariata()
merged = dict(defaults)
merged.update(kw) # user-supplied wins, same rule as new_context
merged = _session.merged_context_kwargs(defaults, kw)
page = original_page(**merged)
ctx = page.context
if prep:
+23
View File
@@ -0,0 +1,23 @@
"""The row the host oracle's declared list carried while the published engine was the 68 or the 69 and the candidate no longer spawned the graphics probe.
ci/ab-host-expected.json declares what the published engine of today and the candidate differ by, which is nothing now (the published engine is the 70, which does not spawn
gfxtest either, so the row would be stale in every run). The mechanism of a declared `proc` difference (the kind and the paths only that process touched, the A/B only, the stale
check) is tested with this row, as a row of the tests' own.
"""
from __future__ import annotations
import copy
GFXTEST_ROW = {
"id": "gfxtest-69",
"os": "linux",
"category": "proc",
"name": "gfxtest",
"published": "present",
"candidate": "absent",
"reason": "the 69 no longer spawns the graphics probe gfxtest (GFX_PROBE_BINARY, widget/gtk/GfxInfo.cpp:55; commit 0e896e4ee1, the probe never reads the host); the paths only that process touched go with it",
}
def gfxtest_rows() -> list:
return [copy.deepcopy(GFXTEST_ROW)]
+101
View File
@@ -0,0 +1,101 @@
"""What the browser writes to its output, read by every e2e test that launches the engine, and the lines that fail the test.
The core reads the browser's stdout and stderr (one pipe) through ``invisible_core.juggler.connection.ProcessOutput``, one reader for the whole life of the process, and keeps the last 200 lines. Nothing in the e2e suites looked at those
lines: a line the engine writes to say that it did something it should not have done passed in silence. The check is here: while an e2e test runs, a tee in front of that reader (the bytes are the ones the reader gets, and the browser cannot
tell) matches every line against ``FAILING_LINES``; the test fails, at its teardown, naming each line it saw.
``tests/conftest.py`` installs it for every test marked ``e2e`` (``_the_browser_log_holds_no_line_that_fails_the_test``). A browser that a test starts in a child process of its own (the A/B oracles) is not seen from here: its output is
kept by ``scripts/ci_crash_evidence.py`` and judged by the oracle.
THE LINES.
* An expired wait for ``popupshown``. The engine's Juggler (``juggler/protocol/PageHandler.js``, ``_waitForPopupOfPress``) holds the release of a click until the popup its press opened (a select dropdown) says ``popupshown``, at most one
second, and when the second passes it goes on and writes ``WARNING: popup <id> did not say popupshown within <ms> ms of its press, the release goes on``. The release that goes on is one the dropdown may drop, so a click that a test saw
pass can have lost its ``mouseup``. The text here is the engine's, character for character; the id is the popup's element id (or its tag name) and the number is ``POPUP_SHOWN_WAIT_MS``.
* An expired wait for the press of a release. The same handler holds a click's release at its gate until the page has handled the press (``_holdReleaseForItsPress``), at most five seconds, and then writes ``WARNING: the press of
this release was not handled by the page within 5 s, the release goes on``: the release may reach a page that never saw its press.
"""
from __future__ import annotations
import re
import threading
from typing import List
import pytest
#: The lines of the browser's output that fail an e2e test, each with what it means (the message names both the line and this).
FAILING_LINES = (
(re.compile(r"WARNING: popup \S+ did not say popupshown within \d+ ms of its press, the release goes on"),
"a release waited for the popup its press opened to say popupshown, and went on without it (the engine's bound passed)"),
(re.compile(r"WARNING: the press of this release was not handled by the page within \d+ s, the release goes on"),
"a release waited for its press to be handled by the page, and went on without it (the engine's bound passed)"),
)
def failing(text: str) -> List[str]:
"""The lines of ``text`` that fail a test, each as ``line <- what it means``."""
found = []
for line in text.splitlines():
for pattern, meaning in FAILING_LINES:
hit = pattern.search(line)
if hit:
found.append("%s <- %s" % (hit.group(0), meaning))
return found
class Sink:
"""What the browsers of one test wrote that fails it, and the readers that were tee'd."""
def __init__(self) -> None:
self.lines: List[str] = []
self.outputs: list = []
self._lock = threading.Lock()
def add(self, text: str) -> None:
found = failing(text)
if found:
with self._lock:
self.lines.extend(found)
def fail_if_any(self, wait: float = 0.5) -> None:
"""Fail the test, naming every line, when a browser of the test wrote one. A browser that has just closed has its last lines still in the pipe: its reader is given ``wait`` seconds to reach the end."""
for output in self.outputs:
thread = getattr(output, "_thread", None)
if thread is not None and thread.is_alive():
thread.join(wait)
with self._lock:
lines = list(self.lines)
if lines:
pytest.fail("the browser's output holds %d line(s) that fail an e2e test:\n %s" % (len(lines), "\n ".join(lines)), pytrace=False)
class ScanStream:
"""The stream the core's reader reads, with every line it reads matched against ``FAILING_LINES``: the same lines in the same order to the same reader, and nothing written to the browser."""
def __init__(self, stream, sink: Sink) -> None:
self._stream, self._sink = stream, sink
def readline(self, *args):
line = self._stream.readline(*args)
if line:
try:
self._sink.add(line.decode("utf-8", "replace") if isinstance(line, bytes) else str(line))
except Exception: # noqa: BLE001 - a check never breaks a launch
pass
return line
def __getattr__(self, name):
return getattr(self._stream, name)
def install(monkeypatch, sink: Sink) -> None:
"""Put the tee in front of the reader of every browser the process launches through the core, until ``monkeypatch`` undoes it."""
from invisible_core.juggler.connection import ProcessOutput
original = ProcessOutput.__init__
def init(self, stream, *args, **kwargs):
original(self, ScanStream(stream, sink), *args, **kwargs)
sink.outputs.append(self)
monkeypatch.setattr(ProcessOutput, "__init__", init)
+187
View File
@@ -0,0 +1,187 @@
"""What the drag twin records of a drag, and how two records are compared: every drag event the page hears, in the top document and in the frame, never a number of ours.
``RECORDER_JS`` is the script both pages run: for each of ``dragstart``, ``drag``, ``dragenter``, ``dragover``, ``dragleave``, ``drop`` and ``dragend`` (heard at the document, after the
page's own handlers, so ``dataTransfer.types`` is what the page has set by then) it keeps, in ``window.__events``, the fields of ``FIELDS``:
type, at (the id of the event's target), under (the id of ``document.elementFromPoint`` at the event's client point), cx/cy (clientX/Y), sx/sy (screenX/Y), buttons, input (mozInputSource),
types (dataTransfer.types), allowed (effectAllowed), effect (dropEffect), cancelled (mozUserCancelled), source_null (whether mozSourceNode is null), trusted (isTrusted).
``record(top_events, frame_events)`` is what one browser leaves: for each document (the top one, where the drag starts and ends and a drop can land, and the frame) the events that happen once
or a few times (``once``: dragstart, dragenter, dragleave, drop, dragend, in the order the page heard them) whole, and for ``drag`` and ``dragover``, which repeat as often as the mouse moves
and as a timer fires, their count, their first and last event and the ids they were dispatched at. ``end_minus_last`` is ``dragend``'s client point less the last ``drag``'s, in the top
document.
HOW TWO RECORDS ARE COMPARED (``compare``): with stock, only what stock decides the same way on every machine and in either process model: the routing and the targets (the event sequence, the
type, the target, what is under the point), the client points, ``rel``, the data transfer's types, trusted, the input source, and, in the top document, the effects (the same process on both
sides) of every event but the one the frame's process decides (see the twin rule). In a CSS pixel for the client points (``TOLERANCES``: the point of a drag is a device pixel that crosses a process and is rounded to CSS, the tolerance the twin has always had for the
drop point); and through the relation for the screen points. ``screenX/Y`` is where the window stands on the screen: stock's is the real place of its window and ours is the declared one, so the
two are not the same number and no number of ours is the expected one. What the page reads is the same in both: where a point is on the screen relative to where the top document's first event is
(``rel``: ``screen - client`` of the event, less that of the first event of the top document). It is 0 for every event of the top document and the frame's place in it for a frame's event, in a
browser whose window stands anywhere. The absolute screen points and the origin are in the record, printed when the two differ, and not in the comparison. The count of ``dragover`` events is in
the record and not in the comparison: it is timer-driven.
THE TWIN RULE (``DECLARED``): a field that depends on stock's frame being in the top's process, or on stock's drag being Juggler's synthetic one, is in the record and NOT compared with stock; the
list says which and why, and ``recorded`` returns what differs there, for the report. Retail decides those fields, through the capture of the round ``drag`` of the core's window-geometry workflow.
They are ``buttons`` (stock's synthetic drag has no OLE loop: 0), ``drag`` at the source (count and presence: no OLE loop, no timer-driven ``drag``), the ``dragend`` point less the last ``drag``
(no ``drag`` to be less of), and in the frame ``effectAllowed``, ``dropEffect`` and ``mozSourceNode`` (stock's frame is in-process and reads the source's own DataTransfer; ours is in another
process, where Mozilla's cross-process DataTransfer starts with effectAllowed ``uninitialized`` and the dropEffect is the action, nsContentUtils FilterDropEffect).
For the drop in the frame (``kind`` ``frame``), two more fields of the TOP document depend on the frame's process, and ``comparable`` moves them out of ``top.once`` before the comparison: every top
``dragleave`` whose ``under`` is the frame (``top.into_frame``: stock's frame is in its own process model, so the top's event manager fires a leave at the body when the cursor enters the
subdocument; retail with the frame out of process has none, and ours has none) and the ``dropEffect`` of the top ``dragend`` (``top.dragend_effect``: it is the frame's drop result, which crosses
processes). In the drop in the top document (``kind`` ``top``) the record is compared whole, ``dragend``'s effect included.
"""
from __future__ import annotations
import copy
import json
from typing import Any, Dict, List, Optional, Tuple
from _stock_twin import IN_PROCESS_FRAME, SYNTHETIC_DRAG, both, split_differences
#: The events of a drag, in the order a drag starts, goes over and ends.
TYPES = ("dragstart", "drag", "dragenter", "dragover", "dragleave", "drop", "dragend")
#: Events that repeat (every mouse move, every timer tick): the record keeps their count, their first and last event.
REPEATED = ("drag", "dragover")
#: What the page keeps of each event, and so what the record has of it.
FIELDS = ("type", "at", "under", "cx", "cy", "sx", "sy", "buttons", "input", "types", "allowed", "effect", "cancelled", "source_null", "trusted")
#: A CSS pixel for a client point and for the relation of the screen point to the client one; every other number exactly.
TOLERANCES: Dict[str, float] = {"cx": 1.0, "cy": 1.0, "rel": 1.0}
#: Keys of the record that are in it and not in the comparison, and why (the count of ``drag`` and of ``dragover`` is left out in ``_comparable``: a timer fires them, so it depends on the speed of the machine).
NOT_COMPARED = {
"sx": "the real place of stock's window and the declared one of ours: compared through rel",
"sy": "the real place of stock's window and the declared one of ours: compared through rel",
"screen_origin": "screen minus client of the first event of the top document: where the window stands",
}
#: THE TWIN RULE. Stock Playwright's Firefox sets ``fission.webContentIsolationStrategy=0``: its cross-site frame is in the top's process, ours is in another process, and stock's drag is Juggler's
#: synthetic one (no OLE drag loop). A field that depends on either is RECORDED, not compared with stock: the retail capture decides it (round ``drag`` of the core's window-geometry workflow, which
#: drives a real drag on retail). Each key is a pattern of canonical paths of the record (``top.once[].buttons``; ``*`` is any run of characters), each value is the reason.
#: What is compared with stock is the routing and the targets (the event sequence, ``type``, ``at``, ``under``), the client points and ``rel``, ``types``, ``trusted`` and ``input`` (mozInputSource),
#: in both documents, and ``effectAllowed`` and ``dropEffect`` of the top document, except, in the drop in the frame, the top's leave into the frame and the top ``dragend``'s ``dropEffect``.
DECLARED: Dict[str, str] = {
# stock's synthetic Juggler drag: no OLE loop, so the mouse buttons are 0 in its events and ``drag`` never fires at the source (and the dragend point less the last drag has no drag to be less of)
"*.buttons": SYNTHETIC_DRAG,
"top.repeated.drag.*": SYNTHETIC_DRAG,
"end_minus_last*": SYNTHETIC_DRAG,
# stock's frame is in-process: it reads the source's own DataTransfer; ours is in another process, where Mozilla's cross-process DataTransfer starts with effectAllowed 'uninitialized' and
# dropEffect is the action (nsContentUtils FilterDropEffect), and mozSourceNode is not reachable
"frame.*.allowed": IN_PROCESS_FRAME,
"frame.*.effect": IN_PROCESS_FRAME,
"frame.*.source_null": IN_PROCESS_FRAME,
# the frame drop only (``comparable`` makes these keys): stock's top hears a leave at the body when the cursor enters its in-process-model subdocument, and the top dragend's dropEffect is the
# frame's drop result, which crosses processes
"top.into_frame*": IN_PROCESS_FRAME,
"top.dragend_effect*": IN_PROCESS_FRAME,
}
RECORDER_JS = """
window.__events = [];
(function () {
const name = n => n ? (n.id || n.nodeName.toLowerCase()) : null;
for (const type of %s) {
document.addEventListener(type, e => {
const dt = e.dataTransfer;
window.__events.push({
type: e.type, at: name(e.target), under: name(document.elementFromPoint(e.clientX, e.clientY)),
cx: e.clientX, cy: e.clientY, sx: e.screenX, sy: e.screenY, buttons: e.buttons, input: e.mozInputSource,
types: dt ? Array.from(dt.types) : null, allowed: dt ? dt.effectAllowed : null, effect: dt ? dt.dropEffect : null,
cancelled: dt ? dt.mozUserCancelled : null, source_null: dt ? dt.mozSourceNode === null : null, trusted: e.isTrusted,
});
});
}
})();
""" % json.dumps(list(TYPES))
READ_JS = "() => window.__events"
def read_events(document) -> List[Dict[str, Any]]:
"""The raw events a page or frame heard (``document`` is a Playwright page or frame)."""
return document.evaluate(READ_JS)
def _event(raw: Dict[str, Any], origin: Optional[List[float]]) -> Dict[str, Any]:
missing = [f for f in FIELDS if f not in raw]
if missing:
raise ValueError("a drag event the page recorded has no %s (an absent field is a difference, never an agreement): %r" % (", ".join(missing), raw))
out = {f: raw[f] for f in FIELDS}
out["rel"] = None if origin is None else [raw["sx"] - raw["cx"] - origin[0], raw["sy"] - raw["cy"] - origin[1]]
return out
def _document(events: List[Dict[str, Any]], origin: Optional[List[float]]) -> Dict[str, Any]:
once = [_event(e, origin) for e in events if e.get("type") not in REPEATED]
repeated: Dict[str, Any] = {}
for kind in REPEATED:
of_kind = [_event(e, origin) for e in events if e.get("type") == kind]
repeated[kind] = ({"count": len(of_kind), "first": of_kind[0], "last": of_kind[-1], "at": sorted({str(e["at"]) for e in of_kind})}
if of_kind else {"count": 0})
return {"once": once, "repeated": repeated}
def record(top_events: List[Dict[str, Any]], frame_events: List[Dict[str, Any]]) -> Dict[str, Any]:
"""What one browser leaves of one drag: both documents' events, the end point less the last drag point, and the origin of the screen points."""
origin = [top_events[0]["sx"] - top_events[0]["cx"], top_events[0]["sy"] - top_events[0]["cy"]] if top_events else None
top = _document(top_events, origin)
drags = [e for e in top_events if e.get("type") == "drag"]
ends = [e for e in top_events if e.get("type") == "dragend"]
last, end = (drags[-1] if drags else None), (ends[-1] if ends else None)
return {"top": top, "frame": _document(frame_events, origin),
"end_minus_last": [end["cx"] - last["cx"], end["cy"] - last["cy"]] if (end and last) else None,
"screen_origin": origin}
def read_record(page, frame) -> Dict[str, Any]:
"""The record of a drag, read from the top page and from the frame."""
return record(read_events(page), read_events(frame))
def _comparable(node: Any, key: str = "") -> Any:
if isinstance(node, dict):
return {k: _comparable(v, k) for k, v in node.items() if k not in NOT_COMPARED and not (key in REPEATED and k == "count")}
if isinstance(node, list):
return [_comparable(v, key) for v in node]
return copy.deepcopy(node)
#: The id of the frame in the top page (``f``): the ``under`` of the top's leave into it.
FRAME_ID = "f"
def comparable(record: Dict[str, Any], kind: str) -> Dict[str, Any]:
"""The record as it is compared: for the drop in the frame (``kind`` ``frame``) the top's ``dragleave`` events under the frame leave ``top.once`` for ``top.into_frame`` and the top ``dragend``'s
``effect`` leaves its event for ``top.dragend_effect``; both keys are in ``DECLARED``. For the drop in the top document (``top``) the record is unchanged."""
if kind not in ("top", "frame"):
raise ValueError("the drop is in the 'top' document or in the 'frame', not %r" % (kind,))
out = _comparable(record)
if kind == "frame":
top = out["top"]
into_frame = [e for e in top["once"] if e["type"] == "dragleave" and e["under"] == FRAME_ID]
top["once"] = [e for e in top["once"] if not (e["type"] == "dragleave" and e["under"] == FRAME_ID)]
top["into_frame"] = into_frame
top["dragend_effect"] = [e.pop("effect") for e in top["once"] if e["type"] == "dragend"]
return out
def split(stock: Dict[str, Any], ours: Dict[str, Any], kind: str, path: str = "drag") -> Tuple[List[str], List[str]]:
"""``(red, recorded)``: the differences that decide, and those of the declared fields (``DECLARED``), kept for the report. ``kind`` is where the drop ended: ``top`` or ``frame``."""
return split_differences(comparable(stock, kind), comparable(ours, kind), DECLARED, TOLERANCES, path)
def compare(stock: Dict[str, Any], ours: Dict[str, Any], kind: str, path: str = "drag") -> List[str]:
"""Every place where ours is not what stock is in a field that is compared, as ``path: stock X, ours Y``; empty when the page reads the same there."""
return split(stock, ours, kind, path)[0]
def recorded(stock: Dict[str, Any], ours: Dict[str, Any], kind: str, path: str = "drag") -> List[str]:
"""The differences in the fields of ``DECLARED``: in the report, never in the verdict."""
return split(stock, ours, kind, path)[1]
def verdict(case: str, kind: str, stock: Dict[str, Any], ours: Dict[str, Any]) -> str:
"""The message of a red drag twin, with both records whole; empty when ours is what stock is."""
differing = compare(stock, ours, kind, "%s drop" % kind)
if not differing:
return ""
return ("%s: the drag that ends in the %s of ours does not read what stock's does (every event, that drag fired at the source, dragend less the last drag):\n %s%s"
% (case, "frame of another site" if kind == "frame" else "top document", "\n ".join(differing), both(case, stock, ours)))
+6 -3
View File
@@ -9,7 +9,7 @@ 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``,
(``MOZ_LOG``, one file per process in the evidence: ``MOZ_LOG_FILE`` carries ``%PID``), 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
@@ -36,8 +36,11 @@ EVIDENCE_FOLDER = "invpw-evidence"
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).
#: The base name of the engine's log files in the evidence, and the name given to ``MOZ_LOG_FILE``: Firefox expands ``%PID`` into ``-main.<pid>`` or
#: ``-child.<pid>`` (and adds ``.moz_log``, ``ExpandLogFileName`` in ``xpcom/base/Logging.cpp``), so that every process of every session of a test writes a
#: file of its own. Without it two sessions of one test wrote the same file and the parent's one was 0 bytes.
MOZ_LOG_BASE = "engine"
MOZ_LOG_FILE_NAME = MOZ_LOG_BASE + "%PID"
class FailureEvidence:
@@ -81,7 +84,7 @@ class FailureEvidence:
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._patch.setenv("MOZ_LOG_FILE", str(self.moz_log_dir / MOZ_LOG_FILE_NAME))
self._wire = open(self.wire_path, "w", encoding="utf-8")
try:
from invisible_core.juggler import connection
+58
View File
@@ -0,0 +1,58 @@
"""A stock Playwright client that launches nothing and records what ``p.firefox.launch`` was called with, for the unit tests of the stock twins (no browser, no display)."""
from __future__ import annotations
from typing import Any, Dict, List
import _stock_twin
class _Page:
pass
class _Context:
def new_page(self) -> _Page:
return _Page()
class _Browser:
def __init__(self, events: List[str]) -> None:
self._events = events
def new_context(self, **kwargs: Any) -> _Context:
return _Context()
def close(self) -> None:
self._events.append("browser closed")
class _Firefox:
def __init__(self, launches: List[Dict[str, Any]], events: List[str], fail: bool) -> None:
self._launches, self._events, self._fail = launches, events, fail
def launch(self, **kwargs: Any) -> _Browser:
self._events.append("launch")
self._launches.append(kwargs)
if self._fail:
raise RuntimeError("the launch fails")
return _Browser(self._events)
class _Playwright:
def __init__(self, launches: List[Dict[str, Any]], events: List[str], fail: bool) -> None:
self.firefox = _Firefox(launches, events, fail)
def __enter__(self) -> "_Playwright":
return self
def __exit__(self, *exc: Any) -> bool:
return False
def install(monkeypatch, events: List[str] = None, fail: bool = False) -> List[Dict[str, Any]]:
"""``_stock_twin._on_stock`` on a client that records its launches (the keywords of each) in the list returned, and its steps in ``events``."""
launches: List[Dict[str, Any]] = []
events = [] if events is None else events
monkeypatch.setattr(_stock_twin, "stock_client", lambda: (lambda: _Playwright(launches, events, fail)))
monkeypatch.setattr(_stock_twin, "Chrome", type("FakeChrome", (), {"__init__": lambda self, page: None, "close": lambda self: None}))
return launches
+11 -1
View File
@@ -223,6 +223,11 @@ class H3Server:
#: The same peers with the port they sent from: (address, port). On a machine where a gateway's relay sends from an address of
#: this host (Windows cannot send from 127.0.0.1 to it) the address cannot tell the relay from a client that came direct; its port can.
self.quic_peer_addrs: List[Tuple[str, int]] = []
#: EVERY datagram that reached the UDP port, whether or not a QUIC handshake came out of it: (address, port) of the sender. A browser
#: that TRIES h3 sends its Initial here before anything else, so this list is the attempt itself, the one signal of "the engine tried
#: HTTP/3" that does not depend on the attempt succeeding or on how long it takes; ``quic_peers`` only has the connections that
#: negotiated an ALPN (an attempt that never completes is not in it).
self.udp_datagrams: List[Tuple[str, int]] = []
#: The paths of the requests that were answered over HTTP/3, and over TCP.
self.h3_requests: List[str] = []
self.tcp_requests: List[str] = []
@@ -314,6 +319,11 @@ class H3Server:
self._http.send_data(http_event.stream_id, PAGE, end_stream=True)
self.transmit()
class Recording(QuicServer):
def datagram_received(self, data, addr):
server.udp_datagrams.append((addr[0], addr[1]))
super().datagram_received(data, addr)
configuration = QuicConfiguration(is_client=False, alpn_protocols=H3_ALPN)
if quic_idle_timeout is not None:
configuration.idle_timeout = quic_idle_timeout
@@ -325,7 +335,7 @@ class H3Server:
asyncio.set_event_loop(self._loop)
# What ``aioquic.asyncio.serve(address, port)`` does (1.x), with the socket that already holds the number.
_transport, self._quic = self._loop.run_until_complete(self._loop.create_datagram_endpoint(
lambda: QuicServer(configuration=configuration, create_protocol=Protocol), sock=self._udp))
lambda: Recording(configuration=configuration, create_protocol=Protocol), sock=self._udp))
started.set()
try:
self._loop.run_forever()
+228
View File
@@ -0,0 +1,228 @@
"""A test that is not e2e never leaves the machine: every connection, datagram and name lookup it makes goes to this host or is refused.
The markers say it already (pyproject.toml: ``unit`` is "no network", ``integration`` is "no network"), and nothing enforced it:
``tests/unit/test_config_public.py`` composed the default prefs with no declared exit, the core asked api.ipify.org and icanhazip.com
where it leaves from, and the test failed on a machine whose network refused them. A test cannot fail for the reasons of a third party.
:func:`install` patches the four doors of the standard library that every client in the process goes through (``socket.socket.connect``,
``connect_ex`` and ``sendto``, and ``socket.getaddrinfo``): a destination on this host passes, anything else is refused with
:class:`LeftTheMachine` (a ``ConnectionRefusedError``, so the code under test sees what an offline machine shows it) AND recorded, so the test
fails at its teardown even when the code under test swallowed the refusal. The record names the test, the door and the destination.
asyncio has doors of its own, and on Windows they skip the four above: the Proactor loop connects with ``ConnectEx`` and sends datagrams with
``WSASendTo`` (``_overlapped``), never through ``socket.socket``. So the guard also patches the loop methods every asyncio client goes through, for
both loop kinds: ``BaseEventLoop.create_connection`` and ``create_datagram_endpoint`` (``remote_addr``), ``sock_connect`` and ``sock_sendto`` of the
selector and of the Proactor loop, and the Proactor datagram transport's ``sendto``.
What it cannot see, on any system: a socket made from ``_socket`` directly or used through ``_overlapped`` by hand (no library of this project
does), native code in the same process, and a child process (a subprocess has its own interpreter: the e2e are where a browser runs).
On this host: a loopback address (127/8, ::1), the unspecified address (0.0.0.0, ::, which a connect reaches on this host), a name that is
``localhost`` or ends in ``.localhost``, and an AF_UNIX path. The documentation ranges (192.0.2/24, 198.51.100/24, 203.0.113/24, 2001:db8::/32)
pass too: they are never routed, and the lab gives one of them to an interface of this host (the exit of the lab, tests/_lab_egress.py).
And the address this host sends from (its default route's, tests/_host_address.py): a relay of the tests that leaves from the address of the
host is on this host, and a datagram to it never leaves the machine.
"""
from __future__ import annotations
import ipaddress
import socket
import threading
from typing import Any, List, Optional, Sequence, Tuple
_DOCUMENTATION = tuple(ipaddress.ip_network(n) for n in ("192.0.2.0/24", "198.51.100.0/24", "203.0.113.0/24", "2001:db8::/32"))
RULE = ("a test that is not e2e never leaves the machine (pyproject.toml markers: unit and integration are 'no network'): "
"a test cannot fail for the reasons of a third party")
FIX = ("declare the value the code would ask the network for (timezone=, locale=, proxy= with a local gateway), use a server of the tests "
"on loopback (tests/_servers.py, the local_egress_echo fixture), or mark the test e2e if it is one")
#: The ONE file whose job is to ask a third party, and the hosts it may ask. Nothing else is declared, and a new entry is a decision, not a fix.
#: ``tests/test_version_is_not_taken.py`` is the version gate of a pull request: it asks the index whether the version the change proposes
#: is already published, which only the index can answer. It is skipped unless ``IPW_CHECK_VERSION`` is set, which only the ``version`` job
#: of tests.yml does. Its host is allowed for its name lookup and for the addresses that lookup answered, nothing else.
DECLARED_THIRD_PARTIES = {
"tests/test_version_is_not_taken.py": ("pypi.org",),
}
class LeftTheMachine(ConnectionRefusedError):
"""A destination outside this host, refused by the guard of the tests."""
def own_addresses() -> Tuple[str, ...]:
"""The addresses this host sends from, IPv4 and IPv6 (the source its default route picks). A UDP connect sends no packet; a family with
no route has none. Read BEFORE the doors are patched."""
found = []
for family, probe in ((socket.AF_INET, ("192.0.2.1", 9)), (socket.AF_INET6, ("2001:db8::1", 9))):
try:
with socket.socket(family, socket.SOCK_DGRAM) as s:
s.connect(probe)
found.append(s.getsockname()[0].split("%", 1)[0])
except OSError:
pass
return tuple(found)
def is_on_this_host(host: Any, own: Sequence[str] = ()) -> bool:
"""Whether ``host`` (an address, a name, or None) is on this host, the way the guard decides it; ``own`` are the addresses of this host
(:func:`own_addresses`)."""
if host is None:
return True
if isinstance(host, bytes):
host = host.decode("ascii", "replace")
host = str(host).strip("[]").split("%", 1)[0]
if host == "" or host.lower() == "localhost" or host.lower().endswith(".localhost"):
return True
try:
address = ipaddress.ip_address(host)
except ValueError:
return False # a name: resolving it is already a question to the network
if getattr(address, "ipv4_mapped", None) is not None:
address = address.ipv4_mapped
return (address.is_loopback or address.is_unspecified or any(address in net for net in _DOCUMENTATION)
or any(address == ipaddress.ip_address(mine) for mine in own))
def _destination(address: Any, own: Sequence[str] = ()) -> Optional[str]:
"""``host:port`` of a socket address that leaves the machine, or None when it does not (AF_UNIX paths and this host)."""
if not isinstance(address, tuple) or not address:
return None # an AF_UNIX path or an abstract name: this host
host = address[0]
if is_on_this_host(host, own):
return None
return "%s:%s" % (host, address[1] if len(address) > 1 else "?")
class Guard:
"""The record of one test: what it tried outside the machine. Thread-safe: a client thread of the test is recorded too."""
def __init__(self, test: str) -> None:
self.test = test
self.attempts: List[str] = []
self._lock = threading.Lock()
def refuse(self, door: str, destination: str) -> LeftTheMachine:
sentence = "%s %s" % (door, destination)
with self._lock:
if sentence not in self.attempts:
self.attempts.append(sentence)
return LeftTheMachine("WHERE: %s. WHAT: %s, outside this host, refused. FIX: %s. RULE: %s." % (self.test, sentence, FIX, RULE))
def verdict(self) -> Optional[str]:
"""The failure of the test, or None when it stayed on this host."""
if not self.attempts:
return None
return ("WHERE: %s. WHAT: the test tried to leave the machine: %s (each was refused). FIX: %s. RULE: %s."
% (self.test, "; ".join(self.attempts), FIX, RULE))
def install(monkeypatch: Any, test: str) -> Guard:
"""Patch the four doors for the duration of ``monkeypatch``; return the record of ``test``."""
guard = Guard(test)
declared_hosts = DECLARED_THIRD_PARTIES.get(test.split("::", 1)[0].replace("\\", "/"), ())
answered = set() # the addresses a lookup of a declared host answered: a connection to them is that host
own = tuple(own_addresses())
def mine():
return own + tuple(answered)
connect, connect_ex, sendto, getaddrinfo = (socket.socket.connect, socket.socket.connect_ex, socket.socket.sendto,
socket.getaddrinfo)
def guarded_connect(self, address):
where = _destination(address, mine())
if where is not None:
raise guard.refuse("connect to", where)
return connect(self, address)
def guarded_connect_ex(self, address):
where = _destination(address, mine())
if where is not None:
raise guard.refuse("connect to", where)
return connect_ex(self, address)
def guarded_sendto(self, data, *rest):
where = _destination(rest[-1] if rest else None, mine())
if where is not None:
raise guard.refuse("datagram to", where)
return sendto(self, data, *rest)
def guarded_getaddrinfo(host, *args, **kwargs):
if isinstance(host, str) and host.lower() in declared_hosts:
found = getaddrinfo(host, *args, **kwargs)
answered.update(info[4][0] for info in found)
return found
if not is_on_this_host(host, mine()):
raise guard.refuse("name lookup of", str(host))
return getaddrinfo(host, *args, **kwargs)
_install_asyncio(monkeypatch, guard, mine)
monkeypatch.setattr(socket.socket, "connect", guarded_connect)
monkeypatch.setattr(socket.socket, "connect_ex", guarded_connect_ex)
monkeypatch.setattr(socket.socket, "sendto", guarded_sendto)
monkeypatch.setattr(socket, "getaddrinfo", guarded_getaddrinfo)
return guard
def _install_asyncio(monkeypatch: Any, guard: Guard, mine: Any) -> None:
"""The asyncio doors (module docstring), for the selector loop and, where it exists, the Proactor loop."""
import asyncio.base_events as base_events
import asyncio.selector_events as selector_events
loops = [selector_events.BaseSelectorEventLoop]
datagram_transports = []
try:
import asyncio.proactor_events as proactor_events
loops.append(proactor_events.BaseProactorEventLoop)
datagram_transports.append(proactor_events._ProactorDatagramTransport)
except ImportError: # pragma: no cover - the module exists on every system; its loop runs only on Windows
pass
create_connection = base_events.BaseEventLoop.create_connection
create_datagram_endpoint = base_events.BaseEventLoop.create_datagram_endpoint
async def guarded_create_connection(self, protocol_factory, host=None, port=None, *args, **kwargs):
if host is not None and kwargs.get("sock") is None and not is_on_this_host(host, mine()):
raise guard.refuse("asyncio connect to", "%s:%s" % (host, port))
return await create_connection(self, protocol_factory, host, port, *args, **kwargs)
async def guarded_create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, **kwargs):
where = _destination(remote_addr, mine())
if where is not None:
raise guard.refuse("asyncio datagram endpoint to", where)
return await create_datagram_endpoint(self, protocol_factory, local_addr=local_addr, remote_addr=remote_addr, **kwargs)
monkeypatch.setattr(base_events.BaseEventLoop, "create_connection", guarded_create_connection)
monkeypatch.setattr(base_events.BaseEventLoop, "create_datagram_endpoint", guarded_create_datagram_endpoint)
for loop in loops:
sock_connect, sock_sendto = loop.sock_connect, loop.sock_sendto
def make(sock_connect=sock_connect, sock_sendto=sock_sendto):
async def guarded_sock_connect(self, sock, address):
where = _destination(address, mine())
if where is not None:
raise guard.refuse("asyncio connect to", where)
return await sock_connect(self, sock, address)
async def guarded_sock_sendto(self, sock, data, address):
where = _destination(address, mine())
if where is not None:
raise guard.refuse("asyncio datagram to", where)
return await sock_sendto(self, sock, data, address)
return guarded_sock_connect, guarded_sock_sendto
guarded_sock_connect, guarded_sock_sendto = make()
monkeypatch.setattr(loop, "sock_connect", guarded_sock_connect)
monkeypatch.setattr(loop, "sock_sendto", guarded_sock_sendto)
for transport in datagram_transports:
def make_sendto(sendto=transport.sendto):
def guarded_sendto(self, data, addr=None):
where = _destination(addr, mine())
if where is not None:
raise guard.refuse("asyncio datagram to", where)
return sendto(self, data, addr)
return guarded_sendto
monkeypatch.setattr(transport, "sendto", make_sendto())
+200
View File
@@ -0,0 +1,200 @@
"""Where the operating system's own cursor is while a headed browser window is on the desktop the test runs on.
A real window that appears under the OS cursor receives a native ``WM_MOUSEMOVE`` for it, and the first native move of a process always passes Gecko's
``LastMouseMoveData`` filter, so the page sees ``mousemove`` at the cursor's place with ``buttons=0``, at a moment the test does not choose. On a GitHub
Windows runner the cursor sits at (512, 384) and the headed window covers (-8, -8) to (1928, 1040): the move reached the page once in the middle of a drag
(``test_drag_motion.py::test_a_real_page_sees_a_drag_that_travelled`` saw ``mousemove 512,299 buttons=0`` after the press). The engine keeps delivering native
input to content, so the arrangement is the test's: the cursor is parked on a point of the desktop that no window of the browser covers, before the browser
starts, and a test that records pointer events checks it still is when its gesture begins.
* Windows: ``user32`` through ctypes. The windows are the visible top-level ones of the processes below the test process (the browsers it launched), seen from
the desktop the test runs on: a ``headless=True`` browser runs on a Win32 desktop of its own (``make_virtual_display``), is not enumerated here and cannot
receive the interactive cursor.
* Linux and macOS: nothing to do. The Linux e2e run under ``xvfb-run``: an X server with virtual pointer and keyboard devices (XTEST) and no physical one,
so nothing moves a pointer there; every function answers "outside" and ``park`` does nothing.
"""
from __future__ import annotations
import ctypes
import os
import sys
from typing import List, Optional, Sequence, Tuple
#: ``(left, top, right, bottom)`` as ``GetWindowRect`` gives it: ``right`` and ``bottom`` are the first pixel outside.
Rect = Tuple[int, int, int, int]
Point = Tuple[int, int]
#: How far from every window the parked cursor is, in pixels: a window is moved or grown by a border or a shadow, and the cursor must stay outside of it.
MARGIN = 8
class TheCursorIsInside(AssertionError):
"""The OS cursor is over a window of the browser while a gesture is about to start."""
class TheCursorCannotBeParked(RuntimeError):
"""No point of the desktop is free of the browser's windows, or the system did not move the cursor."""
def _inflate(rect: Rect, margin: int) -> Rect:
return (rect[0] - margin, rect[1] - margin, rect[2] + margin, rect[3] + margin)
def _contains(rect: Rect, point: Point) -> bool:
return rect[0] <= point[0] < rect[2] and rect[1] <= point[1] < rect[3]
def cursor_is_outside(window_rects: Sequence[Rect], cursor: Optional[Point] = None, margin: int = 0, *,
api: Optional["_Win32"] = None) -> bool:
"""True when ``cursor`` (read from the system when None) is outside every rectangle, ``margin`` pixels beyond its edge included.
Not Windows: True, there is no OS cursor that reaches a window."""
if cursor is None:
api = api or _api()
if api is None:
return True
cursor = api.cursor_position()
return not any(_contains(_inflate(r, margin), cursor) for r in window_rects)
def park_outside(window_rects: Sequence[Rect], screen_rect: Rect, margin: int = MARGIN) -> Point:
"""A pixel of the virtual screen that is at least ``margin`` pixels from every window rectangle: the bottom-right corner when it is free.
``screen_rect`` is ``(left, top, right, bottom)`` of the virtual screen, ``right`` and ``bottom`` exclusive (its origin is negative when a monitor lies left of or
above the primary one). The candidates are the screen's edges and the places just beyond each window's inflated edges; a free pixel exists only if one
of them is free (the free pixel can be slid left and up until it touches an edge, and it stays free), so a ``TheCursorCannotBeParked`` is exact."""
left, top, right, bottom = screen_rect
if right <= left or bottom <= top:
raise TheCursorCannotBeParked(
"park_outside: the virtual screen %r is empty. Where: the screen rectangle read from the system. What: no pixel to put the cursor on. "
"Fix: run the e2e on an interactive desktop session." % (screen_rect,))
inflated = [_inflate(r, margin) for r in window_rects]
xs = sorted({right - 1, left, *(min(max(r[2], left), right - 1) for r in inflated), *(min(max(r[0] - 1, left), right - 1) for r in inflated)},
reverse=True)
ys = sorted({bottom - 1, top, *(min(max(r[3], top), bottom - 1) for r in inflated), *(min(max(r[1] - 1, top), bottom - 1) for r in inflated)},
reverse=True)
for y in ys:
for x in xs:
if not any(_contains(r, (x, y)) for r in inflated):
return (x, y)
raise TheCursorCannotBeParked(
"park_outside: the windows %r cover every pixel of the screen %r with a margin of %d. Where: the headed browser window the test launched. What: the "
"OS cursor would be over the page whatever the point, and a native mouse move would reach it. Fix: shrink the window below the screen (the test's own "
"geometry; it is not this helper's to change) or run the test on a bigger desktop." % (list(window_rects), screen_rect, margin))
class _Win32:
"""What the desktop answers, by ``user32``. One object so a test can stand a fake in for it."""
def __init__(self) -> None:
from ctypes import wintypes
self.wintypes = wintypes
self.user32 = ctypes.WinDLL("user32", use_last_error=True)
u = self.user32
u.GetCursorPos.argtypes = (ctypes.POINTER(wintypes.POINT),)
u.GetCursorPos.restype = wintypes.BOOL
u.SetCursorPos.argtypes = (ctypes.c_int, ctypes.c_int)
u.SetCursorPos.restype = wintypes.BOOL
u.GetSystemMetrics.argtypes = (ctypes.c_int,)
u.GetSystemMetrics.restype = ctypes.c_int
u.GetWindowRect.argtypes = (wintypes.HWND, ctypes.POINTER(wintypes.RECT))
u.GetWindowRect.restype = wintypes.BOOL
u.IsWindowVisible.argtypes = (wintypes.HWND,)
u.IsWindowVisible.restype = wintypes.BOOL
u.IsIconic.argtypes = (wintypes.HWND,)
u.IsIconic.restype = wintypes.BOOL
u.GetWindowThreadProcessId.argtypes = (wintypes.HWND, ctypes.POINTER(wintypes.DWORD))
u.GetWindowThreadProcessId.restype = wintypes.DWORD
self.enum_proc = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
u.EnumWindows.argtypes = (self.enum_proc, wintypes.LPARAM)
u.EnumWindows.restype = wintypes.BOOL
def cursor_position(self) -> Point:
point = self.wintypes.POINT()
if not self.user32.GetCursorPos(ctypes.byref(point)):
raise TheCursorCannotBeParked(
"GetCursorPos failed (error %d). Where: user32, on the desktop the test runs on. What: the OS cursor cannot be read. Fix: run the e2e on an "
"interactive desktop session (not a locked screen or a service)." % ctypes.get_last_error())
return (point.x, point.y)
def set_cursor_position(self, x: int, y: int) -> None:
self.user32.SetCursorPos(x, y)
def screen(self) -> Rect:
"""The virtual screen: ``SM_XVIRTUALSCREEN``, ``SM_YVIRTUALSCREEN``, ``SM_CXVIRTUALSCREEN``, ``SM_CYVIRTUALSCREEN``."""
x, y, w, h = (self.user32.GetSystemMetrics(n) for n in (76, 77, 78, 79))
return (x, y, x + w, y + h)
def windows_below(self, root_pid: int) -> List[Rect]:
"""The rectangles of the visible, not minimised, top-level windows of the processes below ``root_pid``."""
import psutil
try:
pids = {p.pid for p in psutil.Process(root_pid).children(recursive=True)}
except psutil.Error:
return []
found: List[Rect] = []
def each(hwnd, _):
owner = self.wintypes.DWORD()
self.user32.GetWindowThreadProcessId(hwnd, ctypes.byref(owner))
if owner.value in pids and self.user32.IsWindowVisible(hwnd) and not self.user32.IsIconic(hwnd):
rect = self.wintypes.RECT()
if self.user32.GetWindowRect(hwnd, ctypes.byref(rect)) and rect.right > rect.left and rect.bottom > rect.top:
found.append((rect.left, rect.top, rect.right, rect.bottom))
return True
self.user32.EnumWindows(self.enum_proc(each), 0)
return found
def _is_windows() -> bool:
return sys.platform == "win32"
def _api() -> Optional[_Win32]:
return _Win32() if _is_windows() else None
def browser_windows(root_pid: Optional[int] = None, *, api: Optional[_Win32] = None) -> List[Rect]:
"""The rectangles of the windows of the browsers below ``root_pid`` (the test process by default) on this desktop; empty when not Windows."""
api = api or _api()
if api is None:
return []
return api.windows_below(os.getpid() if root_pid is None else root_pid)
def park(root_pid: Optional[int] = None, *, api: Optional[_Win32] = None) -> Optional[Point]:
"""Windows: put the OS cursor on a point no window of the browsers below ``root_pid`` covers and read it back. Returns the point; None when not Windows.
Called before the browser starts there is no window yet and the point is the bottom-right corner of the virtual screen, where the engine places no window."""
api = api or _api()
if api is None:
return None
target = park_outside(api.windows_below(os.getpid() if root_pid is None else root_pid), api.screen())
api.set_cursor_position(*target)
read_back = api.cursor_position()
if read_back != target:
raise TheCursorCannotBeParked(
"SetCursorPos(%d, %d) left the cursor at %r. Where: user32, on the desktop the test runs on. What: the OS cursor cannot be moved, so a native "
"mouse move for it can reach a window of the browser mid-gesture. Fix: run the e2e on an interactive desktop session (not a locked screen "
"or a service), with no other program holding the cursor." % (target[0], target[1], read_back))
return target
def require_outside(root_pid: Optional[int] = None, *, api: Optional[_Win32] = None, margin: int = 0) -> None:
"""The precondition of a gesture a test judges by the pointer events the page records: the OS cursor is outside every window of the browsers.
Raises ``TheCursorIsInside`` otherwise, with the cursor and the windows. Not Windows: nothing."""
api = api or _api()
if api is None:
return
windows = api.windows_below(os.getpid() if root_pid is None else root_pid)
cursor = api.cursor_position()
if not cursor_is_outside(windows, cursor, margin):
raise TheCursorIsInside(
"the OS cursor is at %r, inside the browser window(s) %r, when a pointer gesture is about to start. Where: the desktop the test runs on. What: "
"a native WM_MOUSEMOVE for it passes Gecko's first-move filter and reaches the page as a mousemove with buttons=0 at a moment of the "
"system's choosing, in the middle of the gesture the test records. Fix: park the cursor outside the window before the browser starts "
"(the autouse fixture `_the_os_cursor_is_outside_the_browser_window` of tests/conftest.py does it for every e2e test on Windows)." % (cursor, windows))
+151
View File
@@ -0,0 +1,151 @@
"""What a popup twin records about each element it clicks, so that a red run says what the click and the geometry were, and a green run leaves the numbers to compare.
A twin that clicks an element and waits for a popup (the select dropdown) used to say "the dropdown did not open" and nothing about the click: where it was sent, at which scale, what the
element's box was in its document and in the window, and what the popup was doing. This module is what the twin keeps for each element, and writes:
* ``click``: the point in CSS pixels, and the point the driver sent (the unit it is in and the device point it makes: CSS times the scale the driver knows);
* ``scales``: the record of ``Driver.scales()`` (the page's and the chrome's ``devicePixelRatio`` and the real scale of the screen), once per browser;
* ``select_rect``: ``getBoundingClientRect`` of the element inside its own document, and, for an element of a frame, ``iframe_rect``: the frame element's box in the top document;
* ``mozInnerScreen``: ``window.mozInnerScreenX/Y`` of the top document and, for a frame, of the frame's document;
* ``activation_at_click`` and ``activation_after_click``: whether the window was the active one, and had the focus, when the click was sent and right after (``look_at_activation``): chrome
``Services.focus.activeWindow === win``, ``win.document.hasFocus()``, the browsing context's ``isActive`` (``win.gBrowser.selectedBrowser.browsingContext.isActive``), the top content document's
``hasFocus()`` and ``visibilityState``, and the driver's ack of the click when it has one (``last_click_ack``); a popup that does not open for a window that was not active is not a popup that is at the wrong place;
* ``popup``: the state after the click (the first look), the last look of the wait (at the deadline) and, when the popup did not reach the state, a second look (the select test: a short wait on the same condition, so that a popup that comes late is seen to come late).
A read that fails is recorded in ``errors`` and never raised: the diagnosis must not replace the finding. The record is in the message of the failure and, on a runner (``RUNNER_TEMP`` set), in
``$RUNNER_TEMP/invpw-evidence/popup-diagnostics/<case>-<browser>.json``, the folder every e2e job uploads (see ``_watchdog_log``), whatever the result.
"""
from __future__ import annotations
import json
import os
from pathlib import Path
from typing import Any, Dict, Mapping, Optional, Sequence
from _watchdog_log import EVIDENCE_FOLDER
#: The folder of this evidence inside ``$RUNNER_TEMP/invpw-evidence``.
SUBFOLDER = "popup-diagnostics"
#: The top document: the element's box, the frame element's box, the window's place on the screen. Both ids are given by the page of the twin.
TOP_GEOMETRY_JS = """(() => {
const box = id => { const e = document.getElementById(id); if (!e) { return null; } const b = e.getBoundingClientRect(); return {x: b.x, y: b.y, w: b.width, h: b.height}; };
return {select: box(%(select)s), iframe: box(%(iframe)s), mozInnerScreen: [window.mozInnerScreenX, window.mozInnerScreenY], scroll: [window.scrollX, window.scrollY]};
})()"""
#: The document of a frame: the element's box inside it and its own place on the screen.
FRAME_GEOMETRY_JS = """(() => {
const e = document.getElementById(%(select)s); const b = e ? e.getBoundingClientRect() : null;
return {select: b && {x: b.x, y: b.y, w: b.width, h: b.height}, mozInnerScreen: [window.mozInnerScreenX, window.mozInnerScreenY], scroll: [window.scrollX, window.scrollY]};
})()"""
#: Chrome scope: the window's activation and focus, and the browsing context of the selected tab. ``win`` is the most recent browser window, as every chrome script of the twins reads it.
ACTIVATION_JS = """
const win = Services.wm.getMostRecentWindow("navigator:browser");
return JSON.stringify({
active_window: Services.focus.activeWindow === win,
window_has_focus: win.document.hasFocus(),
browsing_context_is_active: win.gBrowser.selectedBrowser.browsingContext.isActive,
});
"""
#: The top content document, read through the driver (``driver.eval``): the same expression on every driver.
CONTENT_ACTIVATION_JS = """(() => ({hasFocus: document.hasFocus(), visibilityState: document.visibilityState}))()"""
def _failed(exc: BaseException) -> str:
return "%s: %s" % (type(exc).__name__, str(exc)[:300])
def look_at_geometry(driver: Any, in_frame: bool, select_id: str = "s", frame_id: str = "f") -> Dict[str, Any]:
"""The boxes and the window's place for one element, read before the click. ``driver.eval`` reads the top document, ``driver.eval_in_frame`` the frame's.
A read that fails leaves its field out and says why in ``errors``."""
ids = {"select": json.dumps(select_id), "iframe": json.dumps(frame_id)}
out: Dict[str, Any] = {"errors": {}}
top: Optional[Dict[str, Any]] = None
try:
top = driver.eval(TOP_GEOMETRY_JS % ids)
except Exception as exc: # noqa: BLE001 the diagnosis never replaces the finding
out["errors"]["top_document"] = _failed(exc)
top = top or {}
out["mozInnerScreen"] = {"top": top.get("mozInnerScreen")}
if not in_frame:
out["select_rect"] = top.get("select")
out["iframe_rect"] = None
else:
out["iframe_rect"] = top.get("iframe")
try:
inner = driver.eval_in_frame(FRAME_GEOMETRY_JS % ids)
out["select_rect"] = inner.get("select")
out["mozInnerScreen"]["frame"] = inner.get("mozInnerScreen")
except Exception as exc: # noqa: BLE001
out["errors"]["frame_document"] = _failed(exc)
out["select_rect"] = None
out["mozInnerScreen"]["frame"] = None
if not out["errors"]:
del out["errors"]
return out
def look_at_activation(driver: Any) -> Dict[str, Any]:
"""The window's activation and focus now: the chrome's (``ACTIVATION_JS``), the top content document's (``CONTENT_ACTIVATION_JS``) and the driver's ack of the click, when it keeps one
(``last_click_ack``, None otherwise). A read that fails leaves its part out and says why in ``errors``; the diagnosis never replaces the finding."""
out: Dict[str, Any] = {"errors": {}}
try:
out["chrome"] = driver.chrome.script(ACTIVATION_JS)
except Exception as exc: # noqa: BLE001
out["errors"]["chrome"] = _failed(exc)
try:
out["content"] = driver.eval(CONTENT_ACTIVATION_JS)
except Exception as exc: # noqa: BLE001
out["errors"]["content"] = _failed(exc)
out["click_ack"] = getattr(driver, "last_click_ack", None)
if not out["errors"]:
del out["errors"]
return out
def click_record(driver: Any, css: Sequence[float]) -> Dict[str, Any]:
"""The click as asked (CSS pixels) and as the driver sent it (``driver.last_click``: the point, its unit, the device point), as the driver wrote it."""
return {"css": list(css), "sent": getattr(driver, "last_click", None)}
class Diagnostics:
"""The record of one browser on one case: its scales and one entry per element."""
def __init__(self, case: str, browser: str) -> None:
self.case, self.browser = case, browser
self.scales: Optional[Dict[str, Any]] = None
self.entries: Dict[str, Dict[str, Any]] = {}
self.save_error: Optional[str] = None
def entry(self, name: str) -> Dict[str, Any]:
return self.entries.setdefault(name, {})
def record(self) -> Dict[str, Any]:
return {"case": self.case, "browser": self.browser, "scales": self.scales, "elements": self.entries}
def message(self, headline: str, name: str) -> str:
"""``headline``, then everything known about the element ``name`` and the scales, as one JSON line a reader can paste."""
body = {"case": self.case, "browser": self.browser, "element": name, "scales": self.scales, **self.entries.get(name, {})}
return "%s\n diagnostics: %s" % (headline, json.dumps(body, sort_keys=True))
def path(self, environ: Mapping[str, str]) -> Optional[Path]:
runner = environ.get("RUNNER_TEMP")
if not runner:
return None
return Path(runner) / EVIDENCE_FOLDER / SUBFOLDER / ("%s-%s.json" % (self.case, self.browser))
def save(self, environ: Optional[Mapping[str, str]] = None) -> Optional[Path]:
"""Writes the record where the jobs upload it; None off a runner. A failed write is kept in ``save_error`` and never raised: this runs while a finding may be on its way up."""
path = self.path(os.environ if environ is None else environ)
if path is None:
return None
try:
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(self.record(), indent=1, sort_keys=True) + "\n", encoding="utf-8")
except OSError as exc:
self.save_error = _failed(exc)
return None
return path
+6 -5
View File
@@ -20,11 +20,12 @@ from _waits import wait_until
#: 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
#: A second declared window frame that no runner has: a border of 6 and a popup UI of 53 above the content. The declared frame at scale 1.0 (8, 72) 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). The position of an unpositioned popup is not
#: declared: it is Firefox's own rule (browser.xhtml screenX/screenY = 4, the stagger, the clamp), the same under every frame.
OTHER_FRAME = {"zoom.stealth.screen.frame_border": 6, "zoom.stealth.screen.popup_ui": 53}
OTHER_BORDER, OTHER_POPUP_UI = 6, 53
READ = """() => ({iw: innerWidth, ih: innerHeight, ow: outerWidth, oh: outerHeight,
sx: screenX, sy: screenY, mx: mozInnerScreenX, my: mozInnerScreenY})"""
+384
View File
@@ -0,0 +1,384 @@
"""The retail reference of the chrome-scope twins: RETAIL Firefox 159, driven by Marionette alone (no Playwright), headed on a display of its own (the wrapper's mechanism); and one driver for it and for ours.
Playwright's own Firefox is not a reference for the popups the browser chrome opens (a select dropdown, a tooltip): nothing says its build takes ``-marionette``, and it is not the
browser a user runs. The reference of these twins is the official retail build, the one the capture rounds of RetailCaptures measured. The chrome-scope relations (the popup against its
element, the tooltip against the pointer) are read in the same way on both sides, from chrome scope through Marionette; the page and its input are driven by one small interface (``Driver``):
``goto``, ``eval`` (a JavaScript expression of the top document, as JSON), ``move``, ``click`` (the point of the top document, CSS pixels), ``wait_for_timeout`` and ``chrome``.
WHERE THE RETAIL BINARY COMES FROM. The file named by the environment variable ``INVPW_RETAIL_FIREFOX`` (the path of ``firefox.exe`` on Windows, of ``firefox`` on Linux, where the reference is Mozilla's own Linux 159 build, fetched and verified the same way
and extracted to ``<work>/extracted/firefox/firefox``): a missing variable or file is RED ("MISSING REFERENCE, reference unavailable"), never a skip. The launcher is the same on both: no ``.exe``, the display is one of its own, made as the wrapper makes ours (``_stock_twin.OwnDisplay``: ``make_virtual_display()``, an Xvfb on Linux, the desktop of the job on Windows), not the job's: the rows run pytest without xvfb-run.
The legs of the rows ``wrapper.e2e.stock_twin.select`` and ``wrapper.e2e.stock_twin.tooltip`` put it there with the mechanism the retail captures already use, in the repository oss-invisible/core: ``scripts/retail/firefox_build.py fetch
--version 159.0 --work DIR`` (it downloads ``Firefox Setup 159.0.exe`` and SHA256SUMS and SHA256SUMS.asc from archive.mozilla.org, checks the signature against the release key committed in
``captures/runner/``, checks the installer's sha256 against SHA256SUMS, extracts it with 7z and writes DIR/build.json with the path of firefox.exe).
HOW IT IS LAUNCHED (what ``scripts/retail/window_geometry/run_scale.py`` does for the captures): ``firefox -no-remote -profile <empty directory> -marionette``, with ``-remote-allow-system-access`` for the
chrome scope; the profile holds only ``user.js`` with ``marionette.port`` 0 (a free port, written to ``MarionetteActivePort``) and ``layout.css.devPixelsPerPx`` (the display scale of the case, the pref
ours and stock are launched with), and the prefs that stop the first-run pages. No policy file. The browser is closed with its whole tree when the block ends.
"""
from __future__ import annotations
import json
import os
import shutil
import subprocess
import tempfile
import time
from pathlib import Path
from typing import Any, Callable, Dict, Optional, Tuple
from _stock_twin import MARIONETTE_ARGS, SCALES_JS, BrokenControl, Chrome, OwnDisplay
from _waits import wait_until
from _window_origin import CASES, DEADLINE_S, launch_case
ENV_VARIABLE = "INVPW_RETAIL_FIREFOX"
#: What the profile of the retail browser holds besides the two prefs of the case: the first-run pages and the updater are off, nothing else.
PROFILE_PREFS = {
"marionette.port": 0,
"browser.shell.checkDefaultBrowser": False,
"browser.aboutwelcome.enabled": False,
"browser.startup.page": 0,
"browser.startup.homepage": "about:blank",
"startup.homepage_welcome_url": "",
"startup.homepage_override_url": "",
"browser.startup.homepage_override.mstone": "ignore",
"datareporting.policy.dataSubmissionPolicyBypassNotification": True,
"toolkit.telemetry.reportingpolicy.firstRun": False,
"app.update.auto": False,
"app.update.checkInstallTime": False,
"browser.tabs.warnOnClose": False,
}
PAGE_SCALES_EXPR = "({devicePixelRatio: window.devicePixelRatio, inner: [innerWidth, innerHeight], screen: [screen.width, screen.height]})"
class MissingReference(AssertionError):
"""No retail binary to compare with: red, and no finding about ours."""
def retail_executable() -> str:
path = os.environ.get(ENV_VARIABLE, "")
if not path or not Path(path).is_file():
raise MissingReference("MISSING REFERENCE, no finding about ours: %s names no retail Firefox 159 (%r). The leg of the rows wrapper.e2e.stock_twin.select and wrapper.e2e.stock_twin.tooltip installs it with "
"oss-invisible/core scripts/retail/firefox_build.py fetch --version 159.0 and sets the variable to the path of firefox.exe" % (ENV_VARIABLE, path))
return path
def _user_js(prefs: Dict[str, Any]) -> str:
return "".join("user_pref(%s, %s);\n" % (json.dumps(name), json.dumps(value)) for name, value in sorted(prefs.items()))
class Driver:
"""What a twin does with a page, on any browser. ``chrome.script(js, args)`` is chrome scope through Marionette."""
chrome: Any
#: Which browser this is, in the names of a record and of its evidence file.
kind = "driver"
#: The last ``click``, as the driver sent it: ``{"point": [x, y], "unit": ..., "device": [x, y]}`` (None before the first click).
last_click: Optional[Dict[str, Any]] = None
def goto(self, url: str) -> None:
raise NotImplementedError
def eval(self, expression: str) -> Any:
"""The value of a JavaScript expression in the top document (a JSON-able value)."""
raise NotImplementedError
def eval_in_frame(self, expression: str) -> Any:
"""The value of a JavaScript expression in the document of the first frame of the top document (a JSON-able value)."""
raise NotImplementedError
def move(self, x: float, y: float, steps: int = 1) -> None:
raise NotImplementedError
def click(self, x: float, y: float) -> None:
raise NotImplementedError
def wait_for_timeout(self, ms: int) -> None:
raise NotImplementedError
def scales(self) -> Dict[str, Any]:
"""The record of the scales: the page's (declared) and the chrome's, with the real ones of the screen."""
out = {"page": self.eval(PAGE_SCALES_EXPR)}
out.update(self.chrome.script(SCALES_JS))
return out
class PlaywrightDriver(Driver):
"""Ours: a page of the wrapper's client, and the chrome of the engine through Marionette."""
kind = "ours"
def __init__(self, page, chrome: Chrome) -> None:
self.page, self.chrome = page, chrome
def goto(self, url: str) -> None:
self.page.goto(url, wait_until="load", timeout=30000)
def eval(self, expression: str) -> Any:
return self.page.evaluate("() => (%s)" % expression)
def eval_in_frame(self, expression: str) -> Any:
frames = [frame for frame in self.page.frames if frame != self.page.main_frame]
return frames[0].evaluate("() => (%s)" % expression)
def move(self, x: float, y: float, steps: int = 1) -> None:
self.page.mouse.move(x, y, steps=steps)
def click(self, x: float, y: float) -> None:
# the client sends the point in CSS pixels of the page; the device point is that times the page's (declared) scale
try:
scale = self.page.evaluate("() => window.devicePixelRatio")
device: Optional[list] = [x * scale, y * scale]
except Exception: # noqa: BLE001 a record of the click never stops the click
device = None
self.last_click = {"point": [x, y], "unit": "CSS pixels of the page, as page.mouse.click sends them", "device": device}
self.page.mouse.click(x, y)
def wait_for_timeout(self, ms: int) -> None:
self.page.wait_for_timeout(ms)
class RetailChrome:
def __init__(self, session: "RetailSession") -> None:
self._session = session
def script(self, script: str, args: Tuple[Any, ...] = ()) -> Dict[str, Any]:
return json.loads(self._session.call("chrome", "WebDriver:ExecuteScript", {"script": script, "args": list(args)})["value"])
#: Moves and presses at a point of the browser's content, from chrome, through the widget: a point of the top document (CSS pixels) plus the content area's own place in the window. Firefox 159's chrome
#: input is ``Window.synthesizeMouseEvent`` (offsets in CSS pixels of that window, a dictionary of Mozilla's fields for the event and one for the options); ``nsIDOMWindowUtils`` has no ``sendMouseEvent``
#: in 159 (tests/test_the_chrome_calls_of_the_tests_exist_in_firefox.py reads the names from Mozilla's sources). ``inputSource: 1`` is a mouse, as a user's.
#: ``isAsyncEnabled: true`` is the field of Mozilla's SynthesizeMouseEventOptions that Mozilla's own EventUtils.js sets when a test asks for ``asyncEnabled`` (EventUtils.js, synthesizeMouse, around
#: lines 784-851, passes it as ``isAsyncEnabled``). Without it (the webidl default is false) nsContentUtils::SendMouseEvent dispatches through ``widget->DispatchEvent`` and never through APZ
#: (nsContentUtils.cpp 10552-10560 at FIREFOX_159_0_RELEASE), the event has no valid layers id, and EventStateManager::DispatchCrossProcessEvent falls back to the TOP process
#: (EventStateManager.cpp 2199): a frame in another process never gets the move or the click, and the tooltip and the select of that frame fail on retail for a reason that is the driver's.
SEND_JS = """
const [type, x, y, button, clicks] = arguments;
const win = Services.wm.getMostRecentWindow("navigator:browser");
const b = win.gBrowser.selectedBrowser.getBoundingClientRect();
win.focus();
win.synthesizeMouseEvent(type, b.left + x, b.top + y, {button, clickCount: clicks, modifiers: 0, inputSource: 1}, {ignoreRootScrollFrame: false, isDOMEventSynthesized: true, isAsyncEnabled: true});
return JSON.stringify({ok: true, at: [b.left + x, b.top + y], dpr: win.devicePixelRatio});
"""
SIZE_JS = """
const win = Services.wm.getMostRecentWindow("navigator:browser");
return JSON.stringify({outer: [win.outerWidth, win.outerHeight], inner: [win.innerWidth, win.innerHeight]});
"""
#: Sets the outer size of the window in DEVICE pixels, from chrome scope: ``WebDriver:SetWindowRect`` takes whole CSS pixels only, and at a display scale of 2 the content area that ours declares
#: (``innerHeight`` 558.5 at 2.0) is an odd number of device pixels, which no whole CSS size of the outer window gives. ``resizeTo`` is this call after the conversion of CSS pixels to device pixels
#: (nsGlobalWindowOuter::SetOuterSize -> nsIBaseWindow.setSize), so the window is the same one.
RESIZE_JS = """
const [width, height] = arguments;
const win = Services.wm.getMostRecentWindow("navigator:browser");
const scale = win.devicePixelRatio;
win.docShell.treeOwner.QueryInterface(Ci.nsIBaseWindow).setSize(Math.round(width * scale), Math.round(height * scale), true);
return JSON.stringify({ok: true});
"""
#: Sizes the window so that its content area (``innerWidth`` x ``innerHeight`` of the chrome window, fractional CSS pixels) is the one asked, and reads the window's own frame in DEVICE pixels in the same
#: chrome read: frame = ``nsIBaseWindow.getSize`` (the whole window, device pixels) less the content area in device pixels (``inner * devicePixelRatio``, whole device pixels as the widget gives them).
#: The window is then set to the asked content area plus that frame, all in device pixels, so an odd number of device pixels (558.5 CSS = 1117 device at a scale of 2) is reachable, which no whole CSS
#: ``outerHeight`` is: ``outerWidth`` and ``outerHeight`` are whole CSS pixels (nsGlobalWindowOuter::GetOuterSize rounds, nsGlobalWindowOuter.cpp:3573), ``innerWidth`` and ``innerHeight`` are not.
CONTENT_JS = """
const [width, height] = arguments;
const win = Services.wm.getMostRecentWindow("navigator:browser");
const scale = win.devicePixelRatio;
const base = win.docShell.treeOwner.QueryInterface(Ci.nsIBaseWindow);
const w = {}, h = {};
base.getSize(w, h);
const frame = [w.value - Math.round(win.innerWidth * scale), h.value - Math.round(win.innerHeight * scale)];
const asked = [Math.round(width * scale) + frame[0], Math.round(height * scale) + frame[1]];
base.setSize(asked[0], asked[1], true);
return JSON.stringify({frame, asked, scale});
"""
class RetailSession:
"""Retail Firefox 159 with Marionette, headed, one profile; closed with its whole tree."""
def __init__(self, executable: str, dpr: float) -> None:
self.executable, self.dpr = executable, dpr
self._context: Optional[str] = None
self._process: Optional[subprocess.Popen] = None
self._profile: Optional[str] = None
self._marionette = None
self._display: Optional[OwnDisplay] = None
def __enter__(self) -> "RetailSession":
import webfont_probe
try:
self._profile = tempfile.mkdtemp(prefix="invpw-retail-")
prefs = dict(PROFILE_PREFS)
prefs["layout.css.devPixelsPerPx"] = str(self.dpr)
Path(self._profile, "user.js").write_text(_user_js(prefs), encoding="utf-8")
self._display = OwnDisplay().__enter__()
env = self._display.environ(dict(os.environ, MOZ_REMOTE_ALLOW_SYSTEM_ACCESS="1", MOZ_CRASHREPORTER_DISABLE="1"))
self._process = subprocess.Popen([self.executable, "-no-remote", "-profile", self._profile] + MARIONETTE_ARGS + ["about:blank"], env=env,
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
port = webfont_probe.marionette_active_port(Path(self._profile), timeout=120)
self._marionette = webfont_probe._Marionette(port)
self._marionette.call("WebDriver:NewSession", {"capabilities": {"alwaysMatch": {}}})
except BaseException:
self.__exit__(None, None, None)
raise
return self
def call(self, context: str, command: str, params: Dict[str, Any]) -> Any:
if self._context != context:
self._marionette.call("Marionette:SetContext", {"value": context})
self._context = context
return self._marionette.call(command, params)
def set_window_size(self, outer: Tuple[float, float]) -> Dict[str, Any]:
"""Sets the window's outer size to ``outer`` (CSS pixels of the chrome) and reads back the sizes the chrome window answers. The first call also puts it at the origin of the screen.
Whole numbers go through Marionette (``WebDriver:SetWindowRect``, which takes only those); a size with a fraction (a content area of an odd number of device pixels at a scale of 2) is set
from chrome scope in device pixels (``RESIZE_JS``)."""
if all(float(v).is_integer() for v in outer):
self.call("content", "WebDriver:SetWindowRect", {"x": 0, "y": 0, "width": int(outer[0]), "height": int(outer[1])})
else:
self.call("chrome", "WebDriver:ExecuteScript", {"script": RESIZE_JS, "args": [outer[0], outer[1]]})
read = SIZE_JS
out: Dict[str, Any] = {}
for _ in range(int(DEADLINE_S * 10)):
out = json.loads(self.call("chrome", "WebDriver:ExecuteScript", {"script": read, "args": []})["value"])
if out["outer"] == [outer[0], outer[1]]:
break
time.sleep(0.1)
return out
def set_inner_size(self, inner: Tuple[float, float]) -> Dict[str, Any]:
"""Sets the window so that its content area is ``inner`` (CSS pixels of the chrome, fractions allowed) and reads back what the chrome window answers. The window is put at the origin of the screen.
The frame is read in device pixels through the chrome (``CONTENT_JS``) and the window is set to ``inner`` plus that frame in device pixels. The answer has ``outer`` and ``inner`` (CSS pixels, as
the window reads them: ``outer`` is whole), ``frame_device`` and ``asked_outer`` (device pixels, and the same in CSS pixels, the last fractional)."""
self.call("content", "WebDriver:SetWindowRect", {"x": 0, "y": 0})
asked = json.loads(self.call("chrome", "WebDriver:ExecuteScript", {"script": CONTENT_JS, "args": [inner[0], inner[1]]})["value"])
out: Dict[str, Any] = {}
for _ in range(int(DEADLINE_S * 10)):
out = json.loads(self.call("chrome", "WebDriver:ExecuteScript", {"script": SIZE_JS, "args": []})["value"])
if out["inner"] == [inner[0], inner[1]]:
break
time.sleep(0.1)
out.update({"frame_device": asked["frame"], "asked_outer_device": asked["asked"], "asked_outer": [asked["asked"][i] / asked["scale"] for i in range(2)]})
return out
def __exit__(self, *exc) -> None:
if self._marionette is not None:
self._marionette.close()
if self._process is not None:
try:
import psutil
root = psutil.Process(self._process.pid)
for child in root.children(recursive=True):
try:
child.kill()
except psutil.Error:
pass
root.kill()
except Exception: # the process is gone already
pass
try:
self._process.wait(30)
except Exception:
pass
if self._display is not None:
self._display.__exit__(None, None, None)
self._display = None
if self._profile is not None:
shutil.rmtree(self._profile, ignore_errors=True)
class RetailDriver(Driver):
kind = "retail"
def __init__(self, session: RetailSession) -> None:
self.session = session
self.chrome = RetailChrome(session)
def goto(self, url: str) -> None:
self.session.call("content", "WebDriver:Navigate", {"url": url})
wait_until(lambda: self.eval("document.readyState") == "complete", DEADLINE_S, lambda: self.wait_for_timeout(100))
def eval(self, expression: str) -> Any:
value = self.session.call("content", "WebDriver:ExecuteScript", {"script": "return JSON.stringify(%s);" % expression, "args": []})["value"]
return json.loads(value) if value is not None else None
def eval_in_frame(self, expression: str) -> Any:
"""Through Marionette: the first frame element becomes the context of the script, and the top document is the context again when the read ends."""
found = self.session.call("content", "WebDriver:FindElement", {"using": "css selector", "value": "iframe"})["value"]
self.session.call("content", "WebDriver:SwitchToFrame", {"id": found})
try:
value = self.session.call("content", "WebDriver:ExecuteScript", {"script": "return JSON.stringify(%s);" % expression, "args": []})["value"]
finally:
self.session.call("content", "WebDriver:SwitchToParentFrame", {})
return json.loads(value) if value is not None else None
def _send(self, kind: str, x: float, y: float, button: int = 0, clicks: int = 0) -> Dict[str, Any]:
return self.chrome.script(SEND_JS, (kind, x, y, button, clicks))
def move(self, x: float, y: float, steps: int = 1) -> None:
# the pointer comes to the point in ``steps`` moves from the last one it made (a move to the point it is on makes no event, as on every browser)
last = getattr(self, "_at", (x - 1, y - 1))
for i in range(1, steps + 1):
self._send("mousemove", last[0] + (x - last[0]) * i / steps, last[1] + (y - last[1]) * i / steps)
self._at = (x, y)
def click(self, x: float, y: float) -> None:
self.move(x, y)
down = self._send("mousedown", x, y, 0, 1)
self._send("mouseup", x, y, 0, 1)
# the point goes to the window's widget in CSS pixels of the chrome (the content area's place added); the device point is that times the chrome's scale
at, scale = down.get("at"), down.get("dpr")
self.last_click = {"point": at, "unit": "CSS pixels of the chrome window, as Window.synthesizeMouseEvent takes them",
"device": [at[0] * scale, at[1] * scale] if at and scale else None}
def wait_for_timeout(self, ms: int) -> None:
time.sleep(ms / 1000.0)
def size_by_content(session: Any, ours_inner: Any) -> Tuple[list, Dict[str, Any]]:
"""``(asked, got)``: the retail window sized so that its content area (``inner``) is the one of ours, whatever its frame is.
Ours declares a frame of its own (the one of a Windows window), and the retail window has the one of its system and display (none on Xvfb without a window manager, 8x4 CSS pixels at a scale of 2 on
a Windows runner), so the same OUTER size is not the same content area. The frame is read in exact device pixels through the chrome (``RetailSession.set_inner_size``) and the window is asked
ours' inner size plus that frame. ``asked`` is the outer size asked (CSS pixels, fractional when the device pixels are odd at the scale), ``got`` what the window answers to it. The outer size the
window reads back is not compared with ``asked``: ``outerWidth`` and ``outerHeight`` are whole CSS pixels (nsGlobalWindowOuter::GetOuterSize rounds, nsGlobalWindowOuter.cpp:3573), ``innerWidth``
and ``innerHeight`` are fractional, so a content area of an odd number of device pixels at a scale of 2 has no outer size that reads back as asked."""
got = session.set_inner_size((ours_inner[0], ours_inner[1]))
return list(got["asked_outer"]), got
def run_retail_twin(case: str, firefox_binary: str, measure: Callable[[Driver], Dict[str, Any]]) -> Tuple[Dict[str, Any], Dict[str, Any]]:
"""(retail's record, ours): the same ``measure(driver)`` on our engine and on the retail reference, one browser at a time. Needs MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1 for ours.
Ours goes first, for its window: the retail window is given the SAME content area as ours (the maximized window of the case's declared screen, as ``launch_case`` makes it, read from the chrome
window's ``innerWidth`` and ``innerHeight``) by ``size_by_content``: ours' inner size plus the frame the retail window shows, read in device pixels. The inner sizes both chrome windows answer are
compared before anything is measured: when they differ the verdict is BROKEN CONTROL, not a finding about ours. The outer size the retail window reads back is not a condition (it is whole CSS
pixels). Both sizes are in each record (``scales.chrome_outer``, ``scales.chrome_inner``), with the outer size the retail window was asked (``scales.window_asked_outer``)."""
executable = retail_executable()
with launch_case(firefox_binary, case, extra_args=MARIONETTE_ARGS, extra_prefs={"marionette.port": 0}) as browser:
page = browser.new_page() # first: the window the session below waits for
chrome = Chrome(page)
try:
ours = measure(PlaywrightDriver(page, chrome))
finally:
chrome.close()
with RetailSession(executable, CASES[case][0]) as session:
asked, got = size_by_content(session, ours["scales"]["chrome_inner"])
if got.get("inner") != ours["scales"]["chrome_inner"]:
raise BrokenControl("BROKEN CONTROL, no finding about ours: the retail window was asked the outer size %r (the content area of ours %r plus its own frame; the outer size of ours is %r) and answers outer %r and inner %r; "
"ours has inner %r (case %s)"
% (asked, ours["scales"]["chrome_inner"], ours["scales"]["chrome_outer"], got.get("outer"), got.get("inner"), ours["scales"]["chrome_inner"], case))
retail = measure(RetailDriver(session))
retail["scales"]["window_asked_outer"] = asked
return retail, ours
+111
View File
@@ -0,0 +1,111 @@
"""The stack watchdog of the e2e tests: a Python thread that writes the stack of every thread of the process, holding the GIL.
``tests/conftest.py`` arms it for each e2e test and cancels it in the teardown. Once the threshold of a test is passed, and then every period until the
test ends, it appends one dump to the file it was given: ``Timeout (h:mm:ss)!`` (the time since the arming) and then, for every thread, ``Thread 0x... (most
recent call first):`` and its frames as `` File "...", line N in name``. Two identical dumps mean a stuck test, two different ones a slow test.
Why a Python thread and not ``faulthandler.dump_traceback_later``: that watchdog is a C thread, and it copies the frames of every thread WITHOUT the GIL
(``_Py_DumpTracebackThreads``, which CPython documents as "for debug purpose only ... after a segmentation fault, at fatal error") while the other threads
keep running and keep changing their frames. On Windows two full dumps of a pytest worker show it dead inside ``dump_frame`` of ``faulthandler_thread``,
reading a frame another thread was freeing. This thread takes ``sys._current_frames()`` with the GIL held, so a frame it reads cannot change under it.
One thread per process, started by the first ``arm`` and reused by every later test. It writes nothing to stdout or stderr. After ``cancel`` returns, nothing
more is written for that test: the dump is written under the lock that ``cancel`` takes.
Known limit: a thread that holds the GIL and never releases it (a C call that does not let go) keeps this thread from running, so it cannot write. That case
is pytest's ``faulthandler.enable()``, which writes only when the process dies. The 420 s limit of the run (``--timeout-method thread``) still names the test.
"""
from __future__ import annotations
import sys
import threading
import time
def _clock(seconds: float) -> str:
whole = int(seconds)
return "%d:%02d:%02d" % (whole // 3600, whole % 3600 // 60, whole % 60)
class StackWatchdog:
def __init__(self) -> None:
self._cond = threading.Condition()
self._thread: threading.Thread | None = None
self._armed = False
self._file = None
self._started = 0.0
self._period = 0.0
self._due = 0.0
@property
def thread(self) -> threading.Thread | None:
"""The one thread of the process (None until the first ``arm``)."""
return self._thread
def arm(self, nodeid: str, threshold_s: float, period_s: float | None = None, file=None) -> None:
"""From ``threshold_s`` seconds on, and then every ``period_s`` (the threshold by default), write the stacks of all threads to ``file`` until ``cancel``."""
period = threshold_s if period_s is None else period_s
with self._cond:
self._file = file
self._started = time.monotonic()
self._period = max(period, 0.0005)
self._due = self._started + threshold_s
self._armed = True
try:
file.write("\n--- %s ---\n" % nodeid)
file.flush()
except Exception:
pass
if self._thread is None or not self._thread.is_alive():
self._thread = threading.Thread(target=self._run, name="invpw-stack-watchdog", daemon=True)
self._thread.start()
self._cond.notify_all()
def cancel(self) -> None:
"""Nothing more is written for the armed test once this returns: a dump in progress finishes first, because it is written under the same lock."""
with self._cond:
self._armed = False
self._file = None
self._cond.notify_all()
def _run(self) -> None:
with self._cond:
while True:
if not self._armed:
self._cond.wait()
continue
left = self._due - time.monotonic()
if left > 0:
# Waiting lets go of the lock, so that a cancel or a new arm is never kept out by a watchdog with a short period.
self._cond.wait(left)
continue
self._write_one_dump()
self._due = time.monotonic() + self._period
def _write_one_dump(self) -> None:
mine = threading.get_ident()
names = {t.ident: t.name for t in threading.enumerate()}
out = ["Timeout (%s)!\n" % _clock(time.monotonic() - self._started)]
for ident, frame in sys._current_frames().items():
if ident == mine:
continue
name = names.get(ident)
out.append("\nThread 0x%016x%s (most recent call first):\n" % (ident, " [%s]" % name if name else ""))
while frame is not None:
out.append(' File "%s", line %d in %s\n' % (frame.f_code.co_filename, frame.f_lineno, frame.f_code.co_name))
frame = frame.f_back
try:
self._file.write("".join(out))
self._file.flush()
except Exception:
# A watchdog that fails the suite over its OWN problem is worse than the defect it is watching for.
pass
_the_watchdog = StackWatchdog()
arm = _the_watchdog.arm
cancel = _the_watchdog.cancel
def the_thread() -> threading.Thread | None:
return _the_watchdog.thread
+261
View File
@@ -0,0 +1,261 @@
"""What the stock twins share: the same steps on Playwright's own Firefox and on our engine, one browser at a time, and a record of each.
A twin test measures a relation (the dropdown of a select against its element, the drop of a real drag, what an observer reads of a scrolled frame) and its
verdict is "the same as stock Firefox with stock Playwright", never a number of ours: an expected value comes from a capture of retail or from stock in the same job.
HOW STOCK RUNS. The mechanism is the one of the fake web (``scripts/run_fakeweb.py``, ``tests/fakeweb/profile_p2.py::run_on_stock``): the stock Playwright client
(``playwright.sync_api``, imported by name: the fork's guard forbids a static import), ``p.firefox.launch()``, which starts Playwright's own Firefox build that
``python -m playwright install firefox`` put on the runner. That is a row with ``"stock_firefox": true`` of ``ci/required-suites.json``, whose leg the gate gives the
archives, checked against ``ci/py-lock/playwright-browsers.json``. Stock goes FIRST and is closed before ours starts (ci-release-18: one browser at a time). The stock
part runs in a thread of its own (a sync client keeps its loop marked as running in its thread, and ours is a sync client too).
THE SAME WINDOW. Stock is launched HEADED (``headless=False``: a real window, on a display of its own that ``OwnDisplay`` makes the way the wrapper makes ours: ``invisible_core.make_virtual_display()``, an Xvfb of 1920x1080x24 on Linux; on Windows the desktop of the job, a stock client cannot be put on another desktop), as ours is (``launch_case``: the wrapper gives the engine a display of its own, so its windows are real ones; Firefox's ``-headless`` mode is on neither, because popups, drag and drop and window geometry behave differently in it), with the display scale of the case as ``layout.css.devPixelsPerPx`` (the pref ours is launched with for the same case: the scale
is then the one of the page AND of the browser chrome) and a context viewport of the inner size retail reads at that case (``RETAIL_CASES``: the maximized window's
``innerWidth`` x ``innerHeight``). Ours is the maximized window of the same case (``_window_origin.launch_case``).
THE RECORD. Each twin saves, for each browser, what it measured with the scales that could make the two differ: ``scales.page`` (``window.devicePixelRatio`` of the page, its
inner size, ``screen.width/height``: the DECLARED ones of ours) and ``scales.chrome`` read from chrome scope through Marionette (``devicePixelRatio`` of the browser window,
the inner and outer size of the window, and the REAL scale of the screen: ``nsIScreen.contentsScaleFactor`` and ``defaultCSSScaleFactor``, ``windowUtils.displayDPI``). The failure message
prints both records whole. A stock browser that cannot be driven (no Marionette, no dropdown, no drag) is a BROKEN CONTROL: red, and the message says it is no finding about ours.
"""
from __future__ import annotations
import fnmatch
import importlib
import json
import os
import re
import sys
from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple
from invisible_core import make_virtual_display
from _popup_geometry import in_a_thread_of_its_own
from _window_origin import launch_case, scale_pref
from test_the_maximized_window_frames_and_popups_read_retail_e2e import CASES as RETAIL_CASES
MARIONETTE_ARGS = ["-marionette", "-remote-allow-system-access"]
SCALES_JS = """
const win = Services.wm.getMostRecentWindow("navigator:browser");
const screen = Cc["@mozilla.org/gfx/screenmanager;1"].getService(Ci.nsIScreenManager).primaryScreen;
return JSON.stringify({
chrome_devicePixelRatio: win.devicePixelRatio,
chrome_inner: [win.innerWidth, win.innerHeight],
chrome_outer: [win.outerWidth, win.outerHeight],
real_screen_contentsScaleFactor: screen.contentsScaleFactor,
real_screen_defaultCSSScaleFactor: screen.defaultCSSScaleFactor,
real_displayDPI: win.windowUtils.displayDPI,
});
"""
PAGE_SCALES = """() => ({devicePixelRatio: window.devicePixelRatio, inner: [innerWidth, innerHeight], screen: [screen.width, screen.height]})"""
def on_linux() -> bool:
return sys.platform.startswith("linux")
class OwnDisplay:
"""The display a browser that is not ours is launched on: the wrapper's own mechanism (``make_virtual_display``, what ``InvisiblePlaywright`` starts for ours), never the job's.
On Linux a fresh Xvfb (the core's: 1920x1080x24, access control on, its cookie in ``XAUTHORITY``), one per launch, started before the browser and stopped after it; the browser's environment
gets ``DISPLAY`` and ``XAUTHORITY`` from it and loses the Wayland variables, so a job that runs pytest without ``xvfb-run`` (the rows of the stock twins) still has a screen. On Windows there is
nothing to make: a stock client cannot spawn its browser on another desktop, so it is on the one of the job, and ``environ`` is the environment as it is."""
def __init__(self) -> None:
self._display: Any = None
def __enter__(self) -> "OwnDisplay":
if on_linux():
display = make_virtual_display()
display.start()
self._display = display
return self
def __exit__(self, *exc: Any) -> None:
display, self._display = self._display, None
if display is not None:
display.stop()
def environ(self, base: Optional[Mapping[str, str]] = None) -> Dict[str, str]:
"""``base`` (the process's environment by default) as the browser is launched with it: what the display names set, what it names ``None`` removed."""
env = dict(os.environ if base is None else base)
for name, value in (self._display.launch_env() if self._display is not None else {}).items():
if value is None:
env.pop(name, None)
else:
env[name] = value
return env
class BrokenControl(AssertionError):
"""Stock Firefox could not be driven through the steps: not a finding about ours."""
class Chrome:
"""Chrome scope of the browser below this process, through Marionette (the route of ``test_software_compositing_is_declared_e2e.py``).
``page`` is the page the browser of this launch already opened, and it is required on purpose: ``WebDriver:NewSession`` waits for the end of the browser's start-up, which only a window
ends, and the wrapper launches with ``-silent`` (no window at start-up). A session asked before the first page never gets its answer (the socket times out after 300 s). With the page
as an argument the wrong order cannot be written."""
def __init__(self, page) -> None:
if page is None:
raise TypeError("Chrome needs the page this launch opened first: Marionette's NewSession is answered only once a window exists")
import webfont_probe
self._page = page
self._m = webfont_probe._Marionette(webfont_probe.marionette_active_port())
self._m.call("WebDriver:NewSession", {"capabilities": {"alwaysMatch": {}}})
self._m.call("Marionette:SetContext", {"value": "chrome"})
def script(self, script: str, args: Tuple[Any, ...] = ()) -> Dict[str, Any]:
return json.loads(self._m.call("WebDriver:ExecuteScript", {"script": script, "args": list(args)})["value"])
def scales(self) -> Dict[str, Any]:
"""The record of the scales: the page's (declared) and the chrome's, with the real ones of the screen."""
out = {"page": self._page.evaluate(PAGE_SCALES)}
out.update(self.script(SCALES_JS))
return out
def close(self) -> None:
self._m.close()
def stock_client():
"""The stock Playwright client, imported by name."""
try:
return importlib.import_module("playwright.sync_api").sync_playwright
except ImportError as exc: # a broken environment, not a reason to skip: a skipped gate checks nothing
raise BrokenControl("the stock Playwright client is missing (%s): install the wrapper with its dev extra" % exc) from exc
def viewport(case: str) -> Dict[str, int]:
"""The inner size retail reads for the maximized window of ``case``, CSS pixels."""
maximized = RETAIL_CASES[case]["maximized"]
return {"width": int(maximized["iw"]), "height": int(maximized["ih"])}
def stock_user_prefs(case: str) -> Dict[str, Any]:
"""The user prefs stock Playwright's Firefox is launched with for ``case``: the display scale as the STRING ours is launched with (``scale_pref``), and a free Marionette port.
A number would be set with ``setIntPref`` by the Juggler of Playwright's build, and ``layout.css.devPixelsPerPx`` is a string pref: ``Browser.enable`` fails and no case launches."""
return {"layout.css.devPixelsPerPx": scale_pref(case), "marionette.port": 0}
def _on_stock(case: str, measure: Callable[[Any, Chrome], Dict[str, Any]]) -> Dict[str, Any]:
def run() -> Dict[str, Any]:
sync_playwright = stock_client()
with sync_playwright() as p, OwnDisplay() as display:
browser = p.firefox.launch(headless=False, args=MARIONETTE_ARGS, env=display.environ(),
firefox_user_prefs=stock_user_prefs(case))
chrome = None
try:
page = browser.new_context(viewport=viewport(case)).new_page()
chrome = Chrome(page)
return measure(page, chrome)
finally:
if chrome is not None:
chrome.close()
browser.close()
try:
return in_a_thread_of_its_own(run)
except BrokenControl:
raise
except Exception as exc:
raise BrokenControl("BROKEN CONTROL, no finding about ours: stock Firefox (Playwright's own build) could not be driven through the steps of %s: %s: %s"
% (case, type(exc).__name__, exc)) from exc
def _on_ours(case: str, firefox_binary: str, measure: Callable[[Any, Chrome], Dict[str, Any]]) -> Dict[str, Any]:
with launch_case(firefox_binary, case, extra_args=MARIONETTE_ARGS, extra_prefs={"marionette.port": 0}) as browser:
page = browser.new_page() # first: the window the session below waits for
chrome = Chrome(page)
try:
return measure(page, chrome)
finally:
chrome.close()
def run_twin(case: str, firefox_binary: str, measure: Callable[[Any, Chrome], Dict[str, Any]]) -> Tuple[Dict[str, Any], Dict[str, Any]]:
"""(stock's record, ours): the same ``measure(page, chrome)`` on Playwright's own Firefox first and on our engine second. Needs MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1."""
stock = _on_stock(case, measure)
ours = _on_ours(case, firefox_binary, measure)
return stock, ours
def both(case: str, stock: Dict[str, Any], ours: Dict[str, Any], reference: str = "stock") -> str:
"""The two records whole, for the message of a red twin (``reference`` names the first: stock, or retail)."""
return "\n case %s\n %s: %s\n ours: %s" % (case, reference, json.dumps(stock, sort_keys=True), json.dumps(ours, sort_keys=True))
def differences(stock: Any, ours: Any, tolerances: Dict[str, float] = None, path: str = "") -> List[str]:
"""Every place where the two records differ, as ``path: stock X, ours Y``. A number differs by more than the tolerance of its key (the last name of its path; 0 when none);
everything else must be equal."""
tolerances = tolerances or {}
out: List[str] = []
if isinstance(stock, dict) and isinstance(ours, dict):
for key in sorted(set(stock) | set(ours)):
if key not in stock or key not in ours:
out.append("%s.%s: only %s has it" % (path, key, "stock" if key in stock else "ours"))
else:
out += differences(stock[key], ours[key], tolerances, "%s.%s" % (path, key))
elif isinstance(stock, list) and isinstance(ours, list) and len(stock) == len(ours):
for i, (a, b) in enumerate(zip(stock, ours)):
out += differences(a, b, tolerances, "%s[%d]" % (path, i))
elif isinstance(stock, (int, float)) and isinstance(ours, (int, float)) and not isinstance(stock, bool) and not isinstance(ours, bool):
tolerance = tolerances.get(path.rsplit(".", 1)[-1].split("[", 1)[0], 0.0)
if abs(stock - ours) > tolerance:
out.append("%s: stock %r, ours %r (tolerance %r)" % (path, stock, ours, tolerance))
elif stock != ours:
out.append("%s: stock %r, ours %r" % (path, stock, ours))
return out
#: The two reasons a field of a stock twin's record can be left out of the comparison with stock (the retail capture of the case decides it instead).
IN_PROCESS_FRAME = "in-process frame in stock"
SYNTHETIC_DRAG = "synthetic drag in stock"
REASONS = {
IN_PROCESS_FRAME: "stock Playwright's Firefox sets fission.webContentIsolationStrategy=0, so its cross-site frame shares the top's process and ours is in another process: a field that depends on "
"the frame being in another process is not what stock reads",
SYNTHETIC_DRAG: "stock's drag is Juggler's synthetic one: no OLE drag loop, so no timer-driven drag event and no buttons held, and nothing a real drag has beyond the events themselves",
}
def canonical(path: str, root: str) -> str:
"""``path`` of a difference less its root, with every list index as ``[]``: ``drag drop.top.once[3].buttons`` is ``top.once[].buttons`` for the root ``drag drop``."""
rest = path[len(root):].lstrip(".") if path.startswith(root) else path
return re.sub(r"\[\d+\]", "[]", rest)
def leaf_paths(node: Any, prefix: str = "") -> List[str]:
"""The canonical path of every leaf of a record (what a declared field has to name to exist in it)."""
if isinstance(node, dict):
return [p for k, v in node.items() for p in leaf_paths(v, "%s.%s" % (prefix, k) if prefix else str(k))] or [prefix]
if isinstance(node, list):
return [p for v in node for p in leaf_paths(v, prefix + "[]")] or [prefix + "[]"]
return [prefix]
def stale_entries(declared: Mapping[str, str], *records: Any) -> List[str]:
"""The declared fields (a pattern of canonical paths, ``*`` for any run of characters) that name nothing in any of ``records``, and the reasons that are not one of ``REASONS``."""
paths = [p for record in records for p in leaf_paths(record)]
out = ["%s names no field of the record" % field for field in declared if not any(fnmatch.fnmatchcase(p, field) for p in paths)]
return out + ["%s has the reason %r, which is not one of %s" % (field, why, sorted(REASONS)) for field, why in declared.items() if why not in REASONS]
def split_differences(stock: Any, ours: Any, declared: Mapping[str, str], tolerances: Dict[str, float] = None, path: str = "") -> Tuple[List[str], List[str]]:
"""``(red, recorded)``: the differences of ``differences`` split by the declared list of the twin. A difference at a declared field is recorded (with its reason, for the report) and does not
decide the verdict; every other one is red. ``declared`` maps a pattern of canonical paths (``canonical``) to one of ``REASONS``."""
red: List[str] = []
recorded: List[str] = []
for difference in differences(stock, ours, tolerances, path):
where = canonical(difference.split(": ", 1)[0], path)
why = next((reason for field, reason in declared.items() if fnmatch.fnmatchcase(where, field)), None)
if why is None:
red.append(difference)
else:
recorded.append("%s [recorded, not compared: %s]" % (difference, why))
return red, recorded
+1 -1
View File
@@ -1,7 +1,7 @@
"""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."""
Used by tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py and tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py. No test of its own, no browser."""
from __future__ import annotations
import os
+70 -6
View File
@@ -93,6 +93,15 @@ def _attrs(data: bytes) -> Dict[int, bytes]:
return out
def is_deallocation(data: bytes) -> bool:
"""Whether a datagram is a TURN deallocation, by what it means (RFC 5766 section 7.1): a STUN Refresh (0x0004) whose LIFETIME (0x000D) is 0. A Refresh with a lifetime above 0, with
none, or any other message type, is not one. The one reading of it: the TURN server of the lab and the gateway of the lab both use it."""
if len(data) < 20 or struct.unpack("!I", data[4:8])[0] != MAGIC or struct.unpack("!H", data[:2])[0] != 0x0004:
return False
lifetime = _attrs(data).get(0x000D)
return lifetime is not None and len(lifetime) == 4 and struct.unpack("!I", lifetime)[0] == 0
def _attr(t: int, v: bytes) -> bytes:
return struct.pack("!HH", t, len(v)) + v + b"\x00" * (-len(v) % 4)
@@ -111,11 +120,39 @@ def _message(mtype: int, tid: bytes, attrs: bytes, key: Optional[bytes] = None)
return head + attrs + _attr(0x0008, mac)
def long_term_key(user: str) -> bytes:
"""The long-term credential key of RFC 5389 section 15.4: md5(username:realm:password)."""
return hashlib.md5(("%s:%s:%s" % (user, REALM, PASSWORD)).encode(), usedforsecurity=False).digest()
def integrity_valid(data: bytes, user: str) -> bool:
"""Whether the MESSAGE-INTEGRITY of a request is the HMAC-SHA1 under the long-term key of ``user`` (RFC 5389 section 15.4): over the message up to the
attribute, with the length field of the header set as if the message ended with that attribute (24 bytes more than what came before it). A request
with no MESSAGE-INTEGRITY, or a truncated one, is not valid."""
i = 20
while i + 4 <= len(data):
t, n = struct.unpack("!HH", data[i:i + 4])
if t == 0x0008:
if n != 20 or i + 24 > len(data):
return False
head = data[:2] + struct.pack("!H", i + 24 - 20) + data[4:20]
return hmac.compare_digest(hmac.new(long_term_key(user), head + data[20:i], hashlib.sha1).digest(), data[i + 4:i + 24])
i += 4 + ((n + 3) & ~3)
return False
class TurnServer:
"""UDP TURN server on 127.0.0.1. ``seen`` is every datagram as (source ip, source port, STUN type), in order;
``requests`` the same datagrams as (monotonic time, transaction id, STUN type, carries credentials): a retransmission has the
transaction id of the request it repeats, so the TRANSACTIONS of a road are the distinct ids (:meth:`transactions`);
``allocations`` the successful Allocates as (source ip, source port, username, time)."""
``allocations`` the successful Allocates as (source ip, source port, username, time); ``deallocations`` the requests that END an allocation as (source ip, source
port, transaction id, time, index in ``allocations`` of the allocation they end, or None when that source has none): a deallocation is recognised by what it means, a
Refresh (0x0004) whose LIFETIME (0x000D) is 0 (RFC 5766 section 7.1), not by its type: a Refresh with a lifetime above 0 keeps the allocation and is not one. The server
answers it as it answers any Refresh; a retransmission is another datagram of the same transaction (:meth:`deallocation_transactions`).
A request that carries USERNAME is checked: its MESSAGE-INTEGRITY must be the HMAC under the long-term key of that user (``PASSWORD``).
A missing or wrong one is answered 401 with the realm and the nonce, makes no allocation, and is written in ``refused`` as
(source ip, source port, username, transaction id, time): a client with the wrong password never gets a relay here, as on a real server."""
def __init__(self) -> None:
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
@@ -124,6 +161,8 @@ class TurnServer:
self.seen: List[Tuple[str, int, int]] = []
self.allocations: List[Tuple[str, int, str, float]] = []
self.requests: List[Tuple[float, bytes, int, bool]] = []
self.deallocations: List[Tuple[str, int, bytes, float, Optional[int]]] = []
self.refused: List[Tuple[str, int, str, bytes, float]] = []
self._closed = False
threading.Thread(target=self._serve, daemon=True).start()
@@ -135,6 +174,17 @@ class TurnServer:
first.setdefault(request[1], request)
return sorted(first.values(), key=lambda r: r[0])
def deallocation_transactions(self) -> List[Tuple[str, int, bytes, float, Optional[int]]]:
"""The first datagram of each deallocation transaction, in order: a retransmission of it is not another deallocation."""
first: Dict[bytes, Tuple[str, int, bytes, float, Optional[int]]] = {}
for record in list(self.deallocations):
first.setdefault(record[2], record)
return sorted(first.values(), key=lambda r: r[3])
def deallocation_tids(self) -> set:
"""The transaction ids (bytes) of every deallocation received: what ties its datagrams on the wire to the server's record of it."""
return {record[2] for record in list(self.deallocations)}
def close(self) -> None:
self._closed = True
self.sock.close()
@@ -148,26 +198,40 @@ class TurnServer:
if len(data) < 20 or struct.unpack("!I", data[4:8])[0] != MAGIC:
continue
mtype, tid = struct.unpack("!H", data[:2])[0], data[8:20]
self.seen.append((src[0], src[1], mtype))
attrs = _attrs(data)
if is_deallocation(data): # recorded BEFORE the request: whoever reads `requests` already knows which of them it ended
held = [i for i, a in enumerate(self.allocations) if a[:2] == (src[0], src[1])]
self.deallocations.append((src[0], src[1], tid, time.monotonic(), held[-1] if held else None))
self.seen.append((src[0], src[1], mtype))
self.requests.append((time.monotonic(), tid, mtype, 0x0008 in attrs and 0x0006 in attrs))
user_raw = attrs.get(0x0006)
if mtype in (0x0003, 0x0004, 0x0008, 0x0009) and user_raw is not None:
user = user_raw.decode(errors="replace")
if not integrity_valid(data, user): # the wrong password, or no MESSAGE-INTEGRITY: 401, no allocation
self.refused.append((src[0], src[1], user, tid, time.monotonic()))
self.sock.sendto(_message(mtype | 0x0110, tid, self._unauthorized()), src)
continue
if mtype == 0x0003: # Allocate
if 0x0008 not in attrs or 0x0006 not in attrs: # no credentials: 401 with a realm and a nonce
err = _attr(0x0009, b"\x00\x00\x04\x01Unauthorized") + _attr(0x0014, REALM.encode()) + _attr(0x0015, NONCE.encode())
self.sock.sendto(_message(0x0113, tid, err), src)
self.sock.sendto(_message(0x0113, tid, self._unauthorized()), src)
continue
user = attrs[0x0006].decode(errors="replace")
key = hashlib.md5(("%s:%s:%s" % (user, REALM, PASSWORD)).encode(), usedforsecurity=False).digest()
key = long_term_key(user)
body = (_attr(0x0016, _xor_addr(*RELAYED)) + _attr(0x0020, _xor_addr(src[0], src[1])) +
_attr(0x000D, struct.pack("!I", 600)))
self.allocations.append((src[0], src[1], user, time.monotonic()))
self.sock.sendto(_message(0x0103, tid, body, key), src)
elif mtype in (0x0004, 0x0008, 0x0009): # Refresh, CreatePermission, ChannelBind
user = attrs.get(0x0006, b"").decode(errors="replace")
key = hashlib.md5(("%s:%s:%s" % (user, REALM, PASSWORD)).encode(), usedforsecurity=False).digest()
key = long_term_key(user)
body = _attr(0x000D, struct.pack("!I", 600)) if mtype == 0x0004 else b""
self.sock.sendto(_message(mtype | 0x0100, tid, body, key), src)
@staticmethod
def _unauthorized() -> bytes:
"""The attributes of a 401: ERROR-CODE, the realm and the nonce of the long-term credential."""
return _attr(0x0009, b"\x00\x00\x04\x01Unauthorized") + _attr(0x0014, REALM.encode()) + _attr(0x0015, NONCE.encode())
# ── the gateway ────────────────────────────────────────────────────────────────
+45 -20
View File
@@ -12,12 +12,7 @@ Nothing here opens a browser; the unit test ``test_the_udp_line_helpers.py`` hol
from __future__ import annotations
import ipaddress
from typing import Any, Callable, Dict, List, Optional, Sequence
#: How much slower than the first visit a later visit may load, in milliseconds, on the roads where UDP does not work. A
#: retail Firefox on a network that drops UDP loads the later visits as fast as the first (15 of 15 sessions, h2/h2/h2): an h3
#: attempt that waits for a timeout before it falls back to h2 would be seconds.
LOAD_MARGIN_MS = 1500
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple
#: The visits of one page in one context, by kind of road. With NO proxy and the native DNS the retail is measured in loopback
#: and is exact: h2, h3, h3 over three visits. BEHIND A PROXY the names are resolved by DoH, the browser learns the Alt-Svc
@@ -162,7 +157,7 @@ def expected_protocols(road: str) -> str:
return ("h2 on the first visit, then h3 from a later visit on and h3 on every one after it, within %d visits "
"(retail with DoH and UDP free: h2/h2/h3 in 9 of 15, h2/h2/h2 in 4, h2/h3/h3 in 2, and h3 first in 3 of 15 in the "
"third run when the DNS answer carries the HTTPS record; this fixture has none: h2 first)" % visits)
return "h2 on every one of %d visits, as fast as the first (retail with UDP dropped: h2/h2/h2 in 15 of 15)" % visits
return "h2 on every one of %d visits, with no attempt at h3 (retail with UDP dropped: h2/h2/h2 in 15 of 15)" % visits
def no_https_record(host: str, doh: Any = None) -> List[str]:
@@ -185,27 +180,62 @@ def no_https_record(host: str, doh: Any = None) -> List[str]:
return problems
def judge_visits(road: str, protocols: Sequence[str], walls_ms: Sequence[float]) -> List[str]:
def relay_activity(gateway: Any) -> Tuple[int, int]:
"""What a SOCKS5 gateway of the tests has been asked for so far, as ``(UDP ASSOCIATE requests, datagrams its relay carried)``: the
requests answered or refused, the datagrams of every association. Taken twice (before the first visit, which is after the core's own
measurement of the gateway, and after the last), the difference is what the ENGINE asked of the relay while it visited the page."""
return int(gateway.associates), len(gateway.datagrams)
def h3_attempts(server: Any, gateway: Any = None, before: Optional[Tuple[int, int]] = None) -> List[str]:
"""What the test server (and, behind a SOCKS5 gateway, the gateway) says about a TRY at HTTP/3, as sentences; an empty list when nothing tried.
Behind a SOCKS5 gateway that is not coherent the engine does not carry UDP (nsSOCKSUDPIOLayer.cpp, ``StealthPutSocksUdpLayer``: the socket of an
HTTP/3 connection gets a layer that is ``Blocked``, no association is asked for): an engine that tried would ask the gateway for a UDP
ASSOCIATE (a refused one is a request too) or send a datagram to its relay, whether or not the datagram goes on to the server.
``gateway`` and ``before`` (:func:`relay_activity` taken before the first visit) add those two to the answer.
A retail Firefox on a network that drops UDP (and behind an HTTP proxy, which has no UDP at all) never tries HTTP/3: it reads h2 and
nothing is sent to the h3 port the Alt-Svc announces. An engine that TRIES sends its QUIC Initial there first, and then waits for
an answer that does not come before it falls back to h2: the wait is the tell, and the datagram is the attempt. The attempt is
read where it is born, as a datagram that reached the UDP port of ``server`` (``H3Server.udp_datagrams``, every datagram, with
or without a handshake), never as a duration: how long a fallback takes is the speed of the machine, whether it was tried is the engine."""
problems: List[str] = []
seen = list(getattr(server, "udp_datagrams", ()))
if seen:
problems.append("%d UDP datagrams reached the h3 port %s of the server, from %s: the engine tried HTTP/3 (and, where nothing answers, "
"waits for a timeout before the fallback to h2)" % (len(seen), getattr(server, "port", "?"), sorted(set(seen))))
if gateway is not None:
if before is None:
raise ValueError("a gateway is judged against what it had been asked before the first visit (relay_activity)")
associates, datagrams = (now - was for now, was in zip(relay_activity(gateway), before))
if associates:
problems.append("the engine asked the gateway for %d UDP ASSOCIATE while it visited the page: it tried to carry UDP (HTTP/3) "
"through a gateway that was not measured coherent" % associates)
if datagrams:
problems.append("%d datagrams went into the relay of the gateway while the page was visited: the engine tried HTTP/3 "
"through a gateway that was not measured coherent" % datagrams)
return problems
def judge_visits(road: str, protocols: Sequence[str]) -> List[str]:
"""What is wrong with the visits of one page on ``road``, as sentences; an empty list when nothing is.
``protocols`` is the ``nextHopProtocol`` of each visit and ``walls_ms`` the time ``page.goto`` took to the load event;
both have :func:`visits_for` entries. The rules, from the retail:
``protocols`` is the ``nextHopProtocol`` of each visit, :func:`visits_for` entries. No duration is judged: that an h3 attempt
waited for a timeout is read as the attempt itself (:func:`h3_attempts`). The rules, from the retail:
* ``direct``: exactly h2, h3, h3.
* ``socks5_coherent``: the first visit is h2 (the fixture is reached by an address: no HTTPS record exists, so nothing
tells the browser about h3 before the first connection; the retail itself reads h3 first when the DNS answer carries
the record, so this is a rule of the fixture, checked with :func:`no_https_record`); every later visit is h2 or h3, but once one is h3 all the following are (h3 never goes back to h2); and at
least one visit is h3 (it is NOT required at the second: h2/h2/h3 is the commonest retail sequence).
* the roads where UDP is dropped: h2 on every visit, and no visit loads more than :data:`LOAD_MARGIN_MS` slower than the
first (a fallback that waits for a timeout is a tell)."""
* the roads where UDP is dropped: h2 on every visit (and no attempt at h3: :func:`h3_attempts`, read by the test)."""
problems: List[str] = []
protocols, walls_ms = list(protocols), list(walls_ms)
protocols = list(protocols)
visits = visits_for(road)
said = "a retail Firefox reads %s on this road" % expected_protocols(road)
if len(protocols) != visits:
problems.append("%d protocols for %d visits: %s" % (len(protocols), visits, protocols))
if len(walls_ms) != visits:
problems.append("%d load times for %d visits: %s" % (len(walls_ms), visits, walls_ms))
if protocols and protocols[0] == "h3":
problems.append("visit 1 read h3: in this fixture nothing had told the browser yet that the server speaks h3 (no "
"name, no HTTPS record): something told it, or the fixture changed")
@@ -221,9 +251,4 @@ def judge_visits(road: str, protocols: Sequence[str], walls_ms: Sequence[float])
problems.append("the protocols of the %d visits are %s, %s" % (visits, protocols, said))
elif protocols != ["h2"] * visits:
problems.append("the protocols of the %d visits are %s, %s" % (visits, protocols, said))
if len(walls_ms) == visits and road in _H2_ROADS:
for number in range(2, visits + 1):
if walls_ms[number - 1] > walls_ms[0] + LOAD_MARGIN_MS:
problems.append("visit %d loaded in %d ms against %d ms for visit 1 (more than %d ms slower): an h3 attempt "
"that waited for a timeout before the fallback" % (number, walls_ms[number - 1], walls_ms[0], LOAD_MARGIN_MS))
return problems
+23
View File
@@ -0,0 +1,23 @@
"""Where the e2e stack watchdog (``tests/_stack_watchdog.py``, armed by ``tests/conftest.py``) writes its stacks."""
from __future__ import annotations
import os
from typing import Mapping
#: The folder under ``$RUNNER_TEMP`` that every e2e job uploads whatever the result ("Keep what the tests saved", ``invpw-evidence-*``).
EVIDENCE_FOLDER = "invpw-evidence"
LOG_NAME = "e2e-watchdog.log"
def default_log_path(environ: Mapping[str, str], tempdir: str) -> str:
"""The file the stacks go to.
``INVPW_TEST_WATCHDOG_FILE`` when it is set (the workflows of the wrapper name their own file). On a runner (``RUNNER_TEMP`` set) the evidence folder, which the gate uploads with
the result of the leg, so that the stack of a hung test is in the artifact of the run that hung. Elsewhere ``invpw-e2e-watchdog.log`` in the temporary folder."""
named = environ.get("INVPW_TEST_WATCHDOG_FILE")
if named:
return named
runner = environ.get("RUNNER_TEMP")
if runner:
return os.path.join(runner, EVIDENCE_FOLDER, "watchdog", LOG_NAME)
return os.path.join(tempdir, "invpw-e2e-watchdog.log")
+27
View File
@@ -0,0 +1,27 @@
"""What a test that cannot get a WebGL context writes down, so that the red says why (a pure helper, no browser).
A page asks for a context and gets ``null``: the page learns nothing more unless it listens for ``webglcontextcreationerror`` on the canvas
before it asks (``statusMessage``). The probe of the test returns an object with ``unavailable: true`` and what it heard instead of ``null``;
``split_probe`` turns that into the old ``None`` (so that the assertion stays as it was) and the record of the attempt, and ``unavailable_message``
is the sentence of the assertion with both attempts appended.
"""
from __future__ import annotations
from typing import Any, Optional, Tuple
#: The pause, in milliseconds, between the first attempt and the second one (a diagnostic: the verdict is the first attempt's).
SECOND_ATTEMPT_AFTER_MS = 2000
UNAVAILABLE = "webgl is unavailable: a WebGL canvas cannot be read"
def split_probe(result: Any) -> Tuple[Optional[Any], Optional[dict]]:
"""``(got, first)``: ``got`` is what the test reads (``None`` when there was no context, exactly as the old probe returned), ``first`` the
record of the failed attempt (``None`` when a context was made)."""
if isinstance(result, dict) and result.get("unavailable") is True:
return None, result
return result, None
def unavailable_message(first: Optional[dict], second: Any) -> str:
"""The message of the assertion: the old sentence, then what the first attempt and the second one (2 s later) reported."""
return "%s | first: %r; second after 2 s: %r" % (UNAVAILABLE, first, second)
+56
View File
@@ -0,0 +1,56 @@
"""Every pytest process of a Windows job that keeps WER dumps lets Windows Error Reporting see its crash: the bit SEM_NOGPFAULTERRORBOX of its error mode is cleared.
A process whose error mode carries SEM_NOGPFAULTERRORBOX (0x0002) never invokes Windows Error Reporting when it dies from an unhandled exception, so the
LocalDumps key of python.exe that e2e.yml sets (a full dump into ``$RUNNER_TEMP/invpw-evidence/dumps/python``) is never read: the pytest controllers of the
runner are born with 0x0003 (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX), and every child inherits the mode of its parent, so every xdist worker is born
with it too and a worker that crashes leaves no dump.
https://learn.microsoft.com/windows/win32/api/errhandlingapi/nf-errhandlingapi-seterrormode
``clear_for_wer_dumps()``: tests/conftest.py calls it in ``pytest_configure``, which the controller and every xdist worker run. It acts only when ALL of this
holds, so nothing changes on a developer's machine, on Linux, or in a job that did not set LocalDumps:
* the system is Windows;
* ``$INVPW_WER_DUMPS`` (the one variable the "Windows Error Reporting keeps a full dump..." step of each Windows job of e2e.yml exports to ``$GITHUB_ENV``) names an
existing folder: the folder the dumps go to.
It clears bit 0x0002 and keeps every other bit of the mode, and appends one line to ``error-mode.log`` in the parent of that folder (``invpw-evidence/dumps``, inside the evidence the job
uploads): ``pid <n> error mode born 0x<hex>, now 0x<hex>``, so the evidence shows the bit was cleared in every process. It writes nothing to stdout or stderr, and it
never raises: a failure is a line of that log, not a failed test.
"""
from __future__ import annotations
import os
import sys
from pathlib import Path
#: The variable the Windows jobs export: the folder LocalDumps of python.exe writes to.
ENV_VAR = "INVPW_WER_DUMPS"
LOG_NAME = "error-mode.log"
#: SEM_NOGPFAULTERRORBOX: the process is not reported to Windows Error Reporting.
SEM_NOGPFAULTERRORBOX = 0x0002
def clear_for_wer_dumps(environ=None) -> None:
environ = os.environ if environ is None else environ
if sys.platform != "win32":
return
folder = environ.get(ENV_VAR)
if not folder or not os.path.isdir(folder):
return
log = Path(folder).resolve().parent / LOG_NAME
try:
import ctypes
kernel32 = ctypes.WinDLL("kernel32")
kernel32.GetErrorMode.restype = ctypes.c_uint
kernel32.SetErrorMode.argtypes = [ctypes.c_uint]
kernel32.SetErrorMode.restype = ctypes.c_uint
born = kernel32.GetErrorMode()
kernel32.SetErrorMode(born & ~SEM_NOGPFAULTERRORBOX)
line = "pid %d error mode born 0x%04x, now 0x%04x\n" % (os.getpid(), born, kernel32.GetErrorMode())
except Exception as exc: # best effort: the evidence says what went wrong, the test run goes on
line = "pid %d error mode not cleared: %s: %s\n" % (os.getpid(), type(exc).__name__, exc)
try:
with open(log, "a", encoding="utf-8") as handle:
handle.write(line)
except OSError:
pass
+78
View File
@@ -0,0 +1,78 @@
"""What the window-origin e2e files share: the four display cases, a browser pinned to one of them, and waits on a reading of a page.
The four cases are the ones of the window tests against retail (``test_the_maximized_window_frames_and_popups_read_retail_e2e.py``): scale 1.0, 1.25 and 1.5
on a 1920x1080 panel (device pixels) and 2.0 on a 1600x1200 one. The engine declares the window, so the page reads the same on Linux and on Windows.
Waits are CONDITIONS with a deadline (``_waits``), never a pause; ``observe`` is the one bounded look at a value that must NOT change, and it says so.
"""
from __future__ import annotations
import time
from typing import Any, Callable, Dict, List, Tuple
from _waits import wait_until
#: The deadline of a wait for something that must happen, in seconds.
DEADLINE_S = 30
#: Floats of a page (``mozInnerScreenY`` 72.667 is 72.6666...).
FLOAT = 0.001
#: case id -> (display scale, panel in device pixels).
CASES: Dict[str, Tuple[float, Tuple[int, int]]] = {
"1920x1080-dpr1.0": (1.0, (1920, 1080)),
"1920x1080-dpr1.25": (1.25, (1920, 1080)),
"1920x1080-dpr1.5": (1.5, (1920, 1080)),
"1600x1200-dpr2.0": (2.0, (1600, 1200)),
}
def scale_pref(case: str) -> str:
"""``layout.css.devPixelsPerPx`` of a case, as the core declares it for ours (``str(profile.screen.dpr)``: "1.0", "1.25", "1.5", "2.0").
The pref is a STRING pref of Firefox. A client that sends a number (stock Playwright puts a number through ``Browser.enable`` as ``setIntPref``) makes the browser refuse
the launch with NS_ERROR_UNEXPECTED, so every browser that is not ours gets the scale in this form, from here."""
return str(CASES[case][0])
def launch_case(firefox_binary: str, case: str, **extra: Any):
"""The product on one case: seed 42, the panel and the scale pinned, headless, no humanizing. ``extra`` is for the keywords a test needs on top
(``extra_args``, ``extra_prefs``)."""
from invisible_playwright import InvisiblePlaywright
dpr, panel = CASES[case]
pin = {"screen.width": panel[0], "screen.height": panel[1], "screen.dpr": dpr}
return InvisiblePlaywright(seed=42, pin=pin, binary_path=firefox_binary, headless=True, humanize=False, **extra)
def settled(page, read: Callable[[], Any], seconds: float = DEADLINE_S) -> Any:
"""``read()`` once two looks in a row, 100 ms apart, give the same value (or the last one at the deadline: a window that never settles is red where
the caller's assertion names what was read)."""
seen: Dict[str, Any] = {"now": None, "before": None}
def look() -> bool:
seen["before"], seen["now"] = seen["now"], read()
return seen["now"] == seen["before"]
wait_until(look, seconds, lambda: page.wait_for_timeout(100))
return seen["now"]
def wait_for(page, condition: Callable[[], Any], seconds: float = DEADLINE_S) -> bool:
"""Until ``condition()`` is true, reading the client's events between two looks; False at the deadline."""
return wait_until(condition, seconds, lambda: page.wait_for_timeout(100))
def observe(page, read: Callable[[], Any], seconds: float) -> List[Any]:
"""The distinct values ``read()`` gives over ``seconds``, in the order they were seen (the first look is always taken).
The ONE bounded look of these files: for a value that must stay as it is (a window after ``resizeBy(0, 0)``, a frame that must not have loaded yet).
A change that comes later than ``seconds`` is not seen; a change inside it always is, so the check can be late to catch a bug and never red for nothing."""
values: List[Any] = []
end = time.monotonic() + seconds
while True:
value = read()
if not values or values[-1] != value:
values.append(value)
if time.monotonic() >= end:
return values
page.wait_for_timeout(100)
+264 -23
View File
@@ -1,20 +1,41 @@
"""What X itself says about two toplevels of a private display: which one is above, where they are, and what visibility X sends the lower one.
"""What X itself says about two toplevels of a private display: which one is above, where they are, what visibility X sends the lower one, and whether the
pointer or the focus moved while it was covered.
The occlusion e2e test (``test_window_occlusion_e2e.py``) judges a page's ``document.visibilityState`` after a second session's window has covered the first
one. On Linux the engine turns a window ``OCCLUDED`` only on a ``VisibilityNotify`` with ``FullyObscured`` of its toplevel (``nsWindow::OnVisibilityNotifyEvent``,
The occlusion e2e test (``test_window_occlusion_e2e.py``) judges a page's ``document.visibilityState`` after a window has covered the first session's one. On
Linux the engine turns a window ``OCCLUDED`` only on a ``VisibilityNotify`` with ``FullyObscured`` of its toplevel (``nsWindow::OnVisibilityNotifyEvent``,
connected to the shell's ``visibility-notify-event``, ``widget/gtk/nsWindow.cpp``): whether X sent that event is the ground truth the verdict rests on, and the
test reads it without the engine, through a connection of its own to the same display (libX11, as ``_os_focus.XFocus``, whose connection and window lookup this
reuses):
reuses).
* ``watch``: ``XSelectInput(VisibilityChangeMask)`` on the covered toplevel, before the cover is mapped. Every client that selects the mask gets its own copy of
the event, so the engine's own selection is untouched;
The cover on Linux is a window of the test's own (``cover_window``): an override-redirect ``InputOutput`` window on the private display, larger than the covered
toplevel on every side (``COVER_MARGIN``, inside the screen when it fits), mapped and raised, and never given the input focus (nothing calls ``XSetInputFocus``).
It is not a second Firefox session's window, as it was before. Why the arrangement must not move the pointer: the private Xvfb has no window manager, so the
focus is ``PointerRoot`` and GDK treats the toplevel under the pointer as the focused one. Any window mapped over the pointer makes the pointer leave the covered
toplevel; GDK turns that crossing into a GTK focus-out (``OnContainerFocusOutEvent``, then a ``leave notify``) and GTK draws a window that loses the focus
(``nsWindow::OnExposeEvent``, ``NotifyOcclusionState(VISIBLE)``). When X delivered ``PartiallyObscured`` and ``FullyObscured`` close to that crossing, the draw
ran 0.4 to 15 ms AFTER the ``FullyObscured`` and turned the window ``VISIBLE`` again before the posted visibility update ran, so the page never recorded
``hidden`` (hunt run 45603211231, 58 reds of 1294; shard 1 it-0014: ``VisibilityNotify state 1`` at 54.355670, ``OnContainerFocusOutEvent`` at 54.355752,
``state 2`` at 54.356290, ``OnExposeEvent`` with ``mIsFullyOccluded 0`` at 54.359166). That is Mozilla's behaviour, in retail too. The first reading, that the
focus moved to a second session's window and X sent a ``FocusOut``, was refuted by run 45620136865: 458 reds of 463 with an X cover over the pointer, and no
``FocusOut`` in 40 iterations of the old arrangement; the trigger is the pointer crossing. So the test warps the pointer to the bottom-right pixel of the
root (computed from the root's geometry) before any session starts, the cover keeps the pointer outside it, and ``pointer_or_focus_moved`` judges that no
crossing and no focus event reached the covered toplevel and that the pointer, read back once, is outside both rectangles.
* ``warp_pointer_to_the_corner``: ``XWarpPointer`` through this connection to ``(width - 1, height - 1)`` of the root, then ``XSync``;
* ``watch``: ``XSelectInput(VisibilityChangeMask | FocusChangeMask | EnterWindowMask | LeaveWindowMask)`` on the covered toplevel, before the cover is mapped.
Every client that selects a mask gets its own copy of the events, so the engine's own selection is untouched. The ``EnterNotify``, ``LeaveNotify``,
``FocusIn`` and ``FocusOut`` events are kept with their time, mode and detail;
* ``cover_window``: reads the pointer (``XQueryPointer`` of the root), creates, maps and raises the cover (``cover_rectangle`` gives its rectangle, the pointer
outside it); ``destroy_window`` destroys it;
* ``raise_and_read``: ``XRaiseWindow`` of the covering toplevel, then ONE read-back of the stacking (``XQueryTree`` of the root, bottom to top: no window
manager reparents the toplevels) and of the two geometries (``XGetWindowAttributes``, relative to the root);
* ``drain``: the ``VisibilityNotify`` events that arrived, with the time since ``watch`` (evidence only, never a verdict);
* ``read_pointer_back``: ONE ``XQueryPointer`` right after the cover is up, kept in the record with whether the pointer lies outside both rectangles;
* ``drain``: the visibility, crossing and focus events that arrived, with the time since ``watch`` (evidence, and the precondition);
* ``shrink_by_one``: ``XResizeWindow`` of the covered toplevel, one pixel narrower, the cover left above it and larger: a draw of a window that stays
covered (see ``control_sees_hidden``).
The pure parts (``visibility_of``, ``arrangement``, ``VisibilityRecord``, ``control_sees_hidden``, ``product_stays_visible``) are tested without a display in ``test_the_x_record_of_the_occlusion_test.py``.
The pure parts (``visibility_of``, ``focus_of``, ``crossing_of``, ``cover_rectangle``, ``arrangement``, ``VisibilityRecord``, ``pointer_or_focus_moved``,
``control_sees_hidden``, ``product_stays_visible``) are tested without a display in ``test_the_x_record_of_the_occlusion_test.py``.
"""
from __future__ import annotations
@@ -27,6 +48,25 @@ from _os_focus import XFocus, _XWindowAttributes
#: ``VisibilityNotify`` (``X.h``) and ``VisibilityChangeMask`` (bit 16 of the event mask).
VISIBILITY_NOTIFY = 15
VISIBILITY_CHANGE_MASK = 1 << 16
#: ``FocusIn`` and ``FocusOut`` (``X.h``) and ``FocusChangeMask`` (bit 21 of the event mask).
FOCUS_IN, FOCUS_OUT = 9, 10
FOCUS_CHANGE_MASK = 1 << 21
#: The ``mode`` and the ``detail`` of a focus event (``X.h``).
FOCUS_MODES = {0: "NotifyNormal", 1: "NotifyGrab", 2: "NotifyUngrab", 3: "NotifyWhileGrabbed"}
FOCUS_DETAILS = {0: "NotifyAncestor", 1: "NotifyVirtual", 2: "NotifyInferior", 3: "NotifyNonlinear", 4: "NotifyNonlinearVirtual", 5: "NotifyPointer",
6: "NotifyPointerRoot", 7: "NotifyDetailNone"}
FOCUS_NAMES = {FOCUS_IN: "FocusIn", FOCUS_OUT: "FocusOut"}
#: ``EnterNotify`` and ``LeaveNotify`` (``X.h``), ``EnterWindowMask`` (bit 4) and ``LeaveWindowMask`` (bit 5); their ``mode`` and ``detail`` read as the focus ones.
ENTER_NOTIFY, LEAVE_NOTIFY = 7, 8
ENTER_WINDOW_MASK, LEAVE_WINDOW_MASK = 1 << 4, 1 << 5
CROSSING_NAMES = {ENTER_NOTIFY: "EnterNotify", LEAVE_NOTIFY: "LeaveNotify"}
#: What ``watch`` selects on the covered toplevel.
WATCH_MASK = VISIBILITY_CHANGE_MASK | FOCUS_CHANGE_MASK | ENTER_WINDOW_MASK | LEAVE_WINDOW_MASK
#: ``CWBackPixel`` and ``CWOverrideRedirect`` of ``XChangeWindowAttributes``, the margin the cover has on every side of the covered toplevel (pixels) and its
#: background pixel.
CW_BACK_PIXEL, CW_OVERRIDE_REDIRECT = 1 << 1, 1 << 9
COVER_MARGIN = 32
COVER_BACKGROUND = 0x303030
#: The ``state`` of a ``VisibilityNotify``.
STATES = {0: "Unobscured", 1: "PartiallyObscured", 2: "FullyObscured"}
FULLY_OBSCURED = "FullyObscured"
@@ -57,9 +97,29 @@ class XVisibilityEvent(ctypes.Structure):
("window", ctypes.c_ulong), ("state", ctypes.c_int)]
class XFocusChangeEvent(ctypes.Structure):
_fields_ = [("type", ctypes.c_int), ("serial", ctypes.c_ulong), ("send_event", ctypes.c_int), ("display", ctypes.c_void_p),
("window", ctypes.c_ulong), ("mode", ctypes.c_int), ("detail", ctypes.c_int)]
class XCrossingEvent(ctypes.Structure):
_fields_ = [("type", ctypes.c_int), ("serial", ctypes.c_ulong), ("send_event", ctypes.c_int), ("display", ctypes.c_void_p),
("window", ctypes.c_ulong), ("root", ctypes.c_ulong), ("subwindow", ctypes.c_ulong), ("time", ctypes.c_ulong),
("x", ctypes.c_int), ("y", ctypes.c_int), ("x_root", ctypes.c_int), ("y_root", ctypes.c_int), ("mode", ctypes.c_int),
("detail", ctypes.c_int), ("same_screen", ctypes.c_int), ("focus", ctypes.c_int), ("state", ctypes.c_uint)]
class XSetWindowAttributes(ctypes.Structure):
_fields_ = [("background_pixmap", ctypes.c_ulong), ("background_pixel", ctypes.c_ulong), ("border_pixmap", ctypes.c_ulong), ("border_pixel", ctypes.c_ulong),
("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), ("event_mask", ctypes.c_long), ("do_not_propagate_mask", ctypes.c_long),
("override_redirect", ctypes.c_int), ("colormap", ctypes.c_ulong), ("cursor", ctypes.c_ulong)]
class XEvent(ctypes.Union):
"""Xlib's ``XEvent``: the type, the visibility member, and the padding of 24 longs that gives the union its size."""
_fields_ = [("type", ctypes.c_int), ("xvisibility", XVisibilityEvent), ("pad", ctypes.c_long * 24)]
"""Xlib's ``XEvent``: the type, the visibility, focus and crossing members, and the padding of 24 longs that gives the union its size."""
_fields_ = [("type", ctypes.c_int), ("xvisibility", XVisibilityEvent), ("xfocus", XFocusChangeEvent), ("xcrossing", XCrossingEvent),
("pad", ctypes.c_long * 24)]
def visibility_of(event: XEvent) -> Optional[Tuple[int, str]]:
@@ -70,12 +130,69 @@ def visibility_of(event: XEvent) -> Optional[Tuple[int, str]]:
return int(event.xvisibility.window), STATES.get(state, "state %d" % state)
def focus_of(event: XEvent) -> Optional[Tuple[int, str, str, str]]:
"""(window, ``FocusIn`` or ``FocusOut``, mode name, detail name) of a focus event; None for any other event."""
if event.type not in FOCUS_NAMES:
return None
focus = event.xfocus
return (int(focus.window), FOCUS_NAMES[event.type], FOCUS_MODES.get(focus.mode, "mode %d" % focus.mode),
FOCUS_DETAILS.get(focus.detail, "detail %d" % focus.detail))
def crossing_of(event: XEvent) -> Optional[Tuple[int, str, str, str, int, int]]:
"""(window, ``EnterNotify`` or ``LeaveNotify``, mode name, detail name, x_root, y_root) of a crossing event; None for any other event."""
if event.type not in CROSSING_NAMES:
return None
crossing = event.xcrossing
return (int(crossing.window), CROSSING_NAMES[event.type], FOCUS_MODES.get(crossing.mode, "mode %d" % crossing.mode),
FOCUS_DETAILS.get(crossing.detail, "detail %d" % crossing.detail), int(crossing.x_root), int(crossing.y_root))
def corner_of(screen: Dict[str, int]) -> Tuple[int, int]:
"""The point the pointer is warped to: the bottom-right pixel of the root, from its read-back geometry (never a fixed number)."""
return (int(screen["width"]) - 1, int(screen["height"]) - 1)
def point_in(point: Tuple[int, int], rectangle: Tuple[int, int, int, int]) -> bool:
"""Whether ``point`` is a pixel of ``rectangle`` (left, top, right, bottom; the right and bottom edges are outside, as in X)."""
return rectangle[0] <= point[0] < rectangle[2] and rectangle[1] <= point[1] < rectangle[3]
def outer(geometry: Dict[str, int]) -> Tuple[int, int, int, int]:
"""(left, top, right, bottom) of a window with its border, from ``x``, ``y``, ``width``, ``height``, ``border``."""
border = geometry.get("border", 0)
return (geometry["x"], geometry["y"], geometry["x"] + geometry["width"] + 2 * border, geometry["y"] + geometry["height"] + 2 * border)
def cover_rectangle(covered: Dict[str, int], screen: Dict[str, int], margin: int = COVER_MARGIN,
pointer: Optional[Tuple[int, int]] = None) -> Tuple[int, int, int, int]:
"""(x, y, width, height) of the cover: the covered toplevel's rectangle with its border (``outer``) and ``margin`` pixels more on every side, kept inside
the screen (``screen``: ``width`` and ``height`` of the root) where that fits; a side that the screen cuts is the covered window's own side, so the cover
always contains the covered rectangle.
With a ``pointer`` (x, y in root coordinates) the cover also leaves that pixel outside it: on the side where the margin would include the pointer, the
margin shrinks until the pointer is outside (never below the covered rectangle). A pointer inside the covered rectangle itself has no such side: an
AssertionError "arrangement: the pointer is inside the covered window, no free point on the screen"."""
left, top, right, bottom = outer(covered)
inner = (left, top, right, bottom)
if pointer is not None and point_in(pointer, inner):
raise AssertionError("arrangement: the pointer is inside the covered window, no free point on the screen: pointer %r, covered %r" % (tuple(pointer), inner))
left, top = max(left - margin, min(0, left)), max(top - margin, min(0, top))
right, bottom = min(right + margin, max(screen["width"], right)), min(bottom + margin, max(screen["height"], bottom))
if pointer is not None and point_in(pointer, (left, top, right, bottom)):
px, py = pointer
il, it, ir, ib = inner
if px >= ir:
right = px
elif px < il:
left = px + 1
elif py >= ib:
bottom = py
else:
top = py + 1
return (left, top, right - left, bottom - top)
def arrangement(stacking: Sequence[int], covered: int, cover: int, geometries: Dict[int, Optional[Dict[str, int]]]) -> Dict[str, object]:
"""What the read-back says: ``ok`` when the cover is above the covered toplevel among the root's children (``stacking``, bottom to top) and the
covered one's rectangle lies inside the cover's; with the positions and the two rectangles that decided it."""
@@ -91,63 +208,151 @@ def arrangement(stacking: Sequence[int], covered: int, cover: int, geometries: D
class VisibilityRecord:
"""The ``VisibilityNotify`` events of one watched window, each with the seconds since the watch began; events of other windows are not kept."""
"""The ``VisibilityNotify``, crossing (``EnterNotify``, ``LeaveNotify``) and focus (``FocusIn``, ``FocusOut``) events of one watched window, each with the
seconds since the watch began; events of other windows are not kept."""
def __init__(self, window: int) -> None:
self.window = window
self.events: List[Dict[str, object]] = []
self.focus: List[Dict[str, object]] = []
self.crossings: List[Dict[str, object]] = []
#: The pointer read back once after the cover was up (``XVisibility.read_pointer_back``), or None.
self.pointer: Optional[Dict[str, object]] = None
def add(self, window: int, state: str, since: float) -> None:
if window == self.window:
self.events.append({"state": state, "t": round(since, 4)})
def add_focus(self, window: int, kind: str, mode: str, detail: str, since: float) -> None:
if window == self.window:
self.focus.append({"event": kind, "mode": mode, "detail": detail, "t": round(since, 4)})
def add_crossing(self, window: int, kind: str, mode: str, detail: str, since: float, x_root: int = 0, y_root: int = 0) -> None:
if window == self.window:
self.crossings.append({"event": kind, "mode": mode, "detail": detail, "t": round(since, 4), "at": [x_root, y_root]})
def first(self, state: str = FULLY_OBSCURED) -> Optional[Dict[str, object]]:
return next((event for event in self.events if event["state"] == state), None)
def focus_out(self) -> Optional[Dict[str, object]]:
"""The first ``FocusOut`` the watched window got, or None."""
return next((event for event in self.focus if event["event"] == "FocusOut"), None)
def line(self) -> str:
"""One line: the states X sent, in order, with their times."""
"""One line: the states X sent, in order, with their times, then the crossings and the focus events (none: nothing is said of them)."""
if not self.events:
return "X sent window 0x%x no VisibilityNotify" % self.window
return "X sent window 0x%x: %s" % (self.window, ", ".join("%s at +%.3f s" % (event["state"], event["t"]) for event in self.events))
seen = "X sent window 0x%x no VisibilityNotify" % self.window
else:
seen = "X sent window 0x%x: %s" % (self.window, ", ".join("%s at +%.3f s" % (event["state"], event["t"]) for event in self.events))
if self.crossings:
seen += "; pointer: %s" % ", ".join("%s at +%.3f s (%s, %s)" % (event["event"], event["t"], event["mode"], event["detail"]) for event in self.crossings)
if self.focus:
seen += "; focus: %s" % ", ".join("%s at +%.3f s (%s, %s)" % (event["event"], event["t"], event["mode"], event["detail"]) for event in self.focus)
return seen
def as_dict(self) -> Dict[str, object]:
first = self.first()
first, out = self.first(), self.focus_out()
return {"window": "0x%x" % self.window, "events": list(self.events), "fully obscured arrived": first is not None,
"fully obscured at": first["t"] if first else None}
"fully obscured at": first["t"] if first else None, "focus events": list(self.focus), "focus out arrived": out is not None,
"focus out at": out["t"] if out else None, "crossings": list(self.crossings), "pointer read back": self.pointer}
def pointer_or_focus_moved(record: Optional[VisibilityRecord]) -> str:
"""The judgement of the precondition: '' when the covered toplevel got no ``EnterNotify``, ``LeaveNotify``, ``FocusIn`` or ``FocusOut`` since the watch began
and the pointer, read back once after the cover was up, lies outside both rectangles; else the message of the red, which starts with "arrangement: the
covering moved the pointer or the focus" and carries the X record. A pointer crossing is turned by GDK into a GTK focus-out and that makes GTK draw the
window (``nsWindow::OnExposeEvent``, ``NotifyOcclusionState(VISIBLE)``) at a moment the test does not control, so a run that had one proves nothing about
the verdict. A record with no pointer read back is not judged on the pointer (the test asserts that the read-back was made)."""
if record is None:
return ""
reasons = []
if record.crossings:
first = record.crossings[0]
reasons.append("the covered toplevel got %s at +%.3f s after the watch began (%d crossing event(s))" % (first["event"], first["t"], len(record.crossings)))
if record.focus:
first = record.focus[0]
reasons.append("the covered toplevel got %s at +%.3f s after the watch began (%d focus event(s))" % (first["event"], first["t"], len(record.focus)))
pointer = record.pointer
if pointer is not None and not (pointer.get("outside covered") and pointer.get("outside cover")):
reasons.append("the pointer read back at %r is inside the covered rectangle (outside: %s) or the cover's (outside: %s)" % (
pointer.get("at"), pointer.get("outside covered"), pointer.get("outside cover")))
if not reasons:
return ""
return ("arrangement: the covering moved the pointer or the focus: %s, so the page may have been drawn again after X's FullyObscured and the run proves "
"nothing about the engine; %s" % ("; ".join(reasons), record.line()))
class XVisibility(XFocus):
"""A test's own connection to the display: watches the visibility of one toplevel, raises another and reads the two back."""
"""A test's own connection to the display: watches the visibility and the focus events of one toplevel, covers it with a window of its own, raises that
window and reads the two back."""
def __init__(self, display: str) -> None:
super().__init__(display)
x11 = self.x11
x11.XSelectInput.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_long)
x11.XCreateSimpleWindow.restype = ctypes.c_ulong
x11.XCreateSimpleWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint,
ctypes.c_ulong, ctypes.c_ulong)
x11.XChangeWindowAttributes.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong, ctypes.POINTER(XSetWindowAttributes))
x11.XMapWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong)
x11.XDestroyWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong)
x11.XRaiseWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong)
x11.XWarpPointer.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_ulong, ctypes.c_int, ctypes.c_int, ctypes.c_uint, ctypes.c_uint, ctypes.c_int,
ctypes.c_int)
x11.XQueryPointer.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.POINTER(ctypes.c_ulong), ctypes.POINTER(ctypes.c_ulong),
ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int),
ctypes.POINTER(ctypes.c_uint))
x11.XResizeWindow.argtypes = (ctypes.c_void_p, ctypes.c_ulong, ctypes.c_uint, ctypes.c_uint)
x11.XPending.argtypes = (ctypes.c_void_p,)
x11.XNextEvent.argtypes = (ctypes.c_void_p, ctypes.POINTER(XEvent))
self.record: Optional[VisibilityRecord] = None
self.started = 0.0
#: Where ``warp_pointer_to_the_corner`` put the pointer, and the root geometry it was computed from.
self.warped: Optional[Dict[str, object]] = None
def query_pointer(self) -> Tuple[int, int]:
"""The pointer's position in root coordinates (``XQueryPointer`` of the root)."""
root, child = ctypes.c_ulong(), ctypes.c_ulong()
root_x, root_y, win_x, win_y, mask = ctypes.c_int(), ctypes.c_int(), ctypes.c_int(), ctypes.c_int(), ctypes.c_uint()
self.x11.XQueryPointer(self.connection, self.root, ctypes.byref(root), ctypes.byref(child), ctypes.byref(root_x), ctypes.byref(root_y),
ctypes.byref(win_x), ctypes.byref(win_y), ctypes.byref(mask))
return (int(root_x.value), int(root_y.value))
def warp_pointer_to_the_corner(self) -> Tuple[int, int]:
"""Before any session starts: ``XWarpPointer`` through this connection to the bottom-right pixel of the root (``corner_of`` its read-back geometry), then
``XSync``. No toplevel exists yet, so none gets a crossing from it; the pointer is read back and kept in ``warped``."""
screen = self.geometry(self.root)
assert screen, "arrangement: the geometry of the root could not be read"
x, y = corner_of(screen)
self.x11.XWarpPointer(self.connection, 0, self.root, 0, 0, 0, 0, x, y)
self.x11.XSync(self.connection, False)
self.warped = {"to": [x, y], "root": [screen["width"], screen["height"]], "read back": list(self.query_pointer())}
return (x, y)
def drain(self) -> Optional[VisibilityRecord]:
"""Reads every event that arrived (none blocks: ``XPending`` first) into the record of the watched window."""
"""Reads every event that arrived (none blocks: ``XPending`` first) into the record of the watched window: visibility, crossing and focus events."""
self.x11.XSync(self.connection, False)
event = XEvent()
while self.x11.XPending(self.connection) > 0:
self.x11.XNextEvent(self.connection, ctypes.byref(event))
seen = visibility_of(event)
if seen and self.record is not None:
self.record.add(seen[0], seen[1], time.monotonic() - self.started)
seen, focus, crossing = visibility_of(event), focus_of(event), crossing_of(event)
if self.record is not None:
if crossing:
self.record.add_crossing(crossing[0], crossing[1], crossing[2], crossing[3], time.monotonic() - self.started, crossing[4], crossing[5])
if seen:
self.record.add(seen[0], seen[1], time.monotonic() - self.started)
if focus:
self.record.add_focus(focus[0], focus[1], focus[2], focus[3], time.monotonic() - self.started)
return self.record
def watch(self, window: int) -> VisibilityRecord:
"""From now on, the ``VisibilityNotify`` events of ``window``; what was queued before (an earlier window's) is read and dropped first."""
"""From now on, the ``VisibilityNotify``, ``EnterNotify``/``LeaveNotify`` and ``FocusIn``/``FocusOut`` events of ``window``; what was queued before (an
earlier window's) is read and dropped first."""
self.record = None
self.drain()
self.record = VisibilityRecord(window)
self.started = time.monotonic()
self.x11.XSelectInput(self.connection, window, VISIBILITY_CHANGE_MASK)
self.x11.XSelectInput(self.connection, window, WATCH_MASK)
self.x11.XSync(self.connection, False)
return self.record
@@ -169,6 +374,42 @@ class XVisibility(XFocus):
return {"x": attributes.x, "y": attributes.y, "width": attributes.width, "height": attributes.height, "border": attributes.border_width,
"map state": MAP_STATES.get(attributes.map_state, attributes.map_state), "override redirect": bool(attributes.override_redirect)}
def cover_window(self, covered: int, margin: int = COVER_MARGIN) -> int:
"""The cover: an override-redirect ``InputOutput`` window of this connection, covering ``covered`` with ``margin`` pixels more on every side (inside the
screen where it fits, the pointer, read with ``XQueryPointer``, outside it: ``cover_rectangle``), mapped and raised, the requests flushed. An
override-redirect window is not managed, and nothing here asks for the input focus (no ``XSetInputFocus``). No event is selected on it. The pointer
inside the covered window is an AssertionError "arrangement: the pointer is inside the covered window, no free point on the screen"."""
inner, screen = self.geometry(covered), self.geometry(self.root)
assert inner and screen, "arrangement: the geometry of the covered toplevel or of the root could not be read: %r, %r" % (inner, screen)
x, y, width, height = cover_rectangle(inner, screen, margin, self.query_pointer())
window = int(self.x11.XCreateSimpleWindow(self.connection, self.root, x, y, width, height, 0, 0, COVER_BACKGROUND))
assert window, "arrangement: XCreateSimpleWindow gave no window"
attributes = XSetWindowAttributes()
attributes.override_redirect = 1
attributes.background_pixel = COVER_BACKGROUND
self.x11.XChangeWindowAttributes(self.connection, window, CW_OVERRIDE_REDIRECT | CW_BACK_PIXEL, ctypes.byref(attributes))
self.x11.XMapWindow(self.connection, window)
self.x11.XRaiseWindow(self.connection, window)
self.x11.XSync(self.connection, False)
return window
def read_pointer_back(self, covered: int, cover: int) -> Dict[str, object]:
"""ONE ``XQueryPointer`` right after the cover is up: where the pointer is and whether it lies outside the covered rectangle and the cover's. Kept in the
record of the watch (``pointer``) and returned."""
at = self.query_pointer()
rectangles = {name: outer(geometry) if geometry else None for name, geometry in (("covered", self.geometry(covered)), ("cover", self.geometry(cover)))}
seen = {"at": list(at), "covered rect": rectangles["covered"], "cover rect": rectangles["cover"],
"outside covered": rectangles["covered"] is not None and not point_in(at, rectangles["covered"]),
"outside cover": rectangles["cover"] is not None and not point_in(at, rectangles["cover"])}
if self.record is not None:
self.record.pointer = seen
return seen
def destroy_window(self, window: int) -> None:
"""``XDestroyWindow`` of a window this connection made (the cover); nothing else."""
self.x11.XDestroyWindow(self.connection, window)
self.x11.XSync(self.connection, False)
def raise_and_read(self, covered: int, cover: int) -> Dict[str, object]:
"""``XRaiseWindow`` of ``cover``, then the one read-back: the stacking, the geometries of the two, and every viewable child of the root."""
self.x11.XRaiseWindow(self.connection, cover)
+100 -8
View File
@@ -1,4 +1,3 @@
import faulthandler
import http.server
import os
import random
@@ -10,6 +9,8 @@ from pathlib import Path
import pytest
import _stack_watchdog
import _watchdog_log
from _servers import LocalServer
from _browser_census import _a_module_leaves_no_browser_open, _the_connections_a_test_made_are_closed_with_it # noqa: F401 (autouse)
@@ -42,9 +43,7 @@ from _browser_census import _a_module_leaves_no_browser_open, _the_connections_a
# under pytest. A file survives the kill and gets uploaded as an artifact on
# CI.
_WATCHDOG_S = float(os.environ.get("INVPW_TEST_WATCHDOG_S", "150"))
_WATCHDOG_FILE = os.environ.get(
"INVPW_TEST_WATCHDOG_FILE",
str(Path(tempfile.gettempdir()) / "invpw-e2e-watchdog.log"))
_WATCHDOG_FILE = _watchdog_log.default_log_path(os.environ, tempfile.gettempdir())
_watchdog_handle = None
@@ -60,6 +59,7 @@ def _watchdog_open():
if _watchdog_handle is not None or _WATCHDOG_S <= 0:
return _watchdog_handle
try:
os.makedirs(os.path.dirname(_WATCHDOG_FILE) or ".", exist_ok=True)
_watchdog_handle = open(_WATCHDOG_FILE, "a", buffering=1, encoding="utf-8")
except OSError:
# A watchdog that fails the suite over its OWN problem is worse than
@@ -71,6 +71,10 @@ def _watchdog_open():
def pytest_configure(config):
# Windows jobs that keep WER dumps (INVPW_WER_DUMPS, exported by the job): the controller and every xdist worker clear SEM_NOGPFAULTERRORBOX of their error mode,
# which the runner gives them (0x0003) and which keeps a crashing worker from ever reaching Windows Error Reporting (tests/_wer_error_mode.py).
import _wer_error_mode
_wer_error_mode.clear_for_wer_dumps()
# 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
@@ -91,13 +95,13 @@ def pytest_runtest_setup(item):
return
handle = _watchdog_open()
if handle is not None:
handle.write("\n--- %s ---\n" % item.nodeid)
faulthandler.dump_traceback_later(_WATCHDOG_S, repeat=True, file=handle)
# A Python thread that holds the GIL, not faulthandler.dump_traceback_later: that one copies the frames of every thread without the GIL and crashed a worker (tests/_stack_watchdog.py).
_stack_watchdog.arm(item.nodeid, _WATCHDOG_S, file=handle)
def pytest_runtest_teardown(item, nextitem):
if _watchdog_handle is not None:
faulthandler.cancel_dump_traceback_later()
_stack_watchdog.cancel()
@pytest.hookimpl(wrapper=True)
@@ -125,7 +129,7 @@ def pytest_collection_modifyitems(config, items):
def pytest_unconfigure(config):
global _watchdog_handle
if _watchdog_handle is not None:
faulthandler.cancel_dump_traceback_later()
_stack_watchdog.cancel()
_watchdog_handle.close()
_watchdog_handle = None
@@ -177,6 +181,22 @@ def _offline_session_geo(request, monkeypatch):
monkeypatch.setattr(_session, "session_geo", lambda *_a, **_k: geo)
@pytest.fixture(autouse=True)
def _a_test_that_is_not_e2e_never_leaves_the_machine(request, monkeypatch):
"""Outside the e2e, every connection, datagram and name lookup goes to this host or is refused, and the test fails naming each
destination it tried (tests/_no_network.py), even when the code under test swallowed the refusal."""
if request.node.get_closest_marker("e2e") is not None:
yield
return
import _no_network
guard = _no_network.install(monkeypatch, request.node.nodeid)
yield
failure = guard.verdict()
if failure:
pytest.fail(failure, pytrace=False)
@pytest.fixture(autouse=True)
def _what_the_core_declares_for_a_proxy_is_recorded(monkeypatch):
"""The core keeps no UDP verdict in memory, so a test that wants to know what the launch declared reads it where it is
@@ -254,6 +274,78 @@ def _no_test_asks_the_world_where_it_leaves_from():
pytest.fail("the question of the exit went toward the internet: " + "; ".join(asked), pytrace=False)
@pytest.fixture(autouse=True)
def _the_browser_log_holds_no_line_that_fails_the_test(request, monkeypatch):
"""An e2e test fails when a browser it launched wrote a line that fails it (``tests/_browser_log.py``: the engine's expired wait for ``popupshown`` among them), and the failure names the line."""
if request.node.get_closest_marker("e2e") is None:
yield
return
import _browser_log
sink = _browser_log.Sink()
_browser_log.install(monkeypatch, sink)
yield
sink.fail_if_any()
def _park_the_os_cursor():
"""Windows: the OS cursor goes where no window of the browsers below the test process covers (the bottom-right corner while none is open), read back."""
if sys.platform == "win32":
import _os_cursor
_os_cursor.park()
@pytest.fixture(scope="module", autouse=True)
def _the_os_cursor_is_outside_the_browser_window_of_a_module(request):
"""A browser a module-scoped fixture starts opens its window before any test of the module runs: the cursor is parked before that, once per module that has an
e2e test (``tests/_os_cursor.py``; Windows only, the Linux e2e run under xvfb-run whose pointer is virtual)."""
if sys.platform == "win32" and any(getattr(item, "module", None) is request.module and item.get_closest_marker("e2e") is not None
for item in request.session.items):
_park_the_os_cursor()
@pytest.fixture(autouse=True)
def _the_os_cursor_is_outside_the_browser_window(request):
"""A headed window that opens under the real cursor gets a native mouse move for it (the runner's cursor is at 512,384, inside the window), and the first
native move of a process passes Gecko's filter: the page sees a ``mousemove`` with ``buttons=0`` in the middle of the gesture a test records. Every e2e
test on Windows starts with the cursor parked outside the window the engine opens, before its browser starts. A ``headless=True`` browser runs on a desktop of
its own and never receives it; the parking is the same for it and costs one system call. The gestures that record pointer events then call
``_os_cursor.require_outside()`` at their start."""
if request.node.get_closest_marker("e2e") is not None:
_park_the_os_cursor()
@pytest.fixture
def lab_exit(monkeypatch, tmp_path):
"""The exit of the lab and its GeoIP database, declared for one test that is not e2e (``tests/_lab_egress.py``, as the e2e have it).
With no proxy the core asks where this machine leaves from once per composition (``prepare_session_geo``: zone, language and position
come from the exit, even when the zone is given), and a test that is not e2e never leaves the machine (``tests/_no_network.py``). A test
that composes prefs or a session through the core takes this fixture."""
import _lab_egress
return _lab_egress.install(monkeypatch, tmp_path / "lab-geoip")
@pytest.fixture
def declared_engine(monkeypatch, tmp_path):
"""An engine executable declared for one test that is not e2e, instead of the one the core resolves.
Without ``binary_path=`` the launch resolves the engine through ``ensure_binary`` (``_engine.resolve_executable``): with an engine in
the cache of the machine it answers at once, and with none it asks GitHub's release index and downloads the archive. So a unit test that
composes a launch passed on a machine that had run ``fetch`` and went to the internet on a fresh runner, and a test that is not e2e
never leaves the machine (``tests/_no_network.py``). The file is never run: the tests that take this fixture stop at the environment,
the arguments or a fake ``launch``. Returns its path."""
from invisible_playwright import _engine
executable = tmp_path / "declared-engine" / ("firefox.exe" if sys.platform == "win32" else "firefox")
executable.parent.mkdir(parents=True)
executable.write_bytes(b"")
monkeypatch.setattr(_engine, "ensure_binary", lambda *a, **k: executable)
return executable
@pytest.fixture
def local_egress_echo(monkeypatch):
"""The REAL discovery of the exit, for the test that must prove it, against an echo service of its own on loopback: the three services of the
@@ -0,0 +1,358 @@
#!/usr/bin/env python3
"""CI known Mozilla defects - the list of crashes a test may meet and the matcher that reads it (stdlib only, Python >= 3.11).
A crash that comes from a defect of Mozilla's own Firefox (one the stock browser has too) is not fixed by a patch of ours (see the
engine's rule on Mozilla defects); the tests that meet it still have to say so by name and not by a threshold, a skip or a rerun.
That is this file's job. Each repository that judges crashes keeps a list (the core and the wrapper: ci/mozilla-defects.json; the series:
tools/mozilla-defects.json), a JSON array with one row per known defect. The matcher is shared: every repository reads it from the
core's main, so the judge is never the branch being judged (the way scripts/ci_regressions.py is read).
THE RULE, as a question every verdict asks of every crash:
Does the crash match exactly an entry of ci/mozilla-defects.json (D<n>, bug, signature: process type, thread or frame, exit phase),
and does the entry hold for the Firefox version of the engine under test?
A row:
{"id": "D<n>", "bug": "<https://bugzilla.mozilla.org/show_bug.cgi?id=N, or empty until the bug is filed>",
"firefox": {"from": "<major.minor>", "to": "<major.minor or major.*>"},
"signature": {"process": "<parent|tab|gpu|rdd|socket|utility|backgroundtask|...>", "phase": "startup|run|exit",
"thread": "<thread name, optional>", "frames": ["<top frame>", "..."], "reason": "<optional>"},
"seen": "<owner>/<repo>/actions/runs/<digits>[/job/<digits>]", "why": "<one line>"}
`frames` is optional: an ordered prefix of the top frames of the crashing thread. `reason` is optional: the MOZ_CRASH text, the signal or
the NTSTATUS. A signature must declare `process`, `phase` and at least one of `thread` or `frames`. Ids are unique. `firefox` is the range
of Firefox releases the row was seen on and still holds for, both ends included: `from` is a major.minor, `to` is a major.minor or
`<major>.*` (every minor of that major). The engine under test is a version string such as 159.0 or 159.0.1; only major.minor decides.
The crash record `C` is the one record a judge builds from its evidence:
{"process": "...", "phase": "...", "thread": "...", "frames": ["<top frame first>", "..."], "reason": "..."}
EXACT means exactly that: every field the row's signature declares is equal to the crash's field (frames: the row's list equals the first
len(row frames) frames of the crash, in order, so a crash with fewer frames than the row misses). No regular expression, no wildcard, no
case folding, no substring. A field the row does not declare is not compared. A row whose range does not contain the engine cannot match.
ci_mozilla_defects.py check --file F --engine-version V
the schema of every row, every id once, and every row's range contains V. A row whose range does not contain V is RED: the port
that moved the engine to V re-justifies the row for this version (a new range and a new `seen`) or drops it.
ci_mozilla_defects.py match --file F --engine-version V --crash C.json
the crash record C against the rows of F that hold for V. Exit 0 and one line `MATCHED D<n> (<bug or 'not filed'>): <why>`, which
the caller prints and counts. Exit 1 and `no known defect matches: the crash stays red` with the record printed.
Exit codes: 0 ok (or matched); 1 red (a problem in the file, or no match); 2 the checker cannot run (a file that cannot be read or is
not JSON, a version that is not major.minor[.patch], a crash record that is not a record) - the caller treats 2 as red, never as a pass;
3 usage. Every problem prints one line:
FAIL <where>: <what>. Fix: <how>. Rule: <the rule, short>
A Python API for the callers in other repositories (they import this file by path, from the core's main): `load(path)`,
`problems(rows, version, name=...)`, `match(rows, version, crash) -> row | None` and
`verdict(rows, version, crashes, measurements_complete) -> (red, lines)`. `load` and the version parsing raise `CannotRun`.
THE VERDICT RULE (`verdict`). A match excuses ONLY the crash itself. The test's own assertions still have to pass, and every measurement
must be present, compared and equal; a crash that cost a measurement (a visit that has no result, a dump that was not written) stays red
as a missing result, even when the defect matched. So the verdict is RED when any crash has no match; RED when `measurements_complete`
is False (even if every crash matched: the line names the defect that matched and says what is missing is the caller's to print); RED
when the file has any problem (including a range that does not contain the engine). Otherwise it is not red and has one line per matched
crash, naming its D<n>. Never a skip, never a threshold, never a rerun.
"""
from __future__ import annotations
import argparse
import json
import re
import sys
from pathlib import Path
RULE = ("Does the crash match exactly an entry of ci/mozilla-defects.json (D<n>, bug, signature: process type, thread or frame, "
"exit phase), and does the entry hold for the Firefox version of the engine under test?")
SHORT_RULE = "known Mozilla defect, exact match and range (ci/mozilla-defects.json)"
DEFAULT_NAME = "ci/mozilla-defects.json"
PHASES = ("startup", "run", "exit")
ROW_KEYS = {"id", "bug", "firefox", "signature", "seen", "why"}
SIGNATURE_KEYS = {"process", "phase", "thread", "frames", "reason"}
CRASH_KEYS = {"process", "phase", "thread", "frames", "reason"}
_ID = re.compile(r"^D\d+$")
_BUG = re.compile(r"^https://bugzilla\.mozilla\.org/show_bug\.cgi\?id=\d+$")
_RUN = re.compile(r"^[\w.-]+/[\w.-]+/actions/runs/\d+(/job/\d+)?$")
_VERSION = re.compile(r"^(\d+)\.(\d+)(\.\d+)*$")
_FROM = re.compile(r"^(\d+)\.(\d+)$")
_TO = re.compile(r"^(\d+)\.(\d+|\*)$")
_ANY_MINOR = 10 ** 9
class CannotRun(Exception):
"""The checker cannot run (exit 2): unreadable file, not JSON, a bad version string or a bad crash record."""
def _line(where: str, what: str, fix: str) -> str:
return "FAIL %s: %s. Fix: %s. Rule: %s" % (where, what, fix, SHORT_RULE)
def _text(value: object) -> bool:
return isinstance(value, str) and bool(value.strip()) and "\n" not in value
def parse_version(version: object) -> tuple[int, int]:
"""major.minor of an engine version such as 159.0 or 159.0.1; CannotRun for anything else."""
m = _VERSION.match(version) if isinstance(version, str) else None
if not m:
raise CannotRun("the engine version %r is not major.minor[.patch] (such as 159.0 or 159.0.1)" % (version,))
return int(m.group(1)), int(m.group(2))
def load(path: "str | Path") -> list:
"""The rows of a defects file; CannotRun when it cannot be read or is not JSON. Not being an array is a schema problem, not here."""
try:
raw = Path(path).read_bytes()
except OSError as exc:
raise CannotRun("the file %s cannot be read (%s)" % (path, exc)) from exc
try:
return json.loads(raw.decode("utf-8"))
except (UnicodeDecodeError, ValueError) as exc:
raise CannotRun("the file %s is not JSON (%s)" % (path, exc)) from exc
def _range(row: object) -> "tuple[tuple[int, int], tuple[int, int]] | None":
"""((from major, minor), (to major, minor or _ANY_MINOR)) of a well-formed range, else None."""
rng = row.get("firefox") if isinstance(row, dict) else None
if not isinstance(rng, dict):
return None
lo, hi = rng.get("from"), rng.get("to")
ml = _FROM.match(lo) if isinstance(lo, str) else None
mh = _TO.match(hi) if isinstance(hi, str) else None
if not ml or not mh:
return None
low = (int(ml.group(1)), int(ml.group(2)))
high = (int(mh.group(1)), _ANY_MINOR if mh.group(2) == "*" else int(mh.group(2)))
return (low, high) if low <= high else None
def _where(name: str, row: object, index: int) -> str:
rid = row.get("id") if isinstance(row, dict) else None
if isinstance(rid, str) and _ID.match(rid):
return "%s row %s" % (name, rid)
return "%s row #%d" % (name, index)
def _row_problems(row: object, where: str) -> list[str]:
if not isinstance(row, dict):
return [_line(where, "the row is not an object", "write the row as a JSON object with the fields of the format")]
out: list[str] = []
for key in sorted(set(row) - ROW_KEYS):
out.append(_line(where, "unknown field %r" % key, "remove it; the format has only %s" % ", ".join(sorted(ROW_KEYS))))
for key in sorted(ROW_KEYS - set(row)):
out.append(_line(where, "field %r is missing" % key, "add it (`bug` may be an empty string until the bug is filed)"))
if "id" in row and not (isinstance(row["id"], str) and _ID.match(row["id"])):
out.append(_line(where, "field 'id' is not D<n> (%r)" % (row["id"],), "write it as D followed by digits, such as D31"))
if "bug" in row and not (row["bug"] == "" or (isinstance(row["bug"], str) and _BUG.match(row["bug"]))):
out.append(_line(where, "field 'bug' is neither empty nor a Bugzilla URL (%r)" % (row["bug"],),
"write https://bugzilla.mozilla.org/show_bug.cgi?id=<digits>, or an empty string until the bug is filed"))
if "seen" in row and not (isinstance(row["seen"], str) and _RUN.match(row["seen"])):
out.append(_line(where, "field 'seen' is not a run (%r)" % (row["seen"],),
"write <owner>/<repo>/actions/runs/<digits>[/job/<digits>]"))
if "why" in row and not _text(row["why"]):
out.append(_line(where, "field 'why' is empty or not one line", "write why this crash is Mozilla's in one line"))
if "firefox" in row and _range(row) is None:
out.append(_line(where, "field 'firefox' is not {\"from\": \"<major.minor>\", \"to\": \"<major.minor or major.*>\"} with from <= to (%r)"
% (row["firefox"],), "write the range of Firefox releases, both ends included, such as 159.0 to 159.*"))
if "signature" in row:
out.extend(_signature_problems(row["signature"], where))
return out
def _signature_problems(sig: object, where: str) -> list[str]:
if not isinstance(sig, dict):
return [_line(where, "field 'signature' is not an object", "write {\"process\": ..., \"phase\": ..., \"thread\": ... or \"frames\": ...}")]
out: list[str] = []
for key in sorted(set(sig) - SIGNATURE_KEYS):
out.append(_line(where, "unknown signature field %r" % key,
"remove it; a signature has only %s" % ", ".join(sorted(SIGNATURE_KEYS))))
for key in ("process", "phase"):
if key not in sig:
out.append(_line(where, "signature field %r is missing" % key, "declare it: a signature names the process type and the phase"))
if "thread" not in sig and "frames" not in sig:
out.append(_line(where, "the signature declares neither 'thread' nor 'frames'",
"declare the crashing thread's name or the top frames (an ordered prefix): the process and the phase alone match too much"))
if "process" in sig and not _text(sig["process"]):
out.append(_line(where, "signature field 'process' is empty or not one line", "write the process type, such as parent or gpu"))
if "phase" in sig and sig["phase"] not in PHASES:
out.append(_line(where, "signature field 'phase' is %r" % (sig["phase"],), "use one of %s" % ", ".join(PHASES)))
for key in ("thread", "reason"):
if key in sig and not _text(sig[key]):
out.append(_line(where, "signature field %r is empty or not one line" % key, "write the exact text, or remove the field"))
if "frames" in sig and not (isinstance(sig["frames"], list) and sig["frames"] and all(_text(f) for f in sig["frames"])):
out.append(_line(where, "signature field 'frames' is not a non-empty list of frame names",
"write the top frames of the crashing thread, top first, one string each"))
return out
def problems(rows: object, version: str, name: str = DEFAULT_NAME) -> list[str]:
"""Every problem of the file for the engine `version`: schema, duplicate ids, and a range that does not contain the engine."""
ver = parse_version(version)
if not isinstance(rows, list):
return [_line(name, "the file is not a JSON array of rows", "write the file as an array, [] when no defect is known")]
out: list[str] = []
seen_ids: dict[str, int] = {}
for index, row in enumerate(rows):
where = _where(name, row, index)
out.extend(_row_problems(row, where))
rid = row.get("id") if isinstance(row, dict) else None
if isinstance(rid, str) and _ID.match(rid):
if rid in seen_ids:
out.append(_line(where, "the id %s is also row #%d" % (rid, seen_ids[rid]),
"give every defect its own D<n>; one row per defect"))
else:
seen_ids[rid] = index
rng = _range(row)
if rng is not None and not rng[0] <= ver <= rng[1]:
out.append(_line(where, "its range %s to %s does not contain the engine under test (%s)"
% (row["firefox"]["from"], row["firefox"]["to"], version),
"the port re-justifies the row for this version (a new range and a new `seen`) or drops it"))
return out
def _crash_problem(crash: object) -> "str | None":
if not isinstance(crash, dict):
return "the crash record is not an object"
extra = sorted(set(crash) - CRASH_KEYS)
if extra:
return "the crash record has unknown fields %s" % ", ".join(extra)
for key in ("process", "phase"):
if not isinstance(crash.get(key), str):
return "the crash record has no string %r" % key
for key in ("thread", "reason"):
if key in crash and not isinstance(crash[key], str):
return "the crash record field %r is not a string" % key
frames = crash.get("frames", [])
if not (isinstance(frames, list) and all(isinstance(f, str) for f in frames)):
return "the crash record field 'frames' is not a list of strings"
return None
def _equal(row: dict, crash: dict) -> bool:
sig = row["signature"]
for key in ("process", "phase", "thread", "reason"):
if key in sig and sig[key] != crash.get(key):
return False
if "frames" in sig:
frames = crash.get("frames", [])
if frames[:len(sig["frames"])] != sig["frames"]:
return False
return True
def match(rows: object, version: str, crash: object) -> "dict | None":
"""The first row that holds for `version` and whose signature equals the crash field by field; None otherwise. CannotRun on a bad record."""
ver = parse_version(version)
bad = _crash_problem(crash)
if bad:
raise CannotRun(bad)
if not isinstance(rows, list):
return None
for row in rows:
if not isinstance(row, dict) or _row_problems(row, "x"):
continue # a malformed row never matches; `problems` is what says so
rng = _range(row)
if rng is None or not rng[0] <= ver <= rng[1]:
continue
if _equal(row, crash):
return row
return None
def _matched_line(row: dict) -> str:
return "MATCHED %s (%s): %s" % (row["id"], row["bug"] or "not filed", row["why"])
def verdict(rows: object, version: str, crashes: list, measurements_complete: bool,
name: str = DEFAULT_NAME) -> "tuple[bool, list[str]]":
"""(red, lines) of a test that met `crashes` (the crash records it found, possibly none).
A match excuses only the crash itself. Red when any crash has no match; red when `measurements_complete` is False even if every crash
matched; red when the file has any problem. Otherwise not red, with one MATCHED line per matched crash. No skip, no threshold, no rerun."""
lines = problems(rows, version, name)
red = bool(lines)
matched: list[dict] = []
for index, crash in enumerate(crashes):
where = "crash #%d" % index
try:
row = match(rows, version, crash)
except CannotRun as exc:
lines.append(_line(where, "%s" % exc, "build the record {process, phase, thread, frames, reason} from the crash evidence"))
red = True
continue
if row is None:
lines.append(_line(where, "no known defect matches: the crash stays red (%s)" % json.dumps(crash, sort_keys=True),
"fix the product, or declare the crash as a Mozilla defect with its bug and an exact signature in %s" % name))
red = True
else:
matched.append(row)
lines.append(_matched_line(row))
if not measurements_complete:
red = True
names = ", ".join(r["id"] for r in matched)
what = ("the crash matched %s, which excuses the crash only, and a measurement is missing" % names
if matched else "a measurement is missing")
lines.append(_line("measurements", what,
"a missing result stays red: the test's own assertions and every measurement must still pass; the caller "
"prints which measurement is missing"))
return red, lines
class _Parser(argparse.ArgumentParser):
def error(self, message: str) -> None: # usage is exit 3, as the rule of exit codes says
self.print_usage(sys.stderr)
sys.stderr.write("%s: error: %s\n" % (self.prog, message))
raise SystemExit(3)
def _build_parser() -> argparse.ArgumentParser:
ap = _Parser(prog="ci_mozilla_defects.py", description=__doc__.split("\n", 1)[0])
sub = ap.add_subparsers(dest="mode", required=True, parser_class=_Parser)
for mode in ("check", "match"):
p = sub.add_parser(mode)
p.add_argument("--file", required=True)
p.add_argument("--engine-version", required=True)
if mode == "match":
p.add_argument("--crash", required=True)
return ap
def main(argv: "list[str] | None" = None) -> int:
args = _build_parser().parse_args(argv)
try:
rows = load(args.file)
version = args.engine_version
parse_version(version)
found = problems(rows, version, str(args.file))
if args.mode == "check":
for line in found:
print(line)
if found:
return 1
print("OK ci_mozilla_defects check: %d known defect(s), every range contains the engine %s" % (len(rows), version))
return 0
try:
crash = json.loads(Path(args.crash).read_text(encoding="utf-8"))
except (OSError, ValueError) as exc:
raise CannotRun("the crash record %s cannot be read as JSON (%s)" % (args.crash, exc)) from exc
row = match(rows, version, crash) if not found else None
for line in found:
print(line)
if row is None:
print("no known defect matches: the crash stays red")
print(json.dumps(crash, sort_keys=True))
return 1
print(_matched_line(row))
return 0
except CannotRun as exc:
print(_line("ci_mozilla_defects", "cannot run: %s" % exc,
"give a readable JSON file, an engine version such as 159.0 and a crash record"))
return 2
if __name__ == "__main__":
sys.exit(main())
@@ -0,0 +1,216 @@
[New LWP 14305]
[New LWP 14187]
[New LWP 14246]
[New LWP 14202]
[New LWP 14233]
[New LWP 14241]
[New LWP 14242]
[New LWP 14244]
[New LWP 14201]
[New LWP 14452]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `/tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/firefox --backg'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fd9cb69ebec in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
[Current thread is 1 (Thread 0x7fd9a5b896c0 (LWP 14305))]
Thread 10 (Thread 0x7fd9ab6ff6c0 (LWP 14452)):
#0 0x00007fd9cb6ecb9f in clock_nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9cb6f9ae7 in nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007fd9cb72997c in usleep () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007fd9bca783f7 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#4 0x00007fd9cbcbc2e8 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libnspr4.so
#5 0x0000559e12f6d3d4 in ?? ()
#6 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#7 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Thread 9 (Thread 0x7fd9b42ff6c0 (LWP 14201)):
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9c0d6d7ad in g_cond_wait () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007fd9c0cde58b in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007fd9c0d43ec3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007fd9c0d430e2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x0000559e12f6d3d4 in ?? ()
#6 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#7 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Thread 8 (Thread 0x7fd9aa6fe6c0 (LWP 14244)):
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9c0d6e0a0 in g_cond_wait_until () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007fd9c0cde553 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007fd9c0cde6a6 in g_async_queue_timeout_pop () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007fd9c0d4853f in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x00007fd9c0d430e2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6 0x0000559e12f6d3d4 in ?? ()
#7 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#8 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Thread 7 (Thread 0x7fd9ab9be6c0 (LWP 14242)):
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9ba2d2525 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#2 0x00007fd9b968aef2 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#3 0x00007fd9b9688973 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#4 0x00007fd9b96887ee in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#5 0x00007fd9b9688450 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#6 0x00007fd9ba6286af in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#7 0x0000559e12f6d3d4 in ?? ()
#8 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#9 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Thread 6 (Thread 0x7fd9ab9ff6c0 (LWP 14241)):
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9ba2d2525 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#2 0x00007fd9b968aef2 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#3 0x00007fd9b9688973 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#4 0x00007fd9b96887ee in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#5 0x00007fd9b9688450 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#6 0x00007fd9ba6286af in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#7 0x0000559e12f6d3d4 in ?? ()
#8 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#9 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Thread 5 (Thread 0x7fd9b22fd6c0 (LWP 14233)):
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9b9698227 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#2 0x00007fd9ba4cff9a in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#3 0x00007fd9b96923e7 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#4 0x00007fd9b96883a4 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#5 0x00007fd9ba6286af in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#6 0x0000559e12f6d3d4 in ?? ()
#7 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#8 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Thread 4 (Thread 0x7fd9b32fe6c0 (LWP 14202)):
#0 0x00007fd9cb71b75d in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9c0d73b4e in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007fd9c0d13ad3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007fd9c0d13b29 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4 0x00007fd9c0d430e2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x0000559e12f6d3d4 in ?? ()
#6 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#7 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Thread 3 (Thread 0x7fd9a96fd6c0 (LWP 14246)):
#0 0x00007fd9cb71b75d in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9c0d73b4e in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2 0x00007fd9c0d14ff7 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3 0x00007fd9c0c016c2 in ?? () from /lib/x86_64-linux-gnu/libgio-2.0.so.0
#4 0x00007fd9c0d430e2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5 0x0000559e12f6d3d4 in ?? ()
#6 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#7 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
Thread 2 (Thread 0x7fd9cbccdbc0 (LWP 14187)):
#0 0x00007fd9c04012fc in ?? () from /lib/x86_64-linux-gnu/libz.so.1
#1 0x00007fffa5a6b3d0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
Thread 1 (Thread 0x7fd9a5b896c0 (LWP 14305)):
#0 0x00007fd9cb69ebec in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007fd9cb64527e in raise () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007fd9bc1c2f71 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#3 <signal handler called>
#4 0x0000559e12fc4d26 in mozilla::detail::MutexImpl::lock() ()
#5 0x00007fd9b98cc564 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#6 0x00007fd9b9a54b99 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#7 0x00007fd9b98cae67 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
#8 0x0000559e12f6d3d4 in ?? ()
#9 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#10 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
0x559e12f3ccce: "MOZ_CRASH(mozilla::detail::MutexImpl::mutexLock: pthread_mutex_lock failed)"
From To Syms Read Shared Object Library
0x00007fd9cbd05040 0x00007fd9cbd05105 Yes (*) /lib/x86_64-linux-gnu/libdl.so.2
0x00007fd9cbaa55c0 0x00007fd9cbbe4ce2 Yes (*) /lib/x86_64-linux-gnu/libstdc++.so.6
0x00007fd9cb927420 0x00007fd9cb9a53a6 Yes (*) /lib/x86_64-linux-gnu/libm.so.6
0x00007fd9cbcda780 0x00007fd9cbcfd745 Yes (*) /lib/x86_64-linux-gnu/libgcc_s.so.1
0x00007fd9cbcd2040 0x00007fd9cbcd2105 Yes (*) /lib/x86_64-linux-gnu/libpthread.so.0
0x00007fd9cb628800 0x00007fd9cb7b0039 Yes (*) /lib/x86_64-linux-gnu/libc.so.6
0x00007fd9cbd1f000 0x00007fd9cbd49175 Yes (*) /lib64/ld-linux-x86-64.so.2
0x00007fd9cbca01f0 0x00007fd9cbcc3b5b Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libnspr4.so
0x00007fd9cbd0fd70 0x00007fd9cbd1136a Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libplc4.so
0x00007fd9cbc8a5b0 0x00007fd9cbc8b4b8 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libplds4.so
0x00007fd9cb8ed3d0 0x00007fd9cb9139c6 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libmozsandbox.so
0x00007fd9cbc84080 0x00007fd9cbc842b1 Yes (*) /lib/x86_64-linux-gnu/librt.so.1
0x00007fd9c19ec7f0 0x00007fd9c20db8c5 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libgkcodecs.so
0x00007fd9cb8c73e0 0x00007fd9cb8dcb05 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/liblgpllibs.so
0x00007fd9cb89ab70 0x00007fd9cb8b0ffc Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libnssutil3.so
0x00007fd9cb46e2a0 0x00007fd9cb4f510b Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libnss3.so
0x00007fd9cb868570 0x00007fd9cb8820b8 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libsmime3.so
0x00007fd9c218a6e0 0x00007fd9c22f59d4 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libmozsqlite3.so
0x00007fd9c17a3760 0x00007fd9c17f6ff8 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libssl3.so
0x00007fd9cbd0a6e0 0x00007fd9cbd0a7b3 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libmozgtk.so
0x00007fd9c0e94a40 0x00007fd9c1230a2c Yes (*) /lib/x86_64-linux-gnu/libgtk-3.so.0
0x00007fd9c16b9320 0x00007fd9c1736cf5 Yes (*) /lib/x86_64-linux-gnu/libgdk-3.so.0
0x00007fd9cb849500 0x00007fd9cb84a5d2 Yes (*) /lib/x86_64-linux-gnu/libgmodule-2.0.so.0
0x00007fd9c0cd6e90 0x00007fd9c0d74842 Yes (*) /lib/x86_64-linux-gnu/libglib-2.0.so.0
0x00007fd9c1636110 0x00007fd9c166b3d0 Yes (*) /lib/x86_64-linux-gnu/libgobject-2.0.so.0
0x00007fd9c0b277e0 0x00007fd9c0c36b86 Yes (*) /lib/x86_64-linux-gnu/libgio-2.0.so.0
0x00007fd9cb83c680 0x00007fd9cb8427f4 Yes (*) /lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
0x00007fd9c0a912d0 0x00007fd9c0ac7f97 Yes (*) /lib/x86_64-linux-gnu/libpango-1.0.so.0
0x00007fd9c097ae90 0x00007fd9c0a471e2 Yes (*) /lib/x86_64-linux-gnu/libharfbuzz.so.0
0x00007fd9c0841f60 0x00007fd9c092f9af Yes (*) /lib/x86_64-linux-gnu/libcairo.so.2
0x00007fd9cb8253e0 0x00007fd9cb82f677 Yes (*) /lib/x86_64-linux-gnu/libpangoft2-1.0.so.0
0x00007fd9c15ddf90 0x00007fd9c160b2ee Yes (*) /lib/x86_64-linux-gnu/libfontconfig.so.1
0x00007fd9cb416100 0x00007fd9cb4190b7 Yes (*) /lib/x86_64-linux-gnu/libfribidi.so.0
0x00007fd9cb40c100 0x00007fd9cb40d5ba Yes (*) /lib/x86_64-linux-gnu/libcairo-gobject.so.2
0x00007fd9c21300a0 0x00007fd9c21489bd Yes (*) /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0
0x00007fd9c080cd40 0x00007fd9c081b430 Yes (*) /lib/x86_64-linux-gnu/libatk-1.0.so.0
0x00007fd9c073e240 0x00007fd9c07a3ca1 Yes (*) /lib/x86_64-linux-gnu/libepoxy.so.0
0x00007fd9c06ce4a0 0x00007fd9c06d9e09 Yes (*) /lib/x86_64-linux-gnu/libXi.so.6
0x00007fd9c05a7100 0x00007fd9c063610e Yes (*) /lib/x86_64-linux-gnu/libX11.so.6
0x00007fd9c05600e0 0x00007fd9c0576cc2 Yes (*) /lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0
0x00007fd9cb815300 0x00007fd9cb817a4a Yes (*) /lib/x86_64-linux-gnu/libXfixes.so.3
0x00007fd9c050d5a0 0x00007fd9c052c672 Yes (*) /lib/x86_64-linux-gnu/libxkbcommon.so.0
0x00007fd9c04fd580 0x00007fd9c0502b84 Yes (*) /lib/x86_64-linux-gnu/libwayland-client.so.0
0x00007fd9c04f04a0 0x00007fd9c04f1d8b Yes (*) /lib/x86_64-linux-gnu/libwayland-cursor.so.0
0x00007fd9cbc7f080 0x00007fd9cbc7f249 Yes (*) /lib/x86_64-linux-gnu/libwayland-egl.so.1
0x00007fd9c04de600 0x00007fd9c04e8bce Yes (*) /lib/x86_64-linux-gnu/libXext.so.6
0x00007fd9c04d0660 0x00007fd9c04d55ec Yes (*) /lib/x86_64-linux-gnu/libXcursor.so.1
0x00007fd9cb4041a0 0x00007fd9cb404b59 Yes (*) /lib/x86_64-linux-gnu/libXdamage.so.1
0x00007fd9c2122140 0x00007fd9c2122b8b Yes (*) /lib/x86_64-linux-gnu/libXcomposite.so.1
0x00007fd9c04c33a0 0x00007fd9c04c9ee9 Yes (*) /lib/x86_64-linux-gnu/libXrandr.so.2
0x00007fd9c15d11a0 0x00007fd9c15d1b0e Yes (*) /lib/x86_64-linux-gnu/libXinerama.so.1
0x00007fd9c0429300 0x00007fd9c04963b0 Yes (*) /lib/x86_64-linux-gnu/libpcre2-8.so.0
0x00007fd9c041d460 0x00007fd9c042307a Yes (*) /lib/x86_64-linux-gnu/libffi.so.8
0x00007fd9c0401260 0x00007fd9c0412c80 Yes (*) /lib/x86_64-linux-gnu/libz.so.1
0x00007fd9c03bc3a0 0x00007fd9c03ee4fc Yes (*) /lib/x86_64-linux-gnu/libmount.so.1
0x00007fd9c038c040 0x00007fd9c03a75bc Yes (*) /lib/x86_64-linux-gnu/libselinux.so.1
0x00007fd9c037c340 0x00007fd9c037fd97 Yes (*) /lib/x86_64-linux-gnu/libthai.so.0
0x00007fd9c02bb7f0 0x00007fd9c034b6ca Yes (*) /lib/x86_64-linux-gnu/libfreetype.so.6
0x00007fd9c028b240 0x00007fd9c02a7f89 Yes (*) /lib/x86_64-linux-gnu/libgraphite2.so.3
0x00007fd9c0255510 0x00007fd9c027ccf8 Yes (*) /lib/x86_64-linux-gnu/libpng16.so.16
0x00007fd9c0246440 0x00007fd9c024c787 Yes (*) /lib/x86_64-linux-gnu/libXrender.so.1
0x00007fd9c0226660 0x00007fd9c0238ebe Yes (*) /lib/x86_64-linux-gnu/libxcb.so.1
0x00007fd9c0211120 0x00007fd9c0215ccb Yes (*) /lib/x86_64-linux-gnu/libxcb-render.so.0
0x00007fd9c02080e0 0x00007fd9c0208b07 Yes (*) /lib/x86_64-linux-gnu/libxcb-shm.so.0
0x00007fd9c0162300 0x00007fd9c01ee85e Yes (*) /lib/x86_64-linux-gnu/libpixman-1.so.0
0x00007fd9c012e210 0x00007fd9c014c473 Yes (*) /lib/x86_64-linux-gnu/libexpat.so.1
0x00007fd9c00ab580 0x00007fd9c00f7720 Yes (*) /lib/x86_64-linux-gnu/libjpeg.so.8
0x00007fd9c007ef80 0x00007fd9c009563d Yes (*) /lib/x86_64-linux-gnu/libatspi.so.0
0x00007fd9c002af10 0x00007fd9c00597bb Yes (*) /lib/x86_64-linux-gnu/libdbus-1.so.3
0x00007fd9bffead40 0x00007fd9c000d9b7 Yes (*) /lib/x86_64-linux-gnu/libblkid.so.1
0x00007fd9bffdc240 0x00007fd9bffdf58d Yes (*) /lib/x86_64-linux-gnu/libdatrie.so.1
0x00007fd9bffc8280 0x00007fd9bffd4ff3 Yes (*) /lib/x86_64-linux-gnu/libbz2.so.1.0
0x00007fd9bffb91a0 0x00007fd9bffc0bca Yes (*) /lib/x86_64-linux-gnu/libbrotlidec.so.1
0x00007fd9bffb3360 0x00007fd9bffb4042 Yes (*) /lib/x86_64-linux-gnu/libXau.so.6
0x00007fd9bffac1a0 0x00007fd9bffada89 Yes (*) /lib/x86_64-linux-gnu/libXdmcp.so.6
0x00007fd9bfee1e20 0x00007fd9bff6e770 Yes (*) /lib/x86_64-linux-gnu/libsystemd.so.0
0x00007fd9bfea80a0 0x00007fd9bfea87be Yes (*) /lib/x86_64-linux-gnu/libbrotlicommon.so.1
0x00007fd9bfe95de0 0x00007fd9bfea04f6 Yes (*) /lib/x86_64-linux-gnu/libbsd.so.0
0x00007fd9bfe879c0 0x00007fd9bfe8c607 Yes (*) /lib/x86_64-linux-gnu/libcap.so.2
0x00007fd9bfd4aac0 0x00007fd9bfe3e91e Yes (*) /lib/x86_64-linux-gnu/libgcrypt.so.20
0x00007fd9bfd1c180 0x00007fd9bfd36e8c Yes (*) /lib/x86_64-linux-gnu/liblz4.so.1
0x00007fd9bfcea400 0x00007fd9bfd0b66f Yes (*) /lib/x86_64-linux-gnu/liblzma.so.5
0x00007fd9bfc31400 0x00007fd9bfcd77b2 Yes (*) /lib/x86_64-linux-gnu/libzstd.so.1
0x00007fd9bfc20160 0x00007fd9bfc28a7a Yes (*) /lib/x86_64-linux-gnu/libmd.so.0
0x00007fd9bfbfda20 0x00007fd9bfc12d72 Yes (*) /lib/x86_64-linux-gnu/libgpg-error.so.0
0x00007fd9cb856500 0x00007fd9cb856a13 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libmozwayland.so
0x00007fd9b7776980 0x00007fd9bf392d25 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
0x00007fd9bfbdf6e0 0x00007fd9bfbe7f19 Yes (*) /lib/x86_64-linux-gnu/libresolv.so.2
0x00007fd9bfafd500 0x00007fd9bfb9b0f8 Yes (*) /lib/x86_64-linux-gnu/libasound.so.2
0x00007fd9cb84f040 0x00007fd9cb84f11f Yes (*) /lib/x86_64-linux-gnu/libX11-xcb.so.1
0x00007fd9a5c78640 0x00007fd9a5dbc1fd Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libfreeblpriv3.so
(*): Shared library is missing debugging information.
warning: Can't open file /memfd:mozilla-ipc (deleted) during file-backed mapping note processing
@@ -0,0 +1,12 @@
{
"gdb-core.FSBroker14298.14187.1796087906.txt": {
"source": "run 46539190316 of oss-invisible/firefox_antidetect_patch, job 142310624770 (wrapper.e2e.ab_oracle), crash/firefox-70-again/09-63-1.5-ab-visit/",
"sha256": "a84ad75b5688dd306aed1d4a059d4a51a1117e8497cff0a061090373fab95b08"
},
"ci_mozilla_defects.py.txt": {
"source": "oss-invisible/core scripts/ci_mozilla_defects.py",
"core_main_sha": "882eed52ae1776c570053eb772c068206207cac8",
"last_commit": "3946b2679d3faee0c6b748d9d941db69945bcada",
"sha256": "256908b42bb7ccdfa119eb3d5b57b4ee0c6747fcc646f14dd6f09f0c5af3a98d"
}
}
+1 -1
View File
@@ -89,7 +89,7 @@
"n": 5864
},
"dom.system_colors": {
"s": "[[\"Canvas\",\"rgb(255, 255, 255)\"],[\"CanvasText\",\"rgb(0, 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)\"],[\"Highlight\",\"rgb(0, 120, 215)\"],[\"HighlightText\",\"rgb(255, 255, 255)\"],[\"GrayText\",\"rgb(109, 109, 109)\"],[\"LinkText\",\"rgb(0, 0, 238)\"],[\"VisitedText\",\"rgb(85, 26, 139)\"],[\"ActiveText\",\"rgb(238, 0, 0)\"],[\"Mark\",\"rgb(255, 255, 0)\"],[\"MarkText\",\"rgb(0, 0, 0)\"],[\"AccentColor\",\"rgb(0, 96, 223)\"],[\"AccentColorText\",\"rgb(255, 255, 255)\"],[\"SelectedItem\",\"rgb(0, 120, 215)\"],[\"SelectedItemText\",\"rgb(255, 255, 255)\"]]"
"s": "[[\"Canvas\",\"rgb(255, 255, 255)\"],[\"CanvasText\",\"rgb(0, 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)\"],[\"Highlight\",\"rgb(0, 120, 212)\"],[\"HighlightText\",\"rgb(255, 255, 255)\"],[\"GrayText\",\"rgb(109, 109, 109)\"],[\"LinkText\",\"rgb(0, 0, 238)\"],[\"VisitedText\",\"rgb(85, 26, 139)\"],[\"ActiveText\",\"rgb(238, 0, 0)\"],[\"Mark\",\"rgb(255, 255, 0)\"],[\"MarkText\",\"rgb(0, 0, 0)\"],[\"AccentColor\",\"rgb(0, 96, 223)\"],[\"AccentColorText\",\"rgb(255, 255, 255)\"],[\"SelectedItem\",\"rgb(0, 120, 212)\"],[\"SelectedItemText\",\"rgb(255, 255, 255)\"]]"
},
"env.dpr": {
"s": "1"
+1 -1
View File
@@ -89,7 +89,7 @@
"n": 5863
},
"dom.system_colors": {
"s": "[[\"Canvas\",\"rgb(255, 255, 255)\"],[\"CanvasText\",\"rgb(0, 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)\"],[\"Highlight\",\"rgb(0, 120, 215)\"],[\"HighlightText\",\"rgb(255, 255, 255)\"],[\"GrayText\",\"rgb(109, 109, 109)\"],[\"LinkText\",\"rgb(0, 0, 238)\"],[\"VisitedText\",\"rgb(85, 26, 139)\"],[\"ActiveText\",\"rgb(238, 0, 0)\"],[\"Mark\",\"rgb(255, 255, 0)\"],[\"MarkText\",\"rgb(0, 0, 0)\"],[\"AccentColor\",\"rgb(0, 96, 223)\"],[\"AccentColorText\",\"rgb(255, 255, 255)\"],[\"SelectedItem\",\"rgb(0, 120, 215)\"],[\"SelectedItemText\",\"rgb(255, 255, 255)\"]]"
"s": "[[\"Canvas\",\"rgb(255, 255, 255)\"],[\"CanvasText\",\"rgb(0, 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)\"],[\"Highlight\",\"rgb(0, 120, 212)\"],[\"HighlightText\",\"rgb(255, 255, 255)\"],[\"GrayText\",\"rgb(109, 109, 109)\"],[\"LinkText\",\"rgb(0, 0, 238)\"],[\"VisitedText\",\"rgb(85, 26, 139)\"],[\"ActiveText\",\"rgb(238, 0, 0)\"],[\"Mark\",\"rgb(255, 255, 0)\"],[\"MarkText\",\"rgb(0, 0, 0)\"],[\"AccentColor\",\"rgb(0, 96, 223)\"],[\"AccentColorText\",\"rgb(255, 255, 255)\"],[\"SelectedItem\",\"rgb(0, 120, 212)\"],[\"SelectedItemText\",\"rgb(255, 255, 255)\"]]"
},
"env.dpr": {
"s": "1"
+100
View File
@@ -0,0 +1,100 @@
<!doctype html>
<meta charset="utf-8">
<title>password mask character, read as widths</title>
<body style="margin:0;background:#fff">
<script>
"use strict";
// Which character does an <input type=password> mask with? A page cannot read it, but it can read widths: the
// scrollWidth of a password field holding N copies of "a" is N times the advance of the mask character in the field's
// font. The same box styles hold N copies of each candidate character in a text input (scrollWidth) and in an inline span
// (getBoundingClientRect). The mask character is the candidate whose width equals the password width.
// Two fonts: Arial 16px, and the default font of an input (only the size is set). Also recorded: measureText of each
// candidate in a canvas with the same font, devicePixelRatio, the computed font-family of the input, navigator.platform.
const N = 40;
const CANDS = [["U+25CF", "●"], ["U+2022", "•"], ["U+2731", "✱"], ["U+273A", "✺"], ["*", "*"]];
const FONTS = [["arial16", "font-family:Arial;font-size:16px"], ["default16", "font-size:16px"]];
const BOX = "box-sizing:content-box;margin:0;padding:0;border:0;width:20px;height:24px;outline:0;";
const SPAN = "display:inline-block;white-space:pre;margin:0;padding:0;border:0;";
function input(type, value, font) {
const el = document.createElement("input");
el.type = type;
el.value = value;
el.setAttribute("style", BOX + font);
document.body.appendChild(el);
return el;
}
function span(text, familyCss) {
const el = document.createElement("span");
el.textContent = text;
el.setAttribute("style", SPAN + familyCss);
document.body.appendChild(el);
return el;
}
function measureFont(fontCase, font) {
const out = {};
const pw = input("password", "a".repeat(N), font);
const cs = getComputedStyle(pw);
const family = cs.fontFamily;
out.input_font_family = family;
out.input_font_size = cs.fontSize;
out.input_font = cs.font;
const spanFont = "font-family:" + family + ";font-size:16px";
// password widths with 1, 10 and N characters: per-character advance = (w[N] - w[10]) / (N - 10)
out.password = {};
for (const n of [1, 10, N]) {
const e = input("password", "a".repeat(n), font);
out.password[n] = {scrollWidth: e.scrollWidth, clientWidth: e.clientWidth};
e.remove();
}
out.password[N].scrollWidth_main = pw.scrollWidth;
out.password.per_char = (out.password[N].scrollWidth - out.password[10].scrollWidth) / (N - 10);
out.refs = {};
for (const [name, ch] of CANDS) {
const r = {};
r.text_input = {};
for (const n of [1, 10, N]) {
const e = input("text", ch.repeat(n), font);
r.text_input[n] = {scrollWidth: e.scrollWidth};
e.remove();
}
r.text_input.per_char = (r.text_input[N].scrollWidth - r.text_input[10].scrollWidth) / (N - 10);
const sp = span(ch.repeat(N), spanFont);
r.span_width = sp.getBoundingClientRect().width;
r.span_width_1 = (() => { const s1 = span(ch, spanFont); const w = s1.getBoundingClientRect().width; s1.remove(); return w; })();
sp.remove();
const c = document.createElement("canvas").getContext("2d");
c.font = (fontCase === "arial16" ? "16px Arial" : "16px " + family);
r.canvas_measureText = c.measureText(ch).width;
r.canvas_font = c.font;
out.refs[name] = r;
}
const pwWidth = out.password[N].scrollWidth;
out.verdict = {
by_text_input_scrollWidth: CANDS.map(c => c[0]).filter(k => out.refs[k].text_input[N].scrollWidth === pwWidth),
by_span_width: CANDS.map(c => c[0]).filter(k => Math.abs(out.refs[k].span_width - pwWidth) < 1),
by_per_char: CANDS.map(c => c[0]).filter(k => out.refs[k].text_input.per_char === out.password.per_char),
};
pw.remove();
return out;
}
(async () => {
let result;
try {
result = {format: "password-mask/1", n: N,
env: {userAgent: navigator.userAgent, platform: navigator.platform, devicePixelRatio: window.devicePixelRatio,
width: screen.width, height: screen.height},
fonts: {}};
for (const [fontCase, font] of FONTS) result.fonts[fontCase] = measureFont(fontCase, font);
} catch (e) {
result = {format: "password-mask/1", error: String(e && e.stack || e)};
}
window.__result = result;
const label = location.search.slice(1) || "result";
try { await fetch("/result?" + label, {method: "POST", body: JSON.stringify(result)}); } catch (e) { /* recorded in window.__result */ }
document.title = "done";
})();
</script>
+38
View File
@@ -12,6 +12,8 @@ folder and a `view` of the machine (the real one, or a stand-in in the unit test
"""
from __future__ import annotations
import os
import sys
from typing import Dict, List, Optional
@@ -52,3 +54,39 @@ def maps_of_the_engine_below(root: int, binary_dir: str, machine: Optional[Machi
if exe and exe.startswith(binary_dir):
found[pid] = machine.maps(pid)
return found
def ships_its_own_gl(binary_dir: str) -> bool:
"""The engine's own GL is in the package from firefox-59: a test follows the package under
test, not the core's version (the gate runs a candidate under the published core)."""
return os.path.isfile(os.path.join(binary_dir, "llvmpipe", "libEGL.so.1"))
def gl_maps_of_this_test(firefox_binary: str) -> Optional[Dict[int, List[str]]]:
"""The maps of the engine's processes below this test, to be read while the browser is up and a
page has had its WebGL context; None where the verdict on the GL does not apply (not Linux,
or an engine with no GL of its own)."""
if not sys.platform.startswith("linux"):
return None
binary_dir = os.path.dirname(os.path.realpath(firefox_binary))
if not ships_its_own_gl(binary_dir):
return None
return maps_of_the_engine_below(os.getpid(), binary_dir)
def assert_the_gl_is_the_engines_own(firefox_binary: str, below: Optional[Dict[int, List[str]]]) -> None:
"""The rule of the verdict on the GL, written once: some engine process maps the engine's own
libEGL.so.1 and its own libgallium-*, and none maps a libEGL that is not under the engine's
`llvmpipe/` folder. (GTK still opens the host's GLX at startup to choose its X11 visuals;
nothing of it reaches WebGL or a page, so only libEGL is held against the host's.) With
`below` None the verdict does not apply."""
if below is None:
return
own = os.path.join(os.path.dirname(os.path.realpath(firefox_binary)), "llvmpipe") + os.sep
assert below, "no engine process below this test"
drew = [pid for pid, maps in below.items()
if own + "libEGL.so.1" in maps and any(m.startswith(own + "libgallium-") for m in maps)]
assert drew, {pid: [m for m in maps if "EGL" in m or "gallium" in m] for pid, maps in below.items()}
foreign = {pid: [m for m in maps if "libEGL" in os.path.basename(m) and not m.startswith(own)]
for pid, maps in below.items()}
assert not any(foreign.values()), foreign
+8 -1
View File
@@ -1,5 +1,5 @@
{
"comment": "The outcome of Playwright's own Firefox (stock.lock) on each page: 'idle' means page.wait_for_load_state('networkidle') arrives. A page enters this list after 20 green runs of stock in a row; if stock deviates, the suite is red as a broken control. newsfront is not listed: stock Firefox stalls on it 1 or 2 times in 10 (a pending list that is empty), so it cannot be a gate until a minimal pattern replaces it.",
"comment": "The outcome of Playwright's own Firefox (stock.lock) on each page: 'idle' means page.wait_for_load_state('networkidle') arrives. A page enters this list after 20 green runs of stock in a row; if stock deviates, the suite is red as a broken control. newsfront is not listed: stock Firefox stalls on it 1 or 2 times in 10 (a pending list that is empty), so it cannot be a gate until a minimal pattern replaces it. stock_firefox_may_lose names, per page, a request stock may never report the end of when the page itself aborts it while the route holds it: a stock round that did not idle only because of such a request is \"stock unsettled\" (not a broken control), and our engine is judged there against the outcome stock_firefox declares.",
"stock_firefox": {
"quiet": "idle",
"beacon_pair": "idle",
@@ -19,6 +19,13 @@
"leaving_beacons_subframe": "idle",
"cancel_among_beacons": "idle"
},
"stock_firefox_may_lose": {
"cancel_among_beacons": {
"url": "[?&]id=cab\\d+(&|$)",
"what": "a fetch the page aborts while the route holds it may never end on stock Firefox",
"measured": "Windows 2 of 460 rounds (runs 45206310347 round 9 and 45621332479 round 6, always id=cab6), Linux 0 of 480 (94 runs, 25/11)"
}
},
"journey_p4": {
"comment": "Profile P4 (tests/fakeweb/profile_p4.py): the steps on which stock Firefox does NOT reach networkidle within the timeout, because the page holds a request open on purpose: 7 and 8 (a fetch held until step 9, on the category page), 12 (a keepalive fetch held until step 13, on the search results). Stock Firefox idles on every other step, and every step is ok.",
"not_idle_steps": [7, 8, 12]
+30 -8
View File
@@ -298,18 +298,40 @@ def run_on_stock(sync_playwright, origin, patterns, repetitions, **kw):
browser.close()
def verdict(candidate, stock, declared):
"""The cells where the candidate fails and stock idles, and the cells where stock is not what pages.json declares."""
def _unsettled(cell, may_lose):
"""True when a stock cell that did not idle is one pages.json `stock_firefox_may_lose` allows: its pattern has an entry, the cell lists
requests still in flight, and every one of them is a request that entry names (`url`, a regex searched in the request's url)."""
entry = (may_lose or {}).get(cell["pattern"])
in_flight = cell.get("in_flight")
if not entry or not in_flight:
return False
return all(re.search(entry["url"], str(r.get("url", ""))) for r in in_flight)
def verdict(candidate, stock, declared, may_lose=None):
"""Returns (fails, broken, unsettled).
fails: the cells where the candidate does not idle and stock does, and the cells where stock is unsettled (below) and the candidate does not idle
on a page that stock_firefox declares idle (it is judged against the declared outcome there).
broken: the cells where stock is not what pages.json declares (idle) and is not unsettled.
unsettled: the stock cells that did not idle only because stock lost the end of a request the page itself aborted (`may_lose`: pattern -> {"url": regex, ...}):
every request in flight at the expiry is one the entry names. Not a broken control."""
may_lose = may_lose or {}
key = lambda c: (c["round"], c["pattern"], c["canary"], c["after"]) # noqa: E731
stock_by = {key(c): c for c in stock}
fails, broken = [], []
fails, broken, unsettled = [], [], []
unsettled_keys = set()
for s in stock:
if declared.get(s["pattern"]) == "idle" and not s["idle"]:
if _unsettled(s, may_lose):
unsettled.append((key(s), s["err"]))
unsettled_keys.add(key(s))
else:
broken.append((key(s), s["err"]))
for c in candidate:
s = stock_by.get(key(c))
if s is None:
continue
if s["idle"] and not c["idle"]:
if not c["idle"] and (s["idle"] or (key(c) in unsettled_keys and declared.get(c["pattern"]) == "idle")):
fails.append((key(c), c["err"]))
for s in stock:
if declared.get(s["pattern"]) == "idle" and not s["idle"]:
broken.append((key(s), s["err"]))
return fails, broken
return fails, broken, unsettled
+4 -1
View File
@@ -21,6 +21,7 @@
{"file": "test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "scope": "<module>.READ", "rule": "js-timer", "nth": 1, "kind": "hang-detector", "reason": "The timer of 30 s only ends a read of the position that never answers: the answer is a position or an error as soon as the engine gives one, and no verdict reads when the timer fired."},
{"file": "test_a_held_ice_port_blinds_the_loopback_checks_e2e.py", "scope": "<module>._START_JS", "rule": "js-timer", "nth": 1, "kind": "hang-detector", "reason": "The 5 ms step of the page's two waits, each with a deadline of 30 s: for the host UDP candidate of the first connection, and for the data channel to open and echo; the second loop keeps the longest time it did not run, so the time the connection took is judged only when the page itself was not stopped by the machine (`_e2e_verdicts.opened_at_the_retry_problem`)."},
{"file": "test_a_page_cannot_probe_the_juggler_e2e.py", "scope": "<module>._CHANNELS", "rule": "js-timer", "nth": 1, "kind": "hang-detector", "reason": "The 30 s of each channel are the deadline of its wait (`no answer` is a channel that stays silent). Every channel of a URL is asked at once and a name that is nowhere answers all of them, so on a healthy run no silence is waited for, and a stall of the machine cannot make one URL answer and the other not."},
{"file": "test_a_page_function_called_by_the_client_sees_only_page_frames_e2e.py", "scope": "test_a_timer_callback_the_client_started_has_only_its_own_frame_and_no_caller", "rule": "js-timer", "nth": 1, "kind": "stimulus", "reason": "The timer the client's evaluate starts is the subject of the test (the stack and the caller of its callback are what it asserts); the test waits for the callback to have run with a deadline of 30 s, and no verdict reads when the timer fired."},
{"file": "test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "scope": "<module>._GATHER_JS", "rule": "js-timer", "nth": 1, "kind": "hang-detector", "reason": "The timer of 30 s is the deadline of the wait for the end of the ICE gathering: the wait ends when the page says `complete`, a gathering that never completes returns what it has and fails the assertions on the candidates, and no verdict reads when the timer fired."},
{"file": "test_a_page_that_moves_on_e2e.py", "scope": "_replace_after_load", "rule": "js-timer", "nth": 1, "kind": "stimulus", "reason": "The page's own timer moves the page 0, 50 or 300 ms after the load, and the reads made while it moves accept both states (the page before the move or the page it moved to) and never an engine error; nothing reads when the timer fired, and the waits that lead up to the reads have a deadline of 30 s."},
{"file": "test_a_page_that_moves_on_e2e.py", "scope": "test_reads_wait_as_playwright_s_do", "rule": "js-timer", "nth": 1, "kind": "stimulus", "reason": "The page's own timer adds the element 500 ms after the call; the read waits for it with a deadline of 30 s, and the verdict is the text read, never when the timer fired."},
@@ -28,8 +29,10 @@
{"file": "test_a_popup_of_a_link_reaches_the_client_e2e.py", "scope": "_router.route", "rule": "sleep", "nth": 1, "kind": "stimulus", "reason": "Slowness on purpose: this test server, relay or client answers late as the input of the test, and the product waits for it under a deadline; nothing here judges the machine."},
{"file": "test_a_proxy_that_cannot_carry_udp_leaks_nothing_direct_e2e.py", "scope": "<module>._PROBE_JS", "rule": "js-timer", "nth": 1, "kind": "stimulus", "reason": "A timer of the test's own page is the stimulus (the thing appears later); the product waits for it with a deadline and the verdict does not read when it fired."},
{"file": "test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "scope": "<module>.TURN_PORT", "rule": "port", "nth": 1, "kind": "virtual-port", "reason": "A port number that nothing binds: the gateway of the test answers for the name or address by itself, so no worker can collide on it."},
{"file": "test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "scope": "_go_back_and_record", "rule": "sleep", "nth": 1, "kind": "instrument", "reason": "Runs only after go_back has already raised: the pause dates a restore that lands after the wait, for the evidence of the red run; the error is raised unchanged and the pause decides nothing."},
{"file": "test_caller_world_handles_e2e.py", "scope": "test_a_node_that_appears_later_ends_the_wait", "rule": "js-timer", "nth": 1, "kind": "stimulus", "reason": "A timer of the test's own page is the stimulus (the thing appears later); the product waits for it with a deadline and the verdict does not read when it fired."},
{"file": "test_caller_world_handles_e2e.py", "scope": "test_a_wait_for_function_object_handle_reads_in_the_page_world", "rule": "js-timer", "nth": 1, "kind": "stimulus", "reason": "A timer of the test's own page is the stimulus (the thing appears later); the product waits for it with a deadline and the verdict does not read when it fired."},
{"file": "test_canvas_reads_as_drawn.py", "scope": "_non_premultiplied", "rule": "sleep", "nth": 1, "kind": "instrument", "reason": "A diagnostic pause that decides nothing: after a first attempt that gave no WebGL context the test waits 2 s and makes a second attempt only to record what it heard; the assert fails on the first attempt whatever the second says."},
{"file": "test_declared_host_network_e2e.py", "scope": "<module>._GATHER_JS", "rule": "js-timer", "nth": 1, "kind": "hang-detector", "reason": "The timer of 30 s is the deadline of the wait for the end of the ICE gathering: the wait ends when the page says `complete`, a gathering that never completes returns what it has and fails the assertions on the candidates, and no verdict reads when the timer fired."},
{"file": "test_declared_host_network_e2e.py", "scope": "<module>._LOOPBACK_JS", "rule": "js-timer", "nth": 1, "kind": "hang-detector", "reason": "The 5 ms step of the page's own wait for the data channel to open and echo, which ends at 30 s; the same loop keeps the longest time it did not run, so the time the connection took is judged only when the page itself was not stopped by the machine (`_e2e_verdicts.opened_at_the_retry_problem`)."},
{"file": "test_detectors_e2e.py", "scope": "test_enumerate_devices_resolves_promptly", "rule": "bound", "nth": 1, "kind": "hang-detector", "reason": "The limit is the larger of 30 s and 2000 times a load reference (microtasks) measured in the same page just before, and never reaches the 120 s at which the call is held to be hung, so it ends a call that never comes and is relative to the machine's own load."},
@@ -96,6 +99,6 @@
{"file": "test_webrtc_realness.py", "scope": "<module>._RELAY_PROBE_JS", "rule": "js-timer", "nth": 1, "kind": "stimulus", "reason": "A timer of the test's own page is the stimulus (the thing appears later); the product waits for it with a deadline and the verdict does not read when it fired."}
],
"debt": [
{"file": "_udp_line.py", "scope": "judge_visits", "rule": "bound", "nth": 1, "class": "B", "reason": "An absolute upper bound on a duration is a verdict on the machine: compare with a control measured in the same run, or assert the order of the events."}
]
}
-285
View File
@@ -1,285 +0,0 @@
"""HUNT, not a test of the suites: the double `mouseover` of `handle.click()`, seen once on Windows.
The e2e `tests/test_element_handle_actions.py::test_the_nine_actions_reach_the_page_through_a_handle` went red once on the Windows leg of an engine
candidate with the page's record `['hover', 'hover', 'click']` where it expects `['hover', 'click']` first. Two readings of that:
* an EXIT AND RE-ENTRY of the pointer (a `mouseout` between the two `mouseover`): the pointer left the button and came back, which a human
does and a page may count;
* a SPURIOUS second `mouseover` (none between): the engine told the page the pointer entered twice, which no pointer does.
This file runs the same scenario (same page, same launch, same call) with the page listening to everything that tells them apart, and the core's
retry loop hooked (the core logs nothing of its turns), and writes ONE JSON line per run with a verdict:
single [mouseover, click]
exit-reentry two or more mouseover before the first click, a mouseout between each pair
spurious two mouseover before the first click with no mouseout between them
other no mouseover before the click, a mouseover then a mouseout and no new one, no click...
It is named `hunt_*` and not `test_*` on purpose: no suite collects it (`ci/required-suites.json` names files, and the e2e accounting collects
`test_*`). The hunt workflow runs it by its path, once with no xdist and once with `-n 4 --dist load` as the suite does:
HUNT_MODE=sequential|parallel HUNT_RUNS=60 HUNT_OUT=<dir> pytest tests/hunt_handle_double_hover_e2e.py ...
A run that finds a defect PASSES (the finding is the point); a run whose scenario errors (a launch that fails, a page that never loads, a click that
raises) writes verdict `error` and FAILS, so that the job says the measurement is not what it was meant to be.
"""
from __future__ import annotations
import http.server
import json
import os
import socket
import threading
import time
import traceback
from pathlib import Path
import pytest
from _servers import LocalServer
pytestmark = pytest.mark.e2e
MODE = os.environ.get("HUNT_MODE", "sequential")
RUNS = int(os.environ.get("HUNT_RUNS", "60"))
OUT = Path(os.environ.get("HUNT_OUT", "hunt-out"))
# The page of tests/test_element_handle_actions.py, as it is there (the button and the record the test reads), and below it the listeners of the hunt.
PAGE = b"""<!doctype html>
<html><head><title>handle actions</title></head><body>
<input id="testo" type="text">
<input id="daScrivere" type="text">
<button id="bottone" type="button">press me</button>
<input id="casella" type="checkbox">
<select id="tendina">
<option value="a">Alpha</option><option value="b">Beta</option>
</select>
<div id="passaggio">no</div>
<script>
window.registro = {click: 0, ordine: [], change: [], tasti: []};
const b = document.getElementById('bottone');
b.addEventListener('click', e => {
window.registro.click++; window.registro.fidato = e.isTrusted;
window.registro.ordine.push('click');
});
b.addEventListener('mouseover', () => window.registro.ordine.push('hover'));
window.registro.movimenti = 0;
b.addEventListener('mousemove', () => window.registro.movimenti++);
for (const id of ['casella','tendina'])
document.getElementById(id).addEventListener('change',
() => window.registro.change.push(id));
document.getElementById('daScrivere').addEventListener('keydown',
e => window.registro.tasti.push(e.key));
</script>
<script>
// THE HUNT: everything a page can see of the pointer around the button, with the rect of the button at each moment.
(() => {
const b = document.getElementById('bottone');
const H = window.hunt = {ev: [], moves: [], dmoves: [], rects: [], ro: [], shifts: [], frames: 0};
const epoch = e => performance.timeOrigin + e.timeStamp;
const rect = () => { const r = b.getBoundingClientRect(); return [r.x, r.y, r.width, r.height]; };
const rel = e => e.relatedTarget ? {id: e.relatedTarget.id || null, tag: e.relatedTarget.tagName} : null;
for (const type of ['mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'click'])
b.addEventListener(type, e => H.ev.push({type, rel: rel(e), x: e.clientX, y: e.clientY, ts: e.timeStamp, t: epoch(e),
trusted: e.isTrusted, rect: rect()}));
b.addEventListener('mousemove', e => H.moves.push([e.clientX, e.clientY, e.timeStamp, epoch(e)]));
document.addEventListener('mousemove', e => {
if (H.dmoves.length < 3000) H.dmoves.push([e.clientX, e.clientY, e.target.id || e.target.tagName, e.timeStamp]);
}, true);
// what happens to the pointer OFF the button (the body it leaves to, the field next to it)
for (const type of ['mouseover', 'mouseout'])
document.addEventListener(type, e => {
if (e.target !== b) H.ev.push({type: 'doc-' + type, target: e.target.id || e.target.tagName, rel: rel(e),
x: e.clientX, y: e.clientY, ts: e.timeStamp, t: epoch(e)});
}, true);
try {
new ResizeObserver(es => es.forEach(en => H.ro.push([en.contentRect.width, en.contentRect.height,
performance.timeOrigin + performance.now()]))).observe(b);
} catch (e) { H.roError = String(e); }
try {
new PerformanceObserver(l => l.getEntries().forEach(en => H.shifts.push([en.value, en.startTime]))).observe({type: 'layout-shift', buffered: true});
} catch (e) { H.shiftsError = String(e); }
let last = rect().join();
const tick = () => {
H.frames++;
const now = rect().join();
if (now !== last) { H.rects.push({t: performance.timeOrigin + performance.now(), now, was: last}); last = now; }
requestAnimationFrame(tick);
};
requestAnimationFrame(tick);
H.snap = () => ({rect: rect(), vw: innerWidth, vh: innerHeight, scrollY: scrollY, dpr: devicePixelRatio,
focus: document.hasFocus(), visibility: document.visibilityState,
t: performance.timeOrigin + performance.now()});
})();
</script>
</body></html>"""
def judge(events):
"""The verdict of one run, from the page's events in order (a pure function: tests/unit would be where it is tested, it is here with the hunt).
Only what precedes the FIRST click counts: `mouseover`, `mouseout`, `click` of the button. See the module docstring for the four words."""
short = {"mouseover": "o", "mouseout": "x", "click": "c"}
seq = []
for e in events:
if e["type"] in short:
seq.append(short[e["type"]])
if e["type"] == "click":
break
word = "".join(seq)
if not word.endswith("c"):
return "other", word
before = word[:-1]
if before == "o":
return "single", word
if before.count("o") >= 2:
overs = [i for i, ch in enumerate(before) if ch == "o"]
for first, second in zip(overs, overs[1:]):
if "x" not in before[first:second]:
return "spurious", word
return "exit-reentry", word
return "other", word
# ── the core's retry loop, hooked (it logs nothing of its turns) ────────────────────────────────────────────────────────
class _Recorder:
def __init__(self):
self.mouse = [] # every pointer event the core sent: the client side of the sequence the page records
self.retries = [] # one per `_retry`: turns, runs, hit-target verdicts, what each `_act_on_target` ended with
REC = _Recorder()
_hooked = False
def _now_ms():
return time.time() * 1000.0
def _install_hooks():
"""Class-level wrappers on `invisible_core.juggler.actions.Actions`, once per process. They record and call the original with the same
arguments: nothing is changed. A run where `mouse` stays empty says the hooks never saw the call (`hooks_live` false in its line)."""
global _hooked
if _hooked:
return
from invisible_core.juggler import actions as A
cls = A.Actions
mouse, retry, center, hit, act = (cls._mouse_event, cls._retry, cls._center_point, cls.hit_target, cls._act_on_target)
def _mouse_event(self, event_type, point, *a, **kw):
REC.mouse.append({"t": _now_ms(), "type": event_type, "x": point[0], "y": point[1], "buttons": kw.get("buttons"),
"at_ms": kw.get("at_ms"), "retry": len(REC.retries)})
return mouse(self, event_type, point, *a, **kw)
def _retry(self, selector, run, *a, **kw):
turn = {"selector": str(selector)[:60], "start": _now_ms(), "center_point_calls": 0, "run_calls": 0, "act_on_target_calls": 0,
"hit_verdicts": [], "exceptions": [], "end": None}
REC.retries.append(turn)
def counted(f, el, pt):
turn["run_calls"] += 1
return run(f, el, pt)
try:
return retry(self, selector, counted, *a, **kw)
finally:
turn["end"] = _now_ms()
def _center_point(self, *a, **kw):
if REC.retries:
REC.retries[-1]["center_point_calls"] += 1
return center(self, *a, **kw)
def hit_target(self, f, element, point):
verdict = hit(self, f, element, point)
if REC.retries:
REC.retries[-1]["hit_verdicts"].append([_now_ms(), verdict])
return verdict
def _act_on_target(self, *a, **kw):
if REC.retries:
REC.retries[-1]["act_on_target_calls"] += 1
try:
return act(self, *a, **kw)
except BaseException as exc:
if REC.retries:
REC.retries[-1]["exceptions"].append([_now_ms(), type(exc).__name__, str(exc)[:200]])
raise
cls._mouse_event, cls._retry, cls._center_point, cls.hit_target, cls._act_on_target = (
_mouse_event, _retry, _center_point, hit_target, _act_on_target)
_hooked = True
def _serve():
class H(http.server.BaseHTTPRequestHandler):
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(PAGE)))
self.end_headers()
self.wfile.write(PAGE)
def log_message(self, *a):
pass
s = socket.socket()
s.bind(("127.0.0.1", 0))
port = s.getsockname()[1]
s.close()
srv = LocalServer(("127.0.0.1", port), H)
threading.Thread(target=srv.serve_forever, daemon=True).start()
return srv, "http://127.0.0.1:%d/" % port
def _write(index, record):
OUT.mkdir(parents=True, exist_ok=True)
path = OUT / ("run-%s-%03d.json" % (MODE, index))
path.write_text(json.dumps(record, separators=(",", ":")) + "\n", encoding="utf-8")
@pytest.mark.parametrize("index", range(RUNS))
def test_hunt_the_first_click_of_a_handle(index, firefox_binary):
"""One fresh browser, the first `button.click()` of the test, and the page's whole account of it."""
from invisible_playwright import InvisiblePlaywright
_install_hooks()
REC.mouse.clear()
REC.retries.clear()
record = {"mode": MODE, "index": index, "pid": os.getpid(), "worker": os.environ.get("PYTEST_XDIST_WORKER", "main")}
srv, url = _serve()
try:
with InvisiblePlaywright(seed=4242, binary_path=firefox_binary, headless=True) as browser:
page = browser.new_context().new_page()
page.goto(url, wait_until="load", timeout=30_000)
button = page.query_selector("#bottone")
t0 = _now_ms()
button.click()
t1 = _now_ms()
# nothing is asked of the page before the click: the scenario is the test's (goto, query_selector, click)
after = page.evaluate("() => { const h = window.hunt; return {hunt: {ev: h.ev, moves: h.moves, dmoves: h.dmoves, rects: h.rects, "
"ro: h.ro, shifts: h.shifts, frames: h.frames}, registro: window.registro, snap: h.snap()}; }")
hunt = after["hunt"]
verdict, word = judge(hunt["ev"])
turns = [r["center_point_calls"] for r in REC.retries]
record.update({
"ok": True, "verdict": verdict, "word": word,
"ordine": after["registro"]["ordine"], "clicks": after["registro"]["click"], "trusted": after["registro"].get("fidato"),
"test_rule_passes": after["registro"]["ordine"][:2] == ["hover", "click"],
"click_ms": round(t1 - t0, 1),
"events": hunt["ev"], "moves": hunt["moves"], "doc_moves": hunt["dmoves"],
"rect_changes": hunt["rects"], "resize": hunt["ro"], "layout_shifts": hunt["shifts"], "frames": hunt["frames"],
"snap_after_click": after["snap"],
"hooks_live": bool(REC.mouse), "core_mouse": REC.mouse, "retries": REC.retries,
"turns": turns[0] if turns else None,
"run_calls": REC.retries[0]["run_calls"] if REC.retries else None,
"wrong_hit_target": sum(1 for r in REC.retries for x in r["exceptions"] if x[1] == "WrongHitTarget"),
})
_write(index, record)
except BaseException as exc:
record.update({"ok": False, "verdict": "error", "error": "%s: %s" % (type(exc).__name__, exc),
"traceback": traceback.format_exc()[-3000:], "core_mouse": REC.mouse, "retries": REC.retries})
_write(index, record)
raise
finally:
srv.shutdown()
@@ -0,0 +1,122 @@
"""A click on the password field of a login form, with the login autocomplete list open over it, reaches the page: the page hears the click and no tab opens, as with stock Firefox and Playwright.
Firefox opens the autocomplete list (``#PopupAutoComplete``, a panel of the browser's own UI) by itself when a login field takes the focus. On a form whose first row is the insecure-login warning
(the form's action is an ``http`` address that is not local, so the form is not secure whatever the page is) the list opens under ``#user`` and covers the field below it. Stock Playwright sends a press
to the page through such a panel, as through the password doorhanger, so the page hears the whole click on ``#pass`` and the focus goes to it. An engine whose door sent the press to the popup
widget put it on the warning row, which opens a tab of the support site: the page heard nothing, and a page appeared.
Per scale (1, 1.25 and 1.5), the client's own mouse: a click on ``#user`` (the list must be open, read from the chrome: without it the case would pass for nothing), then a click on ``#pass``. The page records
``pointerdown``, ``mousedown``, ``pointerup``, ``mouseup`` and ``click`` in the capture phase. The test waits (a condition with a deadline) until the page has heard the click on ``#pass`` and the focus is
there, and then watches the number of pages of the context for one second (``observe``): it must stay what it was.
Needs ``MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1`` for the chrome reads. Red on an engine whose door lets the autocomplete list take part in the input path: the page hears nothing of the click on ``#pass`` and a page
opens.
"""
from __future__ import annotations
import contextlib
from typing import Any, Iterator, List, Tuple
import pytest
from _fission_frames import Sites
from _stock_twin import MARIONETTE_ARGS, BrokenControl, Chrome
from _window_origin import CASES, DEADLINE_S, launch_case, observe, wait_for
pytestmark = pytest.mark.e2e
#: The display scales of the cases: 1, 1.25 and 1.5.
SCALES = sorted(case for case, (scale, _panel) in CASES.items() if scale <= 1.5)
#: How long the number of pages is watched once the page has heard the click.
WATCH_S = 1.0
#: The two fields, one under the other (CSS pixels of the viewport): ``#user`` at (20, 20, 200 x 30), ``#pass`` at (20, 60, 200 x 30). The list opens under ``#user`` and covers ``#pass``.
USER_CENTRE = (120, 35)
PASS_CENTRE = (120, 75)
#: What the page hears on ``#pass``, in the order of a click.
PASS_CLICK = [["pointerdown", "pass"], ["mousedown", "pass"], ["pointerup", "pass"], ["mouseup", "pass"], ["click", "pass"]]
#: The login form. Its action is an ``http`` address that is not local and is never visited (nothing submits it): it makes the form insecure, so the list that opens on ``#user`` holds the warning row.
PAGE = """<!doctype html><meta charset=utf-8><title>login</title>
<style>html,body{margin:0;padding:0;height:100%}input{position:absolute;left:20px;width:200px;height:30px;box-sizing:border-box}#user{top:20px}#pass{top:60px}</style>
<body><form method=post action="http://login-target.example/signin">
<input id=user name=user type=text><input id=pass name=password type=password></form>
<script>
window.__events = [];
for (const type of ['pointerdown', 'mousedown', 'pointerup', 'mouseup', 'click'])
window.addEventListener(type, e => window.__events.push([e.type, e.target.id || e.target.nodeName.toLowerCase()]), true);
window.__read = () => ({events: window.__events.slice(), active: document.activeElement && document.activeElement.id});
window.__reset = () => { window.__events.length = 0; };
</script>"""
#: The prefs of the launch. ``-marionette`` applies Marionette's recommended preferences, which set ``signon.rememberSignons`` to false on the default branch, and a real user's Firefox has it true (the default):
#: the user branch, which wins over the default one, gets it back, so the login manager marks the field and the list opens.
EXTRA_PREFS = {"marionette.port": 0, "signon.rememberSignons": True}
#: The state of the autocomplete list, read in the chrome (``absent`` where the element is not there).
STATE_JS = """
const win = Services.wm.getMostRecentWindow("navigator:browser");
const popup = win.document.getElementById("PopupAutoComplete");
return JSON.stringify({autocomplete: popup && typeof popup.state === "string" ? popup.state : "absent"});
"""
#: The pref that lets the login manager mark a field as autocompletable (``LoginHelper.enabled``).
PREF_JS = """
return JSON.stringify({rememberSignons: Services.prefs.getBoolPref("signon.rememberSignons", null)});
"""
#: Closes the list, so the page closes clean.
HIDE_JS = """
const win = Services.wm.getMostRecentWindow("navigator:browser");
const popup = win.document.getElementById("PopupAutoComplete");
if (popup && typeof popup.hidePopup === "function" && popup.state !== "closed") popup.hidePopup();
return JSON.stringify({});
"""
@contextlib.contextmanager
def _session(firefox_binary: str, monkeypatch, case: str) -> Iterator[Tuple[Any, Any, Chrome, Sites]]:
"""Our browser on ``case`` with the login page served: ``(page, context, chrome, sites)``. The first page is kept open (the window the chrome session waits for)."""
monkeypatch.setenv("MOZ_REMOTE_ALLOW_SYSTEM_ACCESS", "1") # the chrome-scope reads
with Sites() as sites, launch_case(firefox_binary, case, extra_args=MARIONETTE_ARGS, extra_prefs=EXTRA_PREFS) as browser:
sites.route("A", "/login", PAGE)
holder = browser.new_page()
chrome = Chrome(holder)
page = browser.new_page()
try:
page.goto(sites.url("A", "/login"))
yield page, page.context, chrome, sites
finally:
chrome.script(HIDE_JS)
chrome.close()
def _list_state(chrome: Chrome) -> str:
return chrome.script(STATE_JS)["autocomplete"]
@pytest.mark.parametrize("case", SCALES)
def test_a_click_on_the_password_field_under_the_login_list_reaches_the_page(firefox_binary, monkeypatch, case):
with _session(firefox_binary, monkeypatch, case) as (page, context, chrome, _sites):
page.mouse.click(*USER_CENTRE)
opened = wait_for(page, lambda: _list_state(chrome) == "open", DEADLINE_S)
if not opened:
raise BrokenControl("BROKEN CONTROL, no finding about ours: a click on #user did not open the login autocomplete list (state %r, signon.rememberSignons %r): the case would pass for nothing"
% (_list_state(chrome), chrome.script(PREF_JS)["rememberSignons"]))
# The release of the first click is heard by the page after the click returned: wait for it, then start from an empty record.
assert wait_for(page, lambda: ["click", "user"] in page.evaluate("() => window.__read()")["events"], DEADLINE_S), "the page never heard the click on #user"
page.evaluate("() => window.__reset()")
pages_before = len(context.pages)
if _list_state(chrome) != "open":
raise BrokenControl("BROKEN CONTROL, no finding about ours: the login autocomplete list is not open right before the press on #pass (state %r, signon.rememberSignons %r)"
% (_list_state(chrome), chrome.script(PREF_JS)["rememberSignons"]))
page.mouse.click(*PASS_CENTRE)
def heard() -> bool:
reading = page.evaluate("() => window.__read()")
return reading["events"] == PASS_CLICK and reading["active"] == "pass"
arrived = wait_for(page, heard, DEADLINE_S)
reading = page.evaluate("() => window.__read()")
assert arrived, ("the page did not hear the whole click on #pass with the focus on it (waited %s s; the list was %r): it heard %r, the active element is %r"
% (DEADLINE_S, _list_state(chrome), reading["events"], reading["active"]))
counts: List[int] = observe(page, lambda: len(context.pages), WATCH_S)
assert counts == [pages_before], "a click on #pass opened a page (the pages of the context over %s s: %r, before it %d)" % (WATCH_S, counts, pages_before)
@@ -114,14 +114,6 @@ def test_the_caller_never_declares_udp_on_a_context_proxy():
assert _context_proxy(_apply({"proxy": dict(gw.proxy, udp="coherent")}, [gw]))[1]["udp"] == "no"
def test_a_proxy_is_measured_again_for_every_context_given_it():
"""Nothing is kept by the core: three contexts given one proxy are three measurements."""
with coherent() as gw:
for n in range(1, 4):
assert _context_proxy(_apply({"proxy": dict(gw.proxy)}, [gw]))[1]["udp"] == "coherent"
assert gw.associates == n
def test_the_credentials_are_used_on_the_socket_and_nowhere_else(caplog):
user, password = "u-7c1e4b9a02", "p-3d5f8a6e41"
env_before = dict(os.environ)
@@ -0,0 +1,123 @@
"""A real drag from the top document ends as it does on stock Firefox with stock Playwright, in a frame of another site and in the top document.
The drag-and-drop points cross the process boundary as whole numbers: the parent sends the drop point to the frame's process, and the end point of the drag
to the source's. If either one is off by the offset between the window's real chrome and its declared chrome, the frame's element under the cursor is not the
element that gets the drop, and ``dragend`` carries a point that is not the last one the drag reported.
THE VERDICT IS "THE SAME AS STOCK" (``_stock_twin``): Playwright's own Firefox, driven by the stock Playwright client, does the same drag first, on the same local pages, at the same
window size and scale, and ours must read what stock reads. What the page reads is the relation, and no number of ours is its expected value.
What it does, per display case (the four of the window tests), on each browser, with the client's own mouse (``page.mouse.move``, ``down``, ``move`` in steps, ``up``), twice: a page of the top
site holds a draggable box at its top left, a drop box in the top document (120x120 at (20, 200)) and, lower right, a frame of another site, 400x300 at (200, 100). The frame holds two boxes,
120x120, at (40, 60) (``target``) and (220, 60) (``other``). The mouse goes down on the dragged box and moves in twelve steps to the centre of ``target`` (300, 220 in the top document), and then,
on a fresh load of the page, to the centre of the drop box of the top document (80, 260). Both pages record every drag event they hear (``_drag_record``): for ``dragstart`` and ``drag``
at the source, ``dragenter``, ``dragover``, ``dragleave`` and ``drop`` where the drag goes, and ``dragend`` at the source, the type, the target's id, the id of the element under the cursor, the
client and screen points, ``buttons``, ``mozInputSource``, ``dataTransfer.types``, ``effectAllowed``, ``dropEffect``, ``mozUserCancelled``, whether ``mozSourceNode`` is null and ``isTrusted``;
the ``dragend`` point; and ``dragend``'s client point less the last ``drag``'s.
THE TWIN RULE (``_drag_record.DECLARED``): stock's frame is in-process (stock Playwright's Firefox sets ``fission.webContentIsolationStrategy=0``) and its drag is Juggler's synthetic one, so
the buttons, ``drag`` at the source (count and presence), the ``dragend`` point less the last ``drag`` and, in the frame, ``effectAllowed``, ``dropEffect`` and ``mozSourceNode`` are in the record
and NOT compared with stock; so are, for the drop in the frame only, the top document's ``dragleave`` into the frame (stock's top hears one at the body when the cursor enters the subdocument;
retail with the frame out of process has none) and the ``dropEffect`` of the top ``dragend`` (the frame's drop result, which crosses processes). The report of the test lists what differs there
(``recorded_differences``), and the retail capture (the round ``drag`` of the core's window-geometry workflow) decides them. Routing and targets, client points, ``rel``, types, trusted, the input
source, and the effects of the top document (``dragend``'s too, in the drop in the top document) are compared.
Ours equals stock in every compared field, within one CSS pixel in a client point, and through the relation of the screen point to the client point (stock's window
stands where it stands and ours where it declares, so the screen numbers themselves are in the record and not in the verdict; ``_drag_record`` says why, field by field). The record also has
the scales of each browser (page and chrome ``devicePixelRatio``, and the real scale of the screen from chrome scope), printed when it differs.
The engine that answers these values is not released yet: with the real chrome offset in the points the drop target or ``dragend`` is off, so this test is RED on the engine of the pin
where they differ, on purpose. It enters the suite with the engine release.
"""
from __future__ import annotations
from typing import Any, Dict, Tuple
import pytest
from _drag_record import RECORDER_JS, read_events, read_record, recorded, verdict
from _fission_frames import Sites, wait_frame
from _stock_twin import Chrome, run_twin
from _window_origin import CASES, DEADLINE_S, wait_for
pytestmark = pytest.mark.e2e
#: The box that is dragged: 80x50 at (20, 20) of the top document; the mouse goes down at its centre.
SOURCE = (60, 45)
#: The frame: 400x300 at (200, 100). The centre of ``target`` in the frame is (100, 120), so (300, 220) in the top document.
FRAME_AT = (200, 100)
TARGET_IN_FRAME = (100, 120)
#: The drop box of the top document: 120x120 at (20, 200); its centre.
TOP_DROP = (80, 260)
STEPS = 12
#: The two drops, in this order: the one the engine's fission path serves and the one that must keep working. kind -> where the mouse goes up.
DROPS: Dict[str, Tuple[int, int]] = {"frame": (FRAME_AT[0] + TARGET_IN_FRAME[0], FRAME_AT[1] + TARGET_IN_FRAME[1]), "top": TOP_DROP}
TOP = """<!doctype html><meta charset=utf-8><title>drag</title>
<style>html,body{margin:0;padding:0;height:100%%}
#src{position:absolute;left:20px;top:20px;width:80px;height:50px;background:#9bd}
#top_target{position:absolute;left:20px;top:200px;width:120px;height:120px;background:#bd9}
#f{position:absolute;left:200px;top:100px;width:400px;height:300px;border:0}</style>
<body><div id=src draggable=true>drag</div><div id=top_target>drop</div><iframe id=f src="%s"></iframe><script>
document.getElementById('src').addEventListener('dragstart', e => {
e.dataTransfer.setData('text/plain', 'x');
e.dataTransfer.effectAllowed = 'copy';
});
document.getElementById('top_target').addEventListener('dragover', e => e.preventDefault());
document.getElementById('top_target').addEventListener('drop', e => e.preventDefault());
</script><script>""" + RECORDER_JS + """</script>"""
FRAME = """<!doctype html><meta charset=utf-8><title>drop</title>
<style>html,body{margin:0;padding:0;height:100%}
.box{position:absolute;top:60px;width:120px;height:120px}
#target{left:40px;background:#bd9}#other{left:220px;background:#db9}</style>
<body><div id=target class=box>target</div><div id=other class=box>other</div><script>
document.addEventListener('dragover', e => e.preventDefault(), true);
document.addEventListener('drop', e => e.preventDefault(), true);
</script><script>""" + RECORDER_JS + """</script>"""
def _drag(page, to: Tuple[int, int]) -> None:
page.mouse.move(*SOURCE)
page.mouse.down()
page.mouse.move(to[0], to[1], steps=STEPS)
page.mouse.up()
def _heard(document, kind: str) -> bool:
return any(e["type"] == kind for e in read_events(document))
def _one_drop(sites, page, kind: str) -> Dict[str, Any]:
"""A fresh load of the page, one drag that ends at ``kind``'s point, and the record of what both documents heard."""
page.goto(sites.url("A", "/page"), wait_until="load", timeout=30000)
frame = wait_frame(page, sites.origin["B"], "/drop", seconds=DEADLINE_S)
wait_for(page, lambda: frame.evaluate("() => document.readyState") == "complete")
origin = page.evaluate("() => { const r = document.getElementById('f').getBoundingClientRect(); return [r.left, r.top]; }")
assert tuple(origin) == FRAME_AT, "the frame is at %r in the top document, the test placed it at %r" % (origin, FRAME_AT)
_drag(page, DROPS[kind])
wait_for(page, lambda: _heard(page, "dragend") or not _heard(page, "dragstart"), 10)
receiver = frame if kind == "frame" else page
wait_for(page, lambda: _heard(receiver, "drop"), 5) # stock may drop nothing: then the wait ends and the record says so
return read_record(page, frame)
def _steps(sites, page, chrome: Chrome) -> Dict[str, Any]:
"""What one browser does and what the page reads of it. {"scales": ..., "measured": {"frame": record, "top": record}}."""
page.goto(sites.url("A", "/page"), wait_until="load", timeout=30000)
scales = chrome.scales()
return {"scales": scales, "measured": {kind: _one_drop(sites, page, kind) for kind in DROPS}}
@pytest.mark.parametrize("case", sorted(CASES))
def test_a_drag_from_the_top_into_a_frame_of_another_site_ends_as_on_stock(firefox_binary, monkeypatch, case, record_property):
monkeypatch.setenv("MOZ_REMOTE_ALLOW_SYSTEM_ACCESS", "1") # the chrome-scope reads of the record
with Sites() as sites:
sites.route("A", "/page", lambda handler: TOP % sites.url("B", "/drop"))
sites.route("B", "/drop", FRAME)
stock, ours = run_twin(case, firefox_binary, lambda page, chrome: _steps(sites, page, chrome))
for kind in DROPS:
record_property("recorded_differences_%s" % kind, "\n".join(recorded(stock["measured"][kind], ours["measured"][kind], kind, "%s drop" % kind)))
message = verdict(case, kind, stock["measured"][kind], ours["measured"][kind])
assert not message, message
@@ -0,0 +1,128 @@
"""A frame reads its ``mozInnerScreen`` only as (0, 0), as the client origin of the window, or as its settled value, from the first line of its script to ``load``.
Retail Firefox 159.0 on Windows, round 7 of the window-geometry capture (RetailCaptures ``captures/WINDOW_GEOMETRY_FRAME_EARLY.csv``, steps ``iframes_max``
and ``iframes_transformed``, columns ``moment``, ``mozInnerScreenX/Y``, ``settled_mozInnerScreenX/Y``, ``client_origin_css_x/y``): in a maximized window every
reading of a frame, at parse, ``DOMContentLoaded``, the first two animation frames and ``load``, is one of
three values and no other:
* (0, 0): the frame has no place yet (a frame of another process before the parent has sent the first matrix, and any frame before its first layout);
* the window's client origin, ``client_origin_css_x/y``: (0, 0) in every row of the maximized window (the popup of the same round has (12, 4) at scale 1.0,
and is not read here);
* the value the frame settles at.
A reading that is none of them is a value the page can tell from retail: a frame of another process that, before its first matrix, reads the real offset of the
browser chrome in the host's window, or the real window origin, instead of what the declaration gives. Those values are what the host's window has, and they
are not the declared ones.
What it does, per display case (the four of the window tests): a page of the top site loads a frame of the same site and a frame of another site, and the same two
inside a container under ``transform: scale(1.5)`` and ``rotate(10deg)`` (``transform-origin: 0 0``), the six kinds of round 7. The frame's page has an inline
script FIRST in ``<head>``: it records ``mozInnerScreenX/Y`` at parse, at ``DOMContentLoaded``, in the first two ``requestAnimationFrame`` callbacks it asked for at
parse, and at ``load``. Each kind loads three times (a new frame each time: the reading at parse is a race the first load can win by luck). The settled value is the
frame's reading once two looks 100 ms apart are equal, after ``load``. The assertion names the case, the kind, the moment and the three values it allowed.
The engine that answers these values is not released yet: on the engine of the pin this test is RED where the frame reads the real offsets, on purpose. It enters
the suite with the engine release.
"""
from __future__ import annotations
from typing import Any, Dict, List, Tuple
import pytest
from _fission_frames import Sites, wait_frame
from _window_origin import CASES, DEADLINE_S, FLOAT, launch_case, settled, wait_for
pytestmark = pytest.mark.e2e
#: The window's client origin in CSS pixels: ``client_origin_css_x/y`` of every ``iframes_max`` and ``iframes_transformed`` row of round 7 (maximized: the client
#: area starts at the window's origin).
CLIENT_ORIGIN: Tuple[float, float] = (0.0, 0.0)
#: The moments of the capture, and the frames each load must have recorded before it is read.
MOMENTS = ("parse", "dcl", "raf1", "raf2", "load")
#: Loads of each kind.
LOADS = 3
TOP = """<!doctype html><meta charset=utf-8><title>early</title>
<style>html,body{margin:0;padding:0;height:100%}</style><body></body>"""
# The page of every frame. The script is the first thing in <head>, as in the capture.
EARLY = """<!doctype html><html><head><script>
window.__early = [];
function rec(moment) { window.__early.push({m: moment, x: mozInnerScreenX, y: mozInnerScreenY}); }
rec('parse');
document.addEventListener('DOMContentLoaded', function () { rec('dcl'); });
requestAnimationFrame(function () { rec('raf1'); requestAnimationFrame(function () { rec('raf2'); }); });
window.addEventListener('load', function () { rec('load'); });
</script><meta charset=utf-8><style>html,body{margin:0;padding:0;height:100%}</style></head><body></body></html>"""
#: A frame in the page, 300x120 at (10, 60) (same site) or (10, 200) (another site), or in a container at (10, 200) under a transform.
ADD = """([src, top, transform]) => {
const f = document.createElement('iframe');
f.src = src;
f.style.cssText = 'display:block;width:300px;height:120px;border:0;margin:0;padding:0';
const box = document.createElement('div');
box.className = 'early-box';
if (transform) {
box.style.cssText = 'position:fixed;left:10px;top:200px;width:300px;height:120px;margin:0;padding:0;transform-origin:0 0;transform:' + transform;
} else {
box.style.cssText = 'position:absolute;left:10px;top:' + top + 'px;width:300px;height:120px;margin:0;padding:0';
}
box.appendChild(f);
document.body.appendChild(box);
}"""
REMOVE = "() => { document.querySelectorAll('.early-box').forEach(b => b.remove()); }"
#: kind -> (site of the frame, top in the page, transform)
KINDS: Dict[str, Tuple[str, int, str]] = {
"same": ("A", 60, ""),
"cross": ("B", 200, ""),
"same_scale": ("A", 200, "scale(1.5)"),
"cross_scale": ("B", 200, "scale(1.5)"),
"same_rotate": ("A", 200, "rotate(10deg)"),
"cross_rotate": ("B", 200, "rotate(10deg)"),
}
def _near(reading: Tuple[float, float], other: Tuple[float, float]) -> bool:
return abs(reading[0] - other[0]) <= FLOAT and abs(reading[1] - other[1]) <= FLOAT
def _recorded(frame) -> List[Dict[str, Any]]:
try:
return frame.evaluate("() => window.__early || []")
except Exception: # the frame is between two documents: not recorded yet
return []
@pytest.mark.parametrize("case", sorted(CASES))
def test_a_frame_reads_only_declared_origins_while_it_loads(firefox_binary, case):
problems: List[str] = []
with Sites() as sites:
sites.route("A", "/page", TOP)
sites.route("A", "/early", EARLY)
sites.route("B", "/early", EARLY)
with launch_case(firefox_binary, case) as browser:
page = browser.new_page()
page.goto(sites.url("A", "/page"), wait_until="load", timeout=30000)
for kind, (site, top, transform) in KINDS.items():
for load in range(LOADS):
path = "/early?%s&load=%d" % (kind, load)
page.evaluate(ADD, [sites.url(site, path), top, transform])
try:
frame = wait_frame(page, sites.origin[site], path, seconds=DEADLINE_S)
wait_for(page, lambda: {r["m"] for r in _recorded(frame)} >= set(MOMENTS))
records = {r["m"]: r for r in _recorded(frame)}
missing = [m for m in MOMENTS if m not in records]
if missing:
problems.append("%s, %s, load %d: the frame never recorded %s (recorded %r)" % (case, kind, load, missing, _recorded(frame)))
continue
final = settled(page, lambda: tuple(frame.evaluate("() => [mozInnerScreenX, mozInnerScreenY]")))
allowed = [(0.0, 0.0), CLIENT_ORIGIN, final]
for moment in MOMENTS:
reading = (records[moment]["x"], records[moment]["y"])
if not any(_near(reading, a) for a in allowed):
problems.append(
"%s, %s frame, load %d, at %s: mozInnerScreen reads (%r, %r); allowed (0, 0), the client origin %r, or the settled value %r"
% (case, kind, load, moment, reading[0], reading[1], CLIENT_ORIGIN, final))
finally:
page.evaluate(REMOVE)
assert not problems, "a frame read a value that is not declared while it loaded (%d):\n %s" % (len(problems), "\n ".join(problems))
@@ -0,0 +1,126 @@
"""faulthandler's thread dump crashes a process whose threads churn frames, and the e2e stack watchdog does not: the hazard behind the Windows part 3 deaths.
Both halves run the same load in a child python: 32 threads that call a recursive function and start and join a short thread, over and over, so that frames
are created and freed all the time, while a watchdog dumps the stacks of every thread every millisecond.
* The old mechanism, ``faulthandler.dump_traceback_later(0.001, repeat=True)``, copies the frames of every thread without the GIL. The child must die with a
crash status (a signal on Linux, an NT status such as 0xC0000005 on Windows), never end well and never end with an exception (status 1). It dies in under 100 ms
on CPython 3.11 and 3.12, and the child gets 60 s before the test says that this Python did not show the hazard. This is the proof that the hazard is real.
* The new watchdog (``tests/_stack_watchdog.py``) at a period of 1 ms, on the same load, must let the child run for SURVIVAL_S = 6 s (sixty times what the old
one lasts) and end with status 0, with the file holding a dump of the threads for at least 20 dumps.
The child sets itself up not to leave a trace of its crash: on Windows the error mode without the crash box (no Windows Error Reporting dialog and no dump
in the LocalDumps folder of a job that keeps them), on Linux a core limit of 0.
"""
from __future__ import annotations
import json
import subprocess
import sys
from pathlib import Path
import pytest
pytestmark = pytest.mark.unit
TESTS = Path(__file__).resolve().parent
SURVIVAL_S = 6.0
THREADS = 32
HAZARD_DEADLINE_S = 60.0
CHILD = '''
import json, os, sys, threading, time
mode, seconds, threads, tests_dir, log_path = sys.argv[1], float(sys.argv[2]), int(sys.argv[3]), sys.argv[4], sys.argv[5]
if sys.platform == "win32":
import ctypes
ctypes.windll.kernel32.SetErrorMode(0x8003)
else:
import resource
resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
sys.path.insert(0, tests_dir)
stop = threading.Event()
def deep(n):
if n == 0:
return sum(i for i in range(5))
return deep(n - 1) + 1
def churn():
while not stop.is_set():
deep(30)
t = threading.Thread(target=deep, args=(10,))
t.start()
t.join()
class Sink:
"""Counts the dumps and keeps the first megabyte of them in the file: a dump every millisecond would fill a disk."""
def __init__(self, path):
self.file = open(path, "w", encoding="utf-8")
self.kept = 0
self.dumps = 0
def write(self, text):
self.dumps += text.count("Timeout (")
if self.kept < 1000000:
self.kept += self.file.write(text)
def flush(self):
self.file.flush()
if mode == "old":
import faulthandler
faulthandler.dump_traceback_later(0.001, repeat=True, file=open(os.devnull, "w"))
else:
import _stack_watchdog as dog
sink = Sink(log_path)
dog.arm("stress", 0.001, 0.001, file=sink)
workers = [threading.Thread(target=churn, daemon=True) for _ in range(threads)]
for w in workers:
w.start()
time.sleep(seconds)
stop.set()
if mode == "old":
faulthandler.cancel_dump_traceback_later()
else:
dog.cancel()
for w in workers:
w.join()
print(json.dumps({"survived": True, "dumps": 0 if mode == "old" else sink.dumps}))
'''
def _run(tmp_path: Path, mode: str, seconds: float, timeout: float):
script = tmp_path / ("child_%s.py" % mode)
script.write_text(CHILD, encoding="utf-8")
log = tmp_path / "dumps.log"
done = subprocess.run([sys.executable, str(script), mode, str(seconds), str(THREADS), str(TESTS), str(log)], capture_output=True, text=True, timeout=timeout)
return done, log
def _crashed(returncode: int) -> bool:
"""A signal on POSIX (negative), an NT status (0xC0000005 and the like, from 0x80000000) on Windows. An exception of Python is 1, a good end is 0."""
return returncode < 0 or returncode >= 0x80000000
def test_the_dump_of_faulthandler_kills_a_process_that_churns_frames(tmp_path):
done, _ = _run(tmp_path, "old", HAZARD_DEADLINE_S, HAZARD_DEADLINE_S + 60)
assert _crashed(done.returncode), (
"faulthandler.dump_traceback_later(0.001, repeat=True) did not crash the child on this Python (%s, status %s): the GIL-free copy of the frames "
"did not show on %d threads in %d s. stdout %r, stderr %r" % (sys.version.split()[0], done.returncode, THREADS, HAZARD_DEADLINE_S, done.stdout[-200:], done.stderr[-500:]))
def test_the_stack_watchdog_survives_the_same_load_for_sixty_times_as_long(tmp_path):
done, log = _run(tmp_path, "new", SURVIVAL_S, SURVIVAL_S + 120)
assert done.returncode == 0, "the child ended with status %s after at most %s s, stderr %r" % (done.returncode, SURVIVAL_S, done.stderr[-800:])
result = json.loads(done.stdout)
assert result["survived"] and result["dumps"] >= 20, result
text = log.read_text(encoding="utf-8", errors="replace")
assert "Timeout (" in text and "Thread 0x" in text and "in churn" in text
@@ -0,0 +1,346 @@
"""An ElementHandle's pointer action walks onto its element the way a selector's does: ONE click path, ONE fingerprint.
THE DEFECT. `page.query_selector("#go").click()` went straight to `Actions.click(element_id=...)` and never through the server's hand (`Frame._by_hand` ->
`Pointer.act`). The core's approach is, with `engine_approach` False (the server never sets it), ONE `mousemove` onto the exact centre of the element's quad, a
settle, and the press on that same point. So a click through a handle was a jump to the exact geometric centre of the box, identical in every install, where the
same click through a selector is a drawn path with a landing point of the session's own. Two click paths are two fingerprints, which is the one thing the pointer
exists not to have, and the comment above the handle's actions said the opposite.
Nothing here launches a browser. The page is a real `PageDispatcher` shape over the core's real `Actions` (with its `PageActs`, `CursorMotion` and `Pacer`) and
the wrapper's real `Pointer`; only the connection (it RECORDS `Page.dispatchMouseEvent` and `Page.dispatchTapEvent`) and the injected script (it answers the
element's box, its hit test and its state) are stand-ins, on a clock that advances only when something sleeps. The operations called are the dispatchers' own
(`FrameDispatcher.op_click` for the selector, `ElementHandleDispatcher.op_click` for the handle), so what is asserted is the wiring and not a copy of it.
The e2e twin, in a real browser, is `test_a_handle_action_walks_like_a_selector_action_e2e.py`.
"""
from __future__ import annotations
import time
from types import SimpleNamespace
from unittest.mock import Mock
import pytest
from invisible_core.juggler import PageActs
from invisible_core.juggler import actions as core_actions
from invisible_core.juggler.actions import Actions
from invisible_core.juggler.connection import EventListeners
from invisible_core.juggler.lifecycle import Lifecycle
from invisible_playwright import _cursor
from invisible_playwright._juggler import pointer as pointer_mod
from invisible_playwright._juggler.dispatcher import Dispatcher
from invisible_playwright._juggler.pointer import Pointer
from invisible_playwright._juggler.server import (
ElementHandleDispatcher, FrameDispatcher, JugglerServer, PageDispatcher)
pytestmark = pytest.mark.unit
VIEWPORT = {"width": 1280, "height": 720}
BUDGET = 1.5
#: A control whose exact quad centre is (450.0, 320.0).
BOX = {"x": 400.0, "y": 300.0, "width": 100.0, "height": 40.0}
CENTRE = (450.0, 320.0)
HANDLE_ID = "el-1"
#: A spread of boxes the way a page lays out buttons and links: wide, tall, small, near the edge of the viewport.
BOXES = [
{"x": 400.0, "y": 300.0, "width": 100.0, "height": 40.0},
{"x": 880.5, "y": 120.25, "width": 160.0, "height": 36.0},
{"x": 300.0, "y": 5.0, "width": 60.0, "height": 18.0},
{"x": 500.0, "y": 40.0, "width": 90.0, "height": 30.0},
]
SEEDS = range(1, 121)
# -- the stand-ins ---------------------------------------------------------------------------------------------------------------------------------
class VirtualClock:
"""Advances only when something sleeps, for the pointer's pacer and for the pauses the core's actions take (press settle, dwell)."""
def __init__(self) -> None:
self.t = 0.0
def now(self) -> float:
return self.t
def sleep(self, seconds: float) -> None:
self.t += max(0.0, seconds)
class RecordingConnection:
"""The engine's side: records what the page would receive, answers the quad of the one box."""
def __init__(self, box) -> None:
self.box = box
self.log = []
def send(self, method, params=None, session=None, timeout=None, **kw):
params = params or {}
if method in ("Page.dispatchMouseEvent", "Page.dispatchTapEvent"):
self.log.append({"m": method, "type": params.get("type", "tap"), "x": params["x"], "y": params["y"]})
if method == "Page.getContentQuads":
b = self.box
return {"quads": [{
"p1": {"x": b["x"], "y": b["y"]},
"p2": {"x": b["x"] + b["width"], "y": b["y"]},
"p3": {"x": b["x"] + b["width"], "y": b["y"] + b["height"]},
"p4": {"x": b["x"], "y": b["y"] + b["height"]}}]}
if method == "Page.dispatchMouseEvent" and "landsOn" in params:
return {"landing": {"landed": True, "on": "el"}}
return {}
class FakeInjected:
"""The page's script: the element's box, a hit test that accepts every point of the box, the state of a checkbox that is unchecked until clicked."""
def __init__(self, conn) -> None:
self.conn = conn
self.queried = []
self.disposed = []
self.measured = []
self.state_reads = 0
def query_selector(self, f, selector, strict=False):
self.queried.append(selector)
return "resolved-from-the-selector"
def bounding_box(self, f, el):
self.measured.append(el)
return dict(self.conn.box)
def dispose(self, f, el):
self.disposed.append(el)
def element_states(self, f, el, states):
return {"ok": True}
def element_state(self, f, el, state):
self.state_reads += 1
return self.state_reads > 1
def evaluate(self, f, expr, **kw):
return {"w": VIEWPORT["width"], "h": VIEWPORT["height"]}
def check_hit_target(self, f, el, point):
b = self.conn.box
inside = b["x"] <= point[0] < b["x"] + b["width"] and b["y"] <= point[1] < b["y"] + b["height"]
return "done" if inside else "other"
def scroll_into_view(self, *a, **k):
raise AssertionError("not expected: the box is on screen")
class Life:
main_frame = "main"
def build_page(box=BOX, *, seed=4242, number=0, budget=BUDGET):
"""A page the dispatchers act on: real `Actions` and `Pointer`, as `PageDispatcher._build` assembles them."""
server = JugglerServer()
server.attach(SimpleNamespace(emit_message=lambda message: None))
context = Dispatcher(server, None)
context.options = {"hasTouch": True}
conn = RecordingConnection(box)
injected = FakeInjected(conn)
actions = Actions(conn, "sess", Life(), injected, acts=PageActs(number), session_seed=seed, motion_budget_s=budget, layout="us")
page = object.__new__(PageDispatcher)
page.context = context
page.lifecycle = Lifecycle(EventListeners(), "session")
page.injected = injected
page.actions = actions
page.viewport_size = dict(VIEWPORT)
page.pointer = Pointer(actions, injected, number, seed, budget, lambda: page.viewport_size)
page._frames = {}
page._navigation_requests = {}
page._announced_closed = False
Dispatcher.__init__(page, server, context)
page.frame = FrameDispatcher(server, page, "main")
page.handle = ElementHandleDispatcher(server, page.frame, HANDLE_ID)
page.engine = conn
return page
@pytest.fixture(autouse=True)
def clock(monkeypatch):
c = VirtualClock()
monkeypatch.setattr(pointer_mod, "_CLOCK", c)
# the core pauses with `time.sleep` and counts a stroke's instants on `time.monotonic`: both are this clock
monkeypatch.setattr(core_actions, "time", SimpleNamespace(sleep=c.sleep, monotonic=c.now, perf_counter=time.perf_counter))
monkeypatch.delenv(_cursor.ENGINE_ENV, raising=False)
monkeypatch.delenv(_cursor.LANDING_ENV, raising=False)
_cursor._reset_warnings()
yield c
_cursor._reset_warnings()
def act(how, kind, *, box=BOX, seed=4242, number=0, **params):
"""One action, through the dispatcher a client's call arrives at: `how` is "selector" (the Frame's op) or "handle" (the ElementHandle's).
Returns the page, whose `conn.log` is what the engine received."""
page = build_page(box, seed=seed, number=number)
if how == "selector":
page.frame.call(kind, {"selector": "#b", "noWaitAfter": True, **params})
else:
page.handle.call(kind, {"noWaitAfter": True, **params})
return page
def moves(page):
return [(e["x"], e["y"]) for e in page.engine.log if e["type"] == "mousemove"]
def presses(page):
return [(e["x"], e["y"]) for e in page.engine.log if e["type"] in ("mousedown", "tap")]
def moves_before_the_press(page):
out = []
for e in page.engine.log:
if e["type"] in ("mousedown", "tap"):
break
if e["type"] == "mousemove":
out.append((e["x"], e["y"]))
return out
def entries(box, points, start):
"""How many times the pointer ENTERS the box: maximal runs of consecutive positions inside it, from `start` (what a page counts as `mouseover`)."""
def inside(p):
return box["x"] <= p[0] < box["x"] + box["width"] and box["y"] <= p[1] < box["y"] + box["height"]
n, was = 0, False
for p in [start] + list(points):
now = inside(p)
if now and not was:
n += 1
was = now
return n
# -- 1. a handle's pointer action is a walk, not a jump to the centre ------------------------------------------------------------------------------
@pytest.mark.parametrize("kind", ["click", "dblclick"])
def test_a_handle_press_is_preceded_by_a_walk_and_not_a_single_jump(kind):
"""The defect, stated plainly. Today: ONE `mousemove` (onto the exact centre) and then the press."""
for seed in (4242, 1, 2, 3, 77):
page = act("handle", kind, seed=seed)
before = moves_before_the_press(page)
assert len(before) > 1, "seed %d: a handle %s made %d mousemove before its press: %r" % (seed, kind, len(before), before)
@pytest.mark.parametrize("kind", ["click", "dblclick", "tap"])
def test_a_handle_press_does_not_land_on_the_exact_centre(kind):
"""The point a press lands on is the session's own landing point, not the centre of the quad that every install would share."""
centred = []
for seed in SEEDS:
for box in BOXES:
page = act("handle", kind, box=box, seed=seed)
point = presses(page)[0]
if point == (box["x"] + box["width"] / 2.0, box["y"] + box["height"] / 2.0):
centred.append((seed, box))
assert not centred, "%d of %d handle %ss pressed on the exact centre of the box: %r" % (len(centred), len(SEEDS) * len(BOXES), kind, centred[:3])
def test_a_handle_hover_walks_and_ends_off_the_centre():
for seed in (4242, 1, 2, 3, 77):
page = act("handle", "hover", seed=seed)
path = moves(page)
assert len(path) > 1, "seed %d: a handle hover made %d mousemove: %r" % (seed, len(path), path)
assert path[-1] != CENTRE, "seed %d: a handle hover ended on the exact centre" % seed
@pytest.mark.parametrize("kind", ["check", "uncheck"])
def test_a_handle_check_and_uncheck_walk_and_press_off_the_centre(kind):
# the stand-in box is not in the wanted state until it has been clicked, which is what both actions look for
page = act("handle", kind)
assert len(moves_before_the_press(page)) > 1, "a handle %s jumped to its press" % kind
assert presses(page)[0] != CENTRE, "a handle %s pressed on the exact centre" % kind
# -- 2. one click path: the handle's walk is the selector's -------------------------------------------------------------------------------------------
def test_a_handle_and_a_selector_enter_the_box_alike_over_the_same_seeds_and_boxes():
"""The same seed and the same boxes: the statistics of entries into the box per action are the same through a handle and through a selector."""
histograms = {"selector": {}, "handle": {}}
for seed in SEEDS:
for box in BOXES:
for how in histograms:
page = act(how, "click", box=box, seed=seed)
start = page.pointer.hand.start_point(VIEWPORT["width"], VIEWPORT["height"])
n = entries(box, moves(page), start)
histograms[how][n] = histograms[how].get(n, 0) + 1
assert histograms["handle"] == histograms["selector"], "entries into the box -> actions: through a handle %r, through a selector %r" % (
dict(sorted(histograms["handle"].items())), dict(sorted(histograms["selector"].items())))
@pytest.mark.parametrize("kind", ["click", "dblclick", "hover", "tap", "check"])
def test_a_handle_action_draws_the_same_events_as_the_selector_action_of_the_name(kind):
"""One path, not two similar ones: same seed, same page, same box, the engine receives the same events at the same points."""
for seed in (4242, 9, 31):
by_selector = act("selector", kind, seed=seed)
by_handle = act("handle", kind, seed=seed)
assert by_handle.engine.log == by_selector.engine.log, "seed %d: %s differs between the handle and the selector" % (seed, kind)
# -- 3. what the handle's action must keep -----------------------------------------------------------------------------------------------------------
def test_the_walk_aims_at_the_handle_s_node_and_never_looks_a_selector_up_or_disposes_the_handle():
page = act("handle", "click")
assert len(moves(page)) > 1
assert page.injected.queried == [], "the handle's node is given; a selector was queried: %r" % page.injected.queried
assert page.injected.disposed == [], "the caller's handle was disposed: %r" % page.injected.disposed
assert set(page.injected.measured) == {HANDLE_ID}, page.injected.measured
# and the same handle acts again: it is still the caller's
page.handle.call("click", {"noWaitAfter": True})
assert page.injected.disposed == []
def test_a_selector_walk_still_disposes_its_own_probe():
page = act("selector", "click")
assert page.injected.disposed and set(page.injected.disposed) == {"resolved-from-the-selector"}
def test_a_position_the_caller_pinned_is_the_press_point_of_a_handle_too():
page = act("handle", "click", position={"x": 10.0, "y": 5.0})
assert presses(page) == [(410.0, 305.0)]
assert len(moves_before_the_press(page)) > 1, "the pinned point is where the press lands; the pointer still gets there by a path"
def test_a_trial_run_through_a_handle_moves_nothing():
page = act("handle", "click", trial=True)
assert page.engine.log == []
assert page.injected.disposed == []
def test_without_a_session_seed_a_handle_action_is_the_plain_action():
"""Humanising off keeps meaning no walk: the one event the action itself makes."""
page = build_page()
page.pointer = Pointer(page.actions, page.injected, 0, None, None, lambda: VIEWPORT)
assert not page.pointer.active
page.handle.call("click", {"noWaitAfter": True})
assert moves(page) == [CENTRE]
# -- 4. the audit: the keyboard and text actions of a handle are the selector's, argument for argument -----------------------------------------------
#: (wire method, the core `Actions` method both doors end in, the params of the request, the keyword arguments that name the target)
KEYBOARD_AND_TEXT = [
("fill", "fill", {"value": "v", "timeout": 4000, "force": True}),
("type", "type_text", {"text": "ab", "delay": 30, "timeout": 4000}),
("press", "press", {"key": "Enter", "delay": 20, "timeout": 4000, "noWaitAfter": True}),
("focus", "focus", {"timeout": 4000}),
("selectText", "select_text", {"timeout": 4000}),
]
@pytest.mark.parametrize("wire,method,params", KEYBOARD_AND_TEXT, ids=[k[0] for k in KEYBOARD_AND_TEXT])
def test_a_handle_s_keyboard_and_text_actions_reach_the_core_as_the_selector_s_do(wire, method, params):
"""The cadence of typing (the pause before the first key, the focus, the key delay) lives in the core's action, which both doors call: the audit's conclusion,
held. If a door grew a rhythm of its own, or dropped an argument, the two calls would differ here."""
page = build_page()
page.actions = Mock()
page.frame.call(wire, {"selector": "#b", **params})
page.handle.call(wire, dict(params))
by_selector, by_handle = getattr(page.actions, method).call_args_list
assert by_handle.args[1:] == by_selector.args[1:]
drop = {"frame_id", "element_id"}
assert {k: v for k, v in by_handle.kwargs.items() if k not in drop} == {k: v for k, v in by_selector.kwargs.items() if k not in drop}
assert by_handle.kwargs["element_id"] == HANDLE_ID and "element_id" not in by_selector.kwargs
@@ -0,0 +1,102 @@
"""In a real browser, a pointer action through an ElementHandle reaches the page the way the same action through a selector does: a path, and a landing point
that is not the exact centre of the box. ONE click path, one fingerprint.
The page is asked, which is the only reader that matters: it counts every `mousemove` before the press, and keeps the point of the press (`clientX`, `clientY`).
Before the fix a handle's click was one `mousemove` onto the exact centre of the element's box, a settle, and the press on that same point: count 1, point (400,
240) for the button below, in every install. The unit test (`test_a_handle_action_walks_like_a_selector_action`) holds what the engine is sent for each action;
this holds what the page hears. Each test is one browser, humanising on, closed at the end; the selector's control is on a second page of the same browser.
"""
from __future__ import annotations
import pytest
from _waits import wait_until
#: A button whose exact centre is (400, 240).
CENTRE = (400.0, 240.0)
PAGE = """<!doctype html><html><body style="margin:0">
<button id="b" style="position:absolute;left:300px;top:200px;width:200px;height:80px">b</button>
<script>
window.moves = 0; window.beforePress = null; window.down = null; window.up = null; window.clicks = 0; window.dblclicks = 0; window.over = 0;
document.addEventListener('mousemove', e => { window.moves++; window.last = [e.clientX, e.clientY]; });
const b = document.getElementById('b');
b.addEventListener('mouseover', () => window.over++);
b.addEventListener('mousedown', e => { if (window.down === null) { window.beforePress = window.moves; window.down = [e.clientX, e.clientY]; } });
b.addEventListener('click', e => { window.clicks++; });
b.addEventListener('dblclick', e => { window.dblclicks++; });
</script></body></html>"""
SEED = 4261
def _read(page):
return page.evaluate("({moves: window.moves, beforePress: window.beforePress, down: window.down, last: window.last || null, "
"clicks: window.clicks, dblclicks: window.dblclicks, over: window.over})")
def _fresh(browser):
page = browser.new_context().new_page()
page.set_content(PAGE)
return page
def _shape(seen, what):
"""The two things a jump to the centre cannot show: a path before the press, and a press that is not on the exact centre."""
assert seen["beforePress"] is not None, "%s: the page never saw a press: %r" % (what, seen)
assert seen["beforePress"] > 1, "%s: the page counted %d mousemove before the press (a jump, not a walk): %r" % (what, seen["beforePress"], seen)
assert tuple(seen["down"]) != CENTRE, "%s: the press landed on the exact centre of the box %r: %r" % (what, CENTRE, seen)
@pytest.mark.e2e
def test_a_handle_click_walks_and_lands_off_the_centre_like_a_selector_click(firefox_binary):
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=SEED, binary_path=firefox_binary, headless=True, humanize=True) as browser:
by_handle = _fresh(browser)
by_handle.query_selector("#b").click()
seen = _read(by_handle)
assert seen["clicks"] == 1, seen
_shape(seen, "ElementHandle.click")
by_selector = _fresh(browser)
by_selector.click("#b")
control = _read(by_selector)
assert control["clicks"] == 1, control
_shape(control, "page.click (the control)")
@pytest.mark.e2e
def test_a_handle_dblclick_walks_and_lands_off_the_centre_like_a_selector_dblclick(firefox_binary):
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=SEED, binary_path=firefox_binary, headless=True, humanize=True) as browser:
by_handle = _fresh(browser)
by_handle.query_selector("#b").dblclick()
seen = _read(by_handle)
assert seen["dblclicks"] == 1, seen
_shape(seen, "ElementHandle.dblclick")
by_selector = _fresh(browser)
by_selector.dblclick("#b")
control = _read(by_selector)
assert control["dblclicks"] == 1, control
_shape(control, "page.dblclick (the control)")
@pytest.mark.e2e
def test_a_handle_hover_walks_and_ends_off_the_centre_like_a_selector_hover(firefox_binary):
"""A hover has no press: its shape is the path the page counts and the point its last `mousemove` stops on."""
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=SEED, binary_path=firefox_binary, headless=True, humanize=True) as browser:
for how in ("handle", "selector"):
page = _fresh(browser)
if how == "handle":
page.query_selector("#b").hover()
else:
page.hover("#b")
assert wait_until(lambda: _read(page)["over"] >= 1, 30, lambda: page.wait_for_timeout(50)), _read(page)
seen = _read(page)
assert seen["moves"] > 1, "%s hover: the page counted %d mousemove (a jump, not a walk): %r" % (how, seen["moves"], seen)
assert tuple(seen["last"]) != CENTRE, "%s hover ended on the exact centre of the box: %r" % (how, seen)
@@ -0,0 +1,274 @@
"""A Marionette session is asked for only after the launch has a window: the twins no longer wait 300 s for an answer that cannot come.
The wrapper launches the engine with ``-silent``: there is no window at start-up. Marionette's ``WebDriver:NewSession`` waits for the end of the browser's start-up, which only a window ends,
so a test that asked for the session before its first ``new_page()`` never got its answer and the socket gave up after 300 s (the twins ``run_retail_twin`` and ``_on_ours``: every
stock twin and every retail twin of the engine candidate, both systems). Two checks, no browser:
1. The order is written in the signature and the call sites. ``Chrome`` takes the page of the launch as a required argument, and a scan of every test and script (ast) refuses a function that
makes a session (``_Marionette(...)``, ``marionette_active_port(...)``, ``WebDriver:NewSession``, or a helper or class that does, found by name across the files) before the
first ``new_page()`` of the same function, or a ``Popen`` that opens ``about:blank``. A helper that opens no window of its own is checked at its callers.
2. The behaviour, on a Marionette that answers ``NewSession`` only once a window exists, as the engine does: ``_on_ours`` and ``run_retail_twin`` get their answer, and the same fake
times out for a session asked first.
Known-bad input: ``chrome = Chrome()`` before ``browser.new_page()`` (both twins, the old files), and the synthetic old order below. Green: the page first, then ``Chrome(page)``.
"""
from __future__ import annotations
import ast
import contextlib
import inspect
import pathlib
from typing import Dict, List, Optional, Set, Tuple
import pytest
import _retail_reference
import _stock_twin
import webfont_probe
pytestmark = pytest.mark.unit
HERE = pathlib.Path(__file__).resolve().parent
ROOT = HERE.parent
NEW_SESSION = "WebDriver:NewSession"
#: The names that open a Marionette connection; a function that calls one is a session helper or a launcher with a session, and the names it carries join the set.
PRIMITIVES = {"_Marionette", "marionette_active_port"}
#: What starts a browser: a function that calls one of these is a launcher, and every session it asks for needs a window before it.
LAUNCHERS = {"InvisiblePlaywright", "launch_case", "launch", "Popen"}
def _name(call: ast.Call) -> Optional[str]:
target = call.func
return target.id if isinstance(target, ast.Name) else target.attr if isinstance(target, ast.Attribute) else None
def _own_calls(function: ast.AST) -> List[ast.Call]:
"""The calls in the body of ``function`` itself, not in a function, lambda or class defined inside it."""
calls: List[ast.Call] = []
stack = list(function.body)
while stack:
node = stack.pop()
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef, ast.Lambda, ast.ClassDef)):
continue
if isinstance(node, ast.Call):
calls.append(node)
stack.extend(ast.iter_child_nodes(node))
return calls
def _opens_a_window(call: ast.Call) -> bool:
if _name(call) == "new_page":
return True
if _name(call) == "Popen":
return any(isinstance(x, ast.Constant) and x.value == "about:blank" for arg in call.args for x in ast.walk(arg))
return False
def _functions(tree: ast.AST) -> List[Tuple[ast.AST, Optional[str]]]:
"""Every function with the class it is a method of (None for the others), nested ones too."""
found: List[Tuple[ast.AST, Optional[str]]] = []
def visit(node: ast.AST, owner: Optional[str]) -> None:
for child in ast.iter_child_nodes(node):
if isinstance(child, (ast.FunctionDef, ast.AsyncFunctionDef)):
found.append((child, owner))
visit(child, None)
elif isinstance(child, ast.ClassDef):
visit(child, child.name)
else:
visit(child, owner)
visit(tree, None)
return found
def sessions_before_a_window(sources: Dict[str, str]) -> List[str]:
"""Where a session is asked for before the first window of its function: one line per place, ``file:line``, what and how to correct it."""
functions = [(path, function, owner, _own_calls(function)) for path, source in sources.items() for function, owner in _functions(ast.parse(source))]
creators: Set[str] = set(PRIMITIVES)
def asks(call: ast.Call) -> bool:
return _name(call) in creators or (bool(call.args) and isinstance(call.args[0], ast.Constant) and call.args[0].value == NEW_SESSION)
helpers: Set[int] = set()
grew = True
while grew:
grew = False
for index, (_, function, owner, calls) in enumerate(functions):
if index in helpers or not any(asks(c) for c in calls):
continue
if not any(_opens_a_window(c) or _name(c) in LAUNCHERS for c in calls):
helpers.add(index)
creators.add(owner if function.name == "__init__" and owner else function.name)
grew = True
out: List[str] = []
for index, (path, function, _, calls) in enumerate(functions):
if index in helpers:
continue
windows = [(c.lineno, c.col_offset) for c in calls if _opens_a_window(c)]
for call in calls:
if asks(call) and not any(at < (call.lineno, call.col_offset) for at in windows):
out.append("%s:%d: %s asks for a Marionette session before any page of %s() is open (NewSession is answered only once a window exists, and the wrapper launches "
"with -silent: the socket times out after 300 s); open the page first (page = browser.new_page()), then ask for the session" % (path, call.lineno, _name(call) or NEW_SESSION, function.name))
return out
def _sources() -> Dict[str, str]:
files: Dict[str, str] = {}
for folder in ("tests", "scripts"):
for path in sorted((ROOT / folder).rglob("*.py")):
if "vendor" in path.parts or "__pycache__" in path.parts:
continue
files[path.relative_to(ROOT).as_posix()] = path.read_text(encoding="utf-8")
return files
def test_no_test_or_script_asks_for_a_session_before_its_first_page():
found = sessions_before_a_window(_sources())
assert not found, "\n".join(found)
OLD_ORDER = """
def run(firefox_binary, case):
with launch_case(firefox_binary, case) as browser:
chrome = Chrome()
return measure(browser.new_page(), chrome)
"""
OLD_ORDER_THROUGH_A_HELPER = """
def open_chrome(port):
m = _Marionette(port)
m.call("WebDriver:NewSession", {})
return m
def test_it(firefox_binary):
with InvisiblePlaywright(binary_path=firefox_binary) as browser:
m = open_chrome(1)
browser.new_page()
"""
OLD_ORDER_RAW = """
def test_it(firefox_binary):
with InvisiblePlaywright(binary_path=firefox_binary) as browser:
m = _Marionette(marionette_active_port())
m.call("WebDriver:NewSession", {})
page = browser.new_page()
"""
NEW_ORDER = """
class Chrome:
def __init__(self, page):
self._m = _Marionette(marionette_active_port())
def run(firefox_binary, case):
with launch_case(firefox_binary, case) as browser:
page = browser.new_page()
chrome = Chrome(page)
return measure(page, chrome)
def retail():
process = subprocess.Popen([exe, "-no-remote", "about:blank"])
m = _Marionette(marionette_active_port())
m.call("WebDriver:NewSession", {})
"""
@pytest.mark.parametrize("source", [OLD_ORDER, OLD_ORDER_THROUGH_A_HELPER, OLD_ORDER_RAW], ids=["class", "helper", "raw"])
def test_the_scan_sees_the_old_order(source):
sources = {"synthetic.py": source + "\nclass Chrome:\n def __init__(self):\n self._m = _Marionette(marionette_active_port())\n"}
assert sessions_before_a_window(sources), "the scan does not see a session asked for before the first page:\n" + source
def test_the_scan_lets_the_page_first_through():
assert sessions_before_a_window({"synthetic.py": NEW_ORDER}) == []
def test_chrome_takes_the_page_and_nothing_makes_it_without():
parameters = list(inspect.signature(_stock_twin.Chrome).parameters.values())
assert [p.name for p in parameters] == ["page"] and parameters[0].default is inspect.Parameter.empty, (
"Chrome must take the page of the launch as its one required argument (found %r): without it the session can be asked before the window exists" % (parameters,))
with pytest.raises(TypeError):
_stock_twin.Chrome(None)
# ----------------------------------------------------------------------------------------------------------- the behaviour, on a Marionette that waits for a window
class World:
"""The engine started with ``-silent``: no window until a page is opened. ``NewSession`` is answered then, and times out as the socket does before it."""
def __init__(self) -> None:
self.window = False
self.sessions = 0
@pytest.fixture
def world(monkeypatch):
state = World()
class FakeMarionette:
def __init__(self, port, timeout=120.0):
self.closed = False
def call(self, name, params=None):
if name == NEW_SESSION:
if not state.window:
raise TimeoutError("timed out: no answer to WebDriver:NewSession (the engine has no window)")
state.sessions += 1
return {"value": "{}"}
def close(self):
self.closed = True
class FakePage:
def evaluate(self, expression):
return {}
class FakeBrowser:
def new_page(self):
state.window = True
return FakePage()
@contextlib.contextmanager
def launch_case(binary, case, **kwargs):
state.window = False
yield FakeBrowser()
monkeypatch.setattr(webfont_probe, "_Marionette", FakeMarionette)
monkeypatch.setattr(webfont_probe, "marionette_active_port", lambda *a, **k: 1)
monkeypatch.setattr(_stock_twin, "launch_case", launch_case)
monkeypatch.setattr(_retail_reference, "launch_case", launch_case)
return state
def test_the_fake_engine_does_not_answer_a_session_asked_before_its_first_page(world):
marionette = webfont_probe._Marionette(webfont_probe.marionette_active_port())
with pytest.raises(TimeoutError):
marionette.call(NEW_SESSION, {"capabilities": {"alwaysMatch": {}}})
def test_ours_gets_the_answer_of_its_session_in_a_twin(world):
record = _stock_twin._on_ours("1920x1080-dpr1.0", "not-launched", lambda page, chrome: {"scales": chrome.scales()})
assert world.sessions == 1
assert record["scales"]["page"] == {}
def test_ours_gets_the_answer_of_its_session_in_a_retail_twin(world, monkeypatch):
scales = {"scales": {"chrome_outer": [800, 600], "chrome_inner": [790, 500]}}
class FakeRetail:
def __init__(self, executable, dpr):
pass
def __enter__(self):
return self
def __exit__(self, *exc):
return False
def set_inner_size(self, inner):
return {"outer": [800, 600], "inner": [790, 500], "asked_outer": [800, 600]}
monkeypatch.setattr(_retail_reference, "retail_executable", lambda: "retail")
monkeypatch.setattr(_retail_reference, "RetailSession", FakeRetail)
monkeypatch.setattr(_retail_reference, "RetailDriver", lambda session: object())
retail, ours = _retail_reference.run_retail_twin("1920x1080-dpr1.0", "not-launched", lambda driver: {"scales": dict(scales["scales"])})
assert world.sessions == 1
assert ours["scales"]["chrome_outer"] == [800, 600] and retail["scales"]["window_asked_outer"] == [800, 600]
@@ -3,9 +3,9 @@
`new Worker("chrome://<name>/...")` returns for a chrome package the browser
registers and throws SecurityError at once for one it does not: the parent sends
every registered package to each content process. Every engine until firefox-47
registered `juggler`, and captcha vendors probed it from 2026-10-06 (hCaptcha's
hsw.js runs `new Worker("chrome://juggler/content/content/WorkerMain.js")`,
camoufox #847): a challenge solved by hand was refused on our engine while
registered `juggler`, and captcha vendors probed it from 2026-10-06 (the script of a
captcha vendor runs `new Worker("chrome://juggler/content/content/WorkerMain.js")`,
reported on another project's tracker): a challenge solved by hand was refused on our engine while
retail Firefox passed. Measured from a page on firefox-46 and on retail Firefox
151 under geckodriver, 2026-10-14: of the 65 chrome packages and resource
substitutions the engine registers, `juggler` was the one retail does not; retail
@@ -0,0 +1,406 @@
"""A page function that the client's call reaches sees only the page's own frames: no eval code, no debugger code, no function of the client.
A page can read `new Error().stack` and `fn.caller` inside any function of its own. When the client runs `page.evaluate("() => probe()")` the page function is called by
a function the automation compiled, and a page that looks sees it: an `eval code` / `debugger eval code` line below its own frame and a `probe.caller` that is the
client's function. Retail Firefox, where the page is called by an extension content script or by the browser itself, shows page frames only and `caller` is null
(a function called from native code or from privileged code has no content caller).
Ten cases, each says what it saw in its message:
1. `page.evaluate("() => probe()")`: every line of the stack names the page's script (`name@URL:line:col`), the first one is `probe`, and `probe.caller` is null;
2. `page.evaluate("() => a()")` with `a` calling `b` calling `probe`: exactly three lines, `probe`, `b`, `a`, in this order, and nothing else (`probe.caller` is the page's own `b`);
3. `page.evaluate("() => { setTimeout(probe2, 0) }")`: the stack of the timer callback is read later from `window.__timer`: one page frame, `probe2`, and a null caller;
4. a click listener of the page records its stack and `arguments.callee.caller`, the client does `page.click('#btn')`: the listener is the only frame and the caller is null;
5. `page.evaluate("() => { throw new Error('x') }")` still raises in the client, with the message;
6. the atoms (`Page.elementAtom`, `isElementDisplayed` and `getVisibleText`, sent raw: no client call reaches them) run in the engine's own sandbox over Xrays: the page wrapped
`getClientRects`, `getBoundingClientRect`, `checkVisibility`, `getComputedStyle`, the `innerText` and `textContent` getters, and each wrapper was either never called (the
expectation, through Xrays) or, if called, saw only page frames and a null caller;
7. a `securitypolicyviolation` the client's evaluate causes (an image under `img-src 'none'`) reports a `sourceFile` that is not a location of the client's world;
8. an uncaught error thrown by a listener the client's evaluate registered, triggered by the page itself (its own listener, run when the test clicks a trigger button), reaches `window.onerror` with a file, line, column and stack
that name no location of the client's world.
9. the same as 8 with `throw 5` (not an Error): file, line and column told to `window.onerror` name no location of the client's world;
10. `import()` called by the client's evaluate asks the server for the module like the page's own `import()` of an inline script does: the same path base and the same Referer, none of them a
location of the client's world (the server records the path and the Referer of every request of the module).
Cases 7 to 10 each have a control that the page makes itself (a violation, a throwing listener), which must name the page's own script: it proves the page's record works.
What stock gives for 7 to 10 is not known from a measurement (no browser runs here): the expectation asserted is the one that holds on any engine that hides its world, "not a
location of the world", and the message says what was seen, so a first run shows the stock value.
WHAT STOCK GIVES, and how it is derived (nothing was measured here: no browser runs on this machine). In Firefox the stack of an `Error` is the chain of JS frames of the
current JS stack that the reader may see, and `Function.prototype.caller` is the JS function below on that same stack, null when the one below is native or privileged.
A timer callback (case 3) and an event listener of a trusted event (case 4) are called by the event loop and by the event dispatch, which are native: the listener or the
callback is the BOTTOM of the JS stack, so one line and a null caller. Playwright's own click on stock Firefox is a protocol `Input.dispatchMouseEvent`, which reaches the
page as a native event and runs no function of the page's world, so the listener is alone. A page function called by the client's `evaluate` (cases 1 and 2) is the bottom of
the page's chain when the call comes from privileged code: stock's evaluate runs the function in the page's world through the browser's own call, so `probe` is the bottom of
the stack in case 1 and `a` in case 2. The two readings that differ from these are exactly what the cases catch: an extra line that is not the script of the page, or a caller.
"""
from __future__ import annotations
import re
import threading
from http.server import BaseHTTPRequestHandler
from types import SimpleNamespace
import pytest
from _servers import LocalServer
from _waits import wait_until
pytestmark = pytest.mark.e2e
#: Far beyond what a healthy run needs; it is the only clock the verdict depends on.
DEADLINE = 30.0
PAGE = b"""<!doctype html><title>frames</title><button id="btn">go</button><script src="/page.js"></script>"""
SCRIPT = b"""function probe() {
return {stack: new Error().stack,
caller: probe.caller === null ? null : typeof probe.caller,
callerSrc: probe.caller ? String(probe.caller).slice(0, 80) : null};
}
function a() { return b(); }
function b() { return probe(); }
function probe2() {
window.__timer = {stack: new Error().stack, caller: probe2.caller === null ? null : typeof probe2.caller};
}
document.getElementById('btn').addEventListener('click', function listener() {
var caller = arguments.callee.caller;
window.__click = {stack: new Error().stack, caller: caller === null ? null : typeof caller};
});
"""
#: The page of the atoms: a visible element and a hidden one, and a script that wraps what the atoms (Marionette's `isElementDisplayed` and `getVisibleText`) could read
#: of the page's elements: the methods `getClientRects`, `getBoundingClientRect`, `checkVisibility` of Element, `getComputedStyle` of the window, and the getters
#: `innerText` of HTMLElement and `textContent` of Node. Each wrapper counts the call and records `new Error().stack` and the type of its own `caller`; the page calls
#: each one once itself at load (the control: a count of 1 proves the wrapper runs when something calls it).
ATOMS_PAGE = b"""<!doctype html><title>atoms</title><p id="shown">hello visible world</p><p id="none" style="display:none">secret</p><script src="/atoms.js"></script>"""
ATOMS_SCRIPT = b"""window.__calls = {}; window.__seen = {}; window.__wrapped = [];
function record(key, stack, caller) {
window.__calls[key] = (window.__calls[key] || 0) + 1;
(window.__seen[key] = window.__seen[key] || []).push({stack: stack, caller: caller});
}
function wrapMethod(owner, name) {
if (typeof owner[name] !== 'function') return;
var orig = owner[name];
var w = function w() { record(name, new Error().stack, w.caller === null ? null : typeof w.caller); return orig.apply(this, arguments); };
Object.defineProperty(owner, name, {value: w, writable: true, configurable: true});
window.__wrapped.push(name);
}
function wrapGetter(owner, name) {
var d = Object.getOwnPropertyDescriptor(owner, name);
if (!d || !d.get) return;
var g = function g() { record(name, new Error().stack, g.caller === null ? null : typeof g.caller); return d.get.call(this); };
Object.defineProperty(owner, name, {get: g, set: d.set, configurable: true});
window.__wrapped.push(name);
}
wrapMethod(Element.prototype, 'getClientRects');
wrapMethod(Element.prototype, 'getBoundingClientRect');
wrapMethod(Element.prototype, 'checkVisibility');
wrapMethod(window, 'getComputedStyle');
wrapGetter(HTMLElement.prototype, 'innerText');
wrapGetter(Node.prototype, 'textContent');
window.__reset = function () { window.__calls = {}; window.__seen = {}; };
var el = document.getElementById('shown');
el.getClientRects(); el.getBoundingClientRect(); if (el.checkVisibility) el.checkVisibility();
getComputedStyle(el); void el.innerText; void el.textContent;
"""
#: Case 7: a page under `img-src 'none'` that records every `securitypolicyviolation` (file, line, column, what was blocked); the page causes one itself at load (the control).
CSP_PAGE = b"""<!doctype html><title>csp</title><body><script src="/csp.js"></script>"""
CSP_SCRIPT = b"""window.__violations = [];
document.addEventListener('securitypolicyviolation', function (e) {
window.__violations.push({file: e.sourceFile, line: e.lineNumber, column: e.columnNumber, blocked: e.blockedURI});
});
var img = document.createElement('img'); img.src = '/by-the-page.png'; document.body.appendChild(img);
"""
#: Case 8: a page whose `window.onerror` records what it is told; a listener of the page on #c that throws (the control), a button #b for the client's listener, and
#: `fire`, which the page itself runs when the test clicks a trigger button (#go-b, #go-c, #go-d): the page's own listener of the trigger clicks the target.
OE_PAGE = b"""<!doctype html><title>oe</title><button id="b">b</button><button id="c">c</button><button id="d">d</button><button id="go-b">go-b</button><button id="go-c">go-c</button><button id="go-d">go-d</button><script src="/oe.js"></script>"""
OE_SCRIPT = b"""window.__oe = null;
window.onerror = function (msg, file, line, col, err) { window.__oe = {msg: String(msg), file: file, line: line, col: col, stack: err && err.stack}; };
document.getElementById('c').addEventListener('click', function () { throw new Error('page-made'); });
document.getElementById('d').addEventListener('click', function () { throw 5; });
function fire(id) { document.getElementById(id).click(); }
['b', 'c', 'd'].forEach(function (id) { document.getElementById('go-' + id).addEventListener('click', function () { fire(id); }); });
"""
#: What identifies the client's world in anything a page reads: the code of an evaluate, the debugger's code, the engine's own URLs.
WORLD_MARKERS = ("debugger eval", "eval code", "eval", "chrome://", "resource://", "moz-extension://", "juggler", "about:", "createElement('img')", "=>")
def _world_marks(text):
return [m for m in WORLD_MARKERS if m in (text or "")]
#: Case 10: a page whose own inline script imports a module at load (the control); the server records the path and the Referer of every request of `/mod.js`.
#: The control is an INLINE classic script of the document: a dynamic import() takes its referrer and base from the script that runs it, so the inline one has the document's URL
#: as the evaluate's import has. `/imp.js` makes a second import (`from=file`), informational only: its referrer is the script file, and nothing is compared with it.
IMP_PAGE = b"""<!doctype html><title>imp</title><script>window.__imported = import('/mod.js?from=page').then(function (m) { return m.default; });</script><script src="/imp.js"></script>"""
IMP_SCRIPT = b"""window.__file = import('/mod.js?from=file').then(function (m) { return m.default; });"""
MOD_SCRIPT = b"export default 1;"
class _Handler(BaseHTTPRequestHandler):
def log_message(self, *a):
pass
def do_GET(self):
path = self.path.split("?", 1)[0]
if path == "/mod.js":
self.server.requests.append((self.path, self.headers.get("Referer")))
body, kind = {
"/imp": (IMP_PAGE, "text/html; charset=utf-8"),
"/imp.js": (IMP_SCRIPT, "application/javascript"),
"/mod.js": (MOD_SCRIPT, "application/javascript"),
"/csp": (CSP_PAGE, "text/html; charset=utf-8"),
"/csp.js": (CSP_SCRIPT, "application/javascript"),
"/oe": (OE_PAGE, "text/html; charset=utf-8"),
"/oe.js": (OE_SCRIPT, "application/javascript"),
"/page.js": (SCRIPT, "application/javascript"),
"/atoms": (ATOMS_PAGE, "text/html; charset=utf-8"),
"/atoms.js": (ATOMS_SCRIPT, "application/javascript"),
}.get(path, (PAGE, "text/html; charset=utf-8"))
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")
if path == "/csp":
self.send_header("Content-Security-Policy", "img-src 'none'")
self.end_headers()
self.wfile.write(body)
@pytest.fixture(scope="module")
def site():
srv = LocalServer(("127.0.0.1", 0), _Handler)
srv.requests = []
threading.Thread(target=srv.serve_forever, daemon=True).start()
try:
yield SimpleNamespace(url="http://127.0.0.1:%d/" % srv.server_address[1], requests=srv.requests)
finally:
srv.shutdown()
srv.server_close()
@pytest.fixture(scope="module")
def invisible(firefox_binary):
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=4275, binary_path=firefox_binary, headless=True) as b:
yield b
@pytest.fixture
def page(invisible, site):
context = invisible.new_context()
page = context.new_page()
page.goto(site.url, wait_until="load")
try:
yield page
finally:
context.close()
def _frames(stack):
return [line for line in stack.splitlines() if line.strip()]
def _names(stack, site):
"""The function names of a stack whose every line is `name@<script of the page>:line:col`; a line that is anything else comes back as itself, so the assertion shows it."""
pattern = re.compile(r"([^@\s]*)@" + re.escape(site.url + "page.js") + r":\d+:\d+")
names = []
for line in _frames(stack):
found = pattern.fullmatch(line)
names.append(found.group(1) if found else "NOT A FRAME OF THE PAGE'S SCRIPT: %r" % line)
return names
def test_a_function_called_by_evaluate_sees_only_its_own_frame_and_no_caller(page, site):
seen = page.evaluate("() => probe()")
assert _names(seen["stack"], site) == ["probe"], "the page's function called by evaluate saw this stack: %r" % seen["stack"]
assert seen["caller"] is None, "the page's function called by evaluate saw a caller of type %r: %r" % (seen["caller"], seen["callerSrc"])
def test_a_chain_of_page_functions_called_by_evaluate_shows_exactly_the_three_page_frames(page, site):
seen = page.evaluate("() => a()")
assert _names(seen["stack"], site) == ["probe", "b", "a"], "the chain a, b, probe called by evaluate saw this stack: %r" % seen["stack"]
assert seen["caller"] == "function" and (seen["callerSrc"] or "").startswith("function b"), (
"probe.caller in the chain was %r, %r (expected the page's own b)" % (seen["caller"], seen["callerSrc"]))
def test_a_timer_callback_the_client_started_has_only_its_own_frame_and_no_caller(page, site):
page.evaluate("() => { setTimeout(probe2, 0); }")
# The client is a sync one: events are delivered while it calls the browser, so the wait is a call.
seen = {}
def read():
seen["timer"] = page.evaluate("() => window.__timer || null")
return seen["timer"]
assert wait_until(read, DEADLINE, lambda: page.wait_for_timeout(50)), "the timer callback of the page never ran (after %.0f s)" % DEADLINE
timer = seen["timer"]
assert _names(timer["stack"], site) == ["probe2"], "the timer callback saw this stack: %r" % timer["stack"]
assert timer["caller"] is None, "the timer callback saw a caller of type %r" % timer["caller"]
def test_a_click_listener_of_the_page_has_only_its_own_frame_and_no_caller_when_the_client_clicks(page, site):
page.click("#btn")
seen = {}
def read():
seen["click"] = page.evaluate("() => window.__click || null")
return seen["click"]
assert wait_until(read, DEADLINE, lambda: page.wait_for_timeout(50)), "the click listener of the page never ran (after %.0f s)" % DEADLINE
click = seen["click"]
assert _names(click["stack"], site) == ["listener"], "the click listener saw this stack: %r" % click["stack"]
assert click["caller"] is None, "the click listener saw a caller of type %r" % click["caller"]
def test_an_error_thrown_by_an_evaluate_still_reaches_the_client_with_its_message(page):
from invisible_playwright.sync_api import Error
with pytest.raises(Error) as raised:
page.evaluate("() => { throw new Error('x') }")
assert "x" in str(raised.value), "the client raised %r for a thrown Error('x'): the message is lost" % str(raised.value)
def _raw_atom(page, handle, atom):
"""What `Page.elementAtom` answers for the element of `handle`, sent on the in-process connection of the page's session as tests/test_page_element_atoms_run_in_a_sandbox_e2e.py does."""
impl = handle._impl_obj
server = impl._connection._transport._server
element = server.object(impl._guid)
injected = server.object(page._impl_obj._guid).injected
return injected.c.send(
"Page.elementAtom",
{"frameId": element.frame.frame_id, "objectId": element.object_id, "atom": atom},
session=injected.session, timeout=None)["result"]
def test_the_atoms_call_nothing_of_the_page_or_are_seen_with_page_frames_only(invisible, site):
context = invisible.new_context()
try:
page = context.new_page()
page.goto(site.url + "atoms", wait_until="load")
handles = [page.query_selector("#shown"), page.query_selector("#none")]
control = page.evaluate("() => ({calls: {...window.__calls}, wrapped: window.__wrapped})")
wrong = {key: control["calls"].get(key) for key in control["wrapped"] if control["calls"].get(key) != 1}
assert control["wrapped"] and not wrong, "the page's own call of each wrapper did not count 1 (the wrappers do not work as the test needs): %r of %r" % (wrong, control["wrapped"])
page.evaluate("() => window.__reset()")
for handle in handles:
for atom in ("isElementDisplayed", "getVisibleText"):
_raw_atom(page, handle, atom)
after = page.evaluate("() => ({calls: window.__calls, seen: window.__seen})")
finally:
context.close()
pattern = re.compile(r"[^@\s]*@" + re.escape(site.url + "atoms.js") + r":\d+:\d+")
bad = []
for key, entries in after["seen"].items():
for entry in entries:
lines = _frames(entry["stack"])
if not lines or not all(pattern.fullmatch(line) for line in lines) or entry["caller"] is not None:
bad.append("%s: stack %r, caller %r" % (key, entry["stack"], entry["caller"]))
assert not bad, "the atoms called %r of the page's wrappers (call counts), and these calls saw more than page frames or a caller: %s" % (after["calls"], "; ".join(bad))
def test_a_violation_the_clients_evaluate_causes_does_not_name_a_location_of_the_clients_world(invisible, site):
context = invisible.new_context()
try:
page = context.new_page()
page.goto(site.url + "csp", wait_until="load")
def violations():
return page.evaluate("() => window.__violations.slice()")
assert wait_until(lambda: len(violations()) >= 1, DEADLINE, lambda: page.wait_for_timeout(50)), (
"the violation the page itself causes was never recorded (after %.0f s)" % DEADLINE)
control = violations()[0]
assert control["file"].endswith("/csp.js"), "the control (a violation caused by the page's own script) reported the file %r, not the page's script" % control["file"]
page.evaluate("() => { const i = document.createElement('img'); i.src = '/by-evaluate.png'; document.body.appendChild(i); }")
assert wait_until(lambda: len(violations()) >= 2, DEADLINE, lambda: page.wait_for_timeout(50)), (
"the violation the client's evaluate causes was never recorded (after %.0f s): %r" % (DEADLINE, violations()))
seen = violations()[1]
finally:
context.close()
assert "by-evaluate" in seen["blocked"], "the second violation was not the evaluate's: %r" % seen
marks = _world_marks(seen["file"])
assert not marks, "the violation caused by the client's evaluate reported sourceFile %r (line %r, column %r), which names the client's world (%r)" % (
seen["file"], seen["line"], seen["column"], marks)
def test_an_error_thrown_by_a_listener_the_clients_evaluate_registered_names_no_location_of_the_clients_world(invisible, site):
context = invisible.new_context()
try:
page = context.new_page()
page.goto(site.url + "oe", wait_until="load")
def heard():
return page.evaluate("() => window.__oe")
# the control: a listener the page made throws, the page's onerror names the page's script
page.click("#go-c")
assert wait_until(heard, DEADLINE, lambda: page.wait_for_timeout(50)), "the page's own throwing listener never reached window.onerror (after %.0f s)" % DEADLINE
control = heard()
assert str(control["file"]).endswith("/oe.js"), "the control (a listener made by the page) reported the file %r, not the page's script: %r" % (control["file"], control)
page.evaluate("() => { window.__oe = null; }")
# the listener is made IN the evaluate; the test clicks the trigger, and the PAGE (its own function `fire`, run by its own listener of the trigger) clicks the button
page.evaluate("() => { document.getElementById('b').addEventListener('click', () => { throw new Error('w'); }); }")
page.click("#go-b")
assert wait_until(heard, DEADLINE, lambda: page.wait_for_timeout(50)), (
"the error thrown by the listener of the client's evaluate never reached window.onerror (after %.0f s)" % DEADLINE)
seen = heard()
finally:
context.close()
marks = {name: _world_marks(str(seen[name])) for name in ("file", "stack")}
assert not any(marks.values()), "window.onerror was told file %r, line %r, column %r, stack %r for the error of the evaluate's listener: it names the client's world (%r)" % (
seen["file"], seen["line"], seen["col"], seen["stack"], marks)
def test_a_non_error_thrown_by_a_listener_the_clients_evaluate_registered_names_no_location_of_the_clients_world(invisible, site):
context = invisible.new_context()
try:
page = context.new_page()
page.goto(site.url + "oe", wait_until="load")
def heard():
return page.evaluate("() => window.__oe")
# the control: a listener the page made does `throw 5`, the page's onerror names the page's script
page.click("#go-d")
assert wait_until(heard, DEADLINE, lambda: page.wait_for_timeout(50)), "the page's own `throw 5` never reached window.onerror (after %.0f s)" % DEADLINE
control = heard()
assert str(control["file"]).endswith("/oe.js"), "the control (`throw 5` in a listener made by the page) reported the file %r, not the page's script: %r" % (control["file"], control)
page.evaluate("() => { window.__oe = null; }")
page.evaluate("() => { document.getElementById('b').addEventListener('click', () => { throw 5; }); }")
page.click("#go-b")
assert wait_until(heard, DEADLINE, lambda: page.wait_for_timeout(50)), (
"the `throw 5` of the listener of the client's evaluate never reached window.onerror (after %.0f s)" % DEADLINE)
seen = heard()
finally:
context.close()
marks = _world_marks(str(seen["file"]))
assert not marks, "window.onerror was told file %r, line %r, column %r (message %r) for the `throw 5` of the evaluate's listener: it names the client's world (%r)" % (
seen["file"], seen["line"], seen["col"], seen["msg"], marks)
def test_an_import_called_by_the_clients_evaluate_asks_for_the_module_as_the_pages_own_import_does(invisible, site):
context = invisible.new_context()
try:
page = context.new_page()
page.goto(site.url + "imp", wait_until="load")
assert page.evaluate("() => window.__imported") == 1, "the page's own import() did not give the module"
assert page.evaluate("() => window.__file") == 1, "the import() of the page's script file did not give the module"
# `.then` only so that the answer is a number the client can carry (a module namespace is not serializable); the request is the import's
assert page.evaluate("() => import('/mod.js?from=world').then(m => m.default)") == 1, "the import() of the client's evaluate did not give the module"
finally:
context.close()
asked = dict(site.requests)
assert "/mod.js?from=page" in asked and "/mod.js?from=world" in asked, "the server heard these requests of the module (path, Referer): %r" % site.requests
page_referer, world_referer = asked["/mod.js?from=page"], asked["/mod.js?from=world"]
assert world_referer == page_referer, "the import() of the client's evaluate came with the Referer %r, the page's own import() with %r (the import() of the script file had %r; requests: %r)" % (
world_referer, page_referer, asked.get("/mod.js?from=file"), site.requests)
for who, referer in (("page", page_referer), ("world", world_referer)):
assert not _world_marks(referer), "the Referer of the %s's import() is %r, which names the client's world (%r)" % (who, referer, _world_marks(referer))
@@ -0,0 +1,150 @@
"""With `headless=True` a page sees no pointer or mouse event until the test's own first input.
What it proves: the engine runs on the core's own hidden display (an Xvfb on Linux, a private desktop on Windows), and
the host pointer is not part of it. A page that listens from the first line of its `<head>` hears nothing at all with no
input: no `pointerover`, `pointerenter`, `mouseover` or `mouseenter` at the centre of the screen, no move, no wheel. The
first thing it hears is what the test's own `page.mouse.move` makes, at the point the test asked for, trusted.
Why it matters: an event the page hears before any input is an input nobody made. A real user's page gets its first
`mouseover` when the pointer enters it, at the place the pointer is, never at the centre of the screen on its birth. The
pointer of the host is the one thing the hidden display must not give the page: whatever the machine's cursor is doing
(the runner's, a person's at their desk) is not something a page may read.
Measured on the published engine (run 46840604601 of this repository): every page on Linux got a trusted
`pointerover`, `pointerenter`, `mouseover` and `mouseenter` at the centre of the screen with no input at all, 42 to 160 ms
after its birth, and Windows got none. The engine makes its window ignore the host pointer on that display, on both systems.
How the proof is made, with no clock. What must not happen is an event that arrives on its own, and "nothing arrived in
some time" would judge the machine. So the proof is an outcome: after `TURNS` frames of the page (a count of the page's own
`requestAnimationFrame` turns, never a time) the test makes ONE input, a `page.mouse.move` to a point that is not the centre
of the screen, and waits until the page has recorded it. The page must then have recorded, as its very first pointer or
mouse event, the one that move made: an over, an enter or a move at that point, trusted. A crossing made by the host pointer
is synthesized on layout and paint, within the first frames of a page, so it lands before the move and is the first event
the page recorded: the test is red on it, with the event in the message.
Two tests, one launch each, on Linux and on Windows:
* the first input, in three situations: the page the test serves on 127.0.0.1 (first document of its tab); a page that
stood on `about:blank` (the recorder is put there by the test); and a page that stood on `about:blank` for its frames with
no input and was then navigated to the served page. In each, the sentinel move is the first event recorded;
* the first input in full: on the served page, the move is the first event, and every event of it is trusted, at (x, y) in
client coordinates, and of a kind a move alone makes.
The listeners are on `window` in the capture phase (a `mouseenter` does not bubble) and on `document`. The humaniser is off:
the move is one move, not a stroke from somewhere else.
"""
from __future__ import annotations
import pytest
from _fission_frames import Sites
pytestmark = pytest.mark.e2e
#: Every pointer and mouse event a page can be given by a pointer that moves, presses or wheels.
TYPES = ["pointerover", "pointerout", "pointerenter", "pointerleave", "pointermove", "pointerdown", "pointerup",
"mouseover", "mouseout", "mouseenter", "mouseleave", "mousemove", "mousedown", "mouseup", "click", "wheel",
"contextmenu"]
#: Frames of the page (its own `requestAnimationFrame` turns) before the sentinel move is made (see the docstring).
TURNS = 30
#: Where the moves go: inside the default viewport, and not at its centre. One per situation of the first test.
X, Y = 211, 137
POINTS = [(211, 137), (173, 251), (329, 97)]
FIRST_KINDS = ("pointerover", "pointerenter", "mouseover", "mouseenter", "pointermove", "mousemove")
#: The recorder: the page runs it from the first line of its `<head>`, and the test runs it on `about:blank`.
RECORDER = """
window.__ev = [];
window.__turns = 0;
(function () {
const types = %s;
for (const where of [window, document]) {
const name = where === window ? 'window' : 'document';
for (const t of types) {
where.addEventListener(t, e => {
window.__ev.push({t: t, via: name, trusted: e.isTrusted, x: e.clientX, y: e.clientY});
}, true);
}
}
const turn = () => { window.__turns++; requestAnimationFrame(turn); };
requestAnimationFrame(turn);
})();
""" % repr(TYPES)
PAGE = """<!doctype html><html><head><meta charset=utf-8><title>listening</title>
<script>%s</script>
<style>html,body{margin:0;height:100%%}</style></head><body></body></html>""" % RECORDER
def _frames(page):
"""Until the page has run `TURNS` frames of its own (a count of its turns, with a deadline)."""
page.wait_for_function("(turns) => window.__turns >= turns", arg=TURNS, timeout=30_000)
def _heard(page):
return page.evaluate("() => window.__ev")
def _launch(binary, seed):
from invisible_playwright import InvisiblePlaywright
return InvisiblePlaywright(seed=seed, binary_path=binary, headless=True, humanize=False)
def _the_move_is_the_first_event(page, point, where):
"""One move after the frames; it must be recorded, and be the first event the page recorded."""
_frames(page)
page.mouse.move(*point)
page.wait_for_function("([x, y]) => window.__ev.some(e => e.t === 'mousemove' && e.x === x && e.y === y)",
arg=list(point), timeout=30_000)
events = _heard(page)
first = events[0]
assert first["t"] in FIRST_KINDS and (first["x"], first["y"]) == point and first["trusted"], (
"%s: the first event the page recorded is %r, not an over, an enter or a move of the move at %r; all: %r" % (where, first, point, events))
def test_a_page_sees_no_pointer_or_mouse_event_before_the_first_input_on_the_hidden_display(firefox_binary):
with Sites() as sites:
sites.route("A", "/listening", PAGE)
with _launch(firefox_binary, 7201) as browser:
# a page served on 127.0.0.1, listened to from the first line of its head
page = browser.new_page()
page.goto(sites.url("A", "/listening"), wait_until="load", timeout=30_000)
_the_move_is_the_first_event(page, POINTS[0], "the served page")
# about:blank itself, with the recorder put there by the test
blank = browser.new_page()
blank.evaluate("() => { %s }" % RECORDER)
_the_move_is_the_first_event(blank, POINTS[1], "about:blank")
# about:blank first, its frames run with no input, then navigated: the pointer of this tab has not been moved by the
# test before its sentinel, so a crossing the page hears first can only be one nobody made
later = browser.new_page()
later.evaluate("() => { %s }" % RECORDER)
_frames(later)
later.goto(sites.url("A", "/listening"), wait_until="load", timeout=30_000)
_the_move_is_the_first_event(later, POINTS[2], "the page navigated to after about:blank")
def test_the_first_event_a_page_sees_is_the_one_the_first_mouse_move_makes(firefox_binary):
with Sites() as sites:
sites.route("A", "/listening", PAGE)
with _launch(firefox_binary, 7202) as browser:
page = browser.new_page()
page.goto(sites.url("A", "/listening"), wait_until="load", timeout=30_000)
_frames(page)
page.mouse.move(X, Y)
page.wait_for_function("([x, y]) => window.__ev.some(e => e.t === 'mousemove' && e.x === x && e.y === y)",
arg=[X, Y], timeout=30_000)
events = _heard(page)
assert events, "the page heard nothing of the move"
first = events[0]
assert first["t"] in FIRST_KINDS and (first["x"], first["y"]) == (X, Y), (
"the first event of the page is %r, not an over, an enter or a move at the move's point %r; all: %r" % (first, (X, Y), events))
assert all(e["trusted"] for e in events), "an event of the move is not trusted: %r" % [e for e in events if not e["trusted"]]
assert all((e["x"], e["y"]) == (X, Y) for e in events), "an event of the move is not at %r: %r" % ((X, Y), events)
assert {e["t"] for e in events} <= set(FIRST_KINDS), (
"a move made an event a move does not make: %r" % sorted({e["t"] for e in events} - set(FIRST_KINDS)))
@@ -0,0 +1,295 @@
"""A page's own `RegExp[Symbol.hasInstance]` and `Date[Symbol.hasInstance]` are never called by the automation while the client listens to console events.
Retail Firefox never calls them: nothing of the browser asks the page's `RegExp` or `Date` whether a value is an instance of it. The engine's Juggler classifies
the arguments of a console message (`rawObj instanceof this._domWindow[className]`, `juggler/content/Runtime.js`, `_createRemoteObject`), and an `instanceof` runs
`Symbol.hasInstance` of the constructor on its right: a page that defines it on `RegExp` or `Date` (a plain `Object.defineProperty`, a thing any script can do)
counts the calls and learns that something looked at its objects, which no retail Firefox does.
The page defines the hook on `RegExp` and on `Date` BEFORE any log, and a third one on a class of its own (`Probe`) that the page itself tests once with
`instanceof`: that control is 1 when the hook works, so a count of 0 on `RegExp` and `Date` means nothing was called, not that the hook never ran. The client
registers `page.on("console")`, the page logs `{}`, `/x/`, `new Date(0)` and `[1]` (an object, a RegExp, a Date, an array: the classification of the engine
goes through each of them), the test waits until the client has heard the four, and then reads the counters.
What the client sees of the two values, and what is checked of it: the wrapper hands the client a console message whose `args` is empty and whose `text` is built
from what Juggler sends for each argument (`_console_text`, `_juggler/_marshal.py`; Juggler sends a type and a subtype for an object and no preview). So the client
cannot read a "regexp" or a "date" in the message; what it must still see is that the four messages arrive, in the order of the page, each a `log` with a text
that is not empty (a classification that threw, or an `instanceof` that was stopped, would lose the message or leave it empty). That is what the last
assertions check, for the RegExp and the Date as for the others.
"""
from __future__ import annotations
import threading
from collections import namedtuple
from http.server import BaseHTTPRequestHandler
from types import SimpleNamespace
import pytest
from _servers import LocalServer
from _waits import wait_until
pytestmark = pytest.mark.e2e
#: Far beyond what a healthy run needs (a few hundred ms); it is the only clock the verdict depends on.
DEADLINE = 30.0
PAGE = b"""<!doctype html><title>hasinstance</title><script>
window.__hits = {re: 0, date: 0, probe: 0};
function hook(ctor, key) {
Object.defineProperty(ctor, Symbol.hasInstance, {
value(o) { window.__hits[key]++; return Function.prototype[Symbol.hasInstance].call(this, o); },
configurable: true,
});
}
hook(RegExp, 're');
hook(Date, 'date');
class Probe {}
hook(Probe, 'probe');
// The control: the page itself asks once, so the hook is proved to run when something runs `instanceof`.
void ({} instanceof Probe);
</script>"""
#: A page whose `Error.prototype.message` and `Error.prototype.stack` are counting getters (fixed strings, configurable, a no-op setter for `stack`). An error made by
#: `new Error('...')` carries its own data property `message`, set by the constructor, so the getter on the prototype is read only by code that reads a
#: message the error does not have, and `stack` (an accessor of the prototype in Firefox) only by code that reads the stack of the error.
ERRORS_PAGE = b"""<!doctype html><title>errors</title><script>
window.__errHits = {message: 0, stack: 0};
Object.defineProperty(Error.prototype, 'message', {get() { window.__errHits.message++; return 'page-message'; }, configurable: true});
Object.defineProperty(Error.prototype, 'stack', {get() { window.__errHits.stack++; return 'page-stack'; }, set(v) {}, configurable: true});
</script>"""
BLANK_PAGE = b"<!doctype html><title>blank</title>"
#: The page of the handle reads: an iframe of the same origin (its own document), a visible block, a block far below the fold (a scroll is needed to see it) and a button there.
TARGETS_PAGE = b"""<!doctype html><title>targets</title>
<style>body {margin: 0} #low {position: absolute; top: 3000px; left: 10px; width: 100px; height: 30px}
#btn {position: absolute; top: 3400px; left: 10px; width: 100px; height: 30px}</style>
<iframe id="f" srcdoc="<!doctype html><p id=inner>in</p>" style="width: 200px; height: 100px"></iframe>
<div id="outer">outer</div><div id="low">low</div><button id="btn">go</button>"""
#: The four logs of the page, in this order: the classification of Juggler goes through an object, a RegExp, a Date and an array.
LOGS = "() => { console.log({}); console.log(/x/); console.log(new Date(0)); console.log([1]); }"
KINDS = ["object", "RegExp", "Date", "array"]
class _Handler(BaseHTTPRequestHandler):
def log_message(self, *a):
pass
def do_GET(self):
body = {"/errors": ERRORS_PAGE, "/targets": TARGETS_PAGE, "/blank": BLANK_PAGE}.get(self.path, PAGE)
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)
@pytest.fixture
def site():
srv = LocalServer(("127.0.0.1", 0), _Handler)
threading.Thread(target=srv.serve_forever, daemon=True).start()
try:
yield SimpleNamespace(url="http://127.0.0.1:%d/" % srv.server_address[1])
finally:
srv.shutdown()
srv.server_close()
def test_the_page_own_regexp_and_date_hasinstance_are_not_called_by_a_console_listener(firefox_binary, site):
from invisible_playwright import InvisiblePlaywright
seen = []
with InvisiblePlaywright(seed=4271, binary_path=firefox_binary, headless=True) as browser:
page = browser.new_page()
page.on("console", lambda m: seen.append((m.type, m.text)))
page.goto(site.url, wait_until="load")
page.evaluate(LOGS)
# The client is a sync one: events are delivered while it calls the browser, so the wait is a call.
# What is awaited: the client has heard the four console events.
wait_until(lambda: len(seen) >= len(KINDS), DEADLINE, lambda: page.wait_for_timeout(50))
hits = page.evaluate("() => window.__hits")
assert len(seen) == len(KINDS), "the client heard %d console events of the 4 the page logged (after %.0f s): %r" % (
len(seen), DEADLINE, seen)
assert hits["re"] == 0, "the page's RegExp[Symbol.hasInstance] was called %d times while the client listened to console events" % hits["re"]
assert hits["date"] == 0, "the page's Date[Symbol.hasInstance] was called %d times while the client listened to console events" % hits["date"]
assert hits["probe"] == 1, "the control (the hook of a class of the page, tested once by the page) counted %d, not 1: the hook did not run as the test needs, counters %r" % (
hits["probe"], hits)
# What the client sees: the four messages, in the order of the page, each a `log` with a text (see the docstring: the wrapper carries no args and no preview).
for kind, (type_, text) in zip(KINDS, seen):
assert type_ == "log", "the console message of the %s reached the client as type %r, not 'log': %r" % (kind, type_, seen)
assert isinstance(text, str) and text.strip(), "the console message of the %s reached the client with the text %r: %r" % (kind, text, seen)
def _raised(page, expression):
"""The text of the exception the client raises for `expression`, or None when it raised nothing."""
try:
page.evaluate(expression)
except Exception as exc: # noqa: BLE001 - what the client raises is what is judged
return str(exc)
return None
def test_the_page_own_error_message_and_stack_getters_are_not_read_when_an_evaluate_fails(firefox_binary, site):
"""The page's `Error.prototype.message` and `.stack` are counting getters; an evaluate that throws and one that rejects must not read them, and the client
must still get the error's own message: `new Error('boom')` has `message` as its own data property, which the constructor sets and no getter shadows, so
the text 'boom' (and 'later') reaches the client in the exception text. The counters are read by a THIRD evaluate that returns a plain object and throws
nothing, so the read cannot touch an error itself."""
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=4272, binary_path=firefox_binary, headless=True) as browser:
page = browser.new_page()
page.goto(site.url + "errors", wait_until="load")
thrown = _raised(page, "() => { throw new Error('boom') }")
rejected = _raised(page, "() => Promise.reject(new Error('later'))")
hits = page.evaluate("() => window.__errHits")
assert thrown is not None, "the evaluate that throws raised nothing in the client"
assert rejected is not None, "the evaluate that returns a rejected promise raised nothing in the client"
assert hits == {"message": 0, "stack": 0}, "the page's Error.prototype getters were read while the client evaluated: counters %r (message, stack)" % hits
assert "boom" in thrown, "the client's exception for the thrown Error('boom') does not carry its message: %r" % thrown
assert "later" in rejected, "the client's exception for the rejected Error('later') does not carry its message: %r" % rejected
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
# The arguments of an exposed function cross as the page's own clone would read them
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
#: Defines, in the page, a factory of an object whose properties are counting getters (two on the object, one on a nested object), and measures what the PAGE's own
#: `structuredClone` reads: the counters of one clone of a fresh object, then reset.
CLONE_PROBE = """() => {
window.__bp = {a: 0, b: 0, c: 0};
window.__make = () => ({
get a() { window.__bp.a++; return 1; },
get b() { window.__bp.b++; return 2; },
nested: {get c() { window.__bp.c++; return 3; }},
});
structuredClone(window.__make());
const clone = {...window.__bp};
window.__bp = {a: 0, b: 0, c: 0};
return clone;
}"""
def test_the_getters_of_an_object_passed_to_an_exposed_function_are_read_as_the_page_s_own_clone_reads_them(firefox_binary, site):
"""What a page can count when it calls an exposed function with an object made of getters. `structuredClone` of the same shape reads every own enumerable property
ONCE (the two of the object and the one of the nested object), so the page's own clone is 1, 1, 1: that is the count expected here, measured in the page first
and not only written as a number. A stock client serializes the arguments of a binding by reading the properties once, to send them, so it is held to the same
count. A getter read twice, or a nested one read at another time, is a second reader of the page's objects. What the client receives is what one read of each
getter gives: {a: 1, b: 2, nested: {c: 3}}."""
from invisible_playwright import InvisiblePlaywright
received = []
with InvisiblePlaywright(seed=4273, binary_path=firefox_binary, headless=True) as browser:
page = browser.new_page()
page.expose_function("probe", lambda value: received.append(value))
page.goto(site.url + "blank", wait_until="load")
cloned = page.evaluate(CLONE_PROBE)
page.evaluate("() => window.probe(window.__make())")
wait_until(lambda: received, DEADLINE, lambda: page.wait_for_timeout(50))
hits = page.evaluate("() => ({...window.__bp})")
assert cloned == {"a": 1, "b": 1, "c": 1}, "the page's own structuredClone read the getters %r times (expected once each): the measure is not the one this test compares with" % cloned
assert received == [{"a": 1, "b": 2, "nested": {"c": 3}}], "the exposed function received %r, not the one read of each getter" % received
assert hits == cloned, "the getters of the object passed to the exposed function were read %r times, the page's own structuredClone of the same shape reads them %r" % (hits, cloned)
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
# A client call on a handle reads nothing the page can count: one case per block of the engine's PageAgent that reads the element it is given
# ---------------------------------------------------------------------------------------------------------------------------------------------------------
#: Plants a counting getter on each named property of each target, in the frame it runs in, and returns the reads the PAGE made of each one by reading it once
#: (the control: 1 when the getter works, the proof that a count of 0 later is not a plant that never took). The getter hands back what the property gave (the
#: native accessor or value found on the prototype chain, nothing for a name the page cannot see) so the page keeps working; the reads are reset to 0 after the control.
#: A property shadowed on the INSTANCE is what a chrome script holding the element WITHOUT an Xray would read; an Xray reads the native one and the page counts nothing.
PLANT = """(targets) => {
window.__reads = {};
const control = {};
const resolve = of => of === 'window' ? window : of === 'document' ? document : of === 'root' ? document.documentElement : document.querySelector(of);
for (const [of, names] of targets) {
const target = resolve(of);
for (const name of names) {
const key = of + '.' + name;
let owner = target, found = null;
while (owner && !(found = Object.getOwnPropertyDescriptor(owner, name))) owner = Object.getPrototypeOf(owner);
window.__reads[key] = 0;
try {
Object.defineProperty(target, name, {
get() { window.__reads[key]++; return found ? (found.get ? found.get.call(this) : found.value) : undefined; },
set(v) {}, configurable: true});
} catch (e) { control[key] = 'cannot plant: ' + e.message; continue; }
void target[name];
control[key] = window.__reads[key];
window.__reads[key] = 0;
}
}
return control;
}"""
Case = namedtuple("Case", "id block call plants")
#: `block`: the function of juggler/content/PageAgent.js with its lines and the Juggler command the client's call makes; `plants`: (frame, [(target, [properties])]),
#: the properties that block reads off the element it is given (and off the documents and windows it reaches).
CASES = [
Case("adopt", "_adoptNode :571 and :575 (Page.adoptNode): nodePrincipal of the element and of the document it is adopted into",
lambda h, child: child.evaluate("e => e.id", h["#outer"]),
[("main", [("#outer", ["nodePrincipal"])]), ("child", [("document", ["nodePrincipal"])])]),
Case("quads", "_getFrameQuads :813-:828 (Page.getContentQuads): getBoxQuads of the element, innerWidth and innerHeight of the main window",
lambda h, child: h["#outer"].bounding_box(),
[("main", [("#outer", ["getBoxQuads"]), ("window", ["innerWidth", "innerHeight"])])]),
Case("describe", "_describeNode :833-:848 (Page.describeNode): browsingContext, localName, contentWindow and ownerDocument of the iframe",
lambda h, child: h["#f"].content_frame(),
[("main", [("#f", ["browsingContext", "localName", "contentWindow", "ownerDocument"])])]),
Case("scroll", "_scrollIntoViewIfNeeded :907-:934 (Page.scrollIntoViewIfNeeded): isConnected, nodeType, ownerDocument, getClientRects, getBoundingClientRect, "
"scrollIntoView of the element, defaultView of its document, clientWidth and clientHeight of the root, innerWidth, innerHeight and frameElement of the window",
lambda h, child: h["#low"].scroll_into_view_if_needed(),
[("main", [("#low", ["isConnected", "nodeType", "ownerDocument", "getClientRects", "getBoundingClientRect", "scrollIntoView"]),
("document", ["defaultView"]), ("root", ["clientWidth", "clientHeight"]),
("window", ["innerWidth", "innerHeight", "frameElement"])])]),
Case("click", "_armLanding :1084 (the landing is armed before the event), what it feeds (_pruneArmedLandings :1107-:1112: ownerDocument, defaultView; _landingOn :1160-:1180: "
"ownerDocument, contains) and the quads and scroll blocks that a click runs first",
lambda h, child: h["#btn"].click(),
[("main", [("#btn", ["ownerDocument", "contains", "isConnected", "nodeType", "getClientRects", "getBoundingClientRect", "scrollIntoView", "getBoxQuads"]),
("document", ["defaultView"])])]),
]
@pytest.fixture(scope="module")
def invisible(firefox_binary):
from invisible_playwright import InvisiblePlaywright
with InvisiblePlaywright(seed=4274, binary_path=firefox_binary, headless=True) as b:
yield b
@pytest.mark.parametrize("case", CASES, ids=[c.id for c in CASES])
def test_a_client_call_on_a_handle_reads_none_of_the_getters_the_page_planted(invisible, site, case):
"""Retail Firefox reads nothing of a page's element for an automation call. The page plants counting getters on the properties the block of PageAgent reads
(instance properties, which a chrome script without an Xray would read and which the page can count), the client makes the call on a handle it held BEFORE the
plant, and every counter must still be 0. A control first: the page reads each planted property once, and each must have counted 1."""
page = invisible.new_context().new_page()
page.goto(site.url + "targets", wait_until="load")
handles = {sel: page.query_selector(sel) for sel in ("#f", "#outer", "#low", "#btn")}
child = handles["#f"].content_frame()
child.wait_for_selector("#inner")
where = {"main": page, "child": child}
controls = {}
for frame_key, targets in case.plants:
for key, count in where[frame_key].evaluate(PLANT, targets).items():
controls["%s:%s" % (frame_key, key)] = count
assert all(count == 1 for count in controls.values()), "the planted getters did not count one read by the page itself: %r (case %s)" % (controls, case.id)
failure = None
try:
case.call(handles, child)
except Exception as exc: # noqa: BLE001 - what the call raised is part of what is reported
failure = str(exc)
called = {}
for frame_key in {frame_key for frame_key, _ in case.plants}:
for key, count in where[frame_key].evaluate("() => window.__reads").items():
if count:
called["%s:%s" % (frame_key, key)] = count
assert not called, "the client's call read getters of the page: %r (block: %s)%s" % (
called, case.block, "; the call itself failed with %s" % failure if failure else "")
assert failure is None, "the client's call failed with %s (block: %s)" % (failure, case.block)
Loaded 100 of 211 files, more files were not shown because too many files have changed in this diff. Show more