Commit 25e6b9fd authored by estark's avatar estark Committed by Commit bot

Add UseCounters for referrerpolicy attributes

BUG=

Review-Url: https://codereview.chromium.org/2628613002
Cr-Commit-Position: refs/heads/master@{#443145}
parent 4e689e4b
...@@ -1421,6 +1421,10 @@ class CORE_EXPORT UseCounter { ...@@ -1421,6 +1421,10 @@ class CORE_EXPORT UseCounter {
TopNavInSandboxWithPerm = 1751, TopNavInSandboxWithPerm = 1751,
TopNavInSandboxWithPermButNoGesture = 1752, TopNavInSandboxWithPermButNoGesture = 1752,
ReferrerPolicyHeader = 1753, ReferrerPolicyHeader = 1753,
HTMLAnchorElementReferrerPolicyAttribute = 1754,
HTMLIFrameElementReferrerPolicyAttribute = 1755,
HTMLImageElementReferrerPolicyAttribute = 1756,
HTMLLinkElementReferrerPolicyAttribute = 1757,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
......
...@@ -415,6 +415,8 @@ void HTMLAnchorElement::handleClick(Event* event) { ...@@ -415,6 +415,8 @@ void HTMLAnchorElement::handleClick(Event* event) {
SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords( SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(
fastGetAttribute(referrerpolicyAttr), &policy) && fastGetAttribute(referrerpolicyAttr), &policy) &&
!hasRel(RelationNoReferrer)) { !hasRel(RelationNoReferrer)) {
UseCounter::count(document(),
UseCounter::HTMLAnchorElementReferrerPolicyAttribute);
request.setHTTPReferrer(SecurityPolicy::generateReferrer( request.setHTTPReferrer(SecurityPolicy::generateReferrer(
policy, completedURL, document().outgoingReferrer())); policy, completedURL, document().outgoingReferrer()));
} }
......
...@@ -113,9 +113,12 @@ void HTMLIFrameElement::parseAttribute( ...@@ -113,9 +113,12 @@ void HTMLIFrameElement::parseAttribute(
UseCounter::count(document(), UseCounter::SandboxViaIFrame); UseCounter::count(document(), UseCounter::SandboxViaIFrame);
} else if (name == referrerpolicyAttr) { } else if (name == referrerpolicyAttr) {
m_referrerPolicy = ReferrerPolicyDefault; m_referrerPolicy = ReferrerPolicyDefault;
if (!value.isNull()) if (!value.isNull()) {
SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords( SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(
value, &m_referrerPolicy); value, &m_referrerPolicy);
UseCounter::count(document(),
UseCounter::HTMLIFrameElementReferrerPolicyAttribute);
}
} else if (name == allowfullscreenAttr) { } else if (name == allowfullscreenAttr) {
bool oldAllowFullscreen = m_allowFullscreen; bool oldAllowFullscreen = m_allowFullscreen;
m_allowFullscreen = !value.isNull(); m_allowFullscreen = !value.isNull();
......
...@@ -267,6 +267,8 @@ void HTMLImageElement::parseAttribute( ...@@ -267,6 +267,8 @@ void HTMLImageElement::parseAttribute(
if (!params.newValue.isNull()) { if (!params.newValue.isNull()) {
SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords( SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(
params.newValue, &m_referrerPolicy); params.newValue, &m_referrerPolicy);
UseCounter::count(document(),
UseCounter::HTMLImageElementReferrerPolicyAttribute);
} }
} else { } else {
HTMLElement::parseAttribute(params); HTMLElement::parseAttribute(params);
......
...@@ -82,8 +82,11 @@ void HTMLLinkElement::parseAttribute( ...@@ -82,8 +82,11 @@ void HTMLLinkElement::parseAttribute(
process(); process();
} else if (name == referrerpolicyAttr) { } else if (name == referrerpolicyAttr) {
m_referrerPolicy = ReferrerPolicyDefault; m_referrerPolicy = ReferrerPolicyDefault;
if (!value.isNull()) if (!value.isNull()) {
SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy);
UseCounter::count(document(),
UseCounter::HTMLLinkElementReferrerPolicyAttribute);
}
} else if (name == sizesAttr) { } else if (name == sizesAttr) {
m_sizes->setValue(value); m_sizes->setValue(value);
} else if (name == mediaAttr) { } else if (name == mediaAttr) {
......
...@@ -88803,6 +88803,10 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries. ...@@ -88803,6 +88803,10 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<int value="1751" label="TopNavInSandboxWithPerm"/> <int value="1751" label="TopNavInSandboxWithPerm"/>
<int value="1752" label="TopNavInSandboxWithPermButNoGesture"/> <int value="1752" label="TopNavInSandboxWithPermButNoGesture"/>
<int value="1753" label="ReferrerPolicyHeader"/> <int value="1753" label="ReferrerPolicyHeader"/>
<int value="1754" label="HTMLAnchorElementReferrerPolicyAttribute"/>
<int value="1755" label="HTMLIFrameElementReferrerPolicyAttribute"/>
<int value="1756" label="HTMLImageElementReferrerPolicyAttribute"/>
<int value="1757" label="HTMLLinkElementReferrerPolicyAttribute"/>
</enum> </enum>
<enum name="FetchRequestMode" type="int"> <enum name="FetchRequestMode" type="int">
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