Bug 1470961 - Remove unnecessary use of SQLITE_IGNORE. r=asuth
MozReview-Commit-ID: GhZzTzLULWp
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -43,17 +43,16 @@
#include "mozIStorageFunction.h"
#include "mozStorageHelper.h"
#include "nsICacheVisitor.h"
#include "nsISeekableStream.h"
#include "mozilla/Telemetry.h"
-#include "sqlite3.h"
#include "mozilla/storage.h"
#include "nsVariant.h"
#include "mozilla/BasePrincipal.h"
using namespace mozilla;
using namespace mozilla::storage;
using mozilla::OriginAttributes;
@@ -213,17 +212,19 @@ nsOfflineCacheEvictionFunction::OnFuncti
const char *key = values->AsSharedUTF8String(1, &valueLen);
nsAutoCString fullKey(clientID);
fullKey.Append(':');
fullKey.Append(key);
int generation = values->AsInt32(2);
// If the key is currently locked, refuse to delete this row.
if (mDevice->IsLocked(fullKey)) {
- NS_ADDREF(*_retval = new IntegerVariant(SQLITE_IGNORE));
+ // This code thought it was performing the equivalent of invoking the SQL
+ // "RAISE(IGNORE)" function. It was not. Please see bug 1470961 and any
+ // follow-ups to understand the plan for correcting this bug.
return NS_OK;
}
nsCOMPtr<nsIFile> file;
rv = GetCacheDataFile(mDevice->CacheDirectory(), key,
generation, file);
if (NS_FAILED(rv))
{
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -255,19 +255,17 @@ basicFunctionHelper(sqlite3_context *aCt
NS_WARNING(errorMessage.get());
::sqlite3_result_error(aCtx, errorMessage.get(), -1);
::sqlite3_result_error_code(aCtx, nsresultToSQLiteResult(rv));
return;
}
int retcode = variantToSQLiteT(aCtx, result);
- if (retcode == SQLITE_IGNORE) {
- ::sqlite3_result_int(aCtx, SQLITE_IGNORE);
- } else if (retcode != SQLITE_OK) {
+ if (retcode != SQLITE_OK) {
NS_WARNING("User function returned invalid data type!");
::sqlite3_result_error(aCtx,
"User function returned invalid data type",
-1);
}
}
void