mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 12:05:07 +00:00
LibJS: Define the "constructor" property on ScriptFunction's prototype
and set it to the current function
This commit is contained in:
parent
f833362536
commit
949bffdc93
2 changed files with 21 additions and 8 deletions
|
@ -1,7 +1,17 @@
|
|||
function Foo() {
|
||||
this.x = 123;
|
||||
}
|
||||
load("test-common.js");
|
||||
|
||||
var foo = new Foo();
|
||||
if (foo.x === 123)
|
||||
console.log("PASS");
|
||||
try {
|
||||
function Foo() {
|
||||
this.x = 123;
|
||||
}
|
||||
|
||||
assert(Foo.prototype.constructor === Foo);
|
||||
|
||||
var foo = new Foo();
|
||||
assert(foo.constructor === Foo);
|
||||
assert(foo.x === 123);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue