mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
LibWeb: Make DOM::Window store its associated document in a WeakPtr
Let's err on the side of caution and use a WeakPtr instead of a DOM::Document&. Even if the object lifetimes involved here should be well-defined, they are fairly complicated.
This commit is contained in:
parent
90cdeebfb3
commit
f1ce43bdbf
|
@ -36,8 +36,8 @@ public:
|
|||
Page* page();
|
||||
Page const* page() const;
|
||||
|
||||
Document const& associated_document() const { return m_associated_document; }
|
||||
Document& associated_document() { return m_associated_document; }
|
||||
Document const& associated_document() const { return *m_associated_document; }
|
||||
Document& associated_document() { return *m_associated_document; }
|
||||
|
||||
void alert(String const&);
|
||||
bool confirm(String const&);
|
||||
|
@ -76,7 +76,7 @@ private:
|
|||
explicit Window(Document&);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
||||
Document& m_associated_document;
|
||||
WeakPtr<Document> m_associated_document;
|
||||
|
||||
WeakPtr<Bindings::WindowObject> m_wrapper;
|
||||
|
||||
|
|
Loading…
Reference in a new issue