diff --git a/dom/localstorage/ActorsParent.cpp b/dom/localstorage/ActorsParent.cpp index 506976e51ae4..a45f619a61cc 100644 --- a/dom/localstorage/ActorsParent.cpp +++ b/dom/localstorage/ActorsParent.cpp @@ -961,22 +961,23 @@ Result ExistsAsFile(nsIFile& aFile) { // This is an optimization to check both properties in one OS case, rather // than calling Exists first, and then IsDirectory. IsDirectory also checks if - // the path exists. + // the path exists. QM_OR_ELSE_WARN is not used here since we want to ignore + // NS_ERROR_FILE_NOT_FOUND/NS_ERROR_FILE_TARGET_DOES_NOT_EXIST completely. LS_TRY_INSPECT( const auto& res, - QM_OR_ELSE_WARN( - MOZ_TO_RESULT_INVOKE(aFile, IsDirectory) - .map([](const bool isDirectory) { - return isDirectory ? ExistsAsFileResult::IsDirectory - : ExistsAsFileResult::IsFile; - }), - ([](const nsresult rv) -> Result { - if (rv != NS_ERROR_FILE_NOT_FOUND && - rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) { - return Err(rv); - } - return ExistsAsFileResult::DoesNotExist; - }))); + MOZ_TO_RESULT_INVOKE(aFile, IsDirectory) + .map([](const bool isDirectory) { + return isDirectory ? ExistsAsFileResult::IsDirectory + : ExistsAsFileResult::IsFile; + }) + .orElse( + [](const nsresult rv) -> Result { + if (rv != NS_ERROR_FILE_NOT_FOUND && + rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST) { + return Err(rv); + } + return ExistsAsFileResult::DoesNotExist; + })); LS_TRY(OkIf(res != ExistsAsFileResult::IsDirectory), Err(NS_ERROR_FAILURE));