OLD | NEW |
| (Empty) |
1 function openTestDatabase() | |
2 { | |
3 return openDatabaseSync("OpenDatabaseWhileTransactionInProgressTest", | |
4 "1.0", | |
5 "Test to make sure that calling openDatabase() while
a transaction is in progress on a different handle to the same database does no
t result in a deadlock.", | |
6 2100000); // 2MB + epsilon | |
7 } | |
8 | |
9 // See https://bugs.webkit.org/show_bug.cgi?id=28207 | |
10 // In order to trigger this bug, the transaction must acquire an exclusive | |
11 // lock on the DB file before trying to obtain a second handle to the same DB. | |
12 // The only way to force SQLite to obtain an exclusive lock is to change more | |
13 // than cache_size * page_size bytes in the database. The default value for | |
14 // cache_size is 2000 pages, and the default page_size is 1024 bytes. So the | |
15 // size of the blob must be at least 2MB. | |
16 var db1 = openTestDatabase(); | |
17 db1.transaction(function(tx) { | |
18 tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo BLOB);"); | |
19 tx.executeSql("INSERT INTO Test VALUES (ZEROBLOB(2097152));"); | |
20 var db2 = openTestDatabase(); | |
21 postMessage("PASS: second handle opened successfully."); | |
22 | |
23 // Clean up the DB to allow for repeated runs of this test | |
24 // without needing to increase the default allowed quota (5MB) | |
25 tx.executeSql("DELETE FROM Test;"); | |
26 }); | |
27 | |
28 postMessage("done"); | |
OLD | NEW |