Bug 1268849 Don't crash in GetServiceWorkersTestingEnabled if window is torn down and GetScriptableTop() returns nullptr. r=bz a=lizzard
authorBen Kelly <ben@wanderview.com>
Tue, 03 May 2016 16:40:00 -0700
changeset 332694 2d3a15d3e47e3934aee718481471e14e11415870
parent 332693 fb4552d95407a2a6ec0ef5b2924fc65797fc6e1e
child 332695 e5694384be52d02fd430d3d6298a922265e663fd
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, lizzard
bugs1268849
milestone48.0a2
Bug 1268849 Don't crash in GetServiceWorkersTestingEnabled if window is torn down and GetScriptableTop() returns nullptr. r=bz a=lizzard
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -3778,16 +3778,19 @@ nsPIDOMWindowOuter::SetServiceWorkersTes
 }
 
 bool
 nsPIDOMWindowOuter::GetServiceWorkersTestingEnabled()
 {
   // Automatically get this setting from the top level window so that nested
   // iframes get the correct devtools setting.
   nsCOMPtr<nsPIDOMWindowOuter> topWindow = GetScriptableTop();
+  if (!topWindow) {
+    return false;
+  }
   return topWindow->mServiceWorkersTestingEnabled;
 }
 
 bool
 nsPIDOMWindowInner::GetAudioCaptured() const
 {
   MOZ_ASSERT(IsInnerWindow());
   return mAudioCaptured;