Bug 1470961 - Remove unnecessary use of SQLITE_IGNORE. r=asuth
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 26 Jun 2018 13:50:57 +0200
changeset 423892 bd92ec274e3934bc11948d4a81f05cd7801d7cdb
parent 423891 12a849d78301b32f4d800dfe50944fc6f4f810b4
child 423893 79aabc0f2db2fa8e6c248502aa901efb4ffafe44
push id34195
push usertoros@mozilla.com
push dateWed, 27 Jun 2018 22:05:29 +0000
treeherdermozilla-central@e922b59832f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1470961
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1470961 - Remove unnecessary use of SQLITE_IGNORE. r=asuth MozReview-Commit-ID: GhZzTzLULWp
netwerk/cache/nsDiskCacheDeviceSQL.cpp
storage/mozStorageConnection.cpp
--- 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