Bug 678818 - Ensure that the device motion is cancelled at ~nsGlobalWindow. r=jst
--- 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();
}
}