Commit 2c970cbe authored by Ian Clelland's avatar Ian Clelland Committed by Commit Bot

Add deprecation message for allow attribute.

The use of commas as separators in the iframe allow attribute is not
allowed, according to the specification, but it was previously parsed,
as it can appear in HTTP headers. This CL adds a deprecation message,
and is the first step towards removing this.

Blink intent thread:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/43EhaSQWm6M/iqvQ3hY0AwAJ

Bug: 1062400
Change-Id: I2efff7c9610ca7b85145a7600d1c0074ad2e30be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2313298Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806885}
parent 44e8463b
......@@ -67,6 +67,7 @@ enum Milestone {
kM86 = 86,
kM87 = 87,
kM88 = 88,
kM89 = 89,
};
// Returns estimated milestone dates as milliseconds since January 1, 1970.
......@@ -112,25 +113,17 @@ base::Time::Exploded MilestoneDate(Milestone milestone) {
case kM83:
return {2020, 5, 0, 18, 4};
case kM84:
// This release is not yet scheduled, so this date is a guess.
// https://groups.google.com/a/chromium.org/d/msg/chromium-dev/N1NxbSVOZas/ySlEKDKkBgAJ
return {2020, 7, 0, 14, 4};
case kM85:
// This release is not yet scheduled, so this date is a guess.
// https://groups.google.com/a/chromium.org/d/msg/chromium-dev/N1NxbSVOZas/ySlEKDKkBgAJ
return {2020, 8, 0, 25, 4};
case kM86:
// This release is not yet scheduled, so this date is a guess.
// https://groups.google.com/a/chromium.org/d/msg/chromium-dev/N1NxbSVOZas/ySlEKDKkBgAJ
return {2020, 10, 0, 6, 4};
case kM87:
// This release is not yet scheduled, so this date is a guess.
// https://groups.google.com/a/chromium.org/d/msg/chromium-dev/N1NxbSVOZas/ySlEKDKkBgAJ
return {2020, 11, 0, 17, 4};
case kM88:
// This release is not yet scheduled, so this date is a guess.
// https://groups.google.com/a/chromium.org/d/msg/chromium-dev/N1NxbSVOZas/ySlEKDKkBgAJ
return {2021, 1, 0, 19, 4};
case kM89:
return {2021, 3, 0, 2, 4};
}
NOTREACHED();
......@@ -575,6 +568,11 @@ DeprecationInfo GetDeprecationInfo(WebFeature feature) {
"RTCConfiguration.encodedInsertableStreams", kM88,
"6321945865879552")};
case WebFeature::kCommaSeparatorInAllowAttribute:
return {"CommaSeparatorInAllowAttribute", kM89,
ReplacedWillBeRemoved("Comma separator in iframe allow attribute",
"semicolons", kM89, "5740835259809792")};
// Features that aren't deprecated don't have a deprecation message.
default:
return {"NotDeprecated", kUnknown, ""};
......
......@@ -39,6 +39,7 @@
#include "third_party/blink/renderer/core/feature_policy/iframe_policy.h"
#include "third_party/blink/renderer/core/fetch/trust_token_issuance_authorization.h"
#include "third_party/blink/renderer/core/frame/csp/content_security_policy.h"
#include "third_party/blink/renderer/core/frame/deprecation.h"
#include "third_party/blink/renderer/core/frame/sandbox_flags.h"
#include "third_party/blink/renderer/core/html/html_document.h"
#include "third_party/blink/renderer/core/html/trust_token_attribute_parsing.h"
......@@ -271,8 +272,9 @@ void HTMLIFrameElement::ParseAttribute(
WebFeature::kFeaturePolicyAllowAttribute);
}
if (value.Contains(',')) {
UseCounter::Count(GetDocument(),
WebFeature::kCommaSeparatorInAllowAttribute);
Deprecation::CountDeprecation(
GetDocument().GetExecutionContext(),
WebFeature::kCommaSeparatorInAllowAttribute);
}
}
} else if (name == html_names::kDisallowdocumentaccessAttr &&
......
......@@ -403,7 +403,7 @@ TEST_F(HTMLIFrameElementSimTest, AllowAttributeParsingError) {
<< ConsoleMessages().front();
}
TEST_F(HTMLIFrameElementSimTest, CommaSeparatorIsCounted) {
TEST_F(HTMLIFrameElementSimTest, CommaSeparatorIsDeprecated) {
EXPECT_FALSE(
GetDocument().Loader()->GetUseCounterHelper().HasRecordedMeasurement(
WebFeature::kCommaSeparatorInAllowAttribute));
......@@ -414,6 +414,12 @@ TEST_F(HTMLIFrameElementSimTest, CommaSeparatorIsCounted) {
allow="fullscreen, geolocation"></iframe>
)");
EXPECT_EQ(ConsoleMessages().size(), 1u)
<< "Comma separator in allow attribute should log a deprecation message "
"to the console.";
EXPECT_TRUE(ConsoleMessages().front().Contains("5740835259809792"))
<< "Console message should mention the chromestatus entry.";
EXPECT_TRUE(
GetDocument().Loader()->GetUseCounterHelper().HasRecordedMeasurement(
WebFeature::kCommaSeparatorInAllowAttribute));
......
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