diff --git a/app/importer.js b/app/importer.js index 1e2d898ecf4..2c37ab723e0 100644 --- a/app/importer.js +++ b/app/importer.js @@ -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 diff --git a/test/unit/app/importerTest.js b/test/unit/app/importerTest.js index dc95ab23d05..00e079aff13 100644 --- a/test/unit/app/importerTest.js +++ b/test/unit/app/importerTest.js @@ -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) }) }) })