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: handle issue with process and DOM conflict #1331

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

IvanKalinin
Copy link
Contributor

CLA

  • I have signed the Stream CLA (required).
  • Code changes are tested

Description of the changes, What, Why and How?

Any DOM element with an id can be accessed from the window object by window.{EL_ID}.
Also, global variables are available without chaining window object. e.g.
variableName // global variable is the same as window.variableName

Therefore if a page contains a DOM element with id "process" the client constructor check typeof process !== "undefined" is not sufficient. process.env.ANY_ENV_VARIABLE will throw the TypeError TypeError: process.env is undefined that crashes the messenger.

image

Changelog

  • Implemented additional check for process.env object.

Copy link
Member

@oliverlaz oliverlaz left a comment

Choose a reason for hiding this comment

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

hi @IvanKalinin, thanks for contributing this fix. It looks good to me.

@oliverlaz oliverlaz changed the title Handle issue with process and DOM conflict. fix: Handle issue with process and DOM conflict Aug 6, 2024
@oliverlaz oliverlaz changed the title fix: Handle issue with process and DOM conflict fix: handle issue with process and DOM conflict Aug 6, 2024
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.

3 participants