freezing an Object from Java code

74 views
Skip to first unread message

P

unread,
May 19, 2021, 8:47:23 AM5/19/21
to mozilla-rhino
Hi,

Trying to implement Template Strings in Rhino, getting pretty close passing all tests of test262.

However, according to the specs I need to freeze some objects (step 12 in https://262.ecma-international.org/11.0/#sec-gettemplateobject)

The ecma spec defines an abstract setIntegrityLevel method (https://262.ecma-international.org/11.0/#sec-setintegritylevel), that ought to be used and is also to be used by Object.seal & Object.freeze.

Rhino supports Object.seal/freeze, but the implementation of that is located within NativeObject.execIdCall

So, I can either:
- duplicate the logic
- try to call the NativeObject.execIdCall somehow
- extract the logic in NativeObject.execIdCall to some setIntegrityLevel  method somewhere and refactor the .seal/freeze impl. to use that new setIntegrityLevel method as well

I think the later option is preferred, but what would be a good place to put it? While working on some other new EcmaScript feature impl. I also ran into similar issues, where the spec defines some abstract Object operations, that within Rhino are scattered throughout different classes and/or not 100% spec-compliant.

So I wonder about creating a org.mozilla.javascript.ecma.operations.Objects class in which to place these abstract operations.

Thoughts? Also wondering what the accessibility of these methods ought to be: public of package scoped?

Paul

P

unread,
May 19, 2021, 8:48:17 AM5/19/21
to mozilla-rhino
Oh, btw: if this sort of stuff is better discussed in GitLab, lemme know

P

unread,
Jul 2, 2021, 2:31:14 AM7/2/21
to mozilla-rhino
Sorted this out in gitlab
Reply all
Reply to author
Forward
0 new messages