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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2626243002: Add some <base> metrics to guide experimentation. (Closed)
Patch Set: One more. Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index eb856afdaa55eb22b25ddac31cd4621ba8eb151b..45677d5fc304b629b3877704a919e5201d3b314b 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -3287,6 +3287,8 @@ void Document::setBaseURLOverride(const KURL& url) {
}
void Document::processBaseElement() {
+ UseCounter::count(*this, UseCounter::BaseElement);
+
// Find the first href attribute in a base element and the first target
// attribute in a base element.
const AtomicString* href = 0;
@@ -3304,9 +3306,10 @@ void Document::processBaseElement() {
if (!value.isNull())
target = &value;
}
- if (contentSecurityPolicy()->isActive())
+ if (contentSecurityPolicy()->isActive()) {
UseCounter::count(*this,
UseCounter::ContentSecurityPolicyWithBaseElement);
+ }
}
// FIXME: Since this doesn't share code with completeURL it may not handle
@@ -3317,13 +3320,29 @@ void Document::processBaseElement() {
if (!strippedHref.isEmpty())
baseElementURL = KURL(url(), strippedHref);
}
+
+ if (!baseElementURL.isEmpty()) {
+ if (baseElementURL.protocolIsData())
+ UseCounter::count(*this, UseCounter::BaseWithDataHref);
+ if (!this->getSecurityOrigin()->canRequest(baseElementURL))
+ UseCounter::count(*this, UseCounter::BaseWithCrossOriginHref);
+ }
+
if (m_baseElementURL != baseElementURL &&
contentSecurityPolicy()->allowBaseURI(baseElementURL)) {
m_baseElementURL = baseElementURL;
updateBaseURL();
}
- m_baseTarget = target ? *target : nullAtom;
+ if (target) {
+ if (target->contains('\n') || target->contains('\r'))
+ UseCounter::count(*this, UseCounter::BaseWithNewlinesInTarget);
+ if (target->contains('<'))
+ UseCounter::count(*this, UseCounter::BaseWithOpenBracketInTarget);
+ m_baseTarget = *target;
+ } else {
+ m_baseTarget = nullAtom;
+ }
}
String Document::userAgent() const {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698