Section 15.2.4 of ECMA-262
Created attachment 5078 [details] Implement isPrototypeOf
Comment on attachment 5078 [details] Implement isPrototypeOf r=me
Comment on attachment 5078 [details] Implement isPrototypeOf Wait, should this work for a non-object value if that just happens to be set as the prototype?
(In reply to comment #3) > (From update of attachment 5078 [details] [edit]) > Wait, should this work for a non-object value if that just happens to be set as > the prototype? > I don't think so, since you can't invoke methods on non-objects, and they can't have prototype properties anyway, but maybe I'm misunderstanding something
I don't think it's right to test for v being NULL. JSValues should never be null, only jsNull().
(In reply to comment #5) > I don't think it's right to test for v being NULL. JSValues should never be null, only jsNull(). That's a good point. The check for 0/NULL is unnecessary and should omitted.
(In reply to comment #4) > (In reply to comment #3) > > Wait, should this work for a non-object value if that just happens to be set as the prototype? > > I don't think so, since you can't invoke methods on non-objects, and they can't have prototype properties > anyway, but maybe I'm misunderstanding something You're right. I had it backwards. To restate what you said in a more confusing but more thorough way, "this" must be an object so we don't have to look at non- object prototypes since they can't possibly be equal to this. And the argument to the method is the object to find a prototype "of". Thus if the argument is not an object we instantly know "this" is not its prototype since only objects have prototypes.
Committed (with some small changes that Geoffrey approved)
bug.