From 953ba1231fadfa4761dc169f306588afe0a0101d Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 11 Sep 2020 08:30:11 -0400 Subject: [PATCH] Object.values() may fail for unknown reasons Work around this issue by using more reliable Object.keys(). --- assets/resources/scriptlets.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/resources/scriptlets.js b/assets/resources/scriptlets.js index 0a1c835e6..d09ebc7e0 100644 --- a/assets/resources/scriptlets.js +++ b/assets/resources/scriptlets.js @@ -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; }