1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:28:13 +00:00

LibWeb/HTML: Make Window::m{location,navigator} lazily allocated

This now matches the other window-owned objects, which already do this:
m_crypto, m_performance, m_screen.
This commit is contained in:
Linus Groh 2023-03-11 17:40:54 +00:00
parent 22552382ff
commit 4da68384e6
4 changed files with 22 additions and 14 deletions

View file

@ -1673,7 +1673,7 @@ bool Document::is_active() const
}
// https://html.spec.whatwg.org/multipage/history.html#dom-document-location
HTML::Location* Document::location()
WebIDL::ExceptionOr<JS::GCPtr<HTML::Location>> Document::location()
{
// The Document object's location attribute's getter must return this Document object's relevant global object's Location object,
// if this Document object is fully active, and null otherwise.
@ -1681,7 +1681,7 @@ HTML::Location* Document::location()
if (!is_fully_active())
return nullptr;
return window().location();
return TRY(window().location());
}
// https://html.spec.whatwg.org/multipage/interaction.html#dom-document-hidden

View file

@ -343,7 +343,7 @@ public:
JS::NonnullGCPtr<HTML::History> history();
JS::NonnullGCPtr<HTML::History> history() const;
HTML::Location* location();
WebIDL::ExceptionOr<JS::GCPtr<HTML::Location>> location();
size_t number_of_things_delaying_the_load_event() { return m_number_of_things_delaying_the_load_event; }
void increment_number_of_things_delaying_the_load_event(Badge<DocumentLoadEventDelayer>);