LibJS: Pass "this" as an Object* to NativeFunction callbacks

Instead of every NativeFunction callback having to ask the Interpreter
for the current "this" value and then converting it to an Object etc,
just pass "this" as an Object* directly.
This commit is contained in:
Andreas Kling 2020-03-15 20:51:36 +01:00
commit 63b3cfdc73
Notes: sideshowbarker 2024-07-19 08:17:26 +09:00
9 changed files with 28 additions and 26 deletions

View file

@ -36,7 +36,7 @@ namespace Bindings {
DocumentWrapper::DocumentWrapper(Document& document)
: NodeWrapper(document)
{
put_native_function("getElementById", [this](JS::Interpreter&, Vector<JS::Value> arguments) -> JS::Value {
put_native_function("getElementById", [this](JS::Object*, Vector<JS::Value> arguments) -> JS::Value {
if (arguments.is_empty())
return JS::js_null();
auto id = arguments[0].to_string();