Changeset 276526 in webkit
- Timestamp:
- Apr 23, 2021, 4:01:48 PM (5 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 2 added
- 5 edited
- 1 copied
-
ChangeLog (modified) (1 diff)
-
http/tests/security/referrer-policy-header-expected.txt (modified) (7 diffs)
-
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) (copied from trunk/LayoutTests/http/tests/security/referrer-policy-header.html ) (2 diffs)
-
http/tests/security/referrer-policy-header.html (modified) (2 diffs)
-
http/tests/security/resources/postReferrer.py (modified) (2 diffs)
-
http/tests/security/resources/serve-referrer-policy-and-test.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r276520 r276526 1 2021-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 1 24 2021-04-23 Ryan Haddad <ryanhaddad@apple.com> 2 25 -
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'.13 1 Tests support for Referrer-Policy HTTP header. 14 2 … … 35 23 36 24 Testing '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 "25 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&id=6" 38 26 39 27 Testing '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 "28 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&id=7" 41 29 42 30 Testing '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 "31 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&id=8" 44 32 45 33 Testing '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 "34 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&id=9" 47 35 48 36 Testing '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 "37 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&id=10" 50 38 51 39 Testing 'Referrer-Policy: no-referrer-when-downgrade' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false … … 56 44 57 45 Testing '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 "46 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&id=13" 59 47 60 48 Testing 'Referrer-Policy: same-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false … … 74 62 75 63 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? 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 "64 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&id=19" 77 65 78 66 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? false … … 83 71 84 72 Testing '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 "73 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&id=22" 86 74 87 75 Testing 'Referrer-Policy: origin-when-cross-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false … … 89 77 90 78 Testing '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 "79 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&id=24" 92 80 93 81 Testing '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 "82 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&id=25" 95 83 96 84 Testing 'Referrer-Policy: invalid' - referrer origin: https://127.0.0.1:8443/ - destination origin: http://127.0.0.1:8000/ - isMultipartResponse? false … … 98 86 99 87 Testing '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 "88 PASS 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" 101 89 102 90 Testing '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 "91 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&id=28" 104 92 105 93 Testing '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? true109 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? true112 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? true115 PASS actualReferrer is ""116 117 Testing 'Referrer-Policy: origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true118 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? true121 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? true124 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? true127 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? true130 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? true133 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? true136 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? true139 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? true142 PASS actualReferrer is ""143 144 Testing 'Referrer-Policy: same-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true145 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? true148 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? true151 PASS actualReferrer is ""152 153 Testing 'Referrer-Policy: strict-origin' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true154 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? true157 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? true160 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? true163 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? true166 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? true169 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? true172 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? true175 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? true178 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? true181 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? true184 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? true187 PASS actualReferrer is ""188 189 Testing 'Referrer-Policy: ' - referrer origin: https://127.0.0.1:8443/ - destination origin: https://localhost:8443/ - isMultipartResponse? true190 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? true193 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? true196 94 PASS actualReferrer is "" 197 95 -
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 11 1 const sourceOrigin = "https://127.0.0.1:8443/"; 12 2 const crossOrigin = "https://localhost:8443/"; … … 48 38 ]; 49 39 50 let currentTestIndex = 0; 51 let isTestingMultipart = false; 40 let results = new Array(tests.length); 41 let resultCount = 0; 42 43 function 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 } 52 57 53 58 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(); 59 results[msg.data.id] = msg.data.referer; 60 if (++resultCount == results.length) 61 printResults(); 64 62 } 65 63 66 function run NextTest()64 function runTests(isTestingMultipart) 67 65 { 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); 76 75 } 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 76 } 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 ] --> 2 2 <html> 3 3 <head> … … 5 5 </head> 6 6 <body> 7 <script src="referrer-policy-header-test.js"></script> 7 8 <script> 8 9 description("Tests support for Referrer-Policy HTTP header."); 9 10 jsTestIsAsync = true; 10 11 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 } 12 if (window.testRunner) 13 testRunner.setStatisticsShouldDowngradeReferrer(false, () => { runTests(false /* multipart */); }); 90 14 </script> 91 15 </body> -
trunk/LayoutTests/http/tests/security/resources/postReferrer.py
r274244 r276526 3 3 import os 4 4 import sys 5 from urllib.parse import parse_qs 6 7 query = parse_qs(os.environ.get('QUERY_STRING', ''), keep_blank_values=True) 5 8 6 9 referer = os.environ.get('HTTP_REFERER', '') 10 id = query.get('id', [''])[0] 11 12 if len(id) > 0: 13 payload = "{{ id:{}, referer:'{}' }}".format(id, referer) 14 else: 15 payload = "'{}'".format(referer) 7 16 8 17 sys.stdout.write( … … 12 21 '<body>\n' 13 22 '<script>\n' 14 'top.postMessage( \'{}\', \'*\');\n'23 'top.postMessage({}, \'*\');\n' 15 24 '</script>\n' 16 '</body>\n'.format( referer)25 '</body>\n'.format(payload) 17 26 ) -
trunk/LayoutTests/http/tests/security/resources/serve-referrer-policy-and-test.py
r275917 r276526 9 9 is_testing_multipart = query.get('isTestingMultipart', [None])[0] 10 10 value = query.get('value', [''])[0] 11 id = query.get('id', [''])[0] 11 12 12 13 sys.stdout.write('Referrer-Policy: {}\r\n'.format(value)) … … 18 19 'Content-type: text/html\r\n' 19 20 '\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) 22 23 ) 23 24 else: … … 25 26 'Content-Type: text/html\r\n\r\n' 26 27 '\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) 28 29 )
Note:
See TracChangeset
for help on using the changeset viewer.