Skip to content

Commit e07e7bb

Browse files
committed
Fix potential exception in procedural operator :matches-attr
Related issue: uBlockOrigin/uBlock-issues#3720
1 parent bb9e2c0 commit e07e7bb

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

platform/mv3/extension/js/scripting/css-procedural-api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class PSelectorMatchesAttrTask extends PSelectorTask {
119119
this.reValue = regexFromString(task[1].value, true);
120120
}
121121
transpose(node, output) {
122+
if ( typeof node.getAttributeNames !== 'function' ) { return; }
122123
const attrs = node.getAttributeNames();
123124
for ( const attr of attrs ) {
124125
if ( this.reAttr.test(attr) === false ) { continue; }

src/js/contentscript-extra.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class PSelectorMatchesAttrTask extends PSelectorTask {
9999
this.reValue = regexFromString(task[1].value, true);
100100
}
101101
transpose(node, output) {
102+
if ( typeof node.getAttributeNames !== 'function' ) { return; }
102103
const attrs = node.getAttributeNames();
103104
for ( const attr of attrs ) {
104105
if ( this.reAttr.test(attr) === false ) { continue; }

0 commit comments

Comments
 (0)