From: Lars Knoll Date: Thu, 13 Dec 2012 00:15:44 +0000 (+0100) Subject: Fix Object.prototype.isPrototypeOf() X-Git-Tag: upstream/5.2.1~669^2~659^2~699 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c267edf74b5e8fba75e2191dc70aeb11f11edce0;p=platform%2Fupstream%2Fqtdeclarative.git Fix Object.prototype.isPrototypeOf() Implement the method according to spec (15.2.4.6) Change-Id: I84b943366dcb1048966d4ae2f60bcbf01c99e7ea Reviewed-by: Simon Hausmann --- diff --git a/qv4ecmaobjects.cpp b/qv4ecmaobjects.cpp index daee93a..bb3cd5f 100644 --- a/qv4ecmaobjects.cpp +++ b/qv4ecmaobjects.cpp @@ -823,9 +823,14 @@ Value ObjectPrototype::method_isPrototypeOf(ExecutionContext *ctx) if (! V.isObject()) return Value::fromBoolean(false); - Value O = ctx->thisObject.toObject(ctx); + Object *O = ctx->thisObject.toObject(ctx).objectValue(); Object *proto = V.objectValue()->prototype; - return Value::fromBoolean(proto && O.objectValue() == proto); + while (proto) { + if (O == proto) + return Value::fromBoolean(true); + proto = proto->prototype; + } + return Value::fromBoolean(false); } Value ObjectPrototype::method_propertyIsEnumerable(ExecutionContext *ctx)