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

Issue 258110043: Freeze globals successfully even on standards-conformant browsers. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
8 years, 9 months ago by MarkM
Modified:
8 years, 9 months ago
Reviewers:
kpreid_google
CC:
google-caja-discuss_googlegroups.com
Visibility:
Public.

Description

Prior to this CL, SES assumes it can freeze a property on the global object straightforwardly, by doing Object.defineProperty(.., .., {.., configurable: false}) However, because of the browser split between Window and WindowProxy, any browser that allows this breaks the ES6 invariants. Instead, on browsers that implement the draft spec https://github.com/domenic/window-proxy-spec it is still possible to freeze these properties by roundabout means. At the time of this writing, FF Nightly is the only browser that obeys part of this new behavior though it does not implement all of it. This CL changes the logic of freezing global properties so that it works on * browsers implementing the old behavior (currently, all but FF Nightly) * FF Nightly * browsers implementing the new draft spec (which do not exist, making this assertion hard to test) * non-browsers, where there is no split of the global object. Fixes https://github.com/google/caja/issues/1974 See https://esdiscuss.org/topic/figuring-out-the-behavior-of-windowproxy-in-the-face-of-non-configurable-properties https://esdiscuss.org/topic/a-dom-use-case-that-can-t-be-emulated-with-direct-proxies https://github.com/domenic/window-proxy-spec

Patch Set 1 #

Total comments: 37

Patch Set 2 : Freeze globals successfully even on standards-conformant browsers. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+330 lines, -25 lines) Patch
M src/com/google/caja/ses/repairES5.js View 1 6 chunks +30 lines, -14 lines 0 comments Download
M src/com/google/caja/ses/startSES.js View 1 5 chunks +300 lines, -11 lines 0 comments Download

Messages

Total messages: 6
MarkM
8 years, 9 months ago (2015-08-04 16:56:31 UTC) #1
MarkM
https://codereview.appspot.com/258110043/diff/1/src/com/google/caja/ses/startSES.js File src/com/google/caja/ses/startSES.js (right): https://codereview.appspot.com/258110043/diff/1/src/com/google/caja/ses/startSES.js#newcode1595 src/com/google/caja/ses/startSES.js:1595: * <i>name</i> property in all three cases. For the ...
8 years, 9 months ago (2015-08-04 18:23:35 UTC) #2
kpreid_google
https://codereview.appspot.com/258110043/diff/1/src/com/google/caja/ses/startSES.js File src/com/google/caja/ses/startSES.js (right): https://codereview.appspot.com/258110043/diff/1/src/com/google/caja/ses/startSES.js#newcode263 src/com/google/caja/ses/startSES.js:263: * the time of this writing, with TRY_GLOBAL_SIMPLE_FREEZE_FIRST Say ...
8 years, 9 months ago (2015-08-05 17:46:53 UTC) #3
MarkM
Prior to this CL, SES assumes it can freeze a property on the global object ...
8 years, 9 months ago (2015-08-05 21:25:21 UTC) #4
MarkM
https://codereview.appspot.com/258110043/diff/1/src/com/google/caja/ses/startSES.js File src/com/google/caja/ses/startSES.js (right): https://codereview.appspot.com/258110043/diff/1/src/com/google/caja/ses/startSES.js#newcode263 src/com/google/caja/ses/startSES.js:263: * the time of this writing, with TRY_GLOBAL_SIMPLE_FREEZE_FIRST On ...
8 years, 9 months ago (2015-08-05 21:28:49 UTC) #5
kpreid_google
8 years, 9 months ago (2015-08-06 19:39:33 UTC) #6
LGTM

https://codereview.appspot.com/258110043/diff/1/src/com/google/caja/ses/start...
File src/com/google/caja/ses/startSES.js (right):

https://codereview.appspot.com/258110043/diff/1/src/com/google/caja/ses/start...
src/com/google/caja/ses/startSES.js:1597: * <tt>Object.defineProperty</tt>.
On 2015/08/05 21:28:49, MarkM wrote:
> On 2015/08/05 17:46:53, kpreid_google wrote:
> > use <code> not <tt> (here and below).
> 
> Done. But why? "<tt>" is much less noisy in the source.

<code>: This is a fragment of code.

<tt>: For some unspecified reason, we wish this to be presented in a monospace
font.
Sign in to reply to this message.

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