RESOLVED FIXED 4000
Object.prototype is missing isPrototypeOf
https://bugs.webkit.org/show_bug.cgi?id=4000
Summary Object.prototype is missing isPrototypeOf
Geoffrey Garen
Reported 2005-07-14 10:41:10 PDT
Section 15.2.4 of ECMA-262
Attachments
Implement isPrototypeOf (7.28 KB, patch)
2005-12-14 07:47 PST, Anders Carlsson
darin: review+
Anders Carlsson
Comment 1 2005-12-14 07:47:09 PST
Created attachment 5078 [details] Implement isPrototypeOf
Darin Adler
Comment 2 2005-12-14 09:44:00 PST
Comment on attachment 5078 [details] Implement isPrototypeOf r=me
Darin Adler
Comment 3 2005-12-14 09:44:44 PST
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?
Anders Carlsson
Comment 4 2005-12-14 10:03:55 PST
(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
Geoffrey Garen
Comment 5 2005-12-14 10:40:32 PST
I don't think it's right to test for v being NULL. JSValues should never be null, only jsNull().
Darin Adler
Comment 6 2005-12-17 09:01:41 PST
(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.
Darin Adler
Comment 7 2005-12-17 09:04:53 PST
(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.
Anders Carlsson
Comment 8 2005-12-18 05:29:05 PST
Committed (with some small changes that Geoffrey approved)
Diego Pino
Comment 9 2021-06-08 07:03:11 PDT Comment hidden (spam)
Diego Pino
Comment 10 2022-01-02 19:41:24 PST Comment hidden (spam)
Diego Pino
Comment 11 2024-05-27 07:11:55 PDT Comment hidden (spam)
Note You need to log in before you can comment on or make changes to this bug.