Skip to content

Commit

Permalink
Add new Schemeful blocked cookie enums
Browse files Browse the repository at this point in the history
Add enums to the browser protocol in prep for the devtools frontend
work.

This CL also updates the network_handler to insert the new values.

Bug: 1136839
Change-Id: I23f9d47bffde3dce3917d41d5c01070646b3d366
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2461595
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Steven Bingler <bingler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816666}
  • Loading branch information
Steven Bingler authored and Commit Bot committed Oct 13, 2020
1 parent fb2fea1 commit c197a4f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 9 deletions.
50 changes: 41 additions & 9 deletions content/browser/devtools/protocol/network_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,34 @@ GetProtocolBlockedSetCookieReason(net::CookieInclusionStatus status) {
}
if (status.HasExclusionReason(
net::CookieInclusionStatus::EXCLUDE_SAMESITE_STRICT)) {
blockedReasons->push_back(
Network::SetCookieBlockedReasonEnum::SameSiteStrict);
if (status.HasDowngradeWarning()) {
blockedReasons->push_back(
Network::SetCookieBlockedReasonEnum::SchemefulSameSiteStrict);
} else {
blockedReasons->push_back(
Network::SetCookieBlockedReasonEnum::SameSiteStrict);
}
}
if (status.HasExclusionReason(
net::CookieInclusionStatus::EXCLUDE_SAMESITE_LAX)) {
blockedReasons->push_back(Network::SetCookieBlockedReasonEnum::SameSiteLax);
if (status.HasDowngradeWarning()) {
blockedReasons->push_back(
Network::SetCookieBlockedReasonEnum::SchemefulSameSiteLax);
} else {
blockedReasons->push_back(
Network::SetCookieBlockedReasonEnum::SameSiteLax);
}
}
if (status.HasExclusionReason(
net::CookieInclusionStatus::
EXCLUDE_SAMESITE_UNSPECIFIED_TREATED_AS_LAX)) {
blockedReasons->push_back(
Network::SetCookieBlockedReasonEnum::SameSiteUnspecifiedTreatedAsLax);
if (status.HasDowngradeWarning()) {
blockedReasons->push_back(Network::SetCookieBlockedReasonEnum::
SchemefulSameSiteUnspecifiedTreatedAsLax);
} else {
blockedReasons->push_back(
Network::SetCookieBlockedReasonEnum::SameSiteUnspecifiedTreatedAsLax);
}
}
if (status.HasExclusionReason(
net::CookieInclusionStatus::EXCLUDE_SAMESITE_NONE_INSECURE)) {
Expand Down Expand Up @@ -658,17 +674,33 @@ GetProtocolBlockedCookieReason(net::CookieInclusionStatus status) {
}
if (status.HasExclusionReason(
net::CookieInclusionStatus::EXCLUDE_SAMESITE_STRICT)) {
blockedReasons->push_back(Network::CookieBlockedReasonEnum::SameSiteStrict);
if (status.HasDowngradeWarning()) {
blockedReasons->push_back(
Network::CookieBlockedReasonEnum::SchemefulSameSiteStrict);
} else {
blockedReasons->push_back(
Network::CookieBlockedReasonEnum::SameSiteStrict);
}
}
if (status.HasExclusionReason(
net::CookieInclusionStatus::EXCLUDE_SAMESITE_LAX)) {
blockedReasons->push_back(Network::CookieBlockedReasonEnum::SameSiteLax);
if (status.HasDowngradeWarning()) {
blockedReasons->push_back(
Network::CookieBlockedReasonEnum::SchemefulSameSiteLax);
} else {
blockedReasons->push_back(Network::CookieBlockedReasonEnum::SameSiteLax);
}
}
if (status.HasExclusionReason(
net::CookieInclusionStatus::
EXCLUDE_SAMESITE_UNSPECIFIED_TREATED_AS_LAX)) {
blockedReasons->push_back(
Network::CookieBlockedReasonEnum::SameSiteUnspecifiedTreatedAsLax);
if (status.HasDowngradeWarning()) {
blockedReasons->push_back(Network::CookieBlockedReasonEnum::
SchemefulSameSiteUnspecifiedTreatedAsLax);
} else {
blockedReasons->push_back(
Network::CookieBlockedReasonEnum::SameSiteUnspecifiedTreatedAsLax);
}
}
if (status.HasExclusionReason(
net::CookieInclusionStatus::EXCLUDE_SAMESITE_NONE_INSECURE)) {
Expand Down
28 changes: 28 additions & 0 deletions third_party/blink/public/devtools_protocol/browser_protocol.pdl
Original file line number Diff line number Diff line change
Expand Up @@ -4664,6 +4664,20 @@ domain Network
InvalidPrefix
# An unknown error was encountered when trying to store this cookie.
UnknownError
# The cookie had the "SameSite=Strict" attribute but came from a response
# with the same registrable domain but a different scheme.
# This includes navigation requests intitiated by other origins.
# This is the "Schemeful Same-Site" version of the blocked reason.
SchemefulSameSiteStrict
# The cookie had the "SameSite=Lax" attribute but came from a response
# with the same registrable domain but a different scheme.
# This is the "Schemeful Same-Site" version of the blocked reason.
SchemefulSameSiteLax
# The cookie didn't specify a "SameSite" attribute and was defaulted to
# "SameSite=Lax" and broke the same rules specified in the SchemefulSameSiteLax
# value.
# This is the "Schemeful Same-Site" version of the blocked reason.
SchemefulSameSiteUnspecifiedTreatedAsLax

# Types of reasons why a cookie may not be sent with a request.
experimental type CookieBlockedReason extends string
Expand Down Expand Up @@ -4692,6 +4706,20 @@ domain Network
UserPreferences
# An unknown error was encountered when trying to send this cookie.
UnknownError
# The cookie had the "SameSite=Strict" attribute but came from a response
# with the same registrable domain but a different scheme.
# This includes navigation requests intitiated by other origins.
# This is the "Schemeful Same-Site" version of the blocked reason.
SchemefulSameSiteStrict
# The cookie had the "SameSite=Lax" attribute but came from a response
# with the same registrable domain but a different scheme.
# This is the "Schemeful Same-Site" version of the blocked reason.
SchemefulSameSiteLax
# The cookie didn't specify a "SameSite" attribute and was defaulted to
# "SameSite=Lax" and broke the same rules specified in the SchemefulSameSiteLax
# value.
# This is the "Schemeful Same-Site" version of the blocked reason.
SchemefulSameSiteUnspecifiedTreatedAsLax

# A cookie which was not stored from a response with the corresponding reason.
experimental type BlockedSetCookieWithReason extends object
Expand Down

0 comments on commit c197a4f

Please sign in to comment.