-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1541670 [wpt PR 16148] - Send
Sec-Fetch-User
only for user-acti…
…vated, navigational requests., a=testonly Automatic update from web-platform-tests Send `Sec-Fetch-User` only for user-activated, navigational requests. As per the conversation in w3c/webappsec-fetch-metadata#23 and w3c/webappsec-fetch-metadata#19, this patch drops the `Sec-Fetch-User` header for non-navigational requests, and for navigational requests that are not user-activated. Bug: 947444 Change-Id: Ica4846bda6ccf4e8bce1323803954f4fef9c18a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1545871 Reviewed-by: Alex Moshchuk <alexmoschromium.org> Commit-Queue: Mike West <mkwstchromium.org> Cr-Commit-Position: refs/heads/master{#646086} -- wpt-commits: b93752a06f9498f774aed288663259cd738f1a7c wpt-pr: 16148 UltraBlame original commit: 595f9f3aa36e9e4e5c8f120d7349c2965613814d
- Loading branch information
Showing
21 changed files
with
143 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 78 additions & 56 deletions
134
testing/web-platform/tests/fetch/sec-metadata/iframe.tentative.https.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,85 @@ | ||
<!DOCTYPE html> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src=/resources/testdriver.js></script> | ||
<script src=/resources/testdriver-vendor.js></script> | ||
<script src=/fetch/sec-metadata/resources/helper.js></script> | ||
<script src=/common/utils.js></script> | ||
<body> | ||
<script> | ||
async_test(t => { | ||
let i = document.createElement('iframe'); | ||
i.src = "https://{{host}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"; | ||
window.addEventListener('message', t.step_func(e => { | ||
if (e.source != i.contentWindow) | ||
return; | ||
|
||
assert_header_equals(e.data, { | ||
"dest": "nested-document", | ||
"site": "same-origin", | ||
"user": "?F", | ||
"mode": "nested-navigate" | ||
}); | ||
t.done(); | ||
})); | ||
|
||
document.body.appendChild(i); | ||
}, "Same-origin iframe"); | ||
|
||
async_test(t => { | ||
let i = document.createElement('iframe'); | ||
i.src = "https://{{hosts[][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"; | ||
window.addEventListener('message', t.step_func(e => { | ||
if (e.source != i.contentWindow) | ||
return; | ||
|
||
assert_header_equals(e.data, { | ||
"dest": "nested-document", | ||
"site": "same-site", | ||
"user": "?F", | ||
"mode": "nested-navigate" | ||
}); | ||
t.done(); | ||
})); | ||
|
||
document.body.appendChild(i); | ||
}, "Same-site iframe"); | ||
|
||
async_test(t => { | ||
let i = document.createElement('iframe'); | ||
i.src = "https://{{hosts[alt][www]}}:{{ports[https][0]}}/fetch/sec-metadata/resources/post-to-owner.py"; | ||
window.addEventListener('message', t.step_func(e => { | ||
if (e.source != i.contentWindow) | ||
return; | ||
|
||
assert_header_equals(e.data, { | ||
"dest": "nested-document", | ||
"site": "cross-site", | ||
"user": "?F", | ||
"mode": "nested-navigate" | ||
}); | ||
t.done(); | ||
})); | ||
|
||
document.body.appendChild(i); | ||
}, "Cross-site iframe"); | ||
const USER = true; | ||
const FORCED = false; | ||
|
||
function create_test(host, user_activated, expectations) { | ||
async_test(t => { | ||
let i = document.createElement('iframe'); | ||
window.addEventListener('message', t.step_func(e => { | ||
if (e.source != i.contentWindow) | ||
return; | ||
|
||
assert_header_equals(e.data, expectations); | ||
t.done(); | ||
})); | ||
|
||
let url = `https://${host}/fetch/sec-metadata/resources/post-to-owner.py`; | ||
if (user_activated == FORCED) { | ||
i.src = url; | ||
document.body.appendChild(i); | ||
} else if (user_activated == USER) { | ||
let uuid = token(); | ||
i.name = uuid; | ||
let a = document.createElement('a'); | ||
a.href = url; | ||
a.target = uuid; | ||
a.text = "This is a link!"; | ||
|
||
document.body.appendChild(i); | ||
document.body.appendChild(a); | ||
|
||
test_driver.click(a); | ||
} | ||
}, `{{host}} -> ${host} iframe: ${user_activated ? "user-activated" : "forced"}`); | ||
} | ||
|
||
create_test("{{host}}:{{ports[https][0]}}", FORCED, { | ||
"dest": "nested-document", | ||
"site": "same-origin", | ||
"user": "", | ||
"mode": "nested-navigate" | ||
}); | ||
|
||
create_test("{{hosts[][www]}}:{{ports[https][0]}}", FORCED, { | ||
"dest": "nested-document", | ||
"site": "same-site", | ||
"user": "", | ||
"mode": "nested-navigate" | ||
}); | ||
|
||
create_test("{{hosts[alt][www]}}:{{ports[https][0]}}", FORCED, { | ||
"dest": "nested-document", | ||
"site": "cross-site", | ||
"user": "", | ||
"mode": "nested-navigate" | ||
}); | ||
|
||
create_test("{{host}}:{{ports[https][0]}}", USER, { | ||
"dest": "nested-document", | ||
"site": "same-origin", | ||
"user": "?T", | ||
"mode": "nested-navigate" | ||
}); | ||
|
||
create_test("{{hosts[][www]}}:{{ports[https][0]}}", USER, { | ||
"dest": "nested-document", | ||
"site": "same-site", | ||
"user": "?T", | ||
"mode": "nested-navigate" | ||
}); | ||
|
||
create_test("{{hosts[alt][www]}}:{{ports[https][0]}}", USER, { | ||
"dest": "nested-document", | ||
"site": "cross-site", | ||
"user": "?T", | ||
"mode": "nested-navigate" | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.