Bug 678818 - Ensure that the device motion is cancelled at ~nsGlobalWindow. r=jst
authorDoug Turner <dougt@dougt.org>
Thu, 18 Aug 2011 19:27:41 -0700
changeset 76835 1ac35ad29f03b52815b8a9362e3f12764cd7f7c4
parent 76834 2586082fbd94bc68baa1265f45c5a2b6a8279eae
child 76836 c9c694fa048cac880a91474b4ccedaad6bdbca66
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs678818
milestone9.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 678818 - Ensure that the device motion is cancelled at ~nsGlobalWindow. r=jst
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1032,26 +1032,27 @@ nsGlobalWindow::~nsGlobalWindow()
 
   mDocument = nsnull;           // Forces Release
   mDoc = nsnull;
 
   NS_ASSERTION(!mArguments, "mArguments wasn't cleaned up properly!");
 
   CleanUp(PR_TRUE);
 
-  NS_ASSERTION(!mHasDeviceMotion, "Window still registered with device motion.");
-
 #ifdef DEBUG
   nsCycleCollector_DEBUG_wasFreed(static_cast<nsIScriptGlobalObject*>(this));
 #endif
 
   if (mURLProperty) {
     mURLProperty->ClearWindowReference();
   }
 
+  DisableDeviceMotionUpdates();
+  mHasDeviceMotion = PR_FALSE;
+
   nsLayoutStatics::Release();
 }
 
 // static
 void
 nsGlobalWindow::ShutDown()
 {
   NS_IF_RELEASE(sGlobalStorageList);
@@ -1160,19 +1161,16 @@ nsGlobalWindow::CleanUp(PRBool aIgnoreMo
   mParentTarget = nsnull;
 
   nsGlobalWindow *inner = GetCurrentInnerWindowInternal();
 
   if (inner) {
     inner->CleanUp(aIgnoreModalDialog);
   }
 
-  DisableDeviceMotionUpdates();
-  mHasDeviceMotion = PR_FALSE;
-
   if (mCleanMessageManager) {
     NS_ABORT_IF_FALSE(mIsChrome, "only chrome should have msg manager cleaned");
     nsGlobalChromeWindow *asChrome = static_cast<nsGlobalChromeWindow*>(this);
     if (asChrome->mMessageManager) {
       static_cast<nsFrameMessageManager*>(
         asChrome->mMessageManager.get())->Disconnect();
     }
   }