Web Inspector: fix debug WK1 test failures for WI.ObjectStore
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Nov 2018 19:12:45 +0000 (19:12 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Nov 2018 19:12:45 +0000 (19:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191158

Reviewed by Joseph Pecoraro.

* inspector/unit-tests/objectStore/delete.html:
* inspector/unit-tests/objectStore/deleteObject.html:
* inspector/unit-tests/objectStore/resources/objectStore-utilities.js:
(TestPage.registerInitializer):

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

LayoutTests/ChangeLog
LayoutTests/inspector/unit-tests/objectStore/delete.html
LayoutTests/inspector/unit-tests/objectStore/deleteObject.html
LayoutTests/inspector/unit-tests/objectStore/resources/objectStore-utilities.js

index 1125fe1..8406f91 100644 (file)
@@ -1,3 +1,15 @@
+2018-11-01  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: fix debug WK1 test failures for WI.ObjectStore
+        https://bugs.webkit.org/show_bug.cgi?id=191158
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/unit-tests/objectStore/delete.html:
+        * inspector/unit-tests/objectStore/deleteObject.html:
+        * inspector/unit-tests/objectStore/resources/objectStore-utilities.js:
+        (TestPage.registerInitializer):
+
 2018-11-01  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         [CG] Adopt CG SPI for non-even cornered rounded rects
index 185119e..5d59691 100644 (file)
@@ -27,7 +27,10 @@ function test()
         };
         let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
 
-        await InspectorTest.ObjectStore.add(InspectorTest.ObjectStore.basicObject2, 1);
+        try {
+            // This call may fail on WK1
+            await InspectorTest.ObjectStore.add(InspectorTest.ObjectStore.basicObject2, 1);
+        } catch { }
 
         await InspectorTest.expectException(async () => {
             await objectStore.delete();
index 7221bbb..8235bb2 100644 (file)
@@ -30,11 +30,16 @@ function test()
         };
         let objectStore = InspectorTest.ObjectStore.createObjectStore(options);
 
-        await InspectorTest.ObjectStore.add(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2), 1);
+        let object = new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2);
+
+        try {
+            // This call may fail on WK1
+            await InspectorTest.ObjectStore.add(object, 1);
+        } catch { }
 
         await InspectorTest.expectException(async () => {
             await objectStore.deleteObject();
-            await objectStore.deleteObject(new InspectorTest.ObjectStore.TestObject(InspectorTest.ObjectStore.basicObject2));
+            await objectStore.deleteObject(object);
         });
     });
 
index 1947800..adb4f6b 100644 (file)
@@ -86,7 +86,11 @@ TestPage.registerInitializer(() => {
                     WI.ObjectStore._database = null;
                 }
 
-                indexedDB.deleteDatabase(WI.ObjectStore._databaseName);
+                await new Promise((resolve, reject) => {
+                    let deleteDatabaseRequest = indexedDB.deleteDatabase(WI.ObjectStore._databaseName);
+                    deleteDatabaseRequest.addEventListener("success", resolve);
+                    deleteDatabaseRequest.addEventListener("error", reject);
+                });
             },
         });
     };