Title: [219824] trunk/LayoutTests
Revision
219824
Author
[email protected]
Date
2017-07-24 09:06:50 -0700 (Mon, 24 Jul 2017)

Log Message

Remove race from one plug-in test
https://bugs.webkit.org/show_bug.cgi?id=130653

Reviewed by Antti Koivisto.

* plugins/plugin-remove-readystatechange.html: Updated test to use waitUntilDone/notifyDone
rather than racing. Added a computation of offsetLeft to trigger layout and adding a long
comment explaining why this is both needed and potentially insufficient in the long run.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219823 => 219824)


--- trunk/LayoutTests/ChangeLog	2017-07-24 16:01:33 UTC (rev 219823)
+++ trunk/LayoutTests/ChangeLog	2017-07-24 16:06:50 UTC (rev 219824)
@@ -1,3 +1,14 @@
+2017-07-23  Darin Adler  <[email protected]>
+
+        Remove race from one plug-in test
+        https://bugs.webkit.org/show_bug.cgi?id=130653
+
+        Reviewed by Antti Koivisto.
+
+        * plugins/plugin-remove-readystatechange.html: Updated test to use waitUntilDone/notifyDone
+        rather than racing. Added a computation of offsetLeft to trigger layout and adding a long
+        comment explaining why this is both needed and potentially insufficient in the long run.
+
 2017-07-11  Frederic Wang  <[email protected]>
 
         Add attribute allow-top-navigation-by-user-activation to iframe sandbox

Modified: trunk/LayoutTests/plugins/plugin-remove-readystatechange.html (219823 => 219824)


--- trunk/LayoutTests/plugins/plugin-remove-readystatechange.html	2017-07-24 16:01:33 UTC (rev 219823)
+++ trunk/LayoutTests/plugins/plugin-remove-readystatechange.html	2017-07-24 16:06:50 UTC (rev 219824)
@@ -10,8 +10,10 @@
 It ensures a readystatechange event can't get dispatched until after a plugin is fully removed.
 </div>
 <script>
-if (window.testRunner)
+if (window.testRunner) {
     testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
 
 document.addEventListener('readystatechange', function() {
     if (document.readyState == "complete") {
@@ -20,11 +22,20 @@
         }
         catch (e) {
             alert('PASS: element could not be re-appended');
-       }
+        }
+        if (window.testRunner)
+            testRunner.notifyDone();
     }
 });
 
 window.addEventListener('DOMContentLoaded', function() {
+    // This test relies on removing the embed element while it is actively loading.
+    // There's no observable event that creates the exact right timing for that.
+    // As of this writing, after DOMContentLoaded, then next layout is the right time.
+    // Here we evaluate document.body.offsetLeft to trigger that layout. But really,
+    // this is a race condition, nothing guarantees that the load starts at that moment,
+    // and we might have to revise this test again in the future.
+    document.body.offsetLeft;
     document.body.removeChild(document.getElementById('viewer'));
 });
 </script>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to