1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:07:46 +00:00

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."
This commit is contained in:
Lenny Maiorani 2022-03-14 13:21:51 -06:00 committed by Linus Groh
parent c0dd188c4d
commit c37820b898
237 changed files with 243 additions and 730 deletions

View file

@ -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");

View file

@ -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;

View file

@ -18,10 +18,6 @@ CSSNamespace::CSSNamespace(JS::GlobalObject& global_object)
{
}
CSSNamespace::~CSSNamespace()
{
}
void CSSNamespace::initialize(JS::GlobalObject& global_object)
{
Object::initialize(global_object);

View file

@ -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);

View file

@ -18,9 +18,5 @@ EventListenerWrapper::EventListenerWrapper(JS::GlobalObject& global_object, DOM:
{
}
EventListenerWrapper::~EventListenerWrapper()
{
}
}
}

View file

@ -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; }

View file

@ -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");

View file

@ -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;

View file

@ -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
{

View file

@ -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;

View file

@ -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;

View file

@ -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());

View file

@ -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);

View file

@ -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);

View file

@ -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; }

View file

@ -10,10 +10,6 @@
namespace Web {
namespace Bindings {
Wrappable::~Wrappable()
{
}
void Wrappable::set_wrapper(Wrapper& wrapper)
{
VERIFY(!m_wrapper);

View file

@ -15,7 +15,7 @@ namespace Web::Bindings {
class Wrappable {
public:
virtual ~Wrappable();
virtual ~Wrappable() = default;
void set_wrapper(Wrapper&);
Wrapper* wrapper() { return m_wrapper; }