Index: Source/core/frame/LocalFrame.cpp |
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp |
index 59c68fb30f1656f1e87a4186e7e690d9dae676e4..a26e93efdc70c55ceac931965c7913172a1ece68 100644 |
--- a/Source/core/frame/LocalFrame.cpp |
+++ b/Source/core/frame/LocalFrame.cpp |
@@ -206,15 +206,7 @@ |
#if !ENABLE(OILPAN) |
// Oilpan: see setDOMWindow() comment why it is acceptable not to |
// mirror the non-Oilpan call below. |
- // |
- // Also, FrameDestructionObservers that live longer than this |
- // frame object keep weak references to the frame; those will be |
- // automatically cleared by the garbage collector. Hence, explicit |
- // frameDestroyed() notifications aren't needed. |
setDOMWindow(nullptr); |
- |
- for (const auto& frameDestructionObserver : m_destructionObservers) |
- frameDestructionObserver->frameDestroyed(); |
#endif |
} |
@@ -291,6 +283,11 @@ |
// finalization. Too late to access various heap objects at that |
// stage. |
m_loader.clear(); |
+ |
+ // Signal frame destruction here rather than in the destructor. |
+ // Main motivation is to avoid being dependent on its exact timing (Oilpan.) |
+ for (const auto& frameDestructionObserver : m_destructionObservers) |
+ frameDestructionObserver->frameDestroyed(); |
} |
SecurityContext* LocalFrame::securityContext() const |