| Index: third_party/WebKit/LayoutTests/http/tests/fetch/referrer/serviceworker-from-origin-only-document.html
|
| diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/referrer/serviceworker-from-origin-only-document.html b/third_party/WebKit/LayoutTests/http/tests/fetch/referrer/serviceworker-from-origin-only-document.html
|
| index 4472765a7ae1c409674e8a9be789658ff7bc0a46..3f1968bb3b0a6199c727f7d2749c90b4c430504f 100644
|
| --- a/third_party/WebKit/LayoutTests/http/tests/fetch/referrer/serviceworker-from-origin-only-document.html
|
| +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/referrer/serviceworker-from-origin-only-document.html
|
| @@ -1,10 +1,71 @@
|
| <!doctype html>
|
| <html>
|
| <title>Fetch in a document with "referrer origin" policy and controlled by a ServiceWorker</title>
|
| +<body>
|
| <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-helpers.js"></script>
|
| +<script src = "/fetch/resources/fetch-test-options.js"></script>
|
| <script>
|
| -location =
|
| - '/fetch/referrer/resources/serviceworker-from-origin-only-document.html';
|
| +const SCRIPT = '/fetch/referrer/resources/simple-onfetch.js';
|
| +const SCOPE = '/fetch/referrer/resources/empty-referrer-origin.html';
|
| +
|
| +const BASE_URL = BASE_ORIGIN + '/fetch/resources/referrer.php';
|
| +const OTHER_URL = OTHER_ORIGIN + '/fetch/resources/referrer.php';
|
| +const REFERRER_SOURCE = BASE_ORIGIN + SCOPE;
|
| +
|
| +const TESTS = [
|
| + [BASE_URL, 'about:client', '', BASE_ORIGIN + '/'],
|
| + [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', '', BASE_ORIGIN + '/'],
|
| + [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 + '/'],
|
| + [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 + '/'],
|
| + [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'],
|
| +];
|
| +
|
| +promise_test(t => {
|
| + return service_worker_unregister_and_register(t, SCRIPT, SCOPE).then(r => {
|
| + add_completion_callback(() => r.unregister());
|
| + return wait_for_state(t, r.installing, 'activated');
|
| + }).then(() => {
|
| + return with_iframe(SCOPE);
|
| + }).then(frame => {
|
| + add_completion_callback(() => frame.remove());
|
| + add_referrer_tests(TESTS, frame.contentWindow);
|
| + });
|
| + });
|
| </script>
|
| </html>
|
|
|