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

Optimize supportsNativeFetch() with a fast path that avoids DOM I/O #2326

Merged
merged 2 commits into from
Nov 27, 2019
Merged

Optimize supportsNativeFetch() with a fast path that avoids DOM I/O #2326

merged 2 commits into from
Nov 27, 2019

Conversation

AaronO
Copy link
Contributor

@AaronO AaronO commented Nov 21, 2019

This fixes #2324 by adding a fast path for the scenario where the browser supports fetch and window.fetch hasn't been wrapped or polyfilled (which should be very common on modern browsers)

This avoids expensive DOM I/O in the critical path during the initial load.

Fallbacking to the expensive iframe check, if necessary.

Note

The new isNativeFetch() check is also more robust than the previous implementation, which could yield false positives (since it only checked if the function's body contained native).

Copy link
Member

@HazAT HazAT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the issue report + nice PR!
LGTM wdyt @kamilogorek

@kamilogorek
Copy link
Contributor

Looks much better now. Thanks! Feel free to merge @HazAT

@HazAT HazAT merged commit a6c0081 into getsentry:master Nov 27, 2019
@AaronO AaronO deleted the optimize/native-fetch-check branch November 27, 2019 09:13
@AaronO
Copy link
Contributor Author

AaronO commented Nov 27, 2019

@HazAT Thanks for merging this, any idea of when it will be shipped in a release ?

@HazAT
Copy link
Member

HazAT commented Nov 27, 2019

We are in the process of releasing 5.10.0 with a lot of internal improvements.
We are testing it on sentry.io, I would say mid next week.

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.

Inefficient supportsNativeFetch() check (does DOM I/O)
3 participants