Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
fix(layout): reuse compatible snapshots after interactions
ldm0da6df4375f28
diff --git a/moli-protocol-server/src/protocol_server/tests/cdp_dynamic_page.rs b/moli-protocol-server/src/protocol_server/tests/cdp_dynamic_page.rsindex ef841cad4..3b9bb5d8e 100644--- a/moli-protocol-server/src/protocol_server/tests/cdp_dynamic_page.rs+++ b/moli-protocol-server/src/protocol_server/tests/cdp_dynamic_page.rs@@ -446,9 +446,10 @@ async fn websocket_cdp_mouse_wheel_scrolls_page_and_honors_prevent_default() {.await;let value = &response_by_id(&scrolled, 3)["result"]["result"]["value"];assert_eq!(value["scrollY"], json!(120));+ // Ordinary geometry reads retain the last published visual world.assert_eq!(value["markerTop"].as_f64().expect("scrolled marker top"),- marker_before - 120.0+ marker_before);assert_eq!(value["wheelDeltas"], json!([120]));diff --git a/moli-renderer-v8/src/native_bridge/context_host/host_environment.rs b/moli-renderer-v8/src/native_bridge/context_host/host_environment.rsindex 1107135c1..e3e97d8e9 100644--- a/moli-renderer-v8/src/native_bridge/context_host/host_environment.rs+++ b/moli-renderer-v8/src/native_bridge/context_host/host_environment.rs@@ -1961,8 +1961,8 @@ impl JsContextHost {);}// Hover changes the source style, not the published rendered world.- // Explicit geometry/paint demands may refresh it; subsequent pointer- // phases continue consuming the retained snapshot.+ // Geometry reads and pointer phases keep consuming the retained+ // snapshot until a fresh visual publication replaces it.self.invalidate_layout_after_interaction_state_change();true}diff --git a/moli-renderer-v8/src/native_bridge/context_host/layout.rs b/moli-renderer-v8/src/native_bridge/context_host/layout.rsindex c2f29e7da..e002ef8c1 100644--- a/moli-renderer-v8/src/native_bridge/context_host/layout.rs+++ b/moli-renderer-v8/src/native_bridge/context_host/layout.rs@@ -536,9 +536,11 @@ impl JsContextHost {pub(crate) fn invalidate_layout_after_interaction_state_change(&self) {self.clear_layout_rect_cache();+ // Interactions dirty future visual publication, while ordinary geometry+ // and input keep consuming the latest compatible frozen snapshot.self.document_layout_state.borrow_mut()- .invalidate_latest_layout_for_demand();+ .mark_visual_state_dirty();}pub(crate) fn document_web_font_resources_are_current(diff --git a/moli-renderer-v8/src/native_bridge/context_host/layout_snapshot.rs b/moli-renderer-v8/src/native_bridge/context_host/layout_snapshot.rsindex 50c1cdb6a..972d445fd 100644--- a/moli-renderer-v8/src/native_bridge/context_host/layout_snapshot.rs+++ b/moli-renderer-v8/src/native_bridge/context_host/layout_snapshot.rs@@ -17,7 +17,6 @@ struct LatestFrozenLayout {document: DomHandle,tree: Box<FrozenLayoutTree<DomHandle>>,environment: LayoutEnvironment,- reusable_for_demand: bool,}/// Single-slot storage for the latest successful frozen layout tree.@@ -45,9 +44,9 @@ impl LatestLayoutTreeCache {}pub(super) fn matches_environment(&self, environment: LayoutEnvironment) -> bool {- self.latest.as_ref().is_some_and(|snapshot| {- snapshot.reusable_for_demand && snapshot.environment == environment- })+ self.latest+ .as_ref()+ .is_some_and(|snapshot| snapshot.environment == environment)}pub(super) fn publish(@@ -60,18 +59,9 @@ impl LatestLayoutTreeCache {document,tree: Box::new(tree),environment,- reusable_for_demand: true,});}- /// Keep the rendered world available to input while the next geometry- /// demand rebuilds it after an interaction such as scrolling or hover.- pub(super) fn invalidate_for_demand(&mut self) {- if let Some(snapshot) = &mut self.latest {- snapshot.reusable_for_demand = false;- }- }-pub(super) fn clear(&mut self) {self.latest = None;}diff --git a/moli-renderer-v8/src/native_bridge/context_host/layout_state.rs b/moli-renderer-v8/src/native_bridge/context_host/layout_state.rsindex 3e746992a..5e3e90f7b 100644--- a/moli-renderer-v8/src/native_bridge/context_host/layout_state.rs+++ b/moli-renderer-v8/src/native_bridge/context_host/layout_state.rs@@ -146,11 +146,6 @@ impl DocumentLayoutState {self.mark_visual_state_dirty();}- pub(super) fn invalidate_latest_layout_for_demand(&mut self) {- self.latest_layout.invalidate_for_demand();- self.mark_visual_state_dirty();- }-pub(super) fn frame_viewport(&self, frame: DomHandle) -> Option<LayoutViewport> {self.frame_viewports.get(&frame).copied()}diff --git a/moli-renderer-v8/src/native_bridge/element/geometry/scroll.rs b/moli-renderer-v8/src/native_bridge/element/geometry/scroll.rsindex 49a74eb5e..01c521310 100644--- a/moli-renderer-v8/src/native_bridge/element/geometry/scroll.rs+++ b/moli-renderer-v8/src/native_bridge/element/geometry/scroll.rs@@ -149,10 +149,9 @@ pub(crate) fn apply_scroll_observable_effects(if effects.is_empty() {return;}- // Native lazy loading deliberately combines the retained pre-scroll- // projection with live element offsets, so admit those requests before- // invalidating it for subsequent geometry demands. Coordinate input- // retains this projection until such a demand publishes a replacement.+ // Native lazy loading combines the retained projection with live scroll+ // offsets. Geometry and input retain that projection until fresh visual+ // publication replaces it.for effects in &effects {if let Some(document) = effects.document() {queue_revealed_lazy_image_loads(scope, runtime_ptr, document);diff --git a/moli-renderer-v8/src/runtime/tests.rs b/moli-renderer-v8/src/runtime/tests.rsindex eb53822d8..01d669cf9 100644--- a/moli-renderer-v8/src/runtime/tests.rs+++ b/moli-renderer-v8/src/runtime/tests.rs@@ -12299,7 +12299,7 @@ async fn owner_scheduler_applies_a_wheel_batch_at_the_fixed_action_window_deadli.expect("default resource request client");let (base_url, effect_request_seen, release_effect_response, effect_server) =spawn_owner_wake_gated_server_with_content_type(- "/action-window-intersection-applied",+ "/action-window-scroll-applied","ok","text/plain; charset=utf-8",)@@ -12352,11 +12352,9 @@ globalThis.__lmActionWindowObserver = new IntersectionObserver(entries => {const entry = entries.find(candidate => candidate.target.id === "target");if (!entry) return;__lmActionWindowIoLog.push(entry.isIntersecting);- if (__lmActionWindowIoLog.length === 2) {- fetch("/action-window-intersection-applied");- }});__lmActionWindowObserver.observe(document.getElementById("target"));+addEventListener("scroll", () => fetch("/action-window-scroll-applied"), { once: true });"installed""#.to_owned(),@@ -12389,17 +12387,17 @@ __lmActionWindowObserver.observe(document.getElementById("target"));tokio::time::timeout(Duration::from_secs(3), effect_request_seen).await.expect("the owner scheduler should apply the wheel batch at its deadline")- .expect("IntersectionObserver effect signal should remain open");+ .expect("scroll effect signal should remain open");assert!(opened_at.elapsed() >= Duration::from_millis(900),"the fixed one-second action window must not apply immediately");release_effect_response.send(())- .expect("intersection effect response should release once");+ .expect("scroll effect response should release once");effect_server.await- .expect("intersection effect server should finish");+ .expect("scroll effect server should finish");let (state, _) = page.run_async_command(RendererPageCommand::EvaluateExpression {@@ -12416,7 +12414,7 @@ __lmActionWindowObserver.observe(document.getElementById("target"));assert_eq!(renderer_json_value(state),Some(serde_json::json!(- r#"{"scrollY":100,"wheelLog":["event:100","event:-100","event:100","microtask:100","microtask:-100","microtask:100"],"ioLog":[false,true]}"#+ r#"{"scrollY":100,"wheelLog":["event:100","event:-100","event:100","microtask:100","microtask:-100","microtask:100"],"ioLog":[false]}"#)));diff --git a/moli-renderer-v8/src/script_vm/element_click.rs b/moli-renderer-v8/src/script_vm/element_click.rsindex a2767d982..3a966aa4b 100644--- a/moli-renderer-v8/src/script_vm/element_click.rs+++ b/moli-renderer-v8/src/script_vm/element_click.rs@@ -7,7 +7,7 @@ use crate::runtime::{RendererElementClickError as ClickError, RendererElementClickTarget as ClickTarget,RendererInputDispatchOutcome, RendererPointerEventProperties, RendererPreparedPointerClick,};-use moli_layout::{LayoutFlushReason, LayoutPoint, LayoutQuad};+use moli_layout::{LayoutFlushReason, LayoutPassRequest, LayoutPoint, LayoutQuad};fn layout_error(error: impl std::fmt::Display) -> ClickError {ClickError::LayoutUnavailable(error.to_string())@@ -36,11 +36,25 @@ impl ScriptVm {return Ok(ClickTarget::DomActivation);}}- self.with_default_context_scope(|scope, runtime_ptr| {- Ok(scroll_node_into_view_at_center(scope, runtime_ptr, handle)?)- })- .map_err(layout_error)?- .ok_or(ClickError::NoClickableRect)?;+ let scrolled = self+ .with_default_context_scope(|scope, runtime_ptr| {+ Ok(scroll_node_into_view_at_center(scope, runtime_ptr, handle)?)+ })+ .map_err(layout_error)?+ .ok_or(ClickError::NoClickableRect)?;+ if scrolled {+ // Element click must prepare a point in the newly scrolled view.+ // Ordinary geometry reads and coordinate input retain the snapshot.+ let viewport = {+ let host = self._context_host.borrow();+ host.layout_viewport_for_document(host.document_handle())+ };+ self.with_fresh_layout_pass(+ LayoutPassRequest::new(viewport, LayoutFlushReason::HitTest),+ |_| Ok(()),+ )+ .map_err(layout_error)?;+ }self.prepare_pointer_click_geometry(handle).map(ClickTarget::Pointer)}diff --git a/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs b/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rsindex c8d81766d..1836820eb 100644--- a/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs+++ b/moli-renderer-v8/src/script_vm/tests/dom_elements/dom_surface.rs@@ -255,7 +255,7 @@ fn element_scroll_into_view_if_needed_updates_observable_window_scroll() {}#[test]-fn wheel_default_action_scrolls_and_refreshes_geometry_unless_canceled() {+fn wheel_default_action_scrolls_unless_canceled() {let mut vm = new_storage_test_vm("https://wheel-default-scroll.test/");vm.eval(r#"@@ -292,6 +292,8 @@ fn wheel_default_action_scrolls_and_refreshes_geometry_unless_canceled() {.expect("wheel input should dispatch");assert!(outcome.handled);+ // Publish the scrolled geometry before checking its rendered position.+ refresh_layout_for_test(&mut vm);let result = vm.eval(r#"@@ -330,7 +332,7 @@ fn wheel_default_action_scrolls_and_refreshes_geometry_unless_canceled() {}#[test]-fn window_scroll_refreshes_intersection_observer_geometry() {+fn intersection_checks_after_scroll_reuse_geometry_until_fresh_paint() {let mut vm = new_storage_test_vm("https://scroll-intersection-observer.test/");vm.set_viewport_surface(Some(crate::protocol_types::ViewportSurface {inner_width: 800,@@ -382,6 +384,19 @@ fn window_scroll_refreshes_intersection_observer_geometry() {vm.eval("window.scrollTo(0, 400)").expect("window scroll should evaluate");+ assert_eq!(+ vm.eval("JSON.stringify(window.__intersectionStates)")+ .expect("scroll should retain the published intersection geometry"),+ "[false]"+ );+ vm.screenshot_layout_snapshot(moli_layout::PaintViewport::new(800, 600, 1.0))+ .expect("fresh paint publishes the scrolled geometry")+ .expect("document layout");+ vm.with_default_context_scope_and_checkpoint_for_test(|scope, runtime_ptr| {+ crate::observer_runtime::queue_intersection_checks(scope, runtime_ptr);+ Ok(())+ })+ .expect("check intersections against the newly published geometry");assert_eq!(vm.eval("JSON.stringify(window.__intersectionStates)").expect("scrolled intersection state should flush"),@@ -764,6 +779,7 @@ fn iframe_wheel_batch_reuses_one_composite_snapshot_for_every_scroll_step() {"committing derived effects must not perform another layout");+ refresh_layout_for_test(&mut vm);assert_eq!(vm.eval("(() => { const frame = document.getElementById('wheel-frame'); return [frame.contentDocument.getElementById('wheel-scroller').scrollTop, frame.contentWindow.__wheelGeometryReads].join('|'); })()"@@ -1175,6 +1191,7 @@ fn classic_scrollbar_metrics_and_thumb_drag_match_chromium_without_dom_mouse_evevm.dispatch_mouse_event_at_point(90.0, 90.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("horizontal thumb release should dispatch");+ refresh_layout_for_test(&mut vm);let before_controls = vm.eval("scroller.scrollTop").expect("pre-control scrollTop should evaluate")@@ -1184,6 +1201,7 @@ fn classic_scrollbar_metrics_and_thumb_drag_match_chromium_without_dom_mouse_eve.expect("back button press should dispatch");vm.dispatch_mouse_event_at_point(190.0, 5.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("back button release should dispatch");+ refresh_layout_for_test(&mut vm);let after_back = vm.eval("scroller.scrollTop").expect("back-button scrollTop should evaluate")@@ -1195,6 +1213,7 @@ fn classic_scrollbar_metrics_and_thumb_drag_match_chromium_without_dom_mouse_eve.expect("forward button press should dispatch");vm.dispatch_mouse_event_at_point(190.0, 80.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("forward button release should dispatch");+ refresh_layout_for_test(&mut vm);let after_forward = vm.eval("scroller.scrollTop").expect("forward-button scrollTop should evaluate")@@ -1206,6 +1225,7 @@ fn classic_scrollbar_metrics_and_thumb_drag_match_chromium_without_dom_mouse_eve.expect("forward track press should dispatch");vm.dispatch_mouse_event_at_point(190.0, 60.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("forward track release should dispatch");+ refresh_layout_for_test(&mut vm);let after_track = vm.eval("scroller.scrollTop").expect("track scrollTop should evaluate")@@ -1260,6 +1280,7 @@ fn painted_overlay_wins_over_scrollbar_and_corner_consumes_input() {refresh_layout_for_test(&mut vm);vm.eval("scroller.scrollTop = 80").expect("scroller should move before the overlay probe");+ refresh_layout_for_test(&mut vm);vm.dispatch_mouse_event_at_point(210.0, 30.0, "mousedown", 0, Some(1), 0.0, 0.0).expect("overlay press should dispatch");@@ -1758,6 +1779,7 @@ fn nested_and_sibling_scrollbar_drags_stay_bound_to_the_pressed_scroller() {.expect("captured nested thumb move should dispatch");vm.dispatch_mouse_event_at_point(515.0, 115.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("captured nested thumb release should dispatch");+ refresh_layout_for_test(&mut vm);let after_nested: serde_json::Value = serde_json::from_str(&vm.eval("JSON.stringify([inner.scrollTop, outer.scrollTop, sibling.scrollTop])").expect("nested drag state should evaluate"),@@ -1829,6 +1851,7 @@ fn nested_and_sibling_scrollbar_drags_stay_bound_to_the_pressed_scroller() {vm.dispatch_mouse_event_at_point(295.0, 125.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("outer thumb release should dispatch");+ refresh_layout_for_test(&mut vm);let result: serde_json::Value = serde_json::from_str(&vm.eval("JSON.stringify([outer.scrollTop, inner.scrollTop, sibling.scrollTop, horizontal.scrollLeft, document.getElementById('thin-child').scrollLeft, document.getElementById('thin-child').scrollTop, document.getElementById('rtl-child').scrollLeft, document.getElementById('rtl-child').scrollTop, __nestedScrollbarDomEvents])",@@ -1903,6 +1926,7 @@ fn transformed_scrollbar_drag_uses_local_motion_clamps_and_cancels_on_button_los);vm.dispatch_mouse_event_at_point(700.0, 420.0, "mousemove", -1, Some(1), 0.0, 0.0).expect("first scaled incremental thumb move should dispatch");+ refresh_layout_for_test(&mut vm);let first_move = vm.eval("scaled.scrollTop").expect("first scaled scrollTop should evaluate")@@ -1916,6 +1940,7 @@ fn transformed_scrollbar_drag_uses_local_motion_clamps_and_cancels_on_button_los.expect("scaled captured thumb move should dispatch outside its element");vm.dispatch_mouse_event_at_point(700.0, 440.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("scaled captured thumb release should dispatch");+ refresh_layout_for_test(&mut vm);let moderate = vm.eval("scaled.scrollTop").expect("scaled scrollTop should evaluate")@@ -1932,19 +1957,20 @@ fn transformed_scrollbar_drag_uses_local_motion_clamps_and_cancels_on_button_los.expect("scaled lower-clamp thumb move should dispatch");vm.dispatch_mouse_event_at_point(700.0, 590.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("scaled lower-clamp thumb release should dispatch");+ refresh_layout_for_test(&mut vm);assert_eq!(vm.eval("scaled.scrollTop").expect("maximum scaled scrollTop should evaluate"),"215");- refresh_layout_for_test(&mut vm);vm.dispatch_mouse_event_at_point(355.0, 460.0, "mousedown", 0, Some(1), 0.0, 0.0).expect("scaled upper-clamp thumb press should dispatch");vm.dispatch_mouse_event_at_point(700.0, 300.0, "mousemove", -1, Some(1), 0.0, 0.0).expect("scaled upper-clamp thumb move should dispatch");vm.dispatch_mouse_event_at_point(700.0, 300.0, "mouseup", 0, Some(0), 0.0, 0.0).expect("scaled upper-clamp thumb release should dispatch");+ refresh_layout_for_test(&mut vm);assert_eq!(vm.eval("scaled.scrollTop").expect("minimum scaled scrollTop should evaluate"),@@ -1953,7 +1979,6 @@ fn transformed_scrollbar_drag_uses_local_motion_clamps_and_cancels_on_button_los// Losing the primary-button bit cancels native capture. Later moves must// return to DOM dispatch and must not continue scrolling the old element.- refresh_layout_for_test(&mut vm);vm.dispatch_mouse_event_at_point(355.0, 400.0, "mousedown", 0, Some(1), 0.0, 0.0).expect("cancelable scaled thumb press should dispatch");vm.dispatch_mouse_event_at_point(700.0, 440.0, "mousemove", -1, Some(0), 0.0, 0.0)diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/dom.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/dom.rsindex 8b051f713..1a1b8c3a8 100644--- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/dom.rs+++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/dom.rs@@ -6078,7 +6078,7 @@ fn mouse_hover_dispatches_pointer_boundary_before_mouse_boundary() {}#[test]-fn mouse_hover_persists_stylo_state_and_reflows_dropdown_on_geometry_demand() {+fn mouse_hover_persists_stylo_state_and_reflows_dropdown_on_fresh_paint() {let mut vm = new_parsed_test_vm("https://hover-dropdown.test/",r#"@@ -6150,8 +6150,9 @@ fn mouse_hover_persists_stylo_state_and_reflows_dropdown_on_geometry_demand() {"true|true|true|true|block");- vm.eval("document.getElementById('submenu').getBoundingClientRect()")- .expect("explicit geometry demand publishes the displayed submenu");+ vm.screenshot_layout_snapshot(moli_layout::PaintViewport::new(1920, 1080, 1.0))+ .expect("fresh paint publishes the displayed submenu")+ .expect("document layout");vm.dispatch_mouse_event_at_point(10.0, 35.0, "mousedown", 0, Some(1), 0.0, 0.0).expect("mousedown should hit the newly displayed submenu");vm.dispatch_mouse_event_at_point(10.0, 35.0, "mouseup", 0, Some(0), 0.0, 0.0)diff --git a/moli-renderer-v8/src/script_vm/tests/mouse_snapshot.rs b/moli-renderer-v8/src/script_vm/tests/mouse_snapshot.rsindex 52421f63f..a43afa6e4 100644--- a/moli-renderer-v8/src/script_vm/tests/mouse_snapshot.rs+++ b/moli-renderer-v8/src/script_vm/tests/mouse_snapshot.rs@@ -110,7 +110,7 @@ fn mouse_click_consumes_snapshot_through_hover_focus_and_dom_mutation() {}#[test]-fn mouse_input_uses_latest_published_geometry_until_an_explicit_refresh() {+fn mouse_and_geometry_reuse_the_snapshot_until_fresh_paint() {let mut vm = new_parsed_test_vm("https://mouse-snapshot.test/",r#"<!doctype html><style>body{min-height:100px}</style>@@ -121,7 +121,16 @@ fn mouse_input_uses_latest_published_geometry_until_an_explicit_refresh() {mouse(&mut vm, "mousemove").unwrap();assert_eq!(vm.eval("JSON.stringify(hits)").unwrap(), r#"["target"]"#);assert_eq!(vm.layout_pass_observability_for_test().1, before);- // Hover invalidation is observed by the next geometry demand, never input.+ // DOM and hover changes do not invalidate ordinary geometry reads.+ assert_eq!(+ vm.eval("String(target.getBoundingClientRect().left)")+ .unwrap(),+ "20"+ );+ assert_eq!(vm.layout_pass_observability_for_test().1, before);+ vm.screenshot_layout_snapshot(moli_layout::PaintViewport::new(1920, 1080, 1.0))+ .unwrap()+ .unwrap();assert_eq!(vm.eval("String(target.getBoundingClientRect().left)").unwrap(),@@ -134,7 +143,7 @@ fn mouse_input_uses_latest_published_geometry_until_an_explicit_refresh() {}#[test]-fn mouse_handlers_can_explicitly_demand_geometry() {+fn mouse_handler_geometry_reads_reuse_the_published_snapshot() {let mut vm = new_parsed_test_vm("https://mouse-snapshot.test/",r#"<!doctype html>@@ -143,8 +152,8 @@ fn mouse_handlers_can_explicitly_demand_geometry() {vm.eval("target.getBoundingClientRect();target.onmousemove=()=>{target.style.left='300px';window.observedLeft=target.getBoundingClientRect().left}").unwrap();let before = vm.layout_pass_observability_for_test().1;mouse(&mut vm, "mousemove").unwrap();- assert_eq!(vm.eval("String(observedLeft)").unwrap(), "300");- assert_eq!(vm.layout_pass_observability_for_test().1, before + 1);+ assert_eq!(vm.eval("String(observedLeft)").unwrap(), "20");+ assert_eq!(vm.layout_pass_observability_for_test().1, before);}#[test]@@ -163,7 +172,13 @@ fn mouse_wheel_updates_scroll_without_refreshing_the_rendered_world() {.unwrap();assert_eq!(vm.layout_pass_observability_for_test().1, before);}- // scrollTop is an explicit geometry observation in Moli and can refresh.+ // Scroll metrics and bounds still come from the published snapshot.+ assert_eq!(vm.eval("String(target.scrollTop)").unwrap(), "0");+ vm.eval("target.getBoundingClientRect()").unwrap();+ assert_eq!(vm.layout_pass_observability_for_test().1, before);+ vm.screenshot_layout_snapshot(moli_layout::PaintViewport::new(1920, 1080, 1.0))+ .unwrap()+ .unwrap();assert_eq!(vm.eval("String(target.scrollTop)").unwrap(), "150");assert_eq!(vm.layout_pass_observability_for_test().1, before + 1);vm.eval("target.getBoundingClientRect()").unwrap();