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: skip top domain when cookie is disabled #580

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

liuyang1520
Copy link
Contributor

@liuyang1520 liuyang1520 commented Mar 3, 2023

Summary

  • fix: skip top domain when cookie is disabled
  • remove the random ids in the test cookie

For test cookie, we have the random id each time when testing whether the cookie is enabled in the browser, this might introduce too many cookies if the remove operation gets any issue. Following the TS SDK, think we can just use the general key for testing purpose.

With disabledCookies set to true, we still have a topDomain function which still uses the cookies (base-cookie):

  • move the getLocation and getHost to utils, so we can mock/stub the functions, otherwise as window.location is not writable/configurable, we cannot unit test the features, also moving these two standalone functions into utils for better readability.
  • skip calling topDomain in MetadataStorage when cookies is disabled.
  • this case is not testable in localhost as the domain doesn't have multiple levels.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

@liuyang1520 liuyang1520 requested a review from a team March 3, 2023 21:50
@liuyang1520 liuyang1520 marked this pull request as ready for review March 3, 2023 21:51
Copy link
Contributor

@yuhao900914 yuhao900914 left a comment

Choose a reason for hiding this comment

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

LGTM.

@liuyang1520 liuyang1520 merged commit a9ff324 into main Mar 6, 2023
@liuyang1520 liuyang1520 deleted the fix-disable-cookies-misses branch March 6, 2023 21:55
github-actions bot pushed a commit that referenced this pull request Mar 7, 2023
## [8.21.6](v8.21.5...v8.21.6) (2023-03-07)

### Bug Fixes

* skip top domain when cookie is disabled ([#580](#580)) ([a9ff324](a9ff324))
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.

None yet

4 participants