mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 11:37:44 +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
1 changed files with 3 additions and 3 deletions
|
@ -36,8 +36,8 @@ public:
|
||||||
Page* page();
|
Page* page();
|
||||||
Page const* page() const;
|
Page const* page() const;
|
||||||
|
|
||||||
Document const& associated_document() const { return m_associated_document; }
|
Document const& associated_document() const { return *m_associated_document; }
|
||||||
Document& associated_document() { return m_associated_document; }
|
Document& associated_document() { return *m_associated_document; }
|
||||||
|
|
||||||
void alert(String const&);
|
void alert(String const&);
|
||||||
bool confirm(String const&);
|
bool confirm(String const&);
|
||||||
|
@ -76,7 +76,7 @@ private:
|
||||||
explicit Window(Document&);
|
explicit Window(Document&);
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window
|
// 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;
|
WeakPtr<Bindings::WindowObject> m_wrapper;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue