mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibJS: Return specified object from Object.setPrototypeOf()
We were leaking an empty value.
This commit is contained in:
parent
a60a5bc70a
commit
1a64bdd80c
Notes:
sideshowbarker
2024-07-19 05:53:52 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/1a64bdd80c8 Pull-request: https://github.com/SerenityOS/serenity/pull/2478
2 changed files with 13 additions and 1 deletions
|
@ -103,7 +103,7 @@ Value ObjectConstructor::set_prototype_of(Interpreter& interpreter)
|
|||
if (interpreter.exception())
|
||||
return {};
|
||||
object->set_prototype(&const_cast<Object&>(interpreter.argument(1).as_object()));
|
||||
return {};
|
||||
return object;
|
||||
}
|
||||
|
||||
Value ObjectConstructor::is_extensible(Interpreter& interpreter)
|
||||
|
|
12
Libraries/LibJS/Tests/Object.setPrototypeOf.js
Normal file
12
Libraries/LibJS/Tests/Object.setPrototypeOf.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
assert(Object.setPrototypeOf.length === 2);
|
||||
|
||||
o = {};
|
||||
assert(Object.setPrototypeOf(o, {}) === o);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Reference in a new issue