Changeset 252139 in webkit


Ignore:
Timestamp:
Nov 6, 2019 9:36:33 AM (4 years ago)
Author:
dbates@webkit.org
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:
Location:
trunk/LayoutTests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r252138 r252139  
     12019-11-06  Daniel Bates  <dabates@apple.com>
     2
     3        http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html is a Flakey Failure
     4        https://bugs.webkit.org/show_bug.cgi?id=198924
     5        <rdar://problem/51811010>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        JavaScript alert() cannot be called from a Web Worker. Use postMessage() instead to post "PASS"
     10        to the worker's owner document. The tests don't actually make use of this posted message, but
     11        fixing the code to use postMessage() may come in handy for future tests.
     12
     13        * http/tests/security/contentSecurityPolicy/resources/worker.php:
     14        * http/tests/security/contentSecurityPolicy/worker-script-src.html:
     15        * http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html:
     16
    1172019-11-06  Daniel Bates  <dabates@apple.com>
    218
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/resources/worker.php

    r199221 r252139  
    8181
    8282<?php
    83 } else if ($_GET["type"] == "alert-pass") {
     83} else if ($_GET["type"] == "post-message-pass") {
    8484?>
    8585
    86 alert('PASS');
     86postMessage("PASS");
    8787
    8888<?php
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/worker-script-src.html

    r195367 r252139  
    1212<script>
    1313try {
    14     var worker = new Worker('http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.php?type=alert-pass&csp=' +
     14    // 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.
     15    var worker = new Worker('http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.php?type=post-message-pass&csp=' +
    1516                             encodeURIComponent("script-src 'self' 'unsafe-inline'"));
    1617    alert("PASS");
  • trunk/LayoutTests/http/tests/security/isolatedWorld/bypass-main-world-csp-worker.html

    r196526 r252139  
    2525    var worker;
    2626    try {
    27         worker = new Worker("http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.php?type=alert-pass");
     27        // 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.
     28        worker = new Worker("http://127.0.0.1:8000/security/contentSecurityPolicy/resources/worker.php?type=post-message-pass");
    2829        window.postMessage("PASS worker instantiated.", "*");
    2930    } catch (exception) {
Note: See TracChangeset for help on using the changeset viewer.