mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibJS: Use element index as key for array spread in object
This fixes spreading of arrays with holes in object literals where the inserted keys are not consecutive numbers. Fixes #3967.
This commit is contained in:
parent
06a3625545
commit
745ffca580
Notes:
sideshowbarker
2024-07-19 01:32:13 +09:00
Author: https://github.com/linusg
Commit: 745ffca580
Pull-request: https://github.com/SerenityOS/serenity/pull/3969
Issue: https://github.com/SerenityOS/serenity/issues/3967
2 changed files with 6 additions and 1 deletions
|
@ -1552,7 +1552,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
|||
if (key.is_array()) {
|
||||
auto& array_to_spread = static_cast<Array&>(key.as_object());
|
||||
for (auto& entry : array_to_spread.indexed_properties()) {
|
||||
object->indexed_properties().append(entry.value_and_attributes(&array_to_spread).value);
|
||||
object->indexed_properties().put(object, entry.index(), entry.value_and_attributes(&array_to_spread).value);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue