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

LibWeb: Create a new WebView for window.open()'d top level traversables

This commit is contained in:
Andrew Kaster 2024-01-30 20:55:24 -07:00 committed by Tim Flynn
parent 677bdc2a4f
commit adb5c27331
5 changed files with 42 additions and 9 deletions

View file

@ -497,14 +497,25 @@ void PageClient::page_did_update_resource_count(i32 count_waiting)
client().async_did_update_resource_count(count_waiting);
}
String PageClient::page_did_request_new_web_view(Web::HTML::ActivateTab activate_tab, Web::HTML::WebViewHints hints, Optional<u64> page_index)
PageClient::NewWebViewResult PageClient::page_did_request_new_web_view(Web::HTML::ActivateTab activate_tab, Web::HTML::WebViewHints hints, Web::HTML::TokenizedFeature::NoOpener no_opener)
{
auto response = client().send_sync_but_allow_failure<Messages::WebContentClient::DidRequestNewWebView>(activate_tab, hints, page_index);
auto& new_client = m_owner.create_page();
Optional<u64> page_id;
if (no_opener == Web::HTML::TokenizedFeature::NoOpener::Yes) {
// FIXME: Create an abstraction to let this WebContent process know about a new process we create?
// FIXME: For now, just create a new page in the same process anyway
}
page_id = new_client.m_id;
auto response = client().send_sync_but_allow_failure<Messages::WebContentClient::DidRequestNewWebView>(activate_tab, hints, page_id);
if (!response) {
dbgln("WebContent client disconnected during DidRequestNewWebView. Exiting peacefully.");
exit(0);
}
return response->take_handle();
return { &new_client.page(), response->take_handle() };
}
void PageClient::page_did_request_activate_tab()