Bug 234913

Summary: Safari iOS stops rendering after switching away and back when using RobotoBold Font
Product: WebKit Reporter: Gregg Tavares <gman>
Component: CanvasAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: dino, graouts, jonlee, kbr, kkinnunen, kpiddington, mmaxfield, sabouhallawa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=234923
Attachments:
Description Flags
repo for issue above none

Gregg Tavares
Reported 2022-01-06 00:41:31 PST
Created attachment 448469 [details] repo for issue above Steps to repo 1) Download the zip file, unzip, serve the file (npx servez), open test.html in Safari on iOS (http://<your-mac-ip-address>:8080/test.html) 2) Switch from Safari to the home screen, wait a few seconds 3) Switch back to Safari What should happen: you should see some text "Hello World" and "Round 1" animating as well as a count counting up What happens instead: No animation happens Here's a video of it happening ( https://www.youtube.com/watch?v=FftyV0iYtJw ) Notice after going back to Safari the counter is no longer updating If you go change line 115 from "RobotoBold" to "monospace" and follow the steps above (kill the tab first), you'll see with "monospace" the animation does not stop. HEre's a video of it working with "monospace" ( https://www.youtube.com/watch?v=g8rKxxayZHw ). notice after going back to Safari the counter is still updating The sample uses `setInterval` (yea, I know, it should use rAF, the code that provoked this is probably > 10 year old) If you use the remote debugger, after restoring safari, and put a breakpoint on `draw` you'll see it only gets called once every several seconds and though it is calling drawing functions none of them are affecting the canvas. Further, often you can't even refresh the tab in Safari. You can kill the tab and start a new one though. My understanding is this worked on iOS 14 (don't have iOS 14 to test but the person that found the bug originally said their site broke when they upgraded to iOS 15). This is the small repo.
Attachments
repo for issue above (90.01 KB, application/zip)
2022-01-06 00:41 PST, Gregg Tavares
no flags
Gregg Tavares
Comment 1 2022-01-06 00:49:06 PST
Also note, FWIW, switching to rAF seems to fix the issue. Change the code from setInterval(draw, 10); to // setInterval(draw, 10); function animate() { draw(); requestAnimationFrame(animate); } requestAnimationFrame(animate); It's great there's a workaround but it seems like some kind of memory corruption is happening in the bad case given that setInterval starts running at ~5-10 seconds per callback instead of 10ms and that drawing commands don't actually draw and that refresh fails.
Kenneth Russell
Comment 2 2022-01-06 13:00:26 PST
CC'ing myself and another colleague.
Kenneth Russell
Comment 3 2022-01-06 13:00:43 PST
CC'ing another colleague.
Kimmo Kinnunen
Comment 4 2022-01-10 02:24:11 PST
Thanks for the report. I cannot immediately repro with trunk. Trying with an older release.
Radar WebKit Bug Importer
Comment 5 2022-01-13 00:42:17 PST
Dean Jackson
Comment 6 2022-01-13 09:01:47 PST
This is amazing.
Kimmo Kinnunen
Comment 7 2022-01-16 23:57:52 PST
I think this is fixed with trunk. I could repro it on iPad8,3 on 15.3 seed, but could not repro on trunk. We had canvas rendering IPC changed to other implementation in between.
Jon Lee
Comment 8 2022-02-10 11:04:34 PST
Please check on the 15.4 seeds. If this still reproduces there, please reopen.
Note You need to log in before you can comment on or make changes to this bug.