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

Add nested flash link check #8756

Merged
merged 1 commit into from
May 19, 2017
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: 4 additions & 1 deletion app/extensions/brave/content/scripts/blockFlash.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ if (adobeRegex.test(window.location.href)) {

if (chrome.contentSettings.flashEnabled == 'allow') {
document.addEventListener('click', (e) => {
let href = e.target.href || (e.target.parentNode && e.target.parentNode.href)
let node = e.target
while (!node.href && node.parentNode)
node = node.parentNode
const href = node.href
if (href && href.match(adobeRegex)) {
e.preventDefault()
chrome.ipcRenderer.send('dispatch-action', JSON.stringify([{
Expand Down
11 changes: 11 additions & 0 deletions test/bravery-components/flashTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ describe('flash install interception', function () {
return this.getText(notificationBar).then((val) => val.includes('run Flash Player'))
})
})
it('shows notification bar on nested span click', function * () {
yield this.app.client
.tabByIndex(0)
.loadUrl(this.flashUrl)
.click('#flashNestedSpan')
.windowByUrl(Brave.browserWindowUrl)
.waitForExist(notificationBar)
.waitUntil(function () {
return this.getText(notificationBar).then((val) => val.includes('run Flash Player'))
})
})
it('shows flash notification bar when small element is loaded', function * () {
const flashUrl = Brave.server.url('flash_small.html')
yield this.app.client
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/flash_interception.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,13 @@
</p>
<a id='flashLink' target='_blank' href='https://get.adobe.com/flashplayer/'>Adobe Flash</a>
</div>
<div>
<a href='https://get.adobe.com/flashplayer/'>
<div>
<span>
<span id='flashNestedSpan'>get.adobe.com/flashplayer</span>
</span>
<div>
</a>
</div>
</body>