1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:14:58 +00:00

LibWeb+WebContent: Plumb ability for WebContent process to hold N pages

In order for same-origin NavigableContainers (iframe, frame, embed, ...)
and window.open() WindowProxies to have the proper JS access to their
embedder/opener, we need to host multiple top level traversables in the
same WebContent process. As a first step, make WebContent::PageHost hold
a HashMap of PageClient objects, each holding their own Web::Page that
represents a TraversableNavigable's API surface with the UI process.
This commit is contained in:
Andrew Kaster 2023-11-29 09:34:38 -07:00 committed by Andreas Kling
parent 34ae39478a
commit fbfb70f81a
13 changed files with 769 additions and 660 deletions

View file

@ -26,7 +26,6 @@ namespace Web {
Page::Page(PageClient& client)
: m_client(client)
{
m_top_level_traversable = JS::make_handle(HTML::TraversableNavigable::create_a_fresh_top_level_traversable(*this, AK::URL("about:blank")).release_value_but_fixme_should_propagate_errors());
}
Page::~Page() = default;
@ -161,6 +160,13 @@ bool Page::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point)
return focused_context().event_handler().handle_keyup(key, modifiers, code_point);
}
void Page::set_top_level_traversable(JS::NonnullGCPtr<HTML::TraversableNavigable> navigable)
{
VERIFY(!m_top_level_traversable); // Replacement is not allowed!
VERIFY(navigable->page() == this);
m_top_level_traversable = navigable;
}
bool Page::top_level_traversable_is_initialized() const
{
return m_top_level_traversable;