Bug 866748: isTopLevel shouldn't throw, r=smaug
☠☠ backed out by 6b8b86d96eac ☠ ☠
authorGavin Sharp <gavin@gavinsharp.com>
Mon, 29 Apr 2013 15:52:57 -0700
changeset 141233 16c6e8f4dc2fca55e92fd94e83449aa5e4283c37
parent 141232 4fc7f15531a2f738657496786591eb16517aa77d
child 141234 6b8b86d96eac63cc57d60a2da32e3541fac7ea7c
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs866748
milestone23.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 866748: isTopLevel shouldn't throw, r=smaug
uriloader/base/nsDocLoader.cpp
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -947,27 +947,28 @@ nsDocLoader::GetDOMWindowID(uint64_t *aR
 }
 
 NS_IMETHODIMP
 nsDocLoader::GetIsTopLevel(bool *aResult)
 {
   *aResult = false;
 
   nsCOMPtr<nsIDOMWindow> window;
-  nsresult rv = GetDOMWindow(getter_AddRefs(window));
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
-  NS_ENSURE_STATE(piwindow);
+  GetDOMWindow(getter_AddRefs(window));
+  if (window) {
+    nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
+    NS_ENSURE_STATE(piwindow);
 
-  nsCOMPtr<nsIDOMWindow> topWindow;
-  rv = piwindow->GetTop(getter_AddRefs(topWindow));
-  NS_ENSURE_SUCCESS(rv, rv);
+    nsCOMPtr<nsIDOMWindow> topWindow;
+    rv = piwindow->GetTop(getter_AddRefs(topWindow));
+    NS_ENSURE_SUCCESS(rv, rv);
 
-  *aResult = piwindow == topWindow;
+    *aResult = piwindow == topWindow;
+  }
+
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocLoader::GetIsLoadingDocument(bool *aIsLoadingDocument)
 {
   *aIsLoadingDocument = mIsLoadingDocument;