Bug 749964. Don't try to save if what we have is not a real document object. r=khuey, a=akeybl
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 05 Oct 2012 22:39:46 -0400
changeset 107096 1ae01910317360f88318a41a2373ee0e9c0b2e53
parent 107095 5e6bff90786c6a480b05ac25c66780770b69651b
child 107097 1b4b0dcc95e09f249160b60d957f5cdb543143ba
push id2231
push userbzbarsky@mozilla.com
push dateMon, 08 Oct 2012 01:59:38 +0000
treeherdermozilla-aurora@21cc2ed4690c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey, akeybl
bugs749964
milestone17.0a2
Bug 749964. Don't try to save if what we have is not a real document object. r=khuey, a=akeybl
embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -1493,16 +1493,19 @@ nsresult nsWebBrowserPersist::SaveDocume
         rv = GetLocalFileFromURI(aDataPath, getter_AddRefs(localDataPath));
         NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
     }
 
     nsCOMPtr<nsIDOMNode> docAsNode = do_QueryInterface(aDocument);
 
     // Persist the main document
     nsCOMPtr<nsIDocument> doc(do_QueryInterface(aDocument));
+    if (!doc) {
+        return NS_ERROR_UNEXPECTED;
+    }
     mURI = doc->GetDocumentURI();
 
     nsCOMPtr<nsIURI> oldBaseURI = mCurrentBaseURI;
     nsCAutoString oldCharset(mCurrentCharset);
 
     // Store the base URI and the charset
     mCurrentBaseURI = doc->GetBaseURI();
     mCurrentCharset = doc->GetDocumentCharacterSet();