IDB: Pending setVersion call in worker prevents document from opening the db, even...
authordgrogan@chromium.org <dgrogan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Apr 2012 18:40:30 +0000 (18:40 +0000)
committerdgrogan@chromium.org <dgrogan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Apr 2012 18:40:30 +0000 (18:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83952

These two tests fail in DRT most proximately because DRT provides
different instances of IDBFactoryBackend to a document and worker:
https://bugs.webkit.org/show_bug.cgi?id=82776.

One fails in chromium because of a logic error tracked by
http://crbug.com/123418. The plan is to run them both as browser tests
when the logic is fixed, but just one in the meantime.

Also added SKIP for storage/indexeddb/dont-commit-on-blocked.html
since it also can't pass in DRT and just turns the flakiness dashboard
all red.

Reviewed by Ojan Vafai.

* platform/chromium/test_expectations.txt:
* storage/indexeddb/pending-version-change-stuck-expected.txt: Added.
* storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt: Added.
* storage/indexeddb/pending-version-change-stuck-works-with-terminate.html: Added.
* storage/indexeddb/pending-version-change-stuck.html: Added.
* storage/indexeddb/resources/pending-version-change-stuck.js: Added.
(test.request.onsuccess.request.onblocked):
(test.request.onsuccess):
(test):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114540 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/storage/indexeddb/pending-version-change-stuck-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/pending-version-change-stuck.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/resources/pending-version-change-stuck.js [new file with mode: 0644]

index 7e00cde..07c5d92 100644 (file)
@@ -1,3 +1,32 @@
+2012-04-18  David Grogan  <dgrogan@chromium.org>
+
+        IDB: Pending setVersion call in worker prevents document from opening the db, even after worker termination
+        https://bugs.webkit.org/show_bug.cgi?id=83952
+
+        These two tests fail in DRT most proximately because DRT provides
+        different instances of IDBFactoryBackend to a document and worker:
+        https://bugs.webkit.org/show_bug.cgi?id=82776.
+
+        One fails in chromium because of a logic error tracked by
+        http://crbug.com/123418. The plan is to run them both as browser tests
+        when the logic is fixed, but just one in the meantime.
+
+        Also added SKIP for storage/indexeddb/dont-commit-on-blocked.html
+        since it also can't pass in DRT and just turns the flakiness dashboard
+        all red.
+
+        Reviewed by Ojan Vafai.
+
+        * platform/chromium/test_expectations.txt:
+        * storage/indexeddb/pending-version-change-stuck-expected.txt: Added.
+        * storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt: Added.
+        * storage/indexeddb/pending-version-change-stuck-works-with-terminate.html: Added.
+        * storage/indexeddb/pending-version-change-stuck.html: Added.
+        * storage/indexeddb/resources/pending-version-change-stuck.js: Added.
+        (test.request.onsuccess.request.onblocked):
+        (test.request.onsuccess):
+        (test):
+
 2012-04-18  Luiz Agostini  <luiz.agostini@palm.com>
 
         matchMedia() MediaQueryList not updating
index 41b783f..1abf778 100644 (file)
@@ -3673,8 +3673,10 @@ BUGWK82717 SNOWLEOPARD : storage/quota-tracking.html = PASS TIMEOUT
 BUGWK82717 SNOWLEOPARD : storage/executesql-accepts-only-one-statement.html = PASS TIMEOUT
 BUGWK82717 SNOWLEOPARD : storage/database-lock-after-reload.html = PASS TIMEOUT
 
-// This test depends on Worker behavior that is broken in DRT
-BUGWK82776 : storage/indexeddb/dont-commit-on-blocked.html = PASS FAIL
+// These tests depends on Worker behavior that is broken in DRT
+BUGWK82776 SKIP : storage/indexeddb/dont-commit-on-blocked.html = PASS FAIL
+BUGWK82776 SKIP : storage/indexeddb/pending-version-change-stuck.html = PASS FAIL
+BUGWK82776 SKIP : storage/indexeddb/pending-version-change-stuck-works-with-terminate.html = PASS FAIL
 
 BUGWK WIN RELEASE : http/tests/xmlhttprequest/redirect-cross-origin-post.html = PASS TEXT
 
diff --git a/LayoutTests/storage/indexeddb/pending-version-change-stuck-expected.txt b/LayoutTests/storage/indexeddb/pending-version-change-stuck-expected.txt
new file mode 100644 (file)
index 0000000..1134ddb
--- /dev/null
@@ -0,0 +1,13 @@
+Implicitly terminating worker with blocked setVersion call should allow later open calls to proceed
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+request = indexedDB.open("pending-version-change-stuck.html")
+PASS Open worked after page reload.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt b/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate-expected.txt
new file mode 100644 (file)
index 0000000..f3b29b5
--- /dev/null
@@ -0,0 +1,13 @@
+Explicitly terminating worker with blocked setVersion call should allow later open calls to proceed
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+request = indexedDB.open("pending-version-change-stuck-works-with-terminate.html")
+PASS Open worked after page reload.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate.html b/LayoutTests/storage/indexeddb/pending-version-change-stuck-works-with-terminate.html
new file mode 100644 (file)
index 0000000..7b1d377
--- /dev/null
@@ -0,0 +1,51 @@
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<script>
+
+description("Explicitly terminating worker with blocked setVersion call should allow later open calls to proceed");
+
+function test()
+{
+    removeVendorPrefixes();
+    dbname = self.location.pathname.substring(1 + self.location.pathname.lastIndexOf("/"));
+    evalAndLog("request = indexedDB.open(\"" + dbname + "\")");
+    request.onblocked = unexpectedBlockedCallback;
+    request.onerror = unexpectedErrorCallback;
+    if (self.location.search == "?second") {
+        request.onsuccess = function() {
+            testPassed("Open worked after page reload.");
+            finishJSTest();
+        };
+    } else {
+        request.onsuccess = startTheWorker;
+    }
+}
+
+function startTheWorker()
+{
+    var worker = startWorker("resources/pending-version-change-stuck.js?" + encodeURI(dbname));
+    worker.onerror = function(e) {
+        testFailed(e.message);
+        finishJSTest();
+    };
+    originalOnMessage = worker.onmessage;
+    worker.onmessage = function(event) {
+        if (event.data == "gotblocked") {
+            worker.terminate();
+            self.location = self.location + "?second";
+        }
+        else
+            originalOnMessage(event);
+    };
+}
+
+test();
+
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/pending-version-change-stuck.html b/LayoutTests/storage/indexeddb/pending-version-change-stuck.html
new file mode 100644 (file)
index 0000000..a5d4ed5
--- /dev/null
@@ -0,0 +1,49 @@
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="resources/shared.js"></script>
+</head>
+<body>
+<script>
+
+description("Implicitly terminating worker with blocked setVersion call should allow later open calls to proceed");
+
+function test()
+{
+    removeVendorPrefixes();
+    dbname = self.location.pathname.substring(1 + self.location.pathname.lastIndexOf("/"));
+    evalAndLog("request = indexedDB.open(\"" + dbname + "\")");
+    request.onblocked = unexpectedBlockedCallback;
+    request.onerror = unexpectedErrorCallback;
+    if (self.location.search == "?second") {
+        request.onsuccess = function() {
+            testPassed("Open worked after page reload.");
+            finishJSTest();
+        };
+    } else {
+        request.onsuccess = startTheWorker;
+    }
+}
+
+function startTheWorker()
+{
+    var worker = startWorker("resources/pending-version-change-stuck.js?" + encodeURI(dbname));
+    worker.onerror = function(e) {
+        testFailed(e.message);
+        finishJSTest();
+    };
+    originalOnMessage = worker.onmessage;
+    worker.onmessage = function(event) {
+        if (event.data == "gotblocked")
+            self.location = self.location + "?second";
+        else
+            originalOnMessage(event);
+    };
+}
+
+test();
+
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/resources/pending-version-change-stuck.js b/LayoutTests/storage/indexeddb/resources/pending-version-change-stuck.js
new file mode 100644 (file)
index 0000000..ef455f6
--- /dev/null
@@ -0,0 +1,23 @@
+if (this.importScripts) {
+    importScripts('../../../fast/js/resources/js-test-pre.js');
+    importScripts('shared.js');
+}
+
+function test()
+{
+    removeVendorPrefixes();
+    dbname = decodeURI(self.location.search.substring(1));
+    evalAndLog("request = indexedDB.open(\"" + dbname + "\")");
+    request.onerror = unexpectedErrorCallback;
+    request.onsuccess = function(e) {
+        db = request.result;
+        evalAndLog("request = db.setVersion(1)");
+        request.onsuccess = unexpectedSuccessCallback;
+        request.onblocked = function() {
+            testPassed("worker received blocked event.");
+            postMessage("gotblocked");
+        };
+    };
+}
+
+test();