diff --git a/moli-benchmark/wpt-cross-current/passed-cases.txt b/moli-benchmark/wpt-cross-current/passed-cases.txt index 3976a2be71..6815a9a2bc 100644 --- a/moli-benchmark/wpt-cross-current/passed-cases.txt +++ b/moli-benchmark/wpt-cross-current/passed-cases.txt @@ -7321,6 +7321,7 @@ html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document-open- html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-02.html html/webappapis/dynamic-markup-insertion/opening-the-input-stream/document.open-03.html html/webappapis/dynamic-markup-insertion/opening-the-input-stream/form-control-state.html +html/webappapis/dynamic-markup-insertion/opening-the-input-stream/ignore-opens-during-unload.window.js?moli-wpt-script=window html/webappapis/dynamic-markup-insertion/opening-the-input-stream/location-set-and-document-open.html html/webappapis/dynamic-markup-insertion/opening-the-input-stream/origin-check-in-document-open-basic.html html/webappapis/dynamic-markup-insertion/the-outerhtml-property/outerhtml-documentfragment.html diff --git a/moli-core/tests/document_open_unload.rs b/moli-core/tests/document_open_unload.rs index 66259a9e9a..463952c808 100644 --- a/moli-core/tests/document_open_unload.rs +++ b/moli-core/tests/document_open_unload.rs @@ -29,7 +29,7 @@ async fn stream_operation_during_unload( let listenerFrame = frame; let doc = frame.contentDocument; if (target === 'other') doc = (await frameIn(window)).contentDocument; - if (target === 'ancestor') {{ + if (target.endsWith('ancestor')) {{ const middle = await frameIn(frame.contentWindow); doc = middle.contentDocument; listenerFrame = await frameIn(middle.contentWindow); @@ -99,7 +99,7 @@ async fn stream_operation_during_unload( #[tokio::test(flavor = "multi_thread")] async fn document_stream_operations_have_no_side_effects_during_unload() -> Result<()> { - for event in ["beforeunload", "pagehide", "unload"] { + for event in ["beforeunload", "pagehide", "visibilitychange", "unload"] { for operation in [ "open", "prototype-open", @@ -132,9 +132,21 @@ async fn ancestor_unload_counter_covers_descendant_callbacks() -> Result<()> { Ok(()) } +#[tokio::test(flavor = "multi_thread")] +async fn ordinary_ancestor_unload_counter_covers_descendant_callbacks() -> Result<()> { + for event in ["beforeunload", "pagehide", "visibilitychange", "unload"] { + let result = stream_operation_during_unload(event, "open", "ordinary-ancestor").await?; + assert_eq!(result["sameRoot"], true, "{event}: {result}"); + assert_eq!(result["sameLength"], true); + assert_eq!(result["listenerCount"], 1); + assert_eq!(result["returnedDocument"], true); + } + Ok(()) +} + #[tokio::test(flavor = "multi_thread")] async fn unload_does_not_block_opening_another_document() -> Result<()> { - for event in ["beforeunload", "pagehide", "unload"] { + for event in ["beforeunload", "pagehide", "visibilitychange", "unload"] { let result = stream_operation_during_unload(event, "open", "other").await?; assert_eq!(result["sameRoot"], false, "{event}: {result}"); assert_eq!(result["listenerCount"], 0); diff --git a/moli-core/tests/javascript_url_lifecycle.rs b/moli-core/tests/javascript_url_lifecycle.rs index 17824219a6..5f06931a14 100644 --- a/moli-core/tests/javascript_url_lifecycle.rs +++ b/moli-core/tests/javascript_url_lifecycle.rs @@ -11,6 +11,9 @@ async fn child_navigation_lifecycle(via: &str, kind: &str, depth: usize) -> Resu let markup = format!( r#"