Skip to content

Commit

Permalink
Introduce "cross-origin-isolated" permission
Browse files Browse the repository at this point in the history
Implementing whatwg/html#5435.

This change itself doesn't change the behavior (yet) as
Agent::IsCrossOriginIsolated() always returns false. Please see
https://crrev.com/c/2247463 for details. With subsequent changes this
will affect the value of WindowOrWorkerGlobalScope.crossOriginIsolated.

Bug: 1018680
Change-Id: I952197efe1b6a591cee39a28519402e22598928c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2247940
Auto-Submit: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#784696}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 23d3561c3e0fcd894052afd9a6c39c3e512e53b2
  • Loading branch information
yutakahirano authored and Commit Bot committed Jul 2, 2020
1 parent a564a9b commit cb3e66e
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions blink/common/feature_policy/feature_policy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ FeaturePolicy::FeatureState FeaturePolicy::GetFeatureState() const {

FeaturePolicy::FeaturePolicy(url::Origin origin,
const FeatureList& feature_list)
: origin_(std::move(origin)), feature_list_(feature_list) {
}
: origin_(std::move(origin)), feature_list_(feature_list) {}

FeaturePolicy::~FeaturePolicy() = default;

Expand Down Expand Up @@ -417,6 +416,8 @@ const FeaturePolicy::FeatureList& FeaturePolicy::GetDefaultFeatureList() {
FeatureDefault(FeaturePolicy::FeatureDefault::EnableForSelf)},
{mojom::FeaturePolicyFeature::kClipboard,
FeatureDefault(FeaturePolicy::FeatureDefault::EnableForSelf)},
{mojom::FeaturePolicyFeature::kCrossOriginIsolated,
FeatureDefault(FeaturePolicy::FeatureDefault::EnableForSelf)},
{mojom::FeaturePolicyFeature::kCamera,
FeatureDefault(FeaturePolicy::FeatureDefault::EnableForSelf)},
{mojom::FeaturePolicyFeature::kDocumentDomain,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ enum FeaturePolicyFeature {
// Client Hint for UA platform version.
kClientHintUAPlatformVersion = 74,

// cross-origin isolated permission
kCrossOriginIsolated = 75,

// Don't change assigned numbers of any item, and don't reuse removed slots.
// Add new features at the end of the enum.
// Also, run update_feature_policy_enum.py in
Expand Down
5 changes: 3 additions & 2 deletions blink/renderer/core/execution_context/execution_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,9 @@ unsigned ExecutionContext::ContextLifecycleStateObserverCountForTesting()
}

bool ExecutionContext::IsCrossOriginIsolated() const {
// TODO(yhirano): Take cross-origin isolated permission into account.
return Agent::IsCrossOriginIsolated();
return Agent::IsCrossOriginIsolated() &&
IsFeatureEnabled(
mojom::blink::FeaturePolicyFeature::kCrossOriginIsolated);
}

void ExecutionContext::AddConsoleMessageImpl(mojom::ConsoleMessageSource source,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@
feature_policy_name: "conversion-measurement",
depends_on: ["ConversionMeasurement"],
},
{
name: "CrossOriginIsolated",
feature_policy_name: "cross-origin-isolated",
depends_on: ["CrossOriginIsolation"],
},
{
name: "DocumentDomain",
feature_policy_name: "document-domain",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ch-ua-platform-version
ch-viewport-width
ch-width
conversion-measurement
cross-origin-isolated
document-domain
document-write
downloads
Expand Down

0 comments on commit cb3e66e

Please sign in to comment.