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

Side by Side Diff: url/url_util.cc

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Addressed comments 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
« url/url_util.h ('K') | « url/url_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "url/url_util.h" 5 #include "url/url_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/debug/leak_annotations.h" 10 #include "base/debug/leak_annotations.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 SchemeType unused_scheme_type; 601 SchemeType unused_scheme_type;
602 return DoIsStandard(spec, scheme, &unused_scheme_type); 602 return DoIsStandard(spec, scheme, &unused_scheme_type);
603 } 603 }
604 604
605 bool IsReferrerScheme(const char* spec, const Component& scheme) { 605 bool IsReferrerScheme(const char* spec, const Component& scheme) {
606 Initialize(); 606 Initialize();
607 SchemeType unused_scheme_type; 607 SchemeType unused_scheme_type;
608 return DoIsInSchemes(spec, scheme, &unused_scheme_type, *referrer_schemes); 608 return DoIsInSchemes(spec, scheme, &unused_scheme_type, *referrer_schemes);
609 } 609 }
610 610
611 bool IsAboutBlankURL(const GURL& url) {
612 if (!url.SchemeIs(url::kAboutScheme))
613 return false;
614
615 if (url.has_host() || url.has_username() || url.has_password() ||
616 url.has_port()) {
617 return false;
618 }
619
620 if (url.path() != kAboutBlankPath && url.path() != kAboutBlankWithHashPath)
621 return false;
622
623 return true;
Mike West 2017/01/20 12:57:56 There's enough logic here that adding tests seems
clamy 2017/01/20 13:19:28 Done. Let me know if you think I should add anothe
624 }
625
611 bool FindAndCompareScheme(const char* str, 626 bool FindAndCompareScheme(const char* str,
612 int str_len, 627 int str_len,
613 const char* compare, 628 const char* compare,
614 Component* found_scheme) { 629 Component* found_scheme) {
615 return DoFindAndCompareScheme(str, str_len, compare, found_scheme); 630 return DoFindAndCompareScheme(str, str_len, compare, found_scheme);
616 } 631 }
617 632
618 bool FindAndCompareScheme(const base::char16* str, 633 bool FindAndCompareScheme(const base::char16* str,
619 int str_len, 634 int str_len,
620 const char* compare, 635 const char* compare,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 return DoCompareSchemeComponent(spec, component, compare_to); 816 return DoCompareSchemeComponent(spec, component, compare_to);
802 } 817 }
803 818
804 bool CompareSchemeComponent(const base::char16* spec, 819 bool CompareSchemeComponent(const base::char16* spec,
805 const Component& component, 820 const Component& component,
806 const char* compare_to) { 821 const char* compare_to) {
807 return DoCompareSchemeComponent(spec, component, compare_to); 822 return DoCompareSchemeComponent(spec, component, compare_to);
808 } 823 }
809 824
810 } // namespace url 825 } // namespace url
OLDNEW
« url/url_util.h ('K') | « url/url_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698