| <!doctype html> |
| <html> |
| <meta name="referrer" content="no-referrer"> |
| <title>Fetch in a document with "referrer no-referrer" policy</title> |
| <body> |
| <script src = "/resources/get-host-info.js?pipe=sub"></script> |
| <script src = "/resources/testharness.js"></script> |
| <script src = "/resources/testharnessreport.js"></script> |
| <script src = "/serviceworker/resources/test-helpers.js"></script> |
| <script src = "/fetch/resources/fetch-test-options.js"></script> |
| <script src = "/fetch/resources/fetch-test-helpers.js"></script> |
| <script> |
| |
| const {BASE_ORIGIN, OTHER_ORIGIN} = get_fetch_test_options(); |
| const BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php'; |
| const OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php'; |
| const REFERRER_SOURCE = location.href; |
| |
| test(function(t) { |
| assert_equals(new Request(BASE_URL).referrer, 'about:client'); |
| }, 'Request referrer property should be immune to the page referrer policy'); |
| |
| const TESTS = [ |
| [BASE_URL, 'about:client', '', '[no-referrer]'], |
| [BASE_URL, 'about:client', 'no-referrer', '[no-referrer]'], |
| [BASE_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], |
| [BASE_URL, 'about:client', 'origin', BASE_ORIGIN + '/'], |
| [BASE_URL, 'about:client', 'origin-when-cross-origin', REFERRER_SOURCE], |
| [BASE_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], |
| [OTHER_URL, 'about:client', '', '[no-referrer]'], |
| [OTHER_URL, 'about:client', 'no-referrer', '[no-referrer]'], |
| [OTHER_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], |
| [OTHER_URL, 'about:client', 'origin', BASE_ORIGIN + '/'], |
| [OTHER_URL, 'about:client', 'origin-when-cross-origin', BASE_ORIGIN + '/'], |
| [OTHER_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], |
| |
| [BASE_URL, '', '', '[no-referrer]'], |
| [BASE_URL, '', 'no-referrer', '[no-referrer]'], |
| [BASE_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'], |
| [BASE_URL, '', 'origin', '[no-referrer]'], |
| [BASE_URL, '', 'origin-when-cross-origin', '[no-referrer]'], |
| [BASE_URL, '', 'unsafe-url', '[no-referrer]'], |
| [OTHER_URL, '', '', '[no-referrer]'], |
| [OTHER_URL, '', 'no-referrer', '[no-referrer]'], |
| [OTHER_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'], |
| [OTHER_URL, '', 'origin', '[no-referrer]'], |
| [OTHER_URL, '', 'origin-when-cross-origin', '[no-referrer]'], |
| [OTHER_URL, '', 'unsafe-url', '[no-referrer]'], |
| |
| [BASE_URL, '/foo', '', '[no-referrer]'], |
| [BASE_URL, '/foo', 'no-referrer', '[no-referrer]'], |
| [BASE_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], |
| [BASE_URL, '/foo', 'origin', BASE_ORIGIN + '/'], |
| [BASE_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/foo'], |
| [BASE_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], |
| [OTHER_URL, '/foo', '', '[no-referrer]'], |
| [OTHER_URL, '/foo', 'no-referrer', '[no-referrer]'], |
| [OTHER_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], |
| [OTHER_URL, '/foo', 'origin', BASE_ORIGIN + '/'], |
| [OTHER_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/'], |
| [OTHER_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], |
| ]; |
| |
| add_referrer_tests(TESTS); |
| done(); |
| </script> |
| </body> |
| </html> |