diff --git a/app/extensions/brave/content/scripts/blockFlash.js b/app/extensions/brave/content/scripts/blockFlash.js index b816779f8f3..7180ecd0f4f 100644 --- a/app/extensions/brave/content/scripts/blockFlash.js +++ b/app/extensions/brave/content/scripts/blockFlash.js @@ -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([{ diff --git a/test/bravery-components/flashTest.js b/test/bravery-components/flashTest.js index 03be763fb50..839ba032159 100644 --- a/test/bravery-components/flashTest.js +++ b/test/bravery-components/flashTest.js @@ -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 diff --git a/test/fixtures/flash_interception.html b/test/fixtures/flash_interception.html index 1aca2131261..77a58b0b0fe 100644 --- a/test/fixtures/flash_interception.html +++ b/test/fixtures/flash_interception.html @@ -15,4 +15,13 @@

Adobe Flash +
+ +
+ + get.adobe.com/flashplayer + +
+ +