summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/Bindings/LocationObject.cpp13
-rw-r--r--Userland/Libraries/LibWeb/Bindings/LocationObject.h17
2 files changed, 21 insertions, 9 deletions
diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
index a1091c9102..37d388e2cf 100644
--- a/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.cpp
@@ -23,9 +23,18 @@ namespace Web::Bindings {
// https://html.spec.whatwg.org/multipage/history.html#the-location-interface
LocationObject::LocationObject(JS::Realm& realm)
- : Object(verify_cast<HTML::Window>(realm.global_object()).cached_web_prototype("Location"))
- , m_default_properties(heap())
+ : PlatformObject(realm)
{
+ set_prototype(&verify_cast<HTML::Window>(realm.global_object()).cached_web_prototype("Location"));
+}
+
+LocationObject::~LocationObject() = default;
+
+void LocationObject::visit_edges(Cell::Visitor& visitor)
+{
+ Base::visit_edges(visitor);
+ for (auto& property : m_default_properties)
+ visitor.visit(property);
}
void LocationObject::initialize(JS::Realm& realm)
diff --git a/Userland/Libraries/LibWeb/Bindings/LocationObject.h b/Userland/Libraries/LibWeb/Bindings/LocationObject.h
index f48ee23114..6bb3716f25 100644
--- a/Userland/Libraries/LibWeb/Bindings/LocationObject.h
+++ b/Userland/Libraries/LibWeb/Bindings/LocationObject.h
@@ -10,20 +10,18 @@
#include <AK/URL.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Completion.h>
-#include <LibJS/Runtime/Object.h>
#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
+#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Forward.h>
namespace Web {
namespace Bindings {
-class LocationObject final : public JS::Object {
- JS_OBJECT(LocationObject, JS::Object);
+class LocationObject final : public Bindings::PlatformObject {
+ JS_OBJECT(LocationObject, Bindings::PlatformObject);
public:
- explicit LocationObject(JS::Realm&);
- virtual void initialize(JS::Realm&) override;
- virtual ~LocationObject() override = default;
+ virtual ~LocationObject() override;
virtual JS::ThrowCompletionOr<JS::Object*> internal_get_prototype_of() const override;
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override;
@@ -40,6 +38,11 @@ public:
CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }
private:
+ explicit LocationObject(JS::Realm&);
+
+ virtual void initialize(JS::Realm&) override;
+ virtual void visit_edges(Cell::Visitor&) override;
+
DOM::Document const* relevant_document() const;
AK::URL url() const;
@@ -61,7 +64,7 @@ private:
CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
// [[DefaultProperties]], https://html.spec.whatwg.org/multipage/history.html#defaultproperties
- JS::MarkedVector<JS::Value> m_default_properties;
+ Vector<JS::Value> m_default_properties;
};
}