Bug 266181
Summary: | Advanced tracking and fingerprinting protection performance issues with drawImage | ||
---|---|---|---|
Product: | WebKit | Reporter: | Daniel Beauchamp <daniel.beauchamp> |
Component: | New Bugs | Assignee: | Matthew Finkel <m_finkel> |
Status: | RESOLVED FIXED | ||
Severity: | Major | CC: | bidders.braces_0f, m_finkel, paul.neave, webkit-bug-importer, wenson_hsieh, wilander |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari 17 | ||
Hardware: | All | ||
OS: | iOS 17 |
Daniel Beauchamp
Description:
In iOS 17 and mac OS Sonoma, using drawPixels performance is slowed when paired with webgl rendering.
It is a common technique to get around webgl context limitations to render a scene to an offscreen canvas, then output it to a desired 2d canvas using drawImage.
However with Advanced Tracking and Fingerprinting protection, framerate seems to decrease dramatically.
Version:
Latest: 271834@main
Reproduction steps:
- Open the following in latest: https://evanescent-traveling-radio.glitch.me/
- You should see a box that you can spin smoothly
- Now open it in Privacy mode (which has advanced fingerprinting protection turned on)
- Spinning the box is now sluggish and choppy
If you turn off advanced fingerprinting protection, then suddenly its fast again.
This is the same on iOS 17
The minimal test case code is here: https://gist.github.com/pushmatrix/bd72b5853b49ff217b0a780ea54e5bd5
My assumption is that advanced tracking protection has a false positive here and is introducing noise to the drawImage functionality that is slowing rendering to a crawl.
Impact:
Model viewer (https://modelviewer.dev/) uses this offscreen technique to allow for lots of 3D elements on a page. It is currently affected by this: https://github.com/google/model-viewer/issues/4587
Many sites rely on this technique.
Shopify relies on this viewer for displaying 3D models on hundreds of thousands of sites. Currently anyone viewing it in webkit in privacy mode has a very degraded experience.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
This sounds like a duplicate of bug 263129. Does this still reproduce with iOS 17.2?
Alexey Proskuryakov
Please feel free to re-open if this still happens.
*** This bug has been marked as a duplicate of bug 263129 ***
Daniel Beauchamp
This is still happening in 17.2
I’ll be able to test on Mac this coming week, but it’s definitely still in 17.2 iOS 17.2 (21C62)
Radar WebKit Bug Importer
<rdar://problem/119783395>
Paul Neave
This is not fixed in iOS 17.2. Safari TP 17.4 still shows this issue too.
Daniel Beauchamp
Update on this. The issue seems to only persist when the source canvas is not in the DOM. Ex: if you just do document.createElement('canvas') to have function as an offscreen canvas, then the drawImage calls will be really slow.
If you however add the offscreen canvas to the DOM with appendChild, the problem goes away. Interestingly, if you do `display:none` on that canvas, the problem comes back. But if you set height to 0px to hide it, then everything is fine.
Here's an updated glitch with the offscreen canvas in the DOM and "hidden" with 0px height: https://common-teal-okapi.glitch.me
Matthew Finkel
Thanks for these details and providing the reduced test cases. I believe I see the issue.
Matthew Finkel
*** Bug 266473 has been marked as a duplicate of this bug. ***
Matthew Finkel
Pull request: https://github.com/WebKit/WebKit/pull/22746
Matthew Finkel
*** Bug 263013 has been marked as a duplicate of this bug. ***
EWS
Committed 273301@main (4c31678fef68): <https://commits.webkit.org/273301@main>
Reviewed commits have been landed. Closing PR #22746 and removing active labels.