diff --git a/Userland/Libraries/LibWeb/HTML/ImageRequest.cpp b/Userland/Libraries/LibWeb/HTML/ImageRequest.cpp
index 36614186c6..7a62cb6be5 100644
--- a/Userland/Libraries/LibWeb/HTML/ImageRequest.cpp
+++ b/Userland/Libraries/LibWeb/HTML/ImageRequest.cpp
@@ -14,6 +14,7 @@
#include
#include
#include
+#include
#include
#include
@@ -21,12 +22,12 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(ImageRequest);
-JS::NonnullGCPtr ImageRequest::create(JS::Realm& realm, Page& page)
+JS::NonnullGCPtr ImageRequest::create(JS::Realm& realm, JS::NonnullGCPtr page)
{
return realm.heap().allocate(realm, page);
}
-ImageRequest::ImageRequest(Page& page)
+ImageRequest::ImageRequest(JS::NonnullGCPtr page)
: m_page(page)
{
}
@@ -39,6 +40,7 @@ void ImageRequest::visit_edges(JS::Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_shared_image_request);
+ visitor.visit(m_page);
}
// https://html.spec.whatwg.org/multipage/images.html#img-available
diff --git a/Userland/Libraries/LibWeb/HTML/ImageRequest.h b/Userland/Libraries/LibWeb/HTML/ImageRequest.h
index 1406a0ce67..7cb3705e5a 100644
--- a/Userland/Libraries/LibWeb/HTML/ImageRequest.h
+++ b/Userland/Libraries/LibWeb/HTML/ImageRequest.h
@@ -22,7 +22,7 @@ class ImageRequest final : public JS::Cell {
JS_DECLARE_ALLOCATOR(ImageRequest);
public:
- [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, Page&);
+ [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, JS::NonnullGCPtr);
~ImageRequest();
@@ -63,9 +63,9 @@ public:
virtual void visit_edges(JS::Cell::Visitor&) override;
private:
- explicit ImageRequest(Page&);
+ explicit ImageRequest(JS::NonnullGCPtr);
- Page& m_page;
+ JS::NonnullGCPtr m_page;
// https://html.spec.whatwg.org/multipage/images.html#img-req-state
// An image request's state is initially unavailable.