Title: [135868] trunk/LayoutTests
Revision
135868
Author
[email protected]
Date
2012-11-27 09:45:23 -0800 (Tue, 27 Nov 2012)

Log Message

IndexedDB: Make test resilient to different event ordering
https://bugs.webkit.org/show_bug.cgi?id=103344

Reviewed by Tony Chang.

This test was failing in multi-process chromium because the blocked
event can arrive before the versionchange event.

* storage/indexeddb/pending-version-change-on-exit.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (135867 => 135868)


--- trunk/LayoutTests/ChangeLog	2012-11-27 17:40:52 UTC (rev 135867)
+++ trunk/LayoutTests/ChangeLog	2012-11-27 17:45:23 UTC (rev 135868)
@@ -1,3 +1,15 @@
+2012-11-27  David Grogan  <[email protected]>
+
+        IndexedDB: Make test resilient to different event ordering
+        https://bugs.webkit.org/show_bug.cgi?id=103344
+
+        Reviewed by Tony Chang.
+
+        This test was failing in multi-process chromium because the blocked
+        event can arrive before the versionchange event.
+
+        * storage/indexeddb/pending-version-change-on-exit.html:
+
 2012-11-27  Min Qin  <[email protected]>
 
         Don't throw an exception if user gesture is required for load

Modified: trunk/LayoutTests/storage/indexeddb/pending-version-change-on-exit.html (135867 => 135868)


--- trunk/LayoutTests/storage/indexeddb/pending-version-change-on-exit.html	2012-11-27 17:40:52 UTC (rev 135867)
+++ trunk/LayoutTests/storage/indexeddb/pending-version-change-on-exit.html	2012-11-27 17:45:23 UTC (rev 135868)
@@ -12,6 +12,7 @@
   testPassed("Didn't crash!");
   finishJSTest();
 } else {
+  evalAndLog("workerGotBlocked = false");
   evalAndLog("gotVersionChangeEvent = false");
   indexedDBTest(prepareDatabase, startTheWorker);
 }
@@ -21,14 +22,11 @@
   debug("inside prepareDatabase");
   preamble();
   db = event.target.result;
-  db._onversionchange_ = function(e) {
-    evalAndLog("gotVersionChangeEvent = true");
-    debug("Got a version change event, e.oldVersion = " + e.oldVersion +
-          " e.newVersion = " + e.newVersion);
-  };
+  db._onversionchange_ = onVersionChange;
 }
 
-function startTheWorker() {
+function startTheWorker()
+{
   var worker = startWorker("resources/pending-version-change-on-exit.js?" + encodeURIComponent(dbname));
   realFinishJSTest = finishJSTest;
   worker._onerror_ = function(e) {
@@ -36,13 +34,23 @@
     realFinishJSTest();
   };
   finishJSTest = function() {
-    shouldBeTrue("gotVersionChangeEvent");
-    if (gotVersionChangeEvent)
-      self.location = self.location + "?second";
-    else
-      realFinishJSTest();
+    workerGotBlocked = true;
+    maybeReload();
   }
 }
+
+function onVersionChange(e)
+{
+  gotVersionChangeEvent = true;
+  maybeReload();
+};
+
+function maybeReload()
+{
+  if (gotVersionChangeEvent && workerGotBlocked)
+    self.location = self.location + "?second";
+};
+
 </script>
 <script src=""
 </body>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to