Bug 1329570 - Restore missing error check in mozilla::dom::Location::GetPathname. r=valentin.gosu
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Mon, 09 Jan 2017 15:53:01 +0900
changeset 328498 d4446c207c1359ded2bde9288e5eab27e8066f0b
parent 328497 afdccbbb363ded460ba209b8f8107cbbe3102aad
child 328499 42ea47c0d3d45734d816280f9c3efb041afa606f
push id35793
push userVYV03354@nifty.ne.jp
push dateMon, 09 Jan 2017 09:11:29 +0000
treeherderautoland@d4446c207c13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin.gosu
bugs1329570
milestone53.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 1329570 - Restore missing error check in mozilla::dom::Location::GetPathname. r=valentin.gosu MozReview-Commit-ID: 1g5Skn2R38c
dom/base/Location.cpp
--- a/dom/base/Location.cpp
+++ b/dom/base/Location.cpp
@@ -571,19 +571,20 @@ Location::GetOrigin(nsAString& aOrigin)
 }
 
 NS_IMETHODIMP
 Location::GetPathname(nsAString& aPathname)
 {
   aPathname.Truncate();
 
   nsCOMPtr<nsIURI> uri;
-  nsresult result = NS_OK;
-
-  result = GetURI(getter_AddRefs(uri));
+  nsresult result = GetURI(getter_AddRefs(uri));
+  if (NS_FAILED(result) || !uri) {
+    return result;
+  }
 
   nsAutoCString file;
 
   result = uri->GetFilePath(file);
 
   if (NS_SUCCEEDED(result)) {
     AppendUTF8toUTF16(file, aPathname);
   }