mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibWeb+WebContent: Store console clients on the DOM document
We explicitly stopped visting the map of documents to console clients in
commit 44659f2f2a
to avoid keeping the
document alive. However, if nothing else visits the console clients, we
may set the top-level console client to a client that has been garbage
collected.
So instead of storing this map, just store the console client on the
document itself. This will allow the document to visit its client.
This commit is contained in:
parent
a1c57ed79a
commit
0a819e628e
Notes:
github-actions[bot]
2024-08-01 09:36:46 +00:00
Author: https://github.com/trflynn89
Commit: 0a819e628e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/916
5 changed files with 12 additions and 26 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <AK/WeakPtr.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/Forward.h>
|
||||
#include <LibJS/Console.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWeb/CSS/CSSStyleSheet.h>
|
||||
|
@ -684,10 +685,12 @@ public:
|
|||
void parse_html_from_a_string(StringView);
|
||||
static JS::NonnullGCPtr<Document> parse_html_unsafe(JS::VM&, StringView);
|
||||
|
||||
void set_console_client(JS::GCPtr<JS::ConsoleClient> console_client) { m_console_client = console_client; }
|
||||
JS::GCPtr<JS::ConsoleClient> console_client() const { return m_console_client; }
|
||||
|
||||
protected:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void finalize() override;
|
||||
|
||||
Document(JS::Realm&, URL::URL const&, TemporaryDocumentForFragmentParsing = TemporaryDocumentForFragmentParsing::No);
|
||||
|
||||
|
@ -945,6 +948,8 @@ private:
|
|||
|
||||
// https://dom.spec.whatwg.org/#document-allow-declarative-shadow-roots
|
||||
bool m_allow_declarative_shadow_roots { false };
|
||||
|
||||
JS::GCPtr<JS::ConsoleClient> m_console_client;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue