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

LibWeb+WebContent: Create WebContentConsoleClient for every document

Fixes regression introduced in b4fe118dff

The `WebContentConsoleClient` needs to be created not just once, but
for every new document. Although the JS Console window allows
communication only with the active document associated with the
top-level browsing context, we still need a console client for each
iframe's document to ensure their console logs are printed.

In the future, we might consider adding the ability to switch which
document the JS Console window communicates with.

Fixes https://github.com/SerenityOS/serenity/issues/21117
This commit is contained in:
Aliaksandr Kalenik 2023-09-17 16:11:16 +02:00 committed by Andreas Kling
parent 9a61041941
commit a76ef04ae6
7 changed files with 34 additions and 15 deletions

View file

@ -2652,6 +2652,8 @@ Vector<JS::Handle<HTML::BrowsingContext>> Document::list_of_descendant_browsing_
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#destroy-a-document
void Document::destroy()
{
page()->client().page_did_destroy_document(*this);
// NOTE: Abort needs to happen before destory. There is currently bug in the spec: https://github.com/whatwg/html/issues/9148
// 4. Abort document.
abort();

View file

@ -203,6 +203,7 @@ public:
virtual Gfx::IntRect page_did_request_fullscreen_window() { return {}; }
virtual void page_did_start_loading(const AK::URL&, bool is_redirect) { (void)is_redirect; }
virtual void page_did_create_new_document(Web::DOM::Document&) { }
virtual void page_did_destroy_document(Web::DOM::Document&) { }
virtual void page_did_finish_loading(const AK::URL&) { }
virtual void page_did_change_selection() { }
virtual void page_did_request_cursor_change(Gfx::StandardCursor) { }