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

Commit d1c8e3e

Browse files
committed
Add test for data leak
1 parent 74c7f6f commit d1c8e3e

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

test/components/autofillTest.js

+61
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* global describe, it, before */
22

33
const Brave = require('../lib/brave')
4+
const assert = require('assert')
5+
const messages = require('../../js/constants/messages')
46
const {urlInput, autofillAddressPanel, autofillCreditCardPanel} = require('../lib/selectors')
57
const {getTargetAboutUrl} = require('../../js/lib/appUrlUtil')
68

@@ -253,4 +255,63 @@ describe('Autofill', function () {
253255
.waitForVisible('[data-l10n-id=noCreditCardsSaved]')
254256
})
255257
})
258+
259+
describe('prevent autocomplete data leak from private to regular', function () {
260+
Brave.beforeAll(this)
261+
const url = 'https://yoast.com/research/autocompletetype.php'
262+
before(function * () {
263+
yield setup(this.app.client)
264+
})
265+
it('submit form on regular', function * () {
266+
yield this.app.client
267+
.ipcSend(messages.SHORTCUT_NEW_FRAME, url)
268+
.waitForUrl(url)
269+
.windowByUrl(Brave.browserWindowUrl)
270+
.waitForExist('.tab[data-frame-key="2"]')
271+
.waitForVisible('webview[partition="persist:default"]')
272+
.tabByUrl(this.url)
273+
.setValue('[x-autocompletetype="name"]', 'bravery')
274+
.click('[value="Submit your name"]')
275+
.loadUrl(url)
276+
.click('[x-autocompletetype="name"]')
277+
.keys('b')
278+
.windowByUrl(Brave.browserWindowUrl)
279+
let item = yield this.app.client.getText('.contextMenuItemText')
280+
assert.equal(item, 'bravery')
281+
yield this.app.client.setContextMenuDetail()
282+
})
283+
it('submit form on private', function * () {
284+
yield this.app.client
285+
.ipcSend(messages.SHORTCUT_NEW_FRAME, url, { isPrivate: true })
286+
.waitForUrl(url)
287+
.windowByUrl(Brave.browserWindowUrl)
288+
.waitForExist('.tab.private[data-frame-key="3"]')
289+
.waitForVisible('webview[partition="default"]')
290+
.tabByUrl(this.url)
291+
.setValue('[x-autocompletetype="name"]', 'bravery2')
292+
.click('[value="Submit your name"]')
293+
.loadUrl(url)
294+
.click('[x-autocompletetype="name"]')
295+
.keys('b')
296+
.windowByUrl(Brave.browserWindowUrl)
297+
let item = yield this.app.client.getText('.contextMenuItemText')
298+
assert.equal(item, 'bravery')
299+
yield this.app.client.setContextMenuDetail()
300+
})
301+
it('check on regular', function * () {
302+
yield this.app.client
303+
.ipcSend(messages.SHORTCUT_NEW_FRAME, url)
304+
.waitForUrl(url)
305+
.windowByUrl(Brave.browserWindowUrl)
306+
.waitForExist('.tab[data-frame-key="4"]')
307+
.waitForVisible('webview[partition="persist:default"]')
308+
.tabByUrl(this.url)
309+
.click('[x-autocompletetype="name"]')
310+
.keys('b')
311+
.windowByUrl(Brave.browserWindowUrl)
312+
let item = yield this.app.client.getText('.contextMenuItemText')
313+
assert.equal(item, 'bravery')
314+
yield this.app.client.setContextMenuDetail()
315+
})
316+
})
256317
})

0 commit comments

Comments
 (0)