summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-09-24 16:02:41 +0100
committerLinus Groh <mail@linusgroh.de>2022-09-24 19:31:39 +0100
commit4f73851afcc3338d58817643665ed13cc3e7d30e (patch)
treea9054a903a38d618519d1c43eeb9cf42cf944c43 /Userland/Libraries/LibWeb
parentdc44effd443adb18162ab8ca86c12d651faf8d8e (diff)
downloadserenity-4f73851afcc3338d58817643665ed13cc3e7d30e.zip
LibWeb: Move CallbackType from Bindings/ to WebIDL/
Let's stop putting generic types and AOs from the Web IDL spec into the Bindings namespace and directory in LibWeb, and instead follow our usual naming rules of 'directory = namespace = spec name'. The IDL namespace is already used by LibIDL, so Web::WebIDL seems like a good choice.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h8
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt2
-rw-r--r--Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp4
-rw-r--r--Userland/Libraries/LibWeb/CSS/MediaQueryList.h4
-rw-r--r--Userland/Libraries/LibWeb/DOM/AbortSignal.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/AbortSignal.h4
-rw-r--r--Userland/Libraries/LibWeb/DOM/EventTarget.cpp14
-rw-r--r--Userland/Libraries/LibWeb/DOM/EventTarget.h6
-rw-r--r--Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/IDLEventListener.h10
-rw-r--r--Userland/Libraries/LibWeb/DOM/MutationObserver.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/MutationObserver.h10
-rw-r--r--Userland/Libraries/LibWeb/DOM/NodeFilter.cpp4
-rw-r--r--Userland/Libraries/LibWeb/DOM/NodeFilter.h10
-rw-r--r--Userland/Libraries/LibWeb/Forward.h5
-rw-r--r--Userland/Libraries/LibWeb/HTML/EventHandler.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/EventHandler.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/MessagePort.cpp16
-rw-r--r--Userland/Libraries/LibWeb/HTML/MessagePort.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/Window.cpp58
-rw-r--r--Userland/Libraries/LibWeb/HTML/Window.h8
-rw-r--r--Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/Worker.cpp16
-rw-r--r--Userland/Libraries/LibWeb/HTML/Worker.h6
-rw-r--r--Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp16
-rw-r--r--Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h6
-rw-r--r--Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp2
-rw-r--r--Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h2
-rw-r--r--Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp2
-rw-r--r--Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h2
-rw-r--r--Userland/Libraries/LibWeb/WebIDL/CallbackType.cpp (renamed from Userland/Libraries/LibWeb/Bindings/CallbackType.cpp)4
-rw-r--r--Userland/Libraries/LibWeb/WebIDL/CallbackType.h (renamed from Userland/Libraries/LibWeb/Bindings/CallbackType.h)2
-rw-r--r--Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp16
-rw-r--r--Userland/Libraries/LibWeb/WebSockets/WebSocket.h6
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp4
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h4
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.cpp16
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h6
42 files changed, 163 insertions, 160 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp b/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp
index 719235546e..f3e1281c11 100644
--- a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp
@@ -82,7 +82,7 @@ ErrorOr<ByteBuffer> get_buffer_source_copy(JS::Object const& buffer_source)
}
// https://webidl.spec.whatwg.org/#invoke-a-callback-function
-JS::Completion invoke_callback(Bindings::CallbackType& callback, Optional<JS::Value> this_argument, JS::MarkedVector<JS::Value> args)
+JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, JS::MarkedVector<JS::Value> args)
{
// 1. Let completion be an uninitialized variable.
JS::Completion completion;
diff --git a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h b/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h
index d4b2b9783c..e1af9aeda5 100644
--- a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h
+++ b/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h
@@ -11,8 +11,8 @@
#include <LibJS/Forward.h>
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/FunctionObject.h>
-#include <LibWeb/Bindings/CallbackType.h>
#include <LibWeb/HTML/Scripting/Environments.h>
+#include <LibWeb/WebIDL/CallbackType.h>
namespace Web::Bindings::IDL {
@@ -44,7 +44,7 @@ inline JS::Completion clean_up_on_return(HTML::EnvironmentSettingsObject& stored
// https://webidl.spec.whatwg.org/#call-a-user-objects-operation
template<typename... Args>
-JS::Completion call_user_object_operation(Bindings::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, Args&&... args)
+JS::Completion call_user_object_operation(WebIDL::CallbackType& callback, String const& operation_name, Optional<JS::Value> this_argument, Args&&... args)
{
// 1. Let completion be an uninitialized variable.
JS::Completion completion;
@@ -120,11 +120,11 @@ JS::Completion call_user_object_operation(Bindings::CallbackType& callback, Stri
return clean_up_on_return(stored_settings, relevant_settings, completion);
}
-JS::Completion invoke_callback(Bindings::CallbackType& callback, Optional<JS::Value> this_argument, JS::MarkedVector<JS::Value> args);
+JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, JS::MarkedVector<JS::Value> args);
// https://webidl.spec.whatwg.org/#invoke-a-callback-function
template<typename... Args>
-JS::Completion invoke_callback(Bindings::CallbackType& callback, Optional<JS::Value> this_argument, Args&&... args)
+JS::Completion invoke_callback(WebIDL::CallbackType& callback, Optional<JS::Value> this_argument, Args&&... args)
{
auto& function_object = callback.callback;
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index 4b8b280e74..bcd02004bb 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -3,7 +3,6 @@ include(libweb_generators)
set(SOURCES
Bindings/AudioConstructor.cpp
Bindings/CSSNamespace.cpp
- Bindings/CallbackType.cpp
Bindings/IDLAbstractOperations.cpp
Bindings/IDLOverloadResolution.cpp
Bindings/ImageConstructor.cpp
@@ -413,6 +412,7 @@ set(SOURCES
WebGL/WebGLContextEvent.cpp
WebGL/WebGLRenderingContext.cpp
WebGL/WebGLRenderingContextBase.cpp
+ WebIDL/CallbackType.cpp
WebSockets/WebSocket.cpp
XHR/EventNames.cpp
XHR/ProgressEvent.cpp
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
index 554797f260..a9765486f2 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
+++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.cpp
@@ -82,12 +82,12 @@ void MediaQueryList::remove_listener(DOM::IDLEventListener* listener)
remove_event_listener_without_options(HTML::EventNames::change, *listener);
}
-void MediaQueryList::set_onchange(Bindings::CallbackType* event_handler)
+void MediaQueryList::set_onchange(WebIDL::CallbackType* event_handler)
{
set_event_handler_attribute(HTML::EventNames::change, event_handler);
}
-Bindings::CallbackType* MediaQueryList::onchange()
+WebIDL::CallbackType* MediaQueryList::onchange()
{
return event_handler_attribute(HTML::EventNames::change);
}
diff --git a/Userland/Libraries/LibWeb/CSS/MediaQueryList.h b/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
index ae23285611..74ae22331c 100644
--- a/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
+++ b/Userland/Libraries/LibWeb/CSS/MediaQueryList.h
@@ -28,8 +28,8 @@ public:
void add_listener(DOM::IDLEventListener*);
void remove_listener(DOM::IDLEventListener*);
- void set_onchange(Bindings::CallbackType*);
- Bindings::CallbackType* onchange();
+ void set_onchange(WebIDL::CallbackType*);
+ WebIDL::CallbackType* onchange();
private:
MediaQueryList(DOM::Document&, NonnullRefPtrVector<MediaQuery>&&);
diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp
index 604242fe49..0822e81a70 100644
--- a/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp
+++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.cpp
@@ -57,12 +57,12 @@ void AbortSignal::signal_abort(JS::Value reason)
dispatch_event(*Event::create(global_object(), HTML::EventNames::abort));
}
-void AbortSignal::set_onabort(Bindings::CallbackType* event_handler)
+void AbortSignal::set_onabort(WebIDL::CallbackType* event_handler)
{
set_event_handler_attribute(HTML::EventNames::abort, event_handler);
}
-Bindings::CallbackType* AbortSignal::onabort()
+WebIDL::CallbackType* AbortSignal::onabort()
{
return event_handler_attribute(HTML::EventNames::abort);
}
diff --git a/Userland/Libraries/LibWeb/DOM/AbortSignal.h b/Userland/Libraries/LibWeb/DOM/AbortSignal.h
index 4ede0e7a54..36de000d2b 100644
--- a/Userland/Libraries/LibWeb/DOM/AbortSignal.h
+++ b/Userland/Libraries/LibWeb/DOM/AbortSignal.h
@@ -31,8 +31,8 @@ public:
void signal_abort(JS::Value reason);
- void set_onabort(Bindings::CallbackType*);
- Bindings::CallbackType* onabort();
+ void set_onabort(WebIDL::CallbackType*);
+ WebIDL::CallbackType* onabort();
// https://dom.spec.whatwg.org/#dom-abortsignal-reason
JS::Value reason() const { return m_abort_reason; }
diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp
index 0565f62eb3..42f805bb84 100644
--- a/Userland/Libraries/LibWeb/DOM/EventTarget.cpp
+++ b/Userland/Libraries/LibWeb/DOM/EventTarget.cpp
@@ -299,7 +299,7 @@ static EventTarget* determine_target_of_event_handler(EventTarget& event_target,
}
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes:event-handler-idl-attributes-2
-Bindings::CallbackType* EventTarget::event_handler_attribute(FlyString const& name)
+WebIDL::CallbackType* EventTarget::event_handler_attribute(FlyString const& name)
{
// 1. Let eventTarget be the result of determining the target of an event handler given this object and name.
auto target = determine_target_of_event_handler(*this, name);
@@ -313,7 +313,7 @@ Bindings::CallbackType* EventTarget::event_handler_attribute(FlyString const& na
}
// https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler
-Bindings::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString const& name)
+WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString const& name)
{
// 1. Let handlerMap be eventTarget's event handler map. (NOTE: Not necessary)
@@ -464,16 +464,16 @@ Bindings::CallbackType* EventTarget::get_current_value_of_event_handler(FlyStrin
function->set_script_or_module({});
// 12. Set eventHandler's value to the result of creating a Web IDL EventHandler callback function object whose object reference is function and whose callback context is settings object.
- event_handler->value = realm.heap().allocate_without_realm<Bindings::CallbackType>(*function, settings_object);
+ event_handler->value = realm.heap().allocate_without_realm<WebIDL::CallbackType>(*function, settings_object);
}
// 4. Return eventHandler's value.
- VERIFY(event_handler->value.has<Bindings::CallbackType*>());
- return *event_handler->value.get_pointer<Bindings::CallbackType*>();
+ VERIFY(event_handler->value.has<WebIDL::CallbackType*>());
+ return *event_handler->value.get_pointer<WebIDL::CallbackType*>();
}
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes:event-handler-idl-attributes-3
-void EventTarget::set_event_handler_attribute(FlyString const& name, Bindings::CallbackType* value)
+void EventTarget::set_event_handler_attribute(FlyString const& name, WebIDL::CallbackType* value)
{
// 1. Let eventTarget be the result of determining the target of an event handler given this object and name.
auto event_target = determine_target_of_event_handler(*this, name);
@@ -556,7 +556,7 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl
0, "", &realm);
// NOTE: As per the spec, the callback context is arbitrary.
- auto* callback = realm.heap().allocate_without_realm<Bindings::CallbackType>(*callback_function, verify_cast<HTML::EnvironmentSettingsObject>(*realm.host_defined()));
+ auto* callback = realm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_function, verify_cast<HTML::EnvironmentSettingsObject>(*realm.host_defined()));
// 5. Let listener be a new event listener whose type is the event handler event type corresponding to eventHandler and callback is callback.
auto* listener = realm.heap().allocate_without_realm<DOMEventListener>();
diff --git a/Userland/Libraries/LibWeb/DOM/EventTarget.h b/Userland/Libraries/LibWeb/DOM/EventTarget.h
index 583299210d..28c1bb18ad 100644
--- a/Userland/Libraries/LibWeb/DOM/EventTarget.h
+++ b/Userland/Libraries/LibWeb/DOM/EventTarget.h
@@ -51,8 +51,8 @@ public:
virtual void legacy_cancelled_activation_behavior() { }
virtual void legacy_cancelled_activation_behavior_was_not_called() { }
- Bindings::CallbackType* event_handler_attribute(FlyString const& name);
- void set_event_handler_attribute(FlyString const& name, Bindings::CallbackType*);
+ WebIDL::CallbackType* event_handler_attribute(FlyString const& name);
+ void set_event_handler_attribute(FlyString const& name, WebIDL::CallbackType*);
protected:
explicit EventTarget(JS::Realm&);
@@ -68,7 +68,7 @@ private:
// Spec Note: The order of the entries of event handler map could be arbitrary. It is not observable through any algorithms that operate on the map.
HashMap<FlyString, JS::GCPtr<HTML::EventHandler>> m_event_handler_map;
- Bindings::CallbackType* get_current_value_of_event_handler(FlyString const& name);
+ WebIDL::CallbackType* get_current_value_of_event_handler(FlyString const& name);
void activate_event_handler(FlyString const& name, HTML::EventHandler& event_handler);
void deactivate_event_handler(FlyString const& name);
JS::ThrowCompletionOr<void> process_event_handler_for_event(FlyString const& name, Event& event);
diff --git a/Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp b/Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp
index 6fd55576e4..7356f36924 100644
--- a/Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp
+++ b/Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp
@@ -9,12 +9,12 @@
namespace Web::DOM {
-JS::NonnullGCPtr<IDLEventListener> IDLEventListener::create(JS::Realm& realm, JS::NonnullGCPtr<Bindings::CallbackType> callback)
+JS::NonnullGCPtr<IDLEventListener> IDLEventListener::create(JS::Realm& realm, JS::NonnullGCPtr<WebIDL::CallbackType> callback)
{
return *realm.heap().allocate<IDLEventListener>(realm, realm, move(callback));
}
-IDLEventListener::IDLEventListener(JS::Realm& realm, JS::NonnullGCPtr<Bindings::CallbackType> callback)
+IDLEventListener::IDLEventListener(JS::Realm& realm, JS::NonnullGCPtr<WebIDL::CallbackType> callback)
: JS::Object(*realm.intrinsics().object_prototype())
, m_callback(move(callback))
{
diff --git a/Userland/Libraries/LibWeb/DOM/IDLEventListener.h b/Userland/Libraries/LibWeb/DOM/IDLEventListener.h
index 51ed2bf4c2..8a22c14b4a 100644
--- a/Userland/Libraries/LibWeb/DOM/IDLEventListener.h
+++ b/Userland/Libraries/LibWeb/DOM/IDLEventListener.h
@@ -8,8 +8,8 @@
#include <AK/RefCounted.h>
#include <LibJS/Heap/Handle.h>
-#include <LibWeb/Bindings/CallbackType.h>
#include <LibWeb/DOM/AbortSignal.h>
+#include <LibWeb/WebIDL/CallbackType.h>
namespace Web::DOM {
@@ -28,17 +28,17 @@ class IDLEventListener final : public JS::Object {
JS_OBJECT(IDLEventListener, JS::Object);
public:
- static JS::NonnullGCPtr<IDLEventListener> create(JS::Realm&, JS::NonnullGCPtr<Bindings::CallbackType>);
- IDLEventListener(JS::Realm&, JS::NonnullGCPtr<Bindings::CallbackType>);
+ static JS::NonnullGCPtr<IDLEventListener> create(JS::Realm&, JS::NonnullGCPtr<WebIDL::CallbackType>);
+ IDLEventListener(JS::Realm&, JS::NonnullGCPtr<WebIDL::CallbackType>);
virtual ~IDLEventListener() = default;
- Bindings::CallbackType& callback() { return *m_callback; }
+ WebIDL::CallbackType& callback() { return *m_callback; }
private:
virtual void visit_edges(Cell::Visitor&) override;
- JS::NonnullGCPtr<Bindings::CallbackType> m_callback;
+ JS::NonnullGCPtr<WebIDL::CallbackType> m_callback;
};
}
diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp
index 8a36188828..3d9520b5c0 100644
--- a/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp
+++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.cpp
@@ -11,13 +11,13 @@
namespace Web::DOM {
-JS::NonnullGCPtr<MutationObserver> MutationObserver::create_with_global_object(HTML::Window& window, JS::GCPtr<Bindings::CallbackType> callback)
+JS::NonnullGCPtr<MutationObserver> MutationObserver::create_with_global_object(HTML::Window& window, JS::GCPtr<WebIDL::CallbackType> callback)
{
return *window.heap().allocate<MutationObserver>(window.realm(), window, callback);
}
// https://dom.spec.whatwg.org/#dom-mutationobserver-mutationobserver
-MutationObserver::MutationObserver(HTML::Window& window, JS::GCPtr<Bindings::CallbackType> callback)
+MutationObserver::MutationObserver(HTML::Window& window, JS::GCPtr<WebIDL::CallbackType> callback)
: PlatformObject(window.realm())
, m_callback(move(callback))
{
diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.h b/Userland/Libraries/LibWeb/DOM/MutationObserver.h
index e24dfdb60c..33437ed35f 100644
--- a/Userland/Libraries/LibWeb/DOM/MutationObserver.h
+++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.h
@@ -10,9 +10,9 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <LibJS/Heap/Handle.h>
-#include <LibWeb/Bindings/CallbackType.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/MutationRecord.h>
+#include <LibWeb/WebIDL/CallbackType.h>
namespace Web::DOM {
@@ -32,7 +32,7 @@ class MutationObserver final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(MutationObserver, Bindings::PlatformObject);
public:
- static JS::NonnullGCPtr<MutationObserver> create_with_global_object(HTML::Window&, JS::GCPtr<Bindings::CallbackType>);
+ static JS::NonnullGCPtr<MutationObserver> create_with_global_object(HTML::Window&, JS::GCPtr<WebIDL::CallbackType>);
virtual ~MutationObserver() override;
ExceptionOr<void> observe(Node& target, MutationObserverInit options = {});
@@ -42,7 +42,7 @@ public:
Vector<WeakPtr<Node>>& node_list() { return m_node_list; }
Vector<WeakPtr<Node>> const& node_list() const { return m_node_list; }
- Bindings::CallbackType& callback() { return *m_callback; }
+ WebIDL::CallbackType& callback() { return *m_callback; }
void enqueue_record(Badge<Node>, JS::NonnullGCPtr<MutationRecord> mutation_record)
{
@@ -50,12 +50,12 @@ public:
}
private:
- MutationObserver(HTML::Window&, JS::GCPtr<Bindings::CallbackType>);
+ MutationObserver(HTML::Window&, JS::GCPtr<WebIDL::CallbackType>);
virtual void visit_edges(Cell::Visitor&) override;
// https://dom.spec.whatwg.org/#concept-mo-callback
- JS::GCPtr<Bindings::CallbackType> m_callback;
+ JS::GCPtr<WebIDL::CallbackType> m_callback;
// https://dom.spec.whatwg.org/#mutationobserver-node-list
// NOTE: These are weak, per https://dom.spec.whatwg.org/#garbage-collection
diff --git a/Userland/Libraries/LibWeb/DOM/NodeFilter.cpp b/Userland/Libraries/LibWeb/DOM/NodeFilter.cpp
index 8c018a73ab..05d7c8f260 100644
--- a/Userland/Libraries/LibWeb/DOM/NodeFilter.cpp
+++ b/Userland/Libraries/LibWeb/DOM/NodeFilter.cpp
@@ -10,12 +10,12 @@
namespace Web::DOM {
-JS::NonnullGCPtr<NodeFilter> NodeFilter::create(JS::Realm& realm, Bindings::CallbackType& callback)
+JS::NonnullGCPtr<NodeFilter> NodeFilter::create(JS::Realm& realm, WebIDL::CallbackType& callback)
{
return *realm.heap().allocate<NodeFilter>(realm, realm, callback);
}
-NodeFilter::NodeFilter(JS::Realm& realm, Bindings::CallbackType& callback)
+NodeFilter::NodeFilter(JS::Realm& realm, WebIDL::CallbackType& callback)
: PlatformObject(*realm.intrinsics().object_prototype())
, m_callback(callback)
{
diff --git a/Userland/Libraries/LibWeb/DOM/NodeFilter.h b/Userland/Libraries/LibWeb/DOM/NodeFilter.h
index aeae0f09de..c9f3c3679e 100644
--- a/Userland/Libraries/LibWeb/DOM/NodeFilter.h
+++ b/Userland/Libraries/LibWeb/DOM/NodeFilter.h
@@ -6,8 +6,8 @@
#pragma once
-#include <LibWeb/Bindings/CallbackType.h>
#include <LibWeb/Bindings/PlatformObject.h>
+#include <LibWeb/WebIDL/CallbackType.h>
namespace Web::DOM {
@@ -15,11 +15,11 @@ class NodeFilter final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(NodeFilter, Bindings::PlatformObject);
public:
- static JS::NonnullGCPtr<NodeFilter> create(JS::Realm&, Bindings::CallbackType&);
+ static JS::NonnullGCPtr<NodeFilter> create(JS::Realm&, WebIDL::CallbackType&);
virtual ~NodeFilter() = default;
- Bindings::CallbackType& callback() { return m_callback; }
+ WebIDL::CallbackType& callback() { return m_callback; }
enum Result {
FILTER_ACCEPT = 1,
@@ -28,11 +28,11 @@ public:
};
private:
- NodeFilter(JS::Realm&, Bindings::CallbackType&);
+ NodeFilter(JS::Realm&, WebIDL::CallbackType&);
virtual void visit_edges(Cell::Visitor&) override;
- Bindings::CallbackType& m_callback;
+ WebIDL::CallbackType& m_callback;
};
}
diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h
index 2ad2adad09..2af18208cf 100644
--- a/Userland/Libraries/LibWeb/Forward.h
+++ b/Userland/Libraries/LibWeb/Forward.h
@@ -393,6 +393,10 @@ class SVGRectElement;
class SVGSVGElement;
}
+namespace Web::WebIDL {
+class CallbackType;
+}
+
namespace Web::WebSockets {
class WebSocket;
}
@@ -460,7 +464,6 @@ class URLSearchParamsIterator;
}
namespace Web::Bindings {
-class CallbackType;
class LocationObject;
class OptionConstructor;
class RangePrototype;
diff --git a/Userland/Libraries/LibWeb/HTML/EventHandler.cpp b/Userland/Libraries/LibWeb/HTML/EventHandler.cpp
index 612df30041..230d94e1d2 100644
--- a/Userland/Libraries/LibWeb/HTML/EventHandler.cpp
+++ b/Userland/Libraries/LibWeb/HTML/EventHandler.cpp
@@ -15,7 +15,7 @@ EventHandler::EventHandler(String s)
{
}
-EventHandler::EventHandler(Bindings::CallbackType& c)
+EventHandler::EventHandler(WebIDL::CallbackType& c)
: value(&c)
{
}
@@ -25,7 +25,7 @@ void EventHandler::visit_edges(Cell::Visitor& visitor)
Cell::visit_edges(visitor);
visitor.visit(listener);
- if (auto* callback = value.get_pointer<Bindings::CallbackType*>())
+ if (auto* callback = value.get_pointer<WebIDL::CallbackType*>())
visitor.visit(*callback);
}
diff --git a/Userland/Libraries/LibWeb/HTML/EventHandler.h b/Userland/Libraries/LibWeb/HTML/EventHandler.h
index a7be161c6e..3014aceac8 100644
--- a/Userland/Libraries/LibWeb/HTML/EventHandler.h
+++ b/Userland/Libraries/LibWeb/HTML/EventHandler.h
@@ -9,21 +9,21 @@
#include <AK/String.h>
#include <AK/Variant.h>
#include <LibJS/Heap/Cell.h>
-#include <LibWeb/Bindings/CallbackType.h>
+#include <LibWeb/WebIDL/CallbackType.h>
namespace Web::HTML {
class EventHandler final : public JS::Cell {
public:
explicit EventHandler(String);
- explicit EventHandler(Bindings::CallbackType&);
+ explicit EventHandler(WebIDL::CallbackType&);
// Either uncompiled source code or a callback.
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-value
// NOTE: This does not contain Empty as part of the optimization of not allocating all event handler attributes up front.
// FIXME: The string should actually be an "internal raw uncompiled handler" struct. This struct is just the uncompiled source code plus a source location for reporting parse errors.
// https://html.spec.whatwg.org/multipage/webappapis.html#internal-raw-uncompiled-handler
- Variant<String, Bindings::CallbackType*> value;
+ Variant<String, WebIDL::CallbackType*> value;
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-listener
DOM::DOMEventListener* listener { nullptr };
diff --git a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp
index 76eb8c2edb..8bef4f4d21 100644
--- a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp
+++ b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.cpp
@@ -13,11 +13,11 @@ namespace Web::HTML {
#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name) \
- void GlobalEventHandlers::set_##attribute_name(Bindings::CallbackType* value) \
+ void GlobalEventHandlers::set_##attribute_name(WebIDL::CallbackType* value) \
{ \
global_event_handlers_to_event_target(event_name).set_event_handler_attribute(event_name, value); \
} \
- Bindings::CallbackType* GlobalEventHandlers::attribute_name() \
+ WebIDL::CallbackType* GlobalEventHandlers::attribute_name() \
{ \
return global_event_handlers_to_event_target(event_name).event_handler_attribute(event_name); \
}
diff --git a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h
index 11c99dddee..23c1908be2 100644
--- a/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h
+++ b/Userland/Libraries/LibWeb/HTML/GlobalEventHandlers.h
@@ -84,9 +84,9 @@ public:
virtual ~GlobalEventHandlers();
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void set_##attribute_name(Bindings::CallbackType*); \
- Bindings::CallbackType* attribute_name();
+#define __ENUMERATE(attribute_name, event_name) \
+ void set_##attribute_name(WebIDL::CallbackType*); \
+ WebIDL::CallbackType* attribute_name();
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
index aceb172125..7774931e9c 100644
--- a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
+++ b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
@@ -112,14 +112,14 @@ void MessagePort::close()
}
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void MessagePort::set_##attribute_name(Bindings::CallbackType* value) \
- { \
- set_event_handler_attribute(event_name, value); \
- } \
- Bindings::CallbackType* MessagePort::attribute_name() \
- { \
- return event_handler_attribute(event_name); \
+#define __ENUMERATE(attribute_name, event_name) \
+ void MessagePort::set_##attribute_name(WebIDL::CallbackType* value) \
+ { \
+ set_event_handler_attribute(event_name, value); \
+ } \
+ WebIDL::CallbackType* MessagePort::attribute_name() \
+ { \
+ return event_handler_attribute(event_name); \
}
ENUMERATE_MESSAGE_PORT_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.h b/Userland/Libraries/LibWeb/HTML/MessagePort.h
index 53b61eaac6..6a6b1334fc 100644
--- a/Userland/Libraries/LibWeb/HTML/MessagePort.h
+++ b/Userland/Libraries/LibWeb/HTML/MessagePort.h
@@ -37,9 +37,9 @@ public:
void close();
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void set_##attribute_name(Bindings::CallbackType*); \
- Bindings::CallbackType* attribute_name();
+#define __ENUMERATE(attribute_name, event_name) \
+ void set_##attribute_name(WebIDL::CallbackType*); \
+ WebIDL::CallbackType* attribute_name();
ENUMERATE_MESSAGE_PORT_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index 7f5bb6396c..a118896283 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -213,7 +213,7 @@ i32 Window::run_timer_initialization_steps(TimerHandler handler, i32 timeout, JS
handler.visit(
// 2. If handler is a Function, then invoke handler given arguments with the callback this value set to thisArg. If this throws an exception, catch it, and report the exception.
- [&](JS::Handle<Bindings::CallbackType> callback) {
+ [&](JS::Handle<WebIDL::CallbackType> callback) {
if (auto result = Bindings::IDL::invoke_callback(*callback, window.ptr(), arguments); result.is_error())
HTML::report_exception(result);
},
@@ -277,7 +277,7 @@ i32 Window::run_timer_initialization_steps(TimerHandler handler, i32 timeout, JS
}
// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#run-the-animation-frame-callbacks
-i32 Window::request_animation_frame_impl(Bindings::CallbackType& js_callback)
+i32 Window::request_animation_frame_impl(WebIDL::CallbackType& js_callback)
{
return m_animation_frame_callback_driver.add([this, js_callback = JS::make_handle(js_callback)](auto) mutable {
// 3. Invoke callback, passing now as the only argument,
@@ -506,7 +506,7 @@ void Window::fire_a_page_transition_event(FlyString const& event_name, bool pers
}
// https://html.spec.whatwg.org/#dom-queuemicrotask
-void Window::queue_microtask_impl(Bindings::CallbackType& callback)
+void Window::queue_microtask_impl(WebIDL::CallbackType& callback)
{
// The queueMicrotask(callback) method must queue a microtask to invoke callback,
HTML::queue_a_microtask(&associated_document(), [&callback]() mutable {
@@ -686,7 +686,7 @@ void Window::invoke_idle_callbacks()
}
// https://w3c.github.io/requestidlecallback/#the-requestidlecallback-method
-u32 Window::request_idle_callback_impl(Bindings::CallbackType& callback)
+u32 Window::request_idle_callback_impl(WebIDL::CallbackType& callback)
{
// 1. Let window be this Window object.
auto& window = *this;
@@ -696,7 +696,7 @@ u32 Window::request_idle_callback_impl(Bindings::CallbackType& callback)
auto handle = window.m_idle_callback_identifier;
// 4. Push callback to the end of window's list of idle request callbacks, associated with handle.
auto handler = [callback = JS::make_handle(callback)](JS::NonnullGCPtr<RequestIdleCallback::IdleDeadline> deadline) -> JS::Completion {
- return Bindings::IDL::invoke_callback(const_cast<Bindings::CallbackType&>(*callback), {}, deadline.ptr());
+ return Bindings::IDL::invoke_callback(const_cast<WebIDL::CallbackType&>(*callback), {}, deadline.ptr());
};
window.m_idle_request_callbacks.append(adopt_ref(*new IdleCallback(move(handler), handle)));
// 5. Return handle and then continue running this algorithm asynchronously.
@@ -914,7 +914,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::prompt)
static JS::ThrowCompletionOr<TimerHandler> make_timer_handler(JS::VM& vm, JS::Value handler)
{
if (handler.is_function())
- return JS::make_handle(vm.heap().allocate_without_realm<Bindings::CallbackType>(handler.as_function(), HTML::incumbent_settings_object()));
+ return JS::make_handle(vm.heap().allocate_without_realm<WebIDL::CallbackType>(handler.as_function(), HTML::incumbent_settings_object()));
return TRY(handler.to_string(vm));
}
@@ -996,7 +996,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::request_animation_frame)
auto* callback_object = TRY(vm.argument(0).to_object(vm));
if (!callback_object->is_function())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
- auto* callback = vm.heap().allocate_without_realm<Bindings::CallbackType>(*callback_object, HTML::incumbent_settings_object());
+ auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
return JS::Value(impl->request_animation_frame_impl(*callback));
}
@@ -1019,7 +1019,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::queue_microtask)
if (!callback_object->is_function())
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
- auto* callback = vm.heap().allocate_without_realm<Bindings::CallbackType>(*callback_object, HTML::incumbent_settings_object());
+ auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
impl->queue_microtask_impl(*callback);
return JS::js_undefined();
@@ -1035,7 +1035,7 @@ JS_DEFINE_NATIVE_FUNCTION(Window::request_idle_callback)
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAFunctionNoParam);
// FIXME: accept options object
- auto* callback = vm.heap().allocate_without_realm<Bindings::CallbackType>(*callback_object, HTML::incumbent_settings_object());
+ auto* callback = vm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_object, HTML::incumbent_settings_object());
return JS::Value(impl->request_idle_callback_impl(*callback));
}
@@ -1461,26 +1461,26 @@ JS_DEFINE_NATIVE_FUNCTION(Window::name_setter)
return JS::js_undefined();
}
-#define __ENUMERATE(attribute, event_name) \
- JS_DEFINE_NATIVE_FUNCTION(Window::attribute##_getter) \
- { \
- auto* impl = TRY(impl_from(vm)); \
- auto retval = impl->attribute(); \
- if (!retval) \
- return JS::js_null(); \
- return &retval->callback; \
- } \
- JS_DEFINE_NATIVE_FUNCTION(Window::attribute##_setter) \
- { \
- auto* impl = TRY(impl_from(vm)); \
- auto value = vm.argument(0); \
- Bindings::CallbackType* cpp_value = nullptr; \
- if (value.is_object()) { \
- cpp_value = vm.heap().allocate_without_realm<Bindings::CallbackType>( \
- value.as_object(), HTML::incumbent_settings_object()); \
- } \
- impl->set_##attribute(cpp_value); \
- return JS::js_undefined(); \
+#define __ENUMERATE(attribute, event_name) \
+ JS_DEFINE_NATIVE_FUNCTION(Window::attribute##_getter) \
+ { \
+ auto* impl = TRY(impl_from(vm)); \
+ auto retval = impl->attribute(); \
+ if (!retval) \
+ return JS::js_null(); \
+ return &retval->callback; \
+ } \
+ JS_DEFINE_NATIVE_FUNCTION(Window::attribute##_setter) \
+ { \
+ auto* impl = TRY(impl_from(vm)); \
+ auto value = vm.argument(0); \
+ WebIDL::CallbackType* cpp_value = nullptr; \
+ if (value.is_object()) { \
+ cpp_value = vm.heap().allocate_without_realm<WebIDL::CallbackType>( \
+ value.as_object(), HTML::incumbent_settings_object()); \
+ } \
+ impl->set_##attribute(cpp_value); \
+ return JS::js_undefined(); \
}
ENUMERATE_GLOBAL_EVENT_HANDLERS(__ENUMERATE)
ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE)
diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h
index 85a50d2213..16e0799415 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.h
+++ b/Userland/Libraries/LibWeb/HTML/Window.h
@@ -25,7 +25,7 @@ namespace Web::HTML {
class IdleCallback;
// https://html.spec.whatwg.org/#timerhandler
-using TimerHandler = Variant<JS::Handle<Bindings::CallbackType>, String>;
+using TimerHandler = Variant<JS::Handle<WebIDL::CallbackType>, String>;
class Window final
: public DOM::EventTarget
@@ -57,7 +57,7 @@ public:
void alert_impl(String const&);
bool confirm_impl(String const&);
String prompt_impl(String const&, String const&);
- i32 request_animation_frame_impl(Bindings::CallbackType& js_callback);
+ i32 request_animation_frame_impl(WebIDL::CallbackType& js_callback);
void cancel_animation_frame_impl(i32);
bool has_animation_frame_callbacks() const { return m_animation_frame_callback_driver.has_callbacks(); }
@@ -66,7 +66,7 @@ public:
void clear_timeout_impl(i32);
void clear_interval_impl(i32);
- void queue_microtask_impl(Bindings::CallbackType& callback);
+ void queue_microtask_impl(WebIDL::CallbackType& callback);
int inner_width() const;
int inner_height() const;
@@ -115,7 +115,7 @@ public:
void start_an_idle_period();
- u32 request_idle_callback_impl(Bindings::CallbackType& callback);
+ u32 request_idle_callback_impl(WebIDL::CallbackType& callback);
void cancel_idle_callback_impl(u32);
AnimationFrameCallbackDriver& animation_frame_callback_driver() { return m_animation_frame_callback_driver; }
diff --git a/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp b/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp
index b33318e45d..c80c4847c3 100644
--- a/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp
+++ b/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.cpp
@@ -12,11 +12,11 @@ namespace Web::HTML {
#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name) \
- void WindowEventHandlers::set_##attribute_name(Bindings::CallbackType* value) \
+ void WindowEventHandlers::set_##attribute_name(WebIDL::CallbackType* value) \
{ \
window_event_handlers_to_event_target().set_event_handler_attribute(event_name, value); \
} \
- Bindings::CallbackType* WindowEventHandlers::attribute_name() \
+ WebIDL::CallbackType* WindowEventHandlers::attribute_name() \
{ \
return window_event_handlers_to_event_target().event_handler_attribute(event_name); \
}
diff --git a/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h b/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h
index a6d0009b7a..e5e8ce5f75 100644
--- a/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h
+++ b/Userland/Libraries/LibWeb/HTML/WindowEventHandlers.h
@@ -34,9 +34,9 @@ public:
virtual ~WindowEventHandlers();
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void set_##attribute_name(Bindings::CallbackType*); \
- Bindings::CallbackType* attribute_name();
+#define __ENUMERATE(attribute_name, event_name) \
+ void set_##attribute_name(WebIDL::CallbackType*); \
+ WebIDL::CallbackType* attribute_name();
ENUMERATE_WINDOW_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/HTML/Worker.cpp b/Userland/Libraries/LibWeb/HTML/Worker.cpp
index aab54be5d5..d8c4dc9c53 100644
--- a/Userland/Libraries/LibWeb/HTML/Worker.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Worker.cpp
@@ -333,14 +333,14 @@ void Worker::post_message(JS::Value message, JS::Value)
}
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void Worker::set_##attribute_name(Bindings::CallbackType* value) \
- { \
- set_event_handler_attribute(event_name, move(value)); \
- } \
- Bindings::CallbackType* Worker::attribute_name() \
- { \
- return event_handler_attribute(event_name); \
+#define __ENUMERATE(attribute_name, event_name) \
+ void Worker::set_##attribute_name(WebIDL::CallbackType* value) \
+ { \
+ set_event_handler_attribute(event_name, move(value)); \
+ } \
+ WebIDL::CallbackType* Worker::attribute_name() \
+ { \
+ return event_handler_attribute(event_name); \
}
ENUMERATE_WORKER_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/HTML/Worker.h b/Userland/Libraries/LibWeb/HTML/Worker.h
index 9c92120240..bcc1a447bd 100644
--- a/Userland/Libraries/LibWeb/HTML/Worker.h
+++ b/Userland/Libraries/LibWeb/HTML/Worker.h
@@ -52,9 +52,9 @@ public:
JS::GCPtr<MessagePort> outside_message_port() { return m_outside_port; }
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void set_##attribute_name(Bindings::CallbackType*); \
- Bindings::CallbackType* attribute_name();
+#define __ENUMERATE(attribute_name, event_name) \
+ void set_##attribute_name(WebIDL::CallbackType*); \
+ WebIDL::CallbackType* attribute_name();
ENUMERATE_WORKER_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp
index c1b6d069b0..93d4e39827 100644
--- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp
+++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.cpp
@@ -85,14 +85,14 @@ JS::NonnullGCPtr<WorkerNavigator> WorkerGlobalScope::navigator() const
}
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void WorkerGlobalScope::set_##attribute_name(Bindings::CallbackType* value) \
- { \
- set_event_handler_attribute(event_name, move(value)); \
- } \
- Bindings::CallbackType* WorkerGlobalScope::attribute_name() \
- { \
- return event_handler_attribute(event_name); \
+#define __ENUMERATE(attribute_name, event_name) \
+ void WorkerGlobalScope::set_##attribute_name(WebIDL::CallbackType* value) \
+ { \
+ set_event_handler_attribute(event_name, move(value)); \
+ } \
+ WebIDL::CallbackType* WorkerGlobalScope::attribute_name() \
+ { \
+ return event_handler_attribute(event_name); \
}
ENUMERATE_WORKER_GLOBAL_SCOPE_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h
index 30cf2d070f..66d571f1d1 100644
--- a/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h
+++ b/Userland/Libraries/LibWeb/HTML/WorkerGlobalScope.h
@@ -45,9 +45,9 @@ public:
DOM::ExceptionOr<void> import_scripts(Vector<String> urls);
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void set_##attribute_name(Bindings::CallbackType*); \
- Bindings::CallbackType* attribute_name();
+#define __ENUMERATE(attribute_name, event_name) \
+ void set_##attribute_name(WebIDL::CallbackType*); \
+ WebIDL::CallbackType* attribute_name();
ENUMERATE_WORKER_GLOBAL_SCOPE_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
index 7bd00dc103..9b6917880e 100644
--- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
+++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.cpp
@@ -11,7 +11,7 @@
namespace Web::IntersectionObserver {
// https://w3c.github.io/IntersectionObserver/#dom-intersectionobserver-intersectionobserver
-JS::NonnullGCPtr<IntersectionObserver> IntersectionObserver::create_with_global_object(HTML::Window& window, Bindings::CallbackType* callback, IntersectionObserverInit const& options)
+JS::NonnullGCPtr<IntersectionObserver> IntersectionObserver::create_with_global_object(HTML::Window& window, WebIDL::CallbackType* callback, IntersectionObserverInit const& options)
{
// FIXME: Implement
(void)callback;
diff --git a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h
index 6e85321c13..266e885887 100644
--- a/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h
+++ b/Userland/Libraries/LibWeb/IntersectionObserver/IntersectionObserver.h
@@ -22,7 +22,7 @@ class IntersectionObserver : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(IntersectionObserver, Bindings::PlatformObject);
public:
- static JS::NonnullGCPtr<IntersectionObserver> create_with_global_object(HTML::Window&, Bindings::CallbackType* callback, IntersectionObserverInit const& options = {});
+ static JS::NonnullGCPtr<IntersectionObserver> create_with_global_object(HTML::Window&, WebIDL::CallbackType* callback, IntersectionObserverInit const& options = {});
virtual ~IntersectionObserver() override;
diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp
index 13c35d8521..e4a6f74a63 100644
--- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp
+++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp
@@ -11,7 +11,7 @@
namespace Web::ResizeObserver {
// https://drafts.csswg.org/resize-observer/#dom-resizeobserver-resizeobserver
-JS::NonnullGCPtr<ResizeObserver> ResizeObserver::create_with_global_object(HTML::Window& window, Bindings::CallbackType* callback)
+JS::NonnullGCPtr<ResizeObserver> ResizeObserver::create_with_global_object(HTML::Window& window, WebIDL::CallbackType* callback)
{
// FIXME: Implement
(void)callback;
diff --git a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h
index cebbbd9736..dee26b65e5 100644
--- a/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h
+++ b/Userland/Libraries/LibWeb/ResizeObserver/ResizeObserver.h
@@ -19,7 +19,7 @@ class ResizeObserver : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(ResizeObserver, Bindings::PlatformObject);
public:
- static JS::NonnullGCPtr<ResizeObserver> create_with_global_object(HTML::Window&, Bindings::CallbackType* callback);
+ static JS::NonnullGCPtr<ResizeObserver> create_with_global_object(HTML::Window&, WebIDL::CallbackType* callback);
virtual ~ResizeObserver() override;
diff --git a/Userland/Libraries/LibWeb/Bindings/CallbackType.cpp b/Userland/Libraries/LibWeb/WebIDL/CallbackType.cpp
index a575548be5..bcd5776de6 100644
--- a/Userland/Libraries/LibWeb/Bindings/CallbackType.cpp
+++ b/Userland/Libraries/LibWeb/WebIDL/CallbackType.cpp
@@ -5,9 +5,9 @@
*/
#include <LibJS/Runtime/Object.h>
-#include <LibWeb/Bindings/CallbackType.h>
+#include <LibWeb/WebIDL/CallbackType.h>
-namespace Web::Bindings {
+namespace Web::WebIDL {
CallbackType::CallbackType(JS::Object& callback, HTML::EnvironmentSettingsObject& callback_context)
: callback(callback)
diff --git a/Userland/Libraries/LibWeb/Bindings/CallbackType.h b/Userland/Libraries/LibWeb/WebIDL/CallbackType.h
index b1f2cebbb3..3f45bf69cb 100644
--- a/Userland/Libraries/LibWeb/Bindings/CallbackType.h
+++ b/Userland/Libraries/LibWeb/WebIDL/CallbackType.h
@@ -10,7 +10,7 @@
#include <LibJS/Heap/Cell.h>
#include <LibWeb/Forward.h>
-namespace Web::Bindings {
+namespace Web::WebIDL {
// https://heycam.github.io/webidl/#idl-callback-interface
class CallbackType final : public JS::Cell {
diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
index 1449d1de72..ac2ccc0228 100644
--- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
+++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
@@ -231,14 +231,14 @@ void WebSocket::on_message(ByteBuffer message, bool is_text)
}
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void WebSocket::set_##attribute_name(Bindings::CallbackType* value) \
- { \
- set_event_handler_attribute(event_name, value); \
- } \
- Bindings::CallbackType* WebSocket::attribute_name() \
- { \
- return event_handler_attribute(event_name); \
+#define __ENUMERATE(attribute_name, event_name) \
+ void WebSocket::set_##attribute_name(WebIDL::CallbackType* value) \
+ { \
+ set_event_handler_attribute(event_name, value); \
+ } \
+ WebIDL::CallbackType* WebSocket::attribute_name() \
+ { \
+ return event_handler_attribute(event_name); \
}
ENUMERATE_WEBSOCKET_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h
index 4f2272976e..bdfacd55cc 100644
--- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h
+++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h
@@ -44,9 +44,9 @@ public:
String url() const { return m_url.to_string(); }
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void set_##attribute_name(Bindings::CallbackType*); \
- Bindings::CallbackType* attribute_name();
+#define __ENUMERATE(attribute_name, event_name) \
+ void set_##attribute_name(WebIDL::CallbackType*); \
+ WebIDL::CallbackType* attribute_name();
ENUMERATE_WEBSOCKET_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index 97e3bd5cb6..db3b747d61 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -519,12 +519,12 @@ DOM::ExceptionOr<void> XMLHttpRequest::send(Optional<Fetch::XMLHttpRequestBodyIn
return {};
}
-Bindings::CallbackType* XMLHttpRequest::onreadystatechange()
+WebIDL::CallbackType* XMLHttpRequest::onreadystatechange()
{
return event_handler_attribute(Web::XHR::EventNames::readystatechange);
}
-void XMLHttpRequest::set_onreadystatechange(Bindings::CallbackType* value)
+void XMLHttpRequest::set_onreadystatechange(WebIDL::CallbackType* value)
{
set_event_handler_attribute(Web::XHR::EventNames::readystatechange, value);
}
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
index 75ae823853..1af8eae57b 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
@@ -55,8 +55,8 @@ public:
String get_response_header(String const& name) { return m_response_headers.get(name).value_or({}); }
String get_all_response_headers() const;
- Bindings::CallbackType* onreadystatechange();
- void set_onreadystatechange(Bindings::CallbackType*);
+ WebIDL::CallbackType* onreadystatechange();
+ void set_onreadystatechange(WebIDL::CallbackType*);
DOM::ExceptionOr<void> override_mime_type(String const& mime);
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.cpp
index afedb06cc5..24f372cc66 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.cpp
@@ -11,14 +11,14 @@
namespace Web::XHR {
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void XMLHttpRequestEventTarget::set_##attribute_name(Bindings::CallbackType* value) \
- { \
- set_event_handler_attribute(event_name, value); \
- } \
- Bindings::CallbackType* XMLHttpRequestEventTarget::attribute_name() \
- { \
- return event_handler_attribute(event_name); \
+#define __ENUMERATE(attribute_name, event_name) \
+ void XMLHttpRequestEventTarget::set_##attribute_name(WebIDL::CallbackType* value) \
+ { \
+ set_event_handler_attribute(event_name, value); \
+ } \
+ WebIDL::CallbackType* XMLHttpRequestEventTarget::attribute_name() \
+ { \
+ return event_handler_attribute(event_name); \
}
ENUMERATE_XML_HTTP_REQUEST_EVENT_TARGET_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h
index a5d7e0d29f..67aceed7f1 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h
@@ -27,9 +27,9 @@ public:
virtual ~XMLHttpRequestEventTarget() override {};
#undef __ENUMERATE
-#define __ENUMERATE(attribute_name, event_name) \
- void set_##attribute_name(Bindings::CallbackType*); \
- Bindings::CallbackType* attribute_name();
+#define __ENUMERATE(attribute_name, event_name) \
+ void set_##attribute_name(WebIDL::CallbackType*); \
+ WebIDL::CallbackType* attribute_name();
ENUMERATE_XML_HTTP_REQUEST_EVENT_TARGET_EVENT_HANDLERS(__ENUMERATE)
#undef __ENUMERATE