From dceebe137b4c6be1aa8d8285e01e4d88754331c9 Mon Sep 17 00:00:00 2001 From: ldm0 Date: Thu, 10 Sep 2026 08:21:15 +0800 Subject: [PATCH] fix: preserve child navigations started by javascript URLs Check the navigation load as well as the Document owner before committing a javascript URL string result. A form submission or Location navigation started during script execution must keep its pending request. Add four Browser integration tests covering 13 scenarios, including GET, POST, named targets, successor javascript URLs, unrelated frames, and canceled navigation. Record the newly passing jsurl-form-submit WPT. Validation: cargo fmt --all; workspace all-targets all-features Clippy with -D warnings; cargo nextest run --no-fail-fast (17,901 passed, 13 skipped). Focused WPT: 103 cases, one new pass, no regressions. --- moli-benchmark/wpt-cross-current/passed-cases.txt | 1 + moli-core/tests/javascript_url_navigation.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/moli-benchmark/wpt-cross-current/passed-cases.txt b/moli-benchmark/wpt-cross-current/passed-cases.txt index ba3ffba898c..cd11e83ada8 100644 --- a/moli-benchmark/wpt-cross-current/passed-cases.txt +++ b/moli-benchmark/wpt-cross-current/passed-cases.txt @@ -6962,6 +6962,7 @@ html/semantics/forms/form-submission-0/form-double-submit-to-different-origin-fr html/semantics/forms/form-submission-0/form-double-submit.html html/semantics/forms/form-submission-0/form-submit-iframe-then-location-navigate.html html/semantics/forms/form-submission-0/getactionurl.html +html/semantics/forms/form-submission-0/jsurl-form-submit.tentative.html html/semantics/forms/form-submission-0/jsurl-navigation-then-form-submit.html html/semantics/forms/form-submission-0/newline-normalization.html html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html diff --git a/moli-core/tests/javascript_url_navigation.rs b/moli-core/tests/javascript_url_navigation.rs index f54b8b0c629..3a1e2a71f97 100644 --- a/moli-core/tests/javascript_url_navigation.rs +++ b/moli-core/tests/javascript_url_navigation.rs @@ -139,6 +139,7 @@ async fn child_javascript_url_string_survives_without_a_new_cross_document_navig for action in [ "document.body.dataset.changed = 'yes';", "location.hash = 'fragment';", + "navigation.onnavigate = event => event.preventDefault(); document.forms[0].submit();", ] { let result = child_javascript_url_navigation(action, false).await?; assert_eq!(result[0]["bodyId"], "completion", "{action}: {result}");