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

Commit

Permalink
Dismiss autofill context menu when tabId is different
Browse files Browse the repository at this point in the history
fix #6820

Auditors: @bbondy, @bsclifon

Test Plan: Covered by automatic test
  • Loading branch information
darkdh authored and bsclifton committed Jan 25, 2017
1 parent 7239b48 commit 238cfd3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
2 changes: 1 addition & 1 deletion js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ class Frame extends ImmutableComponent {
})
this.webview.addEventListener('hide-autofill-popup', (e) => {
if (this.props.contextMenuDetail && this.props.contextMenuDetail.get('type') === 'autofill' &&
this.webview.isFocused()) {
(this.props.contextMenuDetail.get('tabId') !== this.props.tabId || this.webview.isFocused())) {
windowActions.autofillPopupHidden(this.props.tabId)
}
})
Expand Down
35 changes: 35 additions & 0 deletions test/components/autofillTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,4 +614,39 @@ describe('Autofill', function () {
})
})
})
describe('autofill context menu', function () {
Brave.beforeAll(this)
before(function * () {
yield setup(this.app.client)
this.formfill = Brave.server.url('formfill.html')
yield this.app.client
.tabByIndex(0)
.loadUrl(this.formfill)
.waitForVisible('<form>')
.setValue('[name="04fullname"]', 'test')
.click('#submit')
})
it('hide when scroll', function * () {
yield this.app.client
.tabByIndex(0)
.waitForVisible('<form>')
.click('[name="04fullname"]')
.click('[name="04fullname"]')
.windowByUrl(Brave.browserWindowUrl)
.waitForVisible('.contextMenuItemText')
.keys(Brave.keys.PAGEDOWN)
.waitForVisible('.contextMenuItemText', 1000, true)
})
it('hide when new tab', function * () {
yield this.app.client
.tabByIndex(0)
.waitForVisible('<form>')
.click('[name="04fullname"]')
.click('[name="04fullname"]')
.windowByUrl(Brave.browserWindowUrl)
.waitForVisible('.contextMenuItemText')
.ipcSend(messages.SHORTCUT_NEW_FRAME, this.formfill + '?2')
.waitForVisible('.contextMenuItemText', 1000, true)
})
})
})
3 changes: 2 additions & 1 deletion test/lib/brave.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ var exports = {
BACKSPACE: '\ue003',
DELETE: '\ue017',
DOWN: '\ue015',
UP: '\ue013'
UP: '\ue013',
PAGEDOWN: '\uE00F'
},

defaultTimeout: 10000,
Expand Down

0 comments on commit 238cfd3

Please sign in to comment.