1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

Object.values() may fail for unknown reasons

Work around this issue by using more reliable
Object.keys().
This commit is contained in:
Raymond Hill 2020-09-11 08:30:11 -04:00
parent ead49e083a
commit 953ba1231f
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -282,7 +282,9 @@
let owner = root;
let chain = path;
for (;;) {
if ( owner instanceof Object === false ) { return false; }
if ( typeof owner !== 'object' || owner === null ) {
return false;
}
const pos = chain.indexOf('.');
if ( pos === -1 ) {
const found = owner.hasOwnProperty(chain);
@ -299,8 +301,8 @@
) {
const next = chain.slice(pos + 1);
let found = false;
for ( const item of owner.values() ) {
found = findOwner(item, next, prune) || found;
for ( const key of Object.keys(owner) ) {
found = findOwner(owner[key], next, prune) || found;
}
return found;
}