Index: Source/core/frame/DOMWindow.cpp |
diff --git a/Source/core/frame/DOMWindow.cpp b/Source/core/frame/DOMWindow.cpp |
index 3b2c2b9012b322e5ed2606ea54dbd332fe7d9d8f..b7c3fbdaf6ae62669536c878a4fcfd55c1dd43b0 100644 |
--- a/Source/core/frame/DOMWindow.cpp |
+++ b/Source/core/frame/DOMWindow.cpp |
@@ -348,7 +348,7 @@ void DOMWindow::clearDocument() |
m_document->detach(); |
haraken
2014/05/23 20:53:58
I'm not yet fully convinced about this one. Would
sof
2014/05/23 21:00:15
I don't have a better answer than the one given ea
sof
2014/05/24 05:51:00
Consider the following steps:
- A DOMWindow can a
|
} |
- // FIXME: This should be part of ActiveDOM Object shutdown |
+ // FIXME: This should be part of ActiveDOMObject shutdown |
clearEventQueue(); |
m_document->clearDOMWindow(); |
@@ -489,15 +489,20 @@ DOMWindow::~DOMWindow() |
ASSERT(m_hasBeenReset); |
reset(); |
- removeAllEventListeners(); |
- |
#if ENABLE(OILPAN) |
- ASSERT(m_document->isDisposed()); |
haraken
2014/05/23 20:53:58
Just help me understand: Why do we need to remove
sof
2014/05/24 05:51:00
It was safe with m_document being a RefPtr<>, no l
sof
2014/05/24 06:53:11
Done.
|
+ // Oilpan: the frame host and document objects are |
+ // also garbage collected; cannot notify these |
+ // when removing event listeners. |
+ removeAllEventListeners(DoNotBroadcastListenerRemoval); |
+ |
+ // FIXME: This should be part of ActiveDOMObject shutdown |
+ clearEventQueue(); |
#else |
- ASSERT(m_document->isStopped()); |
-#endif |
+ removeAllEventListeners(DoBroadcastListenerRemoval); |
+ ASSERT(m_document->isStopped()); |
clearDocument(); |
+#endif |
} |
const AtomicString& DOMWindow::interfaceName() const |
@@ -1613,22 +1618,29 @@ bool DOMWindow::dispatchEvent(PassRefPtrWillBeRawPtr<Event> prpEvent, PassRefPtr |
return result; |
} |
-void DOMWindow::removeAllEventListeners() |
+void DOMWindow::removeAllEventListeners(BroadcastListenerRemoval mode) |
{ |
EventTarget::removeAllEventListeners(); |
lifecycleNotifier().notifyRemoveAllEventListeners(this); |
- if (m_frame && m_frame->host()) |
- m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); |
+ if (mode == DoBroadcastListenerRemoval) { |
+ if (m_frame && m_frame->host()) |
+ m_frame->host()->eventHandlerRegistry().didRemoveAllEventHandlers(*this); |
- if (Document* document = this->document()) |
- document->didClearTouchEventHandlers(document); |
+ if (Document* document = this->document()) |
+ document->didClearTouchEventHandlers(document); |
+ } |
removeAllUnloadEventListeners(this); |
removeAllBeforeUnloadEventListeners(this); |
} |
+void DOMWindow::removeAllEventListeners() |
+{ |
+ removeAllEventListeners(DoBroadcastListenerRemoval); |
+} |
+ |
void DOMWindow::finishedLoading() |
{ |
if (m_shouldPrintWhenFinishedLoading) { |
@@ -1875,6 +1887,7 @@ PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() |
void DOMWindow::trace(Visitor* visitor) |
{ |
+ visitor->trace(m_document); |
visitor->trace(m_screen); |
visitor->trace(m_history); |
visitor->trace(m_locationbar); |