Skip to content

Add electron enviroment check to http headers overwrite #2452

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

Closed
wants to merge 2 commits into from

Conversation

aprTaylor
Copy link

Checks for Electron environment before overwriting HTTPS headers.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@aprTaylor
Copy link
Author

@googlebot I signed it!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@aprTaylor
Copy link
Author

@googlebot I fixed it.

1 similar comment
@aprTaylor
Copy link
Author

@googlebot I fixed it.

@Feiyang1
Copy link
Member

Hi @agray5 Can you please tell us what the motivation is for this change?
We added this check to workaround the header issues in react native. #703

Are you facing a similar issue in Electron?

@mikelehen
Copy link
Contributor

@Feiyang1 FYI- The context here is #1491. It turns out this issue happens whenever the browser environment doesn't send an Origin header. React Native ran into this, but Electron/7 and other environments seem to also be hitting it.

* @return true if Electron environment is detected.
*/
export function isElectron(): boolean {
const userAgent = navigator.userAgent.toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

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

navigator may not be defined in some environments (e.g. node.js) and so this could crash. The easy solution is to use the existing getUA() helper.

@mikelehen mikelehen assigned aprTaylor and unassigned mikelehen Dec 19, 2019
@mikelehen
Copy link
Contributor

Thanks @agray5 I ended up just rolling this up into https://github.com/firebase/firebase-js-sdk/pull/2464/files which I will try to get checked in and released sometime in January. Appreciate the help!

@mikelehen mikelehen closed this Dec 20, 2019
@firebase firebase locked and limited conversation to collaborators Jan 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants