Skip to content

Commit

Permalink
Ensure that typeof of href attribute is string
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 8, 2019
1 parent 71f3b07 commit 067ef58
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/js/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '',
Expand Down

0 comments on commit 067ef58

Please sign in to comment.