diff --git a/dom/system/IOUtils.cpp b/dom/system/IOUtils.cpp index df3a6e50b759..e6543c5527f5 100644 --- a/dom/system/IOUtils.cpp +++ b/dom/system/IOUtils.cpp @@ -194,7 +194,9 @@ already_AddRefed IOUtils::Read(GlobalObject& aGlobal, const ReadOptions& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } REJECT_IF_SHUTTING_DOWN(promise); nsCOMPtr file = new nsLocalFile(); @@ -225,7 +227,9 @@ already_AddRefed IOUtils::ReadUTF8(GlobalObject& aGlobal, const ReadUTF8Options& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } nsCOMPtr file = new nsLocalFile(); REJECT_IF_INIT_PATH_FAILED(file, aPath, promise); @@ -303,7 +307,9 @@ already_AddRefed IOUtils::Write(GlobalObject& aGlobal, const WriteOptions& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } REJECT_IF_SHUTTING_DOWN(promise); nsCOMPtr file = new nsLocalFile(); @@ -337,7 +343,9 @@ already_AddRefed IOUtils::WriteUTF8(GlobalObject& aGlobal, const WriteOptions& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } REJECT_IF_SHUTTING_DOWN(promise); nsCOMPtr file = new nsLocalFile(); @@ -418,7 +426,9 @@ already_AddRefed IOUtils::Move(GlobalObject& aGlobal, const MoveOptions& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } REJECT_IF_SHUTTING_DOWN(promise); nsCOMPtr sourceFile = new nsLocalFile(); @@ -443,7 +453,9 @@ already_AddRefed IOUtils::Remove(GlobalObject& aGlobal, const RemoveOptions& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } REJECT_IF_SHUTTING_DOWN(promise); nsCOMPtr file = new nsLocalFile(); @@ -464,7 +476,9 @@ already_AddRefed IOUtils::MakeDirectory( const MakeDirectoryOptions& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } REJECT_IF_SHUTTING_DOWN(promise); nsCOMPtr file = new nsLocalFile(); @@ -486,7 +500,9 @@ already_AddRefed IOUtils::Stat(GlobalObject& aGlobal, const nsAString& aPath) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } REJECT_IF_SHUTTING_DOWN(promise); nsCOMPtr file = new nsLocalFile(); @@ -505,7 +521,9 @@ already_AddRefed IOUtils::Copy(GlobalObject& aGlobal, const CopyOptions& aOptions) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } REJECT_IF_SHUTTING_DOWN(promise); nsCOMPtr sourceFile = new nsLocalFile(); @@ -530,7 +548,9 @@ already_AddRefed IOUtils::Touch( const Optional& aModification) { MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } nsCOMPtr file = new nsLocalFile(); REJECT_IF_INIT_PATH_FAILED(file, aPath, promise); @@ -552,7 +572,9 @@ already_AddRefed IOUtils::GetChildren(GlobalObject& aGlobal, const nsAString& aPath) { MOZ_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } nsCOMPtr file = new nsLocalFile(); REJECT_IF_INIT_PATH_FAILED(file, aPath, promise); @@ -569,7 +591,9 @@ already_AddRefed IOUtils::SetPermissions(GlobalObject& aGlobal, const uint32_t aPermissions) { MOZ_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } nsCOMPtr file = new nsLocalFile(); REJECT_IF_INIT_PATH_FAILED(file, aPath, promise); @@ -587,7 +611,9 @@ already_AddRefed IOUtils::Exists(GlobalObject& aGlobal, const nsAString& aPath) { MOZ_ASSERT(XRE_IsParentProcess()); RefPtr promise = CreateJSPromise(aGlobal); - NS_ENSURE_TRUE(!!promise, nullptr); + if (!promise) { + return nullptr; + } nsCOMPtr file = new nsLocalFile(); REJECT_IF_INIT_PATH_FAILED(file, aPath, promise);