Bug 1168606 - Removed implicit conversion operator of CachedStatement. r=ttung,asuth
☠☠ backed out by 2172f9a7aaf0 ☠ ☠
authorSimon Giesecke <sgiesecke@mozilla.com>
Tue, 05 Nov 2019 12:47:28 +0000
changeset 500609 41f1bef0f0190ce7a172c79f70e289d7a124793d
parent 500608 96cb7140a4f6c3f9651944c824f35e73d5cff735
child 500610 dffe1e6c58bd717cda6184a647c54b0bc7aca12e
push id114166
push userapavel@mozilla.com
push dateThu, 07 Nov 2019 10:04:01 +0000
treeherdermozilla-inbound@d271c572a9bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersttung, asuth
bugs1168606
milestone72.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 1168606 - Removed implicit conversion operator of CachedStatement. r=ttung,asuth Depends on D44377 Differential Revision: https://phabricator.services.mozilla.com/D44443
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -4850,19 +4850,17 @@ class DatabaseConnection::CachedStatemen
     if (mDEBUGConnection) {
       mDEBUGConnection->AssertIsOnConnectionThread();
     }
     MOZ_ASSERT(!NS_IsMainThread());
     MOZ_ASSERT(!IsOnBackgroundThread());
 #endif
   }
 
-  // TODO: Remove the implicit operator, and replace it by explicit calls to
-  // GetUnderlyingStatement.
-  operator mozIStorageStatement*() const;
+  explicit operator bool() const;
 
   mozIStorageStatement& operator*() const;
 
   mozIStorageStatement* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN;
 
   void Reset();
 
  private:
@@ -10082,17 +10080,17 @@ nsresult DatabaseConnection::GetFreelist
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   MOZ_ASSERT(hasResult);
 
   // Make sure this statement is reset when leaving this function since we're
   // not using the normal stack-based protection of CachedStatement.
-  mozStorageStatementScoper scoper(aCachedStatement);
+  mozStorageStatementScoper scoper(&*aCachedStatement);
 
   int32_t freelistCount;
   rv = aCachedStatement->GetInt32(0, &freelistCount);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   MOZ_ASSERT(freelistCount >= 0);
@@ -10223,21 +10221,19 @@ DatabaseConnection::CachedStatement::Cac
 }
 
 DatabaseConnection::CachedStatement::~CachedStatement() {
   AssertIsOnConnectionThread();
 
   MOZ_COUNT_DTOR(DatabaseConnection::CachedStatement);
 }
 
-DatabaseConnection::CachedStatement::operator mozIStorageStatement*() const {
+DatabaseConnection::CachedStatement::operator bool() const {
   AssertIsOnConnectionThread();
 
-  // Note: this might also return nullptr, which is exploited at some call
-  // sites.
   return mStatement;
 }
 
 mozIStorageStatement& DatabaseConnection::CachedStatement::operator*() const {
   return *operator->();
 }
 
 mozIStorageStatement* DatabaseConnection::CachedStatement::operator->() const {
@@ -10767,17 +10763,17 @@ nsresult DatabaseConnection::UpdateRefco
                            "SET refcount = refcount + :delta "
                            "WHERE id = :id"),
         &mUpdateStatement);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
-  mozStorageStatementScoper updateScoper(mUpdateStatement);
+  mozStorageStatementScoper updateScoper(&*mUpdateStatement);
 
   rv = mUpdateStatement->BindInt32ByIndex(0, aDelta);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   rv = mUpdateStatement->BindInt64ByIndex(1, aId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -10803,17 +10799,17 @@ nsresult DatabaseConnection::UpdateRefco
                                                              "FROM file "
                                                              "WHERE id = :id"),
                                           &mSelectStatement);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
     }
 
-    mozStorageStatementScoper selectScoper(mSelectStatement);
+    mozStorageStatementScoper selectScoper(&*mSelectStatement);
 
     rv = mSelectStatement->BindInt64ByIndex(0, aId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     bool hasResult;
     rv = mSelectStatement->ExecuteStep(&hasResult);
@@ -10837,17 +10833,17 @@ nsresult DatabaseConnection::UpdateRefco
         NS_LITERAL_CSTRING("INSERT INTO file (id, refcount) "
                            "VALUES(:id, :delta)"),
         &mInsertStatement);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
