Bug 1240005 - Users of do_CreateInstance or InitWithNativePath/InitWithPath not checking return value r=necko-reviewers,xpcom-reviewers,media-playback-reviewers,emilio,karlt,valentin

Differential Revision: https://phabricator.services.mozilla.com/D227280
This commit is contained in:
Oliver Old
2024-11-25 16:54:11 +00:00
parent 82cc01210e
commit 054846ec0f
42 changed files with 377 additions and 359 deletions

View File

@@ -36,6 +36,7 @@
#include "mozilla/StaticPrefs_signon.h"
#include "mozilla/TextUtils.h"
#include "mozilla/Try.h"
#include "mozilla/Unused.h"
#include "nsAttrValueInlines.h"
#include "nsCRTGlue.h"
#include "nsIFilePicker.h"
@@ -347,7 +348,7 @@ UploadLastDir::ContentPrefCallback::HandleCompletion(uint16_t aReason) {
if (!prefStr.IsEmpty()) {
nsresult rv = NS_NewLocalFile(prefStr, getter_AddRefs(localFile));
(void)NS_WARN_IF(NS_FAILED(rv));
Unused << NS_WARN_IF(NS_FAILED(rv));
}
if (localFile) {
@@ -2161,13 +2162,13 @@ void HTMLInputElement::MozSetFileNameArray(const Sequence<nsString>& aFileNames,
nsASCIICaseInsensitiveStringComparator)) {
// Converts the URL string into the corresponding nsIFile if possible
// A local file will be created if the URL string begins with file://
NS_GetFileFromURLSpec(NS_ConvertUTF16toUTF8(aFileNames[i]),
getter_AddRefs(file));
Unused << NS_GetFileFromURLSpec(NS_ConvertUTF16toUTF8(aFileNames[i]),
getter_AddRefs(file));
}
if (!file) {
// this is no "file://", try as local file
NS_NewLocalFile(aFileNames[i], getter_AddRefs(file));
Unused << NS_NewLocalFile(aFileNames[i], getter_AddRefs(file));
}
if (!file) {