Title: [235819] trunk/LayoutTests
Revision
235819
Author
[email protected]
Date
2018-09-07 16:13:32 -0700 (Fri, 07 Sep 2018)

Log Message

Tests checking document GC in case of ActiveDOMObjects are flaky
https://bugs.webkit.org/show_bug.cgi?id=189413

Reviewed by Eric Carlson.

Instead of calling parent.done() use postMessage.
The assumption is that GC might not always collect 'parent' as it is in the call stack.
With postMessage, no flakiness is observed locally.
Added a related MediaDevices test that was missing from r235438.

* http/tests/IndexedDB/collect-IDB-objects.https.html:
* http/tests/IndexedDB/resources/myidbframe.htm:
* http/tests/media/clearkey/collect-webkit-media-session.html:
* http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm:
* http/tests/media/media-stream/collect-media-devices.https-expected.txt: Added.
* http/tests/media/media-stream/collect-media-devices.https.html: Added.
* http/tests/media/media-stream/resources/mymediadevicesframe.htm: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (235818 => 235819)


--- trunk/LayoutTests/ChangeLog	2018-09-07 23:08:34 UTC (rev 235818)
+++ trunk/LayoutTests/ChangeLog	2018-09-07 23:13:32 UTC (rev 235819)
@@ -1,3 +1,23 @@
+2018-09-07  Youenn Fablet  <[email protected]>
+
+        Tests checking document GC in case of ActiveDOMObjects are flaky
+        https://bugs.webkit.org/show_bug.cgi?id=189413
+
+        Reviewed by Eric Carlson.
+
+        Instead of calling parent.done() use postMessage.
+        The assumption is that GC might not always collect 'parent' as it is in the call stack.
+        With postMessage, no flakiness is observed locally.
+        Added a related MediaDevices test that was missing from r235438.
+
+        * http/tests/IndexedDB/collect-IDB-objects.https.html:
+        * http/tests/IndexedDB/resources/myidbframe.htm:
+        * http/tests/media/clearkey/collect-webkit-media-session.html:
+        * http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm:
+        * http/tests/media/media-stream/collect-media-devices.https-expected.txt: Added.
+        * http/tests/media/media-stream/collect-media-devices.https.html: Added.
+        * http/tests/media/media-stream/resources/mymediadevicesframe.htm: Added.
+
 2018-09-07  Daniel Bates  <[email protected]>
 
         [iOS] uiController.typeCharacterUsingHardwareKeyboard("`", ...) dispatches DOM key events for ~

Modified: trunk/LayoutTests/http/tests/IndexedDB/collect-IDB-objects.https.html (235818 => 235819)


--- trunk/LayoutTests/http/tests/IndexedDB/collect-IDB-objects.https.html	2018-09-07 23:08:34 UTC (rev 235818)
+++ trunk/LayoutTests/http/tests/IndexedDB/collect-IDB-objects.https.html	2018-09-07 23:13:32 UTC (rev 235819)
@@ -30,11 +30,14 @@
 
             await waitFor(50);
         }
-    } finally {
         rejectCallback("Test failed");
+    } catch (e) {
+        rejectCallback("Test failed: exception " + e);
     }
 }
 
+window.addEventListener("message", done);
+
 promise_test((test) => {
     if (!window.internals)
         rejectCallback("Test require internals API");

Modified: trunk/LayoutTests/http/tests/IndexedDB/resources/myidbframe.htm (235818 => 235819)


--- trunk/LayoutTests/http/tests/IndexedDB/resources/myidbframe.htm	2018-09-07 23:08:34 UTC (rev 235818)
+++ trunk/LayoutTests/http/tests/IndexedDB/resources/myidbframe.htm	2018-09-07 23:13:32 UTC (rev 235819)
@@ -17,7 +17,7 @@
                 ._onsuccess_ = t.step_func(function(e)
         {
             t.done();
-            parent.done();
+            parent.postMessage("done", "*");
         });
     });
 };

Modified: trunk/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session.html (235818 => 235819)


--- trunk/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session.html	2018-09-07 23:08:34 UTC (rev 235818)
+++ trunk/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session.html	2018-09-07 23:13:32 UTC (rev 235819)
@@ -30,11 +30,14 @@
 
             await waitFor(50);
         }
-    } finally {
         rejectCallback("Test failed");
+    } catch (e) {
+        rejectCallback("Test failed: exception " + e);
     }
 }
 
+window.addEventListener("message", done);
+
 promise_test((test) => {
     if (!window.internals)
         rejectCallback("Test require internals API");

Modified: trunk/LayoutTests/http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm (235818 => 235819)


--- trunk/LayoutTests/http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm	2018-09-07 23:08:34 UTC (rev 235818)
+++ trunk/LayoutTests/http/tests/media/clearkey/resources/mywebkitmediasessionframe.htm	2018-09-07 23:13:32 UTC (rev 235819)
@@ -22,7 +22,7 @@
             }
 
             session = video.webkitKeys.createSession('application/x-mpegurl', event.initData);
-            parent.done();
+            parent.postMessage("done", "*");
         }
     </script>
 </head>

Added: trunk/LayoutTests/http/tests/media/media-stream/collect-media-devices.https-expected.txt (0 => 235819)


--- trunk/LayoutTests/http/tests/media/media-stream/collect-media-devices.https-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/collect-media-devices.https-expected.txt	2018-09-07 23:13:32 UTC (rev 235819)
@@ -0,0 +1,4 @@
+
+
+PASS Ensure that the frame's document get collected after being stopped while using MediaDevices 
+

Copied: trunk/LayoutTests/http/tests/media/media-stream/collect-media-devices.https.html (from rev 235818, trunk/LayoutTests/http/tests/media/clearkey/collect-webkit-media-session.html) (0 => 235819)


--- trunk/LayoutTests/http/tests/media/media-stream/collect-media-devices.https.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/collect-media-devices.https.html	2018-09-07 23:13:32 UTC (rev 235819)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<script src=""
+<script src=""
+<script>
+function waitFor(duration)
+{
+    return new Promise((resolve) => setTimeout(resolve, duration));
+}
+
+var resolveCallback, rejectCallback;
+var promise = new Promise((resolve, reject) => {
+    resolveCallback = resolve;
+    rejectCallback = reject;
+});
+
+async function done()
+{
+    try {
+        const frameIdentifier = internals.documentIdentifier(iframe.contentDocument);
+        iframe.src = ""
+        let counter = 0;
+        while (++counter < 50) {
+            if (!internals.isDocumentAlive(frameIdentifier)) {
+                resolveCallback();
+                return;
+            }
+            if (window.GCController)
+                GCController.collect();
+
+            await waitFor(50);
+        }
+        rejectCallback("Test failed");
+    } catch (e) {
+        rejectCallback("Test failed: exception " + e);
+    }
+}
+
+window.addEventListener("message", done);
+
+promise_test((test) => {
+    if (!window.internals)
+        rejectCallback("Test require internals API");
+    return promise;
+}, "Ensure that the frame's document get collected after being stopped while using MediaDevices");
+
+</script>
+<iframe src="" id="iframe"></iframe>

Added: trunk/LayoutTests/http/tests/media/media-stream/resources/mymediadevicesframe.htm (0 => 235819)


--- trunk/LayoutTests/http/tests/media/media-stream/resources/mymediadevicesframe.htm	                        (rev 0)
+++ trunk/LayoutTests/http/tests/media/media-stream/resources/mymediadevicesframe.htm	2018-09-07 23:13:32 UTC (rev 235819)
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<script>
+navigator.mediaDevices._ondevicechange_ = () => {};
+parent.postMessage("done", "*");
+</script>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to