Update web-platform-tests to revision 6340a70e8df5e850ea44436b54105f59dd5aa22e

This commit is contained in:
WPT Sync Bot 2019-07-19 10:25:00 +00:00
parent 5788e8c050
commit 7be3e2f06b
131 changed files with 3893 additions and 1852 deletions

View file

@ -0,0 +1,106 @@
<!doctype html>
<meta name="timeout" content="long">
<title>Accept-CH-Lifetime test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-lifetime-test.js"></script>
<script>
setup({ explicit_done: true });
// Cross-origin header tests
run_test({ name: "cross origin iframe not setting other origins",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: do_not_expect,
type: "iframe" });
run_test({ name: "cross origin iframe not setting own origin",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "iframe" });
run_test({ name: "cross origin navigation",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + expect,
type: "navigation" });
run_test({ name: "cross origin subresource",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "subresource" });
// Same origin header tests
run_test({ name: "same origin iframe",
initial_url: echo,
accept_url: accept,
expect_url: expect,
type: "iframe" });
run_test({ name: "same origin navigation",
initial_url: echo,
accept_url: accept,
expect_url: expect,
type: "navigation" });
run_test({ name: "same origin subresource",
initial_url: echo,
accept_url: accept,
expect_url: do_not_expect,
type: "subresource" });
// Cross-origin http-equiv tests
run_test({ name: "http-equiv cross origin iframe not setting other origins",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: do_not_expect,
type: "iframe" });
run_test({ name: "http-equiv cross origin iframe not setting own origin",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "iframe" });
run_test({ name: "http-equiv cross origin navigation",
initial_url: echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + expect,
type: "navigation" });
run_test({ name: "http-equiv cross origin subresource",
initial_url: host_info.HTTPS_REMOTE_ORIGIN + echo,
accept_url: host_info.HTTPS_REMOTE_ORIGIN + httpequiv_accept,
expect_url: host_info.HTTPS_REMOTE_ORIGIN + do_not_expect,
type: "subresource" });
// same-origin http-equiv tests
run_test({ name: "http-equiv same origin iframe",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: expect,
type: "iframe" });
run_test({ name: "http-equiv same origin navigation",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: expect,
type: "navigation" });
run_test({ name: "http-equiv same origin subresource",
initial_url: echo,
accept_url: httpequiv_accept,
expect_url: do_not_expect,
type: "subresource" });
done();
</script>
</body>
</html>

View file

@ -1,67 +0,0 @@
<html>
<title>Accept-CH-Lifetime test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens two more html web page. One test is run
in this web page, and two in the other web pages.
-->
<script>
// This test fetches resources/accept_ch_lifetime.html. The response headers to
// that webpage contain Accept-CH and Accept-CH-Lifetime headers.
// Fetching that webpage should cause the user-agent to persist origin
// preferences for the client hints specified in Accept-CH header for a
// duration specified in the Accept-CH-Lifetime header.
// Next, to verify if the origin preferences were persisted by the user
// agent, this test fetches resources/expect_client_hints_headers.html
// in a new window. Fetching of resources/expect_client_hints_headers.html
// verifies that the user agent actually sends the client hints in the request
// headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', t.step_func(function(e) {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
}));
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
// Fetching this webpage should cause user-agent to persist client hint
// preferences for the origin.
var win = window.open("resources/accept_ch_lifetime.html");
assert_not_equals(win, null, "Popup windows not allowed?");
win.addEventListener('load', acceptChLifetimeLoaded, false);
</script>
</body>
</html>

View file

