-
Notifications
You must be signed in to change notification settings - Fork 13
Adding entry for Publicsuffix flag #17
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13069,20 +13069,15 @@ const { Cookie } = tough; | |
| // it's possible to send these cookies to a domain someone could register after the fact, but | ||
| // for Heap, we need a parseable URI because internally we try to determine the right level to set | ||
| // a cookie, rather than having a known set of public suffix domains. | ||
| const FAKE_APP_URI = 'https://yourdomain.heap/'; | ||
| const FAKE_APP_URI = 'https://' + window.location.host; | ||
|
|
||
| (function(document) { | ||
| const store = new WebStorageCookieStore(localStorage); | ||
|
|
||
| const cookiejar = new tough.CookieJar(store); | ||
| Object.defineProperty(document, "cookie", { | ||
| get() { | ||
| return cookiejar.getCookieStringSync(FAKE_APP_URI); | ||
| }, | ||
| set(cookie) { | ||
| // loose: true lets us accept cookies with key and no value, which the | ||
| // original tests for this library included. | ||
| cookiejar.setCookieSync(Cookie.parse(cookie, {loose: true}), FAKE_APP_URI); | ||
| const store = new WebStorageCookieStore(localStorage); | ||
| const cookiejar = new tough.CookieJar(store); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line 13076 is redundant, and can be removed |
||
| const cookiejar = new tough.CookieJar(store, false); //false here sets the rejectPublicSuffix flag | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The argument that
|
||
| Object.defineProperty(document, "cookie", { | ||
| get() { | ||
| return cookiejar.getCookieStringSync(FAKE_APP_URI); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think formatting got broken here |
||
| } | ||
| }); | ||
| })(document); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave
yourdomain.heap- it's fine since we're adding the new flag. I'm also not 100% sure you always get window.location.host on all hybrid web apps, so wary of using it.