1 // Opens the database used in this test case
2 function openTestDatabase()
4 return openDatabaseWithSuffix("OpenDatabaseWhileTransactionInProgressTest",
6 "Test to make sure that calling openDatabase() while a transaction is in progress on a different handle to the same database does not result in a deadlock.",
7 2100000); // 2MB + epsilon
10 // See https://bugs.webkit.org/show_bug.cgi?id=28207
11 // In order to trigger this bug, the transaction must acquire an exclusive
12 // lock on the DB file before trying to obtain a second handle to the same DB.
13 // The only way to force SQLite to obtain an exclusive lock is to change more
14 // than cache_size * page_size bytes in the database. The default value for
15 // cache_size is 2000 pages, and the default page_size is 1024 bytes. So the
16 // size of the blob must be at least 2MB.
19 var db1 = openTestDatabase();
20 db1.transaction(function(tx) {
21 // Create the Test table if it does not exist
22 tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo BLOB);");
23 tx.executeSql("INSERT INTO Test VALUES (ZEROBLOB(2097152));", [],
25 var db2 = openTestDatabase();
26 log("openDatabase() succeeded.");
29 log("Executing statement failed: " + error.message);
32 // Clean up the DB to allow for repeated runs of this test
33 // without needing to increase the default allowed quota (5MB)
34 tx.executeSql("DELETE FROM Test;");
36 log("Transaction failed: " + error.message);
38 if (window.testRunner)
39 testRunner.notifyDone();