mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 02:59:45 +00:00
WebContent: Limit the Console client to the top-level navigable client
We don't want to set the intrinsic Console object's client to non-top- level clients, created for e.g. subframes. We also want to make sure the Console client is updated if the top-level document has changed.
This commit is contained in:
parent
0a819e628e
commit
0e640f6f70
Notes:
github-actions[bot]
2024-08-01 09:36:40 +00:00
Author: https://github.com/trflynn89
Commit: 0e640f6f70
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/916
1 changed files with 6 additions and 1 deletions
|
@ -341,9 +341,14 @@ void PageClient::page_did_create_new_document(Web::DOM::Document& document)
|
|||
|
||||
void PageClient::page_did_change_active_document_in_top_level_browsing_context(Web::DOM::Document& document)
|
||||
{
|
||||
auto& realm = document.realm();
|
||||
|
||||
if (auto console_client = document.console_client()) {
|
||||
auto& web_content_console_client = verify_cast<WebContentConsoleClient>(*console_client);
|
||||
m_top_level_document_console_client = web_content_console_client;
|
||||
|
||||
auto console_object = realm.intrinsics().console_object();
|
||||
console_object->console().set_client(*console_client);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -663,9 +668,9 @@ void PageClient::initialize_js_console(Web::DOM::Document& document)
|
|||
return;
|
||||
|
||||
auto& realm = document.realm();
|
||||
|
||||
auto console_object = realm.intrinsics().console_object();
|
||||
auto console_client = heap().allocate_without_realm<WebContentConsoleClient>(console_object->console(), document.realm(), *this);
|
||||
console_object->console().set_client(*console_client);
|
||||
|
||||
document.set_console_client(console_client);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue