Few questions:

1) So, we are allowing delete on non-configurable properties. Is this
fine from optimization PoV? i.e., we can't assume that a
non-configurable property can not be deleted.

2) ScriptObject.clear - it appears previously, it deleted inherited
properties too. Now only immediate properties. Intended? do we have
tests to cover these cases?

3) Global's clear method clears lexicalScope. Do we need a test for ES6
lexical scope clear?

-Sundar

On 6/17/2016 7:24 PM, Hannes Wallnöfer wrote:
> Please review JDK-8159589: ScriptObjectMirror.clear() should remove all 
> enumerable properties:
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8159589
> Webrev: http://cr.openjdk.java.net/~hannesw/8159589/webrev.00/
>
> In our current implementation, ScriptObjectMirror.clear() observes JS 
> semantics by not clearing properties that are non-configurable, and even 
> throwing type error when invoking clear() on an object that contains such 
> properties.
>
> IMO, there’s no need to follow JS semantics since we’re calling the method 
> from outside of JS. With this change, clear() will remove all enumerable 
> properties. This also makes the method consistent with size() and isEmpty(), 
> which previously could return values > 0 and false after calling clear().
>
> On a practical note, this is really convenient with global objects as it can 
> be used to return globals to their initial state after an eval, removing all 
> declared vars and functions but leaving the (non-enumerable) built-ins.
>
> Hannes

Reply via email to