⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276526 in webkit


Ignore:
Timestamp:
Apr 23, 2021, 4:01:48 PM (5 years ago)
Author:
Chris Dumez
Message:

http/tests/security/referrer-policy-header.html is slow
https://bugs.webkit.org/show_bug.cgi?id=224998

Reviewed by Geoffrey Garen.

The test is a flaky timeout on the bots because it is slow. On my machine, it takes 17 seconds to run
it with a debug build. To speed things up, I am now running the subtests in parallel instead of
sequentially. I also split the test in 2 (regular response vs multipart response). Each tests now takes
about ~5 seconds to run on my machine.

  • http/tests/security/referrer-policy-header-expected.txt:
  • http/tests/security/referrer-policy-header-multipart-expected.txt: Added.
  • http/tests/security/referrer-policy-header-multipart.html: Added.
  • http/tests/security/referrer-policy-header-test.js: Copied from LayoutTests/http/tests/security/referrer-policy-header.html.

(printResults):
(onmessage):
(runTests):

  • http/tests/security/referrer-policy-header.html:
  • http/tests/security/resources/postReferrer.py:
  • http/tests/security/resources/serve-referrer-policy-and-test.py:
Location:
trunk/LayoutTests
Files:
2 added
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r276520 r276526  
     12021-04-23  Chris Dumez  <cdumez@apple.com>
     2
     3        http/tests/security/referrer-policy-header.html is slow
     4        https://bugs.webkit.org/show_bug.cgi?id=224998
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        The test is a flaky timeout on the bots because it is slow. On my machine, it takes 17 seconds to run
     9        it with a debug build. To speed things up, I am now running the subtests in parallel instead of
     10        sequentially. I also split the test in 2 (regular response vs multipart response). Each tests now takes
     11        about ~5 seconds to run on my machine.
     12
     13        * http/tests/security/referrer-policy-header-expected.txt:
     14        * http/tests/security/referrer-policy-header-multipart-expected.txt: Added.
     15        * http/tests/security/referrer-policy-header-multipart.html: Added.
     16        * http/tests/security/referrer-policy-header-test.js: Copied from LayoutTests/http/tests/security/referrer-policy-header.html.
     17        (printResults):
     18        (onmessage):
     19        (runTests):
     20        * http/tests/security/referrer-policy-header.html:
     21        * http/tests/security/resources/postReferrer.py:
     22        * http/tests/security/resources/serve-referrer-policy-and-test.py:
     23
    1242021-04-23  Ryan Haddad  <ryanhaddad@apple.com>
    225
  • trunk/LayoutTests/http/tests/security/referrer-policy-header-expected.txt

    r275917 r276526  
    1 CONSOLE MESSAGE: Failed to set referrer policy: The value 'invalid' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    2 CONSOLE MESSAGE: Failed to set referrer policy: The value 'invalid' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    3 CONSOLE MESSAGE: Failed to set referrer policy: The value 'invalid' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    4 CONSOLE MESSAGE: Failed to set referrer policy: The value '' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    5 CONSOLE MESSAGE: Failed to set referrer policy: The value '' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    6 CONSOLE MESSAGE: Failed to set referrer policy: The value '' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    7 CONSOLE MESSAGE: Failed to set referrer policy: The value 'invalid' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    8 CONSOLE MESSAGE: Failed to set referrer policy: The value 'invalid' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    9 CONSOLE MESSAGE: Failed to set referrer policy: The value 'invalid' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    10 CONSOLE MESSAGE: Failed to set referrer policy: The value '' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    11 CONSOLE MESSAGE: Failed to set referrer policy: The value '' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    12 CONSOLE MESSAGE: Failed to set referrer policy: The value '' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin-when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'.
    131Tests support for Referrer-Policy HTTP header.
    142
     
    3523
    3624Testing 'Referrer-Policy: unsafe-url' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? false
    37 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=https://localhost:8443/&isTestingMultipart=0"
     25PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=https://localhost:8443/&isTestingMultipart=0&id=6"
    3826
    3927Testing 'Referrer-Policy: unsafe-url' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? false
    40 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0"
     28PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0&id=7"
    4129
    4230Testing 'Referrer-Policy: unsafe-url' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false
    43 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=http://127.0.0.1:8000/&isTestingMultipart=0"
     31PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=http://127.0.0.1:8000/&isTestingMultipart=0&id=8"
    4432
    4533Testing 'Referrer-Policy: no-referrer-when-downgrade' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? false
    46 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=no-referrer-when-downgrade&destinationOrigin=https://localhost:8443/&isTestingMultipart=0"
     34PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=no-referrer-when-downgrade&destinationOrigin=https://localhost:8443/&isTestingMultipart=0&id=9"
    4735
    4836Testing 'Referrer-Policy: no-referrer-when-downgrade' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? false
    49 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=no-referrer-when-downgrade&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0"
     37PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=no-referrer-when-downgrade&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0&id=10"
    5038
    5139Testing 'Referrer-Policy: no-referrer-when-downgrade' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false
     
    5644
    5745Testing 'Referrer-Policy: same-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? false
    58 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=same-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0"
     46PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=same-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0&id=13"
    5947
    6048Testing 'Referrer-Policy: same-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false
     
    7462
    7563Testing 'Referrer-Policy: strict-origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? false
    76 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=strict-origin-when-cross-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0"
     64PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=strict-origin-when-cross-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0&id=19"
    7765
    7866Testing 'Referrer-Policy: strict-origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false
     
    8371
    8472Testing 'Referrer-Policy: origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? false
    85 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=origin-when-cross-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0"
     73PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=origin-when-cross-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0&id=22"
    8674
    8775Testing 'Referrer-Policy: origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false
     
    8977
    9078Testing 'Referrer-Policy: invalid' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? false
    91 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=invalid&destinationOrigin=https://localhost:8443/&isTestingMultipart=0"
     79PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=invalid&destinationOrigin=https://localhost:8443/&isTestingMultipart=0&id=24"
    9280
    9381Testing 'Referrer-Policy: invalid' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? false
    94 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=invalid&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0"
     82PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=invalid&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0&id=25"
    9583
    9684Testing 'Referrer-Policy: invalid' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false
     
    9886
    9987Testing 'Referrer-Policy: ' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? false
    100 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=&destinationOrigin=https://localhost:8443/&isTestingMultipart=0"
     88PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=&destinationOrigin=https://localhost:8443/&isTestingMultipart=0&id=27"
    10189
    10290Testing 'Referrer-Policy: ' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? false
    103 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0"
     91PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=0&id=28"
    10492
    10593Testing 'Referrer-Policy: ' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false
    106 PASS actualReferrer is ""
    107 
    108 Testing 'Referrer-Policy: no-referrer' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    109 PASS actualReferrer is ""
    110 
    111 Testing 'Referrer-Policy: no-referrer' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    112 PASS actualReferrer is ""
    113 
    114 Testing 'Referrer-Policy: no-referrer' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    115 PASS actualReferrer is ""
    116 
    117 Testing 'Referrer-Policy: origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    118 PASS actualReferrer is "https://127.0.0.1:8443/"
    119 
    120 Testing 'Referrer-Policy: origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    121 PASS actualReferrer is "https://127.0.0.1:8443/"
    122 
    123 Testing 'Referrer-Policy: origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    124 PASS actualReferrer is "https://127.0.0.1:8443/"
    125 
    126 Testing 'Referrer-Policy: unsafe-url' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    127 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=https://localhost:8443/&isTestingMultipart=1"
    128 
    129 Testing 'Referrer-Policy: unsafe-url' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    130 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=1"
    131 
    132 Testing 'Referrer-Policy: unsafe-url' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    133 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=unsafe-url&destinationOrigin=http://127.0.0.1:8000/&isTestingMultipart=1"
    134 
    135 Testing 'Referrer-Policy: no-referrer-when-downgrade' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    136 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=no-referrer-when-downgrade&destinationOrigin=https://localhost:8443/&isTestingMultipart=1"
    137 
    138 Testing 'Referrer-Policy: no-referrer-when-downgrade' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    139 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=no-referrer-when-downgrade&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=1"
    140 
    141 Testing 'Referrer-Policy: no-referrer-when-downgrade' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    142 PASS actualReferrer is ""
    143 
    144 Testing 'Referrer-Policy: same-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    145 PASS actualReferrer is ""
    146 
    147 Testing 'Referrer-Policy: same-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    148 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=same-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=1"
    149 
    150 Testing 'Referrer-Policy: same-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    151 PASS actualReferrer is ""
    152 
    153 Testing 'Referrer-Policy: strict-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    154 PASS actualReferrer is "https://127.0.0.1:8443/"
    155 
    156 Testing 'Referrer-Policy: strict-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    157 PASS actualReferrer is "https://127.0.0.1:8443/"
    158 
    159 Testing 'Referrer-Policy: strict-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    160 PASS actualReferrer is ""
    161 
    162 Testing 'Referrer-Policy: strict-origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    163 PASS actualReferrer is "https://127.0.0.1:8443/"
    164 
    165 Testing 'Referrer-Policy: strict-origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    166 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=strict-origin-when-cross-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=1"
    167 
    168 Testing 'Referrer-Policy: strict-origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    169 PASS actualReferrer is ""
    170 
    171 Testing 'Referrer-Policy: origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    172 PASS actualReferrer is "https://127.0.0.1:8443/"
    173 
    174 Testing 'Referrer-Policy: origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    175 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=origin-when-cross-origin&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=1"
    176 
    177 Testing 'Referrer-Policy: origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    178 PASS actualReferrer is "https://127.0.0.1:8443/"
    179 
    180 Testing 'Referrer-Policy: invalid' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    181 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=invalid&destinationOrigin=https://localhost:8443/&isTestingMultipart=1"
    182 
    183 Testing 'Referrer-Policy: invalid' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    184 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=invalid&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=1"
    185 
    186 Testing 'Referrer-Policy: invalid' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    187 PASS actualReferrer is ""
    188 
    189 Testing 'Referrer-Policy: ' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true
    190 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=&destinationOrigin=https://localhost:8443/&isTestingMultipart=1"
    191 
    192 Testing 'Referrer-Policy: ' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://127.0.0.1:8443/ - isMultipartResponse? true
    193 PASS actualReferrer is "https://127.0.0.1:8443/security/resources/serve-referrer-policy-and-test.py?value=&destinationOrigin=https://127.0.0.1:8443/&isTestingMultipart=1"
    194 
    195 Testing 'Referrer-Policy: ' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? true
    19694PASS actualReferrer is ""
    19795
  • trunk/LayoutTests/http/tests/security/referrer-policy-header-test.js

    r276524 r276526  
    1 <!DOCTYPE html>
    2 <html>
    3 <head>
    4 <script src="/js-test-resources/js-test.js"></script>
    5 </head>
    6 <body>
    7 <script>
    8 description("Tests support for Referrer-Policy HTTP header.");
    9 jsTestIsAsync = true;
    10 
    111const sourceOrigin = "https://127.0.0.1:8443/";
    122const crossOrigin = "https://localhost:8443/";
     
    4838];
    4939
    50 let currentTestIndex = 0;
    51 let isTestingMultipart = false;
     40let results = new Array(tests.length);
     41let resultCount = 0;
     42
     43function printResults()
     44{
     45    for (let i = 0; i < results.length; i++) {
     46        let currentTest = tests[i];
     47        actualReferrer = results[i]
     48        debug("Testing 'Referrer-Policy: " + currentTest[0] + "' - referrer origin: " + sourceOrigin + " - destination origin: " + currentTest[2] + " - isMultipartResponse? " + isTestingMultipart);
     49        if (currentTest[1] === fullSourceURL)
     50            shouldBeEqualToString("actualReferrer", sourceOrigin + "security/resources/serve-referrer-policy-and-test.py?value=" + currentTest[0] + "&destinationOrigin=" + currentTest[2] + "&isTestingMultipart=" + (isTestingMultipart ? "1" : "0") + "&id=" + i);
     51        else
     52            shouldBeEqualToString("actualReferrer", "" + currentTest[1]);
     53        debug("");
     54    }
     55    finishJSTest();
     56}
    5257
    5358onmessage = (msg) => {
    54     actualReferrer = msg.data;
    55     if (currentTest[1] === fullSourceURL)
    56         shouldBeEqualToString("actualReferrer", sourceOrigin + "security/resources/serve-referrer-policy-and-test.py?value=" + currentTest[0] + "&destinationOrigin=" + currentTest[2] + "&isTestingMultipart=" + (isTestingMultipart ? "1" : "0"));
    57     else
    58         shouldBeEqualToString("actualReferrer", "" + currentTest[1]);
    59     debug("");
    60 
    61     frame.remove();
    62     currentTestIndex++;
    63     runNextTest();
     59    results[msg.data.id] = msg.data.referer;
     60    if (++resultCount == results.length)
     61        printResults();
    6462}
    6563
    66 function runNextTest()
     64function runTests(isTestingMultipart)
    6765{
    68     if (currentTestIndex >= tests.length) {
    69         if (!isTestingMultipart) {
    70             isTestingMultipart = true;
    71             currentTestIndex = 0;
    72         } else {
    73             finishJSTest();
    74             return;
    75         }
     66    window.isTestingMultipart = isTestingMultipart;
     67    for (let i = 0; i < results.length; i++) {
     68        let currentTest = tests[i % tests.length];
     69        let isTestingMultipart = i >= tests.length;
     70
     71        let frame = document.createElement("iframe");
     72        frame.style = "display:none";
     73        frame.src = sourceOrigin + "security/resources/serve-referrer-policy-and-test.py?value=" + currentTest[0] + "&destinationOrigin=" + currentTest[2] + "&isTestingMultipart=" + (isTestingMultipart ? "1" : "0") + "&id=" + i;
     74        document.body.appendChild(frame);
    7675    }
    77 
    78     currentTest = tests[currentTestIndex];
    79     debug("Testing 'Referrer-Policy: " + currentTest[0] + "' - referrer origin: " + sourceOrigin + " - destination origin: " + currentTest[2] + " - isMultipartResponse? " + isTestingMultipart);
    80     frame = document.createElement("iframe");
    81     frame.src = sourceOrigin + "security/resources/serve-referrer-policy-and-test.py?value=" + currentTest[0] + "&destinationOrigin=" + currentTest[2] + "&isTestingMultipart=" + (isTestingMultipart ? "1" : "0");
    82     document.body.appendChild(frame);   
    8376}
    84 
    85 if (window.testRunner) {
    86     testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
    87         runNextTest();
    88     });
    89 }
    90 </script>
    91 </body>
    92 </html>
  • trunk/LayoutTests/http/tests/security/referrer-policy-header.html

    r275917 r276526  
    1 <!DOCTYPE html>
     1<!DOCTYPE html><!-- webkit-test-runner [ dumpJSConsoleLogInStdErr=true ] -->
    22<html>
    33<head>
     
    55</head>
    66<body>
     7<script src="referrer-policy-header-test.js"></script>
    78<script>
    89description("Tests support for Referrer-Policy HTTP header.");
    910jsTestIsAsync = true;
    1011
    11 const sourceOrigin = "https://127.0.0.1:8443/";
    12 const crossOrigin = "https://localhost:8443/";
    13 const downgradedOrigin = "http://127.0.0.1:8000/";
    14 const fullSourceURL = "fullSourceURL";
    15 
    16 // [Referrer-Policy header, expected referrer, destination origin].
    17 let tests = [
    18     ["no-referrer", "", crossOrigin],
    19     ["no-referrer", "", sourceOrigin],
    20     ["no-referrer", "", downgradedOrigin],
    21     ["origin", sourceOrigin, crossOrigin],
    22     ["origin", sourceOrigin, sourceOrigin],
    23     ["origin", sourceOrigin, downgradedOrigin],
    24     ["unsafe-url", fullSourceURL, crossOrigin],
    25     ["unsafe-url", fullSourceURL, sourceOrigin],
    26     ["unsafe-url", fullSourceURL, downgradedOrigin],
    27     ["no-referrer-when-downgrade", fullSourceURL, crossOrigin],
    28     ["no-referrer-when-downgrade", fullSourceURL, sourceOrigin],
    29     ["no-referrer-when-downgrade", "", downgradedOrigin],
    30     ["same-origin", "", crossOrigin],
    31     ["same-origin", fullSourceURL, sourceOrigin],
    32     ["same-origin", "", downgradedOrigin],
    33     ["strict-origin", sourceOrigin, crossOrigin],
    34     ["strict-origin", sourceOrigin, sourceOrigin],
    35     ["strict-origin", "", downgradedOrigin],
    36     ["strict-origin-when-cross-origin", sourceOrigin, crossOrigin],
    37     ["strict-origin-when-cross-origin", fullSourceURL, sourceOrigin],
    38     ["strict-origin-when-cross-origin", "", downgradedOrigin],
    39     ["origin-when-cross-origin", sourceOrigin, crossOrigin],
    40     ["origin-when-cross-origin", fullSourceURL, sourceOrigin],
    41     ["origin-when-cross-origin", sourceOrigin, downgradedOrigin],
    42     ["invalid", fullSourceURL, crossOrigin],
    43     ["invalid", fullSourceURL, sourceOrigin],
    44     ["invalid", "", downgradedOrigin],
    45     ["", fullSourceURL, crossOrigin],
    46     ["", fullSourceURL, sourceOrigin],
    47     ["", "", downgradedOrigin],
    48 ];
    49 
    50 let currentTestIndex = 0;
    51 let isTestingMultipart = false;
    52 
    53 onmessage = (msg) => {
    54     actualReferrer = msg.data;
    55     if (currentTest[1] === fullSourceURL)
    56         shouldBeEqualToString("actualReferrer", sourceOrigin + "security/resources/serve-referrer-policy-and-test.py?value=" + currentTest[0] + "&destinationOrigin=" + currentTest[2] + "&isTestingMultipart=" + (isTestingMultipart ? "1" : "0"));
    57     else
    58         shouldBeEqualToString("actualReferrer", "" + currentTest[1]);
    59     debug("");
    60 
    61     frame.remove();
    62     currentTestIndex++;
    63     runNextTest();
    64 }
    65 
    66 function runNextTest()
    67 {
    68     if (currentTestIndex >= tests.length) {
    69         if (!isTestingMultipart) {
    70             isTestingMultipart = true;
    71             currentTestIndex = 0;
    72         } else {
    73             finishJSTest();
    74             return;
    75         }
    76     }
    77 
    78     currentTest = tests[currentTestIndex];
    79     debug("Testing 'Referrer-Policy: " + currentTest[0] + "' - referrer origin: " + sourceOrigin + " - destination origin: " + currentTest[2] + " - isMultipartResponse? " + isTestingMultipart);
    80     frame = document.createElement("iframe");
    81     frame.src = sourceOrigin + "security/resources/serve-referrer-policy-and-test.py?value=" + currentTest[0] + "&destinationOrigin=" + currentTest[2] + "&isTestingMultipart=" + (isTestingMultipart ? "1" : "0");
    82     document.body.appendChild(frame);   
    83 }
    84 
    85 if (window.testRunner) {
    86     testRunner.setStatisticsShouldDowngradeReferrer(false, function () {
    87         runNextTest();
    88     });
    89 }
     12if (window.testRunner)
     13    testRunner.setStatisticsShouldDowngradeReferrer(false, () => { runTests(false /* multipart */); });
    9014</script>
    9115</body>
  • trunk/LayoutTests/http/tests/security/resources/postReferrer.py

    r274244 r276526  
    33import os
    44import sys
     5from urllib.parse import parse_qs
     6
     7query = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True)
    58
    69referer = os.environ.get('HTTP_REFERER', '')
     10id = query.get('id', [''])[0]
     11
     12if len(id) > 0:
     13    payload = "{{ id:{}, referer:'{}' }}".format(id, referer)
     14else:
     15    payload = "'{}'".format(referer)
    716
    817sys.stdout.write(
     
    1221    '<body>\n'
    1322    '<script>\n'
    14     'top.postMessage(\'{}\', \'*\');\n'
     23    'top.postMessage({}, \'*\');\n'
    1524    '</script>\n'
    16     '</body>\n'.format(referer)
     25    '</body>\n'.format(payload)
    1726)
  • trunk/LayoutTests/http/tests/security/resources/serve-referrer-policy-and-test.py

    r275917 r276526  
    99is_testing_multipart = query.get('isTestingMultipart', [None])[0]
    1010value = query.get('value', [''])[0]
     11id = query.get('id', [''])[0]
    1112
    1213sys.stdout.write('Referrer-Policy: {}\r\n'.format(value))
     
    1819        'Content-type: text/html\r\n'
    1920        '\r\n'
    20         '<iframe src=\'{}security/resources/postReferrer.py\'></iframe>\r\n'
    21         '--boundary\r\n'.format(value, destination_origin)
     21        '<iframe src=\'{}security/resources/postReferrer.py?id={}\'></iframe>\r\n'
     22        '--boundary\r\n'.format(value, destination_origin, id)
    2223    )
    2324else:
     
    2526        'Content-Type: text/html\r\n\r\n'
    2627        '\r\n'
    27         '<iframe src=\'{}security/resources/postReferrer.py\'></iframe>\r\n'.format(destination_origin)
     28        '<iframe src=\'{}security/resources/postReferrer.py?id={}\'></iframe>\r\n'.format(destination_origin, id)
    2829    )
Note: See TracChangeset for help on using the changeset viewer.