Bug 684599 - Avoid null dereference when chacking if a window's in the background. r=smaug
authorJosh Matthews <josh@joshmatthews.net>
Sun, 04 Sep 2011 14:53:39 -0400
changeset 77842 81ebc148aad38f3bf5a1712927c97a6d6692767b
parent 77841 9f853ef4b6640d2330ed8dcd8392db9fe0b84f56
child 77843 f212867dce42ff6aa6d63c76570d5eb4a3c9f5f8
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)
reviewerssmaug
bugs684599
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 684599 - Avoid null dereference when chacking if a window's in the background. r=smaug
dom/system/nsDeviceMotion.cpp
--- a/dom/system/nsDeviceMotion.cpp
+++ b/dom/system/nsDeviceMotion.cpp
@@ -231,17 +231,19 @@ nsDeviceMotion::DeviceMotionChanged(PRUi
   }
 
   for (PRUint32 i = mWindowListeners.Length(); i > 0 ; ) {
     --i;
 
     // check to see if this window is in the background.  if
     // it is, don't send any device motion to it.
     nsCOMPtr<nsPIDOMWindow> pwindow = do_QueryInterface(mWindowListeners[i]);
-    if (!pwindow || pwindow->GetOuterWindow()->IsBackground())
+    if (!pwindow ||
+        !pwindow->GetOuterWindow() ||
+        pwindow->GetOuterWindow()->IsBackground())
       continue;
 
     nsCOMPtr<nsIDOMDocument> domdoc;
     mWindowListeners[i]->GetDocument(getter_AddRefs(domdoc));
 
     if (domdoc) {
       nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mWindowListeners[i]);
       if (type == nsIDeviceMotionData::TYPE_ACCELERATION)