Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(963)

Unified Diff: content/common/feature_policy/feature_policy.cc

Issue 2651883008: Make content::FeaturePolicy implement WebFeaturePolicy, and use it in blink code (Closed)
Patch Set: Cleanup Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/feature_policy/feature_policy.cc
diff --git a/content/common/feature_policy/feature_policy.cc b/content/common/feature_policy/feature_policy.cc
index c4875a9c01fc463b1327854fbc880fff326ea103..c1cc3a5c866618c5e74a31b02afbdeccc933aec1 100644
--- a/content/common/feature_policy/feature_policy.cc
+++ b/content/common/feature_policy/feature_policy.cc
@@ -97,6 +97,12 @@ void FeaturePolicy::Whitelist::AddAll() {
}
bool FeaturePolicy::Whitelist::Contains(const url::Origin& origin) const {
+ // This does not handle the case where origin is an opaque origin, which is
+ // also supposed to exist in the whitelist. (The identical opaque origins
+ // should match in that case)
+ // TODO(iclelland): Fix that, possibly by having another flag for
+ // 'matches_self', which will explicitly match the policy's origin.
+ // https://crbug.com/690520
if (matches_all_origins_)
return true;
for (const auto& targetOrigin : origins_) {
@@ -130,7 +136,10 @@ bool FeaturePolicy::IsFeatureEnabledForOrigin(
}
if (feature_definition->default_policy ==
FeaturePolicy::FeatureDefault::EnableForSelf) {
- return origin_.IsSameOriginWith(origin);
+ // TODO(iclelland): Remove the pointer equality check once it is possible to
+ // compare opaque origins successfully against themselves.
+ // https://crbug.com/690520
raymes 2017/02/13 04:45:22 I put a question on the bug about this. I'm wonder
iclelland 2017/02/23 20:04:12 I don't know if we can -- they are going to need *
+ return (&origin_ == &origin) || origin_.IsSameOriginWith(origin);
}
return false;
}

Powered by Google App Engine
This is Rietveld 408576698