Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/fetch/referrer/origin-when-cross-origin-document.html

Issue 1844413006: Support ReferrerPolicy in Fetch API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update-referrer-policy
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!doctype html> 1 <!doctype html>
2 <html> 2 <html>
3 <meta http-equiv = "Content-Security-Policy" content = "referrer origin-when-cro ss-origin"> 3 <meta http-equiv = "Content-Security-Policy" content = "referrer origin-when-cro ss-origin">
4 <title>Fetch in a document with &quot;referrer origin-when-cross-origin&quot; po licy</title> 4 <title>Fetch in a document with &quot;referrer origin-when-cross-origin&quot; po licy</title>
5 <body> 5 <body>
6 <script src = "/resources/testharness.js"></script> 6 <script src = "/resources/testharness.js"></script>
7 <script src = "/resources/testharness-helpers.js"></script> 7 <script src = "/resources/testharness-helpers.js"></script>
8 <script src = "/resources/testharnessreport.js"></script> 8 <script src = "/resources/testharnessreport.js"></script>
9 <script src = "/serviceworker/resources/test-helpers.js"></script> 9 <script src = "/serviceworker/resources/test-helpers.js"></script>
10 <script src = "/fetch/resources/fetch-test-options.js"></script> 10 <script src = "/fetch/resources/fetch-test-options.js"></script>
11 <script src = "/fetch/resources/fetch-test-helpers.js"></script> 11 <script src = "/fetch/resources/fetch-test-helpers.js"></script>
12 <script> 12 <script>
13 13
14 var BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php'; 14 const BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php';
15 var OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php'; 15 const OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php';
16 const REFERRER_SOURCE = location.href;
16 17
17 test(function(t) { 18 test(function(t) {
18 assert_equals(new Request(BASE_URL).referrer, 'about:client'); 19 assert_equals(new Request(BASE_URL).referrer, 'about:client');
19 }, 'Request referrer property should be immune to the page referrer policy'); 20 }, 'Request referrer property should be immune to the page referrer policy');
20 21
21 var TESTS = [ 22 const TESTS = [
22 [BASE_URL, 'about:client', location.href], 23 [BASE_URL, 'about:client', '', REFERRER_SOURCE],
23 [BASE_URL, '', '[no-referrer]'], 24 [BASE_URL, 'about:client', 'no-referrer', '[no-referrer]'],
24 [BASE_URL, '/foo', BASE_ORIGIN + '/foo'], 25 [BASE_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE],
25 [OTHER_URL, 'about:client', BASE_ORIGIN + '/'], 26 [BASE_URL, 'about:client', 'origin', BASE_ORIGIN + '/'],
26 [OTHER_URL, '', '[no-referrer]'], 27 [BASE_URL, 'about:client', 'origin-when-cross-origin', REFERRER_SOURCE],
27 [OTHER_URL, '/foo', BASE_ORIGIN + '/'], 28 [BASE_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE],
29 [OTHER_URL, 'about:client', '', BASE_ORIGIN + '/'],
30 [OTHER_URL, 'about:client', 'no-referrer', '[no-referrer]'],
31 [OTHER_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE],
32 [OTHER_URL, 'about:client', 'origin', BASE_ORIGIN + '/'],
33 [OTHER_URL, 'about:client', 'origin-when-cross-origin', BASE_ORIGIN + '/'],
34 [OTHER_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE],
35
36 [BASE_URL, '', '', '[no-referrer]'],
37 [BASE_URL, '', 'no-referrer', '[no-referrer]'],
38 [BASE_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'],
39 [BASE_URL, '', 'origin', '[no-referrer]'],
40 [BASE_URL, '', 'origin-when-cross-origin', '[no-referrer]'],
41 [BASE_URL, '', 'unsafe-url', '[no-referrer]'],
42 [OTHER_URL, '', '', '[no-referrer]'],
43 [OTHER_URL, '', 'no-referrer', '[no-referrer]'],
44 [OTHER_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'],
45 [OTHER_URL, '', 'origin', '[no-referrer]'],
46 [OTHER_URL, '', 'origin-when-cross-origin', '[no-referrer]'],
47 [OTHER_URL, '', 'unsafe-url', '[no-referrer]'],
48
49 [BASE_URL, '/foo', '', BASE_ORIGIN + '/foo'],
50 [BASE_URL, '/foo', 'no-referrer', '[no-referrer]'],
51 [BASE_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'],
52 [BASE_URL, '/foo', 'origin', BASE_ORIGIN + '/'],
53 [BASE_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/foo'],
54 [BASE_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'],
55 [OTHER_URL, '/foo', '', BASE_ORIGIN + '/'],
56 [OTHER_URL, '/foo', 'no-referrer', '[no-referrer]'],
57 [OTHER_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'],
58 [OTHER_URL, '/foo', 'origin', BASE_ORIGIN + '/'],
59 [OTHER_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/'],
60 [OTHER_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'],
28 ]; 61 ];
29 62
30 add_referrer_tests(TESTS); 63 add_referrer_tests(TESTS);
31 done(); 64 done();
32 </script> 65 </script>
33 </body> 66 </body>
34 </html> 67 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698