mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 17:44:56 +09:00
LibJS: Boolean, Number and String prototypes should have values too
It appears that calling .valueOf() on an objectified primitive's prototype should return a value after all. This matches what other engines are doing.
This commit is contained in:
parent
c06d5ef114
commit
070a8f2689
Notes:
sideshowbarker
2024-07-19 07:44:52 +09:00
Author: https://github.com/awesomekling
Commit: 070a8f2689
11 changed files with 33 additions and 9 deletions
8
Libraries/LibJS/Tests/Number.prototype.js
Normal file
8
Libraries/LibJS/Tests/Number.prototype.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
try {
|
||||
assert(typeof Number.prototype === "object");
|
||||
assert(Number.prototype.valueOf() === 0);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
}
|
8
Libraries/LibJS/Tests/String.prototype.js
Normal file
8
Libraries/LibJS/Tests/String.prototype.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
try {
|
||||
assert(typeof Object.getPrototypeOf("") === "object");
|
||||
assert(Object.getPrototypeOf("").valueOf() === '');
|
||||
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue