Object.assign is broken after 1.7.15 with custom ScriptableObjects #1558
Labels
docs
Issues containing stuff that ought to be documented
embedding Rhino
Issues related to enbedding Rhino
Regression
Milestone
The issue
This is related to #780, which changed how
Object.assign
works. That change makes sense as it aligns the implementation with the ECMA specification. However it is a breaking change for all customScriptableObject
based classes (not only inside RhinoJS itself, but in depending projects as well).Symptoms
Classes extending
ScriptableObject
quite often only override basicget
/put
/has
/getIds
methods. Trying to useObject.assign
ends with error due to missing attribute slot:rhino/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java
Line 486 in cc302b4
rhino/rhino/src/main/java/org/mozilla/javascript/ScriptableObject.java
Line 2598 in cc302b4
Quick solution to the issue
The first solution that comes to my mind is to make sure that missing attribute slot does not end with exception... at least not in case when called from
Object.assign
as the specification clearly states the following:So undefined property attributes is a well defined state... the property should be skipped.
Proper solution
Previous quick solution still means 1.7.15+ brought breaking changes for custom
ScriptableObject
implementations. I would appreciate if there would be clear example how customNativeObject
/IdScriptableObject
/ScriptableObject
should be implemented... in the case ofIdScriptableObject
implementation I guess one needs to overridefindInstanceIdInfo
method?Footnote
Not sure if this is a partial duplicate of #1549. That issue's description is a bit cryptic for me.
The text was updated successfully, but these errors were encountered: