Bug 944130 - test_speakermanager.html: ASSERTION: background state is only maintained on outer windows. r=amarchesini
authorRandy Lin <rlin@mozilla.com>
Sun, 01 Dec 2013 13:23:00 +0800
changeset 158404 5e6f5a0ef9cdb952564d1ff5f610b42da6af6bb2
parent 158403 806ed2a530f9d8269124b46050a0dcfb47447b9d
child 158405 3c57c72b4b6155a332a1036d1390869b13fb832d
push id2942
push userryanvm@gmail.com
push dateTue, 03 Dec 2013 03:41:02 +0000
treeherderb2g-inbound@5e6f5a0ef9cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersamarchesini
bugs944130
milestone28.0a1
Bug 944130 - test_speakermanager.html: ASSERTION: background state is only maintained on outer windows. r=amarchesini
dom/speakermanager/SpeakerManager.cpp
--- a/dom/speakermanager/SpeakerManager.cpp
+++ b/dom/speakermanager/SpeakerManager.cpp
@@ -105,20 +105,22 @@ SpeakerManager::DispatchSimpleEvent(cons
     NS_ERROR("Failed to dispatch the event!!!");
     return;
   }
 }
 
 void
 SpeakerManager::Init(nsPIDOMWindow* aWindow)
 {
-  BindToOwner(aWindow->IsOuterWindow() ?
-    aWindow->GetCurrentInnerWindow() : aWindow);
+  BindToOwner(aWindow);
 
-  mVisible = !GetOwner()->IsBackground();
+  nsCOMPtr<nsIDocShell> docshell = do_GetInterface(GetOwner());
+  NS_ENSURE_TRUE_VOID(docshell);
+  docshell->GetIsActive(&mVisible);
+
   nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());
   NS_ENSURE_TRUE_VOID(target);
 
   target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
                                  this,
                                  /* useCapture = */ true,
                                  /* wantsUntrusted = */ false);
 }