Changeset 263626 in webkit


Ignore:
Timestamp:
Jun 27, 2020 10:36:43 AM (4 years ago)
Author:
Chris Dumez
Message:

Update web-platform-tests/cors from upstream
https://bugs.webkit.org/show_bug.cgi?id=213668

Reviewed by Sam Weinig.

Update web-platform-tests/cors from upstream b076c305a256e7.

LayoutTests/imported/w3c:

  • web-platform-tests/cors/*: Updated.

LayoutTests:

  • tests-options.json:
Location:
trunk/LayoutTests
Files:
4 added
1 deleted
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r263615 r263626  
     12020-06-27  Chris Dumez  <cdumez@apple.com>
     2
     3        Update web-platform-tests/cors from upstream
     4        https://bugs.webkit.org/show_bug.cgi?id=213668
     5
     6        Reviewed by Sam Weinig.
     7
     8        Update web-platform-tests/cors from upstream b076c305a256e7.
     9
     10        * tests-options.json:
     11
    1122020-06-26  Diego Pino Garcia  <dpino@igalia.com>
    213
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r263624 r263626  
     12020-06-27  Chris Dumez  <cdumez@apple.com>
     2
     3        Update web-platform-tests/cors from upstream
     4        https://bugs.webkit.org/show_bug.cgi?id=213668
     5
     6        Reviewed by Sam Weinig.
     7
     8        Update web-platform-tests/cors from upstream b076c305a256e7.
     9
     10        * web-platform-tests/cors/*: Updated.
     11
    1122020-06-27  Rob Buis  <rbuis@igalia.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/304.htm

    r213914 r263626  
    22<meta charset=utf-8>
    33<title>CORS - 304 Responses</title>
     4<meta name="timeout" content="long">
    45<meta name=author title="Mark Nottingham" href="mailto:mnot@mnot.net">
    56
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/client-hint-request-headers-expected.txt

    r253331 r263626  
    22
    33
    4 FAIL Client hint headers are simple headers  A network error occurred.
    54PASS Unspecified request headers are disallowed
    65PASS Unextractable device-memory client hint header is disallowed
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/client-hint-request-headers.htm

    r232903 r263626  
    11<!DOCTYPE html>
    22<meta charset=utf-8>
    3 <title>CORS - client hint request headers - Access-Control-Allow-Headers</title>
     3<title>CORS and Client Hints</title>
    44
    55<script src=/resources/testharness.js></script>
     
    1313test(function() {
    1414    var client = new XMLHttpRequest()
    15     client.open('GET', CROSSDOMAIN + 'resources/cors-makeheader.py?headers=x-print,', false)
    16     client.setRequestHeader('x-print', 'unicorn')
    17     client.setRequestHeader('content-type', 'text/plain')
    18     client.setRequestHeader('accept', 'test')
    19     client.setRequestHeader('accept-language', 'nn')
    20     client.setRequestHeader('content-language', 'nn')
    21     client.setRequestHeader('save-data', 'on')
    22     client.setRequestHeader('device-memory', '1.0')
    23     client.setRequestHeader('dpr', '2.0')
    24     client.setRequestHeader('width', '35')
    25     client.setRequestHeader('viewport-width', '42')
    26     client.send(null)
    27 
    28     const res = JSON.parse(client.response)
    29     assert_equals(res['x-print'], 'unicorn')
    30     assert_equals(res['content-type'], 'text/plain')
    31     assert_equals(res['accept'], 'test')
    32     assert_equals(res['accept-language'], 'nn')
    33     assert_equals(res['content-language'], 'nn')
    34     assert_equals(res['save-data'], 'on')
    35     assert_equals(res['device-memory'], '1.0')
    36     assert_equals(res['dpr'], '2.0')
    37     assert_equals(res['width'], '35')
    38     assert_equals(res['viewport-width'], '42')
    39 }, 'Client hint headers are simple headers')
    40 
    41 test(function() {
    42     var client = new XMLHttpRequest()
    4315    client.open('GET', CROSSDOMAIN + 'resources/cors-makeheader.py?headers=x-print', false)
    4416    client.setRequestHeader('x-print', 'unicorn')
    4517    client.setRequestHeader('y-print', 'unicorn')
    46     assert_throws("NetworkError", function() { client.send(null) })
     18    assert_throws_dom("NetworkError", function() { client.send(null) })
    4719}, 'Unspecified request headers are disallowed')
    4820
     
    5123    client.open('GET', CROSSDOMAIN + 'resources/cors-makeheader.py?headers=x-print', false)
    5224    client.setRequestHeader('device-memory', '')
    53     assert_throws("NetworkError", function() { client.send(null) })
     25    assert_throws_dom("NetworkError", function() { client.send(null) })
    5426}, 'Unextractable device-memory client hint header is disallowed')
    5527
     
    5830    client.open('GET', CROSSDOMAIN + 'resources/cors-makeheader.py?headers=x-print', false)
    5931    client.setRequestHeader('dpr', '')
    60     assert_throws("NetworkError", function() { client.send(null) })
     32    assert_throws_dom("NetworkError", function() { client.send(null) })
    6133}, 'Unextractable DPR client hint header is disallowed')
    6234
     
    6537    client.open('GET', CROSSDOMAIN + 'resources/cors-makeheader.py?headers=x-print', false)
    6638    client.setRequestHeader('width', '')
    67     assert_throws("NetworkError", function() { client.send(null) })
     39    assert_throws_dom("NetworkError", function() { client.send(null) })
    6840}, 'Unextractable width client hint header is disallowed')
    6941
     
    7244    client.open('GET', CROSSDOMAIN + 'resources/cors-makeheader.py?headers=x-print', false)
    7345    client.setRequestHeader('viewport-width', '')
    74     assert_throws("NetworkError", function() { client.send(null) })
     46    assert_throws_dom("NetworkError", function() { client.send(null) })
    7547}, 'Unextractable viewport-width client hint header is disallowed')
    7648
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/cors-safelisted-request-header.any.js

    r251490 r263626  
    1212          request = () => fetch(url, { method: "POST", headers, body: "data" });
    1313    if (expectPreflight) {
    14       await promise_rejects(t, TypeError(), request());
     14      await promise_rejects_js(t, TypeError, request());
    1515    } else {
    1616      const response = await request();
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/credentials-flag-expected.txt

    r251775 r263626  
    99PASS Access-Control-Allow-Credentials: True should be disallowed (async)
    1010PASS Access-Control-Allow-Credentials: "true" should be disallowed (async)
     11PASS Access-Control-Allow-Credentials: 'true' should be disallowed (async)
    1112PASS Access-Control-Allow-Credentials: false should be disallowed (async)
    1213PASS Access-Control-Allow-Credentials: 1 should be disallowed (async)
    1314PASS Access-Control-Allow-Credentials: 0 should be disallowed (async)
     15PASS Access-Control-Allow-Credentials: ,true should be disallowed (async)
     16PASS Access-Control-Allow-Credentials: true, should be disallowed (async)
     17FAIL Access-Control-Allow-Credentials: true%0B should be disallowed (async) assert_unreached: onload Reached unreachable code
     18FAIL Access-Control-Allow-Credentials: true%0C should be disallowed (async) assert_unreached: onload Reached unreachable code
    1419
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/credentials-flag.htm

    r213914 r263626  
    123123test_response_header('True')
    124124test_response_header('"true"')
     125test_response_header("'true'");
    125126test_response_header('false')
    126127test_response_header('1')
    127128test_response_header('0')
     129test_response_header(',true');
     130test_response_header('true,');
     131test_response_header('true%0B');
     132test_response_header('true%0C');
    128133
    129134</script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/origin-expected.txt

    r253331 r263626  
    3131PASS Disallow origin: -
    3232PASS Disallow origin: **
     33PASS Disallow origin: ,*
     34PASS Disallow origin: *,
    3335PASS Disallow origin: \0*
     36FAIL Disallow origin:
     37* assert_throws_dom: send function "function () { client.send() }" did not throw
     38FAIL Disallow origin:
     39* assert_throws_dom: send function "function () { client.send() }" did not throw
    3440PASS Disallow origin: *\0
     41FAIL Disallow origin: *
     42 assert_throws_dom: send function "function () { client.send() }" did not throw
     43FAIL Disallow origin: *
     44 assert_throws_dom: send function "function () { client.send() }" did not throw
    3545PASS Disallow origin: '*'
    3646PASS Disallow origin: "*"
     
    5363PASS Disallow origin: .localhost:8800
    5464PASS Disallow origin: *.localhost:8800
    55 FAIL Disallow origin: http://localhost:8800 assert_throws: send function "function () { client.send() }" did not throw
     65FAIL Disallow origin: http://localhost:8800 assert_throws_dom: send function "function () { client.send() }" did not throw
    5666PASS Disallow origin: http://.localhost:8800
    5767PASS Disallow origin: http://*.localhost:8800
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/origin.htm

    r215164 r263626  
    22<meta charset=utf-8>
    33<title>Access-Control-Allow-Origin handling</title>
     4<meta name="timeout" content="long">
    45<link rel=help href=https://fetch.spec.whatwg.org/>
    56<meta name=author title="Odin Hørthe Omdal" href="mailto:odiho@opera.com">
     
    4849                            + encodeURIComponent(origin),
    4950                    false)
    50         assert_throws("NetworkError", function() { client.send() }, 'send')
     51        assert_throws_dom("NetworkError", function() { client.send() }, 'send')
    5152    }, 'Disallow origin: ' + origin.replace(/\0/g, "\\0"));
    5253}
     
    7273shouldFail("-")
    7374shouldFail("**")
     75shouldFail(",*");
     76shouldFail("*,");
    7477shouldFail("\0*")
     78shouldFail("\u000B*");
     79shouldFail("\u000C*");
    7580shouldFail("*\0")
     81shouldFail("*\u000B");
     82shouldFail("*\u000C");
    7683shouldFail("'*'")
    7784shouldFail('"*"')
     
    106113                            + '&origin2=' + encodeURIComponent(origin2),
    107114                    false)
    108         assert_throws("NetworkError", function() { client.send() }, 'send')
     115        assert_throws_dom("NetworkError", function() { client.send() }, 'send')
    109116    }, 'Disallow multiple headers (' + origin + ', ' + origin2 + ')');
    110117}
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/preflight-cache-expected.txt

    r251490 r263626  
    44PASS Test preflight
    55PASS preflight for x-print should be cached
     6PASS age = blank, should be cached
    67PASS age = 0, should not be cached
    78FAIL age = -1, should not be cached assert_equals: did preflight expected "1" but got "0"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/preflight-cache.htm

    r213914 r263626  
    22<meta charset=utf-8>
    33<title>CORS - preflight cache</title>
     4<meta name="timeout" content="long">
    45<meta name=author title="Odin Hørthe Omdal" href="mailto:odiho@opera.com">
    56
     
    6465    var client = new XMLHttpRequest()
    6566
     67    var id = did_preflight(true, client, {extra:'max_age='})
     68    did_preflight(false, client, {extra:'max_age=', token: id})
     69},
     70'age = blank, should be cached')
     71
     72test(function() {
     73    var time = new Date().getTime()
     74    var client = new XMLHttpRequest()
     75
    6676    var id = did_preflight(true, client, {extra:'max_age=0'})
    6777    did_preflight(true, client, {extra:'max_age=0', token: id})
     
    7989
    8090(function() {
    81     var test = async_test("preflight first request, second from cache, wait, third should preflight again", { timeout: 6000 }),
     91    var test = async_test("preflight first request, second from cache, wait, third should preflight again"),
    8292        time = new Date().getTime(),
    8393        dothing = function (url, msg, set_request, func) {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/request-headers.htm

    r215164 r263626  
    4949    client.setRequestHeader('x-print', 'unicorn')
    5050    client.setRequestHeader('y-print', 'unicorn')
    51     assert_throws("NetworkError", function() { client.send(null) })
     51    assert_throws_dom("NetworkError", function() { client.send(null) })
    5252}, 'Unspecified request headers are disallowed')
    5353
     
    6666test(function() {
    6767    var client = new XMLHttpRequest()
    68     assert_throws('INVALID_STATE_ERR', function() { client.setRequestHeader('x-print', 'unicorn') })
     68    assert_throws_dom('INVALID_STATE_ERR', function() { client.setRequestHeader('x-print', 'unicorn') })
    6969},
    7070'INVALID_STATE_ERR on setRequestHeader before open()')
     
    7474    client.open('GET', CROSSDOMAIN + 'resources/cors-makeheader.py?headers=,y-lol,x-PriNT,%20,,,Y-PRINT', false)
    7575    client.send()
    76     assert_throws('INVALID_STATE_ERR', function() { client.setRequestHeader('x-print', 'unicorn') })
     76    assert_throws_dom('INVALID_STATE_ERR', function() { client.setRequestHeader('x-print', 'unicorn') })
    7777},
    7878'INVALID_STATE_ERR on setRequestHeader after send()')
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/304.py

    r213914 r263626  
    22
    33# A header used to correlate requests and responses
    4 state_header = "content-language"
     4state_header = b"content-language"
    55
    66# Static ETag to use (and expect)
    7 etag = "abcdef"
     7etag = b"abcdef"
    88
    99def error(msg):
    10     return (299, "Client Error"), [
    11         ('content-type', 'text/plain'),
    12         ('access-control-allow-origin', "*"),
    13         ('access-control-expose-headers', state_header),
    14         ('cache-control', 'no-store')
     10    return (299, u"Client Error"), [
     11        (b'content-type', b'text/plain'),
     12        (b'access-control-allow-origin', b"*"),
     13        (b'access-control-expose-headers', state_header),
     14        (b'cache-control', b'no-store')
    1515    ], msg
    1616
     
    1818    headers = []
    1919
    20     inm = request.headers.get('if-none-match', None)
     20    inm = request.headers.get(b'if-none-match', None)
    2121    raw_req_num = request.headers.get(state_header, None)
    2222    if raw_req_num == None:
    23         return error("no req_num header in request")
     23        return error(u"no req_num header in request")
    2424    else:
    2525        req_num = int(raw_req_num)
    2626        if req_num > 8:
    27             return error("req_num %s out of range" % req_num)
     27            return error(u"req_num %s out of range" % req_num)
    2828
    29     headers.append(("Access-Control-Expose-Headers", state_header))
     29    headers.append((b"Access-Control-Expose-Headers", state_header))
    3030    headers.append((state_header, req_num))
    31     headers.append(("A", req_num))
    32     headers.append(("B", req_num))
     31    headers.append((b"A", req_num))
     32    headers.append((b"B", req_num))
    3333
    3434    if req_num % 2:  # odd requests are the first in a test pair
    3535        if inm:
    3636            # what are you doing here? This should be a fresh request.
    37             return error("If-None-Match on first request")
     37            return error(u"If-None-Match on first request")
    3838        else:
    39             status = 200, "OK"
    40             headers.append(("Access-Control-Allow-Origin", "*"))
    41             headers.append(("Content-Type", "text/plain"))
    42             headers.append(("Cache-Control", "private, max-age=3, must-revalidate"))
    43             headers.append(("ETag", etag))
    44             return status, headers, "Success"
     39            status = 200, u"OK"
     40            headers.append((b"Access-Control-Allow-Origin", b"*"))
     41            headers.append((b"Content-Type", b"text/plain"))
     42            headers.append((b"Cache-Control", b"private, max-age=3, must-revalidate"))
     43            headers.append((b"ETag", etag))
     44            return status, headers, u"Success"
    4545    else:  # even requests are the second in a pair, and should have a good INM.
    4646        if inm != etag:
    4747            # Bad browser.
    4848            if inm == None:
    49                 return error("If-None-Match missing")
     49                return error(u"If-None-Match missing")
    5050            else:
    51                 return error("If-None-Match '%s' mismatches")
     51                return error(u"If-None-Match '%s' mismatches")
    5252        else:
    5353            if req_num == 2:
    5454                pass  # basic, vanilla check
    5555            elif req_num == 4:
    56                 headers.append(("Access-Control-Expose-Headers", "a, b"))
     56                headers.append((b"Access-Control-Expose-Headers", b"a, b"))
    5757            elif req_num == 6:
    58                 headers.append(("Access-Control-Expose-Headers", "a"))
     58                headers.append((b"Access-Control-Expose-Headers", b"a"))
    5959            elif req_num == 8:
    60                 headers.append(("Access-Control-Allow-Origin", "other.origin.example:80"))
    61             status = 304, "Not Modified"
    62             return status, headers, ""
     60                headers.append((b"Access-Control-Allow-Origin", b"other.origin.example:80"))
     61            status = 304, u"Not Modified"
     62            return status, headers, u""
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cache-304.py

    r233172 r263626  
    11def main(request, response):
    2     match = request.headers.get("If-None-Match", None)
    3     if match is not None and match == "mybestscript-v1":
    4         response.status = (304, "YEP")
    5         return ""
    6     response.headers.set("Access-Control-Allow-Origin", "*")
    7     response.headers.set("Cache-Control", "must-revalidate")
    8     response.headers.set("ETag", "mybestscript-v1")
    9     response.headers.set("Content-Type", "text/javascript")
    10     return "function hep() { }"
     2    match = request.headers.get(b"If-None-Match", None)
     3    if match is not None and match == b"mybestscript-v1":
     4        response.status = (304, u"YEP")
     5        return u""
     6    response.headers.set(b"Access-Control-Allow-Origin", b"*")
     7    response.headers.set(b"Cache-Control", b"must-revalidate")
     8    response.headers.set(b"ETag", b"mybestscript-v1")
     9    response.headers.set(b"Content-Type", b"text/javascript")
     10    return u"function hep() { }"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/checkandremove.py

    r213914 r263626  
    11def main(request, response):
    2     token = request.GET.first("token")
     2    token = request.GET.first(b"token")
    33    if request.server.stash.remove(token) is not None:
    4         return "1"
     4        return u"1"
    55    else:
    6         return "0"
     6        return u"0"
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cors-cookie.py

    r232903 r263626  
    11
    22def main(request, response):
    3     origin = request.GET.first("origin", request.headers["origin"])
    4     credentials = request.GET.first("credentials", "true")
     3    origin = request.GET.first(b"origin", request.headers[b"origin"])
     4    credentials = request.GET.first(b"credentials", b"true")
    55
    6     headers = [("Content-Type", "text/plain")]
    7     if origin != 'none':
    8         headers.append(("Access-Control-Allow-Origin", origin))
    9     if credentials != 'none':
    10         headers.append(("Access-Control-Allow-Credentials", credentials))
     6    headers = [(b"Content-Type", b"text/plain")]
     7    if origin != b'none':
     8        headers.append((b"Access-Control-Allow-Origin", origin))
     9    if credentials != b'none':
     10        headers.append((b"Access-Control-Allow-Credentials", credentials))
    1111
    12     ident = request.GET.first('ident', 'test')
     12    ident = request.GET.first(b'ident', b'test')
    1313
    1414    if ident in request.cookies:
     
    1616        response.delete_cookie(ident)
    1717    else:
    18         response.set_cookie(ident, "COOKIE")
    19         body = "NO_COOKIE"
     18        response.set_cookie(ident, b"COOKIE")
     19        body = u"NO_COOKIE"
    2020
    2121    return headers, body
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cors-makeheader.py

    r213914 r263626  
    11import json
    22
     3from wptserve.utils import isomorphic_decode
     4
    35def main(request, response):
    4     origin = request.GET.first("origin", request.headers.get('origin'))
     6    origin = request.GET.first(b"origin", request.headers.get(b'origin'))
    57
    6     if "check" in request.GET:
    7         token = request.GET.first("token")
     8    if b"check" in request.GET:
     9        token = request.GET.first(b"token")
    810        value = request.server.stash.take(token)
    911        if value is not None:
    10             if request.GET.first("check", None) == "keep":
     12            if request.GET.first(b"check", None) == b"keep":
    1113                request.server.stash.put(token, value)
    12             body = "1"
     14            body = u"1"
    1315        else:
    14             body = "0"
    15         return [("Content-Type", "text/plain")], body
     16            body = u"0"
     17        return [(b"Content-Type", b"text/plain")], body
    1618
    1719
    18     if origin != 'none':
    19         response.headers.set("Access-Control-Allow-Origin", origin)
    20     if 'origin2' in request.GET:
    21         response.headers.append("Access-Control-Allow-Origin", request.GET.first('origin2'))
     20    if origin != b'none':
     21        response.headers.set(b"Access-Control-Allow-Origin", origin)
     22    if b'origin2' in request.GET:
     23        response.headers.append(b"Access-Control-Allow-Origin", request.GET.first(b'origin2'))
    2224
    2325    #Preflight
    24     if 'headers' in request.GET:
    25         response.headers.set("Access-Control-Allow-Headers", request.GET.first('headers'))
    26     if 'credentials' in request.GET:
    27         response.headers.set("Access-Control-Allow-Credentials", request.GET.first('credentials'))
    28     if 'methods' in request.GET:
    29         response.headers.set("Access-Control-Allow-Methods", request.GET.first('methods'))
     26    if b'headers' in request.GET:
     27        response.headers.set(b"Access-Control-Allow-Headers", request.GET.first(b'headers'))
     28    if b'credentials' in request.GET:
     29        response.headers.set(b"Access-Control-Allow-Credentials", request.GET.first(b'credentials'))
     30    if b'methods' in request.GET:
     31        response.headers.set(b"Access-Control-Allow-Methods", request.GET.first(b'methods'))
    3032
    31     code_raw = request.GET.first('code', None)
     33    code_raw = request.GET.first(b'code', None)
    3234    if code_raw:
    3335        code = int(code_raw)
    3436    else:
    3537        code = None
    36     if request.method == 'OPTIONS':
     38    if request.method == u'OPTIONS':
    3739        #Override the response code if we're in a preflight and it's asked
    38         if 'preflight' in request.GET:
    39             code = int(request.GET.first('preflight'))
     40        if b'preflight' in request.GET:
     41            code = int(request.GET.first(b'preflight'))
    4042
    4143        #Log that the preflight actually happened if we have an ident
    42         if 'token' in request.GET:
    43             request.server.stash.put(request.GET['token'], True)
     44        if b'token' in request.GET:
     45            request.server.stash.put(request.GET[b'token'], True)
    4446
    45     if 'location' in request.GET:
     47    if b'location' in request.GET:
    4648        if code is None:
    4749            code = 302
    4850
    4951        if code >= 300 and code < 400:
    50             response.headers.set("Location", request.GET.first('location'))
     52            response.headers.set(b"Location", request.GET.first(b'location'))
    5153
    5254    headers = {}
    53     for name, values in request.headers.iteritems():
     55    for name, values in request.headers.items():
    5456        if len(values) == 1:
    55             headers[name] = values[0]
     57            headers[isomorphic_decode(name)] = isomorphic_decode(values[0])
    5658        else:
    5759            #I have no idea, really
    5860            headers[name] = values
    5961
    60     headers['get_value'] = request.GET.first('get_value', '')
     62    headers[u'get_value'] = isomorphic_decode(request.GET.first(b'get_value', b''))
    6163
    6264    body = json.dumps(headers)
    6365
    6466    if code:
    65         return (code, "StatusText"), [], body
     67        return (code, u"StatusText"), [], body
    6668    else:
    6769        return body
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/expose-headers.py

    r249946 r263626  
    11def main(request, response):
    22    response.add_required_headers = False
    3     output =  "HTTP/1.1 221 ALL YOUR BASE BELONG TO H1\r\n"
    4     output += "Access-Control-Allow-Origin: *\r\n"
    5     output += "BB-8: hey\r\n"
    6     output += "Content-Language: mkay\r\n"
    7     output += request.GET.first("expose") + "\r\n"
    8     output += "\r\n"
     3    output =  b"HTTP/1.1 221 ALL YOUR BASE BELONG TO H1\r\n"
     4    output += b"Access-Control-Allow-Origin: *\r\n"
     5    output += b"BB-8: hey\r\n"
     6    output += b"Content-Language: mkay\r\n"
     7    output += request.GET.first(b"expose") + b"\r\n"
     8    output += b"\r\n"
    99    response.writer.write(output)
    1010    response.close_connection = True
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/preflight.py

    r213914 r263626  
    11def main(request, response):
    2     headers = [("Content-Type", "text/plain")]
     2    headers = [(b"Content-Type", b"text/plain")]
    33
    4     if "check" in request.GET:
    5         token = request.GET.first("token")
     4    if b"check" in request.GET:
     5        token = request.GET.first(b"token")
    66        value = request.server.stash.take(token)
    77        if value == None:
    8             body = "0"
     8            body = u"0"
    99        else:
    10             if request.GET.first("check", None) == "keep":
     10            if request.GET.first(b"check", None) == b"keep":
    1111                request.server.stash.put(token, value)
    12             body = "1"
     12            body = u"1"
    1313
    1414        return headers, body
    1515
    16     if request.method == "OPTIONS":
    17         if not "Access-Control-Request-Method" in request.headers:
    18             response.set_error(400, "No Access-Control-Request-Method header")
    19             return "ERROR: No access-control-request-method in preflight!"
     16    if request.method == u"OPTIONS":
     17        if not b"Access-Control-Request-Method" in request.headers:
     18            response.set_error(400, u"No Access-Control-Request-Method header")
     19            return u"ERROR: No access-control-request-method in preflight!"
    2020
    21         headers.append(("Access-Control-Allow-Methods",
    22                         request.headers['Access-Control-Request-Method']))
     21        headers.append((b"Access-Control-Allow-Methods",
     22                        request.headers[b'Access-Control-Request-Method']))
    2323
    24         if "max_age" in request.GET:
    25             headers.append(("Access-Control-Max-Age", request.GET['max_age']))
     24        if b"max_age" in request.GET:
     25            headers.append((b"Access-Control-Max-Age", request.GET[b'max_age']))
    2626
    27         if "token" in request.GET:
    28             request.server.stash.put(request.GET.first("token"), 1)
     27        if b"token" in request.GET:
     28            request.server.stash.put(request.GET.first(b"token"), 1)
    2929
    30     headers.append(("Access-Control-Allow-Origin", "*"))
    31     headers.append(("Access-Control-Allow-Headers", "x-print"))
     30    headers.append((b"Access-Control-Allow-Origin", b"*"))
     31    headers.append((b"Access-Control-Allow-Headers", b"x-print"))
    3232
    33     body = request.headers.get("x-print", "NO")
     33    body = request.headers.get(b"x-print", b"NO")
    3434
    3535    return headers, body
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/status.py

    r232903 r263626  
     1from wptserve.utils import isomorphic_encode
     2
    13def main(request, response):
    2     response.headers.set("Access-Control-Allow-Origin", request.headers.get("origin"))
    3     response.headers.set("Access-Control-Expose-Headers", "X-Request-Method")
     4    response.headers.set(b"Access-Control-Allow-Origin", request.headers.get(b"origin"))
     5    response.headers.set(b"Access-Control-Expose-Headers", b"X-Request-Method")
    46
    5     if request.method == 'OPTIONS':
    6         response.headers.set("Access-Control-Allow-Methods",  "GET, CHICKEN, HEAD, POST, PUT")
     7    if request.method == u'OPTIONS':
     8        response.headers.set(b"Access-Control-Allow-Methods",  b"GET, CHICKEN, HEAD, POST, PUT")
    79
    8     if 'headers' in request.GET:
    9         response.headers.set("Access-Control-Allow-Headers",  request.GET.first('headers'))
     10    if b'headers' in request.GET:
     11        response.headers.set(b"Access-Control-Allow-Headers",  request.GET.first(b'headers'))
    1012
    11     response.headers.set("X-Request-Method", request.method)
     13    response.headers.set(b"X-Request-Method", isomorphic_encode(request.method))
    1214
    13     response.headers.set("X-A-C-Request-Method", request.headers.get("Access-Control-Request-Method", ""))
     15    response.headers.set(b"X-A-C-Request-Method", request.headers.get(b"Access-Control-Request-Method", b""))
    1416
    1517
    1618    #This should reasonably work for most response codes.
    1719    try:
    18         code = int(request.GET.first("code", 200))
     20        code = int(request.GET.first(b"code", 200))
    1921    except ValueError:
    2022        code = 200
    2123
    22     text = request.GET.first("text", "OMG")
     24    text = request.GET.first(b"text", b"OMG")
    2325
    24     if request.method == "OPTIONS" and "preflight" in request.GET:
     26    if request.method == u"OPTIONS" and b"preflight" in request.GET:
    2527        try:
    26             code = int(request.GET.first('preflight'))
     28            code = int(request.GET.first(b'preflight'))
    2729        except KeyError:
    2830            pass
     
    3032    status = code, text
    3133
    32     if "type" in request.GET:
    33         response.headers.set("Content-Type", request.GET.first('type'))
     34    if b"type" in request.GET:
     35        response.headers.set(b"Content-Type", request.GET.first(b'type'))
    3436
    35     body = request.GET.first('content', "")
     37    body = request.GET.first(b'content', b"")
    3638
    3739    return status, [], body
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/resources/w3c-import.log

    r232903 r263626  
    22Do NOT modify these tests directly in WebKit.
    33Instead, create a pull request on the WPT github:
    4         https://github.com/w3c/web-platform-tests
     4        https://github.com/web-platform-tests/wpt
    55
    66Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
     
    1616List of files:
    1717/LayoutTests/imported/w3c/web-platform-tests/cors/resources/304.py
    18 /LayoutTests/imported/w3c/web-platform-tests/cors/resources/access-control-expose-headers-parsing-2.asis
    19 /LayoutTests/imported/w3c/web-platform-tests/cors/resources/access-control-expose-headers-parsing.asis
     18/LayoutTests/imported/w3c/web-platform-tests/cors/resources/access-control-expose-headers.json
     19/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cache-304.py
    2020/LayoutTests/imported/w3c/web-platform-tests/cors/resources/checkandremove.py
    2121/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cors-cookie.py
    2222/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cors-headers.asis
    2323/LayoutTests/imported/w3c/web-platform-tests/cors/resources/cors-makeheader.py
     24/LayoutTests/imported/w3c/web-platform-tests/cors/resources/expose-headers.py
    2425/LayoutTests/imported/w3c/web-platform-tests/cors/resources/image-tainting-checker.sub.html
    2526/LayoutTests/imported/w3c/web-platform-tests/cors/resources/preflight.py
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/simple-requests-ch.tentative.htm

    r263625 r263626  
    4747}
    4848
    49 check_simple_headers({'Accept': 'test'})
    50 check_simple_headers({'accept-language': 'test'})
    51 check_simple_headers({'CONTENT-language': 'test'})
    52 
    53 check_simple_headers({'Content-Type': 'application/x-www-form-urlencoded'})
    54 check_simple_headers({'content-type': 'multipart/form-data'})
    55 check_simple_headers({'content-type': 'text/plain'})
    56 
    57 check_simple_headers({
    58                         'accept': 'test',
    59                         'accept-language': 'test',
    60                         'content-language': 'test',
    61                         'content-type': 'text/plain; parameter=whatever'
    62                      })
    63 
    6449check_simple_headers({
    6550                        'save-data': 'on',
     
    7055                     })
    7156
    72 check_simple('Get', {'content-type': 'text/plain; parameter=extra_bonus'})
    73 check_simple('post', {'content-type': 'text/plain'})
    74 
    75 /* Extra async test */
    76 
    77 var simple_async = async_test("Check simple headers (async)")
    78 simple_async.step(function (){
    79     var time = new Date().getTime(),
    80         client = new XMLHttpRequest()
    81     var uuid_token = token();
    82     client.open('POST', CROSSDOMAIN + 'resources/preflight.py?token='
    83                         + uuid_token, true)
    84 
    85     client.setRequestHeader('Accept', 'jewelry')
    86     client.setRequestHeader('accept-language', 'nn_NO,nn,en')
    87     client.setRequestHeader('content-type', 'text/plain; parameter=extra')
    88     client.setRequestHeader('content-Language', 'nn_NO')
    89 
    90     client.onload = simple_async.step_func(function() {
    91         assert_equals(client.getResponseHeader('content-type'), "text/plain", 'content-type response header')
    92         assert_equals(client.response, 'NO', 'response')
    93         simple_async.done()
    94     })
    95     client.onerror = simple_async.step_func(function () { assert_unreached('onerror') })
    96     client.send()
    97 })
    9857</script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/simple-requests-expected.txt

    r253331 r263626  
    2525PASS No preflight HEAD and {"accept":"test","accept-language":"test","content-language":"test","content-type":"text/plain; parameter=whatever"}
    2626PASS No preflight POST and {"accept":"test","accept-language":"test","content-language":"test","content-type":"text/plain; parameter=whatever"}
    27 FAIL No preflight GET and {"save-data":"on","device-memory":"2.0","dpr":"3.0","width":"1200","viewport-width":"1300"}  A network error occurred.
    28 FAIL No preflight HEAD and {"save-data":"on","device-memory":"2.0","dpr":"3.0","width":"1200","viewport-width":"1300"}  A network error occurred.
    29 FAIL No preflight POST and {"save-data":"on","device-memory":"2.0","dpr":"3.0","width":"1200","viewport-width":"1300"}  A network error occurred.
    3027PASS No preflight Get and {"content-type":"text/plain; parameter=extra_bonus"}
    3128PASS No preflight post and {"content-type":"text/plain"}
    32 FAIL Check simple headers (async) assert_unreached: onerror Reached unreachable code
     29PASS Check simple headers (async)
    3330
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/simple-requests.htm

    r232903 r263626  
    6262                     })
    6363
    64 check_simple_headers({
    65                         'save-data': 'on',
    66                         'device-memory': '2.0',
    67                         'dpr': '3.0',
    68                         'width': '1200',
    69                         'viewport-width': '1300'
    70                      })
    71 
    7264check_simple('Get', {'content-type': 'text/plain; parameter=extra_bonus'})
    7365check_simple('post', {'content-type': 'text/plain'})
     
    8476
    8577    client.setRequestHeader('Accept', 'jewelry')
    86     client.setRequestHeader('accept-language', 'nn_NO,nn,en')
     78    client.setRequestHeader('accept-language', 'nn-NO,nn,en')
    8779    client.setRequestHeader('content-type', 'text/plain; parameter=extra')
    88     client.setRequestHeader('content-Language', 'nn_NO')
     80    client.setRequestHeader('content-Language', 'nn-NO')
    8981
    9082    client.onload = simple_async.step_func(function() {
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/status-async.htm

    r213914 r263626  
    1515
    1616function statusRequest(method, code, text, content, type) {
    17     async_test("Status on " + method + " " + code, { timeout: 15000 })
     17    async_test("Status on " + method + " " + code)
    1818    .step(function() {
    1919        var client = new XMLHttpRequest()
     
    6161        expect_code = code
    6262
    63     async_test("Status on " + method + " " + code + (nonsimple?' (nonsimple)':''), { timeout: 15000 })
     63    async_test("Status on " + method + " " + code + (nonsimple?' (nonsimple)':''))
    6464    .step(function() {
    6565        var client = new XMLHttpRequest()
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/support.js

    r251490 r263626  
    1 // For ignoring exception names (just for testing)
    2 /*
    3 _real_assert_throws = assert_throws;
    4 function assert_throws(d, func, desc) {
    5     try {
    6         func();
    7     } catch(e) {
    8         return true;
    9     }
    10     assert_unreached("Didn't throw!");
    11 }
    12 */
    13 
    141function dirname(path) {
    152    return path.replace(/\/[^\/]*$/, '/')
  • trunk/LayoutTests/imported/w3c/web-platform-tests/cors/w3c-import.log

    r232903 r263626  
    22Do NOT modify these tests directly in WebKit.
    33Instead, create a pull request on the WPT github:
    4         https://github.com/w3c/web-platform-tests
     4        https://github.com/web-platform-tests/wpt
    55
    66Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
     
    1616List of files:
    1717/LayoutTests/imported/w3c/web-platform-tests/cors/304.htm
    18 /LayoutTests/imported/w3c/web-platform-tests/cors/OWNERS
     18/LayoutTests/imported/w3c/web-platform-tests/cors/META.yml
    1919/LayoutTests/imported/w3c/web-platform-tests/cors/README.md
    2020/LayoutTests/imported/w3c/web-platform-tests/cors/access-control-expose-headers-parsing.window.js
    21 /LayoutTests/imported/w3c/web-platform-tests/cors/allow-headers.htm
    2221/LayoutTests/imported/w3c/web-platform-tests/cors/basic.htm
     22/LayoutTests/imported/w3c/web-platform-tests/cors/client-hint-request-headers-2.tentative.htm
    2323/LayoutTests/imported/w3c/web-platform-tests/cors/client-hint-request-headers.htm
     24/LayoutTests/imported/w3c/web-platform-tests/cors/cors-safelisted-request-header.any.js
    2425/LayoutTests/imported/w3c/web-platform-tests/cors/credentials-flag.htm
    2526/LayoutTests/imported/w3c/web-platform-tests/cors/image-tainting-in-cross-origin-iframe.sub.html
     
    3536/LayoutTests/imported/w3c/web-platform-tests/cors/request-headers.htm
    3637/LayoutTests/imported/w3c/web-platform-tests/cors/response-headers.htm
     38/LayoutTests/imported/w3c/web-platform-tests/cors/script-304.html
     39/LayoutTests/imported/w3c/web-platform-tests/cors/simple-requests-ch.tentative.htm
    3740/LayoutTests/imported/w3c/web-platform-tests/cors/simple-requests.htm
    3841/LayoutTests/imported/w3c/web-platform-tests/cors/status-async.htm
  • trunk/LayoutTests/tests-options.json

    r263605 r263626  
    609609        "slow"
    610610    ],
     611    "imported/w3c/web-platform-tests/cors/304.htm": [
     612        "slow"
     613    ],
     614    "imported/w3c/web-platform-tests/cors/origin.htm": [
     615        "slow"
     616    ],
     617    "imported/w3c/web-platform-tests/cors/preflight-cache.htm": [
     618        "slow"
     619    ],
    611620    "imported/w3c/web-platform-tests/cors/status-async.htm": [
    612621        "slow"
Note: See TracChangeset for help on using the changeset viewer.