mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibJS: Handle symbol PropertyName in primitive assignment error
We can't just to_string() the PropertyName, it might be a symbol. Instead to_value() it and then use to_string_without_side_effects() as usual. Fixes #4062.
This commit is contained in:
parent
3f73b0f896
commit
5a307836c1
2 changed files with 4 additions and 1 deletions
|
@ -5,5 +5,8 @@ test("basic functionality", () => {
|
|||
expect(() => {
|
||||
primitive.foo = "bar";
|
||||
}).toThrowWithMessage(TypeError, "Cannot assign property foo to primitive value");
|
||||
expect(() => {
|
||||
primitive[Symbol.hasInstance] = 123;
|
||||
}).toThrowWithMessage(TypeError, "Cannot assign property Symbol(Symbol.hasInstance) to primitive value");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue