diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp index c32cf4a68f..2fe8f26398 100644 --- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp +++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -22,6 +21,7 @@ #include #include #include +#include namespace Web::Bindings { @@ -380,7 +380,7 @@ void queue_mutation_observer_microtask(DOM::Document& document) MUST(wrapped_records->create_data_property(property_index, record.ptr())); } - auto result = IDL::invoke_callback(callback, mutation_observer.ptr(), wrapped_records, mutation_observer.ptr()); + auto result = WebIDL::invoke_callback(callback, mutation_observer.ptr(), wrapped_records, mutation_observer.ptr()); if (result.is_abrupt()) HTML::report_exception(result); } diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index bcd02004bb..abad3348d6 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/IDLAbstractOperations.cpp Bindings/IDLOverloadResolution.cpp Bindings/ImageConstructor.cpp Bindings/LegacyPlatformObject.cpp @@ -412,6 +411,7 @@ set(SOURCES WebGL/WebGLContextEvent.cpp WebGL/WebGLRenderingContext.cpp WebGL/WebGLRenderingContextBase.cpp + WebIDL/AbstractOperations.cpp WebIDL/CallbackType.cpp WebSockets/WebSocket.cpp XHR/EventNames.cpp diff --git a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp index 59cfb04c98..893f2557e6 100644 --- a/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp +++ b/Userland/Libraries/LibWeb/Crypto/SubtleCrypto.cpp @@ -7,10 +7,10 @@ #include #include #include -#include #include #include #include +#include namespace Web::Crypto { @@ -35,7 +35,7 @@ JS::Promise* SubtleCrypto::digest(String const& algorithm, JS::Handle #include #include -#include #include #include #include @@ -21,6 +20,7 @@ #include #include #include +#include namespace Web::DOM { @@ -109,7 +109,7 @@ bool EventDispatcher::inner_invoke(Event& event, Vector #include #include -#include #include #include #include @@ -32,6 +31,7 @@ #include #include #include +#include namespace Web::DOM { @@ -635,7 +635,7 @@ JS::ThrowCompletionOr EventTarget::process_event_handler_for_event(FlyStri // calls directly into the callback without considering things such as proxies, it is a waste. However, if it observable, then we must reuse the this_value that was given to the callback. auto* this_value = error_event.current_target().ptr(); - return_value_or_error = Bindings::IDL::invoke_callback(*callback, this_value, wrapped_message, wrapped_filename, wrapped_lineno, wrapped_colno, error_event.error()); + return_value_or_error = WebIDL::invoke_callback(*callback, this_value, wrapped_message, wrapped_filename, wrapped_lineno, wrapped_colno, error_event.error()); } else { // -> Otherwise // Invoke callback with one argument, the value of which is the Event object event, with the callback this value set to event's currentTarget. Let return value be the callback's return value. [WEBIDL] @@ -646,7 +646,7 @@ JS::ThrowCompletionOr EventTarget::process_event_handler_for_event(FlyStri // FIXME: The comments about this in the special_error_event_handling path also apply here. auto* this_value = event.current_target().ptr(); - return_value_or_error = Bindings::IDL::invoke_callback(*callback, this_value, wrapped_event); + return_value_or_error = WebIDL::invoke_callback(*callback, this_value, wrapped_event); } // If an exception gets thrown by the callback, end these steps and allow the exception to propagate. (It will propagate to the DOM event dispatch logic, which will then report the exception.) diff --git a/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp b/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp index 648fcf1405..57abeefca1 100644 --- a/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp +++ b/Userland/Libraries/LibWeb/DOM/NodeIterator.cpp @@ -4,10 +4,10 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include #include #include +#include namespace Web::DOM { @@ -148,7 +148,7 @@ JS::ThrowCompletionOr NodeIterator::filter(Node& node) // 6. Let result be the return value of call a user object’s operation with traverser’s filter, "acceptNode", and « node ». // If this throws an exception, then unset traverser’s active flag and rethrow the exception. - auto result = Bindings::IDL::call_user_object_operation(m_filter->callback(), "acceptNode", {}, &node); + auto result = WebIDL::call_user_object_operation(m_filter->callback(), "acceptNode", {}, &node); if (result.is_abrupt()) { m_active = false; return result; diff --git a/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp b/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp index 0244542556..309f5a55fc 100644 --- a/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp +++ b/Userland/Libraries/LibWeb/DOM/TreeWalker.cpp @@ -4,12 +4,12 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include #include #include #include #include +#include namespace Web::DOM { @@ -249,7 +249,7 @@ JS::ThrowCompletionOr TreeWalker::filter(Node& node) // 6. Let result be the return value of call a user object’s operation with traverser’s filter, "acceptNode", and « node ». // If this throws an exception, then unset traverser’s active flag and rethrow the exception. - auto result = Bindings::IDL::call_user_object_operation(m_filter->callback(), "acceptNode", {}, &node); + auto result = WebIDL::call_user_object_operation(m_filter->callback(), "acceptNode", {}, &node); if (result.is_abrupt()) { m_active = false; return result; diff --git a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp index 1379455374..7556094ead 100644 --- a/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp +++ b/Userland/Libraries/LibWeb/Encoding/TextDecoder.cpp @@ -6,9 +6,9 @@ #include #include -#include #include #include +#include namespace Web::Encoding { @@ -39,7 +39,7 @@ DOM::ExceptionOr TextDecoder::decode(JS::Handle const& input { // FIXME: Implement the streaming stuff. - auto data_buffer_or_error = Bindings::IDL::get_buffer_source_copy(*input.cell()); + auto data_buffer_or_error = WebIDL::get_buffer_source_copy(*input.cell()); if (data_buffer_or_error.is_error()) return DOM::OperationError::create(global_object(), "Failed to copy bytes from ArrayBuffer"); auto& data_buffer = data_buffer_or_error.value(); diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp index 3014369415..6fb629d77a 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp @@ -5,12 +5,12 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include #include #include #include #include +#include namespace Web::Fetch { @@ -51,7 +51,7 @@ DOM::ExceptionOr extract_body(JS::Realm& realm, Bo }, [&](JS::Handle const& buffer_source) -> DOM::ExceptionOr { // Set source to a copy of the bytes held by object. - source = TRY_OR_RETURN_OOM(window, Bindings::IDL::get_buffer_source_copy(*buffer_source.cell())); + source = TRY_OR_RETURN_OOM(window, WebIDL::get_buffer_source_copy(*buffer_source.cell())); return {}; }, [&](JS::Handle const& url_search_params) -> DOM::ExceptionOr { diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp index b1c94ddfbf..510be487f4 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp @@ -8,9 +8,9 @@ #include #include #include -#include #include #include +#include namespace Web::FileAPI { @@ -90,7 +90,7 @@ ErrorOr process_blob_parts(Vector const& blob_parts, Optio }, // 2. If element is a BufferSource, get a copy of the bytes held by the buffer source, and append those bytes to bytes. [&](JS::Handle const& buffer_source) -> ErrorOr { - auto data_buffer = TRY(Bindings::IDL::get_buffer_source_copy(*buffer_source.cell())); + auto data_buffer = TRY(WebIDL::get_buffer_source_copy(*buffer_source.cell())); return bytes.try_append(data_buffer.bytes()); }, // 3. If element is a Blob, append the bytes it represents to bytes. diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index a118896283..297a5a42b6 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include #include #include +#include namespace Web::HTML { @@ -214,7 +214,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 callback) { - if (auto result = Bindings::IDL::invoke_callback(*callback, window.ptr(), arguments); result.is_error()) + if (auto result = WebIDL::invoke_callback(*callback, window.ptr(), arguments); result.is_error()) HTML::report_exception(result); }, // 3. Otherwise: @@ -281,7 +281,7 @@ 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, - auto result = Bindings::IDL::invoke_callback(*js_callback, {}, JS::Value(performance().now())); + auto result = WebIDL::invoke_callback(*js_callback, {}, JS::Value(performance().now())); // and if an exception is thrown, report the exception. if (result.is_error()) @@ -510,7 +510,7 @@ 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 { - auto result = Bindings::IDL::invoke_callback(callback, {}); + auto result = WebIDL::invoke_callback(callback, {}); // and if callback throws an exception, report the exception. if (result.is_error()) HTML::report_exception(result); @@ -696,7 +696,7 @@ u32 Window::request_idle_callback_impl(WebIDL::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 deadline) -> JS::Completion { - return Bindings::IDL::invoke_callback(const_cast(*callback), {}, deadline.ptr()); + return WebIDL::invoke_callback(const_cast(*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. diff --git a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.cpp similarity index 98% rename from Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp rename to Userland/Libraries/LibWeb/WebIDL/AbstractOperations.cpp index f3e1281c11..438ad3a8ab 100644 --- a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.cpp @@ -12,9 +12,9 @@ #include #include #include -#include +#include -namespace Web::Bindings::IDL { +namespace Web::WebIDL { // https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy ErrorOr get_buffer_source_copy(JS::Object const& buffer_source) diff --git a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h similarity index 99% rename from Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h rename to Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h index e1af9aeda5..db0fc28ddc 100644 --- a/Userland/Libraries/LibWeb/Bindings/IDLAbstractOperations.h +++ b/Userland/Libraries/LibWeb/WebIDL/AbstractOperations.h @@ -14,7 +14,7 @@ #include #include -namespace Web::Bindings::IDL { +namespace Web::WebIDL { ErrorOr get_buffer_source_copy(JS::Object const& buffer_source);