diff options
author | Lenny Maiorani <lenny@serenityos.org> | 2022-03-14 13:21:51 -0600 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-03-17 17:23:49 +0000 |
commit | c37820b898cdb9689debd28f9c66c70a16d3c663 (patch) | |
tree | c376e1fadc791bf1c651da4ba0ea1411ac046581 /Userland/Libraries/LibWeb/Bindings | |
parent | c0dd188c4defcba2dcae1b14510d494331134e90 (diff) | |
download | serenity-c37820b898cdb9689debd28f9c66c70a16d3c663.zip |
Libraries: Use default constructors/destructors in LibWeb
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
Diffstat (limited to 'Userland/Libraries/LibWeb/Bindings')
17 files changed, 10 insertions, 42 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp index 53656f0d55..b657468de5 100644 --- a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.cpp @@ -29,10 +29,6 @@ void AudioConstructor::initialize(JS::GlobalObject& global_object) define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); } -AudioConstructor::~AudioConstructor() -{ -} - JS::ThrowCompletionOr<JS::Value> AudioConstructor::call() { return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Audio"); diff --git a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h index 3c913c67ae..7aca1ea916 100644 --- a/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h +++ b/Userland/Libraries/LibWeb/Bindings/AudioConstructor.h @@ -14,7 +14,7 @@ class AudioConstructor final : public JS::NativeFunction { public: explicit AudioConstructor(JS::GlobalObject&); virtual void initialize(JS::GlobalObject&) override; - virtual ~AudioConstructor() override; + virtual ~AudioConstructor() override = default; virtual JS::ThrowCompletionOr<JS::Value> call() override; virtual JS::ThrowCompletionOr<JS::Object*> construct(JS::FunctionObject& new_target) override; diff --git a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp index 56507ed776..818b0fd615 100644 --- a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp +++ b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.cpp @@ -18,10 +18,6 @@ CSSNamespace::CSSNamespace(JS::GlobalObject& global_object) { } -CSSNamespace::~CSSNamespace() -{ -} - void CSSNamespace::initialize(JS::GlobalObject& global_object) { Object::initialize(global_object); diff --git a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.h b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.h index 2791c54580..1ab81ef776 100644 --- a/Userland/Libraries/LibWeb/Bindings/CSSNamespace.h +++ b/Userland/Libraries/LibWeb/Bindings/CSSNamespace.h @@ -18,7 +18,7 @@ class CSSNamespace final : public JS::Object { public: explicit CSSNamespace(JS::GlobalObject&); virtual void initialize(JS::GlobalObject&) override; - virtual ~CSSNamespace() override; + virtual ~CSSNamespace() override = default; private: JS_DECLARE_NATIVE_FUNCTION(escape); diff --git a/Userland/Libraries/LibWeb/Bindings/EventListenerWrapper.cpp b/Userland/Libraries/LibWeb/Bindings/EventListenerWrapper.cpp index 33789472ba..87913acdb1 100644 --- a/Userland/Libraries/LibWeb/Bindings/EventListenerWrapper.cpp +++ b/Userland/Libraries/LibWeb/Bindings/EventListenerWrapper.cpp @@ -18,9 +18,5 @@ EventListenerWrapper::EventListenerWrapper(JS::GlobalObject& global_object, DOM: { } -EventListenerWrapper::~EventListenerWrapper() -{ -} - } } diff --git a/Userland/Libraries/LibWeb/Bindings/EventListenerWrapper.h b/Userland/Libraries/LibWeb/Bindings/EventListenerWrapper.h index 1994089590..a90a539b74 100644 --- a/Userland/Libraries/LibWeb/Bindings/EventListenerWrapper.h +++ b/Userland/Libraries/LibWeb/Bindings/EventListenerWrapper.h @@ -16,7 +16,7 @@ class EventListenerWrapper final : public Wrapper { public: EventListenerWrapper(JS::GlobalObject&, DOM::IDLEventListener&); - virtual ~EventListenerWrapper() override; + virtual ~EventListenerWrapper() override = default; DOM::IDLEventListener& impl() { return *m_impl; } DOM::IDLEventListener const& impl() const { return *m_impl; } diff --git a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp index 6456ac1b35..42c035f13f 100644 --- a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp +++ b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.cpp @@ -29,10 +29,6 @@ void ImageConstructor::initialize(JS::GlobalObject& global_object) define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable); } -ImageConstructor::~ImageConstructor() -{ -} - JS::ThrowCompletionOr<JS::Value> ImageConstructor::call() { return vm().throw_completion<JS::TypeError>(global_object(), JS::ErrorType::ConstructorWithoutNew, "Image"); diff --git a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.h b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.h index b516216cfd..65cb94b706 100644 --- a/Userland/Libraries/LibWeb/Bindings/ImageConstructor.h +++ b/Userland/Libraries/LibWeb/Bindings/ImageConstructor.h @@ -14,7 +14,7 @@ class ImageConstructor final : public JS::NativeFunction { public: explicit ImageConstructor(JS::GlobalObject&); virtual void initialize(JS::GlobalObject&) override; - virtual ~ImageConstructor() override; + virtual ~ImageConstructor() override = default; virtual JS::ThrowCompletionOr<JS::Value> call() override; virtual JS::ThrowCompletionOr<JS::Object*> construct(JS::FunctionObject& new_target) override; diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp index 3e0c063c10..1c152169d4 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp @@ -53,10 +53,6 @@ void LocationObject::initialize(JS::GlobalObject& global_object) m_default_properties.extend(MUST(Object::internal_own_property_keys())); } -LocationObject::~LocationObject() -{ -} - // https://html.spec.whatwg.org/multipage/history.html#relevant-document DOM::Document const* LocationObject::relevant_document() const { diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.h b/Userland/Libraries/LibWeb/Bindings/LocationObject.h index 3fab5e3698..ba2611be91 100644 --- a/Userland/Libraries/LibWeb/Bindings/LocationObject.h +++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.h @@ -23,7 +23,7 @@ class LocationObject final : public JS::Object { public: explicit LocationObject(JS::GlobalObject&); virtual void initialize(JS::GlobalObject&) override; - virtual ~LocationObject() override; + virtual ~LocationObject() override = default; virtual JS::ThrowCompletionOr<JS::Object*> internal_get_prototype_of() const override; virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override; diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.h b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.h index ae7acfe2de..e4b9333eb5 100644 --- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.h +++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.h @@ -15,7 +15,7 @@ namespace Web::Bindings { struct WebEngineCustomData final : public JS::VM::CustomData { - virtual ~WebEngineCustomData() override { } + virtual ~WebEngineCustomData() override = default; HTML::EventLoop event_loop; }; @@ -27,7 +27,7 @@ struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData { } - virtual ~WebEngineCustomJobCallbackData() override { } + virtual ~WebEngineCustomJobCallbackData() override = default; HTML::EnvironmentSettingsObject& incumbent_settings; OwnPtr<JS::ExecutionContext> active_script_context; diff --git a/Userland/Libraries/LibWeb/Bindings/NavigatorObject.cpp b/Userland/Libraries/LibWeb/Bindings/NavigatorObject.cpp index f75d538804..270f8ee965 100644 --- a/Userland/Libraries/LibWeb/Bindings/NavigatorObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/NavigatorObject.cpp @@ -40,10 +40,6 @@ void NavigatorObject::initialize(JS::GlobalObject& global_object) define_direct_property("onLine", JS::Value(true), attr); } -NavigatorObject::~NavigatorObject() -{ -} - JS_DEFINE_NATIVE_FUNCTION(NavigatorObject::user_agent_getter) { return JS::js_string(vm, ResourceLoader::the().user_agent()); diff --git a/Userland/Libraries/LibWeb/Bindings/NavigatorObject.h b/Userland/Libraries/LibWeb/Bindings/NavigatorObject.h index 3125d35a40..8222caf20b 100644 --- a/Userland/Libraries/LibWeb/Bindings/NavigatorObject.h +++ b/Userland/Libraries/LibWeb/Bindings/NavigatorObject.h @@ -18,7 +18,7 @@ class NavigatorObject final : public JS::Object { public: NavigatorObject(JS::GlobalObject&); virtual void initialize(JS::GlobalObject&) override; - virtual ~NavigatorObject() override; + virtual ~NavigatorObject() override = default; private: JS_DECLARE_NATIVE_FUNCTION(user_agent_getter); diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp index acb1f1ca8f..f22d6cb87b 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -140,10 +140,6 @@ void WindowObject::initialize_global_object() ADD_WINDOW_OBJECT_INTERFACES; } -WindowObject::~WindowObject() -{ -} - void WindowObject::visit_edges(Visitor& visitor) { GlobalObject::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/Bindings/WindowObject.h b/Userland/Libraries/LibWeb/Bindings/WindowObject.h index f50780828e..7b579f2805 100644 --- a/Userland/Libraries/LibWeb/Bindings/WindowObject.h +++ b/Userland/Libraries/LibWeb/Bindings/WindowObject.h @@ -32,7 +32,7 @@ class WindowObject public: explicit WindowObject(HTML::Window&); virtual void initialize_global_object() override; - virtual ~WindowObject() override; + virtual ~WindowObject() override = default; HTML::Window& impl() { return *m_impl; } const HTML::Window& impl() const { return *m_impl; } diff --git a/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp b/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp index 1c8b146630..9f5efd78fd 100644 --- a/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp +++ b/Userland/Libraries/LibWeb/Bindings/Wrappable.cpp @@ -10,10 +10,6 @@ namespace Web { namespace Bindings { -Wrappable::~Wrappable() -{ -} - void Wrappable::set_wrapper(Wrapper& wrapper) { VERIFY(!m_wrapper); diff --git a/Userland/Libraries/LibWeb/Bindings/Wrappable.h b/Userland/Libraries/LibWeb/Bindings/Wrappable.h index ef0fcfdcb0..36a581f399 100644 --- a/Userland/Libraries/LibWeb/Bindings/Wrappable.h +++ b/Userland/Libraries/LibWeb/Bindings/Wrappable.h @@ -15,7 +15,7 @@ namespace Web::Bindings { class Wrappable { public: - virtual ~Wrappable(); + virtual ~Wrappable() = default; void set_wrapper(Wrapper&); Wrapper* wrapper() { return m_wrapper; } |