Procházet zdrojové kódy

LibWeb: Cleanup unecessary uses and includes of HTML::Window

The big global refactor left some stragglers behind for atomicity.

Clean up the rest, and remove a ton of includes of LibWeb/HTML/Window.h
Andrew Kaster před 2 roky
rodič
revize
56b381aac0
88 změnil soubory, kde provedl 76 přidání a 169 odebrání
  1. 3 20
      Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp
  2. 1 1
      Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp
  3. 0 2
      Userland/Libraries/LibWeb/Bindings/NavigatorPrototype.h
  4. 0 5
      Userland/Libraries/LibWeb/DOM/AbortSignal.cpp
  5. 0 1
      Userland/Libraries/LibWeb/DOM/AbortSignal.h
  6. 1 1
      Userland/Libraries/LibWeb/DOM/CDATASection.cpp
  7. 1 2
      Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp
  8. 0 5
      Userland/Libraries/LibWeb/DOM/Document.cpp
  9. 0 1
      Userland/Libraries/LibWeb/DOM/Document.h
  10. 0 16
      Userland/Libraries/LibWeb/DOM/Event.cpp
  11. 0 3
      Userland/Libraries/LibWeb/DOM/Event.h
  12. 0 1
      Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp
  13. 0 1
      Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp
  14. 1 2
      Userland/Libraries/LibWeb/DOM/NodeFilter.cpp
  15. 2 2
      Userland/Libraries/LibWeb/DOM/NodeIterator.cpp
  16. 0 1
      Userland/Libraries/LibWeb/DOM/ParentNode.cpp
  17. 1 1
      Userland/Libraries/LibWeb/DOM/Text.h
  18. 3 3
      Userland/Libraries/LibWeb/DOM/TreeWalker.cpp
  19. 1 1
      Userland/Libraries/LibWeb/Fetch/Body.cpp
  20. 0 1
      Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp
  21. 0 6
      Userland/Libraries/LibWeb/HTML/CloseEvent.cpp
  22. 0 1
      Userland/Libraries/LibWeb/HTML/CloseEvent.h
  23. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp
  24. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp
  25. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp
  26. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp
  27. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp
  28. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp
  29. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp
  30. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp
  31. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp
  32. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp
  33. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp
  34. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp
  35. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp
  36. 1 2
      Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp
  37. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp
  38. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp
  39. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
  40. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp
  41. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp
  42. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp
  43. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp
  44. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp
  45. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp
  46. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
  47. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp
  48. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp
  49. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp
  50. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp
  51. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp
  52. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp
  53. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
  54. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
  55. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
  56. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp
  57. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp
  58. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp
  59. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp
  60. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp
  61. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp
  62. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp
  63. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp
  64. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
  65. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp
  66. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp
  67. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp
  68. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp
  69. 1 1
      Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp
  70. 0 6
      Userland/Libraries/LibWeb/HTML/MessageEvent.cpp
  71. 0 1
      Userland/Libraries/LibWeb/HTML/MessageEvent.h
  72. 1 2
      Userland/Libraries/LibWeb/Infra/JSON.cpp
  73. 0 1
      Userland/Libraries/LibWeb/Page/EventHandler.cpp
  74. 1 1
      Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp
  75. 1 1
      Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp
  76. 1 1
      Userland/Libraries/LibWeb/SVG/SVGElement.cpp
  77. 1 1
      Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp
  78. 1 1
      Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp
  79. 0 5
      Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp
  80. 0 1
      Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h
  81. 0 5
      Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp
  82. 0 1
      Userland/Libraries/LibWeb/UIEvents/MouseEvent.h
  83. 0 2
      Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h
  84. 1 0
      Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.cpp
  85. 0 2
      Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModulePrototype.h
  86. 1 0
      Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableObject.cpp
  87. 0 2
      Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h
  88. 7 11
      Userland/Libraries/LibWeb/WebIDL/DOMException.h

+ 3 - 20
Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp

@@ -2039,7 +2039,6 @@ void generate_constructor_implementation(IDL::Interface const& interface)
 #include <LibWeb/Bindings/@prototype_class@.h>
 #include <LibWeb/Bindings/ExceptionOrUtils.h>
 #include <LibWeb/Bindings/Intrinsics.h>
