Fix bad Proxy feature test in ES5/3. (issue 292850043 by kpreid@google.com)

6 views
Skip to first unread message

re...@codereview-hr.appspotmail.com

unread,
Mar 9, 2016, 1:41:54 PM3/9/16
to eri...@gmail.com, kpr...@google.com, google-ca...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: MarkM,

Description:
The previous test assumed that if Proxy exists, Proxy.create also
exists, which is not necessarily the case these days.

Please review this at https://codereview.appspot.com/292850043/

Affected files (+1, -1 lines):
M src/com/google/caja/es53.js


Index: src/com/google/caja/es53.js
diff --git a/src/com/google/caja/es53.js b/src/com/google/caja/es53.js
index
3d90f13501027904ff23c2724db784db0ac076f0..99ce23a07ffa5544e272421e2a248b81036b9465
100644
--- a/src/com/google/caja/es53.js
+++ b/src/com/google/caja/es53.js
@@ -4396,7 +4396,7 @@ var ___, cajaVM, safeJSON, WeakMap, ArrayLike, Proxy;
return getter ? getter.i___() : void 0;
});

- var nativeProxies = Proxy && (function () {
+ var nativeProxies = Proxy && Proxy.create && (function () {
var obj = {0: 'hi'};
var p = Proxy.create({
toString: function() { return '[ES5/3 feature test handler]'; },


eri...@gmail.com

unread,
Mar 9, 2016, 1:55:41 PM3/9/16
to kpr...@google.com, google-ca...@googlegroups.com, re...@codereview-hr.appspotmail.com
LGTM


https://codereview.appspot.com/292850043/diff/1/src/com/google/caja/es53.js
File src/com/google/caja/es53.js (right):

https://codereview.appspot.com/292850043/diff/1/src/com/google/caja/es53.js#newcode4399
src/com/google/caja/es53.js:4399: var nativeProxies = Proxy &&
Proxy.create && (function () {
Please add comment pointing out that Proxy.create is no longer standard.
If there is already and adequate comment elsewhere, feel free to ignore
this request.

https://codereview.appspot.com/292850043/

kpr...@google.com

unread,
Mar 9, 2016, 1:59:23 PM3/9/16
to eri...@gmail.com, google-ca...@googlegroups.com, re...@codereview-hr.appspotmail.com

https://codereview.appspot.com/292850043/diff/1/src/com/google/caja/es53.js
File src/com/google/caja/es53.js (right):

https://codereview.appspot.com/292850043/diff/1/src/com/google/caja/es53.js#newcode4399
src/com/google/caja/es53.js:4399: var nativeProxies = Proxy &&
Proxy.create && (function () {
On 2016/03/09 18:55:40, MarkM wrote:
> Please add comment pointing out that Proxy.create is no longer
standard. If
> there is already and adequate comment elsewhere, feel free to ignore
this
> request.

This is not the only use of Proxy.create, es53 is deprecated, and we
already have https://github.com/google/caja/issues/1947 for the whole
matter of removing uses of Proxy.create. Is that not sufficient?

https://codereview.appspot.com/292850043/

eri...@gmail.com

unread,
Mar 9, 2016, 2:00:08 PM3/9/16
to kpr...@google.com, google-ca...@googlegroups.com, re...@codereview-hr.appspotmail.com
It is sufficient, thanks.

https://codereview.appspot.com/292850043/
Reply all
Reply to author
Forward
0 new messages