| OLD | NEW |
| 1 'use strict'; | 1 'use strict'; |
| 2 if (self.importScripts) { | 2 if (self.importScripts) { |
| 3 importScripts('/fetch/resources/fetch-test-helpers.js'); | 3 importScripts('/fetch/resources/fetch-test-helpers.js'); |
| 4 } | 4 } |
| 5 | 5 |
| 6 var BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php'; | 6 const BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php'; |
| 7 var OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php'; | 7 const OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php'; |
| 8 var referrer_source = location.href; | 8 const REFERRER_SOURCE = location.href; |
| 9 | 9 |
| 10 // Currently we cannot set request's referrer policy and the default policy | 10 // There are more tests in referrer/ directory. |
| 11 // is used if no CSP is set to the context. | 11 const TESTS = [ |
| 12 // But the default policy is equivalent to "no referrer when downgrade" and | 12 [BASE_URL, 'about:client', '', REFERRER_SOURCE], |
| 13 // we cannot test the case with fetch() (without serviceworker). | 13 [BASE_URL, 'about:client', 'no-referrer', '[no-referrer]'], |
| 14 var TESTS = [ | 14 [BASE_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], |
| 15 [BASE_URL, 'about:client', referrer_source], | 15 [BASE_URL, 'about:client', 'origin-only', BASE_ORIGIN + '/'], |
| 16 [BASE_URL, '', '[no-referrer]'], | 16 [BASE_URL, 'about:client', 'origin-when-cross-origin', REFERRER_SOURCE], |
| 17 [BASE_URL, '/foo', BASE_ORIGIN + '/foo'], | 17 [BASE_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], |
| 18 [OTHER_URL, 'about:client', referrer_source], | 18 [OTHER_URL, 'about:client', '', REFERRER_SOURCE], |
| 19 [OTHER_URL, '', '[no-referrer]'], | 19 [OTHER_URL, 'about:client', 'no-referrer', '[no-referrer]'], |
| 20 [OTHER_URL, '/foo', BASE_ORIGIN + '/foo'], | 20 [OTHER_URL, 'about:client', 'no-referrer-when-downgrade', REFERRER_SOURCE], |
| 21 [OTHER_URL, 'about:client', 'origin-only', BASE_ORIGIN + '/'], |
| 22 [OTHER_URL, 'about:client', 'origin-when-cross-origin', BASE_ORIGIN + '/'], |
| 23 [OTHER_URL, 'about:client', 'unsafe-url', REFERRER_SOURCE], |
| 24 |
| 25 [BASE_URL, '', '', '[no-referrer]'], |
| 26 [BASE_URL, '', 'no-referrer', '[no-referrer]'], |
| 27 [BASE_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'], |
| 28 [BASE_URL, '', 'origin-only', '[no-referrer]'], |
| 29 [BASE_URL, '', 'origin-when-cross-origin', '[no-referrer]'], |
| 30 [BASE_URL, '', 'unsafe-url', '[no-referrer]'], |
| 31 [OTHER_URL, '', '', '[no-referrer]'], |
| 32 [OTHER_URL, '', 'no-referrer', '[no-referrer]'], |
| 33 [OTHER_URL, '', 'no-referrer-when-downgrade', '[no-referrer]'], |
| 34 [OTHER_URL, '', 'origin-only', '[no-referrer]'], |
| 35 [OTHER_URL, '', 'origin-when-cross-origin', '[no-referrer]'], |
| 36 [OTHER_URL, '', 'unsafe-url', '[no-referrer]'], |
| 37 |
| 38 [BASE_URL, '/foo', '', BASE_ORIGIN + '/foo'], |
| 39 [BASE_URL, '/foo', 'no-referrer', '[no-referrer]'], |
| 40 [BASE_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], |
| 41 [BASE_URL, '/foo', 'origin-only', BASE_ORIGIN + '/'], |
| 42 [BASE_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/foo'], |
| 43 [BASE_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], |
| 44 [OTHER_URL, '/foo', '', BASE_ORIGIN + '/foo'], |
| 45 [OTHER_URL, '/foo', 'no-referrer', '[no-referrer]'], |
| 46 [OTHER_URL, '/foo', 'no-referrer-when-downgrade', BASE_ORIGIN + '/foo'], |
| 47 [OTHER_URL, '/foo', 'origin-only', BASE_ORIGIN + '/'], |
| 48 [OTHER_URL, '/foo', 'origin-when-cross-origin', BASE_ORIGIN + '/'], |
| 49 [OTHER_URL, '/foo', 'unsafe-url', BASE_ORIGIN + '/foo'], |
| 50 |
| 21 [BASE_URL, | 51 [BASE_URL, |
| 22 (BASE_URL + '/path#fragment?query#hash').replace('//', '//user:pass@'), | 52 (BASE_URL + '/path#fragment?query#hash').replace('//', '//user:pass@'), |
| 53 'unsafe-url', |
| 23 BASE_URL + '/path'], | 54 BASE_URL + '/path'], |
| 24 ]; | 55 ]; |
| 25 | 56 |
| 26 add_referrer_tests(TESTS); | 57 add_referrer_tests(TESTS); |
| 27 done(); | 58 done(); |
| OLD | NEW |