[ iOS Debug and Mojave Debug ] http/tests/storage/storage-map-leaking.html is flaky timing out.
https://bugs.webkit.org/show_bug.cgi?id=213795
<rdar://problem/64937993>

Reviewed by Darin Adler.

Because our GC is conservative, a particular JS wrapper is not guaranteed to go away in a timely fashion.
To try and make the test more reliable, we now use 4 separate Storage wrappers instead of a single one.
We treat the test as passing if any of the 4 storage wrappers go away after removing the 4 subframes from
4 separate origins.

* http/tests/storage/storage-map-leaking.html:
* platform/ios-wk2/TestExpectations:
* platform/mac-wk2/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@263822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2158f4f..891554f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2020-07-01  Chris Dumez  <cdumez@apple.com>
+
+        [ iOS Debug and Mojave Debug ] http/tests/storage/storage-map-leaking.html is flaky timing out.
+        https://bugs.webkit.org/show_bug.cgi?id=213795
+        <rdar://problem/64937993>
+
+        Reviewed by Darin Adler.
+
+        Because our GC is conservative, a particular JS wrapper is not guaranteed to go away in a timely fashion.
+        To try and make the test more reliable, we now use 4 separate Storage wrappers instead of a single one.
+        We treat the test as passing if any of the 4 storage wrappers go away after removing the 4 subframes from
+        4 separate origins.
+
+        * http/tests/storage/storage-map-leaking.html:
+        * platform/ios-wk2/TestExpectations:
+        * platform/mac-wk2/TestExpectations:
+
 2020-07-01  Youenn Fablet  <youenn@apple.com>
 
         Add a functional WebRTC VP9 codec
diff --git a/LayoutTests/http/tests/storage/storage-map-leaking.html b/LayoutTests/http/tests/storage/storage-map-leaking.html
index 547d19a..a228760 100644
--- a/LayoutTests/http/tests/storage/storage-map-leaking.html
+++ b/LayoutTests/http/tests/storage/storage-map-leaking.html
@@ -10,7 +10,14 @@
 onload = function() {
     initialStorageAreaMapCount = internals.storageAreaMapCount;
 
-    document.getElementById("testFrame").remove();
+    // We use 4 frames, one per origin that we support in layout tests so that we get 4 StorageAreaMap objects
+    // and 4 Storage JS wrappers. Because our GC is conservative, we consider that this test is passing if
+    // any of the Storage JS wrappers gets collected and thus any of the underlying StorageAreaMap objects
+    // get destroyed.
+    document.getElementById("testFrame1").remove();
+    document.getElementById("testFrame2").remove();
+    document.getElementById("testFrame3").remove();
+    document.getElementById("testFrame4").remove();
 
     handle = setInterval(() => {
         gc()
@@ -22,6 +29,9 @@
     }, 10);
 }
 </script>
-<iframe id="testFrame" src="http://localhost:8000/storage/resources/storage-map-leaking-iframe.html"></iframe>
+<iframe id="testFrame1" src="http://localhost:8000/storage/resources/storage-map-leaking-iframe.html"></iframe>
+<iframe id="testFrame2" src="https://localhost:8443/storage/resources/storage-map-leaking-iframe.html"></iframe>
+<iframe id="testFrame3" src="http://127.0.0.1:8443/storage/resources/storage-map-leaking-iframe.html"></iframe>
+<iframe id="testFrame4" src="https://127.0.0.1:8443/storage/resources/storage-map-leaking-iframe.html"></iframe>
 </body>
 </html>
diff --git a/LayoutTests/platform/ios-wk2/TestExpectations b/LayoutTests/platform/ios-wk2/TestExpectations
index 5f41a83..4f18367 100644
--- a/LayoutTests/platform/ios-wk2/TestExpectations
+++ b/LayoutTests/platform/ios-wk2/TestExpectations
@@ -1758,5 +1758,3 @@
 webkit.org/b/213553 http/tests/resourceLoadStatistics/grandfathering-database.html [ Pass Timeout ]
 
 webkit.org/b/21365 imported/w3c/web-platform-tests/html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm [ Pass Failure ]
-
-webkit.org/b/213795 [ Debug ] http/tests/storage/storage-map-leaking.html [ Pass Timeout ]
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations
index ba06884..871b62f 100644
--- a/LayoutTests/platform/mac-wk2/TestExpectations
+++ b/LayoutTests/platform/mac-wk2/TestExpectations
@@ -1037,5 +1037,3 @@
 webkit.org/b/213621 imported/w3c/web-platform-tests/webrtc/RTCRtpReceiver-getContributingSources.https.html [ Pass Failure ]
 
 webkit.org/b/213652 webrtc/video-autoplay1.html [ Pass Failure ]
-
-webkit.org/b/213795 [ Mojave Debug ] http/tests/storage/storage-map-leaking.html [ Pass Timeout ]
\ No newline at end of file