From 04a2e13b9920bf6b856cf465efca086f4c68d1fe Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Fri, 18 Aug 2023 13:23:38 +0200 Subject: [PATCH] again (see https://github.com/mozilla/rhino/pull/1357) take care of ScriptRuntime.isSymbol() == true; the object might be a NativeSymbol or a SymbolKey (found while working on https://github.com/mozilla/rhino/pull/1332) --- src/org/mozilla/javascript/IdScriptableObject.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/org/mozilla/javascript/IdScriptableObject.java b/src/org/mozilla/javascript/IdScriptableObject.java index bc7f963780..ba46b01940 100644 --- a/src/org/mozilla/javascript/IdScriptableObject.java +++ b/src/org/mozilla/javascript/IdScriptableObject.java @@ -917,9 +917,15 @@ protected ScriptableObject getOwnPropertyDescriptor(Context cx, Object id) { ScriptableObject desc = super.getOwnPropertyDescriptor(cx, id); if (desc == null) { if (id instanceof String) { - desc = getBuiltInDescriptor((String) id); - } else if (ScriptRuntime.isSymbol(id)) { - desc = getBuiltInDescriptor(((NativeSymbol) id).getKey()); + return getBuiltInDescriptor((String) id); + } + + if (ScriptRuntime.isSymbol(id)) { + if (id instanceof SymbolKey) { + return getBuiltInDescriptor((SymbolKey) id); + } + + return getBuiltInDescriptor(((NativeSymbol) id).getKey()); } } return desc;