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).
This commit is contained in:
feder-cr committed 2026-11-29 10:40:14 +01:00
1 parent 3e082e07d7
commit 06c2428572
6 files changed
+1931 -4

No files matched your search

File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -18,8 +18,8 @@
{"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": 2, "exact": true, "tests": ["tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the parent of the engine shows <GRE>/fonts to it (FcConfigAppFontAddDir) to rebuild a font from a path and a face index. On Windows DirectWrite opens the file from its path, with no folder to scan and no cache to read, so this test has no Windows counterpart.", "note": "2 = (1) the stand-in that runs the engine under strace stays in the engine's place, as the core launches it (the leader of a process group of its own): a fake engine with a child, no browser; the process the launcher holds lives as long as the fake engine, and the group killed holds strace and the child (the stand-in that exec'd setsid forked and exited 0 at once: candidate 44161687675); (2) the warm launch of the parent reads the bundle from fontconfig's cache and does not scan it again (from firefox-66, engine_at_least). Two launches under strace with the same XDG_CACHE_HOME of the test, the first cold and the second warm: the cold parent opens every font file of <GRE>/fonts (the folder as the disk lists it) before any page and fontconfig writes its cache; the warm parent does not open every one of them, and it opens a *.cache-* file of fontconfig (a few files are opened to be used, so the verdict asks about the whole folder, as a scan does). Scan and drawing are told apart by position: only what the parent opens before the first page counts (the opens that draw are written as after_startup). Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-cache: the interval and the number of opens of the bundle, the names of the files of the bundle each launch opened before the first page, the size of the cache file, the VmRSS of the parent after about:blank and after a page with every family, and a third launch with gfx.bundled-fonts.activate=0 (the behaviour before), which is evidence only. Needs strace on the runner: without it both are red, not skipped. No threshold."},
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 30, "exact": true, "tests": ["tests/test_the_page_bytes_reference_compares_decoded_pixels.py"], "marker": "unit", "needs_root": false, "note": "The helpers of wrapper.e2e.compositing on known inputs, no browser: the PNG compared on decoded pixels (another deBG chunk and compression are the same, one pixel is not, every scanline filter), the comparison with a reference (changed, missing and extra keys named, the entry to record), the type of an engine process, an engine process known by its executable and not by the name it gives itself (Linux), and the CPU of a window, and the shape of the committed Windows reference, and the box cut out of a screenshot (its pixels, a box outside the picture refused, written as a PNG and read back, two boxes told apart by a pixel that is named, the pixels that are not grey)."},
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 4210, "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_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_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_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_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", "tesLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4222, "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_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_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_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_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_pytest_process_clears_the_gp_fault_error_box_on_windows.py", "tests/test_every_refuLine truncated
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 4228, "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_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_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_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_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", "tesLine truncated
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4240, "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_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_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_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_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_pytest_process_clears_the_gp_fault_error_box_on_windows.py", "tests/test_every_refuLine 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": 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": 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
+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())
+4 -2
View File
@@ -126,13 +126,15 @@ class RetailChrome:
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.
#: 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.
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.windowUtils.sendMouseEvent(type, b.left + x, b.top + y, button, clicks, 0, false, 0, 0, true);
win.synthesizeMouseEvent(type, b.left + x, b.top + y, {button, clickCount: clicks, modifiers: 0, inputSource: 1}, {ignoreRootScrollFrame: false, isDOMEventSynthesized: true});
return JSON.stringify({ok: true});
"""
@@ -0,0 +1,285 @@
"""Every chrome-scope call a test makes exists in the Firefox it runs on: the retail twins no longer fail at the run for a name Firefox 159 does not have.
The twins run chrome JS (Marionette, chrome scope) on retail Firefox 159 and on stock Playwright's Firefox, not only on ours. ``win.windowUtils.sendMouseEvent`` is in no Firefox 159 (its chrome
input is ``Window.synthesizeMouseEvent``), and the four cases of ``wrapper.e2e.stock_twin.tooltip`` all died with ``TypeError: win.windowUtils.sendMouseEvent is not a function`` after the engine had
been built. The check is static, no browser:
1. Every string of every test and script (ast; docstrings are prose and are not read) is scanned for ``windowUtils.<name>`` (also through a ``const u = win.windowUtils`` alias), for
``.synthesize<...>(`` calls, and for the keys of the dictionary literals those calls pass. The names are not listed here: they are the ones in ``ci/mozilla-chrome-api.json``, which
``scripts/extract_mozilla_chrome_api.py`` extracts from Mozilla's ``nsIDOMWindowUtils.idl`` and ``Window.webidl`` at the release tag (path, tag, sha256 of each source in the file); the type
of each parameter, and so which argument is a dictionary, comes from the extracted signature.
2. A name that is neither in Mozilla's file nor in our engine's additions (``ours`` in the file) is red everywhere: no Firefox has it.
3. A name that is only ours (``jugglerSendMouseEvent``, the ``latency`` field) is red in code that runs on retail or on stock Firefox: ``_retail_reference.py``, ``_stock_twin.py`` and every
file that imports them, found by their imports. Code that only drives our engine may call it.
Known-bad input: the old ``SEND_JS`` (``win.windowUtils.sendMouseEvent(...)``), below as text and as the file of the repository before the fix; ``jugglerSendMouseEvent`` and a ``latency`` field in a
twin; a name that is nowhere. Green: the new ``SEND_JS`` and the strings of every test of the repository.
"""
from __future__ import annotations
import ast
import json
import re
import sys
from pathlib import Path
from typing import Any, Dict, List, Set, Tuple
import pytest
ROOT = Path(__file__).resolve().parent.parent
HERE = ROOT / "tests"
sys.path.insert(0, str(ROOT / "scripts"))
import extract_mozilla_chrome_api as extractor # noqa: E402
pytestmark = pytest.mark.unit
#: The modules a test imports to run chrome JS on a browser that is not ours: the retail reference and the stock twin. The files that import them (and the files that import those) run there too.
RETAIL_MODULES = {"_retail_reference", "_stock_twin"}
_ALIAS = re.compile(r"\b(?:const|let|var)\s+(\w+)\s*=\s*[\w.]*\.windowUtils\b(?!\s*\.)")
_UTILS = re.compile(r"\bwindowUtils\s*\.\s*(\w+)")
_SYNTH = re.compile(r"\.\s*(synthesize\w*)\s*\(")
def api() -> Dict[str, Any]:
return json.loads((ROOT / "ci" / "mozilla-chrome-api.json").read_text(encoding="utf-8"))
def _names(data: Dict[str, Any]) -> Dict[str, Set[str]]:
m, o = data["mozilla"], data["ours"]
utils = set().union(*m["window_utils"].values())
ours_utils = set().union(*o["window_utils"].values())
window = set(m["window"]["methods"]) | set(m["window"]["attributes"])
ours_window = set(o["window"]["methods"]) | set(o["window"]["attributes"])
return {"utils": utils, "ours_utils": ours_utils, "window": window, "ours_window": ours_window}
def _call_args(js: str, open_paren: int) -> List[str]:
"""The top-level arguments of the call whose ``(`` is at ``open_paren``."""
depth, args, cur = 0, [], []
for i in range(open_paren, len(js)):
ch = js[i]
if ch in "([{":
depth += 1
if depth == 1:
continue
elif ch in ")]}":
depth -= 1
if depth == 0:
args.append("".join(cur).strip())
return [a for a in args if a]
if ch == "," and depth == 1:
args.append("".join(cur).strip())
cur = []
else:
cur.append(ch)
return [a for a in args + ["".join(cur).strip()] if a]
def _literal_keys(arg: str) -> List[str]:
"""The keys of an object literal (``{a, b: 1, "c": 2}``); anything that is not a literal, or a spread, has none to check."""
if not (arg.startswith("{") and arg.endswith("}")):
return []
keys = []
for entry in _call_args("(" + arg[1:-1] + ")", 0):
m = re.match(r"""^["']?(\w+)["']?\s*(?::|$)""", entry)
if m:
keys.append(m.group(1))
return keys
def calls_in(js: str, data: Dict[str, Any]) -> List[Tuple[str, str, str]]:
"""``(kind, owner, name)`` of every chrome call of ``js``: ``("utils", "", name)``, ``("window", "", name)`` and ``("field", dictionary, key)``."""
out: List[Tuple[str, str, str]] = []
out += [("utils", "", m.group(1)) for m in _UTILS.finditer(js)]
for alias in _ALIAS.findall(js):
out += [("utils", "", m.group(1)) for m in re.finditer(r"\b%s\s*\.\s*(\w+)" % re.escape(alias), js)]
methods = data["mozilla"]["window"]["methods"]
for m in _SYNTH.finditer(js):
out.append(("window", "", m.group(1)))
params = methods.get(m.group(1), {}).get("params", [])
args = _call_args(js, m.end() - 1)
for i, arg in enumerate(args[:len(params)]):
if params[i][1] in data["mozilla"]["window"]["dictionaries"]:
out += [("field", params[i][1], key) for key in _literal_keys(arg)]
return out
def verdict(js: str, data: Dict[str, Any], runs_on_retail: bool, where: str) -> List[str]:
"""What is wrong with the chrome calls of ``js``, each with where, what, how to correct and which rule."""
n, problems = _names(data), []
fields = data["mozilla"]["window"]["dictionaries"]
ours_fields = data["ours"]["window"]["dictionaries"]
for kind, owner, name in calls_in(js, data):
if kind == "utils":
known, ours = name in n["utils"], name in n["ours_utils"]
what = "windowUtils.%s" % name
elif kind == "window":
known, ours = name in n["window"], name in n["ours_window"]
what = "Window.%s" % name
else:
known, ours = name in fields.get(owner, []), name in ours_fields.get(owner, [])
what = "the field %s of %s" % (name, owner)
tag = data["mozilla"]["ref"]
if not known and not ours:
problems.append("%s: %s is in no Firefox we run: it is not in Mozilla's sources at %s (ci/mozilla-chrome-api.json) nor in our engine's additions. Call the member Mozilla has for it "
"(look it up in %s), or correct the name; rule: a chrome call of a test exists in the Firefox it runs on" % (where, what, tag, ", ".join(extractor.SOURCES)))
elif not known and runs_on_retail:
problems.append("%s: %s exists only in our engine and this code runs on retail or stock Firefox %s, where it is not a function: use Mozilla's own member (Mozilla's sources at the tag), "
"or move the call to a file that drives only our engine; rule: nothing that runs on retail uses a name of ours" % (where, what, tag))
return problems
def _strings(tree: ast.AST) -> List[Tuple[int, str]]:
"""The string constants of a module, docstrings left out (a docstring is prose that may name what a test refuses)."""
docs = set()
for node in ast.walk(tree):
if isinstance(node, (ast.Module, ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)) and node.body:
first = node.body[0]
if isinstance(first, ast.Expr) and isinstance(first.value, ast.Constant) and isinstance(first.value.value, str):
docs.add(id(first.value))
return [(n.lineno, n.value) for n in ast.walk(tree) if isinstance(n, ast.Constant) and isinstance(n.value, str) and id(n) not in docs]
def _imports(tree: ast.AST) -> Set[str]:
out: Set[str] = set()
for node in ast.walk(tree):
if isinstance(node, ast.Import):
out |= {a.name.split(".")[0] for a in node.names}
elif isinstance(node, ast.ImportFrom) and node.module:
out.add(node.module.split(".")[0])
return out
def files() -> Dict[Path, ast.AST]:
out = {}
for folder in ("tests", "scripts"):
for path in sorted((ROOT / folder).rglob("*.py")):
if "vendor" in path.parts or "playwright-upstream" in path.parts or path == Path(__file__).resolve():
continue
try:
out[path] = ast.parse(path.read_text(encoding="utf-8"))
except SyntaxError:
continue
return out
def retail_files(parsed: Dict[Path, ast.AST]) -> Set[Path]:
"""The files that run chrome JS on a browser that is not ours: the modules named in RETAIL_MODULES and, to a fixed point, every file that imports one of them."""
modules = set(RETAIL_MODULES)
found: Set[Path] = set()
while True:
more = {p for p, tree in parsed.items() if p not in found and (p.stem in modules or _imports(tree) & modules)}
if not more:
return found
found |= more
modules |= {p.stem for p in more}
def scan(parsed: Dict[Path, ast.AST], data: Dict[str, Any]) -> Tuple[List[str], int]:
retail, problems, seen = retail_files(parsed), [], 0
for path, tree in parsed.items():
for line, text in _strings(tree):
seen += len(calls_in(text, data))
problems += verdict(text, data, path in retail, "%s:%d" % (path.relative_to(ROOT).as_posix(), line))
return problems, seen
# --------------------------------------------------------------------------------------------------------------------------- the data file
def test_the_data_file_says_where_every_name_comes_from():
data = api()
for side in ("mozilla", "ours"):
assert [f["path"] for f in data[side]["files"]] == list(extractor.SOURCES), side
for f in data[side]["files"]:
assert re.fullmatch(r"[0-9a-f]{64}", f["sha256"]), "%s %s has no sha256" % (side, f["path"])
assert re.fullmatch(r"[0-9a-f]{40}", data[side]["commit"]), "%s has no commit" % side
assert re.fullmatch(r"FIREFOX_\d+_\d+(_\d+)?_RELEASE", data["mozilla"]["ref"]), "the Mozilla side is a release tag, not a branch: %r" % data["mozilla"]["ref"]
def test_what_is_ours_is_not_in_mozillas_file():
data = api()
n = _names(data)
assert not (n["utils"] & n["ours_utils"]) and not (n["window"] & n["ours_window"])
for name, extra in data["ours"]["window"]["dictionaries"].items():
assert not set(extra) & set(data["mozilla"]["window"]["dictionaries"].get(name, [])), name
assert n["ours_utils"], "our additions are empty: the file was extracted from a tree that has none, so the separation it exists for was not made"
# --------------------------------------------------------------------------------------------------------------------------- the known-bad input
OLD_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.windowUtils.sendMouseEvent(type, b.left + x, b.top + y, button, clicks, 0, false, 0, 0, true);
return JSON.stringify({ok: true});
"""
def test_the_old_send_js_is_red_because_firefox_159_has_no_sendmouseevent():
problems = verdict(OLD_SEND_JS, api(), True, "old")
assert len(problems) == 1 and "windowUtils.sendMouseEvent" in problems[0] and "no Firefox we run" in problems[0], problems
def test_a_name_of_ours_is_red_on_retail_and_green_on_ours():
js = "win.windowUtils.jugglerSendMouseEvent(type, x, y, 0, 1, 0, false, 0, 0, true, false, 0, 0, 0);"
assert len(verdict(js, api(), True, "twin")) == 1
assert verdict(js, api(), False, "ours only") == []
def test_a_field_of_ours_in_the_options_of_synthesizemouseevent_is_red_on_retail():
js = "win.synthesizeMouseEvent('mousemove', 1, 2, {button: 0, latency: 3}, {});"
problems = verdict(js, api(), True, "twin")
assert len(problems) == 1 and "latency" in problems[0] and "SynthesizeMouseEventData" in problems[0], problems
assert verdict(js, api(), False, "ours only") == []
def test_a_field_that_is_in_no_dictionary_and_a_method_that_is_nowhere_are_red_everywhere():
js = "win.synthesizeMouseEvent('mousemove', 1, 2, {butten: 0}, {toWindow: true}); win.synthesizeMouseEvnt('x', 1, 2);"
assert len(verdict(js, api(), False, "x")) == 2
def test_a_value_read_through_windowutils_is_not_an_alias_of_it():
js = "const p = win.windowUtils.toScreenRectInCSSUnits(1, 2, 0, 0); return [p.left, p.top];"
assert verdict(js, api(), True, "x") == []
def test_the_alias_of_windowutils_is_read_too():
js = "const u = win.windowUtils; out.push([u.layerManagerType, u.sendMouseEvent]);"
problems = verdict(js, api(), False, "x")
assert len(problems) == 1 and "sendMouseEvent" in problems[0], problems
def test_a_spread_and_a_variable_in_the_dictionary_are_not_read_as_keys():
js = "win.synthesizeMouseEvent('mousemove', 1, 2, {...base, button}, opts);"
assert verdict(js, api(), True, "x") == []
# --------------------------------------------------------------------------------------------------------------------------- the repository
def test_the_chrome_calls_of_every_test_and_script_exist_in_firefox_159():
problems, seen = scan(files(), api())
assert seen, "the scan found no chrome call at all: it reads nothing (a scan that finds nothing proves nothing)"
assert not problems, "\n".join(problems)
def test_the_twins_are_found_by_their_imports_and_the_scan_reads_their_strings():
parsed = files()
found = {p.name for p in retail_files(parsed)}
assert {"_retail_reference.py", "_stock_twin.py"} <= found, found
assert any(n.endswith("_e2e.py") for n in found), "no test file imports the twins: the retail files are not found by their imports (%s)" % sorted(found)
def test_the_send_js_of_the_retail_reference_is_mozillas_synthesizemouseevent_with_mozillas_fields():
import _retail_reference
data = api()
calls = calls_in(_retail_reference.SEND_JS, data)
assert ("window", "", "synthesizeMouseEvent") in calls, calls
fields = {name for kind, owner, name in calls if kind == "field"}
assert {"button", "clickCount", "inputSource"} <= fields, calls
assert verdict(_retail_reference.SEND_JS, data, True, "SEND_JS") == []
assert "windowUtils.sendMouseEvent" not in _retail_reference.SEND_JS
@@ -0,0 +1,141 @@
"""The extractor of the chrome names reads methods, attributes, constants, members of ``Window`` and dictionaries from a small IDL and WebIDL, and records what it read.
``scripts/extract_mozilla_chrome_api.py`` writes ``ci/mozilla-chrome-api.json`` from Mozilla's sources, which the wrapper's CI does not have: the test that scans the chrome calls of the tests
(``test_the_chrome_calls_of_the_tests_exist_in_firefox.py``) trusts the file, so the extractor is checked here on samples that carry what a real file carries: comments with the names of
other members, multi-line signatures, ``[attributes]`` before and inside a member, a preprocessor line, a dictionary with a parent, a ``partial interface``, and a line of ours. No browser, no source tree.
"""
from __future__ import annotations
import hashlib
import subprocess
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT / "scripts"))
import extract_mozilla_chrome_api as ex # noqa: E402
pytestmark = pytest.mark.unit
IDL = """
/* the interface; a comment that names void notAMethod(); and const long NOT_A_CONSTANT = 1; */
[scriptable, uuid(11111111-2222-3333-4444-555555555555)]
interface nsIOther : nsISupports {
void otherMethod();
};
[scriptable, uuid(aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee)]
interface nsIDOMWindowUtils : nsISupports {
// void commentedOut();
const long MODIFIER_ALT = 0x0001;
const unsigned long LONG_ONE = 1;
readonly attribute float displayDPI;
attribute boolean paintFlashing;
#ifdef XP_WIN
void windowsOnly();
#endif
[can_run_script]
void sendWheelEvent(in float aX,
in float aY,
[optional] in nsISynthesizedEventCallback aCallback);
[implicit_jscontext] DOMRect toScreenRectInCSSUnits(in float aX, in float aY);
};
"""
OURS_IDL = IDL.replace(" void windowsOnly();", " void windowsOnly();\n [can_run_script] void jugglerSend(in AString aType); // STEALTH-HOOK(automation/input)")
WEBIDL = """
interface Window : EventTarget {
readonly attribute WindowProxy window;
};
dictionary SynthesizeEventData {
unsigned long identifier = 0;
float pressure;
};
dictionary SynthesizeMouseEventData : SynthesizeEventData {
// long ghost;
long button = 0;
required long clickCount;
short inputSource = 1;
};
dictionary SynthesizeMouseEventOptions {
boolean toWindow = false;
};
partial interface Window {
/** undefined notThis(); */
undefined scrollByLines(long numLines, optional ScrollOptions options = {});
[ChromeOnly, Throws]
boolean synthesizeMouseEvent(DOMString type, float offsetX, float offsetY,
optional SynthesizeMouseEventData mouseEventData = {},
optional SynthesizeMouseEventOptions options = {},
optional VoidFunction callback);
[ChromeOnly] readonly attribute boolean chromeFlag;
};
interface WindowOrWorkerGlobalScope { undefined notWindow(); };
"""
OURS_WEBIDL = WEBIDL.replace(" short inputSource = 1;", " short inputSource = 1;\n double latency = 0; // STEALTH-HOOK(fingerprint/input/latency)")
def test_window_utils_reads_methods_attributes_and_constants_of_that_interface_only():
got = ex.window_utils(IDL)
assert got["methods"] == ["sendWheelEvent", "toScreenRectInCSSUnits", "windowsOnly"], got
assert got["attributes"] == ["displayDPI", "paintFlashing"], got
assert got["constants"] == ["LONG_ONE", "MODIFIER_ALT"], got
def test_window_reads_members_of_the_interface_and_its_partial_with_signature_and_chrome_only():
got = ex.window(WEBIDL)
assert sorted(got["methods"]) == ["scrollByLines", "synthesizeMouseEvent"], got["methods"]
assert sorted(got["attributes"]) == ["chromeFlag", "window"], got["attributes"]
assert got["methods"]["synthesizeMouseEvent"]["chrome_only"] is True
assert got["methods"]["scrollByLines"]["chrome_only"] is False
assert got["attributes"]["chromeFlag"]["chrome_only"] is True
assert got["methods"]["synthesizeMouseEvent"]["params"] == [
["type", "DOMString"], ["offsetX", "float"], ["offsetY", "float"],
["mouseEventData", "SynthesizeMouseEventData"], ["options", "SynthesizeMouseEventOptions"], ["callback", "VoidFunction"]]
def test_dictionaries_carry_the_fields_of_their_parents_and_not_those_of_comments():
got = ex.window(WEBIDL)["dictionaries"]
assert got["SynthesizeMouseEventData"] == ["button", "clickCount", "identifier", "inputSource", "pressure"], got
assert got["SynthesizeMouseEventOptions"] == ["toWindow"], got
def test_what_is_only_in_our_tree_is_separated_from_what_is_in_mozillas():
mozilla, ours = ex.extract(IDL, WEBIDL), ex.extract(OURS_IDL, OURS_WEBIDL)
only = ex.only_in_ours(mozilla, ours)
assert only["window_utils"] == {"methods": ["jugglerSend"], "attributes": [], "constants": []}, only
assert only["window"]["dictionaries"] == {"SynthesizeMouseEventData": ["latency"]}, only
assert only["window"]["methods"] == [] and only["window"]["attributes"] == [], only
assert ex.only_in_ours(mozilla, mozilla) == {"window_utils": {"methods": [], "attributes": [], "constants": []}, "window": {"methods": [], "attributes": [], "dictionaries": {}}}
def _repo(path: Path, idl: str, webidl: str, tag: str) -> None:
env = {"GIT_AUTHOR_NAME": "t", "GIT_AUTHOR_EMAIL": "t@users.noreply.github.com", "GIT_COMMITTER_NAME": "t", "GIT_COMMITTER_EMAIL": "t@users.noreply.github.com", "PATH": __import__("os").environ["PATH"]}
for rel, text in ((ex.WINDOW_UTILS_IDL, idl), (ex.WINDOW_WEBIDL, webidl)):
target = path / rel
target.parent.mkdir(parents=True, exist_ok=True)
target.write_bytes(text.encode("utf-8"))
for cmd in (["init", "-q"], ["add", "-A"], ["commit", "-q", "-m", "x"], ["tag", tag]):
subprocess.run(["git", "-C", str(path)] + cmd, check=True, env=env, capture_output=True)
def test_the_file_records_the_path_the_tag_the_commit_and_the_sha256_of_what_was_read(tmp_path):
_repo(tmp_path / "m", IDL, WEBIDL, "FIREFOX_1_0_RELEASE")
_repo(tmp_path / "o", OURS_IDL, OURS_WEBIDL, "ours")
data = ex.build(tmp_path / "m", "FIREFOX_1_0_RELEASE", tmp_path / "o", "ours")
assert data["mozilla"]["ref"] == "FIREFOX_1_0_RELEASE" and len(data["mozilla"]["commit"]) == 40
assert data["mozilla"]["files"] == [
{"path": ex.WINDOW_UTILS_IDL, "sha256": hashlib.sha256(IDL.encode()).hexdigest()},
{"path": ex.WINDOW_WEBIDL, "sha256": hashlib.sha256(WEBIDL.encode()).hexdigest()}]
assert data["ours"]["files"][0]["sha256"] == hashlib.sha256(OURS_IDL.encode()).hexdigest()
assert data["mozilla"]["window_utils"]["methods"] == ["sendWheelEvent", "toScreenRectInCSSUnits", "windowsOnly"]
assert data["ours"]["window_utils"]["methods"] == ["jugglerSend"]
def test_a_source_that_is_not_at_the_tag_is_an_error_not_an_empty_file(tmp_path):
_repo(tmp_path / "m", IDL, WEBIDL, "FIREFOX_1_0_RELEASE")
with pytest.raises(subprocess.CalledProcessError):
ex.build(tmp_path / "m", "FIREFOX_2_0_RELEASE", tmp_path / "m", "FIREFOX_1_0_RELEASE")