Title: [185619] tags/Safari-601.1.35.2/Source/WebKit2
- Revision
- 185619
- Author
- [email protected]
- Date
- 2015-06-16 15:17:28 -0700 (Tue, 16 Jun 2015)
Log Message
Merged r185599. rdar://problem/17357002
Modified Paths
Diff
Modified: tags/Safari-601.1.35.2/Source/WebKit2/ChangeLog (185618 => 185619)
--- tags/Safari-601.1.35.2/Source/WebKit2/ChangeLog 2015-06-16 22:13:19 UTC (rev 185618)
+++ tags/Safari-601.1.35.2/Source/WebKit2/ChangeLog 2015-06-16 22:17:28 UTC (rev 185619)
@@ -1,3 +1,22 @@
+2015-06-16 Babak Shafiei <[email protected]>
+
+ Merge r185599.
+
+ 2015-06-16 Brady Eidson <[email protected]>
+
+ IDB: Records table migration doesn't work with all versions of SQLite.
+ https://bugs.webkit.org/show_bug.cgi?id=145993
+
+ Reviewed by Darin Adler, provisionally reviewed by Jon Lee.
+
+ * DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp:
+ (WebKit::v1RecordsTableSchema):
+ (WebKit::v1RecordsTableSchemaAlternate):
+ (WebKit::v2RecordsTableSchema):
+ (WebKit::v2RecordsTableSchemaAlternate):
+ (WebKit::createOrMigrateRecordsTableIfNecessary): Check both v1 and v1 Alternate whenever we check for the v1 schema.
+ Ditto for the v2 schema. Crash all builds if the current schema is none of these.
+
2015-06-15 Matthew Hanson <[email protected]>
Merge r185487. rdar://problem/21277462
Modified: tags/Safari-601.1.35.2/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp (185618 => 185619)
--- tags/Safari-601.1.35.2/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp 2015-06-16 22:13:19 UTC (rev 185618)
+++ tags/Safari-601.1.35.2/Source/WebKit2/DatabaseProcess/IndexedDB/sqlite/UniqueIDBDatabaseBackingStoreSQLite.cpp 2015-06-16 22:17:28 UTC (rev 185619)
@@ -54,20 +54,26 @@
// Current version of the metadata schema being used in the metadata database.
static const int currentMetadataVersion = 1;
+static const String v1RecordsTableSchema(const String& tableName)
+{
+ return makeString("CREATE TABLE ", tableName, " (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, value NOT NULL ON CONFLICT FAIL)");
+}
+
static const String& v1RecordsTableSchema()
{
- static NeverDestroyed<WTF::String> v1RecordsTableSchemaString(ASCIILiteral(
- "CREATE TABLE Records (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, value NOT NULL ON CONFLICT FAIL)"));
+ static NeverDestroyed<WTF::String> v1RecordsTableSchemaString(v1RecordsTableSchema("Records"));
return v1RecordsTableSchemaString;
}
+static const String& v1RecordsTableSchemaAlternate()
+{
+ static NeverDestroyed<WTF::String> v1RecordsTableSchemaString(v1RecordsTableSchema("\"Records\""));
+ return v1RecordsTableSchemaString;
+}
+
static const String v2RecordsTableSchema(const String& tableName)
{
- StringBuilder builder;
- builder.appendLiteral("CREATE TABLE ");
- builder.append(tableName);
- builder.appendLiteral(" (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL, value NOT NULL ON CONFLICT FAIL)");
- return builder.toString();
+ return makeString("CREATE TABLE ", tableName, " (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL, value NOT NULL ON CONFLICT FAIL)");
}
static const String& v2RecordsTableSchema()
@@ -76,6 +82,12 @@
return v2RecordsTableSchemaString;
}
+static const String& v2RecordsTableSchemaAlternate()
+{
+ static NeverDestroyed<WTF::String> v2RecordsTableSchemaString(v2RecordsTableSchema("\"Records\""));
+ return v2RecordsTableSchemaString;
+}
+
static int64_t generateDatabaseId()
{
static int64_t databaseID = 0;
@@ -140,14 +152,13 @@
ASSERT(!currentSchema.isEmpty());
// If the schema in the backing store is the current schema, we're done.
- if (currentSchema == v2RecordsTableSchema())
+ if (currentSchema == v2RecordsTableSchema() || currentSchema == v2RecordsTableSchemaAlternate())
return true;
- // Currently the Records table should only be one of either the v1 or v2 schemas.
- if (currentSchema != v1RecordsTableSchema()) {
- ASSERT_NOT_REACHED();
- return false;
- }
+ // If the record table is not the current schema then it must be one of the previous schemas.
+ // If it is not then the database is in an unrecoverable state and this should be considered a fatal error.
+ if (currentSchema != v1RecordsTableSchema() && currentSchema != v1RecordsTableSchemaAlternate())
+ RELEASE_ASSERT_NOT_REACHED();
SQLiteTransaction transaction(database);
transaction.begin();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes