Bug 1473217 - Part 2: dom: Fix clang-tidy's misc-unused-raii warnings. r?baku
nsPrintfCString creates a formatted string, but doesn't print it.
ExtractOriginData is called for its constructor's scope and origin out parameters. This ExtractOriginData object doesn't really need a name because it is unused after we have scope and origin, but this change makes clang-tidy happy and makes the code clear that ExtractOriginData is an object and not a funcion being called.
MozReview-Commit-ID: nxUBwzL4Uq
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -25722,19 +25722,20 @@ NormalTransactionOp::SendSuccessResult()
MOZ_ASSERT(maximalSizeFromPref > kMaxIDBMsgOverhead);
const size_t kMaxMessageSize = maximalSizeFromPref - kMaxIDBMsgOverhead;
RequestResponse response;
size_t responseSize = kMaxMessageSize;
GetResponse(response, &responseSize);
if (responseSize >= kMaxMessageSize) {
- nsPrintfCString("The serialized value is too large"
- " (size=%zu bytes, max=%zu bytes).",
- responseSize, kMaxMessageSize);
+ nsPrintfCString warning("The serialized value is too large"
+ " (size=%zu bytes, max=%zu bytes).",
+ responseSize, kMaxMessageSize);
+ NS_WARNING(warning.get());
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
}
MOZ_ASSERT(response.type() != RequestResponse::T__None);
if (response.type() == RequestResponse::Tnsresult) {
MOZ_ASSERT(NS_FAILED(response.get_nsresult()));
--- a/dom/storage/StorageDBUpdater.cpp
+++ b/dom/storage/StorageDBUpdater.cpp
@@ -173,17 +173,17 @@ GetOriginParticular::OnFunctionCall(
{
nsresult rv;
nsAutoCString scope;
rv = aFunctionArguments->GetUTF8String(0, scope);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString suffix, origin;
- ExtractOriginData(scope, suffix, origin);
+ ExtractOriginData extractor(scope, suffix, origin);
nsCOMPtr<nsIWritableVariant> outVar(new nsVariant());
switch (mParticular) {
case EParticular::ORIGIN_ATTRIBUTES_SUFFIX:
rv = outVar->SetAsAUTF8String(suffix);
break;
case EParticular::ORIGIN_KEY: