Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/__tests__/domainMatch.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ describe('domainMatch', () => {
['🫠.com', 'xn--129h.com', true], // Emoji!
['ρһіѕһ.info', 'xn--2xa01ac71bc.info', true], // Greek + Cyrillic characters
['猫.cat', 'xn--z7x.cat', true], // Japanese characters

// domain that needs to be canonicalized
['www.google.com', '.google.com', true],
])('domainMatch(%s, %s) => %s', (string, domain, expectedValue) => {
expect(domainMatch(string, domain)).toBe(expectedValue)
})
Expand Down
2 changes: 1 addition & 1 deletion lib/cookie/domainMatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function domainMatch(
/* " o All of the following [three] conditions hold:" */

/* "* The domain string is a suffix of the string" */
const idx = _str.lastIndexOf(cookieDomain)
const idx = _str.lastIndexOf(_domStr)
if (idx <= 0) {
return false // it's a non-match (-1) or prefix (0)
}
Expand Down
Loading