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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2634893003: Experiment with blocking resolution of HTTP URLs containing '\n' and '<'. (Closed)
Patch Set: Culling. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 4929 matching lines...) Expand 10 before | Expand all | Expand 10 after
4940 m_visuallyOrdered ? EOrder::kVisual : EOrder::kLogical); 4940 m_visuallyOrdered ? EOrder::kVisual : EOrder::kLogical);
4941 } 4941 }
4942 setNeedsStyleRecalc(SubtreeStyleChange, 4942 setNeedsStyleRecalc(SubtreeStyleChange,
4943 StyleChangeReasonForTracing::create( 4943 StyleChangeReasonForTracing::create(
4944 StyleChangeReason::VisuallyOrdered)); 4944 StyleChangeReason::VisuallyOrdered));
4945 } 4945 }
4946 } 4946 }
4947 4947
4948 KURL Document::completeURL(const String& url) const { 4948 KURL Document::completeURL(const String& url) const {
4949 String trimmed = url.stripWhiteSpace(); 4949 String trimmed = url.stripWhiteSpace();
4950 KURL completed = completeURLWithOverride(url, m_baseURL);
4951
4950 bool newline = trimmed.contains('\n') || trimmed.contains('\r'); 4952 bool newline = trimmed.contains('\n') || trimmed.contains('\r');
4951 bool brace = trimmed.contains('<'); 4953 bool lessThan = trimmed.contains('<');
4952 if (newline) 4954 if ((newline || lessThan) && completed.protocolIsInHTTPFamily()) {
4953 UseCounter::count(*this, UseCounter::DocumentCompleteURLContainingNewline); 4955 if (newline) {
4954 if (brace) { 4956 UseCounter::count(*this,
4955 UseCounter::count(*this, 4957 UseCounter::DocumentCompleteURLHTTPContainingNewline);
4956 UseCounter::DocumentCompleteURLContainingOpenBrace); 4958 }
4957 } 4959 if (lessThan) {
4958 if (newline && brace) { 4960 UseCounter::count(*this,
4961 UseCounter::DocumentCompleteURLHTTPContainingLessThan);
4962 }
4963 if (newline && lessThan) {
4964 UseCounter::count(
4965 *this,
4966 UseCounter::DocumentCompleteURLHTTPContainingNewlineAndLessThan);
4967
4968 if (RuntimeEnabledFeatures::restrictCompleteURLCharacterSetEnabled())
4969 return KURL();
4970 }
4971 } else if (newline || lessThan) {
4959 UseCounter::count( 4972 UseCounter::count(
4960 *this, UseCounter::DocumentCompleteURLContainingNewlineAndOpenBrace); 4973 *this,
4974 UseCounter::DocumentCompleteURLNonHTTPContainingNewlineOrLessThan);
4961 } 4975 }
4962 return completeURLWithOverride(url, m_baseURL); 4976 return completeURLWithOverride(url, m_baseURL);
4963 } 4977 }
4964 4978
4965 KURL Document::completeURLWithOverride(const String& url, 4979 KURL Document::completeURLWithOverride(const String& url,
4966 const KURL& baseURLOverride) const { 4980 const KURL& baseURLOverride) const {
4967 DCHECK(baseURLOverride.isEmpty() || baseURLOverride.isValid()); 4981 DCHECK(baseURLOverride.isEmpty() || baseURLOverride.isValid());
4968 4982
4969 // Always return a null URL when passed a null string. 4983 // Always return a null URL when passed a null string.
4970 // FIXME: Should we change the KURL constructor to have this behavior? 4984 // FIXME: Should we change the KURL constructor to have this behavior?
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
6517 } 6531 }
6518 6532
6519 void showLiveDocumentInstances() { 6533 void showLiveDocumentInstances() {
6520 WeakDocumentSet& set = liveDocumentSet(); 6534 WeakDocumentSet& set = liveDocumentSet();
6521 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6535 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6522 for (Document* document : set) 6536 for (Document* document : set)
6523 fprintf(stderr, "- Document %p URL: %s\n", document, 6537 fprintf(stderr, "- Document %p URL: %s\n", document,
6524 document->url().getString().utf8().data()); 6538 document->url().getString().utf8().data());
6525 } 6539 }
6526 #endif 6540 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698