Skip to content

Commit

Permalink
LibWeb: Add window.status property
Browse files Browse the repository at this point in the history
  • Loading branch information
ReimarPB authored and ADKaster committed Dec 7, 2023
1 parent 3a820dd commit 4299fb6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Userland/Libraries/LibWeb/HTML/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,20 @@ void Window::set_name(String const& 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
JS::NonnullGCPtr<Location> Window::location()
{
Expand Down
6 changes: 6 additions & 0 deletions Userland/Libraries/LibWeb/HTML/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ class Window final
JS::NonnullGCPtr<DOM::Document const> document() const;
String name() const;
void set_name(String const&);
String status() const;
void set_status(String const&);
[[nodiscard]] JS::NonnullGCPtr<Location> location();
JS::NonnullGCPtr<History> history() const;
JS::NonnullGCPtr<Navigation> navigation();
Expand Down Expand Up @@ -275,6 +277,10 @@ class Window final

// https://streams.spec.whatwg.org/#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);
Expand Down
1 change: 1 addition & 0 deletions Userland/Libraries/LibWeb/HTML/Window.idl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface Window : EventTarget {
[Replaceable] readonly attribute WindowProxy self;
[LegacyUnforgeable] readonly attribute Document document;
attribute DOMString name;
attribute DOMString status;
[PutForwards=href, LegacyUnforgeable] readonly attribute Location location;
readonly attribute History history;
readonly attribute Navigation navigation;
Expand Down

0 comments on commit 4299fb6

Please sign in to comment.