Fix potential exception in procedural operator :matches-attr

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3720
This commit is contained in:
Raymond Hill 2025-07-18 10:23:11 -04:00
parent bb9e2c0fc7
commit e07e7bbd09
No known key found for this signature in database
GPG key ID: 25E1490B761470C2
2 changed files with 2 additions and 0 deletions

View file

@ -119,6 +119,7 @@ class PSelectorMatchesAttrTask extends PSelectorTask {
this.reValue = regexFromString(task[1].value, true);
}
transpose(node, output) {
if ( typeof node.getAttributeNames !== 'function' ) { return; }
const attrs = node.getAttributeNames();
for ( const attr of attrs ) {
if ( this.reAttr.test(attr) === false ) { continue; }

View file

@ -99,6 +99,7 @@ class PSelectorMatchesAttrTask extends PSelectorTask {
this.reValue = regexFromString(task[1].value, true);
}
transpose(node, output) {
if ( typeof node.getAttributeNames !== 'function' ) { return; }
const attrs = node.getAttributeNames();
for ( const attr of attrs ) {
if ( this.reAttr.test(attr) === false ) { continue; }