| Summary: | visibilitychange event does not get always fired on background but it may on foreground | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Alexander Cerutti <cerutti.alexander> | ||||
| Component: | WebCore JavaScript | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Normal | CC: | cdumez, Kongpheng.Nanthavongsa, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari 12 | ||||||
| Hardware: | iPhone / iPad | ||||||
| OS: | iOS 12 | ||||||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=205942 | ||||||
| Attachments: |
|
||||||
|
Description
Alexander Cerutti
2020-02-05 04:20:05 PST
Created attachment 389818 [details]
Repro html page
I've found a way to reproduce almost-steadly the problem while using sleep button. With the sample that I'm attaching, which is a normal video tag with a `visibilitychange` event attached on document, I've tried to lock and unlock the iPad with iOS 12, different times. The video was playing before this happened. Some unlocks (may vary from 3 to 5 or more), the video didn't came back to playing automatically and the `visibilitychanged` event started being fired only on foreground. This situation can persist for some other lock-unlock actions but it will recover somehow and then can fall back in this again. I don't know how this can be related or linked under the hood, but seems the only almost-steady way I found to reproduce this problem. Instead, I didn't found yet a way to reproduce the problem that happens when home button is pressed. Anyway, if the player is paused after unlock, pressing home button still fires the event `visibilitychanged`. I think that they might be two different but related problems. Likely related to process suspension on iOS. When you lock the screen or home out of Safari, our processes get suspended shortly after. As a result, we may or may not have time to fire the visibilitychange event before we get suspended. The event normally gets fired when the process resumes if it did to have time to get fired before suspension. Any updates? This bug is still reproducible on iOS 13.5.1. I included a fiddle to reproduce the issue, without the need for a video element: https://jsfiddle.net/vkpheng/pv0omfrn/. To reproduce: * On iOS Safari, open this fiddle and run it * Click Home button to background Safari * Immediately click Safari icon to bring Safari back to the foreground * Notice that no alert pops up Expected: an alert pops up, since there was a visibility change. Please advise. Thanks! |