Bug 866748 - isTopLevel shouldn't throw. r=smaug
☠☠ backed out by 598cfd4cb5eb ☠ ☠
authorGavin Sharp <gavin@gavinsharp.com>
Mon, 29 Apr 2013 15:52:57 -0700
changeset 141281 49976a5935584a9854327fc44128d51e6a4b1891
parent 141280 75db6ad43aa1e7d952479f469d3975b33150fafb
child 141282 7e9d5bb4a9afce471cde5c0ff027538ea30490f2
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;
+    nsresult 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;