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

Issue 198470043: SES no longer uses objToString.call(specimen) as a reliable brand test. (Closed)

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

Description

As of ES6, Object.prototype.toString.call(specimen) is no longer a reliable brand test. However, https://esdiscuss.org/topic/tostringtag-spoofing-for-null-and-undefined#content-59 demonstrates another technique that is still reliable. For those places containing old-style brand tests, either fix them or remove them. NEEDS_DUMMY_SETTER and ERRORS_HAVE_INVISIBLE_PROPERTIES were using doing brand testing in their repairs. But since both of these were repaired prior to 2014, I removed the repairs instead. The tests are still in there, so we will still fail safe on ancient browsers that we don't support, but may newly fail to repair them,

Patch Set 1 #

Patch Set 2 : SES no longer uses objToString.call(specimen) as a reliable brand test. #

Total comments: 21

Patch Set 3 : SES no longer uses objToString.call(specimen) as a reliable brand test. #

Patch Set 4 : SES no longer uses objToString.call(specimen) as a reliable brand test. #

Patch Set 5 : SES no longer uses objToString.call(specimen) as a reliable brand test. #

Patch Set 6 : SES no longer uses objToString.call(specimen) as a reliable brand test. #

Patch Set 7 : SES no longer uses objToString.call(specimen) as a reliable brand test. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+301 lines, -135 lines) Patch
M src/com/google/caja/ses/repairES5.js View 1 2 3 4 5 6 17 chunks +293 lines, -135 lines 0 comments Download
M src/com/google/caja/ses/whitelist.js View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 13
MarkM
9 years, 2 months ago (2015-02-12 23:35:44 UTC) #1
MarkM
As of ES6, Object.prototype.toString.call(specimen) is no longer a reliable brand test. However, https://esdiscuss.org/topic/tostringtag-spoofing-for-null-and-undefined#content-59 demonstrates another ...
9 years, 2 months ago (2015-02-12 23:36:17 UTC) #2
MarkM
Note that this repairs only the brand tests in SES. Remaining brand tests elsewhere in ...
9 years, 2 months ago (2015-02-12 23:38:12 UTC) #3
MarkM
As of ES6, Object.prototype.toString.call(specimen) is no longer a reliable brand test. However, https://esdiscuss.org/topic/tostringtag-spoofing-for-null-and-undefined#content-59 demonstrates another ...
9 years, 2 months ago (2015-02-13 03:48:54 UTC) #4
kpreid_google
https://codereview.appspot.com/198470043/diff/20001/src/com/google/caja/ses/repairES5.js File src/com/google/caja/ses/repairES5.js (right): https://codereview.appspot.com/198470043/diff/20001/src/com/google/caja/ses/repairES5.js#newcode488 src/com/google/caja/ses/repairES5.js:488: * Using Allen's trick from This is an explaining-the-implementation ...
9 years, 2 months ago (2015-02-13 21:30:37 UTC) #5
MarkM
As of ES6, Object.prototype.toString.call(specimen) is no longer a reliable brand test. However, https://esdiscuss.org/topic/tostringtag-spoofing-for-null-and-undefined#content-59 demonstrates another ...
9 years, 2 months ago (2015-02-14 00:33:17 UTC) #6
MarkM
PTAL https://codereview.appspot.com/198470043/diff/20001/src/com/google/caja/ses/repairES5.js File src/com/google/caja/ses/repairES5.js (right): https://codereview.appspot.com/198470043/diff/20001/src/com/google/caja/ses/repairES5.js#newcode488 src/com/google/caja/ses/repairES5.js:488: * Using Allen's trick from On 2015/02/13 21:30:37, ...
9 years, 2 months ago (2015-02-14 00:38:47 UTC) #7
MarkM
As of ES6, Object.prototype.toString.call(specimen) is no longer a reliable brand test. However, https://esdiscuss.org/topic/tostringtag-spoofing-for-null-and-undefined#content-59 demonstrates another ...
9 years, 2 months ago (2015-02-14 19:42:19 UTC) #8
MarkM
https://codereview.appspot.com/198470043/diff/20001/src/com/google/caja/ses/repairES5.js File src/com/google/caja/ses/repairES5.js (right): https://codereview.appspot.com/198470043/diff/20001/src/com/google/caja/ses/repairES5.js#newcode512 src/com/google/caja/ses/repairES5.js:512: strictForEachFn([null, undefined, true, 1, 'x', {}], function(v) { On ...
9 years, 2 months ago (2015-02-14 19:46:58 UTC) #9
MarkM
As of ES6, Object.prototype.toString.call(specimen) is no longer a reliable brand test. However, https://esdiscuss.org/topic/tostringtag-spoofing-for-null-and-undefined#content-59 demonstrates another ...
9 years, 2 months ago (2015-02-14 20:55:25 UTC) #10
MarkM
Reported issues relevant to this CL. Updated CL to include links to those issue reports.
9 years, 2 months ago (2015-02-14 20:56:57 UTC) #11
kpreid_google
LGTM
9 years, 2 months ago (2015-02-15 00:05:16 UTC) #12
MarkM
9 years, 2 months ago (2015-02-15 01:24:51 UTC) #13
As of ES6, Object.prototype.toString.call(specimen) is no longer a
reliable brand test. However,
https://esdiscuss.org/topic/tostringtag-spoofing-for-null-and-undefined#conte...
demonstrates another technique that is still reliable. For those
places containing old-style brand tests, either fix them or remove
them. 

NEEDS_DUMMY_SETTER and ERRORS_HAVE_INVISIBLE_PROPERTIES were using
doing brand testing in their repairs. But since both of these were
repaired prior to 2014, I removed the repairs instead. The tests are
still in there, so we will still fail safe on ancient browsers that we
don't support, but may newly fail to repair them,
Sign in to reply to this message.

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