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

Issue 8806045: Repair Object.create on Chrome; make SES compatible with no Object.create(null). (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 11 months ago by kpreid2
Modified:
12 years, 11 months ago
Reviewers:
MarkM, ihab.awad
CC:
google-caja-discuss_googlegroups.com
Base URL:
http://google-caja.googlecode.com/svn/trunk/
Visibility:
Public.

Description

In Chrome 28.0.1480.0 canary (among other versions), Object.freeze(Object.prototype) causes __proto__ to lose its magic, which causes various internal code to fail; most critically, Object.create(X) produces objects whose [[Prototype]] is Object.prototype rather than X. Repair this by reimplementing Object.create from scratch. The repair cannot support Object.create(null); therefore, kludge SES-only code into working despite its absence: * StringMap.js is willing to use {} instead of Object.create(null); safe because the keys are suffixed. * Replace string-map uses of Object.create(null) in repairES5 with an explicit (lightened) StringMap abstraction. * sharedImports and scope objects will have Object.prototype's properties as bindings. * Loosen testProtoMention test to be willing for __proto__ as a global variable to throw errors. Also repair Error.prototype.toString whose native implementation is also broken by lack of __proto__ magic. Note that there is further fatal-to-Caja misbehavior in the same Chrome versions, with apparently the same root cause, only if the "Enable Experimental JavaScript" flag is on (symptom: {}.constructor === Symbol (itself an experimental feature), rather than Object), and this repair does not deal with that. @r5359

Patch Set 1 #

Total comments: 4

Patch Set 2 : Repair Object.create misbehavior on Chrome. #

Patch Set 3 : Repair Object.create on Chrome; make SES compatible with no Object.create(null). #

Total comments: 5

Patch Set 4 : Repair Object.create on Chrome; make SES compatible with no Object.create(null). #

Unified diffs Side-by-side diffs Delta from patch set Stats (+228 lines, -68 lines) Patch
M src/com/google/caja/ses/StringMap.js View 1 2 3 2 chunks +11 lines, -1 line 0 comments Download
M src/com/google/caja/ses/repairES5.js View 1 2 3 11 chunks +144 lines, -35 lines 0 comments Download
M src/com/google/caja/ses/startSES.js View 1 2 3 4 chunks +26 lines, -3 lines 0 comments Download
M tests/com/google/caja/plugin/es53-test-language-guest.html View 1 2 3 1 chunk +47 lines, -29 lines 0 comments Download

Messages

Total messages: 17
kpreid2
12 years, 11 months ago (2013-04-16 21:46:35 UTC) #1
ihab.awad
lgtm
12 years, 11 months ago (2013-04-16 21:50:24 UTC) #2
kpreid2
Forgot to add MarkM as SES reviewer.
12 years, 11 months ago (2013-04-16 21:51:58 UTC) #3
MarkM
(experimental) "symptom: {}.constructor === Symbol (itself an experimental feature), rather than Object" Has this been ...
12 years, 11 months ago (2013-04-16 22:06:55 UTC) #4
kpreid2
On 2013/04/16 22:06:55, MarkM wrote: > (experimental) "symptom: {}.constructor === Symbol > (itself an experimental ...
12 years, 11 months ago (2013-04-16 22:09:14 UTC) #5
MarkM
LGTM pending the examination of mstarzinger's fix that I suggest below. I would be surprised ...
12 years, 11 months ago (2013-04-16 22:20:38 UTC) #6
kpreid2
In Chrome 28.0.1480.0 canary (among other versions), Object.freeze(Object.prototype) causes __proto__ to lose its magic and, ...
12 years, 11 months ago (2013-04-16 23:07:12 UTC) #7
kpreid2
New snapshot. https://codereview.appspot.com/8806045/diff/1/src/com/google/caja/ses/repairES5.js File src/com/google/caja/ses/repairES5.js (right): https://codereview.appspot.com/8806045/diff/1/src/com/google/caja/ses/repairES5.js#newcode2880 src/com/google/caja/ses/repairES5.js:2880: function repair_OBJECT_CREATE() { On 2013/04/16 22:20:38, MarkM ...
12 years, 11 months ago (2013-04-16 23:09:48 UTC) #8
MarkM
Awesome good news! LGTM
12 years, 11 months ago (2013-04-16 23:23:12 UTC) #9
kpreid2
Correction: I seem to have run the tests on the wrong browser. :( I haven't ...
12 years, 11 months ago (2013-04-16 23:43:34 UTC) #10
kpreid2
In Chrome 28.0.1480.0 canary (among other versions), Object.freeze(Object.prototype) causes __proto__ to lose its magic, which ...
12 years, 11 months ago (2013-04-17 17:33:27 UTC) #11
kpreid2
On 2013/04/16 23:43:34, kpreid2 wrote: > Correction: I seem to have run the tests on ...
12 years, 11 months ago (2013-04-17 17:34:33 UTC) #12
MarkM
LGTM Full speed ahead! https://codereview.appspot.com/8806045/diff/13001/src/com/google/caja/ses/repairES5.js File src/com/google/caja/ses/repairES5.js (right): https://codereview.appspot.com/8806045/diff/13001/src/com/google/caja/ses/repairES5.js#newcode2118 src/com/google/caja/ses/repairES5.js:2118: 'Repaired Object.create can not support ...
12 years, 11 months ago (2013-04-17 18:21:11 UTC) #13
kpreid2
In Chrome 28.0.1480.0 canary (among other versions), Object.freeze(Object.prototype) causes __proto__ to lose its magic, which ...
12 years, 11 months ago (2013-04-17 18:28:02 UTC) #14
kpreid2
https://codereview.appspot.com/8806045/diff/13001/src/com/google/caja/ses/repairES5.js File src/com/google/caja/ses/repairES5.js (right): https://codereview.appspot.com/8806045/diff/13001/src/com/google/caja/ses/repairES5.js#newcode2118 src/com/google/caja/ses/repairES5.js:2118: 'Repaired Object.create can not support Object.create(null)') { On 2013/04/17 ...
12 years, 11 months ago (2013-04-17 18:28:55 UTC) #15
MarkM
https://codereview.appspot.com/8806045/diff/13001/src/com/google/caja/ses/startSES.js File src/com/google/caja/ses/startSES.js (right): https://codereview.appspot.com/8806045/diff/13001/src/com/google/caja/ses/startSES.js#newcode564 src/com/google/caja/ses/startSES.js:564: // (that is, if they occur in freeNames). Nevermind ...
12 years, 11 months ago (2013-04-17 18:30:12 UTC) #16
ihab.awad
12 years, 11 months ago (2013-04-17 18:40:07 UTC) #17
lgtm!
Sign in to reply to this message.

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