1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 20:17:41 +00:00

LibWeb: Add window.status property

This commit is contained in:
Reimar 2023-12-04 19:52:04 +01:00 committed by Andrew Kaster
parent 3a820ddbdf
commit 4299fb604b
3 changed files with 21 additions and 0 deletions

View file

@ -863,6 +863,20 @@ void Window::set_name(String const& name)
navigable()->active_session_history_entry()->document_state->set_navigable_target_name(name); navigable()->active_session_history_entry()->document_state->set_navigable_target_name(name);
} }
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-status
String Window::status() const
{
// the status attribute on the Window object must, on getting, return the last string it was set to
return m_status;
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-status
void Window::set_status(String const& status)
{
// on setting, must set itself to the new value.
m_status = status;
}
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location
JS::NonnullGCPtr<Location> Window::location() JS::NonnullGCPtr<Location> Window::location()
{ {

View file

@ -134,6 +134,8 @@ public:
JS::NonnullGCPtr<DOM::Document const> document() const; JS::NonnullGCPtr<DOM::Document const> document() const;
String name() const; String name() const;
void set_name(String const&); void set_name(String const&);
String status() const;
void set_status(String const&);
[[nodiscard]] JS::NonnullGCPtr<Location> location(); [[nodiscard]] JS::NonnullGCPtr<Location> location();
JS::NonnullGCPtr<History> history() const; JS::NonnullGCPtr<History> history() const;
JS::NonnullGCPtr<Navigation> navigation(); JS::NonnullGCPtr<Navigation> navigation();
@ -275,6 +277,10 @@ private:
// https://streams.spec.whatwg.org/#byte-length-queuing-strategy-size-function // https://streams.spec.whatwg.org/#byte-length-queuing-strategy-size-function
JS::GCPtr<WebIDL::CallbackType> m_byte_length_queuing_strategy_size_function; JS::GCPtr<WebIDL::CallbackType> m_byte_length_queuing_strategy_size_function;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-window-status
// When the Window object is created, the attribute must be set to the empty string. It does not do anything else.
String m_status;
}; };
void run_animation_frame_callbacks(DOM::Document&, double now); void run_animation_frame_callbacks(DOM::Document&, double now);

View file

@ -24,6 +24,7 @@ interface Window : EventTarget {
[Replaceable] readonly attribute WindowProxy self; [Replaceable] readonly attribute WindowProxy self;
[LegacyUnforgeable] readonly attribute Document document; [LegacyUnforgeable] readonly attribute Document document;
attribute DOMString name; attribute DOMString name;
attribute DOMString status;
[PutForwards=href, LegacyUnforgeable] readonly attribute Location location; [PutForwards=href, LegacyUnforgeable] readonly attribute Location location;
readonly attribute History history; readonly attribute History history;
readonly attribute Navigation navigation; readonly attribute Navigation navigation;