diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-22 17:50:18 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-23 17:31:08 +0200 |
commit | aaf6014ae11adc246a212d7bb201c16549718b22 (patch) | |
tree | 9632de66e7a2f9ab5aad99c88ea59a4694488ded /Libraries/LibWeb/Bindings | |
parent | 299824de73c09885a0c4158d4aea0db0680b6333 (diff) | |
download | serenity-aaf6014ae11adc246a212d7bb201c16549718b22.zip |
LibJS: Simplify Cell::initialize()
Remove the Interpreter& argument and pass only GlobalObject&. We can
find everything we need via the global object anyway.
Diffstat (limited to 'Libraries/LibWeb/Bindings')
8 files changed, 18 insertions, 17 deletions
diff --git a/Libraries/LibWeb/Bindings/LocationObject.cpp b/Libraries/LibWeb/Bindings/LocationObject.cpp index 09fa7be967..c457e4decd 100644 --- a/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -40,9 +40,9 @@ LocationObject::LocationObject(JS::GlobalObject& global_object) { } -void LocationObject::initialize(JS::Interpreter& interpreter, JS::GlobalObject& global_object) +void LocationObject::initialize(JS::GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable; define_native_property("href", href_getter, href_setter, attr); define_native_property("host", host_getter, nullptr, attr); diff --git a/Libraries/LibWeb/Bindings/LocationObject.h b/Libraries/LibWeb/Bindings/LocationObject.h index e0ebb55f32..76a38946c1 100644 --- a/Libraries/LibWeb/Bindings/LocationObject.h +++ b/Libraries/LibWeb/Bindings/LocationObject.h @@ -37,7 +37,7 @@ class LocationObject final : public JS::Object { public: explicit LocationObject(JS::GlobalObject&); - virtual void initialize(JS::Interpreter&, JS::GlobalObject&) override; + virtual void initialize(JS::GlobalObject&) override; virtual ~LocationObject() override; private: diff --git a/Libraries/LibWeb/Bindings/NavigatorObject.cpp b/Libraries/LibWeb/Bindings/NavigatorObject.cpp index a2787a9c09..9b6432d9de 100644 --- a/Libraries/LibWeb/Bindings/NavigatorObject.cpp +++ b/Libraries/LibWeb/Bindings/NavigatorObject.cpp @@ -39,18 +39,19 @@ NavigatorObject::NavigatorObject(JS::GlobalObject& global_object) { } -void NavigatorObject::initialize(JS::Interpreter& interpreter, JS::GlobalObject& global_object) +void NavigatorObject::initialize(JS::GlobalObject& global_object) { + auto& heap = this->heap(); auto* languages = JS::Array::create(global_object); - languages->indexed_properties().append(js_string(heap(), "en-US")); + languages->indexed_properties().append(js_string(heap, "en-US")); - define_property("appCodeName", js_string(interpreter.heap(), "Mozilla")); - define_property("appName", js_string(interpreter.heap(), "Netscape")); - define_property("appVersion", js_string(interpreter.heap(), "4.0")); + define_property("appCodeName", js_string(heap, "Mozilla")); + define_property("appName", js_string(heap, "Netscape")); + define_property("appVersion", js_string(heap, "4.0")); define_property("language", languages->get(0)); define_property("languages", languages); - define_property("platform", js_string(interpreter.heap(), "SerenityOS")); - define_property("product", js_string(interpreter.heap(), "Gecko")); + define_property("platform", js_string(heap, "SerenityOS")); + define_property("product", js_string(heap, "Gecko")); define_native_property("userAgent", user_agent_getter, nullptr); } diff --git a/Libraries/LibWeb/Bindings/NavigatorObject.h b/Libraries/LibWeb/Bindings/NavigatorObject.h index b05ecc26cd..fe10271e96 100644 --- a/Libraries/LibWeb/Bindings/NavigatorObject.h +++ b/Libraries/LibWeb/Bindings/NavigatorObject.h @@ -37,7 +37,7 @@ class NavigatorObject final : public JS::Object { public: NavigatorObject(JS::GlobalObject&); - virtual void initialize(JS::Interpreter&, JS::GlobalObject&) override; + virtual void initialize(JS::GlobalObject&) override; virtual ~NavigatorObject() override; private: diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp index 6bae08e898..4c70b91743 100644 --- a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp +++ b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.cpp @@ -40,9 +40,9 @@ XMLHttpRequestConstructor::XMLHttpRequestConstructor(JS::GlobalObject& global_ob { } -void XMLHttpRequestConstructor::initialize(JS::Interpreter& interpreter, JS::GlobalObject& global_object) +void XMLHttpRequestConstructor::initialize(JS::GlobalObject& global_object) { - NativeFunction::initialize(interpreter, global_object); + NativeFunction::initialize(global_object); define_property("length", JS::Value(1), JS::Attribute::Configurable); define_property("UNSENT", JS::Value((i32)XMLHttpRequest::ReadyState::Unsent), JS::Attribute::Enumerable); diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.h b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.h index bff68c6728..49af0daf45 100644 --- a/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.h +++ b/Libraries/LibWeb/Bindings/XMLHttpRequestConstructor.h @@ -33,7 +33,7 @@ namespace Web::Bindings { class XMLHttpRequestConstructor final : public JS::NativeFunction { public: explicit XMLHttpRequestConstructor(JS::GlobalObject&); - virtual void initialize(JS::Interpreter&, JS::GlobalObject&) override; + virtual void initialize(JS::GlobalObject&) override; virtual ~XMLHttpRequestConstructor() override; virtual JS::Value call(JS::Interpreter&) override; diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp b/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp index 1469a9e9d6..7d0d066da2 100644 --- a/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp +++ b/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.cpp @@ -39,9 +39,9 @@ XMLHttpRequestPrototype::XMLHttpRequestPrototype(JS::GlobalObject& global_object { } -void XMLHttpRequestPrototype::initialize(JS::Interpreter& interpreter, JS::GlobalObject& global_object) +void XMLHttpRequestPrototype::initialize(JS::GlobalObject& global_object) { - Object::initialize(interpreter, global_object); + Object::initialize(global_object); define_native_function("open", open, 2); define_native_function("send", send, 0); define_native_property("readyState", ready_state_getter, nullptr, JS::Attribute::Enumerable | JS::Attribute::Configurable); diff --git a/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.h b/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.h index a8742f1ca9..7b534b3b00 100644 --- a/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.h +++ b/Libraries/LibWeb/Bindings/XMLHttpRequestPrototype.h @@ -35,7 +35,7 @@ class XMLHttpRequestPrototype final : public JS::Object { public: explicit XMLHttpRequestPrototype(JS::GlobalObject&); - virtual void initialize(JS::Interpreter&, JS::GlobalObject&) override; + virtual void initialize(JS::GlobalObject&) override; virtual ~XMLHttpRequestPrototype() override; private: |