WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch #2: terminate workers in the middle of DB operations
patch (text/plain), 6.50 KB, created by
Dumitru Daniliuc
on 2010-09-30 23:16:41 PDT
(
hide
)
Description:
patch #2: terminate workers in the middle of DB operations
Filename:
MIME Type:
Creator:
Dumitru Daniliuc
Created:
2010-09-30 23:16:41 PDT
Size:
6.50 KB
patch
obsolete
>Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 68864) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2010-09-30 Dumitru Daniliuc <dumi@chromium.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test that workers can be successfully interrupted in the middle of DB operations. >+ >+ * fast/workers/storage/interrupt-database-expected.txt: Added. >+ * fast/workers/storage/interrupt-database-sync-expected.txt: Added. >+ * fast/workers/storage/interrupt-database-sync.html: Added. >+ * fast/workers/storage/interrupt-database.html: Added. >+ * fast/workers/storage/resources/interrupt-database-sync.js: Added. >+ * fast/workers/storage/resources/interrupt-database.js: Added. >+ (runTransaction): >+ > 2010-09-30 Kent Tamura <tkent@chromium.org> > > Unreviewed, test expectation update. >Index: LayoutTests/fast/workers/storage/interrupt-database-expected.txt >=================================================================== >--- LayoutTests/fast/workers/storage/interrupt-database-expected.txt (revision 0) >+++ LayoutTests/fast/workers/storage/interrupt-database-expected.txt (revision 0) >@@ -0,0 +1,3 @@ >+This test makes sure that all async database operations are immediately interrupted when the worker needs to terminate. >+PASS: database operations interrupted. >+ >Index: LayoutTests/fast/workers/storage/interrupt-database-sync-expected.txt >=================================================================== >--- LayoutTests/fast/workers/storage/interrupt-database-sync-expected.txt (revision 0) >+++ LayoutTests/fast/workers/storage/interrupt-database-sync-expected.txt (revision 0) >@@ -0,0 +1,5 @@ >+CONSOLE MESSAGE: line 7: DATABASE_ERR: DOM SQL Exception 1: The operation failed for some reason related to the database. >+CONSOLE MESSAGE: line 11: UNKNOWN_ERR: DOM SQL Exception 0: The operation failed for reasons unrelated to the database. >+This test makes sure that all sync database operations are immediately interrupted when the worker needs to terminate. >+PASS: database operations interrupted. >+ >Index: LayoutTests/fast/workers/storage/interrupt-database-sync.html >=================================================================== >--- LayoutTests/fast/workers/storage/interrupt-database-sync.html (revision 0) >+++ LayoutTests/fast/workers/storage/interrupt-database-sync.html (revision 0) >@@ -0,0 +1,48 @@ >+<html> >+<head> >+<script src="../resources/worker-util.js"></script> >+<script> >+var worker; >+ >+function log(message) >+{ >+ document.getElementById("console").innerHTML += message + "<br>"; >+} >+ >+function finishTest() >+{ >+ log("PASS: database operations interrupted."); >+ if (window.layoutTestController) >+ layoutTestController.notifyDone(); >+} >+ >+function terminateWorker() >+{ >+ worker.terminate(); >+ waitUntilWorkerThreadsExit(finishTest) >+} >+ >+function runTest() >+{ >+ if (window.layoutTestController) { >+ layoutTestController.dumpAsText(); >+ layoutTestController.waitUntilDone(); >+ } >+ >+ worker = new Worker('resources/interrupt-database-sync.js'); >+ worker.onmessage = function(event) { >+ if (event.data == "terminate") >+ terminateWorker(); >+ else >+ log(event.data); >+ }; >+} >+</script> >+</head> >+ >+<body onload="runTest()"> >+This test makes sure that all sync database operations are immediately interrupted when the worker needs to terminate. >+<pre id="console"> >+</pre> >+</body> >+</html> >Index: LayoutTests/fast/workers/storage/interrupt-database.html >=================================================================== >--- LayoutTests/fast/workers/storage/interrupt-database.html (revision 0) >+++ LayoutTests/fast/workers/storage/interrupt-database.html (revision 0) >@@ -0,0 +1,48 @@ >+<html> >+<head> >+<script src="../resources/worker-util.js"></script> >+<script> >+var worker; >+ >+function log(message) >+{ >+ document.getElementById("console").innerHTML += message + "<br>"; >+} >+ >+function finishTest() >+{ >+ log("PASS: database operations interrupted."); >+ if (window.layoutTestController) >+ layoutTestController.notifyDone(); >+} >+ >+function terminateWorker() >+{ >+ worker.terminate(); >+ waitUntilWorkerThreadsExit(finishTest) >+} >+ >+function runTest() >+{ >+ if (window.layoutTestController) { >+ layoutTestController.dumpAsText(); >+ layoutTestController.waitUntilDone(); >+ } >+ >+ worker = new Worker('resources/interrupt-database.js'); >+ worker.onmessage = function(event) { >+ if (event.data == "terminate") >+ terminateWorker(); >+ else >+ log(event.data); >+ }; >+} >+</script> >+</head> >+ >+<body onload="runTest()"> >+This test makes sure that all async database operations are immediately interrupted when the worker needs to terminate. >+<pre id="console"> >+</pre> >+</body> >+</html> >Index: LayoutTests/fast/workers/storage/resources/interrupt-database-sync.js >=================================================================== >--- LayoutTests/fast/workers/storage/resources/interrupt-database-sync.js (revision 0) >+++ LayoutTests/fast/workers/storage/resources/interrupt-database-sync.js (revision 0) >@@ -0,0 +1,11 @@ >+var db = openDatabaseSync("InterruptDatabaseSyncTest", "1", "", 1); >+db.transaction(function(tx) { >+ tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo INT)"); >+ var counter = 0; >+ while (true) { >+ // Put both statements on the same line, to make sure the exception is always reported on the same line. >+ tx.executeSql("INSERT INTO Test VALUES (1)"); tx.executeSql("DELETE FROM Test WHERE Foo = 1"); >+ if (++counter == 100) >+ postMessage("terminate"); >+ } >+}); >Index: LayoutTests/fast/workers/storage/resources/interrupt-database.js >=================================================================== >--- LayoutTests/fast/workers/storage/resources/interrupt-database.js (revision 0) >+++ LayoutTests/fast/workers/storage/resources/interrupt-database.js (revision 0) >@@ -0,0 +1,19 @@ >+var counter = 0; >+function runTransaction() >+{ >+ db.transaction(function(tx) { >+ tx.executeSql("INSERT INTO Test VALUES (1)"); >+ tx.executeSql("DELETE FROM Test WHERE Foo = 1"); >+ if (++counter == 100) >+ postMessage("terminate"); >+ }, null, runTransaction); >+} >+ >+var db = openDatabase("InterruptDatabaseTest", "1", "", 1); >+db.transaction(function(tx) { >+ tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo INT)"); >+}, function(error) { >+ postMessage("Error: " + error.message); >+}, function() { >+ runTransaction(); >+});
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
levin
:
review+
dumi
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 36847
:
69424
| 69425 |
69427