mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:18:12 +00:00
LibJS: Don't create "valid" PropertyName from null string
When value.to_string() throws an exception it returns a null string in which case we must not construct a valid PropertyName. Also ASSERT in PropertyName(String) and PropertyName(FlyString) to prevent this from happening in the future. Fixes #3941.
This commit is contained in:
parent
8afe1c8165
commit
41837f548d
2 changed files with 18 additions and 1 deletions
|
@ -6,3 +6,14 @@ test("Issue #3459, exception in computed property expression", () => {
|
|||
"foo"[bar]();
|
||||
}).toThrow(ReferenceError);
|
||||
});
|
||||
|
||||
test("Issue #3941, exception in computed property's toString()", () => {
|
||||
expect(() => {
|
||||
const o = {
|
||||
toString() {
|
||||
throw Error();
|
||||
},
|
||||
};
|
||||
"foo"[o];
|
||||
}).toThrow(Error);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue