mirror of
https://github.com/lexmount/moli.git
synced 2026-10-31 00:06:19 +00:00
fix(window): retain the name of closed auxiliary windows
Validation on the original split base: cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings. Nextest and WPT reruns omitted at the user's request.
This commit is contained in:
+19
-2
@@ -668,7 +668,24 @@ async fn auxiliary_initial_history_stays_provisional_until_document_navigation()
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn closed_auxiliary_name_reads_empty_and_ignores_writes_after_conversion() {
|
||||
async fn auxiliary_initial_document_adoption_keeps_closed_window_name() {
|
||||
let (addr, server) = spawn_test_protocol_server().await;
|
||||
let (mut browser, _) =
|
||||
connect_async(format!("ws://{addr}/devtools/browser/{DEFAULT_BROWSER_ID}"))
|
||||
.await
|
||||
.unwrap();
|
||||
let opener_id = create_dynamic_target(&mut browser, 1).await;
|
||||
let mut opener = connect_dynamic_page(addr, &opener_id).await;
|
||||
let (_, _child) = open_auxiliary(addr, &mut opener, "").await;
|
||||
assert_eq!(
|
||||
evaluate_window_name_probe(&mut opener, 4, "p.close();p.name").await,
|
||||
json!("actual-page"),
|
||||
);
|
||||
abort_test_cdp_server(server).await;
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn closed_auxiliary_name_is_retained_and_ignores_writes_after_conversion() {
|
||||
let (fixture_addr, _fixture) = spawn_dedicated_fixture_server(
|
||||
Router::new().fallback(get(|| async { axum::response::Html("<p>parent</p>") })),
|
||||
"auxiliary-closed-name",
|
||||
@@ -720,7 +737,7 @@ async fn closed_auxiliary_name_reads_empty_and_ignores_writes_after_conversion()
|
||||
})()"#
|
||||
)
|
||||
.await,
|
||||
json!([true, "", "", 1])
|
||||
json!([true, "kept", "kept", 1])
|
||||
);
|
||||
}
|
||||
abort_test_cdp_server(server).await;
|
||||
|
||||
@@ -881,11 +881,7 @@ fn window_name_runtime_getter<'s>(
|
||||
&& let Some(host_ptr) = context_host_ptr_from_global_bridge(scope)
|
||||
{
|
||||
let host = unsafe { &*host_ptr };
|
||||
let name = if host.browsing_context_is_closed() {
|
||||
String::new()
|
||||
} else {
|
||||
host.browsing_context_name().get()
|
||||
};
|
||||
let name = host.browsing_context_name().get();
|
||||
rv.set(v8::String::new(scope, &name).unwrap().into());
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user