Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #12171 from brave/issue-11401
Browse files Browse the repository at this point in the history
Exclude cookies from google.com domain
  • Loading branch information
bsclifton committed Feb 8, 2018
1 parent 10d025f commit a220321
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ importer.on('add-autofill-form-data-entries', (e, detail) => {
const shouldSkipCookie = (cookie) => {
// Bypassing cookie mismatch error in
// https://github.com/brave/browser-laptop/issues/11401
if (['https://notifications.google.com', 'https://myaccount.google.com',
'https://accounts.google.com'].includes(cookie.url)) {
const googleDomain = /^.*\.google.com(\..+)*$/
if (cookie.domain.match(googleDomain) &&
['OSID', 'LSID', 'SIDCC'].includes(cookie.name)) {
return true
}
return false
Expand Down
12 changes: 9 additions & 3 deletions test/unit/app/importerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ describe('importer unit tests', function () {
})

describe('shouldSkipCookie', function () {
it('returns true if domain is google and URL is one which has a mismatch', function () {
assert.equal(importer.shouldSkipCookie({domain: '.google.com', url: 'https://notifications.google.com'}), true)
it('returns true if domain is google and name is one which has a mismatch', function () {
assert.equal(importer.shouldSkipCookie({domain: '.google.com', name: 'OSID'}), true)
assert.equal(importer.shouldSkipCookie({domain: 'mail.google.com', name: 'LSID'}), true)
assert.equal(importer.shouldSkipCookie({domain: '.google.com.tw', name: 'SIDCC'}), true)
})

it('returns false for other cases', function () {
assert.equal(importer.shouldSkipCookie({domain: '.brave.com', url: 'https://brave.com'}), false)
assert.equal(importer.shouldSkipCookie({domain: '.brave.com', name: 'OSID'}), false)
assert.equal(importer.shouldSkipCookie({domain: 'ggoogle.com', name: 'OSID'}), false)
assert.equal(importer.shouldSkipCookie({domain: '.google.comm', name: 'OSID'}), false)
assert.equal(importer.shouldSkipCookie({domain: '.google.comm.', name: 'OSID'}), false)
assert.equal(importer.shouldSkipCookie({domain: '.google.com', name: 'BRAVE'}), false)
})
})
})

0 comments on commit a220321

Please sign in to comment.