Title: [233599] trunk/LayoutTests
Revision
233599
Author
[email protected]
Date
2018-07-06 15:54:38 -0700 (Fri, 06 Jul 2018)

Log Message

This test is flaky. This unreviewed patch is my attempt to make it less so.

* storage/indexeddb/modern/opendatabase-after-storage-crash.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (233598 => 233599)


--- trunk/LayoutTests/ChangeLog	2018-07-06 22:23:56 UTC (rev 233598)
+++ trunk/LayoutTests/ChangeLog	2018-07-06 22:54:38 UTC (rev 233599)
@@ -1,3 +1,9 @@
+2018-07-06  Brady Eidson  <[email protected]>
+
+        This test is flaky. This unreviewed patch is my attempt to make it less so.
+
+        * storage/indexeddb/modern/opendatabase-after-storage-crash.html:
+
 2018-07-06  David Fenton  <[email protected]>
 
         Layout Test imported/w3c/web-platform-tests/IndexedDB/interfaces.any.worker.html is flaky.

Modified: trunk/LayoutTests/storage/indexeddb/modern/opendatabase-after-storage-crash.html (233598 => 233599)


--- trunk/LayoutTests/storage/indexeddb/modern/opendatabase-after-storage-crash.html	2018-07-06 22:23:56 UTC (rev 233598)
+++ trunk/LayoutTests/storage/indexeddb/modern/opendatabase-after-storage-crash.html	2018-07-06 22:54:38 UTC (rev 233599)
@@ -11,11 +11,12 @@
 {
 	var request = window.indexedDB.open(dbname, 2);
 	request._onupgradeneeded_ = function(e) {
-		document.body.innerHTML = "openDatabase call after storage process termination should not have succeeded";
+		document.body.innerHTML = "openDatabase call after storage process termination should not have resulted in upgradeneeded";
 		if (window.testRunner)
 			testRunner.notifyDone();
 
 	}
+	
 	request._onerror_ = function(e) {
 		// Good, we received an expected error.
 		// Now reload to see if a new document connects successfully
@@ -23,11 +24,18 @@
 			document.body.innerHTML = "Should not have reached this code twice!";
 			if (window.testRunner)
 				testRunner.notifyDone();
+			return;
 		}
 		
 		sessionStorage[location.href] = "Made it";
 		location.reload();
 	}
+
+	request._onsuccess_ = function(e) {
+		document.body.innerHTML = "Unexpected success during the second database open after document load. " + sessionStorage[location.href];
+		if (window.testRunner)
+			testRunner.notifyDone();
+	}
 }
 
 var request = window.indexedDB.open(dbname, 1);
@@ -43,11 +51,12 @@
 	
 	sessionStorage.finishedFirstOpen = true;
 	
-	if (window.testRunner) {
+	if (window.testRunner)
 		testRunner.terminateStorageProcess();
-		// One spin of the runloop is *ALMOST* always enough delay here.
-		// Padding it makes this reliable.
-		setTimeout(continueTest, 10);
+
+	// Set an error handler on the database connection so once the storage process terminates we know to continue the test
+	e.target.result._onerror_ = function(e) {
+		setTimeout(continueTest, 0);
 	}
 }
 
@@ -54,7 +63,13 @@
 request._onerror_ = function(e) {
 	document.body.innerHTML = "Unexpected error during the first database open on document load. " + sessionStorage[location.href];
 	if (window.testRunner)
-		testRunner.notifyDone();	
+		testRunner.notifyDone();
 }
 
+request._onsuccess_ = function(e) {
+	document.body.innerHTML = "Unexpected success during the first database open on document load. " + sessionStorage[location.href];
+	if (window.testRunner)
+		testRunner.notifyDone();
+}
+
 </script>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to