2022-09-04 16:56:15 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2024-04-27 12:09:58 +12:00
|
|
|
#include <LibWeb/Bindings/DOMExceptionPrototype.h>
|
2022-09-25 16:15:49 -06:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2022-09-25 17:28:46 +01:00
|
|
|
#include <LibWeb/WebIDL/DOMException.h>
|
2022-09-04 16:56:15 +02:00
|
|
|
|
2022-09-25 17:28:46 +01:00
|
|
|
namespace Web::WebIDL {
|
2022-09-04 16:56:15 +02:00
|
|
|
|
2023-11-19 19:47:52 +01:00
|
|
|
JS_DEFINE_ALLOCATOR(DOMException);
|
|
|
|
|
2023-09-06 16:03:01 +12:00
|
|
|
JS::NonnullGCPtr<DOMException> DOMException::create(JS::Realm& realm, FlyString const& name, FlyString const& message)
|
2022-09-04 16:56:15 +02:00
|
|
|
{
|
2023-08-13 13:05:26 +02:00
|
|
|
return realm.heap().allocate<DOMException>(realm, realm, name, message);
|
2022-09-04 16:56:15 +02:00
|
|
|
}
|
|
|
|
|
2023-09-06 16:03:01 +12:00
|
|
|
JS::NonnullGCPtr<DOMException> DOMException::construct_impl(JS::Realm& realm, FlyString const& message, FlyString const& name)
|
2022-09-04 16:56:15 +02:00
|
|
|
{
|
2023-08-13 13:05:26 +02:00
|
|
|
return realm.heap().allocate<DOMException>(realm, realm, name, message);
|
2022-09-04 16:56:15 +02:00
|
|
|
}
|
|
|
|
|
2023-09-06 16:03:01 +12:00
|
|
|
DOMException::DOMException(JS::Realm& realm, FlyString const& name, FlyString const& message)
|
2022-09-25 16:15:49 -06:00
|
|
|
: PlatformObject(realm)
|
2022-09-04 16:56:15 +02:00
|
|
|
, m_name(name)
|
|
|
|
, m_message(message)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
DOMException::~DOMException() = default;
|
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
void DOMException::initialize(JS::Realm& realm)
|
2023-01-10 06:28:20 -05:00
|
|
|
{
|
2023-08-07 08:41:28 +02:00
|
|
|
Base::initialize(realm);
|
2024-03-16 13:13:08 +01:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(DOMException);
|
2023-01-10 06:28:20 -05:00
|
|
|
}
|
|
|
|
|
2022-09-04 16:56:15 +02:00
|
|
|
}
|