-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix Safari bug which mistakenly requested WebP images #7817
Conversation
// after a successful image load event | ||
if (webpImgTestOnloadComplete) { | ||
testWebpTextureUpload(gl); | ||
} |
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 think there is still a possible race condition here. testSupport
could run when the image has successfully loaded (webpImgTest.complete === true
) but onload
has not run yet. In this case testWebpTextureUpload
would never run and it would never start loading webps. That isn't as bad as loading then when we shouldn't but it might be good to fix.
I think this could be fixed by adding
} else {
glForTesting = gl;
}
here and removing the if (!webpImgTest.complete) {
section completely.
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 think I pushed the changes you're asking for
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 think this looks good!
Launch Checklist
I uncovered a bug while testing iOS Safari in which WebP images would occasionally be requested. This PR fixes that bug by waiting until the image's onload event fires to check for WebP support.
@mapbox/studio
and/or@mapbox/maps-design
if this PR includes style spec changes