http://codereview.appspot.com/4701044/diff/29001/src/com/google/caja/es53.js
File src/com/google/caja/es53.js (right):

http://codereview.appspot.com/4701044/diff/29001/src/com/google/caja/es53.js#newcode3563
src/com/google/caja/es53.js:3563: var keys = ownKeys(O), len =
keys.length;
On 2011/07/19 23:11:39, Mark S. Miller wrote:
I think both freeze___ and seal___ look correct. But why do they loop
through
their own properties in different ways? Since they both need to make
the same
set of properties non-configurable, it would make the equivalence
easier to
understand if they used the same iteration logic.

Likewise for minor but unnecessary naming differences like "P" vs "j",
"O" vs
"this", and turning extensibility off at the beginning vs the end.

Done.

http://codereview.appspot.com/4701044/diff/29001/src/com/google/caja/es53.js#newcode4711
src/com/google/caja/es53.js:4711: return desc.get.f___(safeDis(proxy),
[]);
On 2011/07/20 00:12:02, Mark S. Miller wrote:
Since desc is untrusted (it came from cajoled code), desc.get could be
an
accessor, or desc itself may be a proxy. In either case, the
expression above
for obtaining the value of desc.get is correct, but the obtained value
should be
used here (e.g. "getter.f___(...") rather than asking the same
question twice
and assuming stable answers.

Likewise perhaps at other places below; I haven't checked.

Done.

http://codereview.appspot.com/4701044/diff/29001/src/com/google/caja/es53.js#newcode4711
src/com/google/caja/es53.js:4711: return desc.get.f___(safeDis(proxy),
[]);
On 2011/07/20 00:37:53, Mark S. Miller wrote:
On 2011/07/20 00:12:02, Mark S. Miller wrote:
> Since desc is untrusted (it came from cajoled code), desc.get could
be an
> accessor, or desc itself may be a proxy. In either case, the
expression above
> for obtaining the value of desc.get is correct, but the obtained
value should
be
> used here (e.g. "getter.f___(...") rather than asking the same
question twice
> and assuming stable answers.
>
> Likewise perhaps at other places below; I haven't checked.

I was surprised to find that the proxies default handlers page
actually
specified that desc.get and desc.set each be obtained twice, which
seems wrong
for the above reasons. At

http://wiki.ecmascript.org/doku.php?id=harmony:proxies&rev=1310650763&do=diff
I
revised it to ask each of these once.

I'm following these semantics.

http://codereview.appspot.com/4701044/diff/29001/src/com/google/caja/es53.js#newcode4827
src/com/google/caja/es53.js:4827: if (!h || typeof h !== 'object') {
On 2011/07/20 00:54:42, Mark S. Miller wrote:
Can a handler not be a function?

Got rid of validateHandler, since we're now failing late and it couldn't
provide a guarantee anyway.

http://codereview.appspot.com/4701044/diff/29001/src/com/google/caja/es53.js#newcode4839
src/com/google/caja/es53.js:4839: ' to be a function, not ' + trapType);
On 2011/07/20 00:54:42, Mark S. Miller wrote:
(typeof X === 'function') does not test whether X is a function; it
tests
whether X is callable. Go figure ;).

Done.

http://codereview.appspot.com/4701044/diff/29001/src/com/google/caja/es53.js#newcode4856
src/com/google/caja/es53.js:4856: proxy = beget(proto);
On 2011/07/20 00:54:42, Mark S. Miller wrote:
We need to validate that proto, and all the objects it inherits from,
are
non-extensible non-proxies. Otherwise, our proxy implementation
technique
doesn't work.

And even if we, there's one more thing we need to do here in order for
our proxy
implementation to work: We need to override the fastpath flags of all
inherited
properties to set the fastpath to false. That way, an attempt to
access those
properties will not bypass the proxy intercepts.

Done.

http://codereview.appspot.com/4701044/

Reply via email to