diff --git a/moli-protocol/src/domains/page/tests/same_document_history.rs b/moli-protocol/src/domains/page/tests/same_document_history.rs index fcf3a17618f..734c2b8b318 100644 --- a/moli-protocol/src/domains/page/tests/same_document_history.rs +++ b/moli-protocol/src/domains/page/tests/same_document_history.rs @@ -1,5 +1,7 @@ use super::*; +mod popup_network_navigation; + const SESSION: &str = "SID-COMMIT-HISTORY"; const FRAME: &str = "TID-COMMIT-HISTORY"; @@ -23,6 +25,10 @@ impl Drop for SameDocumentPage { impl SameDocumentPage { async fn new() -> Self { + Self::with_routes(axum::Router::new()).await + } + + async fn with_routes(routes: axum::Router) -> Self { let listener = TcpListener::bind("127.0.0.1:0").await.unwrap(); let addr = listener.local_addr().unwrap(); let download_requests = std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(0)); @@ -43,7 +49,7 @@ impl SameDocumentPage { } }), ); - axum::serve(listener, app).await.unwrap(); + axum::serve(listener, app.merge(routes)).await.unwrap(); }); let mut ctx = TestContext::new(); load_bc_with_session( diff --git a/moli-protocol/src/domains/page/tests/same_document_history/popup_network_navigation.rs b/moli-protocol/src/domains/page/tests/same_document_history/popup_network_navigation.rs new file mode 100644 index 00000000000..a020fcea976 --- /dev/null +++ b/moli-protocol/src/domains/page/tests/same_document_history/popup_network_navigation.rs @@ -0,0 +1,414 @@ +use super::*; +use std::sync::{ + Arc, + atomic::{AtomicUsize, Ordering}, +}; +use std::time::Duration; + +struct ResponseGate { + requests: AtomicUsize, + responses: AtomicUsize, + release: tokio::sync::Semaphore, +} + +impl ResponseGate { + async fn wait_for(counter: &AtomicUsize, expected: usize) { + tokio::time::timeout(Duration::from_secs(5), async { + while counter.load(Ordering::SeqCst) < expected { + tokio::time::sleep(Duration::from_millis(5)).await; + } + }) + .await + .expect("popup request must reach the response gate"); + } +} + +async fn gated_page() -> (SameDocumentPage, Arc) { + let gate = Arc::new(ResponseGate { + requests: AtomicUsize::new(0), + responses: AtomicUsize::new(0), + release: tokio::sync::Semaphore::new(0), + }); + let observed = gate.clone(); + let routes = axum::Router::new().route( + "/popup-response.html", + axum::routing::get(move |uri: axum::http::Uri| { + let gate = observed.clone(); + async move { + use axum::response::IntoResponse; + let visit = gate.requests.fetch_add(1, Ordering::SeqCst) + 1; + let query = uri.query().unwrap_or(""); + // A reload first commits this URL, then waits at the same gate. + if !(query.contains("reload") && visit == 1) { + gate.release.acquire().await.unwrap().forget(); + } + gate.responses.fetch_add(1, Ordering::SeqCst); + if query.contains("redirect") { + return axum::response::Redirect::to("/history.html?redirected") + .into_response(); + } + if query.contains("204") { + return axum::http::StatusCode::NO_CONTENT.into_response(); + } + if query.contains("205") { + return axum::http::StatusCode::RESET_CONTENT.into_response(); + } + let mut response = ( + [(axum::http::header::CONTENT_TYPE, "text/html")], + format!("Popup response {visit}

Committed

"), + ) + .into_response(); + if query.contains("attachment") { + response.headers_mut().insert( + axum::http::header::CONTENT_DISPOSITION, + axum::http::HeaderValue::from_static("attachment; filename=popup.txt"), + ); + } + response + } + }), + ); + (SameDocumentPage::with_routes(routes).await, gate) +} + +const SETUP: &str = r#"(async () => { + globalThis.popup = open(INITIAL_URL, 'network-popup'); + await new Promise(resolve => popup.addEventListener('load', resolve, {once:true})); + await new Promise(resolve => setTimeout(resolve, 0)); + globalThis.popupDocument = popup.document; + globalThis.popupNavigation = popup.navigation; + globalThis.popupEntry = popupNavigation.currentEntry; + globalThis.popupEvents = []; + globalThis.popupStates = {}; + globalThis.popupReasons = []; + globalThis.popupSignals = []; + globalThis.PopupDOMException = popup.DOMException; + globalThis.popupInitial = {href: popup.location.href, length: popup.history.length, index: popupEntry.index}; + globalThis.observePopupResult = result => { + for (const key of ['committed', 'finished']) result[key].then( + () => popupStates[key] = 'fulfilled', + error => { popupStates[key] = error.name; popupReasons.push(error); } + ); + }; + popupNavigation.addEventListener('navigate', event => { + popupEvents.push('navigate:' + event.navigationType); + popupSignals.push(event.signal); + event.signal.addEventListener('abort', () => popupEvents.push('abort')); + }); + popupNavigation.addEventListener('navigateerror', event => { + popupEvents.push('error:' + event.error.name); popupReasons.push(event.error); + }); + popupNavigation.addEventListener('navigatesuccess', () => popupEvents.push('success')); + globalThis.popupSnapshot = () => ({ + closed: popup.closed, + href: popup.location.href, + documentURL: popup.document.URL, + sameDocument: popup.document === popupDocument, + sameEntry: popupNavigation.currentEntry === popupEntry, + currentURL: popup.navigation.currentEntry?.url, + length: popup.closed ? null : popup.history.length, + index: popup.navigation.currentEntry?.index, + title: popup.document.title, + events: [...popupEvents], states: {...popupStates}, + aborted: popupSignals.map(signal => signal.aborted), + sameError: popupReasons.every(error => error === popupSignals[0].reason && error instanceof PopupDOMException), + }); + return popupInitial; +})()"#; + +async fn start_popup(page: &mut SameDocumentPage, reload: bool) -> serde_json::Value { + page.evaluate(&SETUP.replace( + "INITIAL_URL", + if reload { + "'popup-response.html?reload'" + } else { + "'history.html?initial-popup'" + }, + )) + .await +} + +fn assert_uncommitted(result: &serde_json::Value, initial: &serde_json::Value) { + assert_eq!(result["sameDocument"], true, "{result}"); + assert_eq!(result["sameEntry"], true, "{result}"); + for key in ["href", "documentURL", "currentURL"] { + assert_eq!(result[key], initial["href"], "{key}: {result}"); + } + for key in ["length", "index"] { + assert_eq!(result[key], initial[key], "{key}: {result}"); + } +} + +#[tokio::test(flavor = "multi_thread")] +async fn popup_network_navigation_commits_only_after_response_and_can_be_stopped() { + for operation in [ + "navigate-push", + "navigate-replace", + "location-assign", + "location-replace", + "reload", + ] { + for action in ["commit", "stop", "borrow-stop", "close"] { + let (mut page, gate) = gated_page().await; + let reload = operation == "reload"; + let initial = start_popup(&mut page, reload).await; + let command = match operation { + "navigate-push" => { + "observePopupResult(popupNavigation.navigate('popup-response.html', {history:'push'}))" + } + "navigate-replace" => { + "observePopupResult(popupNavigation.navigate('popup-response.html', {history:'replace'}))" + } + "location-assign" => "popup.location.assign('popup-response.html')", + "location-replace" => "popup.location.replace('popup-response.html')", + "reload" => "observePopupResult(popupNavigation.reload())", + _ => unreachable!(), + }; + let started = page.evaluate(&format!("{command}; popupSnapshot()")).await; + assert_uncommitted(&started, &initial); + let kind = if reload { + "reload" + } else if operation.ends_with("replace") { + "replace" + } else { + "push" + }; + assert_eq!( + started["events"], + json!([format!("navigate:{kind}")]), + "{operation}/{action}: {started}" + ); + assert_eq!(started["aborted"], json!([false])); + assert_eq!(started["states"], json!({})); + let requests = if reload { 2 } else { 1 }; + ResponseGate::wait_for(&gate.requests, requests).await; + let while_pending = page.evaluate("popupSnapshot()").await; + assert_uncommitted(&while_pending, &initial); + match action { + "stop" => { + page.evaluate("popup.stop(); void 0").await; + } + "borrow-stop" => { + page.evaluate("window.stop.call(popup); void 0").await; + } + "close" => { + page.evaluate("popup.close(); void 0").await; + } + _ => {} + } + gate.release.add_permits(1); + ResponseGate::wait_for(&gate.responses, requests).await; + let result = page.evaluate(if action == "commit" { + "(async () => { for(let n=0;n<500 && popup.document===popupDocument;n++)await new Promise(r=>setTimeout(r,5));return popupSnapshot(); })()" + } else { + "new Promise(r=>setTimeout(r,100)).then(()=>popupSnapshot())" + }).await; + if action == "commit" { + assert_eq!(result["sameDocument"], false, "{operation}: {result}"); + let expected_length = + initial["length"].as_u64().unwrap() + u64::from(kind == "push"); + assert_eq!(result["length"], expected_length, "{operation}: {result}"); + assert_eq!(result["currentURL"], result["href"]); + assert_eq!(result["documentURL"], result["href"]); + assert_eq!(result["title"], format!("Popup response {requests}")); + assert_eq!(result["aborted"], json!([false])); + // The old realm's method promises intentionally remain pending. + assert_eq!(result["states"], json!({})); + } else { + if action == "close" { + assert_eq!(result["closed"], true, "{operation}: {result}"); + assert_eq!(result["sameDocument"], true); + } else { + assert_uncommitted(&result, &initial); + } + assert_eq!( + result["aborted"], + json!([true]), + "{operation}/{action}: {result}" + ); + assert_eq!( + result["events"], + json!([ + format!("navigate:{kind}"), + "abort".to_owned(), + "error:AbortError".to_owned() + ]) + ); + assert_eq!( + result["states"], + if operation.starts_with("navigate") || reload { + json!({"committed":"AbortError","finished":"AbortError"}) + } else { + json!({}) + } + ); + assert_eq!(result["sameError"], true, "{operation}/{action}: {result}"); + } + page.evaluate("popup.close(); void 0").await; + page.assert_history(&[""], 0).await; + } + } +} + +#[tokio::test(flavor = "multi_thread")] +async fn popup_ignored_navigation_keeps_history_and_promises_until_superseded() { + for response in ["204", "205", "attachment"] { + for api in [true, false] { + let (mut page, gate) = gated_page().await; + page.allow_downloads().await; + let initial = start_popup(&mut page, false).await; + let target = json!(format!("popup-response.html?{response}")); + page.evaluate(&if api { + format!("observePopupResult(popupNavigation.navigate({target}));void 0") + } else { + format!("popup.location.href={target};void 0") + }) + .await; + ResponseGate::wait_for(&gate.requests, 1).await; + gate.release.add_permits(1); + ResponseGate::wait_for(&gate.responses, 1).await; + let ignored = page + .evaluate("new Promise(r=>setTimeout(r,100)).then(()=>popupSnapshot())") + .await; + assert_uncommitted(&ignored, &initial); + assert_eq!(ignored["states"], json!({}), "{response}/{api}: {ignored}"); + assert_eq!(ignored["events"], json!(["navigate:push"])); + assert_eq!(ignored["aborted"], json!([false])); + let next = page.evaluate("(async () => {await popupNavigation.navigate('#next').finished;return popupSnapshot();})()").await; + assert_eq!( + next["states"], + if api { + json!({"committed":"AbortError","finished":"AbortError"}) + } else { + json!({}) + } + ); + assert_eq!(next["aborted"], json!([true, false])); + assert_eq!(next["sameError"], true); + assert_eq!(next["sameDocument"], true); + assert_eq!( + next["events"], + json!([ + "navigate:push", + "abort", + "error:AbortError", + "navigate:push", + "success" + ]) + ); + page.evaluate("popup.close(); void 0").await; + } + } +} + +#[tokio::test(flavor = "multi_thread")] +async fn popup_network_navigation_ignores_new_state_and_commits_redirect_url() { + for operation in ["push", "replace", "reload", "redirect"] { + let (mut page, gate) = gated_page().await; + let initial = start_popup(&mut page, operation == "reload").await; + let started = page.evaluate(&r#"(() => { + popupNavigation.updateCurrentEntry({state:{previous:true}}); + popupNavigation.addEventListener('navigate',event=>globalThis.popupDestinationState=event.destination.getState(),{once:true}); + const state={map:new Map([['answer',42]]),bytes:new Uint8Array([7,8])};state.self=state; + globalThis.suppliedState=state; + const operation=OPERATION; + observePopupResult(operation==='reload' ? popupNavigation.reload({state}) : popupNavigation.navigate('popup-response.html'+(operation==='redirect'?'?redirect':''),{state,history:operation==='replace'?'replace':'push'})); + state.map.set('answer',99);state.bytes[0]=0; + return popupSnapshot(); + })()"#.replace("OPERATION", &json!(operation).to_string())).await; + assert_uncommitted(&started, &initial); + let requests = if operation == "reload" { 2 } else { 1 }; + ResponseGate::wait_for(&gate.requests, requests).await; + gate.release.add_permits(1); + let result = page.evaluate(r#"(async () => { + for(let n=0;n<500 && popup.document===popupDocument;n++) await new Promise(r=>setTimeout(r,5)); + const state=popup.navigation.currentEntry.getState(),destination=popupDestinationState; + return {snapshot:popupSnapshot(),state,checks:{destination:!!destination,cycle:destination?.self===destination,map:destination?.map?.get('answer')===42,bytes:destination?.bytes?.[0]===7,clone:destination!==suppliedState,newStateIgnored:!state?.self}}; + })()"#).await; + assert_eq!( + result["snapshot"]["sameDocument"], false, + "{operation}: {result}" + ); + assert!( + result["checks"] + .as_object() + .unwrap() + .values() + .all(|v| v == true), + "{operation}: {result}" + ); + if operation == "reload" { + assert_eq!(result["state"], json!({"previous":true})); + } else { + assert!(result["state"].is_null(), "{operation}: {result}"); + } + assert_eq!(result["snapshot"]["href"], result["snapshot"]["currentURL"]); + if operation == "redirect" { + assert!( + result["snapshot"]["href"] + .as_str() + .unwrap() + .ends_with("/history.html?redirected") + ); + } + page.evaluate("popup.close(); void 0").await; + } +} + +#[tokio::test(flavor = "multi_thread")] +async fn popup_network_stop_rejects_reentrant_navigation_and_discards_late_response() { + for listener in ["abort", "navigateerror"] { + for operation in ["navigate", "fragment", "location", "reload"] { + let (mut page, gate) = gated_page().await; + let initial = start_popup(&mut page, false).await; + page.evaluate( + "observePopupResult(popupNavigation.navigate('popup-response.html'));void 0", + ) + .await; + ResponseGate::wait_for(&gate.requests, 1).await; + let stopped = page.evaluate(&r#"(async () => { + const reenter=()=>{ + const operation=OPERATION; + if(operation==='location'){popup.location.href='history.html?reentrant';return;} + const result=operation==='reload'?popupNavigation.reload():popupNavigation.navigate(operation==='fragment'?'#reentrant':'history.html?reentrant'); + for(const key of ['committed','finished'])result[key].then(()=>popupStates['reentrant'+key]='fulfilled',e=>popupStates['reentrant'+key]=e.name); + }; + if(LISTENER==='abort')popupSignals[0].addEventListener('abort',reenter,{once:true}); + else popupNavigation.addEventListener('navigateerror',reenter,{once:true}); + popup.stop();await new Promise(r=>setTimeout(r,0));return popupSnapshot(); + })()"#.replace("OPERATION", &json!(operation).to_string()).replace("LISTENER", &json!(listener).to_string())).await; + assert_uncommitted(&stopped, &initial); + assert_eq!( + stopped["events"], + json!(["navigate:push", "abort", "error:AbortError"]) + ); + assert_eq!(stopped["aborted"], json!([true])); + assert_eq!(stopped["sameError"], true); + let mut expected = json!({"committed":"AbortError","finished":"AbortError"}); + if operation != "location" { + expected["reentrantcommitted"] = json!("AbortError"); + expected["reentrantfinished"] = json!("AbortError"); + } + assert_eq!( + stopped["states"], expected, + "{listener}/{operation}: {stopped}" + ); + gate.release.add_permits(1); + ResponseGate::wait_for(&gate.responses, 1).await; + let final_state = page + .evaluate("new Promise(r=>setTimeout(r,100)).then(()=>popupSnapshot())") + .await; + assert_eq!( + final_state, stopped, + "late response after {listener}/{operation}" + ); + // The stop guard must not suppress a later ordinary navigation. + page.evaluate("popup.location.href='history.html?after-stop';void 0") + .await; + let recovered = page.evaluate("(async()=>{for(let n=0;n<500&&popup.document===popupDocument;n++)await new Promise(r=>setTimeout(r,5));return popupSnapshot();})()").await; + assert_eq!(recovered["sameDocument"], false, "{recovered}"); + assert!(recovered["href"].as_str().unwrap().ends_with("?after-stop")); + page.evaluate("popup.close();void 0").await; + } + } +} diff --git a/moli-renderer-v8/src/context_bootstrap.rs b/moli-renderer-v8/src/context_bootstrap.rs index 00f07490025..f7201694237 100644 --- a/moli-renderer-v8/src/context_bootstrap.rs +++ b/moli-renderer-v8/src/context_bootstrap.rs @@ -208,7 +208,7 @@ pub(crate) use history_mutation::update_history_for_document_open; pub(crate) use location_navigation::{ LocationNavigationKind, dispatch_top_level_form_navigation_event, dispatch_top_level_navigation_event_with_source_element, - history_entry_seed_for_cross_document_location, is_native_location, navigate_borrowed_location, + history_entry_seed_for_cross_document_location, history_entry_seed_for_location_kind, is_native_location, navigate_borrowed_location, navigate_child_meta_refresh, navigate_location_object_with_child_navigate_event, navigate_location_object_with_source_element, navigate_top_level_meta_refresh, navigate_top_level_same_document_from_browser, resolve_cross_window_location_target, @@ -233,6 +233,7 @@ pub(crate) use navigation_history_pruning::{ NavigationHistoryPrunePlan, apply_navigation_history_prune_plan, finalize_navigation_history_prune, plan_navigation_history_prune, }; +pub(crate) use navigation_result::finish_cross_document_navigation_for_window; pub(crate) use navigation_result::{ NavigationFinishedResultApplication, apply_pending_navigation_finished_result, }; diff --git a/moli-renderer-v8/src/context_bootstrap/location_navigation.rs b/moli-renderer-v8/src/context_bootstrap/location_navigation.rs index c1f473bde39..f77f44636f8 100644 --- a/moli-renderer-v8/src/context_bootstrap/location_navigation.rs +++ b/moli-renderer-v8/src/context_bootstrap/location_navigation.rs @@ -505,7 +505,9 @@ fn navigate_location_object_with_options<'s>( return; } let owner = runtime_window_owner(scope, location); - if navigation_unload_event_active(scope, owner) { + if navigation_unload_event_active(scope, owner) + || super::navigation_cancellation::window_navigation_is_stopping(scope, owner) + { return; } if sandbox_blocks_ancestor_or_top_location_navigation(scope, owner) { @@ -815,7 +817,9 @@ fn navigate_location_object_with_options<'s>( return; } - if let Some(popup_id) = popup_id { + if let Some(popup_id) = popup_id + && resolved.scheme() == "javascript" + { if let Some(host_ptr) = context_host_ptr_from_global_bridge(scope) { let _ = unsafe { &mut *host_ptr } .navigate_lightweight_popup_window_to_url(scope, popup_id, resolved, kind); @@ -828,7 +832,9 @@ fn navigate_location_object_with_options<'s>( } else { child_browsing_context_handle_for_runtime_owner(scope, owner) }; - if let Some(handle) = child_handle { + if popup_id.is_none() + && let Some(handle) = child_handle + { let is_javascript_url = resolved.scheme() == "javascript"; let host_ptr = context_host_ptr_for_navigation_owner(scope, owner); let replaces_initial_empty_document = !is_javascript_url @@ -925,10 +931,16 @@ fn navigate_top_level_cross_document_location<'s>( navigate_event: Option>, navigation_source: Option, ) { + let popup_id = crate::native_bridge::lightweight_popup_id_from_window(scope, owner); if let Some(event) = navigate_event && let Some(navigation) = super::navigation_window::window_navigation_for_holder(scope, owner) { + if popup_id.is_some() { + super::navigation_result::cancel_active_cross_document_navigation( + scope, navigation, None, + ); + } let _ = cancel_active_navigation_event(scope, navigation); cancel_pending_precommit_same_document_navigation(scope, navigation); cancel_pending_precommit_history_traversal(scope, navigation); @@ -978,6 +990,22 @@ fn navigate_top_level_cross_document_location<'s>( ); return; } + if popup_id.is_some() { + super::navigation_result::track_cross_document_location_navigation( + scope, + navigation, + outcome.signal, + resolved.as_str(), + ); + } + } + + if let Some(popup_id) = popup_id { + if let Some(host_ptr) = context_host_ptr_from_global_bridge(scope) { + let _ = unsafe { &mut *host_ptr } + .navigate_lightweight_popup_window_to_url(scope, popup_id, resolved, kind); + } + return; } if let Some(location) = location @@ -989,21 +1017,7 @@ fn navigate_top_level_cross_document_location<'s>( let Some(host_ptr) = context_host_ptr_from_global_bridge(scope) else { return; }; - let entry_seed = match kind { - LocationNavigationKind::Assign => history_entry_seed_for_cross_document_location( - scope, - owner, - &resolved, - NavigationHistoryMutation::Push, - ), - LocationNavigationKind::Replace => history_entry_seed_for_cross_document_location( - scope, - owner, - &resolved, - NavigationHistoryMutation::Replace, - ), - LocationNavigationKind::Reload => history_entry_seed_for_reload(scope, owner), - }; + let entry_seed = history_entry_seed_for_location_kind(scope, owner, &resolved, kind); unsafe { &mut *host_ptr }.record_pending_location_navigation_with_kind( resolved, entry_seed, @@ -1470,6 +1484,29 @@ fn child_history_entry_seed_for_location( Some(seed) } +pub(crate) fn history_entry_seed_for_location_kind<'s>( + scope: &mut v8::PinScope<'s, '_>, + owner: v8::Local<'s, v8::Object>, + resolved: &url::Url, + kind: LocationNavigationKind, +) -> Option { + match kind { + LocationNavigationKind::Assign => history_entry_seed_for_cross_document_location( + scope, + owner, + resolved, + NavigationHistoryMutation::Push, + ), + LocationNavigationKind::Replace => history_entry_seed_for_cross_document_location( + scope, + owner, + resolved, + NavigationHistoryMutation::Replace, + ), + LocationNavigationKind::Reload => history_entry_seed_for_reload(scope, owner), + } +} + pub(crate) fn history_entry_seed_for_cross_document_location<'s>( scope: &mut v8::PinScope<'s, '_>, owner: v8::Local<'s, v8::Object>, diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_callbacks/navigation.rs b/moli-renderer-v8/src/context_bootstrap/navigation_callbacks/navigation.rs index 15f0e3f64b7..e0131b5bdc5 100644 --- a/moli-renderer-v8/src/context_bootstrap/navigation_callbacks/navigation.rs +++ b/moli-renderer-v8/src/context_bootstrap/navigation_callbacks/navigation.rs @@ -148,6 +148,13 @@ pub(in crate::context_bootstrap) fn navigation_navigate_callback<'s>( rv.set(navigation_pending_result(scope).into()); return; } + if super::super::navigation_cancellation::window_navigation_is_stopping(scope, owner) { + rv.set( + navigation_rejected_dom_exception_result(scope, "Navigation was stopped", "AbortError") + .into(), + ); + return; + } if navigation_unload_event_active(scope, owner) { rv.set( navigation_rejected_invalid_state_result( diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_cancellation.rs b/moli-renderer-v8/src/context_bootstrap/navigation_cancellation.rs index 386cd52027a..3f94bd8a11d 100644 --- a/moli-renderer-v8/src/context_bootstrap/navigation_cancellation.rs +++ b/moli-renderer-v8/src/context_bootstrap/navigation_cancellation.rs @@ -20,6 +20,13 @@ use crate::util::{context_host_ptr_from_global_bridge, get_private_value, set_pr const WINDOW_STOP_ACTIVE_SLOT: &str = "__lmWindowStopActive"; +pub(super) fn window_navigation_is_stopping<'s>( + scope: &mut v8::PinScope<'s, '_>, + window: v8::Local<'s, v8::Object>, +) -> bool { + get_private_value(scope, window, WINDOW_STOP_ACTIVE_SLOT).is_some_and(|value| value.is_true()) +} + struct WindowNavigationStop { target: WindowDocumentTaskTarget, binding: Option, @@ -83,8 +90,7 @@ impl WindowNavigationStop { binding.with_current_scope(scope, host_ptr, |scope, _| { let window = v8::Local::new(scope, window); if navigation_unload_event_active(scope, window) - || get_private_value(scope, window, WINDOW_STOP_ACTIVE_SLOT) - .is_some_and(|value| value.is_true()) + || window_navigation_is_stopping(scope, window) { return; } @@ -162,6 +168,13 @@ fn stop_navigation_for_window<'s>( if navigation_unload_event_active(scope, window) { return; } + if let Some(OwnerDispatchScope::LightweightPopup(popup_id)) = + runtime_window_dispatch_scope(scope, window) + && let Some(host_ptr) = context_host_ptr_from_global_bridge(scope) + && unsafe { &*host_ptr }.lightweight_popup_has_pending_history_traversal(popup_id) + { + return; + } inform_about_canceled_navigation_for_window( scope, window, @@ -218,6 +231,9 @@ pub(super) fn clear_pending_cross_document_navigation_for_window<'s>( { host.cancel_pending_child_browsing_context_navigation(handle); } + Some(crate::native_bridge::OwnerDispatchScope::LightweightPopup(popup_id)) => { + host.cancel_pending_lightweight_popup_navigation(popup_id); + } _ => {} } } diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_cross_document.rs b/moli-renderer-v8/src/context_bootstrap/navigation_cross_document.rs index 761b254211f..d3dd2c8d84a 100644 --- a/moli-renderer-v8/src/context_bootstrap/navigation_cross_document.rs +++ b/moli-renderer-v8/src/context_bootstrap/navigation_cross_document.rs @@ -97,6 +97,35 @@ pub(super) fn handle_navigation_navigate_cross_document<'s>( .into(); } + if let Some(popup_id) = crate::native_bridge::lightweight_popup_id_from_window(scope, owner) + && let Some(host_ptr) = context_host_ptr_from_global_bridge(scope) + { + let entry_seed = cross_document_navigation_seed( + entries, + current_index, + current_navigation_index, + next_url, + mutation, + ); + let result = navigation_signal + .map(|(navigation, signal)| { + navigation_cross_document_pending_result( + scope, + navigation, + signal, + next_url.as_str(), + ) + }) + .unwrap_or_else(|| navigation_pending_result(scope)); + unsafe { &mut *host_ptr }.queue_lightweight_popup_cross_document_navigation( + scope, + popup_id, + next_url.as_str(), + entry_seed, + ); + return result.into(); + } + let Some(child_handle) = child_browsing_context_handle_for_runtime_owner(scope, owner) else { return navigation_pending_result(scope).into(); }; diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_result.rs b/moli-renderer-v8/src/context_bootstrap/navigation_result.rs index 781ac0e46f5..395dbed703a 100644 --- a/moli-renderer-v8/src/context_bootstrap/navigation_result.rs +++ b/moli-renderer-v8/src/context_bootstrap/navigation_result.rs @@ -54,9 +54,9 @@ struct CrossDocumentPendingNavigationDeclaration<'scope> { #[webapi(slot = CROSS_DOCUMENT_PENDING_SIGNAL_SLOT)] signal: Option>, #[webapi(slot = CROSS_DOCUMENT_PENDING_COMMITTED_REJECT_SLOT)] - committed_reject: v8::Local<'scope, v8::Function>, + committed_reject: Option>, #[webapi(slot = CROSS_DOCUMENT_PENDING_FINISHED_REJECT_SLOT)] - finished_reject: v8::Local<'scope, v8::Function>, + finished_reject: Option>, #[webapi(slot = CROSS_DOCUMENT_PENDING_HREF_SLOT)] href: v8::Local<'scope, v8::Value>, } @@ -160,8 +160,8 @@ pub(super) fn navigation_cross_document_pending_result<'s>( .unwrap_or_else(|| v8::String::empty(scope).into()); let data = CrossDocumentPendingNavigationDeclaration::new( signal, - committed_reject, - finished_reject, + Some(committed_reject), + Some(finished_reject), href, ) .bind(scope) @@ -170,6 +170,21 @@ pub(super) fn navigation_cross_document_pending_result<'s>( navigation_result_object(scope, committed, finished) } +pub(super) fn track_cross_document_location_navigation<'s>( + scope: &mut v8::PinScope<'s, '_>, + navigation: v8::Local<'s, v8::Object>, + signal: Option>, + href: &str, +) { + let href = v8_string(scope, href) + .map(v8::Local::::from) + .unwrap_or_else(|| v8::String::empty(scope).into()); + let data = CrossDocumentPendingNavigationDeclaration::new(signal, None, None, href) + .bind(scope) + .expect("cross-document Location navigation declaration should bind"); + set_navigation_active_cross_document_pending(scope, navigation, data); +} + pub(super) fn navigation_immediate_current_entry_result<'s>( scope: &mut v8::PinScope<'s, '_>, owner: v8::Local<'s, v8::Object>, @@ -405,6 +420,17 @@ pub(super) fn clear_active_cross_document_navigation_if_matches<'s>( } } +pub(crate) fn finish_cross_document_navigation_for_window<'s>( + scope: &mut v8::PinScope<'s, '_>, + window: v8::Local<'s, v8::Object>, + href: &str, +) { + if let Some(navigation) = super::navigation_window::window_navigation_for_holder(scope, window) + { + clear_active_cross_document_navigation_if_matches(scope, navigation, href); + } +} + pub(super) fn cancel_pending_same_document_navigation_finishes_including_reentrant<'s>( scope: &mut v8::PinScope<'s, '_>, navigation: v8::Local<'s, v8::Object>, diff --git a/moli-renderer-v8/src/context_bootstrap/navigation_traversal.rs b/moli-renderer-v8/src/context_bootstrap/navigation_traversal.rs index 61b5d7b7907..9081fc3e152 100644 --- a/moli-renderer-v8/src/context_bootstrap/navigation_traversal.rs +++ b/moli-renderer-v8/src/context_bootstrap/navigation_traversal.rs @@ -25,6 +25,7 @@ use super::navigation_lifecycle::finish_navigation_error_events; use super::navigation_projection::visible_navigation_entries_len; use super::navigation_reload::{NavigationReloadAdmission, navigation_reload_admission}; use super::navigation_result::{ + cancel_active_cross_document_navigation, navigation_cross_document_pending_result, navigation_current_entry_result_with_pending_finished, navigation_dom_exception, navigation_immediate_current_entry_result, navigation_pending_result, navigation_rejected_dom_exception_result, navigation_rejected_invalid_state_result, @@ -262,9 +263,19 @@ pub(super) fn navigation_reload_callback<'s>( rv.set(navigation_pending_result(scope).into()); return; } + if super::navigation_cancellation::window_navigation_is_stopping(scope, owner) { + rv.set( + navigation_rejected_dom_exception_result(scope, "Navigation was stopped", "AbortError") + .into(), + ); + return; + } if navigation_document_can_update_current_entry(scope, owner) && let Some(navigation) = window_navigation_for_holder(scope, owner) { + if crate::native_bridge::lightweight_popup_id_from_window(scope, owner).is_some() { + cancel_active_cross_document_navigation(scope, navigation, None); + } let _ = cancel_active_navigation_event(scope, navigation); cancel_pending_precommit_same_document_navigation(scope, navigation); cancel_pending_precommit_history_traversal(scope, navigation); @@ -374,6 +385,26 @@ pub(super) fn navigation_reload_callback<'s>( rv.set(pending.object.into()); return; } + if let Some(popup_id) = crate::native_bridge::lightweight_popup_id_from_window(scope, owner) + && let Some(host_ptr) = context_host_ptr_from_global_bridge(scope) + && let Some(entry_seed) = + super::navigation_seed::history_entry_seed_for_reload(scope, owner) + { + let result = navigation_cross_document_pending_result( + scope, + navigation, + outcome.signal, + ¤t_href, + ); + unsafe { &mut *host_ptr }.queue_lightweight_popup_cross_document_navigation( + scope, + popup_id, + ¤t_href, + entry_seed, + ); + rv.set(result.into()); + return; + } } navigate_location_object(scope, location, LocationNavigationKind::Reload, None); rv.set(navigation_pending_result(scope).into()); diff --git a/moli-renderer-v8/src/native_bridge/context_host/popups.rs b/moli-renderer-v8/src/native_bridge/context_host/popups.rs index 532e22c6393..2f781489c93 100644 --- a/moli-renderer-v8/src/native_bridge/context_host/popups.rs +++ b/moli-renderer-v8/src/native_bridge/context_host/popups.rs @@ -8,8 +8,10 @@ use crate::{ SIMPLE_EVENT_TARGET_LISTENERS_SLOT, SharedWebStorageStore, WINDOW_NAME_SLOT, apply_local_window_location_navigation, clear_simple_window_event_handler_values, deep_clone_shared_web_storage_store, dispatch_simple_event_target_event, - initialize_simple_event_target, install_navigation_bootstrap_entry_for_holder, - install_simple_window_event_handlers, install_storage_aliases_for_window, + finish_cross_document_navigation_for_window, + history_entry_seed_for_location_kind, initialize_simple_event_target, + install_navigation_bootstrap_entry_for_holder, install_simple_window_event_handlers, + install_storage_aliases_for_window, install_window_location_history_navigation_runtime_state, new_shared_web_storage_store, scoped_indexed_db_factory, sync_document_location_runtime_state_from_window, sync_window_location_history_navigation_runtime_surface, @@ -187,8 +189,47 @@ pub(super) struct PendingLightweightPopupDocumentLoad { pub(super) previous_url: Url, pub(super) target: LightweightPopupDocumentFetchTarget, pub(super) document_state: LightweightPopupDocumentState, + history: PendingLightweightPopupHistory, pub(super) resource_loader: Option, - history_traversal: bool, +} + +#[derive(Debug, Clone)] +enum PendingLightweightPopupHistory { + Initial, + Navigation(NavigationHistoryEntrySeed), + Traversal(NavigationHistoryEntrySeed), +} + +impl PendingLightweightPopupHistory { + fn entry_seed(&self) -> Option<&NavigationHistoryEntrySeed> { + match self { + Self::Initial => None, + Self::Navigation(seed) | Self::Traversal(seed) => Some(seed), + } + } + + fn install<'s>( + &self, + scope: &mut v8::PinScope<'s, '_>, + window: v8::Local<'s, v8::Object>, + final_url: &Url, + ) { + let Some(seed) = self.entry_seed() else { + return; + }; + let mut seed = seed.clone(); + if let Some(entry) = seed + .entries + .iter_mut() + .find(|entry| entry.history_index == seed.current_index) + { + entry.url = final_url.as_str().to_owned(); + } + if let Some(activation) = seed.activation.as_mut() { + activation.entry.url = final_url.as_str().to_owned(); + } + install_navigation_bootstrap_entry_for_holder(scope, window, &seed); + } } struct LightweightPopupClassicScriptContinuation { @@ -1130,6 +1171,7 @@ impl PageScriptHost { about_blank_url(), initial_document_state, response, + PendingLightweightPopupHistory::Initial, ) .is_none() }; @@ -1183,13 +1225,14 @@ impl PageScriptHost { return Some(window); } let document_owner = navigation_task.document_owner(); - self.apply_lightweight_popup_location_navigation( + let history = history_entry_seed_for_location_kind( scope, - popup_id, window, &target_url, crate::context_bootstrap::LocationNavigationKind::Assign, - ); + ) + .map(PendingLightweightPopupHistory::Navigation) + .unwrap_or(PendingLightweightPopupHistory::Initial); let queue_synthetic_load = if moli_url::is_about_blank(&target_url) { let storage_scope = self.lightweight_popup_storage_scope_for_initiated_navigation( scope, @@ -1231,6 +1274,7 @@ impl PageScriptHost { return Some(window); } self.unregister_service_worker_popup_client(popup_id); + history.install(scope, window, &target_url); self.install_lightweight_popup_empty_document(scope, popup_id, window, target_url); true } else { @@ -1240,6 +1284,7 @@ impl PageScriptHost { previous_url, navigation_state, response, + history, ) .is_none() }; @@ -1667,7 +1712,11 @@ impl PageScriptHost { self.pending_lightweight_popup_document_loads .values() .any(|pending| { - pending.target.task().popup_id() == popup_id && pending.history_traversal + pending.target.task().popup_id() == popup_id + && matches!( + pending.history, + PendingLightweightPopupHistory::Traversal(_) + ) }) } @@ -1682,6 +1731,25 @@ impl PageScriptHost { .is_some_and(|record| record.is_open() && !record.auxiliary_window.is_popup()) } + pub(crate) fn cancel_pending_lightweight_popup_navigation(&mut self, popup_id: u64) { + if !self.lightweight_popup_has_pending_document_load(popup_id) { + return; + } + self.cancel_lightweight_popup_document_loads(popup_id); + if let Some(record) = self.lightweight_popup_record_mut(popup_id) { + record.navigation_id = LightweightPopupNavigationId::new( + record + .navigation_id + .as_u64() + .checked_add(1) + .expect("lightweight popup navigation id space exhausted"), + ); + if let LightweightPopupLifecycle::Open(open) = &record.lifecycle { + record.location_url = open.document.url.clone(); + } + } + } + pub(crate) fn lightweight_popup_is_open(&self, popup_id: u64) -> bool { self.lightweight_popup_record(popup_id) .is_some_and(LightweightPopupBrowsingContextRecord::is_open) @@ -1891,13 +1959,10 @@ impl PageScriptHost { return true; } - self.apply_lightweight_popup_location_navigation( - scope, - popup_id, - window, - &target_url, - kind, - ); + let history = + history_entry_seed_for_location_kind(scope, window, &target_url, kind) + .map(PendingLightweightPopupHistory::Navigation) + .unwrap_or(PendingLightweightPopupHistory::Initial); if self .start_lightweight_popup_document_load( navigation_task, @@ -1905,6 +1970,7 @@ impl PageScriptHost { previous_url, navigation_state, response, + history, ) .is_none() { @@ -1919,6 +1985,36 @@ impl PageScriptHost { popup_id: u64, target_url: &str, entry_seed: NavigationHistoryEntrySeed, + ) -> bool { + self.queue_lightweight_popup_entry_navigation( + scope, + popup_id, + target_url, + PendingLightweightPopupHistory::Traversal(entry_seed), + ) + } + + pub(crate) fn queue_lightweight_popup_cross_document_navigation( + &mut self, + scope: &mut v8::PinScope<'_, '_>, + popup_id: u64, + target_url: &str, + entry_seed: NavigationHistoryEntrySeed, + ) -> bool { + self.queue_lightweight_popup_entry_navigation( + scope, + popup_id, + target_url, + PendingLightweightPopupHistory::Navigation(entry_seed), + ) + } + + fn queue_lightweight_popup_entry_navigation( + &mut self, + scope: &mut v8::PinScope<'_, '_>, + popup_id: u64, + target_url: &str, + history: PendingLightweightPopupHistory, ) -> bool { if !self.lightweight_popup_is_open(popup_id) { return false; @@ -1945,18 +2041,10 @@ impl PageScriptHost { return false; }; let document_owner = navigation_task.document_owner(); - install_navigation_bootstrap_entry_for_holder(scope, window, &entry_seed); let base_url = self .lightweight_popup_base_url(scope, popup_id) .unwrap_or_else(|| target_url.clone()); let document_referrer = navigation_state.policy_container.document_referrer.clone(); - sync_lightweight_popup_window_location( - scope, - window, - target_url.as_str(), - &base_url, - &document_referrer, - ); if moli_url::is_about_blank(&target_url) { navigation_state.reset_for_empty_document(target_url.clone()); if !self.commit_lightweight_popup_document( @@ -1979,25 +2067,31 @@ impl PageScriptHost { if !self.lightweight_popup_committed_navigation_task_is_current(navigation_task) { return true; } + finish_cross_document_navigation_for_window(scope, window, target_url.as_str()); + history.install(scope, window, &target_url); + sync_lightweight_popup_window_location( + scope, + window, + target_url.as_str(), + &base_url, + &document_referrer, + ); self.unregister_service_worker_popup_client(popup_id); self.install_lightweight_popup_empty_document(scope, popup_id, window, target_url); self.queue_lightweight_popup_load_event(navigation_task); return true; } - if let Some(load_id) = self.start_lightweight_popup_document_load( - navigation_task, - Request::get_with_url(target_url), - previous_url, - navigation_state, - None, - ) { - if let Some(pending) = self - .pending_lightweight_popup_document_loads - .get_mut(&load_id) - { - pending.history_traversal = true; - } - } else { + if self + .start_lightweight_popup_document_load( + navigation_task, + Request::get_with_url(target_url), + previous_url, + navigation_state, + None, + history, + ) + .is_none() + { self.queue_lightweight_popup_load_event(navigation_task); } true @@ -2411,8 +2505,13 @@ impl PageScriptHost { }) .collect::>(); for load_id in canceled_loads { - self.pending_lightweight_popup_document_loads - .remove(&load_id); + if let Some(pending) = self + .pending_lightweight_popup_document_loads + .remove(&load_id) + && let Some(loader) = pending.resource_loader + { + loader.cancel(); + } } } @@ -2521,6 +2620,7 @@ impl PageScriptHost { previous_url: Url, document_state: LightweightPopupDocumentState, response: Option, + history: PendingLightweightPopupHistory, ) -> Option { let popup_id = task.popup_id(); if !self.lightweight_popup_navigation_attempt_is_current(task) { @@ -2559,8 +2659,8 @@ impl PageScriptHost { previous_url, target, document_state: document_state.clone(), + history, resource_loader: resource_loader.clone(), - history_traversal: false, }, ); if let Some(snapshot) = local_snapshot { @@ -2816,6 +2916,12 @@ impl PageScriptHost { if !self.lightweight_popup_committed_navigation_task_is_current(task) { return PopupDocumentLoadApplication::Applied { body_activity }; } + finish_cross_document_navigation_for_window( + scope, + window, + pending.target_url.as_str(), + ); + pending.history.install(scope, window, &final_url); if matches!(final_url.scheme(), "http" | "https") { let _ = self.register_or_update_service_worker_popup_client( document_owner, diff --git a/moli-renderer-v8/src/script_vm/tests/browser_api/misc/extracted/popup_window.rs b/moli-renderer-v8/src/script_vm/tests/browser_api/misc/extracted/popup_window.rs index feedf0d6f10..a39afe6af7e 100644 --- a/moli-renderer-v8/src/script_vm/tests/browser_api/misc/extracted/popup_window.rs +++ b/moli-renderer-v8/src/script_vm/tests/browser_api/misc/extracted/popup_window.rs @@ -812,7 +812,7 @@ async fn window_open_named_lightweight_popup_reuse_pushes_history_and_back_trave .expect("named popup reopen should evaluate"); assert_eq!( reopened, - r#"{"sameWindow":true,"hrefIsSecond":true,"historyLength":2,"eventCount":1}"# + r#"{"sameWindow":true,"hrefIsSecond":false,"historyLength":1,"eventCount":1}"# ); advance_page_task_executor_until_eval_equals( &mut vm, @@ -822,6 +822,11 @@ async fn window_open_named_lightweight_popup_reuse_pushes_history_and_back_trave "second named popup document should load", ) .await; + assert_eq!( + vm.eval("[__namedPopup.history.length, __namedPopup.location.href === __namedPopupSecondUrl].join('|')") + .expect("named popup history should commit with its response"), + "2|true" + ); vm.eval("__namedPopup.history.back()") .expect("named popup history.back should queue"); @@ -974,7 +979,7 @@ async fn lightweight_popup_cross_document_navigation_clears_old_onload_handler() "#, ) .expect("popup onload clear reopen should evaluate"); - assert_eq!(reopened, "true|2|first-script|first-load|first-listener"); + assert_eq!(reopened, "true|1|first-script|first-load|first-listener"); advance_page_task_executor_until_eval_equals( &mut vm, &loader, @@ -983,6 +988,11 @@ async fn lightweight_popup_cross_document_navigation_clears_old_onload_handler() "second popup document load listener should run", ) .await; + assert_eq!( + vm.eval("String(__popupOnloadWindow.history.length)") + .expect("popup response should commit its history entry"), + "2" + ); let result = vm .eval("globalThis.__popupOnloadEvents.join('|')") @@ -1949,25 +1959,23 @@ async fn window_open_204_popup_ignores_navigation_and_preserves_initial_empty_hi window.opener.postMessage("loaded", "*") } `; - __popup204.location.href = "resources/code-injector.html?2&pipe=sub(none)&code=" + encodeURIComponent(code); + const target = "resources/code-injector.html?2&pipe=sub(none)&code=" + encodeURIComponent(code); + globalThis.__popup204RequestedUrl = new URL(target, document.URL).href; + __popup204.location.href = target; return [ __popup204.location.href, __popup204.history.length, __popup204Messages.length ].join("|"); })() -"# +"#, ) .expect("204 popup follow-up navigation should evaluate"); let expected_loaded_url_prefix = loaded_url.trim_end_matches("loaded.html").to_owned() + "resources/code-injector.html"; let after_navigation_parts = after_navigation.split('|').collect::>(); assert_eq!(after_navigation_parts.len(), 3); - assert!( - after_navigation_parts[0].starts_with(&expected_loaded_url_prefix), - "unexpected popup loaded URL: {}", - after_navigation_parts[0] - ); + assert_eq!(after_navigation_parts[0], "about:blank#foo"); assert_eq!(after_navigation_parts[1], "1"); assert_eq!(after_navigation_parts[2], "0"); @@ -1980,12 +1988,16 @@ async fn window_open_204_popup_ignores_navigation_and_preserves_initial_empty_hi ) .await; server.await.expect("popup 204 server should finish"); + let requested_url = vm + .eval("__popup204RequestedUrl") + .expect("popup requested URL should evaluate"); + assert!(requested_url.starts_with(&expected_loaded_url_prefix)); assert_eq!( vm.eval( "[__popup204.location.href, __popup204.history.length, __popup204Messages.join('|')].join('|')" ) .expect("popup 204 loaded result should evaluate"), - format!("{}|1|loaded", after_navigation_parts[0]) + format!("{requested_url}|1|loaded") ); } #[tokio::test] @@ -3255,7 +3267,7 @@ async fn noopener_hyperlink_reuses_an_existing_named_popup_and_preserves_its_ope globalThis.__namedNoopenerPopup = popup; globalThis.__namedNoopenerTargetUrl = targetUrl; link.click(); - return String(popup.location.href === targetUrl && popup.opener === window); + return String(popup.location.href === 'about:blank' && popup.opener === window); })() "#, ) @@ -3563,7 +3575,33 @@ async fn named_popup_broadcast_precedes_its_queued_close() { } #[test] -fn window_open_named_reuse_before_first_commit_pushes_history() { +fn window_open_initial_empty_history_push_is_a_replacement() { + let mut vm = new_storage_test_vm("https://initial-popup-history.test/page.html"); + + assert_eq!( + vm.eval( + r#" +(() => { + const popup = open(); + popup.history.pushState({ step: 1 }, '', 'about:blank#pushed'); + popup.history.replaceState({ step: 2 }, '', 'about:blank#replaced'); + const result = [ + popup.location.href, + popup.history.state.step, + popup.history.length, + ].join('|'); + popup.close(); + return result; +})() +"#, + ) + .expect("initial empty popup history mutation should evaluate"), + "about:blank#replaced|2|1" + ); +} + +#[test] +fn window_open_named_reuse_before_first_commit_keeps_history_pending() { let mut vm = new_storage_test_vm("https://example.com/base/page.html"); assert_eq!( @@ -3591,32 +3629,6 @@ fn window_open_named_reuse_before_first_commit_pushes_history() { "#, ) .expect("pending named popup reuse should evaluate"), - "true|true|2" - ); -} - -#[test] -fn window_open_initial_empty_history_push_is_a_replacement() { - let mut vm = new_storage_test_vm("https://initial-popup-history.test/page.html"); - - assert_eq!( - vm.eval( - r#" -(() => { - const popup = open(); - popup.history.pushState({ step: 1 }, '', 'about:blank#pushed'); - popup.history.replaceState({ step: 2 }, '', 'about:blank#replaced'); - const result = [ - popup.location.href, - popup.history.state.step, - popup.history.length, - ].join('|'); - popup.close(); - return result; -})() -"#, - ) - .expect("initial empty popup history mutation should evaluate"), - "about:blank#replaced|2|1" + "true|false|1" ); } diff --git a/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style/properties_and_selectors.rs b/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style/properties_and_selectors.rs index ea4c28621ad..0b4aa31809e 100644 --- a/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style/properties_and_selectors.rs +++ b/moli-renderer-v8/src/script_vm/tests/dom_xhr/computed_style/properties_and_selectors.rs @@ -1213,7 +1213,7 @@ async fn popup_held_computed_style_wrapper_is_empty_after_loaded_navigation() { ) .expect("popup loaded held computed style setup should evaluate"); - assert_eq!(setup, "rgb(11, 22, 33)|true|false|true"); + assert_eq!(setup, "rgb(11, 22, 33)|true|false|false"); advance_page_task_executor_until_eval_equals( &mut vm, &loader,