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: Make IS_MAYBE_MIRAGE work in Firefox #9360

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

MichalBryxi
Copy link
Contributor

@MichalBryxi MichalBryxi commented Apr 16, 2024

Description

  • FF vs Chrome produces different toString() for native window.fetch.
  • This patch fixes that.

Firefox

"function fetch() {
    [native code]
}"

Chrome

'function fetch() { [native code] }'

Notes for the release

Fix of a bug where Mirage identification failed for Firefox.

@MichalBryxi MichalBryxi force-pushed the ff-vs-chrome-maybe-mirage branch from 075a959 to ee8d186 Compare April 16, 2024 11:13
- FF vs Chrome produces different `toString()` for native `window.fetch`.
- This patch fixes that.
@MichalBryxi MichalBryxi force-pushed the ff-vs-chrome-maybe-mirage branch from ee8d186 to 660285c Compare April 16, 2024 11:16
@runspired runspired added 🎯 canary PR is targeting canary (default) 🏷️ bug This PR primarily fixes a reported issue labels Apr 16, 2024
@runspired runspired merged commit 0be800c into emberjs:main Apr 16, 2024
26 of 27 checks passed
@MichalBryxi
Copy link
Contributor Author

One smarter person than me suggested that maybe a better option would be to make the toString() whitespace agnostic and thus avoid any formatting issues whatsoever:

window.fetch.toString().replace(/\s+/g, '') !== 'function fetch() { [native code] }'.replace(/\s+/g, '');

@runspired
Copy link
Contributor

@MichalBryxi yeah I thought of that too, am down. Runs in debug only though so not a huge thing either way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 canary PR is targeting canary (default) 🏷️ bug This PR primarily fixes a reported issue
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants