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 URLSearchParams.size missing in slightly older browsers #344

Merged

Conversation

freeatnet
Copy link
Contributor

Motivation and Context

Fixes #317

Some slightly older browsers, such as Safari <17 and Chrome <113, do not support URLSearchParams.size. urlParams.size > 0, the check for whether a URLSearchParams object contains any data, returns false in these browsers, causing the code to treat these params objects as empty and resulting in search and hash elements of the URL being erased when initializing a Web3Auth instance.

Description

This PR changes the comparison from u.size > 0 to u.size !== 0, which evaluates to false only if attribute size exists and the object doesn't contain any data.

How has this been tested?

The change was tested in Safari for iOS 16.4 and 17, macOS Safari 16 and 17, and Android Chrome 128 by signing into a web3auth client application that uses search and hash params to pass dapp data.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project. (run lint)
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Member

@chaitanyapotti chaitanyapotti left a comment

Choose a reason for hiding this comment

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

lgtm

@chaitanyapotti chaitanyapotti merged commit 20337b6 into Web3Auth:master Oct 18, 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.

getHashQueryParams removes search and hash on iOS 16 WKWebView
2 participants