@ -1,68 +0,0 @@
<html>
<title>Accept-CH-Lifetime test with cross-origin iframe</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/accept_ch_lifetime.html in a cross origin iframe.
// The response headers to that webpage contain Accept-CH and Accept-CH-Lifetime
// headers.
// Fetching that webpage should NOT cause the user-agent to persist origin
// preferences for the client hints specified.
// Next, to verify if the origin preferences were NOT persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html
// verifies that the user agent did not actually sent the client hints in the
// request headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', t.step_func(function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
}));
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent does not attach the client
// hints.
var verify_win = window.open("resources/do_not_expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
</script>
<!-- Fetching this webpage should NOT cause user-agent to persist client hint
preferences for the origin.-->
<iframe onload="acceptChLifetimeLoaded()" src="https://{{hosts[][www]}}:{{ports[https][0]}}/client-hints/resources/accept_ch_lifetime.html"></iframe>
</body>
</html>

View file

@ -1,69 +0,0 @@
<html>
<title>Accept-CH-Lifetime test with same-origin iframe</title>
<meta name="timeout" content="long">
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/accept_ch_lifetime.html in a same origin iframe.
// The response headers to that webpage contain Accept-CH and Accept-CH-Lifetime
// headers.
// Fetching that webpage should cause the user-agent to persist origin
// preferences for the client hints specified in Accept-CH header for a
// duration specified in the Accept-CH-Lifetime header.
// Next, to verify if the origin preferences were persisted by the user
// agent, this test fetches resources/expect_client_hints_headers.html
// in a new window. Fetching of resources/expect_client_hints_headers.html
// verifies that the user agent actually sends the client hints in the request
// headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
var acceptChLifetimeLoaded;
async_test(t => {
acceptChLifetimeLoaded = t.step_func(() => {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
});
window.addEventListener('message', t.step_func((e) => {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
}));
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
</script>
<!-- Fetching this webpage should cause user-agent to persist client hint
preferences for the origin.-->
<iframe onload="acceptChLifetimeLoaded()" src="resources/accept_ch_lifetime.html"></iframe>
</body>
</html>

View file

@ -1,72 +0,0 @@
<html>
<title>Accept-CH-Lifetime test with subresource</title>
<meta name="timeout" content="long">
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/accept_ch_lifetime.html as a subresource. The
// response headers to that webpage contain Accept-CH and Accept-CH-Lifetime
// headers.
// Fetching that webpage as a subresource should NOT cause the user-agent to
// persist origin preferences for the client hints specified in Accept-CH
// header.
// Next, to verify if the origin preferences were not persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html verifies that the user
// agent does not send the client hints in the request headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
promise_test(t => {
// Fetching this web page as a subresource should NOT cause user-agent to
// persist client hint preferences for the origin.
return fetch("resources/accept_ch_lifetime.html").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
// Open a new window. Verify that the user agent does not attach the client
// hints.
var win = window.open("resources/do_not_expect_client_hints_headers.html");
assert_not_equals(win, null, "Popup windows not allowed?");
});
}, "Test receiving Accept-CH-Lifetime header");
async_test(t => {
window.addEventListener('message', t.step_func(function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
}));
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
</script>
</body>
</html>

View file

@ -1,66 +0,0 @@
<html>
<title>Accept-CH-Lifetime test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens two more html web page. One test is run
in this web page, and two in the other web pages.
-->
<script>
// This test fetches resources/http_equiv_accept_ch_lifetime.html. The response
// to that webpage contains Accept-CH and Accept-CH-Lifetime http-equiv headers.
// Fetching that webpage should cause the user-agent to persist origin
// preferences for the client hints specified in Accept-CH header for a
// duration specified in the Accept-CH-Lifetime header.
// Next, to verify if the origin preferences were persisted by the user
// agent, this test fetches resources/expect_client_hints_headers.html
// in a new window. Fetching of resources/expect_client_hints_headers.html
// verifies that the user agent actually sends the client hints in the request
// headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', t.step_func(function(e) {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
}));
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
// Fetching this webpage should cause user-agent to persist client hint
// preferences for the origin.
var win = window.open("resources/http_equiv_accept_ch_lifetime.html");
assert_not_equals(win, null, "Popup windows not allowed?");
win.addEventListener('load', acceptChLifetimeLoaded, false);
</script>
</body>
</html>

View file

