summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibJS/Runtime/Reference.cpp2
-rw-r--r--Libraries/LibJS/Tests/strict-mode-errors.js3
2 files changed, 4 insertions, 1 deletions
diff --git a/Libraries/LibJS/Runtime/Reference.cpp b/Libraries/LibJS/Runtime/Reference.cpp
index ee13097681..6b6b06f80f 100644
--- a/Libraries/LibJS/Runtime/Reference.cpp
+++ b/Libraries/LibJS/Runtime/Reference.cpp
@@ -50,7 +50,7 @@ void Reference::put(GlobalObject& global_object, Value value)
}
if (!base().is_object() && vm.in_strict_mode()) {
- vm.throw_exception<TypeError>(global_object, ErrorType::ReferencePrimitiveAssignment, m_name.to_string());
+ vm.throw_exception<TypeError>(global_object, ErrorType::ReferencePrimitiveAssignment, m_name.to_value(global_object.vm()).to_string_without_side_effects());
return;
}
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");
});
});