Skip to content
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

Remove html/semantics/forms/the-input-element/range-restore-oninput-onchange-event.html #99

Closed
nt1m opened this issue Jul 28, 2022 · 19 comments · Fixed by web-platform-tests/wpt-metadata#4998
Labels
focus area: Forms test-change-proposal Proposal to add or remove tests for an interop area

Comments

@nt1m
Copy link
Member

nt1m commented Jul 28, 2022

** Test List **

html/semantics/forms/the-input-element/range-restore-oninput-onchange-event.html

** Rationale **

It does pass on WebKit infrastructure: https://searchfox.org/wubkat/source/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/range-restore-oninput-onchange-event-expected.txt

It does not pass on wpt.fyi however, quoting @cdumez, because:

The reason for that is that the back/forward cache is enabled in Safari but disabled in WebKitTestRunner. The test times out in Safari because it is never getting a load event on back navigation, because the we restored the page from the back/forward cache. The test passes in Chrome and Firefox because they don't allow back/forward caching of pages with an opener.

cc @jensimmons

@nt1m nt1m added the test-change-proposal Proposal to add or remove tests for an interop area label Jul 28, 2022
@foolip
Copy link
Member

foolip commented Aug 4, 2022

Can this test be written to be compatible with bfcache instead?

@jgraham
Copy link
Contributor

jgraham commented Aug 4, 2022

Or we could use a cross-browser way to inhibit bfcache.

@cdumez
Copy link

cdumez commented Aug 4, 2022

HTTPS + Cache-Control: no-store would inhibit the bfcache for WebKit (and likely other browsers)

@foolip
Copy link
Member

foolip commented Aug 4, 2022

Here's the test:
https://github.com/web-platform-tests/wpt/blob/master/html/semantics/forms/the-input-element/range-restore-oninput-onchange-event.html

A new window is window.open()'d and I guess the problem is that w.history.back() never ends up firing an event. But are there other ways of checking that the navigation happened, that makes the test work whether it's in bfcache or not? The "pageshow" event perhaps?

@foolip
Copy link
Member

foolip commented Aug 4, 2022

@mfreed7 @josepharhar do either of you have experience with this test, can you give input?

@jgraham
Copy link
Contributor

jgraham commented Aug 4, 2022

I thought adding an unload handler would be enough to prevent bfcache, but I'm not sure I'm correct.

@smaug---- your input here would be very useful.

@cdumez
Copy link

cdumez commented Aug 4, 2022

I thought adding an unload handler would be enough to prevent bfcache, but I'm not sure I'm correct.

Not true in WebKit.

@cdumez
Copy link

cdumez commented Aug 4, 2022

Here's the test: https://github.com/web-platform-tests/wpt/blob/master/html/semantics/forms/the-input-element/range-restore-oninput-onchange-event.html

A new window is window.open()'d and I guess the problem is that w.history.back() never ends up firing an event. But are there other ways of checking that the navigation happened, that makes the test work whether it's in bfcache or not? The "pageshow" event perhaps?

Listening of the "pageshow" event would indeed detect the navigation even if coming from the bfcache. However, I don't think this is the way to fix this test since it validates form restoration on history traversal and expected certain form control events. If the page came out of the bfcache then there would be no form restoration or form control events since the form controls would come out of the cache as-is with their last values already in there.

I think the way to fix this test is to somehow opt out of bfcache. The most reliable way I know is HTTPS + Cache-Control: no-store.

@foolip
Copy link
Member

foolip commented Aug 4, 2022

Alright, can someone experiment with HTTPS + Cache-Control: no-store? Is it resources/${type}-restore-events.html that would have to be served with that header?

@cdumez
Copy link

cdumez commented Aug 4, 2022

Alright, can someone experiment with HTTPS + Cache-Control: no-store? Is it resources/${type}-restore-events.html that would have to be served with that header?

I guess I can experiment since WebKit is the one bf caching.

cdumez added a commit to cdumez/web-platform-tests that referenced this issue Aug 4, 2022
…t-onchange-event.html doesn't trigger bfcache

This test was triggering bfcache in WebKit and thus not getting form restoration events on back navigation.
To address this, use `HTTPS + Cache-Control: no-store` to opt out of bfcache.

See discussion at web-platform-tests/interop#99.
@cdumez
Copy link

cdumez commented Aug 4, 2022

web-platform-tests/wpt#35341

cdumez added a commit to web-platform-tests/wpt that referenced this issue Aug 4, 2022
…t-onchange-event.html doesn't trigger bfcache (#35341)

This test was triggering bfcache in WebKit and thus not getting form restoration events on back navigation.
To address this, use `HTTPS + Cache-Control: no-store` to opt out of bfcache.

See discussion at web-platform-tests/interop#99.
@cdumez
Copy link

cdumez commented Aug 4, 2022

I had to rename the test to make it https. Does anything need to be done to update the test name in Interop?

@nt1m
Copy link
Member Author

nt1m commented Aug 4, 2022

@nt1m
Copy link
Member Author

nt1m commented Aug 4, 2022

Sounds like there isn't anything else to do here, closing. Thanks Chris!

@nt1m nt1m closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2022
@foolip
Copy link
Member

foolip commented Aug 5, 2022

Thanks for helping sort this out, @cdumez and @nt1m!

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Sep 5, 2022
…-element/range-restore-oninpu…, a=testonly

Automatic update from web-platform-tests
Make sure html/semantics/forms/the-input-element/range-restore-oninput-onchange-event.html doesn't trigger bfcache (#35341)

This test was triggering bfcache in WebKit and thus not getting form restoration events on back navigation.
To address this, use `HTTPS + Cache-Control: no-store` to opt out of bfcache.

See discussion at web-platform-tests/interop#99.
--

wpt-commits: 71e460e053fd2c8ba425c2fe11e73cf6f8e4eb40
wpt-pr: 35341
@vinhill
Copy link

vinhill commented Jun 6, 2023

Since this change, the test is failing on Firefox, see bug 1783245 and this commit.

Also, if this test is aimed at restoring persistent state, we should assert that bfcache is not active (e.g. by changing the value of a span) and make this test optional.

@cdumez do you know of other ways to disable bfcache in Safari? I'm still investigating why no-store makes the test fail on Firefox. But to my knowledge, the HTML Spec defines no interaction between no-store and bfcache and browsers behave differently for no-store.

@hsinyi
Copy link

hsinyi commented Oct 26, 2023

Reopen this for reviewing and addressing vinhill's comment. Thanks!

@nt1m nt1m reopened this Oct 26, 2023
@petervanderbeken
Copy link

As vinhill noted, this test was working correctly in Firefox: the page didn't go into the BFCache for us because it has an opener, and we restored form values correctly. Adding no-store broke it for Firefox because no-store disables form restoration in Firefox.

This area isn't really specified well in HTML, and we are considering aligning our form restoration behaviour in that case with other browsers at some point. But it still seems wrong to change a test to work in WebKit and simultaneously break it in Firefox because of non-speced behaviours that are unrelated to the behaviour that the test is checking.

I don't think there's currently a good way to disable BFCache described in the specs. @smaug---- pointed out to me that the HTML spec does mention active WebSocket objects in https://html.spec.whatwg.org/#dom-pagetransitionevent-persisted-dev, but I'm not sure whether that's supported cross-browser too.

@foolip
Copy link
Member

foolip commented Nov 2, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus area: Forms test-change-proposal Proposal to add or remove tests for an interop area
Projects
None yet
7 participants