@ -1,66 +0,0 @@
<html>
<title>Accept-CH-Lifetime test with cross-origin iframe</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/http_equiv_accept_ch_lifetime.html in a cross
// origin iframe. The response to that webpage contains Accept-CH and
// Accept-CH-Lifetime http-equiv headers.
// Fetching that webpage should NOT cause the user-agent to persist origin
// preferences for the client hints specified.
// Next, to verify if the origin preferences were NOT persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html
// verifies that the user agent did not actually sent the client hints in the
// request headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', t.step_func(function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
}));
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
var verify_win = window.open("resources/do_not_expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
</script>
<!-- Fetching this webpage should NOT cause user-agent to persist client hint
preferences for the origin.-->
<iframe onload="acceptChLifetimeLoaded()" src="https://{{hosts[][www]}}:{{ports[https][0]}}/client-hints/resources/http_equiv_accept_ch_lifetime.html"></iframe>
</body>
</html>

View file

@ -1,70 +0,0 @@
<html>
<title>Accept-CH-Lifetime test with same-origin iframe</title>
<meta name="timeout" content="long">
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/http_equiv_accept_ch_lifetime.html in a same
// origin iframe. The response to that webpage contains Accept-CH and
// Accept-CH-Lifetime http-equiv headers.
// Fetching that webpage should cause the user-agent to persist origin
// preferences for the client hints specified in Accept-CH header for a
// duration specified in the Accept-CH-Lifetime header.
// Next, to verify if the origin preferences were persisted by the user
// agent, this test fetches resources/expect_client_hints_headers.html
// in a new window. Fetching of resources/expect_client_hints_headers.html
// verifies that the user agent actually sends the client hints in the request
// headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
var acceptChLifetimeLoaded;
async_test(t => {
acceptChLifetimeLoaded = t.step_func(() => {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
});
window.addEventListener('message', t.step_func((e) => {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
}));
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
</script>
<!-- Fetching this webpage should cause user-agent to persist client hint
preferences for the origin.-->
<iframe onload="acceptChLifetimeLoaded()" src="resources/http_equiv_accept_ch_lifetime.html"></iframe>
</body>
</html>

View file

@ -1,75 +0,0 @@
<html>
<title>Accept-CH-Lifetime test with subresource</title>
<meta name="timeout" content="long">
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/http_equiv_accept_ch_lifetime.html as a
// subresource. The response to that webpage contains Accept-CH and
// Accept-CH-Lifetime http-equiv headers.
// Fetching that webpage as a subresource should NOT cause the user-agent to
// persist origin preferences for the client hints specified in Accept-CH
// header.
// Next, to verify if the origin preferences were not persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html verifies that the user
// agent does not send the client hints in the request headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
promise_test(t => {
// Fetching this web page as a subresource should NOT cause user-agent to
// persist client hint preferences for the origin.
return fetch("resources/http_equiv_accept_ch_lifetime.html").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
// Open a new window. Verify that the user agent does not attach the client
// hints.
var win = window.open("resources/do_not_expect_client_hints_headers.html");
assert_not_equals(win, null, "Popup windows not allowed?");
});
}, "Test receiving Accept-CH-Lifetime header");
async_test(t => {
window.addEventListener('message', t.step_func(function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
}));
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
</script>
</body>
</html>

View file

@ -0,0 +1,73 @@
const echo = "/client-hints/echo_client_hints_received.py";
const accept = "/client-hints/resources/accept_ch_lifetime.html";
const httpequiv_accept = "/client-hints/resources/http_equiv_accept_ch_lifetime.html";
const expect = "/client-hints/resources/expect_client_hints_headers.html"
const do_not_expect = "/client-hints/resources/do_not_expect_client_hints_headers.html"
const host_info = get_host_info();
const run_test = test => {
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch(test.initial_url).then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"),
"device-memory-received");
});
}, test.name + " precondition: Test that the browser does not have client " +
"hints preferences cached");
// Then, attempt to set Accept-CH-Lifetime for 1 second
promise_test(t => {
return new Promise(resolve => {
if (test.type == "navigation") {
const win = window.open(test.accept_url);
assert_not_equals(win, null, "Popup windows not allowed?");
addEventListener('message', t.step_func(() => {
win.close();
resolve();
}), false);
} else if (test.type == "iframe") {
const iframe = document.createElement("iframe");
iframe.addEventListener('load', t.step_func(() => {
resolve();
}), false);
iframe.src = test.accept_url;
document.body.appendChild(iframe);
} else if (test.type == "subresource") {
fetch(test.accept_url).then(r => {
assert_equals(r.status, 200, "subresource response status")
// Verify that the browser did not include client hints in the request
// headers, just because we can..
assert_false(r.headers.has("device-memory-received"),
"device-memory-received",
"subresource request had no client hints");
resolve();
});
} else {
assert_unreached("unknown test type");
}
});
}, test.name + " set Accept-CH-Lifetime");
// Finally, verify that CH are actually sent (or not) on requests
promise_test(t => {
return new Promise(resolve => {
let win;
window.addEventListener('message', t.step_func(function(e) {
win.close();
assert_equals(e.data, "PASS", "message from opened page");
fetch("/client-hints/resources/clear-site-data.html").then(resolve);
}));
// Open a new window. Verify that the user agent attaches client hints.
win = window.open(test.expect_url);
assert_not_equals(win, null, "Popup windows not allowed?");
});
}, test.name + " got client hints according to expectations.");
};

View file

@ -6,6 +6,10 @@ and Accept-CH-Lifetime header. Fetching this webpage should cause
user-agent to persist origin preferences for the client hints
specified in the Accept-CH header for a duration specified in
the Accept-CH-Lifetime header.-->
<script>
window.top.opener.postMessage('Loaded', '*');
</script>
</body>
</html>

View file

@ -1,2 +1,3 @@
Accept-CH: device-memory
Accept-CH-Lifetime: 5
Accept-CH-Lifetime: 1
Access-Control-Allow-Origin: *

View file

@ -0,0 +1 @@
Clear-Site-Data: "*"

View file

@ -2,5 +2,8 @@
<meta http-equiv="Accept-CH" content="device-memory">
<meta http-equiv="Accept-CH-Lifetime" content="5">
<body>
<script>
window.top.opener.postMessage('Loaded', '*');
</script>
</body>
</html>

View file

@ -0,0 +1,2 @@
Access-Control-Allow-Origin: *