From b86e8fb3a9feb52ae95e4c3c69d43664eb562d02 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Thu, 20 Feb 2014 12:55:40 -0800 Subject: [PATCH] Bug 951491 - Ensure ResumeTimeouts() after FreeInnerObjects() does nothing. r=bz --- dom/base/nsGlobalWindow.cpp | 5 ++++- dom/base/nsGlobalWindow.h | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index c48215a7e06..710d0d90f02 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1083,6 +1083,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow) #endif mShowFocusRingForContent(false), mFocusByKeyOccurred(false), + mInnerObjectsFreed(false), mHasGamepad(false), #ifdef MOZ_GAMEPAD mHasSeenGamepadInput(false), @@ -1520,6 +1521,8 @@ nsGlobalWindow::FreeInnerObjects() // re-create. NotifyDOMWindowDestroyed(this); + mInnerObjectsFreed = true; + // Kill all of the workers for this window. mozilla::dom::workers::CancelWorkersForWindow(this); @@ -12561,7 +12564,7 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren) NS_ASSERTION(mTimeoutsSuspendDepth, "Mismatched calls to ResumeTimeouts!"); --mTimeoutsSuspendDepth; - bool shouldResume = (mTimeoutsSuspendDepth == 0); + bool shouldResume = (mTimeoutsSuspendDepth == 0) && !mInnerObjectsFreed; nsresult rv; if (shouldResume) { diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 544471dcdaf..1521a1915e3 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1407,6 +1407,10 @@ protected: // should be displayed. bool mFocusByKeyOccurred : 1; + // Ensure that a call to ResumeTimeouts() after FreeInnerObjects() does nothing. + // This member is only used by inner windows. + bool mInnerObjectsFreed : 1; + // Indicates whether this window wants gamepad input events bool mHasGamepad : 1; #ifdef MOZ_GAMEPAD