1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-05 18:32:30 +01:00

Ensure that typeof of href attribute is string

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/777
This commit is contained in:
Raymond Hill 2019-11-08 09:30:59 -05:00
parent 71f3b07eef
commit 067ef5843c
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1429,11 +1429,10 @@ vAPI.bootstrap = (function() {
// https://github.com/chrisaljoudi/uBlock/issues/1143
// Find a link under the mouse, to try to avoid confusing new tabs
// as nuisance popups.
let elem = ev.target;
while ( elem !== null && elem.localName !== 'a' ) {
elem = elem.parentElement;
}
if ( elem === null ) { return; }
// https://github.com/uBlockOrigin/uBlock-issues/issues/777
// Mind that href may not be a string.
const elem = ev.target.closest('a[href]');
if ( elem === null || typeof elem.href !== 'string' ) { return; }
vAPI.messaging.send('contentscript', {
what: 'maybeGoodPopup',
url: elem.href || '',