Commit 16f81534 authored by Ehsan Karamad's avatar Ehsan Karamad Committed by Commit Bot

Rename Feature Policy: document-stream-insertion

It was proposed here https://github.com/WICG/feature-policy/pull/172
that "document-write" is a better name for this feature. This CL makes
the naming change correspondingly.

Bug: 841605
Change-Id: Id0a928fd3f6669eb3700736ff5770d4717d2b414
Reviewed-on: https://chromium-review.googlesource.com/1095328
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Reviewed-by: default avatarIan Clelland <iclelland@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566829}
parent 12669c48
...@@ -30,7 +30,7 @@ class RenderFrameHostFeaturePolicyTest ...@@ -30,7 +30,7 @@ class RenderFrameHostFeaturePolicyTest
static constexpr const char* kOrigin4 = "https://test.com"; static constexpr const char* kOrigin4 = "https://test.com";
static const blink::mojom::FeaturePolicyFeature kDefaultEnabledFeature = static const blink::mojom::FeaturePolicyFeature kDefaultEnabledFeature =
blink::mojom::FeaturePolicyFeature::kDocumentStreamInsertion; blink::mojom::FeaturePolicyFeature::kDocumentWrite;
static const blink::mojom::FeaturePolicyFeature kDefaultSelfFeature = static const blink::mojom::FeaturePolicyFeature kDefaultSelfFeature =
blink::mojom::FeaturePolicyFeature::kGeolocation; blink::mojom::FeaturePolicyFeature::kGeolocation;
......
<!doctype html> <!doctype html>
<title>'document-stream-insertion' tests</title> <title>'document-write' tests</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/feature-policy/experimental-features/resources/common.js"></script> <script src="/feature-policy/experimental-features/resources/common.js"></script>
...@@ -14,7 +14,7 @@ html, body { ...@@ -14,7 +14,7 @@ html, body {
"use strict"; "use strict";
let iframeElement = document.querySelector("iframe"); let iframeElement = document.querySelector("iframe");
let url = url_base + "document-stream-insertion.html"; let url = url_base + "document-write.html";
let text_to_write = "<div>FOO<\/div>"; let text_to_write = "<div>FOO<\/div>";
let test_cases = [{ let test_cases = [{
...@@ -38,7 +38,7 @@ html, body { ...@@ -38,7 +38,7 @@ html, body {
expected_value_enabled: "FOO" expected_value_enabled: "FOO"
}]; }];
// The feature 'document-stream-insertion' is enabled by default and when it // The feature 'document-write' is enabled by default and when it
// is enabled, all dynamic markup insertion API work as intended. // is enabled, all dynamic markup insertion API work as intended.
test_cases.forEach((tc) => { test_cases.forEach((tc) => {
promise_test(async() => { promise_test(async() => {
...@@ -59,10 +59,10 @@ html, body { ...@@ -59,10 +59,10 @@ html, body {
}); });
// Disabling 'document-stream-insertion' throws exception on the included API. // Disabling 'document-write' throws exception on the included API.
test_cases.forEach((tc) => { test_cases.forEach((tc) => {
promise_test(async() => { promise_test(async() => {
setFeatureState(iframeElement, "document-stream-insertion", "'none'"); setFeatureState(iframeElement, "document-write", "'none'");
await loadUrlInIframe(iframeElement, url); await loadUrlInIframe(iframeElement, url);
await sendMessageAndGetResponse(iframeElement.contentWindow, tc).then((response) => { await sendMessageAndGetResponse(iframeElement.contentWindow, tc).then((response) => {
assert_true( assert_true(
......
...@@ -251,8 +251,7 @@ void FeaturePolicy::AddContainerPolicy( ...@@ -251,8 +251,7 @@ void FeaturePolicy::AddContainerPolicy(
// See third_party/blink/public/common/feature_policy/feature_policy.h for // See third_party/blink/public/common/feature_policy/feature_policy.h for
// status of each feature (in spec, implemented, etc). // status of each feature (in spec, implemented, etc).
const FeaturePolicy::FeatureList& FeaturePolicy::GetDefaultFeatureList() { const FeaturePolicy::FeatureList& FeaturePolicy::GetDefaultFeatureList() {
CR_DEFINE_STATIC_LOCAL( CR_DEFINE_STATIC_LOCAL(FeatureList, default_feature_list,
FeatureList, default_feature_list,
({{mojom::FeaturePolicyFeature::kAccelerometer, ({{mojom::FeaturePolicyFeature::kAccelerometer,
FeaturePolicy::FeatureDefault::EnableForSelf}, FeaturePolicy::FeatureDefault::EnableForSelf},
{mojom::FeaturePolicyFeature::kAccessibilityEvents, {mojom::FeaturePolicyFeature::kAccessibilityEvents,
...@@ -269,7 +268,7 @@ const FeaturePolicy::FeatureList& FeaturePolicy::GetDefaultFeatureList() { ...@@ -269,7 +268,7 @@ const FeaturePolicy::FeatureList& FeaturePolicy::GetDefaultFeatureList() {
FeaturePolicy::FeatureDefault::EnableForAll}, FeaturePolicy::FeatureDefault::EnableForAll},
{mojom::FeaturePolicyFeature::kDocumentDomain, {mojom::FeaturePolicyFeature::kDocumentDomain,
FeaturePolicy::FeatureDefault::EnableForAll}, FeaturePolicy::FeatureDefault::EnableForAll},
{mojom::FeaturePolicyFeature::kDocumentStreamInsertion, {mojom::FeaturePolicyFeature::kDocumentWrite,
FeaturePolicy::FeatureDefault::EnableForAll}, FeaturePolicy::FeatureDefault::EnableForAll},
{mojom::FeaturePolicyFeature::kEncryptedMedia, {mojom::FeaturePolicyFeature::kEncryptedMedia,
FeaturePolicy::FeatureDefault::EnableForSelf}, FeaturePolicy::FeatureDefault::EnableForSelf},
......
...@@ -94,7 +94,7 @@ enum FeaturePolicyFeature { ...@@ -94,7 +94,7 @@ enum FeaturePolicyFeature {
// Controls the ability of the document to use several dynamic markup API // Controls the ability of the document to use several dynamic markup API
// which interfere with document's input stream (document.write(), // which interfere with document's input stream (document.write(),
// document.close(), etc.). // document.close(), etc.).
kDocumentStreamInsertion, kDocumentWrite,
}; };
// This struct holds feature policy whitelist data that needs to be replicated // This struct holds feature policy whitelist data that needs to be replicated
......
...@@ -6106,8 +6106,8 @@ bool Document::AllowedToUseDynamicMarkUpInsertion( ...@@ -6106,8 +6106,8 @@ bool Document::AllowedToUseDynamicMarkUpInsertion(
if (!RuntimeEnabledFeatures::ExperimentalProductivityFeaturesEnabled()) { if (!RuntimeEnabledFeatures::ExperimentalProductivityFeaturesEnabled()) {
return true; return true;
} }
if (!frame_ || frame_->IsFeatureEnabled( if (!frame_ ||
mojom::FeaturePolicyFeature::kDocumentStreamInsertion)) { frame_->IsFeatureEnabled(mojom::FeaturePolicyFeature::kDocumentWrite)) {
return true; return true;
} }
...@@ -6120,7 +6120,7 @@ bool Document::AllowedToUseDynamicMarkUpInsertion( ...@@ -6120,7 +6120,7 @@ bool Document::AllowedToUseDynamicMarkUpInsertion(
String::Format( String::Format(
"The use of method '%s' has been blocked by feature policy. The " "The use of method '%s' has been blocked by feature policy. The "
"feature " "feature "
"'document-stream-insertion' is disabled in this document.", "'document-write' is disabled in this document.",
api_name)); api_name));
return false; return false;
} }
......
...@@ -172,9 +172,8 @@ const FeatureNameMap& GetDefaultFeatureNameMap() { ...@@ -172,9 +172,8 @@ const FeatureNameMap& GetDefaultFeatureNameMap() {
"picture-in-picture", mojom::FeaturePolicyFeature::kPictureInPicture); "picture-in-picture", mojom::FeaturePolicyFeature::kPictureInPicture);
} }
if (RuntimeEnabledFeatures::ExperimentalProductivityFeaturesEnabled()) { if (RuntimeEnabledFeatures::ExperimentalProductivityFeaturesEnabled()) {
default_feature_name_map.Set( default_feature_name_map.Set("document-write",
"document-stream-insertion", mojom::FeaturePolicyFeature::kDocumentWrite);
mojom::FeaturePolicyFeature::kDocumentStreamInsertion);
default_feature_name_map.Set( default_feature_name_map.Set(
"image-compression", mojom::FeaturePolicyFeature::kImageCompression); "image-compression", mojom::FeaturePolicyFeature::kImageCompression);
default_feature_name_map.Set( default_feature_name_map.Set(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment