Bug 735781 - Make sure nsScreen don't call RemoveObserver twice in a row. r=jlebar
authorMounir Lamouri <mounir.lamouri@gmail.com>
Thu, 15 Mar 2012 10:58:56 +0100
changeset 89745 d5713db687498156de6728400be91a7889b4ae10
parent 89744 dc412fe94df66d018e8f40de30402a3ae2a20566
child 89746 436f102861fc12ba11a58d91670e444f43d831e5
push id22282
push usermlamouri@mozilla.com
push dateTue, 20 Mar 2012 10:40:32 +0000
treeherdermozilla-central@ee554888d071 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs735781
milestone14.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 735781 - Make sure nsScreen don't call RemoveObserver twice in a row. r=jlebar
dom/base/nsGlobalWindow.cpp
dom/base/nsScreen.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -1308,17 +1308,16 @@ nsGlobalWindow::FreeInnerObjects()
   mHistory = nsnull;
 
   if (mNavigator) {
     mNavigator->Invalidate();
     mNavigator = nsnull;
   }
 
   if (mScreen) {
-    mScreen->Invalidate();
     mScreen = nsnull;
   }
 
   if (mDocument) {
     NS_ASSERTION(mDoc, "Why is mDoc null?");
 
     // Remember the document's principal.
     mDocumentPrincipal = mDoc->NodePrincipal();
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -79,22 +79,16 @@ nsScreen::Initialize()
   MOZ_ASSERT(!sInitialized);
   sInitialized = true;
   Preferences::AddBoolVarCache(&sAllowScreenEnabledProperty,
                                "dom.screenEnabledProperty.enabled");
   Preferences::AddBoolVarCache(&sAllowScreenBrightnessProperty,
                                "dom.screenBrightnessProperty.enabled");
 }
 
-void
-nsScreen::Invalidate()
-{
-  hal::UnregisterScreenOrientationObserver(this);
-}
-
 /* static */ already_AddRefed<nsScreen>
 nsScreen::Create(nsPIDOMWindow* aWindow)
 {
   if (!sInitialized) {
     Initialize();
   }
 
   if (!aWindow->GetDocShell()) {
@@ -115,17 +109,17 @@ nsScreen::Create(nsPIDOMWindow* aWindow)
 }
 
 nsScreen::nsScreen()
 {
 }
 
 nsScreen::~nsScreen()
 {
-  Invalidate();
+  hal::UnregisterScreenOrientationObserver(this);
 }
 
 
 DOMCI_DATA(Screen, nsScreen)
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsScreen)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsScreen,