Title: [261455] trunk/LayoutTests/imported/w3c
Revision
261455
Author
[email protected]
Date
2020-05-10 00:26:16 -0700 (Sun, 10 May 2020)

Log Message

[ iOS wk2 and Mac wk2 ] imported/w3c/web-platform-tests/fetch/stale-while-revalidate/frame-removal.html is flaky failing.
https://bugs.webkit.org/show_bug.cgi?id=209281

Patch by Rob Buis <[email protected]> on 2020-05-10
Reviewed by Darin Adler.

Since it is difficult to estimate when the revalidations are received
in relation to the frame loads, add two polling loops to make sure
revalidations have been received before proceding with the next
test step. This is similar to what fetch.html does.

* web-platform-tests/fetch/stale-while-revalidate/frame-removal.html:
* web-platform-tests/fetch/stale-while-revalidate/resources/stale-frame.py:
(main):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (261454 => 261455)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-05-10 03:44:42 UTC (rev 261454)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-05-10 07:26:16 UTC (rev 261455)
@@ -1,3 +1,19 @@
+2020-05-10  Rob Buis  <[email protected]>
+
+        [ iOS wk2 and Mac wk2 ] imported/w3c/web-platform-tests/fetch/stale-while-revalidate/frame-removal.html is flaky failing.
+        https://bugs.webkit.org/show_bug.cgi?id=209281
+
+        Reviewed by Darin Adler.
+
+        Since it is difficult to estimate when the revalidations are received
+        in relation to the frame loads, add two polling loops to make sure
+        revalidations have been received before proceding with the next
+        test step. This is similar to what fetch.html does.
+
+        * web-platform-tests/fetch/stale-while-revalidate/frame-removal.html:
+        * web-platform-tests/fetch/stale-while-revalidate/resources/stale-frame.py:
+        (main):
+
 2020-05-09  Tetsuharu Ohzeki  <[email protected]>
 
         Fix wpt shadow-dom/slots-fallback-in-document.html

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/stale-while-revalidate/frame-removal.html (261454 => 261455)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/stale-while-revalidate/frame-removal.html	2020-05-10 03:44:42 UTC (rev 261454)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/stale-while-revalidate/frame-removal.html	2020-05-10 07:26:16 UTC (rev 261455)
@@ -6,6 +6,14 @@
 <script src=""
 <body>
 <script>
+function wait25ms(test) {
+  return new Promise(resolve => {
+    test.step_timeout(() => {
+      resolve();
+    }, 25);
+  });
+}
+
 async_test(function(t) {
   var request_token = token();
   const url = "" + request_token
@@ -17,17 +25,25 @@
     // second frame load, triggers revalidation
     let frame2 = document.createElement("iframe");
     frame2.src = ""
-    frame2._onload_ = () => {
+    frame2._onload_ = async () => {
+      while (true) {
+        const revalidation_check = await fetch(`resources/stale-frame.py?query&token=` + request_token);
+        if (revalidation_check.headers.get('Count') == '1')
+          break;
+        await wait25ms(t);
+      }
       // remove frame, canceling revalidation
       frame2.remove();
       // third frame load, triggers new revalidation
       let frame3 = document.createElement("iframe");
       frame3.src = ""
-      frame3._onload_ = () => {
-        fetch("resources/stale-frame.py?query&token=" + request_token).then(t.step_func((response) => {
-          assert_equals(response.headers.get("Count"), '2');
-          t.done();
-        }));
+      frame3._onload_ = async () => {
+        while (true) {
+          const revalidation_check = await fetch(`resources/stale-frame.py?query&token=` + request_token);
+          if (revalidation_check.headers.get('Count') == '2')
+            t.done();
+          await wait25ms(t);
+        }
       }
       document.body.appendChild(frame3);
     }

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/stale-while-revalidate/resources/stale-frame.py (261454 => 261455)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/stale-while-revalidate/resources/stale-frame.py	2020-05-10 03:44:42 UTC (rev 261454)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/stale-while-revalidate/resources/stale-frame.py	2020-05-10 07:26:16 UTC (rev 261455)
@@ -21,9 +21,6 @@
           count = count + 1
         request.server.stash.put(token, count)
 
-    if is_revalidation is not None:
-      time.sleep(5);
-
     if is_query:
       headers = [("Count", count), ("Test", str(request.raw_headers))]
       content = ""
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to