diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 2343aae339b89..6f8a752431540 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc @@ -10448,10 +10448,27 @@ bool NavigationRequest::IsFencedFrameRequiredPolicyFeatureAllowed( // Check if the outer document's permissions policies allow all of the // required policies. + const network::PermissionsPolicy* embedder_policy = + GetParentFrameOrOuterDocument()->GetPermissionsPolicy(); std::optional - embedder_allowlist = GetParentFrameOrOuterDocument() - ->GetPermissionsPolicy() - ->GetAllowlistForFeatureIfExists(feature); + embedder_allowlist = + embedder_policy->GetAllowlistForFeatureIfExists(feature); + // --- POC diagnostic logging (not part of any fix) --- + bool embedder_actually_allows = + embedder_policy->IsFeatureEnabledForOrigin(feature, origin); + LOG(ERROR) << "[POC] FF-gate feature=" << static_cast(feature) + << " embedder_origin=" + << GetParentFrameOrOuterDocument() + ->GetLastCommittedOrigin() + .Serialize() + << " embedder_allowlist=" + << (embedder_allowlist + ? (embedder_allowlist->MatchesAll() ? "MatchesAll" + : "restricted") + : "nullopt") + << " embedder_IsFeatureEnabledForOrigin=" + << (embedder_actually_allows ? "true" : "false"); + // ---------------------------------------------------- if (embedder_allowlist && !embedder_allowlist->MatchesAll()) { return false; } @@ -10497,6 +10514,11 @@ bool NavigationRequest::CheckPermissionsPoliciesForFencedFrames( // eventually only use the required policies without policy inheritance, so // extra policies defined in the outer document/"allow" attribute won't have // any effect. + LOG(ERROR) << "[POC] CheckPermissionsPoliciesForFencedFrames target_origin=" + << origin.Serialize() << " required_feature_count=" + << computed_fenced_frame_properties + ->effective_enabled_permissions() + .size(); for (const network::mojom::PermissionsPolicyFeature feature : computed_fenced_frame_properties->effective_enabled_permissions()) { if (!IsFencedFrameRequiredPolicyFeatureAllowed(origin, feature)) { @@ -10509,9 +10531,12 @@ bool NavigationRequest::CheckPermissionsPoliciesForFencedFrames( "Refused to frame '%s' as a fenced frame because permissions " "policy '%s' is not allowed for the frame's origin.", origin.Serialize().c_str(), feature_string.c_str())); + LOG(ERROR) << "[POC] => FF navigation BLOCKED (feature " + << feature_string << " disallowed)"; return false; } } + LOG(ERROR) << "[POC] => FF navigation ALLOWED (all required features passed)"; return true; }