http://codereview.chromium.org/6902104/diff/3001/src/array.js
File src/array.js (right):

http://codereview.chromium.org/6902104/diff/3001/src/array.js#newcode378
src/array.js:378: if (IS_NULL_OR_UNDEFINED(this)) {
On 2011/04/28 15:40:45, MarkM wrote:
On 2011/04/28 10:50:01, Lasse Reichstein wrote:
> Just checked Firefox 4. It does not throw when passing document.all
(an
> undetectable object) as receiver.

Do we have any undetectable objects other that document.all?

Firefox's strategy for handling document.all differs from WebKits.
WebKit treats
the value as a special kind of value, whereas FF treats the lookup of
the "all"
property of document as a special context sensitive kind of lookup.
The lookup
is sensitive to the syntactic context from which it is looked up, but
once
looked up yields either a normal value or a normal undefined. AFAIK,
FF does not
have special undetectable objects as first class values.

See https://bugzilla.mozilla.org/show_bug.cgi?id=521670#c6
Added checks for the undetectable object in all cases

http://codereview.chromium.org/6902104/diff/3001/src/array.js#newcode379
src/array.js:379: throw MakeTypeError("obj_ctor_property_non_object",
["Array.join"]);
On 2011/04/28 10:44:38, Lasse Reichstein wrote:
The name shouldn't be "Array.prototype.join"?
Changed

http://codereview.chromium.org/6902104/diff/3001/src/array.js#newcode379
src/array.js:379: throw MakeTypeError("obj_ctor_property_non_object",
["Array.join"]);
On 2011/04/28 18:58:21, MarkM wrote:
For all these generics, I wonder about the string
"obj_ctor_property_non_object"
as not reflecting what the actual error is. After all

     > typeof [].map.call("foo", function(c,i,a) { return a; })[0]
     object


already works, as it should, by coercing its this to an object as
specified by
ToObject. This shows that the problem isn't that the this is a
"non_object" but
that it's null or undefined. (Or, given document.all, perhaps
"indistinguishable
from null or undefined")
Changed to "FUNCTIONNAME called on null or undefined"

http://codereview.chromium.org/6902104/diff/3001/src/array.js#newcode995
src/array.js:995: f.call(receiver, current, i, this);
On 2011/04/28 10:44:38, Lasse Reichstein wrote:
While you are here, make this use %_CallFunction (and similar for the
other that
calls).
You may have to handle the receiver being null/undefined too :)
I don't want to make this cl even larger, lets do this in another one

http://codereview.chromium.org/6902104/diff/3001/src/string.js
File src/string.js (right):

http://codereview.chromium.org/6902104/diff/3001/src/string.js#newcode66
src/string.js:66: throw MakeTypeError("obj_ctor_property_non_object",
["charAt"]);
On 2011/04/28 10:44:38, Lasse Reichstein wrote:
Why "Array.some" but not "String.charAt"?

Done.

http://codereview.chromium.org/6902104/diff/3001/test/mjsunit/function-call.js
File test/mjsunit/function-call.js (right):

http://codereview.chromium.org/6902104/diff/3001/test/mjsunit/function-call.js#newcode35
test/mjsunit/function-call.js:35: // Array.prototype.toString,
On 2011/04/28 21:16:54, MarkM wrote:
Why are these commented out?

Done (and fixed in Array.prototype.toString/toLocaleString which should
be generic)

http://codereview.chromium.org/6902104/diff/3001/test/mjsunit/function-call.js#newcode80
test/mjsunit/function-call.js:80: [Function.prototype.toString,
On 2011/04/29 06:16:12, Lasse Reichstein wrote:
How about Function.prototype.call and Function.prototype.apply? :)

Done.

http://codereview.chromium.org/6902104/diff/3001/test/mjsunit/function-call.js#newcode149
test/mjsunit/function-call.js:149: Array.prototype.reduceRight];
On 2011/04/29 06:16:12, Lasse Reichstein wrote:
Try testing String.prototype.replace the same way. Let's, for now,
assume that
we should be passing undefined as receiver (I'll ask es5-discuss).
We do not use null as argument to call when in String.prototype.replace
as far as I can see

http://codereview.chromium.org/6902104/diff/3001/test/mjsunit/function-call.js#newcode160
test/mjsunit/function-call.js:160: assertTrue(/called on
non-object/.test(e) || /Cannot convert/.test(e));
On 2011/04/29 06:16:12, Lasse Reichstein wrote:
It helps if the same algorithm can throw more than one TypeError. In
that case,
we should check that it's the first test in the ES algorithm to fail
that is
actually thrown.
We normally do test the output of the error message to ensure that we
actually get what we expected

http://codereview.chromium.org/6902104/diff/3001/test/mjsunit/function-call.js#newcode164
test/mjsunit/function-call.js:164:
should_throw_on_null_and_undefined[i].call(undefined);
On 2011/04/29 06:16:12, Lasse Reichstein wrote:
A comment should suffice. The general rule, which applies to all of
these
functions, is that supplying too few arguments means that the
remaining
parameters will take the undefined value. All of the functions here
will test
their receiver for being convertible to object as the first thing, or
have it as
a precondition for the non-generic methods.

Having meaningless and unusable arguments that would by themselves
make the
method fail, is actually a good thing, since it also tests that the
object-coercible test is performed first.

Comment inserted

http://codereview.chromium.org/6902104/diff/3001/test/mjsunit/function-call.js#newcode273
test/mjsunit/function-call.js:273:
should_throw_on_null_and_undefined[i]);
On 2011/04/28 10:44:38, Lasse Reichstein wrote:
Indentation (more cases below).

Done.

http://codereview.chromium.org/6902104/

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to