-#include <LibWeb/HTML/Window.h>
 #if __has_include(<LibWeb/Crypto/@name@.h>)
 #    include <LibWeb/Crypto/@name@.h>
 #elif __has_include(<LibWeb/CSS/@name@.h>)
@@ -2141,8 +2140,7 @@ JS::ThrowCompletionOr<JS::Object*> @constructor_class@::construct(FunctionObject
 
         generator.append(R"~~~(
     auto& vm = this->vm();
-    [[maybe_unused]] auto& realm = *vm.current_realm();
-    [[maybe_unused]] auto& window = verify_cast<HTML::Window>(realm.global_object());
+    auto& realm = *vm.current_realm();
 )~~~");
 
         if (!constructor.parameters.is_empty()) {
@@ -2153,29 +2151,14 @@ JS::ThrowCompletionOr<JS::Object*> @constructor_class@::construct(FunctionObject
             generator.set(".constructor_arguments", arguments_builder.string_view());
 
             generator.append(R"~~~(
-    auto construct_impl = [&] <typename T>() {
-        if constexpr (requires(T) { T::construct_impl(declval<::JS::Realm&>(), @.constructor_arguments@ ); })
-            return T::construct_impl(realm, @.constructor_arguments@);
-        else if constexpr (requires(T) { T::create_with_global_object(declval<::Web::HTML::Window&>(), @.constructor_arguments@); })
-            return T::create_with_global_object(window, @.constructor_arguments@);
-        else if constexpr (requires(T) { sizeof(T); })
-            static_assert(DependentFalse<T>, "Bound type is missing constructor factory");
-    };
+    auto impl = TRY(throw_dom_exception_if_needed(vm, [&] { return @fully_qualified_name@::construct_impl(realm, @.constructor_arguments@); }));
 )~~~");
         } else {
             generator.append(R"~~~(
-    auto construct_impl = [&] <typename T>() {
-        if constexpr (requires(T) { T::construct_impl(declval<::JS::Realm&>()); })
-            return T::construct_impl(realm);
-        else if constexpr (requires(T) { T::create_with_global_object(declval<::Web::HTML::Window&>()); })
-            return T::create_with_global_object(window);
-        else if constexpr (requires(T) { sizeof(T); })
-            static_assert(DependentFalse<T>, "Bound type is missing constructor factory");
-    };
+    auto impl = TRY(throw_dom_exception_if_needed(vm, [&] { return @fully_qualified_name@::construct_impl(realm); }));
 )~~~");
         }
         generator.append(R"~~~(
-    auto impl = TRY(throw_dom_exception_if_needed(vm, [&] { return construct_impl.operator()<@fully_qualified_name@>(); }));
     return &(*impl);
 )~~~");
     } else {

+ 1 - 1
Userland/Libraries/LibWeb/Bindings/LegacyPlatformObject.cpp

@@ -136,7 +136,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> LegacyPlatformObject::le
     // FIXME: Can this throw?
     if (is_supported_property_index(index)) {
 
-        auto value = TRY(throw_dom_exception_if_needed(global_object(), [&] { return item_value(index); }));
+        auto value = TRY(throw_dom_exception_if_needed(vm(), [&] { return item_value(index); }));
 
         // 5. Let desc be a newly created Property Descriptor with no fields.
         JS::PropertyDescriptor descriptor;

+ 0 - 2
Userland/Libraries/LibWeb/Bindings/NavigatorPrototype.h

@@ -6,11 +6,9 @@
 
 #pragma once
 
-#include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/Object.h>
 #include <LibJS/Runtime/VM.h>
 #include <LibWeb/Forward.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::Bindings {
 

+ 0 - 5
Userland/Libraries/LibWeb/DOM/AbortSignal.cpp

@@ -23,11 +23,6 @@ AbortSignal::AbortSignal(JS::Realm& realm)
     set_prototype(&Bindings::cached_web_prototype(realm, "AbortSignal"));
 }
 
-AbortSignal::AbortSignal(HTML::Window& window)
-    : AbortSignal(window.realm())
-{
-}
-
 // https://dom.spec.whatwg.org/#abortsignal-add
 void AbortSignal::add_abort_algorithm(Function<void()> abort_algorithm)
 {

+ 0 - 1
Userland/Libraries/LibWeb/DOM/AbortSignal.h

@@ -40,7 +40,6 @@ public:
 
 private:
     explicit AbortSignal(JS::Realm&);
-    explicit AbortSignal(HTML::Window&);
 
     virtual void visit_edges(JS::Cell::Visitor&) override;
 

+ 1 - 1
Userland/Libraries/LibWeb/DOM/CDATASection.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/DOM/CDATASection.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::DOM {
 

+ 1 - 2
Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp

@@ -10,7 +10,6 @@
 #include <LibWeb/DOM/DOMTokenList.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Element.h>
-#include <LibWeb/HTML/Window.h>
 #include <LibWeb/WebIDL/DOMException.h>
 
 namespace {
@@ -55,7 +54,7 @@ namespace Web::DOM {
 
 DOMTokenList* DOMTokenList::create(Element const& associated_element, FlyString associated_attribute)
 {
-    auto& realm = associated_element.document().window().realm();
+    auto& realm = associated_element.realm();
     return realm.heap().allocate<DOMTokenList>(realm, associated_element, move(associated_attribute));
 }
 

+ 0 - 5
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -288,11 +288,6 @@ JS::NonnullGCPtr<Document> Document::create(JS::Realm& realm, AK::URL const& url
     return *realm.heap().allocate<Document>(realm, realm, url);
 }
 
-JS::NonnullGCPtr<Document> Document::create(HTML::Window& window, AK::URL const& url)
-{
-    return create(window.realm(), url);
-}
-
 Document::Document(JS::Realm& realm, const AK::URL& url)
     : ParentNode(realm, *this, NodeType::DOCUMENT_NODE)
     , m_style_computer(make<CSS::StyleComputer>(*this))

+ 0 - 1
Userland/Libraries/LibWeb/DOM/Document.h

@@ -84,7 +84,6 @@ public:
     static JS::NonnullGCPtr<Document> create_and_initialize(Type, String content_type, HTML::NavigationParams);
 
     static JS::NonnullGCPtr<Document> create(JS::Realm&, AK::URL const& url = "about:blank"sv);
-    static JS::NonnullGCPtr<Document> create(HTML::Window&, AK::URL const& url = "about:blank"sv);
     static JS::NonnullGCPtr<Document> construct_impl(JS::Realm&);
     virtual ~Document() override;
 

+ 0 - 16
Userland/Libraries/LibWeb/DOM/Event.cpp

@@ -11,7 +11,6 @@
 #include <LibWeb/DOM/Event.h>
 #include <LibWeb/DOM/Node.h>
 #include <LibWeb/DOM/ShadowRoot.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::DOM {
 
@@ -20,11 +19,6 @@ JS::NonnullGCPtr<Event> Event::create(JS::Realm& realm, FlyString const& event_n
     return *realm.heap().allocate<Event>(realm, realm, event_name, event_init);
 }
 
-JS::NonnullGCPtr<Event> Event::create(HTML::Window& window, FlyString const& event_name, EventInit const& event_init)
-{
-    return create(window.realm(), event_name, event_init);
-}
-
 JS::NonnullGCPtr<Event> Event::construct_impl(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init)
 {
     return create(realm, event_name, event_init);
@@ -47,16 +41,6 @@ Event::Event(JS::Realm& realm, FlyString const& type, EventInit const& event_ini
 {
 }
 
-Event::Event(HTML::Window& window, FlyString const& type, EventInit const& event_init)
-    : Event(window.realm(), type, event_init)
-{
-}
-
-Event::Event(HTML::Window& window, FlyString const& type)
-    : Event(window.realm(), type)
-{
-}
-
 void Event::visit_edges(Visitor& visitor)
 {
     Base::visit_edges(visitor);

+ 0 - 3
Userland/Libraries/LibWeb/DOM/Event.h

@@ -46,13 +46,10 @@ public:
     using Path = Vector<PathEntry>;
 
     static JS::NonnullGCPtr<Event> create(JS::Realm&, FlyString const& event_name, EventInit const& event_init = {});
-    static JS::NonnullGCPtr<Event> create(HTML::Window&, FlyString const& event_name, EventInit const& event_init = {});
     static JS::NonnullGCPtr<Event> construct_impl(JS::Realm&, FlyString const& event_name, EventInit const& event_init);
 
     Event(JS::Realm&, FlyString const& type);
     Event(JS::Realm&, FlyString const& type, EventInit const& event_init);
-    Event(HTML::Window&, FlyString const& type);
-    Event(HTML::Window&, FlyString const& type, EventInit const& event_init);
 
     virtual ~Event() = default;
 

+ 0 - 1
Userland/Libraries/LibWeb/DOM/IDLEventListener.cpp

@@ -5,7 +5,6 @@
  */
 
 #include <LibWeb/DOM/IDLEventListener.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::DOM {
 

+ 0 - 1
Userland/Libraries/LibWeb/DOM/LiveNodeList.cpp

@@ -7,7 +7,6 @@
 
 #include <LibWeb/DOM/LiveNodeList.h>
 #include <LibWeb/DOM/Node.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::DOM {
 

+ 1 - 2
Userland/Libraries/LibWeb/DOM/NodeFilter.cpp

@@ -4,9 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibJS/Runtime/Realm.h>
+#include <LibJS/Runtime/VM.h>
 #include <LibWeb/DOM/NodeFilter.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::DOM {
 

+ 2 - 2
Userland/Libraries/LibWeb/DOM/NodeIterator.cpp

@@ -41,8 +41,8 @@ JS::NonnullGCPtr<NodeIterator> NodeIterator::create(Node& root, unsigned what_to
     // 1. Let iterator be a new NodeIterator object.
     // 2. Set iterator’s root and iterator’s reference to root.
     // 3. Set iterator’s pointer before reference to true.
-    auto& window_object = root.document().window();
-    auto* iterator = window_object.heap().allocate<NodeIterator>(window_object.realm(), root);
+    auto& realm = root.realm();
+    auto* iterator = realm.heap().allocate<NodeIterator>(realm, root);
 
     // 4. Set iterator’s whatToShow to whatToShow.
     iterator->m_what_to_show = what_to_show;

+ 0 - 1
Userland/Libraries/LibWeb/DOM/ParentNode.cpp

@@ -13,7 +13,6 @@
 #include <LibWeb/DOM/ParentNode.h>
 #include <LibWeb/DOM/StaticNodeList.h>
 #include <LibWeb/Dump.h>
-#include <LibWeb/HTML/Window.h>
 #include <LibWeb/Namespace.h>
 
 namespace Web::DOM {

+ 1 - 1
Userland/Libraries/LibWeb/DOM/Text.h

@@ -18,7 +18,7 @@ class Text : public CharacterData {
 public:
     virtual ~Text() override = default;
 
-    static JS::NonnullGCPtr<Text> construct_impl(JS::Realm& window, String const& data);
+    static JS::NonnullGCPtr<Text> construct_impl(JS::Realm& realm, String const& data);
 
     // ^Node
     virtual FlyString node_name() const override { return "#text"; }

+ 3 - 3
Userland/Libraries/LibWeb/DOM/TreeWalker.cpp

@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibWeb/DOM/Document.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/DOM/Node.h>
 #include <LibWeb/DOM/NodeFilter.h>
 #include <LibWeb/DOM/TreeWalker.h>
@@ -35,8 +35,8 @@ JS::NonnullGCPtr<TreeWalker> TreeWalker::create(Node& root, unsigned what_to_sho
 {
     // 1. Let walker be a new TreeWalker object.
     // 2. Set walker’s root and walker’s current to root.
-    auto& window_object = root.document().window();
-    auto* walker = window_object.heap().allocate<TreeWalker>(window_object.realm(), root);
+    auto& realm = root.realm();
+    auto* walker = realm.heap().allocate<TreeWalker>(realm, root);
 
     // 3. Set walker’s whatToShow to whatToShow.
     walker->m_what_to_show = what_to_show;

+ 1 - 1
Userland/Libraries/LibWeb/Fetch/Body.cpp

@@ -161,7 +161,7 @@ JS::NonnullGCPtr<JS::Promise> consume_body(JS::Realm& realm, BodyMixin const& ob
     // 4. Let steps be to return the result of package data with the first argument given, type, and object’s MIME type.
     auto steps = [&realm, &object, type](JS::Value value) -> WebIDL::ExceptionOr<JS::Value> {
         VERIFY(value.is_string());
-        auto bytes = TRY_OR_RETURN_OOM(realm.global_object(), ByteBuffer::copy(value.as_string().string().bytes()));
+        auto bytes = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(value.as_string().string().bytes()));
         return package_data(realm, move(bytes), type, object.mime_type_impl());
     };
 

+ 0 - 1
Userland/Libraries/LibWeb/Geometry/DOMPoint.cpp

@@ -6,7 +6,6 @@
 
 #include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/Geometry/DOMPoint.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::Geometry {
 

+ 0 - 6
Userland/Libraries/LibWeb/HTML/CloseEvent.cpp

@@ -6,7 +6,6 @@
 
 #include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/CloseEvent.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 
@@ -15,11 +14,6 @@ CloseEvent* CloseEvent::create(JS::Realm& realm, FlyString const& event_name, Cl
     return realm.heap().allocate<CloseEvent>(realm, realm, event_name, event_init);
 }
 
-CloseEvent* CloseEvent::create(HTML::Window& window, FlyString const& event_name, CloseEventInit const& event_init)
-{
-    return create(window.realm(), event_name, event_init);
-}
-
 CloseEvent* CloseEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, CloseEventInit const& event_init)
 {
     return create(realm, event_name, event_init);

+ 0 - 1
Userland/Libraries/LibWeb/HTML/CloseEvent.h

@@ -22,7 +22,6 @@ class CloseEvent : public DOM::Event {
 
 public:
     static CloseEvent* create(JS::Realm&, FlyString const& event_name, CloseEventInit const& event_init = {});
-    static CloseEvent* create(HTML::Window&, FlyString const& event_name, CloseEventInit const& event_init = {});
     static CloseEvent* construct_impl(JS::Realm&, FlyString const& event_name, CloseEventInit const& event_init);
 
     virtual ~CloseEvent() override;

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLDataElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLDataListElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLDetailsElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLDialogElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLDivElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLEmbedElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp

@@ -4,9 +4,9 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLFieldSetElement.h>
 #include <LibWeb/HTML/HTMLLegendElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp

@@ -4,10 +4,10 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/CSS/StyleProperties.h>
 #include <LibWeb/CSS/StyleValue.h>
 #include <LibWeb/HTML/HTMLFontElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLFrameElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLHRElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLHeadElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLHeadingElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLHtmlElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 2
Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp

@@ -4,9 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibWeb/Bindings/HTMLLegendElementPrototype.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLLegendElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLMapElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLMarqueeElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp

@@ -5,8 +5,8 @@
  */
 
 #include <LibWeb/Bindings/HTMLMediaElementPrototype.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLMediaElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLMenuElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLMetaElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLMeterElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLModElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLOListElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLOptGroupElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp

@@ -6,13 +6,13 @@
  */
 
 #include <AK/StringBuilder.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/DOM/Node.h>
 #include <LibWeb/DOM/Text.h>
 #include <LibWeb/HTML/HTMLOptGroupElement.h>
 #include <LibWeb/HTML/HTMLOptionElement.h>
 #include <LibWeb/HTML/HTMLScriptElement.h>
 #include <LibWeb/HTML/HTMLSelectElement.h>
-#include <LibWeb/HTML/Window.h>
 #include <ctype.h>
 
 namespace Web::HTML {

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLOutputElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLParagraphElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLParamElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLPictureElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLPreElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLQuoteElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp

@@ -7,6 +7,7 @@
 #include <AK/Debug.h>
 #include <AK/StringBuilder.h>
 #include <LibTextCodec/Decoder.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Event.h>
 #include <LibWeb/DOM/ShadowRoot.h>
@@ -14,7 +15,6 @@
 #include <LibWeb/HTML/EventNames.h>
 #include <LibWeb/HTML/HTMLScriptElement.h>
 #include <LibWeb/HTML/Scripting/ClassicScript.h>
-#include <LibWeb/HTML/Window.h>
 #include <LibWeb/Loader/ResourceLoader.h>
 
 namespace Web::HTML {

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp

@@ -5,11 +5,11 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLFormElement.h>
 #include <LibWeb/HTML/HTMLOptGroupElement.h>
 #include <LibWeb/HTML/HTMLOptionElement.h>
 #include <LibWeb/HTML/HTMLSelectElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLSlotElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLSourceElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLSpanElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLTableCaptionElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp

@@ -4,10 +4,10 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/CSS/Parser/Parser.h>
 #include <LibWeb/HTML/HTMLTableCellElement.h>
 #include <LibWeb/HTML/Parser/HTMLParser.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLTableColElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp

@@ -5,6 +5,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/CSS/Parser/Parser.h>
 #include <LibWeb/DOM/ElementFactory.h>
 #include <LibWeb/DOM/HTMLCollection.h>
@@ -12,7 +13,6 @@
 #include <LibWeb/HTML/HTMLTableElement.h>
 #include <LibWeb/HTML/HTMLTableRowElement.h>
 #include <LibWeb/HTML/Parser/HTMLParser.h>
-#include <LibWeb/HTML/Window.h>
 #include <LibWeb/Namespace.h>
 
 namespace Web::HTML {

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp

@@ -4,12 +4,12 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/DOM/HTMLCollection.h>
 #include <LibWeb/HTML/HTMLTableCellElement.h>
 #include <LibWeb/HTML/HTMLTableElement.h>
 #include <LibWeb/HTML/HTMLTableRowElement.h>
 #include <LibWeb/HTML/HTMLTableSectionElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp

@@ -5,11 +5,11 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/DOM/ElementFactory.h>
 #include <LibWeb/DOM/HTMLCollection.h>
 #include <LibWeb/HTML/HTMLTableRowElement.h>
 #include <LibWeb/HTML/HTMLTableSectionElement.h>
-#include <LibWeb/HTML/Window.h>
 #include <LibWeb/Namespace.h>
 
 namespace Web::HTML {

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLTextAreaElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLTimeElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLTrackElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLUListElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLUnknownElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp

@@ -4,8 +4,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/HTMLVideoElement.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 

+ 0 - 6
Userland/Libraries/LibWeb/HTML/MessageEvent.cpp

@@ -6,7 +6,6 @@
 
 #include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/HTML/MessageEvent.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::HTML {
 
@@ -15,11 +14,6 @@ MessageEvent* MessageEvent::create(JS::Realm& realm, FlyString const& event_name
     return realm.heap().allocate<MessageEvent>(realm, realm, event_name, event_init);
 }
 
-MessageEvent* MessageEvent::create(HTML::Window& window, FlyString const& event_name, MessageEventInit const& event_init)
-{
-    return create(window.realm(), event_name, event_init);
-}
-
 MessageEvent* MessageEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, MessageEventInit const& event_init)
 {
     return create(realm, event_name, event_init);

+ 0 - 1
Userland/Libraries/LibWeb/HTML/MessageEvent.h

@@ -22,7 +22,6 @@ class MessageEvent : public DOM::Event {
 
 public:
     static MessageEvent* create(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init = {});
-    static MessageEvent* create(HTML::Window&, FlyString const& event_name, MessageEventInit const& event_init = {});
     static MessageEvent* construct_impl(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init);
 
     MessageEvent(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init);

+ 1 - 2
Userland/Libraries/LibWeb/Infra/JSON.cpp

@@ -53,13 +53,12 @@ WebIDL::ExceptionOr<String> serialize_javascript_value_to_json_string(JS::VM& vm
 WebIDL::ExceptionOr<ByteBuffer> serialize_javascript_value_to_json_bytes(JS::VM& vm, JS::Value value)
 {
     auto& realm = *vm.current_realm();
-    auto& global_object = realm.global_object();
 
     // 1. Let string be the result of serializing a JavaScript value to a JSON string given value.
     auto string = TRY(serialize_javascript_value_to_json_string(vm, value));
 
     // 2. Return the result of running UTF-8 encode on string. [ENCODING]
-    return TRY_OR_RETURN_OOM(global_object, ByteBuffer::copy(string.bytes()));
+    return TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(string.bytes()));
 }
 
 }

+ 0 - 1
Userland/Libraries/LibWeb/Page/EventHandler.cpp

@@ -12,7 +12,6 @@
 #include <LibWeb/HTML/HTMLAnchorElement.h>
 #include <LibWeb/HTML/HTMLIFrameElement.h>
 #include <LibWeb/HTML/HTMLImageElement.h>
-#include <LibWeb/HTML/Window.h>
 #include <LibWeb/Layout/InitialContainingBlock.h>
 #include <LibWeb/Page/EventHandler.h>
 #include <LibWeb/Page/Page.h>

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp

@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibWeb/HTML/Window.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/SVG/SVGClipPathElement.h>
 
 namespace Web::SVG {

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp

@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibWeb/HTML/Window.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/SVG/SVGDefsElement.h>
 
 namespace Web::SVG {

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGElement.cpp

@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibWeb/HTML/Window.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/SVG/SVGElement.h>
 
 namespace Web::SVG {

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp

@@ -5,8 +5,8 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/CSS/Parser/Parser.h>
-#include <LibWeb/HTML/Window.h>
 #include <LibWeb/Layout/Node.h>
 #include <LibWeb/SVG/SVGGraphicsElement.h>
 #include <LibWeb/SVG/SVGSVGElement.h>

+ 1 - 1
Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp

@@ -4,7 +4,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  */
 
-#include <LibWeb/HTML/Window.h>
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/SVG/AttributeNames.h>
 #include <LibWeb/SVG/AttributeParser.h>
 #include <LibWeb/SVG/SVGLineElement.h>

+ 0 - 5
Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.cpp

@@ -91,11 +91,6 @@ KeyboardEvent* KeyboardEvent::create_from_platform_event(JS::Realm& realm, FlySt
     return KeyboardEvent::create(realm, event_name, event_init);
 }
 
-KeyboardEvent* KeyboardEvent::create_from_platform_event(HTML::Window& window, FlyString const& event_name, KeyCode platform_key, unsigned modifiers, u32 code_point)
-{
-    return create_from_platform_event(window.realm(), event_name, platform_key, modifiers, code_point);
-}
-
 bool KeyboardEvent::get_modifier_state(String const& key_arg)
 {
     if (key_arg == "Alt")

+ 0 - 1
Userland/Libraries/LibWeb/UIEvents/KeyboardEvent.h

@@ -31,7 +31,6 @@ public:
     static KeyboardEvent* create(JS::Realm&, FlyString const& event_name, KeyboardEventInit const& event_init = {});
     static KeyboardEvent* construct_impl(JS::Realm&, FlyString const& event_name, KeyboardEventInit const& event_init);
     static KeyboardEvent* create_from_platform_event(JS::Realm&, FlyString const& event_name, KeyCode, unsigned modifiers, u32 code_point);
-    static KeyboardEvent* create_from_platform_event(HTML::Window&, FlyString const& event_name, KeyCode, unsigned modifiers, u32 code_point);
 
     virtual ~KeyboardEvent() override;
 

+ 0 - 5
Userland/Libraries/LibWeb/UIEvents/MouseEvent.cpp

@@ -62,11 +62,6 @@ MouseEvent* MouseEvent::create_from_platform_event(JS::Realm& realm, FlyString c
     return MouseEvent::create(realm, event_name, event_init);
 }
 
-MouseEvent* MouseEvent::create_from_platform_event(HTML::Window& window, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button)
-{
-    return create_from_platform_event(window.realm(), event_name, offset_x, offset_y, client_x, client_y, mouse_button);
-}
-
 void MouseEvent::set_event_characteristics()
 {
     if (type().is_one_of(EventNames::mousedown, EventNames::mousemove, EventNames::mouseout, EventNames::mouseover, EventNames::mouseup, HTML::EventNames::click)) {

+ 0 - 1
Userland/Libraries/LibWeb/UIEvents/MouseEvent.h

@@ -27,7 +27,6 @@ class MouseEvent final : public UIEvent {
 public:
     static MouseEvent* create(JS::Realm&, FlyString const& event_name, MouseEventInit const& event_init = {});
     static MouseEvent* create_from_platform_event(JS::Realm&, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button = 1);
-    static MouseEvent* create_from_platform_event(HTML::Window&, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button = 1);
 
     virtual ~MouseEvent() override;
 

+ 0 - 2
Userland/Libraries/LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h

@@ -7,11 +7,9 @@
 #pragma once
 
 #include "WebAssemblyMemoryConstructor.h"
-#include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/Object.h>
 #include <LibJS/Runtime/VM.h>
 #include <LibWeb/Forward.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::Bindings {
 

+ 1 - 0
Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModuleObject.cpp

@@ -5,6 +5,7 @@
  */
 
 #include "WebAssemblyModulePrototype.h"
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/WebAssembly/WebAssemblyModuleObject.h>
 
 namespace Web::Bindings {

+ 0 - 2
Userland/Libraries/LibWeb/WebAssembly/WebAssemblyModulePrototype.h

@@ -7,11 +7,9 @@
 #pragma once
 
 #include "WebAssemblyModuleConstructor.h"
-#include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/Object.h>
 #include <LibJS/Runtime/VM.h>
 #include <LibWeb/Forward.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::Bindings {
 

+ 1 - 0
Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTableObject.cpp

@@ -5,6 +5,7 @@
  */
 
 #include "WebAssemblyTablePrototype.h"
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/WebAssembly/WebAssemblyTableObject.h>
 
 namespace Web::Bindings {

+ 0 - 2
Userland/Libraries/LibWeb/WebAssembly/WebAssemblyTablePrototype.h

@@ -7,11 +7,9 @@
 #pragma once
 
 #include "WebAssemblyTableConstructor.h"
-#include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/Object.h>
 #include <LibJS/Runtime/VM.h>
 #include <LibWeb/Forward.h>
-#include <LibWeb/HTML/Window.h>
 
 namespace Web::Bindings {
 

+ 7 - 11
Userland/Libraries/LibWeb/WebIDL/DOMException.h

@@ -123,17 +123,13 @@ private:
     FlyString m_message;
 };
 
-#define __ENUMERATE(ErrorName)                                                                                  \
-    class ErrorName final {                                                                                     \
-    public:                                                                                                     \
-        static JS::NonnullGCPtr<DOMException> create(JS::Realm& realm, FlyString const& message)                \
-        {                                                                                                       \
-            return DOMException::create(realm, #ErrorName, message);                                            \
-        }                                                                                                       \
-        static JS::NonnullGCPtr<DOMException> create(JS::Object const& global_object, FlyString const& message) \
-        {                                                                                                       \
-            return create(HTML::relevant_realm(global_object), message);                                        \
-        }                                                                                                       \
+#define __ENUMERATE(ErrorName)                                                                   \
+    class ErrorName final {                                                                      \
+    public:                                                                                      \
+        static JS::NonnullGCPtr<DOMException> create(JS::Realm& realm, FlyString const& message) \
+        {                                                                                        \
+            return DOMException::create(realm, #ErrorName, message);                             \
+        }                                                                                        \
     };
 ENUMERATE_DOM_EXCEPTION_ERROR_NAMES
 #undef __ENUMERATE