Repository navigation
script: abort planned form navigations - #38676
Conversation
|
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#54325) with upstreamable changes. |
68b1c45 to
d28ec9a
Compare
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#54325) title and body. |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#54325) title and body. |
d28ec9a to
21527cf
Compare
21527cf to
67316e5
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
67316e5 to
ef1a817
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
1 similar comment
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#54325) title and body. |
ef1a817 to
d142f27
Compare
|
🔨 Triggering try run (#16975400605) for Linux (WPT) |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
|
Test results for linux-wpt from try job (#16975400605): Flaky unexpected result (23)
Stable unexpected results that are known to be intermittent (23)
Stable unexpected results (7)
|
|
|
| /// <https://html.spec.whatwg.org/multipage/#constructing-entry-list> | ||
| constructing_entry_list: Cell<bool>, | ||
| elements: DomOnceCell<HTMLFormControlsCollection>, | ||
| generation_id: Cell<GenerationId>, |
There was a problem hiding this comment.
question: by removing the per form generation_id you’ve removing the original behavior that deduplicated multiple queued submissions of the same form?
There was a problem hiding this comment.
can we use both a per form generation and the window level “ongoing navigation" ?
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
we need followup issue for that ?
There was a problem hiding this comment.
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.
| } | ||
| } | ||
|
|
||
| /// An id used to cancel planned formed navigations. |
There was a problem hiding this comment.
| /// An id used to cancel planned formed navigations. | |
| /// An id used to cancel planned form navigations. |
| 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; |
There was a problem hiding this comment.
you will never hit 2^32, but you can make it explicit:
| 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(); |
There was a problem hiding this comment.
do we need window.stop() instead?
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
can promise_test be used here? promise_test(... await new Promise(r => t.step_timeout(r, 150))) ?
There was a problem hiding this comment.
I'm not sure that fits well with the window.onload for the other step...
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
What pattern do other tests watching for onunload use?
There seems to be various patterns use, see for example
And a look at these search results shows many different pattenrs:
There was a problem hiding this comment.
Also, re onload, a search reveals it is used directly in some tests at least, such as the below:
|
There were probably a lot of notifications from all the messages, but this one is now ready for review again. @Taym95 @jdm @mrobinson |
|
✍ Updated existing upstream WPT pull request (web-platform-tests/wpt#54325) title and body. |
| // <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 |
There was a problem hiding this comment.
| // 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. |
There was a problem hiding this comment.
| // 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. |
| /// <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). |
There was a problem hiding this comment.
| // we just increment it(it is not a uuid). | |
| // we just increment it (it is not a uuid). |
| // 2. Send a `AbortLoadUrl` message(in case the navigation | ||
| // already started at the constellation). | ||
| self.set_ongoing_navigation(); | ||
| //self.send_to_constellation(ScriptToConstellationMessage::AbortLoadUrl); |
There was a problem hiding this comment.
That should have been removed...
Signed-off-by: gterzian <[email protected]>
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
mrobinson
left a comment
There was a problem hiding this comment.
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?
| // 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. |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Nit: increment might be better here?
| pub(crate) fn set_ongoing_navigation(&self) -> OngoingNavigation { | |
| pub(crate) fn increment_ongoing_navigation(&self) -> OngoingNavigation { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| window.onunload = () => { | ||
| unloaded = true; | ||
| }; | ||
| t.step_timeout(() => { |
There was a problem hiding this comment.
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...
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]>
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
1 similar comment
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
Signed-off-by: gterzian <[email protected]>
85493d9 to
b44cf37
Compare
|
📝 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 { |
There was a problem hiding this comment.
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.
…using a `newValue` variable Signed-off-by: gterzian <[email protected]>
5c4d557 to
63b2c30
Compare
|
@Taym95 @jdm @mrobinson Thank you all for your reviews. |
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#54325). |
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