// occurred.nit: "occurred in the network service URLLoaderFactory checks"
if (policies.connection_allowlists.enforced.has_value()) {
if (!network::ConnectionAllowlistMatchesUrl(
policies.connection_allowlists.enforced.value(), GURL(url))) {
if (reporting_disposition == ReportingDisposition::kReport) {
PrintAccessDeniedMessage(url);
ConnectionAllowlistViolationReportBody::QueueServiceWorkerReport(
url, V8ConnectionAllowlistDisposition::Enum::kEnforce,
*GetExecutionContext());
}
return ResourceRequestBlockedReason::kOther;
}
}
if (policies.connection_allowlists.report_only.has_value()) {
if (!network::ConnectionAllowlistMatchesUrl(
policies.connection_allowlists.report_only.value(),
GURL(url))) {
if (reporting_disposition == ReportingDisposition::kReport) {
PrintAccessDeniedMessage(url);
ConnectionAllowlistViolationReportBody::QueueServiceWorkerReport(
url, V8ConnectionAllowlistDisposition::Enum::kReport,
*GetExecutionContext());
}something like below to avoid duplication of code?
bool report_only = policies.connection_allowlists.report_only.has_value()
bool enforce = policies.connection_allowlists.enforced.has_value()
if (enforce || report_only) {
if (!network::ConnectionAllowlistMatchesUrl(
enforce? policies.connection_allowlists.enforced.value()
:policies.connection_allowlists.report_only.value(), GURL(url))) {
if (reporting_disposition == ReportingDisposition::kReport) {
PrintAccessDeniedMessage(url);
ConnectionAllowlistViolationReportBody::QueueServiceWorkerReport(
url,
enforce? V8ConnectionAllowlistDisposition::Enum::kEnforce
: V8ConnectionAllowlistDisposition::Enum::kReport,
*GetExecutionContext());
}
if (enforce) {
return ResourceRequestBlockedReason::kOther;
}
}
}| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
nit: "occurred in the network service URLLoaderFactory checks"
Done
if (policies.connection_allowlists.enforced.has_value()) {
if (!network::ConnectionAllowlistMatchesUrl(
policies.connection_allowlists.enforced.value(), GURL(url))) {
if (reporting_disposition == ReportingDisposition::kReport) {
PrintAccessDeniedMessage(url);
ConnectionAllowlistViolationReportBody::QueueServiceWorkerReport(
url, V8ConnectionAllowlistDisposition::Enum::kEnforce,
*GetExecutionContext());
}
return ResourceRequestBlockedReason::kOther;
}
}
if (policies.connection_allowlists.report_only.has_value()) {
if (!network::ConnectionAllowlistMatchesUrl(
policies.connection_allowlists.report_only.value(),
GURL(url))) {
if (reporting_disposition == ReportingDisposition::kReport) {
PrintAccessDeniedMessage(url);
ConnectionAllowlistViolationReportBody::QueueServiceWorkerReport(
url, V8ConnectionAllowlistDisposition::Enum::kReport,
*GetExecutionContext());
}something like below to avoid duplication of code?
bool report_only = policies.connection_allowlists.report_only.has_value()
bool enforce = policies.connection_allowlists.enforced.has_value()if (enforce || report_only) {
if (!network::ConnectionAllowlistMatchesUrl(
enforce? policies.connection_allowlists.enforced.value()
:policies.connection_allowlists.report_only.value(), GURL(url))) {
if (reporting_disposition == ReportingDisposition::kReport) {
PrintAccessDeniedMessage(url);
ConnectionAllowlistViolationReportBody::QueueServiceWorkerReport(
url,
enforce? V8ConnectionAllowlistDisposition::Enum::kEnforce
: V8ConnectionAllowlistDisposition::Enum::kReport,
*GetExecutionContext());
}
if (enforce) {
return ResourceRequestBlockedReason::kOther;
}
}
}
In theory both headers can be present, and unifying the code this way only checks one of them. I used a lambda to make this a bit more DRY.
| 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. |
[Connection-Allowlist] Reporting for Document->ServiceWorker fetches.
If a document is controlled by a Service Worker, its own Connection-
Allowlist headers will be checked in Blink before delegating the fetch
to the worker. If this fetch would violate the document's allowlist,
reports are now sent to the proper reporting endpoint.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/60531
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |