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

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

Issue 1148133005: Window.postMessage() to self can cause document leaks (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove PostMessageTimers when stopped Created 5 years, 6 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
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalDOMWindow.cpp
diff --git a/Source/core/frame/LocalDOMWindow.cpp b/Source/core/frame/LocalDOMWindow.cpp
index 719d0b2fad727cc1998cfa5b86017462b894e77d..12eb9a022395a5e52bb4d71d8f9552bb325d3bdf 100644
--- a/Source/core/frame/LocalDOMWindow.cpp
+++ b/Source/core/frame/LocalDOMWindow.cpp
@@ -126,6 +126,12 @@ public:
SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); }
ScriptCallStack* stackTrace() const { return m_stackTrace.get(); }
UserGestureToken* userGestureToken() const { return m_userGestureToken.get(); }
+ virtual void stop() override
+ {
+ SuspendableTimer::stop();
+ // Will destroy this object
+ m_window->postMessageTimerStopped(this);
+ }
DEFINE_INLINE_VIRTUAL_TRACE()
{
@@ -663,6 +669,11 @@ void LocalDOMWindow::postMessageTimerFired(PostMessageTimer* timer)
m_postMessageTimers.remove(timer);
}
+void LocalDOMWindow::postMessageTimerStopped(PostMessageTimer* timer)
+{
+ m_postMessageTimers.remove(timer);
+}
+
void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<ScriptCallStack> stackTrace)
{
if (intendedTargetOrigin) {
« no previous file with comments | « Source/core/frame/LocalDOMWindow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698