Title: [291359] trunk/LayoutTests
Revision
291359
Author
[email protected]
Date
2022-03-16 11:42:45 -0700 (Wed, 16 Mar 2022)

Log Message

[ MacOS ] http/tests/security/content SecurityPolicy/frame-src-cross-origin-load.html is a flakey failure (230428)
https://bugs.webkit.org/show_bug.cgi?id=230428
<rdar://problem/83254559>

Reviewed by Brent Fulgham.

The flakiness was caused by relying on ordered output from iframe
loads that are not guaranteed to load in order. This change loads
iframes in script to make sure they load only after the previous
iframe has loaded.

* http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt:
* http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html:
* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (291358 => 291359)


--- trunk/LayoutTests/ChangeLog	2022-03-16 17:42:08 UTC (rev 291358)
+++ trunk/LayoutTests/ChangeLog	2022-03-16 18:42:45 UTC (rev 291359)
@@ -1,3 +1,20 @@
+2022-03-16  Kate Cheney  <[email protected]>
+
+        [ MacOS ] http/tests/security/content SecurityPolicy/frame-src-cross-origin-load.html is a flakey failure (230428)
+        https://bugs.webkit.org/show_bug.cgi?id=230428
+        <rdar://problem/83254559>
+
+        Reviewed by Brent Fulgham.
+
+        The flakiness was caused by relying on ordered output from iframe
+        loads that are not guaranteed to load in order. This change loads
+        iframes in script to make sure they load only after the previous
+        iframe has loaded.
+
+        * http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt:
+        * http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html:
+        * platform/mac/TestExpectations:
+
 2022-03-16  Philippe Normand  <[email protected]>
 
         [GStreamer][1.20] media/video-src-blob-perf.html failing

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt (291358 => 291359)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt	2022-03-16 17:42:08 UTC (rev 291358)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load-expected.txt	2022-03-16 18:42:45 UTC (rev 291359)
@@ -1,5 +1,5 @@
+ALERT: PASS
 CONSOLE MESSAGE: Refused to load https://localhost:8443/security/contentSecurityPolicy/resources/alert-fail.html because it does not appear in the frame-src directive of the Content Security Policy.
-ALERT: PASS
 CONSOLE MESSAGE: PASS
 IFrames blocked by CSP should generate a 'load' event, regardless of blocked state. This means they appear to be normal cross-origin loads, thereby not leaking URL information directly to JS.
 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html (291358 => 291359)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html	2022-03-16 17:42:08 UTC (rev 291358)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html	2022-03-16 18:42:45 UTC (rev 291359)
@@ -8,20 +8,34 @@
         
         description("IFrames blocked by CSP should generate a 'load' event, regardless of blocked state. This means they appear to be normal cross-origin loads, thereby not leaking URL information directly to JS.");
 
+        function loadIFrameWithSrc(srcURL)
+        {
+            var iframe = document.createElement("iframe");
+            iframe._onload_ = loadEvent();
+            iframe.src = ""
+            document.body.appendChild(iframe);
+        }
+
         var loads = 0;
-
         function loadEvent() {
             loads++;
             testPassed("IFrame #" + loads + " generated a 'load' event.");
-            if (loads == 3)
+            switch (loads)
+            {
+            case 1:
+                loadIFrameWithSrc("http://localhost:8080/security/contentSecurityPolicy/resources/alert-pass.html");
+                break;
+            case 2:
+                loadIFrameWithSrc("https://localhost:8443/security/contentSecurityPolicy/resources/alert-fail.html");
+                break;
+            case 3:
                 setTimeout(finishJSTest, 0);
+            }
         }
     </script>
 </head>
 <body>
     <iframe src="" _onload_="loadEvent()"></iframe>
-    <iframe src="" _onload_="loadEvent()"></iframe>
-    <iframe src="" _onload_="loadEvent()"></iframe>
     <script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/platform/mac/TestExpectations (291358 => 291359)


--- trunk/LayoutTests/platform/mac/TestExpectations	2022-03-16 17:42:08 UTC (rev 291358)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2022-03-16 18:42:45 UTC (rev 291359)
@@ -1023,8 +1023,6 @@
 webkit.org/b/155505 http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-audio.html [ Skip ]
 webkit.org/b/155505 http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html [ Skip ]
 
-webkit.org/b/230428 http/tests/security/contentSecurityPolicy/frame-src-cross-origin-load.html [ Pass Failure ]
-
 webkit.org/b/154688 inspector/controller/runtime-controller.html [ Pass Timeout ]
 
 webkit.org/b/156351 storage/indexeddb/modern/autoincrement-abort-private.html [ Pass Timeout ]
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to