Title: [252139] trunk/LayoutTests
Revision
252139
Author
dba...@webkit.org
Date
2019-11-06 09:36:33 -0800 (Wed, 06 Nov 2019)

Log Message

http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html is a Flakey Failure
https://bugs.webkit.org/show_bug.cgi?id=198924
<rdar://problem/51811010>

Reviewed by Brent Fulgham.

_javascript_ alert() cannot be called from a Web Worker. Use postMessage() instead to post "PASS"
to the worker's owner document. The tests don't actually make use of this posted message, but
fixing the code to use postMessage() may come in handy for future tests.

* http/tests/security/contentSecurityPolicy/resources/worker.php:
* http/tests/security/contentSecurityPolicy/worker-script-src.html:
* http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (252138 => 252139)


--- trunk/LayoutTests/ChangeLog	2019-11-06 17:34:50 UTC (rev 252138)
+++ trunk/LayoutTests/ChangeLog	2019-11-06 17:36:33 UTC (rev 252139)
@@ -1,5 +1,21 @@
 2019-11-06  Daniel Bates  <daba...@apple.com>
 
+        http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html is a Flakey Failure
+        https://bugs.webkit.org/show_bug.cgi?id=198924
+        <rdar://problem/51811010>
+
+        Reviewed by Brent Fulgham.
+
+        _javascript_ alert() cannot be called from a Web Worker. Use postMessage() instead to post "PASS"
+        to the worker's owner document. The tests don't actually make use of this posted message, but
+        fixing the code to use postMessage() may come in handy for future tests.
+
+        * http/tests/security/contentSecurityPolicy/resources/worker.php:
+        * http/tests/security/contentSecurityPolicy/worker-script-src.html:
+        * http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html:
+
+2019-11-06  Daniel Bates  <daba...@apple.com>
+
         Update SameSite tests for new semantics for empty and invalid SameSite attribute
         https://bugs.webkit.org/show_bug.cgi?id=203755
         <rdar://problem/50816282>

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php (252138 => 252139)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php	2019-11-06 17:34:50 UTC (rev 252138)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php	2019-11-06 17:36:33 UTC (rev 252139)
@@ -80,10 +80,10 @@
 postMessage(id === 0 ? "setTimeout blocked" : "setTimeout allowed");
 
 <?php
-} else if ($_GET["type"] == "alert-pass") {
+} else if ($_GET["type"] == "post-message-pass") {
 ?>
 
-alert('PASS');
+postMessage("PASS");
 
 <?php
 } else if ($_GET["type"] == "report-referrer") {

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/worker-script-src.html (252138 => 252139)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/worker-script-src.html	2019-11-06 17:34:50 UTC (rev 252138)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/worker-script-src.html	2019-11-06 17:36:33 UTC (rev 252139)
@@ -11,7 +11,8 @@
 <body>
 <script>
 try {
-    var worker = new Worker('http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.php?type=alert-pass&csp=' +
+    // We ignore the message posted by the worker (by not registering an onmessage handler) as we are only interested in knowing whether an exception occurred.
+    var worker = new Worker('http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.php?type=post-message-pass&csp=' +
                              encodeURIComponent("script-src 'self' 'unsafe-inline'"));
     alert("PASS");
 } catch (e) {

Modified: trunk/LayoutTests/http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html (252138 => 252139)


--- trunk/LayoutTests/http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html	2019-11-06 17:34:50 UTC (rev 252138)
+++ trunk/LayoutTests/http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html	2019-11-06 17:36:33 UTC (rev 252139)
@@ -24,7 +24,8 @@
 {
     var worker;
     try {
-        worker = new Worker("http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.php?type=alert-pass");
+        // We ignore the message posted by the worker (by not registering an onmessage handler) as we are only interested in knowing whether an exception occurred.
+        worker = new Worker("http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.php?type=post-message-pass");
         window.postMessage("PASS worker instantiated.", "*");
     } catch (exception) {
         window.postMessage("FAIL should not have thrown an exception when creating worker. Threw exception " + exception + ".", "*");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to