Title: [246232] trunk/LayoutTests
Revision
246232
Author
[email protected]
Date
2019-06-08 03:32:07 -0700 (Sat, 08 Jun 2019)

Log Message

resize-observer/element-leak.html fails on Windows platform
https://bugs.webkit.org/show_bug.cgi?id=197908

Patch by Cathie Chen <[email protected]> on 2019-06-08
Reviewed by Ryosuke Niwa.

We have conservative GC, the removed objects might keep alive for a while. Change the test case
to 20 iframes. This would make the result more accurate.

* platform/win/TestExpectations:
* resize-observer/element-leak-expected.txt:
* resize-observer/element-leak.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (246231 => 246232)


--- trunk/LayoutTests/ChangeLog	2019-06-08 05:19:56 UTC (rev 246231)
+++ trunk/LayoutTests/ChangeLog	2019-06-08 10:32:07 UTC (rev 246232)
@@ -1,3 +1,17 @@
+2019-06-08  Cathie Chen  <[email protected]>
+
+        resize-observer/element-leak.html fails on Windows platform
+        https://bugs.webkit.org/show_bug.cgi?id=197908
+
+        Reviewed by Ryosuke Niwa.
+
+        We have conservative GC, the removed objects might keep alive for a while. Change the test case
+        to 20 iframes. This would make the result more accurate.
+
+        * platform/win/TestExpectations:
+        * resize-observer/element-leak-expected.txt:
+        * resize-observer/element-leak.html:
+
 2019-06-07  Youenn Fablet  <[email protected]>
 
         [ Mac Debug ] REGRESSION (r242975) Layout Test storage/indexeddb/modern/deletedatabase-2-private.html is a flaky failure

Modified: trunk/LayoutTests/platform/win/TestExpectations (246231 => 246232)


--- trunk/LayoutTests/platform/win/TestExpectations	2019-06-08 05:19:56 UTC (rev 246231)
+++ trunk/LayoutTests/platform/win/TestExpectations	2019-06-08 10:32:07 UTC (rev 246232)
@@ -4402,8 +4402,4 @@
 
 webkit.org/b/198112 http/tests/security/showModalDialog-sync-cross-origin-page-load2.html [ Skip ]
 
-# The removed elements couldn't be released properly in Win.
-# The relevant bug is https://bugs.webkit.org/show_bug.cgi?id=197908
-resize-observer/element-leak.html [ Skip ]
-
 webkit.org/b/198679 fast/events/fire-mousedown-while-pressing-mouse-button.html [ Failure ]

Modified: trunk/LayoutTests/resize-observer/element-leak-expected.txt (246231 => 246232)


--- trunk/LayoutTests/resize-observer/element-leak-expected.txt	2019-06-08 05:19:56 UTC (rev 246231)
+++ trunk/LayoutTests/resize-observer/element-leak-expected.txt	2019-06-08 10:32:07 UTC (rev 246232)
@@ -1,4 +1,4 @@
 
 PASS ResizeObserver implemented 
-PASS Test elements leak 
+PASS Test elements leak in 20 iframes 
 

Modified: trunk/LayoutTests/resize-observer/element-leak.html (246231 => 246232)


--- trunk/LayoutTests/resize-observer/element-leak.html	2019-06-08 05:19:56 UTC (rev 246231)
+++ trunk/LayoutTests/resize-observer/element-leak.html	2019-06-08 10:32:07 UTC (rev 246232)
@@ -7,36 +7,74 @@
 <script src=""
 </head>
 <body>
-<iframe id="testFrame" src=""
 <script>
 
-test(_ => {
-    assert_own_property(window, "ResizeObserver");
-}, "ResizeObserver implemented");
+let iframeCount = 20;
+function prepareFrame() {
+    return new Promise(function(resolve, reject) {
+        let container = document.createElement("div");
+        for (let i = 0; i < iframeCount; ++i) {
+            let iframe = document.createElement("iframe");
+            iframe.style.height = "1px";
+            iframe.src = ""
+            container.appendChild(iframe);
+        }
+        document.body.appendChild(container);
 
-promise_test(async () => {
-    return new Promise(function(resolve, reject) {
+        let notifyCount = 0;
         window.addEventListener('message', event => {
             switch(event.data) {
             case 'Notified':
-                var testFrame = document.getElementById("testFrame");
-                let frameDocumentIdentifier = internals.documentIdentifier(testFrame.contentDocument);
-                testFrame.remove();
-
-                handle = setInterval(function() {
-                    gc();
-                    if (internals && !internals.isDocumentAlive(frameDocumentIdentifier)) {
-                        clearInterval(handle);
-                        resolve();
-                    }
-                }, 10);
+                notifyCount++;
+                if (notifyCount == iframeCount) {
+                    resolve("All iframes notified");
+                }
             break;
             }
-         }, false);
-        setTimeout(() => reject("Test timed out"), 5000);
+        }, false);
     });
-}, 'Test elements leak');
+}
 
+function testElementLeak(resolve, reject) {
+    return new Promise(function(resolve, reject) {
+        let documentIdentifierArray = new Array(iframeCount);
+        let count = 0;
+        document.querySelectorAll('iframe').forEach(iframe => {
+            documentIdentifierArray[count++] = internals.documentIdentifier(iframe.contentDocument);
+            iframe.remove();
+        });
+
+        let handle = setInterval(function() {
+            gc();
+            documentIdentifierArray.forEach(function(frameDocumentIdentifier) {
+                if (internals && !internals.isDocumentAlive(frameDocumentIdentifier)) {
+                    clearInterval(handle);
+                    documentIdentifierArray = [];
+                    resolve("Detected document release.");
+                }
+            });
+        }, 10);
+    });
+}
+
+function startTest() {
+    return prepareFrame().then(function(){
+        return testElementLeak().catch(function(result){
+            assert_unreached(result);
+        });
+    }).catch(function(result){
+        assert_unreached(result);
+    });
+}
+
+test(_ => {
+    assert_own_property(window, "ResizeObserver");
+}, "ResizeObserver implemented");
+
+promise_test(async () => {
+    return startTest();
+}, 'Test elements leak in 20 iframes');
+
 </script>
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to