Thanks for making this refactor in a separate PR to get ready for other changes that will consume this type.
blink::OriginOrWildcardHeaderValuePtr ConvertToBlink(
const OriginOrWildcardHeaderValuePtr& allow_csp_from) {
if (!allow_csp_from)
return nullptr;Given this helper is now a general helper would it make sense to rename the var from allow_csp_from to allow_from, header_value, or something similar?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
blink::OriginOrWildcardHeaderValuePtr ConvertToBlink(
const OriginOrWildcardHeaderValuePtr& allow_csp_from) {
if (!allow_csp_from)
return nullptr;Given this helper is now a general helper would it make sense to rename the var from allow_csp_from to allow_from, header_value, or something similar?
Yes, I think this makes sense. I've renamed the var accordingly.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
This looks pretty reasonable to me % the nit. Thanks!
Perhaps bashi@ could take a look at //services/network generally, and arthursonzogni@ could stamp //content/browser?
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"Nit: This might be helpful, but it's irrelevant to the change you're making in this CL. Please remove it to keep the CL focused on one change at a time.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM % the comments Mike already added. Thanks!
Please tie this to a bug before landing.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"Nit: This might be helpful, but it's irrelevant to the change you're making in this CL. Please remove it to keep the CL focused on one change at a time.
So, this include was added to fix a build break specifically for Android. Moving OriginOrWildcardHeaderValue out of content_security_policy.mojom means its -blink.h no longer references url.mojom.Origin (which typemaps to blink::SecurityOrigin), so it stops transitively pulling in security_origin.h.
integrity_policy_test.cc was relying on that transitive include, so it fails to compile after the move. The Android trybot flags it as incomplete type 'blink::SecurityOrigin'
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"Giovanni Del ValleNit: This might be helpful, but it's irrelevant to the change you're making in this CL. Please remove it to keep the CL focused on one change at a time.
So, this include was added to fix a build break specifically for Android. Moving OriginOrWildcardHeaderValue out of content_security_policy.mojom means its -blink.h no longer references url.mojom.Origin (which typemaps to blink::SecurityOrigin), so it stops transitively pulling in security_origin.h.
integrity_policy_test.cc was relying on that transitive include, so it fails to compile after the move. The Android trybot flags it as incomplete type 'blink::SecurityOrigin'
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[network] Rename AllowCSPFromHeaderValue to OriginOrWildcardHeaderValue
This is one in a series of CLs:
1. https://crrev.com/c/7926080 - [You are here.]
2. https://crrev.com/c/7925634 - Add Connection-Allowlist embedded enforcement primitives
3. https://crrev.com/c/7925636 - Add connectionallowlist iframe attribute + IPC transport
4. https://crrev.com/c/7933938 - Enforce Connection-Allowlist embedded enforcement handshake
`AllowCSPFromHeaderValue` is a mojom union representing the parsed value
of an HTTP response header whose grammar is either the token `*` or a
single serialized origin. Despite the `CSP` in its name, and its home in
content_security_policy.mojom, the type itself is not CSP-specific.
Rename it to the header-agnostic `OriginOrWildcardHeaderValue` and move
it into its own `origin_or_wildcard_header_value.mojom` file (and GN
target) so it can be reused by other `Allow-...-From`-style opt-in
headers (e.g. an upcoming Connection-Allowlist embedded-enforcement
header) without implying a tie to CSP or forcing a dependency on the CSP
mojom.
This is a pure rename + move of the type and its generated `*Ptr`,
`::Tag`, and `::New*` symbols. The `allow_csp_from` field, the
`ParseAllowCSPFromHeader` function, and the `Allow-CSP-From` header
string are intentionally left unchanged, as they remain CSP-specific.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |