diff options
author | Linus Groh <mail@linusgroh.de> | 2020-11-12 10:32:46 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-11-12 11:40:29 +0100 |
commit | 5a307836c1d17592182d0fd4b11694c40c303066 (patch) | |
tree | a5bfd34dcb258531ed6a1edad79ed69926ff996d /Libraries/LibJS/Tests | |
parent | 3f73b0f896f57957f1bfedf5ee674f8fd8c9224f (diff) | |
download | serenity-5a307836c1d17592182d0fd4b11694c40c303066.zip |
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.
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r-- | Libraries/LibJS/Tests/strict-mode-errors.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/strict-mode-errors.js b/Libraries/LibJS/Tests/strict-mode-errors.js index c5e8b86414..2b640d1f3c 100644 --- a/Libraries/LibJS/Tests/strict-mode-errors.js +++ b/Libraries/LibJS/Tests/strict-mode-errors.js @@ -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"); }); }); |