Title: [195801] trunk
Revision
195801
Author
beid...@apple.com
Date
2016-01-28 22:50:40 -0800 (Thu, 28 Jan 2016)

Log Message

Modern IDB: SQLite backend mismanages key generator values.
https://bugs.webkit.org/show_bug.cgi?id=153625

Reviewed by Andy Estes.

Source/WebCore:

No new tests (Many failing tests pass, a few get closer).

There's mixed assumptions about whether the value stored is the current value or the next value.

Fixing those assumptions fixes tests.

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber): Store/retrieve the correct value.
(WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber): Ditto.
(WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber): Ditto.

LayoutTests:

* platform/mac-wk1/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (195800 => 195801)


--- trunk/LayoutTests/ChangeLog	2016-01-29 05:37:44 UTC (rev 195800)
+++ trunk/LayoutTests/ChangeLog	2016-01-29 06:50:40 UTC (rev 195801)
@@ -1,3 +1,12 @@
+2016-01-28  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: SQLite backend mismanages key generator values.
+        https://bugs.webkit.org/show_bug.cgi?id=153625
+
+        Reviewed by Andy Estes.
+
+        * platform/mac-wk1/TestExpectations:
+
 2016-01-28  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: InspectorTimelineAgent doesn't need to recompile functions because it now uses the sampling profiler

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (195800 => 195801)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2016-01-29 05:37:44 UTC (rev 195800)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2016-01-29 06:50:40 UTC (rev 195801)
@@ -256,19 +256,12 @@
 # SQLite backend tests with text failures
 crypto/subtle/rsa-indexeddb-non-exportable.html [ Failure ]
 fast/history/page-cache-indexed-opened-db.html [ Failure ]
-imported/w3c/indexeddb/idbdatabase_deleteObjectStore4-not_reused.htm [ Failure ]
 imported/w3c/indexeddb/idbindex-multientry-big.htm [ Failure ]
-imported/w3c/indexeddb/keygenerator-constrainterror.htm [ Failure ]
-imported/w3c/indexeddb/keygenerator.htm [ Failure ]
-imported/w3c/indexeddb/transaction-requestqueue.htm [ Failure ]
 storage/indexeddb/cursor-continue-validity.html [ Failure ]
 storage/indexeddb/cursor-primary-key-order.html [ Failure ]
 storage/indexeddb/get-keyrange.html [ Failure ]
-storage/indexeddb/index-duplicate-keypaths.html [ Failure ]
-storage/indexeddb/key-generator.html [ Failure ]
 storage/indexeddb/modern/get-keyrange.html [ Failure ]
 storage/indexeddb/modern/index-3.html [ Failure ]
-storage/indexeddb/objectstore-autoincrement.html [ Failure ]
 
 # SQLite backend tests that timeout
 storage/indexeddb/modern/transaction-scheduler-1.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (195800 => 195801)


--- trunk/Source/WebCore/ChangeLog	2016-01-29 05:37:44 UTC (rev 195800)
+++ trunk/Source/WebCore/ChangeLog	2016-01-29 06:50:40 UTC (rev 195801)
@@ -1,3 +1,21 @@
+2016-01-28  Brady Eidson  <beid...@apple.com>
+
+        Modern IDB: SQLite backend mismanages key generator values.
+        https://bugs.webkit.org/show_bug.cgi?id=153625
+
+        Reviewed by Andy Estes.
+
+        No new tests (Many failing tests pass, a few get closer).
+
+        There's mixed assumptions about whether the value stored is the current value or the next value.
+
+        Fixing those assumptions fixes tests.
+        
+        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+        (WebCore::IDBServer::SQLiteIDBBackingStore::generateKeyNumber): Store/retrieve the correct value.
+        (WebCore::IDBServer::SQLiteIDBBackingStore::revertGeneratedKeyNumber): Ditto.
+        (WebCore::IDBServer::SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber): Ditto.
+
 2016-01-28  Joseph Pecoraro  <pecor...@apple.com>
 
         Web Inspector: InspectorTimelineAgent doesn't need to recompile functions because it now uses the sampling profiler

Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (195800 => 195801)


--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp	2016-01-29 05:37:44 UTC (rev 195800)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp	2016-01-29 06:50:40 UTC (rev 195801)
@@ -1356,7 +1356,7 @@
     if (!error.isNull())
         return error;
 
-    if (currentValue > maxGeneratorValue)
+    if (currentValue + 1 > maxGeneratorValue)
         return { IDBDatabaseException::ConstraintError, "Cannot generate new key value over 2^53 for object store operation" };
 
     generatedKey = currentValue + 1;
@@ -1365,7 +1365,7 @@
 
 IDBError SQLiteIDBBackingStore::revertGeneratedKeyNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, uint64_t newKeyNumber)
 {
-    LOG(IndexedDB, "SQLiteIDBBackingStore::revertGeneratedKeyNumber");
+    LOG(IndexedDB, "SQLiteIDBBackingStore::revertGeneratedKeyNumber - object store %" PRIu64 ", reverted number %" PRIu64, objectStoreID, newKeyNumber);
 
     ASSERT(m_sqliteDB);
     ASSERT(m_sqliteDB->isOpen());
@@ -1380,7 +1380,8 @@
         return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to revert key generator value in a read-only transaction") };
     }
 
-    return uncheckedSetKeyGeneratorValue(objectStoreID, newKeyNumber);
+    ASSERT(newKeyNumber);
+    return uncheckedSetKeyGeneratorValue(objectStoreID, newKeyNumber - 1);
 }
 
 IDBError SQLiteIDBBackingStore::maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, double newKeyNumber)
@@ -1414,7 +1415,7 @@
 
     ASSERT(newKeyInteger > uint64_t(newKeyNumber));
 
-    return uncheckedSetKeyGeneratorValue(objectStoreID, newKeyInteger);
+    return uncheckedSetKeyGeneratorValue(objectStoreID, newKeyInteger - 1);
 }
 
 IDBError SQLiteIDBBackingStore::openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo& info, IDBGetResult& result)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to