1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +00:00

LibWeb: Make BrowsingContex::page() return a Page&

This exposed a whole slew of now-unnecessary null checks. :^)

Co-Authored-By: Andreas Kling <kling@serenityos.org>
This commit is contained in:
Shannon Booth 2023-12-03 20:29:37 +13:00 committed by Andreas Kling
parent af2bcc3b56
commit 88f8ea7c60
9 changed files with 56 additions and 88 deletions

View file

@ -130,8 +130,7 @@ static JS::NonnullGCPtr<HTML::BrowsingContext> obtain_a_browsing_context_to_use_
}
// 3. Let newBrowsingContext be the first return value of creating a new top-level browsing context and document
VERIFY(browsing_context.page());
auto new_browsing_context = HTML::create_a_new_top_level_browsing_context_and_document(*browsing_context.page()).release_value_but_fixme_should_propagate_errors().browsing_context;
auto new_browsing_context = HTML::create_a_new_top_level_browsing_context_and_document(browsing_context.page()).release_value_but_fixme_should_propagate_errors().browsing_context;
// FIXME: 4. If navigationCOOP's value is "same-origin-plurs-COEP", then set newBrowsingContext's group's
// cross-origin isolation mode to either "logical" or "concrete". The choice of which is implementation-defined.
@ -1910,12 +1909,12 @@ void Document::update_readiness(HTML::DocumentReadyState readiness_value)
Page* Document::page()
{
return m_browsing_context ? m_browsing_context->page() : nullptr;
return m_browsing_context ? &m_browsing_context->page() : nullptr;
}
Page const* Document::page() const
{
return m_browsing_context ? m_browsing_context->page() : nullptr;
return m_browsing_context ? &m_browsing_context->page() : nullptr;
}
EventTarget* Document::get_parent(Event const& event)