-  mozStorageStatementScoper insertScoper(mInsertStatement);
+  mozStorageStatementScoper insertScoper(&*mInsertStatement);
 
   rv = mInsertStatement->BindInt64ByIndex(0, aId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   rv = mInsertStatement->BindInt32ByIndex(1, aDelta);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -18797,33 +18793,33 @@ nsresult DatabaseOperationBase::InsertIn
       }
     }
 
     rv = stmt->BindInt64ByName(kStmtParamNameIndexId, info.mIndexId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    rv = info.mPosition.BindToStatement(stmt, kStmtParamNameValue);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-      return rv;
-    }
-
-    rv = info.mLocaleAwarePosition.BindToStatement(stmt,
+    rv = info.mPosition.BindToStatement(&*stmt, kStmtParamNameValue);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
+    rv = info.mLocaleAwarePosition.BindToStatement(&*stmt,
                                                    kStmtParamNameValueLocale);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = stmt->BindInt64ByName(kStmtParamNameObjectStoreId, aObjectStoreId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    rv = aObjectStoreKey.BindToStatement(stmt, kStmtParamNameObjectDataKey);
+    rv = aObjectStoreKey.BindToStatement(&*stmt, kStmtParamNameObjectDataKey);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = stmt->Execute();
     if (rv == NS_ERROR_STORAGE_CONSTRAINT && info.mUnique) {
       // If we're inserting multiple entries for the same unique index, then
       // we might have failed to insert due to colliding with another entry for
@@ -18900,23 +18896,23 @@ nsresult DatabaseOperationBase::DeleteIn
       }
     }
 
     rv = stmt->BindInt64ByName(kStmtParamNameIndexId, indexValue.mIndexId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    rv = indexValue.mPosition.BindToStatement(stmt, kStmtParamNameValue);
+    rv = indexValue.mPosition.BindToStatement(&*stmt, kStmtParamNameValue);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     if (!indexValue.mUnique) {
-      rv = aObjectStoreKey.BindToStatement(stmt, kStmtParamNameObjectDataKey);
+      rv = aObjectStoreKey.BindToStatement(&*stmt, kStmtParamNameObjectDataKey);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
     }
 
     rv = stmt->Execute();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
@@ -18962,17 +18958,17 @@ nsresult DatabaseOperationBase::DeleteOb
             kStmtParamNameKey + NS_LITERAL_CSTRING(";"),
         &selectStmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     objectStoreKey = aKeyRange.ref().lower();
 
-    rv = objectStoreKey.BindToStatement(selectStmt, kStmtParamNameKey);
+    rv = objectStoreKey.BindToStatement(&*selectStmt, kStmtParamNameKey);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   } else {
     const auto keyRangeClause =
         MaybeGetBindingClauseForKeyRange(aKeyRange, kColumnNameKey);
 
     rv = aConnection->GetCachedStatement(
@@ -18983,17 +18979,17 @@ nsresult DatabaseOperationBase::DeleteOb
             kStmtParamNameObjectStoreId + keyRangeClause +
             NS_LITERAL_CSTRING(";"),
         &selectStmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     if (aKeyRange.isSome()) {
-      rv = BindKeyRangeToStatement(aKeyRange.ref(), selectStmt);
+      rv = BindKeyRangeToStatement(aKeyRange.ref(), &*selectStmt);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
     }
   }
 
   rv = selectStmt->BindInt64ByName(kStmtParamNameObjectStoreId, aObjectStoreId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -19003,25 +18999,25 @@ nsresult DatabaseOperationBase::DeleteOb
   DatabaseConnection::CachedStatement deleteStmt;
   AutoTArray<IndexDataValue, 32> indexValues;
 
   DebugOnly<uint32_t> resultCountDEBUG = 0;
 
   bool hasResult;
   while (NS_SUCCEEDED(rv = selectStmt->ExecuteStep(&hasResult)) && hasResult) {
     if (!singleRowOnly) {
-      rv = objectStoreKey.SetFromStatement(selectStmt, 1);
+      rv = objectStoreKey.SetFromStatement(&*selectStmt, 1);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
 
       indexValues.ClearAndRetainStorage();
     }
 
-    rv = ReadCompressedIndexDataValues(selectStmt, 0, indexValues);
+    rv = ReadCompressedIndexDataValues(&*selectStmt, 0, indexValues);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = DeleteIndexDataTableRows(aConnection, objectStoreKey, indexValues);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
@@ -19041,17 +19037,17 @@ nsresult DatabaseOperationBase::DeleteOb
     }
 
     rv = deleteStmt->BindInt64ByName(kStmtParamNameObjectStoreId,
                                      aObjectStoreId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    rv = objectStoreKey.BindToStatement(deleteStmt, kStmtParamNameKey);
+    rv = objectStoreKey.BindToStatement(&*deleteStmt, kStmtParamNameKey);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = deleteStmt->Execute();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
@@ -23524,17 +23520,17 @@ nsresult DeleteIndexOp::RemoveReferences
       return rv;
     }
 
     rv = stmt->BindInt64ByName(kStmtParamNameObjectStoreId, mObjectStoreId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    rv = aObjectStoreKey.BindToStatement(stmt, kStmtParamNameKey);
+    rv = aObjectStoreKey.BindToStatement(&*stmt, kStmtParamNameKey);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = stmt->Execute();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
@@ -23739,17 +23735,17 @@ nsresult DeleteIndexOp::DoDatabaseWork(D
 
   Key lastObjectStoreKey;
   AutoTArray<IndexDataValue, 32> lastIndexValues;
 
   bool hasResult;
   while (NS_SUCCEEDED(rv = selectStmt->ExecuteStep(&hasResult)) && hasResult) {
     // We always need the index key to delete the index row.
     Key indexKey;
-    rv = indexKey.SetFromStatement(selectStmt, 0);
+    rv = indexKey.SetFromStatement(&*selectStmt, 0);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     if (NS_WARN_IF(indexKey.IsUnset())) {
       IDB_REPORT_INTERNAL_ERR();
       return NS_ERROR_FILE_CORRUPTED;
     }
@@ -23785,17 +23781,17 @@ nsresult DeleteIndexOp::DoDatabaseWork(D
       }
 
       // Save the object store key.
       lastObjectStoreKey = Key(currentObjectStoreKeyBuffer);
 
       // And the |index_data_values| row if this isn't the only index.
       if (!mIsLastIndex) {
         lastIndexValues.ClearAndRetainStorage();
-        rv = ReadCompressedIndexDataValues(selectStmt, 2, lastIndexValues);
+        rv = ReadCompressedIndexDataValues(&*selectStmt, 2, lastIndexValues);
         if (NS_WARN_IF(NS_FAILED(rv))) {
           return rv;
         }
 
         if (NS_WARN_IF(lastIndexValues.IsEmpty())) {
           IDB_REPORT_INTERNAL_ERR();
           return NS_ERROR_FILE_CORRUPTED;
         }
@@ -23828,23 +23824,23 @@ nsresult DeleteIndexOp::DoDatabaseWork(D
       }
     }
 
     rv = deleteIndexRowStmt->BindInt64ByName(kStmtParamNameIndexId, mIndexId);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    rv = indexKey.BindToStatement(deleteIndexRowStmt, kStmtParamNameValue);
+    rv = indexKey.BindToStatement(&*deleteIndexRowStmt, kStmtParamNameValue);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     if (!mUnique) {
-      rv = lastObjectStoreKey.BindToStatement(deleteIndexRowStmt,
+      rv = lastObjectStoreKey.BindToStatement(&*deleteIndexRowStmt,
                                               kStmtParamNameObjectDataKey);
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
     }
 
     rv = deleteIndexRowStmt->Execute();
     if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -24208,30 +24204,31 @@ nsresult ObjectStoreAddOrPutRequestOp::R
   }
 
   rv = indexValuesStmt->BindInt64ByName(kStmtParamNameObjectStoreId,
                                         mParams.objectStoreId());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  rv = mResponse.BindToStatement(indexValuesStmt, kStmtParamNameKey);
+  rv = mResponse.BindToStatement(&*indexValuesStmt, kStmtParamNameKey);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   bool hasResult;
   rv = indexValuesStmt->ExecuteStep(&hasResult);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (hasResult) {
     AutoTArray<IndexDataValue, 32> existingIndexValues;
-    rv = ReadCompressedIndexDataValues(indexValuesStmt, 0, existingIndexValues);
+    rv = ReadCompressedIndexDataValues(&*indexValuesStmt, 0,
+                                       existingIndexValues);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = DeleteIndexDataTableRows(aConnection, mResponse, existingIndexValues);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
@@ -24467,17 +24464,17 @@ nsresult ObjectStoreAddOrPutRequestOp::D
       LittleEndian::writeUint64(keyPropBuffer, keyPropValue);
 
       auto iter = cloneData.Start();
       MOZ_ALWAYS_TRUE(cloneData.Advance(iter, cloneInfo.offsetToKeyProp()));
       MOZ_ALWAYS_TRUE(cloneData.UpdateBytes(iter, keyPropBuffer, keyPropSize));
     }
   }
 
-  key.BindToStatement(stmt, kStmtParamNameKey);
+  key.BindToStatement(&*stmt, kStmtParamNameKey);
 
   if (mDataOverThreshold) {
     // The data we store in the SQLite database is a (signed) 64-bit integer.
     // The flags are left-shifted 32 bits so the max value is 0xFFFFFFFF.
     // The file_ids index occupies the lower 32 bits and its max is 0xFFFFFFFF.
     static const uint32_t kCompressedFlag = (1 << 0);
 
     uint32_t flags = 0;
@@ -24840,31 +24837,31 @@ nsresult ObjectStoreGetRequestOp::DoData
   }
 
   rv = stmt->BindInt64ByName(kStmtParamNameObjectStoreId, mObjectStoreId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (mOptionalKeyRange.isSome()) {
-    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt);
+    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
     StructuredCloneReadInfo* cloneInfo = mResponse.AppendElement(fallible);
     if (NS_WARN_IF(!cloneInfo)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     rv = GetStructuredCloneReadInfoFromStatement(
-        stmt, 1, 0, mDatabase->GetFileManager(), cloneInfo);
+        &*stmt, 1, 0, mDatabase->GetFileManager(), cloneInfo);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     if (cloneInfo->mHasPreprocessInfo) {
       mPreprocessInfoCount++;
     }
   }
@@ -25026,30 +25023,30 @@ nsresult ObjectStoreGetKeyRequestOp::DoD
   }
 
   rv = stmt->BindInt64ByName(kStmtParamNameObjectStoreId, mObjectStoreId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (mOptionalKeyRange.isSome()) {
-    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt);
+    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
     Key* key = mResponse.AppendElement(fallible);
     if (NS_WARN_IF(!key)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
-    rv = key->SetFromStatement(stmt, 0);
+    rv = key->SetFromStatement(&*stmt, 0);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -25262,17 +25259,17 @@ nsresult ObjectStoreCountRequestOp::DoDa
 
   rv = stmt->BindInt64ByName(kStmtParamNameObjectStoreId,
                              mParams.objectStoreId());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (mParams.optionalKeyRange().isSome()) {
-    rv = BindKeyRangeToStatement(mParams.optionalKeyRange().ref(), stmt);
+    rv = BindKeyRangeToStatement(mParams.optionalKeyRange().ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   rv = stmt->ExecuteStep(&hasResult);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -25427,31 +25424,31 @@ nsresult IndexGetRequestOp::DoDatabaseWo
 
   rv = stmt->BindInt64ByName(kStmtParamNameIndexId,
                              mMetadata->mCommonMetadata.id());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (hasKeyRange) {
-    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt);
+    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
     StructuredCloneReadInfo* cloneInfo = mResponse.AppendElement(fallible);
     if (NS_WARN_IF(!cloneInfo)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     rv = GetStructuredCloneReadInfoFromStatement(
-        stmt, 1, 0, mDatabase->GetFileManager(), cloneInfo);
+        &*stmt, 1, 0, mDatabase->GetFileManager(), cloneInfo);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     if (cloneInfo->mHasPreprocessInfo) {
       IDB_WARNING("Preprocessing for indexes not yet implemented!");
       return NS_ERROR_NOT_IMPLEMENTED;
     }
@@ -25596,30 +25593,30 @@ nsresult IndexGetKeyRequestOp::DoDatabas
 
   rv = stmt->BindInt64ByName(kStmtParamNameIndexId,
                              mMetadata->mCommonMetadata.id());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (hasKeyRange) {
-    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt);
+    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   while (NS_SUCCEEDED((rv = stmt->ExecuteStep(&hasResult))) && hasResult) {
     Key* key = mResponse.AppendElement(fallible);
     if (NS_WARN_IF(!key)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
-    rv = key->SetFromStatement(stmt, 0);
+    rv = key->SetFromStatement(&*stmt, 0);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -25686,17 +25683,17 @@ nsresult IndexCountRequestOp::DoDatabase
 
   rv = stmt->BindInt64ByName(kStmtParamNameIndexId,
                              mMetadata->mCommonMetadata.id());
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (hasKeyRange) {
-    rv = BindKeyRangeToStatement(mParams.optionalKeyRange().ref(), stmt);
+    rv = BindKeyRangeToStatement(mParams.optionalKeyRange().ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   rv = stmt->ExecuteStep(&hasResult);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -26158,34 +26155,34 @@ nsresult Cursor::OpenOp::DoObjectStoreDa
   }
 
   rv = stmt->BindInt64ByName(kStmtParamNameId, mCursor->mObjectStoreId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (usingKeyRange) {
-    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt);
+    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   rv = stmt->ExecuteStep(&hasResult);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (!hasResult) {
     mResponse = void_t();
     return NS_OK;
   }
 
-  rv = PopulateResponseFromStatement(stmt, true);
+  rv = PopulateResponseFromStatement(&*stmt, true);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Now we need to make the query for ContinueOp.
   PrepareKeyConditionClauses(kStmtParamNameKey, directionClause, queryStart);
 
   // The degree to which extra responses on OpenOp can actually be used depends
@@ -26193,17 +26190,17 @@ nsresult Cursor::OpenOp::DoObjectStoreDa
   // ContinueOp::DoDatabaseWork.
   //
   // TODO: We should somehow evaluate the effects of this. Maybe use a smaller
   // extra count that for ContinueOp?
   //
   // TODO: If this is done here, do this in the other Do*DatabaseWork functions
   // as well (or move this to DoDatabaseWork).
 
-  return PopulateExtraResponses(stmt, mCursor->mMaxExtraCount,
+  return PopulateExtraResponses(&*stmt, mCursor->mMaxExtraCount,
                                 NS_LITERAL_CSTRING("OpenOp"));
 }
 
 nsresult Cursor::OpenOp::DoObjectStoreKeyDatabaseWork(
     DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(mCursor);
@@ -26238,34 +26235,34 @@ nsresult Cursor::OpenOp::DoObjectStoreKe
   }
 
   rv = stmt->BindInt64ByName(kStmtParamNameId, mCursor->mObjectStoreId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (usingKeyRange) {
-    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt);
+    rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   rv = stmt->ExecuteStep(&hasResult);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (!hasResult) {
     mResponse = void_t();
     return NS_OK;
   }
 
-  rv = PopulateResponseFromStatement(stmt, true);
+  rv = PopulateResponseFromStatement(&*stmt, true);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Now we need to make the query to get the next match.
   PrepareKeyConditionClauses(kStmtParamNameKey, directionClause, queryStart);
 
   return NS_OK;
@@ -26353,20 +26350,20 @@ nsresult Cursor::OpenOp::DoIndexDatabase
 
   rv = stmt->BindInt64ByName(kStmtParamNameId, mCursor->mIndexId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (usingKeyRange) {
     if (mCursor->IsLocaleAware()) {
-      rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt,
+      rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt,
                                    mCursor->mLocale);
     } else {
-      rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt);
+      rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     }
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   rv = stmt->ExecuteStep(&hasResult);
@@ -26374,31 +26371,31 @@ nsresult Cursor::OpenOp::DoIndexDatabase
     return rv;
   }
 
   if (!hasResult) {
     mResponse = void_t();
     return NS_OK;
   }
 
-  rv = PopulateResponseFromStatement(stmt, true);
+  rv = PopulateResponseFromStatement(&*stmt, true);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Now we need to make the query to get the next match.
   PrepareIndexKeyConditionClause(kColumnNameAliasSortKey, directionClause,
                                  NS_LITERAL_CSTRING("index_table."),
                                  std::move(queryStart));
 
   // The degree to which extra responses on OpenOp can actually be used depends
   // on the parameters of subsequent ContinueOp operations, see also comment in
   // ContinueOp::DoDatabaseWork.
 
-  return PopulateExtraResponses(stmt, mCursor->mMaxExtraCount,
+  return PopulateExtraResponses(&*stmt, mCursor->mMaxExtraCount,
                                 NS_LITERAL_CSTRING("OpenOp"));
 }
 
 nsresult Cursor::OpenOp::DoIndexKeyDatabaseWork(
     DatabaseConnection* aConnection) {
   MOZ_ASSERT(aConnection);
   aConnection->AssertIsOnConnectionThread();
   MOZ_ASSERT(mCursor);
@@ -26468,20 +26465,20 @@ nsresult Cursor::OpenOp::DoIndexKeyDatab
 
   rv = stmt->BindInt64ByName(kStmtParamNameId, mCursor->mIndexId);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   if (usingKeyRange) {
     if (mCursor->IsLocaleAware()) {
-      rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt,
+      rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt,
                                    mCursor->mLocale);
     } else {
-      rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), stmt);
+      rv = BindKeyRangeToStatement(mOptionalKeyRange.ref(), &*stmt);
     }
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   bool hasResult;
   rv = stmt->ExecuteStep(&hasResult);
@@ -26489,17 +26486,17 @@ nsresult Cursor::OpenOp::DoIndexKeyDatab
     return rv;
   }
 
   if (!hasResult) {
     mResponse = void_t();
     return NS_OK;
   }
 
-  rv = PopulateResponseFromStatement(stmt, true);
+  rv = PopulateResponseFromStatement(&*stmt, true);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Now we need to make the query to get the next match.
   PrepareIndexKeyConditionClause(kColumnNameAliasSortKey, directionClause,
                                  NS_LITERAL_CSTRING(""), std::move(queryStart));
 
@@ -26697,43 +26694,43 @@ nsresult Cursor::ContinueOp::DoDatabaseW
   const int64_t id = isIndex ? mCursor->mIndexId : mCursor->mObjectStoreId;
 
   rv = stmt->BindInt64ByName(kStmtParamNameId, id);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Bind current key.
-  rv = currentKey.BindToStatement(stmt, kStmtParamNameCurrentKey);
+  rv = currentKey.BindToStatement(&*stmt, kStmtParamNameCurrentKey);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   // Bind range bound if it is specified.
   if (!mCursor->mLocaleAwareRangeBound.IsUnset()) {
     rv = mCursor->mLocaleAwareRangeBound.BindToStatement(
-        stmt, kStmtParamNameRangeBound);
+        &*stmt, kStmtParamNameRangeBound);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   // Bind object store position if duplicates are allowed and we're not
   // continuing to a specific key.
   if (isIndex && !hasContinueKey &&
       (mCursor->mDirection == IDBCursor::NEXT ||
        mCursor->mDirection == IDBCursor::PREV)) {
     rv = mCursor->mObjectStorePosition.BindToStatement(
-        stmt, kStmtParamNameObjectStorePosition);
+        &*stmt, kStmtParamNameObjectStorePosition);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   } else if (hasContinuePrimaryKey) {
     rv = mParams.get_ContinuePrimaryKeyParams().primaryKey().BindToStatement(
-        stmt, kStmtParamNameObjectStorePosition);
+        &*stmt, kStmtParamNameObjectStorePosition);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   // TODO: Why do we query the records we don't need and skip them here, rather
   // than using a OFFSET clause in the query?
   for (uint32_t index = 0; index < advanceCount; index++) {
@@ -26748,22 +26745,22 @@ nsresult Cursor::ContinueOp::DoDatabaseW
       mCursor->mLocaleAwarePosition.Unset();
       mCursor->mLocaleAwareRangeBound.Unset();
       mCursor->mObjectStorePosition.Unset();
       mResponse = void_t();
       return NS_OK;
     }
   }
 
-  rv = PopulateResponseFromStatement(stmt, true);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  return PopulateExtraResponses(stmt, maxExtraCount,
+  rv = PopulateResponseFromStatement(&*stmt, true);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
+
+  return PopulateExtraResponses(&*stmt, maxExtraCount,
                                 NS_LITERAL_CSTRING("ContinueOp"));
 }
 
 nsresult Cursor::ContinueOp::SendSuccessResult() {
   AssertIsOnOwningThread();
   MOZ_ASSERT(mCursor);
   MOZ_ASSERT(mCursor->mCurrentlyRunningOp == this);
   MOZ_ASSERT_IF(mResponse.type() == CursorResponse::Tvoid_t,