Changeset 184020 in webkit
- Timestamp:
- May 8, 2015, 3:56:33 PM (11 years ago)
- Location:
- branches/safari-600.1.4.16-branch
- Files:
-
- 5 edited
- 3 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/storage/websql/alter-to-info-table-expected.txt (copied) (copied from trunk/LayoutTests/storage/websql/alter-to-info-table-expected.txt )
-
LayoutTests/storage/websql/alter-to-info-table.html (copied) (copied from trunk/LayoutTests/storage/websql/alter-to-info-table.html )
-
LayoutTests/storage/websql/alter-to-info-table.js (copied) (copied from trunk/LayoutTests/storage/websql/alter-to-info-table.js )
-
LayoutTests/storage/websql/test-authorizer-expected.txt (modified) (2 diffs)
-
LayoutTests/storage/websql/test-authorizer.js (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-600.1.4.16-branch/LayoutTests/ChangeLog
r183519 r184020 1 2015-05-08 Babak Shafiei <bshafiei@apple.com> 2 3 Merge r183646. 4 5 2015-04-30 Brady Eidson <beidson@apple.com> 6 7 Javascript using WebSQL can create their own WebKit info table. 8 <rdar://problem/20688792> and https://bugs.webkit.org/show_bug.cgi?id=144466 9 10 Reviewed by Alex Christensen. 11 12 * storage/websql/alter-to-info-table-expected.txt: Added. 13 * storage/websql/alter-to-info-table.html: Added. 14 * storage/websql/alter-to-info-table.js: Added. 15 1 16 2015-04-28 Babak Shafiei <bshafiei@apple.com> 2 17 -
branches/safari-600.1.4.16-branch/LayoutTests/storage/websql/test-authorizer-expected.txt
r117816 r184020 16 16 SQLITE_ALTER_TABLE statement succeeded. 17 17 SQLITE_ALTER_TABLE statement succeeded. 18 SQLITE_ALTER_INFO_TABLE statement failed: could not prepare statement (23 not authorized) 19 SQLITE_ALTER_INFO_TABLE statement failed: could not prepare statement (23 not authorized) 20 SQLITE_ALTER_INFO_TABLE statement failed: could not prepare statement (1 there is already another table or index with this name: __WebKitDatabaseInfoTable__) 18 21 SQLITE_TRANSACTION statement failed: could not prepare statement (23 not authorized) 19 22 SQLITE_ATTACH statement failed: could not prepare statement (23 not authorized) … … 53 56 SQLITE_ALTER_TABLE statement failed: could not prepare statement (23 not authorized) 54 57 SQLITE_ALTER_TABLE statement failed: could not prepare statement (1 no such table: TestTable) 58 SQLITE_ALTER_INFO_TABLE statement failed: could not prepare statement (23 not authorized) 59 SQLITE_ALTER_INFO_TABLE statement failed: could not prepare statement (23 not authorized) 60 SQLITE_ALTER_INFO_TABLE statement failed: could not prepare statement (1 there is already another table or index with this name: __WebKitDatabaseInfoTable__) 55 61 SQLITE_TRANSACTION statement failed: could not prepare statement (23 not authorized) 56 62 SQLITE_ATTACH statement failed: could not prepare statement (23 not authorized) -
branches/safari-600.1.4.16-branch/LayoutTests/storage/websql/test-authorizer.js
r120516 r184020 73 73 // Rename the table back to its original name 74 74 executeStatement(tx, "ALTER TABLE TestTable RENAME To Test;", "SQLITE_ALTER_TABLE"); 75 76 // These should always fail, as nobody gets to mess with the info table. 77 executeStatement(tx, "ALTER TABLE __WebKitDatabaseInfoTable__ RENAME TO TestTable;", "SQLITE_ALTER_INFO_TABLE"); 78 executeStatement(tx, "ALTER TABLE main.__WebKitDatabaseInfoTable__ RENAME TO TestTable;", "SQLITE_ALTER_INFO_TABLE"); 79 executeStatement(tx, "ALTER TABLE Test RENAME TO __WebKitDatabaseInfoTable__;", "SQLITE_ALTER_INFO_TABLE"); 75 80 76 81 executeStatement(tx, "BEGIN TRANSACTION;", "SQLITE_TRANSACTION"); -
branches/safari-600.1.4.16-branch/Source/WebCore/ChangeLog
r183519 r184020 1 2015-05-08 Babak Shafiei <bshafiei@apple.com> 2 3 Merge r183646. 4 5 2015-04-30 Brady Eidson <beidson@apple.com> 6 7 Javascript using WebSQL can create their own WebKit info table. 8 <rdar://problem/20688792> and https://bugs.webkit.org/show_bug.cgi?id=144466 9 10 Reviewed by Alex Christensen. 11 12 Test: storage/websql/alter-to-info-table.html 13 14 * Modules/webdatabase/DatabaseBackendBase.cpp: 15 (WebCore::DatabaseBackendBase::databaseInfoTableName): Return the info table name. 16 (WebCore::fullyQualifiedInfoTableName): Append "main." to the info table name. 17 (WebCore::DatabaseBackendBase::DatabaseBackendBase): Use the fully qualified name. 18 (WebCore::DatabaseBackendBase::performOpenAndVerify): Ditto. 19 (WebCore::DatabaseBackendBase::getVersionFromDatabase): Ditto. 20 (WebCore::DatabaseBackendBase::setVersionInDatabase): Ditto. 21 1 22 2015-04-28 Babak Shafiei <bshafiei@apple.com> 2 23 -
branches/safari-600.1.4.16-branch/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp
r169518 r184020 86 86 87 87 static const char versionKey[] = "WebKitDatabaseVersionKey"; 88 static const char infoTableName[] = "__WebKitDatabaseInfoTable__"; 88 static const char unqualifiedInfoTableName[] = "__WebKitDatabaseInfoTable__"; 89 90 const char* DatabaseBackendBase::databaseInfoTableName() 91 { 92 return unqualifiedInfoTableName; 93 } 94 95 static const char* fullyQualifiedInfoTableName() 96 { 97 static const char qualifier[] = "main."; 98 static char qualifiedName[sizeof(qualifier) + sizeof(unqualifiedInfoTableName) - 1]; 99 100 static std::once_flag onceFlag; 101 std::call_once(onceFlag, []{ 102 char* newDestination = stpcpy(qualifiedName, qualifier); 103 strcpy(newDestination, unqualifiedInfoTableName); 104 }); 105 106 return qualifiedName; 107 } 89 108 90 109 static String formatErrorMessage(const char* message, int sqliteErrorCode, const char* sqliteErrorMessage) … … 193 212 194 213 return guid; 195 }196 197 // static198 const char* DatabaseBackendBase::databaseInfoTableName()199 {200 return infoTableName;201 214 } 202 215 … … 221 234 m_contextThreadSecurityOrigin = m_databaseContext->securityOrigin()->isolatedCopy(); 222 235 223 m_databaseAuthorizer = DatabaseAuthorizer::create( infoTableName);236 m_databaseAuthorizer = DatabaseAuthorizer::create(unqualifiedInfoTableName); 224 237 225 238 if (m_name.isNull()) … … 351 364 } 352 365 353 String tableName( infoTableName);366 String tableName(unqualifiedInfoTableName); 354 367 if (!m_sqliteDatabase.tableExists(tableName)) { 355 368 m_new = true; … … 450 463 bool DatabaseBackendBase::getVersionFromDatabase(String& version, bool shouldCacheVersion) 451 464 { 452 String query(String("SELECT value FROM ") + infoTableName+ " WHERE key = '" + versionKey + "';");465 String query(String("SELECT value FROM ") + fullyQualifiedInfoTableName() + " WHERE key = '" + versionKey + "';"); 453 466 454 467 m_databaseAuthorizer->disable(); … … 470 483 // The INSERT will replace an existing entry for the database with the new version number, due to the UNIQUE ON CONFLICT REPLACE 471 484 // clause in the CREATE statement (see Database::performOpenAndVerify()). 472 String query(String("INSERT INTO ") + infoTableName+ " (key, value) VALUES ('" + versionKey + "', ?);");485 String query(String("INSERT INTO ") + fullyQualifiedInfoTableName() + " (key, value) VALUES ('" + versionKey + "', ?);"); 473 486 474 487 m_databaseAuthorizer->disable();
Note:
See TracChangeset
for help on using the changeset viewer.