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

Exclude cookies from google.com domain #12171

Merged
merged 1 commit into from
Feb 8, 2018
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
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)
})
})
})