blob: 317b02175f2f15d467d3336cd48ca0fc21b473cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<!DOCTYPE html>
<title>Service Worker: CORS-exposed header names should be transferred correctly</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<script>
promise_test(async function(t) {
const SCOPE = 'resources/simple.html';
const SCRIPT = 'resources/fetch-cors-exposed-header-names-worker.js';
const host_info = get_host_info();
const URL = get_host_info().HTTPS_REMOTE_ORIGIN +
'/service-workers/service-worker/resources/simple.txt?pipe=' +
'header(access-control-allow-origin,*)|' +
'header(access-control-expose-headers,*)|' +
'header(foo,bar)|' +
'header(set-cookie,X)';
const reg = await service_worker_unregister_and_register(t, SCRIPT, SCOPE);
await wait_for_state(t, reg.installing, 'activated');
const frame = await with_iframe(SCOPE);
const response = await frame.contentWindow.fetch(URL);
const headers = response.headers;
assert_equals(headers.get('foo'), 'bar');
assert_equals(headers.get('set-cookie'), null);
assert_equals(headers.get('access-control-expose-headers'), '*');
}, 'CORS-exposed header names for a response from sw');
</script>
|