1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:48:11 +00:00

LibJS: Pass GlobalObject& to native functions and property accessors

More work towards supporting multiple global objects. Native C++ code
now get a GlobalObject& and don't have to ask the Interpreter for it.

I've added macros for declaring and defining native callbacks since
this was pretty tedious and this makes it easier next time we want to
change any of these signatures.
This commit is contained in:
Andreas Kling 2020-06-20 13:55:34 +02:00
parent 4aa98052ca
commit e4add19915
79 changed files with 541 additions and 519 deletions

View file

@ -40,17 +40,17 @@ public:
private:
virtual const char* class_name() const override { return "LocationObject"; }
static JS::Value reload(JS::Interpreter&);
JS_DECLARE_NATIVE_FUNCTION(reload);
static JS::Value href_getter(JS::Interpreter&);
static void href_setter(JS::Interpreter&, JS::Value);
JS_DECLARE_NATIVE_GETTER(href_getter);
JS_DECLARE_NATIVE_SETTER(href_setter);
static JS::Value host_getter(JS::Interpreter&);
static JS::Value hostname_getter(JS::Interpreter&);
static JS::Value pathname_getter(JS::Interpreter&);
static JS::Value hash_getter(JS::Interpreter&);
static JS::Value search_getter(JS::Interpreter&);
static JS::Value protocol_getter(JS::Interpreter&);
JS_DECLARE_NATIVE_GETTER(host_getter);
JS_DECLARE_NATIVE_GETTER(hostname_getter);
JS_DECLARE_NATIVE_GETTER(pathname_getter);
JS_DECLARE_NATIVE_GETTER(hash_getter);
JS_DECLARE_NATIVE_GETTER(search_getter);
JS_DECLARE_NATIVE_GETTER(protocol_getter);
};
}