Bug 1338086 - Remove useless else blocks in order to reduce complexity devtools/shared/ r?fitzgen
MozReview-Commit-ID: CxMopblOFVp
--- a/devtools/shared/heapsnapshot/HeapSnapshot.cpp
+++ b/devtools/shared/heapsnapshot/HeapSnapshot.cpp
@@ -1502,53 +1502,52 @@ getCoreDumpOutputStream(ErrorResult& rv,
nsCOMPtr<nsIOutputStream> outputStream;
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), file,
PR_WRONLY, -1, 0);
if (NS_WARN_IF(rv.Failed()))
return nullptr;
return outputStream.forget();
- } else {
- // Request a file descriptor from the parent process over IPDL.
+ }
+ // Request a file descriptor from the parent process over IPDL.
- auto cc = ContentChild::GetSingleton();
- if (!cc) {
- rv.Throw(NS_ERROR_UNEXPECTED);
- return nullptr;
- }
+ auto cc = ContentChild::GetSingleton();
+ if (!cc) {
+ rv.Throw(NS_ERROR_UNEXPECTED);
+ return nullptr;
+ }
- UniqueHeapSnapshotTempFileHelperChild helper(
- cc->SendPHeapSnapshotTempFileHelperConstructor());
- if (NS_WARN_IF(!helper)) {
- rv.Throw(NS_ERROR_UNEXPECTED);
- return nullptr;
- }
+ UniqueHeapSnapshotTempFileHelperChild helper(
+ cc->SendPHeapSnapshotTempFileHelperConstructor());
+ if (NS_WARN_IF(!helper)) {
+ rv.Throw(NS_ERROR_UNEXPECTED);
+ return nullptr;
+ }
- OpenHeapSnapshotTempFileResponse response;
- if (!helper->SendOpenHeapSnapshotTempFile(&response)) {
- rv.Throw(NS_ERROR_UNEXPECTED);
- return nullptr;
- }
- if (response.type() == OpenHeapSnapshotTempFileResponse::Tnsresult) {
- rv.Throw(response.get_nsresult());
- return nullptr;
- }
+ OpenHeapSnapshotTempFileResponse response;
+ if (!helper->SendOpenHeapSnapshotTempFile(&response)) {
+ rv.Throw(NS_ERROR_UNEXPECTED);
+ return nullptr;
+ }
+ if (response.type() == OpenHeapSnapshotTempFileResponse::Tnsresult) {
+ rv.Throw(response.get_nsresult());
+ return nullptr;
+ }
- auto opened = response.get_OpenedFile();
- outFilePath = opened.path();
- nsCOMPtr<nsIOutputStream> outputStream =
- FileDescriptorOutputStream::Create(opened.descriptor());
- if (NS_WARN_IF(!outputStream)) {
- rv.Throw(NS_ERROR_UNEXPECTED);
- return nullptr;
- }
+ auto opened = response.get_OpenedFile();
+ outFilePath = opened.path();
+ nsCOMPtr<nsIOutputStream> outputStream =
+ FileDescriptorOutputStream::Create(opened.descriptor());
+ if (NS_WARN_IF(!outputStream)) {
+ rv.Throw(NS_ERROR_UNEXPECTED);
+ return nullptr;
+ }
- return outputStream.forget();
- }
+ return outputStream.forget();
}
} // namespace devtools
namespace dom {
using namespace JS;
using namespace devtools;