mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibJS: Throw in strict mode when assigning property to primitive value
This commit is contained in:
parent
5f2632f121
commit
8ff4587f65
3 changed files with 25 additions and 5 deletions
|
@ -50,6 +50,11 @@ void Reference::put(Interpreter& interpreter, Value value)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!base().is_object() && interpreter.in_strict_mode()) {
|
||||
interpreter.throw_exception<TypeError>(String::format("Can't assign property %s to primitive value", m_name.to_string().characters()));
|
||||
return;
|
||||
}
|
||||
|
||||
auto* object = base().to_object(interpreter);
|
||||
if (!object)
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue