Skip to content

Commit

Permalink
[client hints] Remove explicit lifetimes behind FeaturePolicyForClien…
Browse files Browse the repository at this point in the history
…tHints flag

Adding changes to client hint lifetimes <httpwg/http-extensions@7d24ea4>
under the client hint feature policy flag.

Bug: 1017166
Change-Id: Ia4d63777c4a4fcb150d4e854312851105fa0a11b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1919953
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Aaron Tagliaboschi <aarontag@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719162}
  • Loading branch information
amtunlimited authored and chromium-wpt-export-bot committed Nov 26, 2019
1 parent a4f84ff commit 0b93a71
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
22 changes: 10 additions & 12 deletions client-hints/accept_ch.tentative.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@
<script>

// This test fetches resources/accept_ch.html. The response headers to
// that webpage contains only the Accept-CH header. Due to the missing
// Accept-CH-Lifetime header, the user-agent should not persist origin
// preferences for the client hints specified in Accept-CH header.
// that webpage contains only the Accept-CH header. These preferences should be
// stored so that the next request to the same origin is sent with the
// requested client hint headers.

// Next, to verify that 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.
// Next, to verify that 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 does send the client hints in the request headers.

// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
Expand All @@ -39,20 +37,20 @@

async_test(t => {
window.addEventListener('message', t.step_func(function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
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/do_not_expect_client_hints_headers.html did not finish.");
}, "Loading of resources/expect_client_hints_headers.html did not finish.");

function acceptChLoaded() {
// 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");
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}

Expand Down
17 changes: 8 additions & 9 deletions client-hints/http_equiv_accept_ch.tentative.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@

<script>

// This test contains accept-ch http-equiv header. Due to the missing
// Accept-CH-Lifetime header, the user-agent should not persist origin
// preferences for the client hints specified in Accept-CH header.
// This test contains accept-ch http-equiv header. The user-agent should
// persist origin preferences for the client hints specified in Accept-CH
// header.

// Next, to verify that the origin preferences were not persisted by the user
// Next, to verify that the origin preferences were 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.
// 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.
Expand All @@ -37,12 +36,12 @@
// Verify that the browser does not attach client hints on resources in a
// different navigation. This verifies that the client hint preferences were
// not persisted for the origin.
window.open("resources/do_not_expect_client_hints_headers.html");
window.open("resources/expect_client_hints_headers.html");
async_test(t => {
window.addEventListener('message', t.step_func_done(e => {
assert_equals(e.data, 'PASS');
}));
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
}, "Loading of resources/expect_client_hints_headers.html did not finish.");

</script>
</body>
Expand Down

0 comments on commit 0b93a71

Please sign in to comment.