Changeset 183646 in webkit
- Timestamp:
- Apr 30, 2015, 3:15:29 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/storage/websql/alter-to-info-table-expected.txt (added)
-
LayoutTests/storage/websql/alter-to-info-table.html (added)
-
LayoutTests/storage/websql/alter-to-info-table.js (added)
-
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
-
trunk/LayoutTests/ChangeLog
r183644 r183646 1 2015-04-30 Brady Eidson <beidson@apple.com> 2 3 Javascript using WebSQL can create their own WebKit info table. 4 <rdar://problem/20688792> and https://bugs.webkit.org/show_bug.cgi?id=144466 5 6 Reviewed by Alex Christensen. 7 8 * storage/websql/alter-to-info-table-expected.txt: Added. 9 * storage/websql/alter-to-info-table.html: Added. 10 * storage/websql/alter-to-info-table.js: Added. 11 1 12 2015-04-30 Martin Robinson <mrobinson@igalia.com> 2 13 -
trunk/LayoutTests/storage/websql/test-authorizer-expected.txt
r117816 r183646 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) -
trunk/LayoutTests/storage/websql/test-authorizer.js
r120516 r183646 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"); -
trunk/Source/WebCore/ChangeLog
r183645 r183646 1 2015-04-30 Brady Eidson <beidson@apple.com> 2 3 Javascript using WebSQL can create their own WebKit info table. 4 <rdar://problem/20688792> and https://bugs.webkit.org/show_bug.cgi?id=144466 5 6 Reviewed by Alex Christensen. 7 8 Test: storage/websql/alter-to-info-table.html 9 10 * Modules/webdatabase/DatabaseBackendBase.cpp: 11 (WebCore::DatabaseBackendBase::databaseInfoTableName): Return the info table name. 12 (WebCore::fullyQualifiedInfoTableName): Append "main." to the info table name. 13 (WebCore::DatabaseBackendBase::DatabaseBackendBase): Use the fully qualified name. 14 (WebCore::DatabaseBackendBase::performOpenAndVerify): Ditto. 15 (WebCore::DatabaseBackendBase::getVersionFromDatabase): Ditto. 16 (WebCore::DatabaseBackendBase::setVersionInDatabase): Ditto. 17 1 18 2015-04-30 Beth Dakin <bdakin@apple.com> 2 19 -
trunk/Source/WebCore/Modules/webdatabase/DatabaseBackendBase.cpp
r182365 r183646 83 83 84 84 static const char versionKey[] = "WebKitDatabaseVersionKey"; 85 static const char infoTableName[] = "__WebKitDatabaseInfoTable__"; 85 static const char unqualifiedInfoTableName[] = "__WebKitDatabaseInfoTable__"; 86 87 const char* DatabaseBackendBase::databaseInfoTableName() 88 { 89 return unqualifiedInfoTableName; 90 } 91 92 static const char* fullyQualifiedInfoTableName() 93 { 94 static const char qualifier[] = "main."; 95 static char qualifiedName[sizeof(qualifier) + sizeof(unqualifiedInfoTableName) - 1]; 96 97 static std::once_flag onceFlag; 98 std::call_once(onceFlag, []{ 99 char* newDestination = stpcpy(qualifiedName, qualifier); 100 strcpy(newDestination, unqualifiedInfoTableName); 101 }); 102 103 return qualifiedName; 104 } 86 105 87 106 static String formatErrorMessage(const char* message, int sqliteErrorCode, const char* sqliteErrorMessage) … … 189 208 190 209 return guid; 191 }192 193 // static194 const char* DatabaseBackendBase::databaseInfoTableName()195 {196 return infoTableName;197 210 } 198 211 … … 215 228 m_contextThreadSecurityOrigin = m_databaseContext->securityOrigin()->isolatedCopy(); 216 229 217 m_databaseAuthorizer = DatabaseAuthorizer::create( infoTableName);230 m_databaseAuthorizer = DatabaseAuthorizer::create(unqualifiedInfoTableName); 218 231 219 232 if (m_name.isNull()) … … 345 358 } 346 359 347 String tableName( infoTableName);360 String tableName(unqualifiedInfoTableName); 348 361 if (!m_sqliteDatabase.tableExists(tableName)) { 349 362 m_new = true; … … 444 457 bool DatabaseBackendBase::getVersionFromDatabase(String& version, bool shouldCacheVersion) 445 458 { 446 String query(String("SELECT value FROM ") + infoTableName+ " WHERE key = '" + versionKey + "';");459 String query(String("SELECT value FROM ") + fullyQualifiedInfoTableName() + " WHERE key = '" + versionKey + "';"); 447 460 448 461 m_databaseAuthorizer->disable(); … … 464 477 // The INSERT will replace an existing entry for the database with the new version number, due to the UNIQUE ON CONFLICT REPLACE 465 478 // clause in the CREATE statement (see Database::performOpenAndVerify()). 466 String query(String("INSERT INTO ") + infoTableName+ " (key, value) VALUES ('" + versionKey + "', ?);");479 String query(String("INSERT INTO ") + fullyQualifiedInfoTableName() + " (key, value) VALUES ('" + versionKey + "', ?);"); 467 480 468 481 m_databaseAuthorizer->disable();
Note:
See TracChangeset
for help on using the changeset viewer.