mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Object.values() may fail for unknown reasons
Work around this issue by using more reliable Object.keys().
This commit is contained in:
parent
ead49e083a
commit
953ba1231f
@ -282,7 +282,9 @@
|
|||||||
let owner = root;
|
let owner = root;
|
||||||
let chain = path;
|
let chain = path;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if ( owner instanceof Object === false ) { return false; }
|
if ( typeof owner !== 'object' || owner === null ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const pos = chain.indexOf('.');
|
const pos = chain.indexOf('.');
|
||||||
if ( pos === -1 ) {
|
if ( pos === -1 ) {
|
||||||
const found = owner.hasOwnProperty(chain);
|
const found = owner.hasOwnProperty(chain);
|
||||||
@ -299,8 +301,8 @@
|
|||||||
) {
|
) {
|
||||||
const next = chain.slice(pos + 1);
|
const next = chain.slice(pos + 1);
|
||||||
let found = false;
|
let found = false;
|
||||||
for ( const item of owner.values() ) {
|
for ( const key of Object.keys(owner) ) {
|
||||||
found = findOwner(item, next, prune) || found;
|
found = findOwner(owner[key], next, prune) || found;
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user