Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1219)

Issue 7807043: [APICHANGE] Make ES5/3 property virtualization conformant by hiding accessors. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 2 months ago by kpreid2
Modified:
11 years ago
CC:
caja-discuss-undisclosed_googlegroups.com, ihab.awad, Jasvir, metaweta, MikeSamuel, MarkM, felix8a, kpreid2
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

The 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. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+391 lines, -110 lines) Patch
M src/com/google/caja/es53.js View 1 2 3 4 5 6 7 49 chunks +253 lines, -96 lines 0 comments Download
M tests/com/google/caja/parser/quasiliteral/ES53ConformanceTest.java View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/parser/quasiliteral/ES53RewriterTest.java View 1 2 3 4 5 6 7 2 chunks +64 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-domado-dom-guest.html View 1 2 3 4 5 6 7 2 chunks +6 lines, -1 line 0 comments Download
M tests/com/google/caja/plugin/es53-test-language-guest.html View 1 2 3 4 5 6 7 1 chunk +25 lines, -0 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-taming-tamed-guest.html View 1 2 3 4 5 6 7 3 chunks +13 lines, -5 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-taming-untamed.js View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/plugin/es53-test-taming-untamed-guest.html View 1 2 3 4 5 6 7 2 chunks +13 lines, -2 lines 0 comments Download
M tests/com/google/caja/plugin/jsunit.js View 1 2 3 4 5 6 7 1 chunk +15 lines, -4 lines 0 comments Download

Messages

Total messages: 25
kpreid2
11 years, 2 months ago (2013-03-14 00:13:43 UTC) #1
kpreid2
A note on the status of this change: I think there should be more tests ...
11 years, 2 months ago (2013-03-14 00:15:46 UTC) #2
MarkM
What about test262? On Wed, Mar 13, 2013 at 5:15 PM, <kpreid.switchb.org@gmail.com> wrote: > A ...
11 years, 2 months ago (2013-03-14 02:26:12 UTC) #3
kpreid2
On 2013/03/14 02:26:12, MarkM wrote: > What about test262? A relevant point. Can you tell ...
11 years, 2 months ago (2013-03-14 03:12:07 UTC) #4
MarkM
On Wed, Mar 13, 2013 at 8:12 PM, <kpreid.switchb.org@gmail.com> wrote: > On 2013/03/14 02:26:12, MarkM ...
11 years, 2 months ago (2013-03-14 03:25:44 UTC) #5
kpreid2
ping ihab
11 years, 2 months ago (2013-03-19 17:00:39 UTC) #6
kpreid2
The internal virtualize() of ES5/3 used to create an accessor property which, besides being a ...
11 years, 1 month ago (2013-03-19 21:46:35 UTC) #7
kpreid2
New snapshot with additions to ES53RewriterTest checking virtualized property behavior specifically. Also note that https://codereview.appspot.com/7905045/ ...
11 years, 1 month ago (2013-03-19 21:50:03 UTC) #8
Mark S. Miller
On Tue, Mar 19, 2013 at 2:50 PM, <kpreid.switchb.org@gmail.com> wrote: > New snapshot with additions ...
11 years, 1 month ago (2013-03-20 08:32:36 UTC) #9
kpreid2
The internal virtualize() of ES5/3 used to create an accessor property which, besides being a ...
11 years, 1 month ago (2013-03-20 19:42:21 UTC) #10
kpreid2
New snapshot with logger changes deleted as previously noted. Additional changes: * cajaVM.es5ProblemReports as added ...
11 years, 1 month ago (2013-03-20 19:44:03 UTC) #11
MarkM
ses/* LGTM. I leave the rest to others.
11 years, 1 month ago (2013-03-24 23:37:39 UTC) #12
ihab.awad
lgtm++ https://codereview.appspot.com/7807043/diff/28001/src/com/google/caja/es53.js File src/com/google/caja/es53.js (right): https://codereview.appspot.com/7807043/diff/28001/src/com/google/caja/es53.js#newcode831 src/com/google/caja/es53.js:831: // convert grant writable to fastpath writable, only ...
11 years, 1 month ago (2013-03-27 17:06:37 UTC) #13
kpreid2
The internal virtualize() of ES5/3 used to create an accessor property which, besides being a ...
11 years, 1 month ago (2013-03-27 17:28:51 UTC) #14
kpreid2
New snapshot. https://codereview.appspot.com/7807043/diff/28001/src/com/google/caja/es53.js File src/com/google/caja/es53.js (right): https://codereview.appspot.com/7807043/diff/28001/src/com/google/caja/es53.js#newcode831 src/com/google/caja/es53.js:831: // convert grant writable to fastpath writable, ...
11 years, 1 month ago (2013-03-27 17:29:30 UTC) #15
felix8a
this patch causes a test failure: es5=true&test-driver=es53-test-taming-untamed.js FAIL: testRecordNumerics: TypeError: Non-function given as shouldFail to ...
11 years, 1 month ago (2013-03-27 21:22:06 UTC) #16
kpreid2
The internal virtualize() of ES5/3 used to create an accessor property which, besides being a ...
11 years, 1 month ago (2013-03-27 22:11:27 UTC) #17
kpreid2
Patch Set 5 fixes expectFailure problems in es53-test-taming-untamed-guest.html
11 years, 1 month ago (2013-03-27 22:14:46 UTC) #18
kpreid2
The internal virtualize() of ES5/3 used to create an accessor property which, besides being a ...
11 years, 1 month ago (2013-03-28 23:33:24 UTC) #19
kpreid2
New snapshot; now contains no SES changes as they were committed in r5331, r5332. Tested ...
11 years, 1 month ago (2013-03-28 23:34:33 UTC) #20
kpreid2
The internal virtualize() of ES5/3 used to create an accessor property which, besides being a ...
11 years, 1 month ago (2013-04-09 19:32:17 UTC) #21
kpreid2
New snapshot Patch Set 7 additionally makes use of the accessor-virtualization flag to hide the ...
11 years, 1 month ago (2013-04-09 19:39:15 UTC) #22
ihab.awad
lgtm
11 years, 1 month ago (2013-04-10 15:46:25 UTC) #23
felix8a
btw, this needs a trivial change when combined with the markFuncFreeze->markConstFunc patch
11 years, 1 month ago (2013-04-10 23:14:05 UTC) #24
kpreid2
11 years, 1 month ago (2013-04-17 00:16:59 UTC) #25
The 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.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b