DescriptionThe internal virtualize() of ES5/3 used to create an accessor property
which, besides being a visible deviation from ES5 semantics, also did
not protect against defineProperty or object literals creating
overriding properties. Instead, it now causes _any_ property with the
given property name to be represented as an accessor property with a
magic flag (name + '_av___') which causes it to reflect like a data
property.
A small change in existing internals is necessary: the (name + '_gw___')
flag now may be set for these properties, so as to store the writable
attribute of these virtual data properties; isWritable() has changed to
not fastpath such properties.
Impact:
* Fixes issue 1667, using defineProperty or literals to bypass
virtualization.
* Fixes issue 1668, cajaVM.def not traversing into virtualized methods.
* Virtualized properties now conform to ES5 semantics; in particular:
* Formerly, they would never appear to be 'own' when assigned; that
is,
var o = {}; o.toString = ...; o.hasOwnProperty('toString')
used to be false, but is now true.
* Virtualized properties other than toString and valueOf can be given
non-function values.
Supporting changes:
* Added an end-to-end test that we are not exposing such unfrozen
primordials as this bug was causing.
* Harness in ES53ConformanceTest assumed the property named 'test'
was not virtualized; fixed to use v___ access.
* expectFailure now explains that it had an unexpected error rather
than just throwing it, which helps debugging with less-helpful
consoles.
* expectFailure now catches bad arguments that would cause it to
trivially succeed-by-failing.
* Changes to es53-test-taming-tamed-guest.html test
testTamingFramePrimordialsAreFrozen, which would have caught this
bug:
* Remove assumption there exists at least one accessor (now false).
* Invoke getters and traverse into given values.
* Fix incorrect invocation of expectFailure which always trivially
failed.
* Fixed incorrect invocation of expectFailure in
es53-test-taming-untamed-guest.html which did not even fail as
expected; to get intended failures, made host-side eval be in strict
mode.
* Added names for setTimeout and friends in the sampleObjects list
in es53-test-domado-dom-guest.html.
@r5369
Patch Set 1 #Patch Set 2 : [APICHANGE] Make ES5/3 property virtualization conformant by hiding accessors. #Patch Set 3 : [APICHANGE] Make ES5/3 property virtualization conformant by hiding accessors. #
Total comments: 13
Patch Set 4 : [APICHANGE] Make ES5/3 property virtualization conformant by hiding accessors. #Patch Set 5 : [APICHANGE] Make ES5/3 property virtualization conformant by hiding accessors. #Patch Set 6 : [APICHANGE] Make ES5/3 property virtualization conformant by hiding accessors. #Patch Set 7 : [APICHANGE] Make ES5/3 property virtualization conformant by hiding accessors. #Patch Set 8 : [APICHANGE] Make ES5/3 property virtualization conformant by hiding accessors. #MessagesTotal messages: 25
|