Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(895)

Unified Diff: Source/core/frame/DOMWindow.cpp

Issue 240343002: Track event handlers on windows (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed assertions not to go through the document. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/DOMWindow.cpp
diff --git a/Source/core/frame/DOMWindow.cpp b/Source/core/frame/DOMWindow.cpp
index 58eb5f81e01198d54b8ca2702ff2913171ed1e1e..bf86c6029e217a21c3ff4e4865980f89cb20ece2 100644
--- a/Source/core/frame/DOMWindow.cpp
+++ b/Source/core/frame/DOMWindow.cpp
@@ -59,6 +59,7 @@
#include "core/frame/Console.h"
#include "core/frame/DOMPoint.h"
#include "core/frame/DOMWindowLifecycleNotifier.h"
+#include "core/frame/EventHandlerRegistry.h"
#include "core/frame/FrameConsole.h"
#include "core/frame/FrameHost.h"
#include "core/frame/FrameView.h"
@@ -329,6 +330,7 @@ DOMWindow::DOMWindow(LocalFrame& frame)
#endif
{
ScriptWrappable::init(this);
+ m_frame->host()->eventHandlerRegistry().didMoveIntoFrameHost(*this);
Rick Byers 2014/05/06 20:54:39 Please add a comment describing why this is necess
Sami 2014/05/07 10:36:41 Yeah, I was thinking along the same lines -- it wo
Rick Byers 2014/05/07 13:28:21 Yeah this seems a lot cleaner. The observer abstr
}
void DOMWindow::clearDocument()
@@ -484,6 +486,9 @@ DOMWindow::~DOMWindow()
ASSERT(m_hasBeenReset);
reset();
+ if (m_frame && m_frame->host())
+ m_frame->host()->eventHandlerRegistry().didMoveOutOfFrameHost(*this);
+
removeAllEventListeners();
ASSERT(m_document->isStopped());
@@ -523,6 +528,7 @@ void DOMWindow::frameDestroyed()
void DOMWindow::willDetachFrameHost()
Rick Byers 2014/05/06 20:54:39 Does this only happen when a window is being destr
Sami 2014/05/07 10:36:41 I don't think we need to worry about that. If hand
Rick Byers 2014/05/07 13:28:21 Thanks, sounds reasonable.
{
+ m_frame->host()->eventHandlerRegistry().didMoveOutOfFrameHost(*this);
InspectorInstrumentation::frameWindowDiscarded(m_frame, this);
}

Powered by Google App Engine
This is Rietveld 408576698