-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WPT for initial empty document history replacement behaviors #28541
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The review process for this patch is being conducted in the Chromium project.
b946725
to
f2f3358
Compare
9c04a64
to
4ba08c1
Compare
|
||
// Do a fragment navigation within the initial empty document through iframe.src. | ||
iframe.src = url1; | ||
await new Promise(resolve => setTimeout(setTimeout(resolve, 100), 100)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setTimeout()
takes a function, so passing it the result of setTimeout()
(an integer) doesn't really work. I think this should be just await new Promise(resolve => setTimeout(resolve, 100))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, of course. Thank you!
|
||
promise_test(async t => { | ||
const startingHistoryLength = history.length; | ||
// Create an ifame with src set to about:blank but navigate away from it immediately below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ifame" -> "iframe" here and elsewhere
window.addEventListener("message", t.step_func((event) => { | ||
if (event.data == message) | ||
resolve(); | ||
}), { once: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could try removing { once: true }
here to see if that helps the tests pass, e.g. if multiple messages are being sent somehow. If it doesn't help though then keeping it is best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think this helped some tests
if (iframe.contentDocument.readyState === 'complete') { | ||
// Wait a bit longer in case the about:blank navigation after the | ||
// initial empty document is asynchronous. | ||
setTimeout(resolve, 100); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general all uses of setTimeout
should instead be t.step_timeout
, which gives them extra time on slow test runners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, changed!
const openedWindow = windowOpen204(t); | ||
|
||
// Do a fragment navigation within the initial empty document through setting location.href. | ||
openedWindow.location.href = url1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this test is breaking because it's parsing #foo
relative to this document, and not relative to 204-url.
Try openedWindow.location.hash = "foo"
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that and it seems to fail a lot more (then again I changed a lot of other parts as well). Do you think we should use location.hash now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just worried that this is trying to load window-open-204-fragment.html#foo
instead of /common/blank.html?pipe=status(204)#foo
. Maybe just explicitly do openedWindow.location.href = "/common/blank.html?pipe=status(204)#foo"
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I think that's one of the source of flakiness. I changed it to navigate to about:blank#foo
explicitly now!
openedWindow.location.href = url1; | ||
await waitForMessage(t, "loaded"); | ||
assert_equals(openedWindow.history.length, 1, | ||
"history.length must be 1 after normal navigation on initial empty document"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised Chrome is failing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is failing because of https://bugs.chromium.org/p/chromium/issues/detail?id=524208#c22, which is being fixed in crrev.com/c/2794069
34be15c
to
89abc91
Compare
It's unfortunate that this fails the stability checker, but it seems like this is just an inherently flaky area and we might need to ask for a stability checker override. Still, maybe you could debug at least on Chromium; see the command in https://github.com/web-platform-tests/wpt/pull/28541/checks?check_run_id=2395119277 . Maybe the timeouts just need to be longer or something. |
89abc91
to
6548bf2
Compare
It passes the stability checker now! Looks like we need to wait for the window.open()-ed document to load first before continuing the navigation. Here's the latest Chrome, Firefox, Safari results. Firefox times out in most cases though, maybe they don't fire load for initial empty document loads? Or the load here is actually caused by Chrome and potentially Safari's non-initial empty document Also, unfortunately it looks like the behavior for iframe vs |
Oh, I'm so glad we were able to get a non-flaky version! I'll discuss next steps in the spec issue based on these results. |
109c21e
to
a1bff1e
Compare
a1bff1e
to
e75ccfb
Compare
Is this PR expected to be the full extent of WPT changes for this spec change? That is, is it expected that there aren't modifications to existing tests? |
I think so, the "always replace" behavior landed in Chromium and no existing WPTs needed an update |
That surprises me. Thanks! |
5b57154
to
4afced7
Compare
Looks like I completely forgot to land this, even after the relevant spec PRs had merged. Before we land, @hsivonen - do you have any comments? |
I think the easiest way forward is to land these and let them propagate to mozilla-central. I'm currently working on about:blank changes, so it's good to have these land, and I'll file follow-ups if I find concerns. Thanks. |
Previously, I wrote:
Today, I discovered that https://github.com/web-platform-tests/wpt/blob/master/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_1-1.html#L11 and https://github.com/web-platform-tests/wpt/blob/master/html/browsers/the-window-object/garbage-collection-and-browsing-contexts/discard_iframe_history_2-1.html#L12 need changing. (I intend to eventually change these two lines myself; I already have a pending patch, but it's going to take some time to get landed due to what else is in the same patch.) |
4afced7
to
4a261f9
Compare
Thanks @hsivonen! Regarding the tests you mentioned, looks like Chrome is already failing those since long ago (see expectations 1 and 2, we don't increase the history.length when the iframe loads), so looks like we do need to change the expectations in the WPT itself if Firefox starts behaving similarly. Also, it looks like some cases are flakily failing only on Firefox: https://github.com/web-platform-tests/wpt/pull/28541/checks?check_run_id=8030346986. Not really sure why only some types of navigations are hitting that... are we OK landing the WPTs as is with the flakiness, or do you have suggestions to handle those (maybe disable the tests on Firefox somehow?) |
My preference is landing these into WPT as flaky, letting them sync to mozilla-central, and then annotating them there. I'm actively working on a change that I expect to fix these on the Firefox side. |
4a261f9
to
2202cdb
Compare
Adds WPTs for various ways navigation can happen on initial empty documents, and their impact on session history. Bug: 1215096 Change-Id: If8754e600e5feb6860ebf9aa4df481330b746eaf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2831564 Reviewed-by: Domenic Denicola <[email protected]> Commit-Queue: Rakina Zata Amni <[email protected]> Cr-Commit-Position: refs/heads/main@{#1039711}
2202cdb
to
f9b746b
Compare
Thanks! I've landed the WPT on Chromium, lmk if I need to do anything else. Looking forward to see Firefox pass the tests! |
WPT Command: Some affected tests had inconsistent (flaky) results: Unstable results
These may be pre-existing or new flakes. Please try to reproduce (see the above WPT command, though some flags may not be needed when running locally) and determine if your change introduced the flake. If you are unable to reproduce the problem, please tag |
@sj0602, this one is blocked because some tests are flaky on firefox. Below is some instructions to handle such case: A common problem is the TaskCluster stability check failing, which indicates that a test is flaky. This is very often a problem with the test itself and will require help from the author, so deflaking these can take some time. To avoid these PRs from piling up we aim to clear them from the queue and apply a fix in the background. Follow these steps (see #23617 for a recent example): copy the "Unstable Results" from the TaskCluster log into the PR for easier viewing. |
Files crbug.com/1357195. |
@KyleJu @DanielRyanSmith can you help admin merge? Thanks! |
Adds WPTs for various ways navigation can happen on initial empty
documents, and their impact on session history.
Bug: 1215096
Change-Id: If8754e600e5feb6860ebf9aa4df481330b746eaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2831564
Reviewed-by: Domenic Denicola <[email protected]>
Commit-Queue: Rakina Zata Amni <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1039711}