mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +09:00
Issue #2542 - Part 6: Add Sec-Fetch-User header for all requests that are the direct result of a system principal request.
This means navigation resulting from interaction with the browser UI should result in a -user header (address bar navigation, bookmarks, etc.)
This commit is contained in:
parent
0ef8b05101
commit
53149ed646
1 changed files with 15 additions and 5 deletions
|
|
@ -271,12 +271,22 @@ void SecFetch::AddSecFetchSite(nsIHttpChannel* aHTTPChannel) {
|
|||
}
|
||||
|
||||
void SecFetch::AddSecFetchUser(nsIHttpChannel* aHTTPChannel) {
|
||||
// TODO: Bug 1621987: Implement Sec-Fetch-User
|
||||
bool userInitiated = false;
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = aHTTPChannel->GetLoadInfo();
|
||||
// A request issued by the browser is always assumed user-initiated.
|
||||
if (nsContentUtils::IsSystemPrincipal(loadInfo->TriggeringPrincipal())) {
|
||||
userInitiated = true;
|
||||
}
|
||||
|
||||
// nsAutoCString user("?1");
|
||||
// nsresult rv = aHTTPChannel->SetRequestHeader(
|
||||
// NS_LITERAL_CSTRING("Sec-Fetch-User"), user, false);
|
||||
// Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||
// TODO: Implement content interaction
|
||||
|
||||
nsAutoCString user("?1");
|
||||
|
||||
if (userInitiated) {
|
||||
nsresult rv = aHTTPChannel->SetRequestHeader(NS_LITERAL_CSTRING("Sec-Fetch-User"), user, false);
|
||||
Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
}
|
||||
|
||||
void SecFetch::AddSecFetchHeader(nsIHttpChannel* aHTTPChannel) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue