summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibWeb/CMakeLists.txt1
-rw-r--r--Userland/Libraries/LibWeb/Forward.h2
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp2
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h4
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl2
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h56
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.idl3
7 files changed, 66 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt
index efac40b7bd..79fe39de24 100644
--- a/Userland/Libraries/LibWeb/CMakeLists.txt
+++ b/Userland/Libraries/LibWeb/CMakeLists.txt
@@ -373,6 +373,7 @@ libweb_js_wrapper(UIEvents/MouseEvent)
libweb_js_wrapper(UIEvents/UIEvent)
libweb_js_wrapper(XHR/ProgressEvent)
libweb_js_wrapper(XHR/XMLHttpRequest)
+libweb_js_wrapper(XHR/XMLHttpRequestEventTarget)
get_property(WRAPPER_SOURCES GLOBAL PROPERTY wrapper_sources)
set(SOURCES ${SOURCES} ${WRAPPER_SOURCES})
diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h
index c1c222baef..7e8ca5b9da 100644
--- a/Userland/Libraries/LibWeb/Forward.h
+++ b/Userland/Libraries/LibWeb/Forward.h
@@ -192,6 +192,7 @@ class StackingContext;
namespace Web::XHR {
class ProgressEvent;
class XMLHttpRequest;
+class XMLHttpRequestEventTarget;
}
namespace Web::Bindings {
@@ -300,6 +301,7 @@ class Wrapper;
class XMLHttpRequestConstructor;
class XMLHttpRequestPrototype;
class XMLHttpRequestWrapper;
+class XMLHttpRequestEventTargetWrapper;
class RangeConstructor;
class RangePrototype;
class RangeWrapper;
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index 249c106127..cec68927f3 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -43,7 +43,7 @@
namespace Web::XHR {
XMLHttpRequest::XMLHttpRequest(DOM::Window& window)
- : EventTarget(static_cast<Bindings::ScriptExecutionContext&>(window.document()))
+ : XMLHttpRequestEventTarget(static_cast<Bindings::ScriptExecutionContext&>(window.document()))
, m_window(window)
{
}
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
index 076e6a9681..a8050a315d 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h
@@ -32,14 +32,14 @@
#include <AK/Weakable.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/DOM/EventTarget.h>
+#include <LibWeb/XHR/XMLHttpRequestEventTarget.h>
namespace Web::XHR {
class XMLHttpRequest final
: public RefCounted<XMLHttpRequest>
, public Weakable<XMLHttpRequest>
- , public DOM::EventTarget
- , public Bindings::Wrappable {
+ , public XMLHttpRequestEventTarget {
public:
enum class ReadyState : u16 {
Unsent = 0,
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl
index bf2a035ec4..b4529f0283 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.idl
@@ -1,4 +1,4 @@
-interface XMLHttpRequest : EventTarget {
+interface XMLHttpRequest : XMLHttpRequestEventTarget {
const unsigned short UNSENT = 0;
const unsigned short OPENED = 1;
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h
new file mode 100644
index 0000000000..5b8691821b
--- /dev/null
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2021, the SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/Bindings/EventTargetWrapperFactory.h>
+#include <LibWeb/DOM/EventDispatcher.h>
+#include <LibWeb/DOM/EventTarget.h>
+
+namespace Web::XHR {
+
+class XMLHttpRequestEventTarget
+ : public DOM::EventTarget
+ , public Bindings::Wrappable {
+public:
+ using WrapperType = Bindings::XMLHttpRequestEventTargetWrapper;
+
+ virtual ~XMLHttpRequestEventTarget() override {};
+
+protected:
+ explicit XMLHttpRequestEventTarget(Bindings::ScriptExecutionContext& script_execution_context)
+ : DOM::EventTarget(script_execution_context)
+ {
+ }
+
+private:
+ virtual JS::Object* create_wrapper(JS::GlobalObject& global_object) override
+ {
+ return wrap(global_object, *this);
+ }
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.idl b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.idl
new file mode 100644
index 0000000000..658f1ca2ee
--- /dev/null
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequestEventTarget.idl
@@ -0,0 +1,3 @@
+interface XMLHttpRequestEventTarget : EventTarget {
+
+};