Skip to content

script: abort planned form navigations - #38676

Merged
jdm merged 9 commits into
servo:mainfrom
gterzian:abort_navigations
Aug 22, 2025
Merged

jdm merged 9 commits into
servo:mainfrom
gterzian:abort_navigations

Conversation

@gterzian

@gterzian gterzian commented Aug 14, 2025 •

Copy link
Copy Markdown
Member

Servo shows a behavior unlike FF and Safari(I don't have Chrome), where stopping a window does not cancel planned form navigation, resulting in an infinite navigation loop. The current behavior of Servo does seem to follow the wording of the spec, so I will open a companion issue at the spec, and I have also written a WPT tests for the non-standard but widely followed behavior. This PR also adds a beginning of an implementation of the "ongoing navigation" concept, which is used by the spec to cancel navigations, and which is used in this PR only to cancel planned form navigations. The generation id concept, which corresponds to the planned navigation concept in the spec, is turned into a simple struct private cell, and is documented per the spec.

Testing: A new WPT test is added
Fixes: Only one part of #36747

@gterzian gterzian changed the title script: abort navigations script: abort planned form navigations Aug 14, 2025
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#54325) with upstreamable changes.

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#54325) title and body.

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

@gterzian
gterzian requested a review from jdm August 14, 2025 17:15
@gterzian
gterzian requested a review from mrobinson August 14, 2025 17:15
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#54325) title and body.

@gterzian
gterzian marked this pull request as ready for review August 14, 2025 17:18
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

1 similar comment
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#54325) title and body.

@gterzian gterzian added the T-linux-wpt Do a try run of the WPT label Aug 14, 2025
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Aug 14, 2025
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#16975400605) for Linux (WPT)

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt from try job (#16975400605):

Flaky unexpected result (23)
  • OK /FileAPI/url/url-with-fetch.any.worker.html (#21517)
    • FAIL [expected PASS] subtest: Revoke blob URL after calling fetch, fetch should succeed

      promise_test: Unhandled rejection with value: object "TypeError: Network error occurred"
      

  • FAIL [expected PASS] /_mozilla/css/table_row_direction_a.html
  • FAIL [expected PASS] /css/CSS2/text/word-spacing-101.xht
  • FAIL [expected PASS] /css/WOFF2/blocks-extraneous-data-005.xht
  • FAIL [expected PASS] /css/WOFF2/metadatadisplay-schema-copyright-023.xht
  • FAIL [expected PASS] /css/WOFF2/metadatadisplay-schema-extension-010.xht
  • OK /css/css-cascade/layer-font-face-override.html (#35935)
    • PASS [expected FAIL] subtest: @font-face override update with appended sheet 1
    • PASS [expected FAIL] subtest: @font-face override update with appended sheet 2
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 20deg' should prefer 'oblique 10deg' over 'oblique 0deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 21deg' should prefer 'oblique 20deg' over 'oblique 10deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • CRASH [expected FAIL] /css/css-lists/nested-marker-styling.html
  • FAIL [expected PASS] /css/css-text/text-encoding/shaping-join-001.html
  • OK /custom-elements/form-associated/ElementInternals-setFormValue.html (#29174)
    • PASS [expected FAIL] subtest: Single value - name is missing
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-cross-origin.sub.window.html (#29056)
    • PASS [expected FAIL] subtest: Cross-origin navigation started from unload handler must be ignored
  • OK /html/browsers/history/the-history-interface/traverse_the_history_2.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • TIMEOUT [expected OK] /html/infrastructure/urls/base-url/document-base-url-window-initiator-is-not-opener.https.window.html (#30970)
  • OK [expected TIMEOUT] /html/semantics/embedded-content/media-elements/playing-the-media-resource/loop-from-ended.tentative.html (#33778)
    • FAIL [expected TIMEOUT] subtest: play() with loop set to true after playback ended

      this argument is not a finite floating-point value
      

  • OK /html/semantics/forms/form-submission-0/multipart-formdata.window.html (#28725)
    • PASS [expected FAIL] subtest: multipart/form-data: Basic test (normal form)
  • OK /html/semantics/forms/form-submission-0/text-plain.window.html (#28687)
    • PASS [expected FAIL] subtest: text/plain: Basic test (normal form)
  • OK /html/semantics/scripting-1/the-script-element/module/dynamic-import/blob-url.any.html (#33948)
    • FAIL [expected PASS] subtest: Revoking a blob URL immediately after calling import will not fail

      promise_test: Unhandled rejection with value: object "TypeError: Dynamic import failed"
      

  • TIMEOUT /preload/preload-resource-match.https.html (#38088)
    • TIMEOUT [expected FAIL] subtest: Loading script (use-credentials) with link (no-cors) should discard the preloaded response

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: Loading script (use-credentials) with link (anonymous) should discard the preloaded response
  • TIMEOUT [expected OK] /resource-timing/tentative/document-initiated.html (#37785)
  • ERROR /service-workers/idlharness.https.any.html (#36250)
    • TIMEOUT [expected PASS] subtest: ServiceWorkerContainer interface: operation register((TrustedScriptURL or USVString), optional RegistrationOptions)

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: NavigationPreloadManager interface: operation enable()

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: NavigationPreloadManager interface: operation disable()

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: NavigationPreloadManager interface: operation setHeaderValue(ByteString)

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: NavigationPreloadManager interface: operation getState()

      Test timed out
      

  • OK /trusted-types/trusted-types-reporting.html
    • PASS [expected FAIL] subtest: Trusted Type violation report: sample for eval
  • OK [expected TIMEOUT] /webmessaging/with-ports/017.html (#24486)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, about:blank
Stable unexpected results that are known to be intermittent (23)
  • FAIL [expected PASS] /_mozilla/css/iframe/hide_and_show.html (#15265)
  • FAIL [expected PASS] /_mozilla/css/stacked_layers.html (#15988)
  • FAIL [expected PASS] /_mozilla/mozilla/sslfail.html (#10760)
  • TIMEOUT [expected OK] /_mozilla/mozilla/window_resize_event.html (#36741)
    • TIMEOUT [expected PASS] subtest: Popup onresize event fires after resizeTo

      Test timed out
      

  • OK /content-security-policy/frame-ancestors/frame-ancestors-path-ignored.window.html (#36468)
    • FAIL [expected PASS] subtest: A 'frame-ancestors' CSP directive with a URL that includes a path should be ignored.

      assert_unreached: The IFrame should have been blocked (or cross-origin). It wasn't. Reached unreachable code
      

  • TIMEOUT [expected FAIL] /dom/xslt/large-cdata.html (#38029)
  • OK /fetch/metadata/generated/css-font-face.sub.tentative.html (#34624)
    • PASS [expected FAIL] subtest: sec-fetch-storage-access - Not sent to non-trustworthy same-site destination
    • FAIL [expected PASS] subtest: sec-fetch-storage-access - Not sent to non-trustworthy cross-site destination

      promise_test: Unhandled rejection with value: object "Error: Failed to query for recorded headers."
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/005.html (#27062)
    • PASS [expected FAIL] subtest: Link with onclick navigation and href navigation
  • OK /html/browsers/browsing-the-web/navigating-across-documents/008.html (#24456)
    • PASS [expected FAIL] subtest: Link with onclick form submit to javascript url and href navigation
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/iframe-src-aboutblank-navigate-immediately.html (#29048)
    • PASS [expected FAIL] subtest: Navigating to a different document with location.href
    • PASS [expected FAIL] subtest: Navigating to a different document with location.assign
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html (#28681)
    • FAIL [expected PASS] subtest: load & pageshow events do not fire on contentWindow of <iframe> element created with src='about:blank'

      assert_unreached: load should not be fired Reached unreachable code
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin-fragment.html (#20768)
    • FAIL [expected PASS] subtest: Tests that a fragment navigation in the unload handler will not block the initial navigation

      assert_equals: expected "" but got "#fragment"
      

  • OK /html/browsers/history/the-history-interface/traverse_the_history_3.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/autofocus-dialog.html (#29087)
    • TIMEOUT [expected FAIL] subtest: <dialog>-contained autofocus element gets focused when the dialog is shown

      Test timed out
      

  • TIMEOUT /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • TIMEOUT [expected PASS] subtest: Non-HTMLElement should not support autofocus

      Test timed out
      

    • NOTRUN [expected FAIL] subtest: Host element with delegatesFocus should support autofocus
    • NOTRUN [expected FAIL] subtest: Host element with delegatesFocus including no focusable descendants should be skipped
  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
    • FAIL [expected TIMEOUT] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • OK [expected TIMEOUT] /html/semantics/forms/form-submission-0/reparent-form-during-planned-navigation-task.html (#29724)
    • PASS [expected TIMEOUT] subtest: reparent-form-during-planned-navigation-task
  • OK /html/semantics/forms/form-submission-0/urlencoded2.window.html (#28687)
    • PASS [expected FAIL] subtest: application/x-www-form-urlencoded: Basic test (normal form)
  • OK /html/semantics/forms/historical.html (#28568)
    • FAIL [expected PASS] subtest: <input name=isindex> should not be supported

      assert_regexp_match: expected object "/\?isindex=x$/" but got "about:blank"
      

  • OK /preload/preload-error.sub.html (#37177)
    • PASS [expected FAIL] subtest: success (style): main
    • PASS [expected FAIL] subtest: 404 (style): main
    • FAIL [expected PASS] subtest: 404 (script): main

      assert_greater_than: http://web-platform.test:8000/preload/resources/dummy.js?pipe=status%28404%29&label=script should be loaded expected a number greater than 0 but got 0
      

    • FAIL [expected PASS] subtest: CORS (script): main

      assert_greater_than: http://not-web-platform.test:8000/preload/resources/dummy.js?pipe=header%28Access-Control-Allow-Origin%2C*%29&label=script should be loaded expected a number greater than 0 but got 0
      

    • PASS [expected FAIL] subtest: success (xhr): main
    • PASS [expected FAIL] subtest: 404 (xhr): main
    • PASS [expected FAIL] subtest: CORS (xhr): main
    • PASS [expected FAIL] subtest: Decode-error (style): main
    • FAIL [expected PASS] subtest: MIME-error (script): main

      assert_greater_than: http://web-platform.test:8000/preload/resources/dummy.css?pipe=header%28Content-Type%2Ctext%2Fnotjavascript%29&label=script should be loaded expected a number greater than 0 but got 0
      

  • CRASH [expected TIMEOUT] /trusted-types/trusted-types-navigation.html?06-10 (#37920)
  • OK /webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html (#22849)
    • FAIL [expected PASS] subtest: X Stitched sine-wave buffers at sample rate 43800 does not equal [0,0.06264832615852356,0.12505052983760834,0.18696144223213196,0.24813786149024963,0.308339387178421,0.36732959747314453,0.4248766601085663,0.480754554271698,0.5347436666488647,0.5866320133209229,0.6362156271934509,0.6832997798919678,0.7276994585990906,0.7692402601242065,0.8077589869499207...] with an element-wise tolerance of {"absoluteThreshold":0.0038986,"relativeThreshold":0}. Index Actual Expected AbsError RelError Test threshold [13774] -3.4371144873244154e-34 4.3901130557060242e-1 4.3901130557060242e-1 1.0000000000000000e+0 3.8985999999999999e-3 [13775] 9.9520772695541382e-2 3.8186064362525940e-1 2.8233987092971802e-1 7.3937934071779721e-1 3.8985999999999999e-3 Max AbsError of 4.3901130557060242e-1 at index of 13774. Max RelError of 1.0000000000000000e+0 at index of 13774.

      assert_true: expected true got false
      

    • FAIL [expected PASS] subtest: X SNR (48.98931933084172 dB) is not greater than or equal to 65.737. Got 48.98931933084172.

      assert_true: expected true got false
      

  • OK [expected TIMEOUT] /webmessaging/with-ports/018.html (#24485)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, javascript:
Stable unexpected results (7)
  • OK /html/semantics/forms/form-submission-0/form-double-submit-default-action.html
    • FAIL [expected PASS] subtest: default submit action should supersede input onclick submit()

      assert_equals: expected "v4" but got "v2"
      

    • FAIL [expected PASS] subtest: default submit action should supersede button onclick submit()

      assert_equals: expected "v4" but got "v3"
      

    • FAIL [expected PASS] subtest: default submit action should supersede form onclick submit()

      assert_equals: expected "v4" but got "v2"
      

    • FAIL [expected PASS] subtest: default submit action should supersede form onsubmit submit()

      assert_equals: expected "v4" but got "v3"
      

    • FAIL [expected PASS] subtest: default submit action should supersede form onclick/onsubmit submit()

      assert_equals: expected "v7" but got "v2"
      

  • OK /html/semantics/forms/form-submission-0/form-double-submit-input-type-change.html
    • FAIL [expected PASS] subtest: default submit action should supersede input onclick submit() and change the input type from color to submit

      assert_equals: expected (string) "v3" but got (object) null
      

    • FAIL [expected PASS] subtest: default submit action should supersede input onclick submit() and change the input type from checkbox to submit

      assert_equals: expected (string) "v3" but got (object) null
      

    • FAIL [expected PASS] subtest: default submit action should supersede input onclick submit() and change the input type from radio to submit

      assert_equals: expected (string) "v3" but got (object) null
      

    • FAIL [expected PASS] subtest: default submit action should supersede input onclick submit() and change the input type from file to submit

      assert_equals: expected (string) "v3" but got (object) null
      

    • FAIL [expected PASS] subtest: default submit action should supersede input onclick submit() and change the input type from image to submit

      assert_equals: expected (string) "v3" but got (object) null
      

    • FAIL [expected PASS] subtest: default submit action should supersede input onclick submit() and change the input type from reset to submit

      assert_equals: expected (string) "v3" but got (object) null
      

  • OK /html/semantics/forms/form-submission-0/form-double-submit-preventdefault-click.html
    • FAIL [expected PASS] subtest: PreventDefaulting input onclick should allow submit() to succeed

      assert_equals: expected "v3" but got "v2"
      

    • FAIL [expected PASS] subtest: PreventDefaulting button onclick should allow submit() to succeed

      assert_equals: expected "v3" but got "v2"
      

    • FAIL [expected PASS] subtest: PreventDefaulting form onclick should allow submit() to succeed

      assert_equals: expected "v3" but got "v2"
      

  • OK /html/semantics/forms/form-submission-0/form-double-submit-preventdefault.html
    • FAIL [expected PASS] subtest: PreventDefaulting form onsubmit should allow submit() to succeed

      assert_equals: expected "v6" but got "v2"
      

  • OK /html/semantics/forms/form-submission-0/form-double-submit-requestsubmit.html
    • FAIL [expected PASS] subtest: test runTest with submitterType: input, preventDefaultRequestSubmit: false, preventDefaultSubmitButton: false, passSubmitter: true

      assert_equals: expected "v2" but got "v1"
      

    • FAIL [expected PASS] subtest: test runTest with submitterType: input, preventDefaultRequestSubmit: false, preventDefaultSubmitButton: false, passSubmitter: false

      assert_equals: expected "v2" but got "v1"
      

    • FAIL [expected PASS] subtest: test runTest with submitterType: button, preventDefaultRequestSubmit: false, preventDefaultSubmitButton: false, passSubmitter: true

      assert_equals: expected "v2" but got "v1"
      

    • FAIL [expected PASS] subtest: test runTest with submitterType: button, preventDefaultRequestSubmit: false, preventDefaultSubmitButton: false, passSubmitter: false

      assert_equals: expected "v2" but got "v1"
      

    • PASS [expected FAIL] subtest: test runTest2 with submitterType: input, callRequestSubmit: true, callSubmit: true, preventDefault: false, passSubmitter: true
    • PASS [expected FAIL] subtest: test runTest2 with submitterType: button, callRequestSubmit: true, callSubmit: true, preventDefault: false, passSubmitter: true
    • PASS [expected FAIL] subtest: test runTest2 with submitterType: button, callRequestSubmit: false, callSubmit: true, preventDefault: false, passSubmitter: true
  • OK /html/semantics/forms/the-button-element/button-submit-remove-jssubmit.html
    • FAIL [expected PASS] subtest: This test will pass if a form navigation successfully occurs when clicking a <button type=submit> element with a onclick event handler which removes the button and then calls form.submit().

      assert_equals: expected "http://web-platform.test:8000/html/semantics/forms/the-button-element/does_not_exist.html?name=bar" but got "http://web-platform.test:8000/html/semantics/forms/the-button-element/does_not_exist.html?name=foo"
      

  • OK /html/semantics/forms/the-input-element/input-submit-remove-jssubmit.html
    • FAIL [expected PASS] subtest: This test will pass if a form navigation successfully occurs when clicking a <input type=submit> element with a onclick event handler which removes the input and then calls form.submit().

      assert_equals: expected "http://web-platform.test:8000/html/semantics/forms/the-input-element/does_not_exist.html?name=bar" but got "http://web-platform.test:8000/html/semantics/forms/the-input-element/does_not_exist.html?name=foo"
      

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#16975400605) failed.

@gterzian
gterzian marked this pull request as draft August 15, 2025 07:53
@gterzian
gterzian requested a review from Taym95 August 15, 2025 07:53
@Taym95
Taym95 marked this pull request as ready for review August 15, 2025 07:59
/// <https://html.spec.whatwg.org/multipage/#constructing-entry-list>
constructing_entry_list: Cell<bool>,
elements: DomOnceCell<HTMLFormControlsCollection>,
generation_id: Cell<GenerationId>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: by removing the per form generation_id you’ve removing the original behavior that deduplicated multiple queued submissions of the same form?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use both a per form generation and the window level “ongoing navigation" ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am now using the ongoing navigation for both concepts, meaning I get a new one for each planned nav(the tests were failing because I would just use the current one, which means a subsequent planned navigation would not replace the last one).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: the concepts need to be separated, because the planned nav is per form, while ongoing nav is per navigable(which can change per form). So we need to have both. I did clean-up the panned nav one because it doesn't need to be shared outside of the form.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need followup issue for that ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok for now, I don't have an actionable issue in mind. But as we work through more of the navigation code, things will evolve.

Comment thread components/script/dom/window.rs Outdated
}
}

/// An id used to cancel planned formed navigations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// An id used to cancel planned formed navigations.
/// An id used to cancel planned form navigations.

Comment thread components/script/dom/window.rs Outdated
fn set_ongoing_navigation(&self) {
// Note: since this value, for now, is only used in a single script-thread,
// we just increment it(it is not a uuid).
let new_value = self.ongoing_navigation.get().0 + 1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will never hit 2^32, but you can make it explicit:

Suggested change
let new_value = self.ongoing_navigation.get().0 + 1;
let new_value = self.ongoing_navigation.get().0.wrapping_add(1);

let unloaded = false;
window.onload = t.step_func(() => {
form.submit();
window.frames.stop();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need window.stop() instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the same, but yes for the test we might as well keep it simple(I copied it from the original crash test).

window.onunload = () => {
unloaded = true;
};
t.step_timeout(() => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can promise_test be used here? promise_test(... await new Promise(r => t.step_timeout(r, 150))) ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that fits well with the window.onload for the other step...

@mrobinson mrobinson Aug 20, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't promise_testss always wait for window.onload to finish before starting?

What pattern do other tests watching for onunload use? I want to double-check here that a timeout is right way to do this...

@gterzian gterzian Aug 20, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gterzian gterzian Aug 20, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, re onload, a search reveals it is used directly in some tests at least, such as the below:

@gterzian

Copy link
Copy Markdown
Member Author

There were probably a lot of notifications from all the messages, but this one is now ready for review again. @Taym95 @jdm @mrobinson

@Taym95 Taym95 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#54325) title and body.

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice incremental improvement!

// <https://html.spec.whatwg.org/multipage/#nav-stop>
//
// The concept of ongoing navigation must be separated from the form's
// planned navigation conceopt, because each planned navigation cancels the previous one

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// planned navigation conceopt, because each planned navigation cancels the previous one
// planned navigation concept, because each planned navigation cancels the previous one

// The concept of ongoing navigation must be separated from the form's
// planned navigation conceopt, because each planned navigation cancels the previous one
// for a given form,
// whereas an ongoing navigation is a per navigable(read: window for now) concept.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// whereas an ongoing navigation is a per navigable(read: window for now) concept.
// whereas an ongoing navigation is a per navigable (read: window for now) concept.

Comment thread components/script/dom/window.rs Outdated
/// <https://html.spec.whatwg.org/multipage/#set-the-ongoing-navigation>
pub(crate) fn set_ongoing_navigation(&self) -> OngoingNavigation {
// Note: since this value, for now, is only used in a single script-thread,
// we just increment it(it is not a uuid).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// we just increment it(it is not a uuid).
// we just increment it (it is not a uuid).

Comment thread components/script/dom/window.rs Outdated
// 2. Send a `AbortLoadUrl` message(in case the navigation
// already started at the constellation).
self.set_ongoing_navigation();
//self.send_to_constellation(ScriptToConstellationMessage::AbortLoadUrl);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should have been removed...

Signed-off-by: gterzian <[email protected]>
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

@mrobinson mrobinson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems okay to me. Just some nits. The use of a new planned navigation rather than None after stopping the navigation is a bit weird, but I assume that will be fixed in a followup?

Comment on lines +1006 to +1009
// Let referrerPolicy be the empty string.
// If the form element's link types include the noreferrer keyword,
// then set referrerPolicy to "no-referrer".
// Note: both steps done below.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind preserving the step numbers? Although the do get out of date quickly, it helps to show when we are moving from one step to another or to understand when the order we do things is out of order with the specification.

}

/// <https://html.spec.whatwg.org/multipage/#set-the-ongoing-navigation>
pub(crate) fn set_ongoing_navigation(&self) -> OngoingNavigation {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: increment might be better here?

Suggested change
pub(crate) fn set_ongoing_navigation(&self) -> OngoingNavigation {
pub(crate) fn increment_ongoing_navigation(&self) -> OngoingNavigation {

@gterzian gterzian Aug 20, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to stick with something that reflects the spec naming, as opposed to focus on how we happen to implement it for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, please put a quick comment explaining why there is no newValue here yet and that it will be added in the future.

Comment thread components/script/dom/window.rs Resolved
Comment thread components/script/dom/window.rs Resolved
window.onunload = () => {
unloaded = true;
};
t.step_timeout(() => {

@mrobinson mrobinson Aug 20, 2025 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't promise_testss always wait for window.onload to finish before starting?

What pattern do other tests watching for onunload use? I want to double-check here that a timeout is right way to do this...

gterzian and others added 4 commits August 20, 2025 18:17
Co-authored-by: Martin Robinson <[email protected]>
Signed-off-by: Gregory Terzian <[email protected]>
Co-authored-by: Martin Robinson <[email protected]>
Signed-off-by: Gregory Terzian <[email protected]>
Co-authored-by: Martin Robinson <[email protected]>
Signed-off-by: Gregory Terzian <[email protected]>
Co-authored-by: Martin Robinson <[email protected]>
Signed-off-by: Gregory Terzian <[email protected]>
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

1 similar comment
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

@gterzian
gterzian requested a review from mrobinson August 20, 2025 10:49
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

}

/// <https://html.spec.whatwg.org/multipage/#set-the-ongoing-navigation>
pub(crate) fn set_ongoing_navigation(&self) -> OngoingNavigation {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, please put a quick comment explaining why there is no newValue here yet and that it will be added in the future.

@gterzian

Copy link
Copy Markdown
Member Author

@Taym95 @jdm @mrobinson Thank you all for your reviews.

@gterzian
gterzian enabled auto-merge August 21, 2025 13:16
@servo-wpt-sync

Copy link
Copy Markdown
Collaborator

📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325).

@gterzian
gterzian added this pull request to the merge queue Aug 21, 2025
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 21, 2025
@jdm
jdm added this pull request to the merge queue Aug 22, 2025
Merged via the queue into servo:main with commit ede9db2 Aug 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants