mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
LibWeb: Make LocationObject a PlatformObject
This commit is contained in:
parent
2fe97fa8db
commit
0e47754ac8
2 changed files with 21 additions and 9 deletions
|
@ -23,9 +23,18 @@ namespace Web::Bindings {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/history.html#the-location-interface
|
// https://html.spec.whatwg.org/multipage/history.html#the-location-interface
|
||||||
LocationObject::LocationObject(JS::Realm& realm)
|
LocationObject::LocationObject(JS::Realm& realm)
|
||||||
: Object(verify_cast<HTML::Window>(realm.global_object()).cached_web_prototype("Location"))
|
: PlatformObject(realm)
|
||||||
, m_default_properties(heap())
|
|
||||||
{
|
{
|
||||||
|
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)
|
void LocationObject::initialize(JS::Realm& realm)
|
||||||
|
|
|
@ -10,20 +10,18 @@
|
||||||
#include <AK/URL.h>
|
#include <AK/URL.h>
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibJS/Runtime/Completion.h>
|
#include <LibJS/Runtime/Completion.h>
|
||||||
#include <LibJS/Runtime/Object.h>
|
|
||||||
#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
|
#include <LibWeb/Bindings/CrossOriginAbstractOperations.h>
|
||||||
|
#include <LibWeb/Bindings/PlatformObject.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
|
|
||||||
namespace Web {
|
namespace Web {
|
||||||
namespace Bindings {
|
namespace Bindings {
|
||||||
|
|
||||||
class LocationObject final : public JS::Object {
|
class LocationObject final : public Bindings::PlatformObject {
|
||||||
JS_OBJECT(LocationObject, JS::Object);
|
JS_OBJECT(LocationObject, Bindings::PlatformObject);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LocationObject(JS::Realm&);
|
virtual ~LocationObject() override;
|
||||||
virtual void initialize(JS::Realm&) override;
|
|
||||||
virtual ~LocationObject() override = default;
|
|
||||||
|
|
||||||
virtual JS::ThrowCompletionOr<JS::Object*> internal_get_prototype_of() const override;
|
virtual JS::ThrowCompletionOr<JS::Object*> internal_get_prototype_of() const override;
|
||||||
virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) 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; }
|
CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
explicit LocationObject(JS::Realm&);
|
||||||
|
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
DOM::Document const* relevant_document() const;
|
DOM::Document const* relevant_document() const;
|
||||||
AK::URL url() const;
|
AK::URL url() const;
|
||||||
|
|
||||||
|
@ -61,7 +64,7 @@ private:
|
||||||
CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
|
CrossOriginPropertyDescriptorMap m_cross_origin_property_descriptor_map;
|
||||||
|
|
||||||
// [[DefaultProperties]], https://html.spec.whatwg.org/multipage/history.html#defaultproperties
|
// [[DefaultProperties]], https://html.spec.whatwg.org/multipage/history.html#defaultproperties
|
||||||
JS::MarkedVector<JS::Value> m_default_properties;
|
Vector<JS::Value> m_default_properties;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue