| Index: third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/referrer.js
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/referrer.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/referrer.js
|
| index 0017bd8e23ae45a2083529a1b4d9e40f3b12bbc0..eec6b293d75a70670869480d61e07c926cad5a55 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/referrer.js
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/referrer.js
|
| @@ -3,23 +3,54 @@ if (self.importScripts) {
|
| importScripts('/fetch/resources/fetch-test-helpers.js');
|
| }
|
|
|
| -var BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php';
|
| -var OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php';
|
| -var referrer_source = location.href;
|
| +const BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php';
|
| +const OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php';
|
| +const REFERRER_SOURCE = location.href;
|
| +
|
| +// There are more tests in referrer/ directory.
|
| +const TESTS = [
|
| + [BASE_URL, 'about:client', '', REFERRER_SOURCE],
|
| + [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', '', REFERRER_SOURCE],
|
| + [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', '', BASE_ORIGIN + '/foo'],
|
| + [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', '', BASE_ORIGIN + '/foo'],
|
| + [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'],
|
|
|
| -// Currently we cannot set request's referrer policy and the default policy
|
| -// is used if no CSP is set to the context.
|
| -// But the default policy is equivalent to "no referrer when downgrade" and
|
| -// we cannot test the case with fetch() (without serviceworker).
|
| -var TESTS = [
|
| - [BASE_URL, 'about:client', referrer_source],
|
| - [BASE_URL, '', '[no-referrer]'],
|
| - [BASE_URL, '/foo', BASE_ORIGIN + '/foo'],
|
| - [OTHER_URL, 'about:client', referrer_source],
|
| - [OTHER_URL, '', '[no-referrer]'],
|
| - [OTHER_URL, '/foo', BASE_ORIGIN + '/foo'],
|
| [BASE_URL,
|
| (BASE_URL + '/path#fragment?query#hash').replace('//', '//user:pass@'),
|
| + 'unsafe-url',
|
| BASE_URL + '/path'],
|
| ];
|
|
|
|
|