Bug 1396368 - Update WebSocket count on top inner window when unlinking. r=bkelly
authorAndreas Farre <farre@mozilla.com>
Tue, 12 Sep 2017 15:25:33 +0200
changeset 380310 0cbbb59b5e61c5e1af0d42df72f56a9b736a454b
parent 380309 f4561375608bbbca3f3882bb6007ec7582e90ac5
child 380311 09df59c389f58591b6bab860c3fa4a0183bf871e
push id32486
push userarchaeopteryx@coole-files.de
push dateWed, 13 Sep 2017 09:28:25 +0000
treeherdermozilla-central@987326974635 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1396368
milestone57.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 1396368 - Update WebSocket count on top inner window when unlinking. r=bkelly
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -4382,22 +4382,22 @@ void
 nsPIDOMWindowInner::SyncStateFromParentWindow()
 {
   nsGlobalWindow::Cast(this)->SyncStateFromParentWindow();
 }
 
 void
 nsGlobalWindow::UpdateTopInnerWindow()
 {
-  if (!IsInnerWindow() || AsInner()->IsTopInnerWindow()) {
-    return;
-  }
-
-  AsInner()->UpdateWebSocketCount(-(int32_t)mNumOfOpenWebSockets);
-  AsInner()->UpdateUserMediaCount(-(int32_t)mNumOfActiveUserMedia);
+  if (!IsInnerWindow() || AsInner()->IsTopInnerWindow() || !mTopInnerWindow) {
+    return;
+  }
+
+  mTopInnerWindow->UpdateWebSocketCount(-(int32_t)mNumOfOpenWebSockets);
+  mTopInnerWindow->UpdateUserMediaCount(-(int32_t)mNumOfActiveUserMedia);
 }
 
 void
 nsPIDOMWindowInner::AddPeerConnection()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(IsInnerWindow());
   mTopInnerWindow ? mTopInnerWindow->mActivePeerConnections++