diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Object/prototype/isPrototypeOf/this-value-is-in-prototype-chain-of-arg.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | js/src/tests/test262/built-ins/Object/prototype/isPrototypeOf/this-value-is-in-prototype-chain-of-arg.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Object/prototype/isPrototypeOf/this-value-is-in-prototype-chain-of-arg.js b/js/src/tests/test262/built-ins/Object/prototype/isPrototypeOf/this-value-is-in-prototype-chain-of-arg.js new file mode 100644 index 0000000000..fe5773032a --- /dev/null +++ b/js/src/tests/test262/built-ins/Object/prototype/isPrototypeOf/this-value-is-in-prototype-chain-of-arg.js @@ -0,0 +1,44 @@ +// Copyright (C) 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-object.prototype.isprototypeof +description: > + Object.prototype.isPrototypeOf returns true if either parameter V + and O refer to the same object or O is in [[Prototype]] chain of V. +info: | + Object.prototype.isPrototypeOf ( V ) + + ... + 3. Repeat, + a. Set V to ? V.[[GetPrototypeOf]](). + b. If V is null, return false. + c. If SameValue(O, V) is true, return true. +---*/ + +function USER_FACTORY(name) { + this.name = name; + this.getName = function() { + return name; + }; +} + +function FORCEDUSER_FACTORY(name, grade) { + this.name = name; + this.grade = grade; + this.getGrade = function() { + return grade; + }; +} + +var proto = new USER_FACTORY("noname"); + +FORCEDUSER_FACTORY.prototype = proto; + +var luke = new FORCEDUSER_FACTORY("Luke Skywalker", 12); + +assert.sameValue(proto.isPrototypeOf(luke), true); +assert.sameValue(USER_FACTORY.prototype.isPrototypeOf(luke), true); +assert.sameValue(Number.isPrototypeOf(luke), false); + +reportCompare(0, 0); |