summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebSockets
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2022-09-25 17:03:42 +0100
committerLinus Groh <mail@linusgroh.de>2022-09-25 19:13:31 +0100
commitad04d7ac9b88ecea572cf517f6e01ccf1e95073d (patch)
treeed33bb942b1bdef7163972425057435a7d8eeaf9 /Userland/Libraries/LibWeb/WebSockets
parentc0eda779287d4b1305046164cd0a8ee5a5799e0b (diff)
downloadserenity-ad04d7ac9b88ecea572cf517f6e01ccf1e95073d.zip
LibWeb: Move ExceptionOr from DOM/ to WebIDL/
This is a concept fully defined in the Web IDL spec and doesn't belong in the DOM directory/namespace - not even DOMException, despite the name :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/WebSockets')
-rw-r--r--Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp8
-rw-r--r--Userland/Libraries/LibWeb/WebSockets/WebSocket.h8
2 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
index ac2ccc0228..b429277aed 100644
--- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
+++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.cpp
@@ -12,7 +12,6 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/EventDispatcher.h>
-#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/IDLEventListener.h>
#include <LibWeb/HTML/CloseEvent.h>
#include <LibWeb/HTML/EventHandler.h>
@@ -20,6 +19,7 @@
#include <LibWeb/HTML/MessageEvent.h>
#include <LibWeb/HTML/Origin.h>
#include <LibWeb/HTML/Window.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
#include <LibWeb/WebSockets/WebSocket.h>
namespace Web::WebSockets {
@@ -47,7 +47,7 @@ WebSocketClientSocket::~WebSocketClientSocket() = default;
WebSocketClientManager::WebSocketClientManager() = default;
// https://websockets.spec.whatwg.org/#dom-websocket-websocket
-DOM::ExceptionOr<JS::NonnullGCPtr<WebSocket>> WebSocket::create_with_global_object(HTML::Window& window, String const& url)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<WebSocket>> WebSocket::create_with_global_object(HTML::Window& window, String const& url)
{
AK::URL url_record(url);
if (!url_record.is_valid())
@@ -133,7 +133,7 @@ String WebSocket::protocol() const
}
// https://websockets.spec.whatwg.org/#dom-websocket-close
-DOM::ExceptionOr<void> WebSocket::close(Optional<u16> code, Optional<String> reason)
+WebIDL::ExceptionOr<void> WebSocket::close(Optional<u16> code, Optional<String> reason)
{
// 1. If code is present, but is neither an integer equal to 1000 nor an integer in the range 3000 to 4999, inclusive, throw an "InvalidAccessError" DOMException.
if (code.has_value() && *code != 1000 && (*code < 3000 || *code > 4099))
@@ -160,7 +160,7 @@ DOM::ExceptionOr<void> WebSocket::close(Optional<u16> code, Optional<String> rea
}
// https://websockets.spec.whatwg.org/#dom-websocket-send
-DOM::ExceptionOr<void> WebSocket::send(String const& data)
+WebIDL::ExceptionOr<void> WebSocket::send(String const& data)
{
auto state = ready_state();
if (state == WebSocket::ReadyState::Connecting)
diff --git a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h
index bdfacd55cc..f882120f24 100644
--- a/Userland/Libraries/LibWeb/WebSockets/WebSocket.h
+++ b/Userland/Libraries/LibWeb/WebSockets/WebSocket.h
@@ -11,9 +11,9 @@
#include <LibCore/Object.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/EventTarget.h>
-#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
#define ENUMERATE_WEBSOCKET_EVENT_HANDLERS(E) \
E(onerror, HTML::EventNames::error) \
@@ -37,7 +37,7 @@ public:
Closed = 3,
};
- static DOM::ExceptionOr<JS::NonnullGCPtr<WebSocket>> create_with_global_object(HTML::Window&, String const& url);
+ static WebIDL::ExceptionOr<JS::NonnullGCPtr<WebSocket>> create_with_global_object(HTML::Window&, String const& url);
virtual ~WebSocket() override;
@@ -57,8 +57,8 @@ public:
String const& binary_type() { return m_binary_type; };
void set_binary_type(String const& type) { m_binary_type = type; };
- DOM::ExceptionOr<void> close(Optional<u16> code, Optional<String> reason);
- DOM::ExceptionOr<void> send(String const& data);
+ WebIDL::ExceptionOr<void> close(Optional<u16> code, Optional<String> reason);
+ WebIDL::ExceptionOr<void> send(String const& data);
private:
void on_open();