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

Issue 8629044: Replace ES5/3 ___.markFuncFreeze which left .prototype undefended (Closed)

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

Description

ES5/3 internally used markFuncFreeze in a fashion which suggests that it is intended that the resulting function is (trivially) transitively immutable (ignoring prototypes). However, it left the .prototype property untouched, so any such function, if not otherwise defended, has an accessible non-frozen .prototype object. * Replace markFuncFreeze with a function markConstFunc (named to fit with constFunc) which sets .prototype to null. * Replace all uses of markFuncFreeze on function literals with markConstFunc. * Replaced uses of markFuncFreeze on existing functions with markFunc(). Supporting changes: * Use ES5/3 interface instead of deprecated Cajita interface to grant assert functions in ES53RewriterTest. Fixes <https://code.google.com/p/google-caja/issues/detail?id=1695>. @r5396

Patch Set 1 #

Total comments: 2

Patch Set 2 : Replace ES5/3 ___.markFuncFreeze which left .prototype undefended #

Total comments: 2

Patch Set 3 : Replace ES5/3 ___.markFuncFreeze which left .prototype undefended #

Unified diffs Side-by-side diffs Delta from patch set Stats (+128 lines, -105 lines) Patch
M src/com/google/caja/cajita-promise.js View 1 2 8 chunks +12 lines, -12 lines 0 comments Download
M src/com/google/caja/es53.js View 1 2 32 chunks +52 lines, -48 lines 0 comments Download
M src/com/google/caja/flash/caja-flash.js View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M src/com/google/caja/plugin/capture-cajoled-module.js View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M src/com/google/caja/plugin/es53-frame-group.js View 1 2 1 chunk +6 lines, -7 lines 0 comments Download
M src/com/google/caja/plugin/load-module.js View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M src/com/google/caja/plugin/templates/HtmlAttributeRewriter.java View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M tests/com/google/caja/parser/quasiliteral/ES53ConformanceTest.java View 1 2 1 chunk +1 line, -1 line 0 comments Download
M tests/com/google/caja/parser/quasiliteral/ES53RewriterTest.java View 1 2 4 chunks +25 lines, -5 lines 0 comments Download
M tests/com/google/caja/plugin/PipelineCacheTest.java View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M tests/com/google/caja/plugin/container.js View 1 2 1 chunk +9 lines, -9 lines 0 comments Download
M tests/com/google/caja/plugin/jsunit.js View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M tests/com/google/caja/plugin/templates/TemplateCompilerTest.java View 1 2 3 chunks +3 lines, -3 lines 0 comments Download
M tests/com/google/caja/plugin/templates/template-compiler-golden1-dynamic.js View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M tests/com/google/caja/plugin/templates/template-compiler-golden1-nulluripol.js View 1 2 2 chunks +2 lines, -2 lines 0 comments Download
M tests/com/google/caja/plugin/templates/template-compiler-golden1-static.js View 1 2 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 12
kpreid2
12 years ago (2013-04-10 17:45:04 UTC) #1
MarkM
Why did you decide on an empty record rather than setting .prototype to null? Setting ...
12 years ago (2013-04-10 18:19:49 UTC) #2
kpreid2
On 2013/04/10 18:19:49, MarkM wrote: > Why did you decide on an empty record rather ...
12 years ago (2013-04-10 18:54:59 UTC) #3
felix8a
https://codereview.appspot.com/8629044/diff/1/src/com/google/caja/es53.js File src/com/google/caja/es53.js (right): https://codereview.appspot.com/8629044/diff/1/src/com/google/caja/es53.js#newcode4094 src/com/google/caja/es53.js:4094: var lengthGetter = freeze(markFunc(function () { why isn't this ...
12 years ago (2013-04-10 19:47:05 UTC) #4
kpreid2
ES5/3 internally used markFuncFreeze in a fashion which suggests that it is intended that the ...
12 years ago (2013-04-10 22:42:03 UTC) #5
kpreid2
New snapshot; the function now nulls the prototype, and is called markConstFunc rather than snowFunc. ...
12 years ago (2013-04-10 22:43:01 UTC) #6
felix8a
lgtm
12 years ago (2013-04-10 22:46:16 UTC) #7
MarkM
LGTM
12 years ago (2013-04-10 23:08:48 UTC) #8
ihab.awad
https://codereview.appspot.com/8629044/diff/3002/tests/com/google/caja/plugin/container.js File tests/com/google/caja/plugin/container.js (right): https://codereview.appspot.com/8629044/diff/3002/tests/com/google/caja/plugin/container.js#newcode29 tests/com/google/caja/plugin/container.js:29: value: ___.markFunc(fail), What determines markConstFunc vs markFunc usage here?
12 years ago (2013-04-12 05:20:05 UTC) #9
kpreid2
https://codereview.appspot.com/8629044/diff/3002/tests/com/google/caja/plugin/container.js File tests/com/google/caja/plugin/container.js (right): https://codereview.appspot.com/8629044/diff/3002/tests/com/google/caja/plugin/container.js#newcode29 tests/com/google/caja/plugin/container.js:29: value: ___.markFunc(fail), On 2013/04/12 05:20:06, ihab.awad wrote: > What ...
12 years ago (2013-04-12 16:32:39 UTC) #10
ihab.awad
Yeah, up to you -- just seemed whacky.
12 years ago (2013-04-12 16:46:11 UTC) #11
kpreid2
12 years ago (2013-04-16 17:58:58 UTC) #12
ES5/3 internally used markFuncFreeze in a fashion which suggests that it
is intended that the resulting function is (trivially) transitively
immutable (ignoring prototypes). However, it left the .prototype
property untouched, so any such function, if not otherwise defended, has
an accessible non-frozen .prototype object.

* Replace markFuncFreeze with a function markConstFunc (named to fit
  with constFunc) which sets .prototype to null.
* Replace all uses of markFuncFreeze on function literals with
  markConstFunc.
* Replaced uses of markFuncFreeze on existing functions with markFunc().

Supporting changes:
* Use ES5/3 interface instead of deprecated Cajita interface to grant
  assert functions in ES53RewriterTest.
* Deleted unused Cajita/Valija-legacy ___.markCtor and ___.extend.
* Deleted unused setup-valija.js.

Fixes <https://code.google.com/p/google-caja/issues/detail?id=1695>.
Sign in to reply to this message.

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