Bug 1266178 Make ServiceWorkerClient not assert if the document doesn't have an outer window. r=ehsan
authorBen Kelly <ben@wanderview.com>
Thu, 21 Apr 2016 14:14:45 -0700
changeset 294399 987e2c82c04fa03260845b0c65e700455d3b6221
parent 294398 48ba2783004140f0331ffd4764363b5b0040f127
child 294400 3d46eafd05b975b83d95a9c28f77c2e153422f2f
push id18880
push usercbook@mozilla.com
push dateFri, 22 Apr 2016 13:59:00 +0000
treeherderfx-team@0da9dcd298a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1266178
milestone48.0a1
Bug 1266178 Make ServiceWorkerClient not assert if the document doesn't have an outer window. r=ehsan
dom/workers/ServiceWorkerClient.cpp
--- a/dom/workers/ServiceWorkerClient.cpp
+++ b/dom/workers/ServiceWorkerClient.cpp
@@ -30,16 +30,17 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(Service
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorkerClient)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 ServiceWorkerClientInfo::ServiceWorkerClientInfo(nsIDocument* aDoc)
   : mWindowId(0)
+  , mFrameType(FrameType::None)
 {
   MOZ_ASSERT(aDoc);
   nsresult rv = aDoc->GetOrCreateId(mClientId);
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to get the UUID of the document.");
   }
 
   RefPtr<nsGlobalWindow> innerWindow = nsGlobalWindow::Cast(aDoc->GetInnerWindow());
@@ -59,18 +60,19 @@ ServiceWorkerClientInfo::ServiceWorkerCl
 
   ErrorResult result;
   mFocused = aDoc->HasFocus(result);
   if (result.Failed()) {
     NS_WARNING("Failed to get focus information.");
   }
 
   RefPtr<nsGlobalWindow> outerWindow = nsGlobalWindow::Cast(aDoc->GetWindow());
-  MOZ_ASSERT(outerWindow);
-  if (!outerWindow->IsTopLevelWindow()) {
+  if (!outerWindow) {
+    MOZ_ASSERT(mFrameType == FrameType::None);
+  } else if (!outerWindow->IsTopLevelWindow()) {
     mFrameType = FrameType::Nested;
   } else if (outerWindow->HadOriginalOpener()) {
     mFrameType = FrameType::Auxiliary;
   } else {
     mFrameType = FrameType::Top_level;
   }
 }