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

Fix Safari bug which mistakenly requested WebP images #7817

Merged
merged 4 commits into from
Jan 25, 2019

Conversation

ryanhamley
Copy link
Contributor

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.

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores
  • manually test the debug page
  • tagged @mapbox/studio and/or @mapbox/maps-design if this PR includes style spec changes

@ryanhamley ryanhamley requested a review from ansis January 25, 2019 00:05
// after a successful image load event
if (webpImgTestOnloadComplete) {
testWebpTextureUpload(gl);
}
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

@ansis ansis left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants