LibJS: Make Array constructor take its prototype

Let's start moving towards native JS objects taking their prototype as
a constructor argument.

This will eventually allow us to move prototypes off of Interpreter and
into GlobalObject.
This commit is contained in:
Andreas Kling 2020-04-17 18:24:01 +02:00
commit 2d7b495244
Notes: sideshowbarker 2024-07-19 07:31:46 +09:00
7 changed files with 23 additions and 12 deletions

View file

@ -96,7 +96,7 @@ JS::Value DocumentWrapper::query_selector_all(JS::Interpreter& interpreter)
auto selector = arguments[0].to_string();
auto elements = document->query_selector_all(selector);
// FIXME: This should be a static NodeList, not a plain JS::Array.
auto* node_list = interpreter.heap().allocate<JS::Array>();
auto* node_list = JS::Array::create(interpreter.global_object());
for (auto& element : elements) {
node_list->elements().append(wrap(interpreter.heap(), element));
}