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

Side by Side Diff: url/url_util.cc

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Add missing include 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 // 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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "url/gurl.h"
13 #include "url/url_canon_internal.h" 14 #include "url/url_canon_internal.h"
14 #include "url/url_constants.h" 15 #include "url/url_constants.h"
15 #include "url/url_file.h" 16 #include "url/url_file.h"
16 #include "url/url_util_internal.h" 17 #include "url/url_util_internal.h"
17 18
18 namespace url { 19 namespace url {
19 20
20 namespace { 21 namespace {
21 22
22 // Pass this enum through for methods which would like to know if whitespace 23 // Pass this enum through for methods which would like to know if whitespace
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 SchemeType unused_scheme_type; 602 SchemeType unused_scheme_type;
602 return DoIsStandard(spec, scheme, &unused_scheme_type); 603 return DoIsStandard(spec, scheme, &unused_scheme_type);
603 } 604 }
604 605
605 bool IsReferrerScheme(const char* spec, const Component& scheme) { 606 bool IsReferrerScheme(const char* spec, const Component& scheme) {
606 Initialize(); 607 Initialize();
607 SchemeType unused_scheme_type; 608 SchemeType unused_scheme_type;
608 return DoIsInSchemes(spec, scheme, &unused_scheme_type, *referrer_schemes); 609 return DoIsInSchemes(spec, scheme, &unused_scheme_type, *referrer_schemes);
609 } 610 }
610 611
612 bool IsAboutBlank(const GURL& url) {
613 if (!url.SchemeIs(url::kAboutScheme))
614 return false;
615
616 if (url.has_host() || url.has_username() || url.has_password() ||
617 url.has_port()) {
618 return false;
619 }
620
621 if (url.path() != kAboutBlankPath && url.path() != kAboutBlankWithHashPath)
622 return false;
623
624 return true;
625 }
626
611 bool FindAndCompareScheme(const char* str, 627 bool FindAndCompareScheme(const char* str,
612 int str_len, 628 int str_len,
613 const char* compare, 629 const char* compare,
614 Component* found_scheme) { 630 Component* found_scheme) {
615 return DoFindAndCompareScheme(str, str_len, compare, found_scheme); 631 return DoFindAndCompareScheme(str, str_len, compare, found_scheme);
616 } 632 }
617 633
618 bool FindAndCompareScheme(const base::char16* str, 634 bool FindAndCompareScheme(const base::char16* str,
619 int str_len, 635 int str_len,
620 const char* compare, 636 const char* compare,
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 return DoCompareSchemeComponent(spec, component, compare_to); 817 return DoCompareSchemeComponent(spec, component, compare_to);
802 } 818 }
803 819
804 bool CompareSchemeComponent(const base::char16* spec, 820 bool CompareSchemeComponent(const base::char16* spec,
805 const Component& component, 821 const Component& component,
806 const char* compare_to) { 822 const char* compare_to) {
807 return DoCompareSchemeComponent(spec, component, compare_to); 823 return DoCompareSchemeComponent(spec, component, compare_to);
808 } 824 }
809 825
810 } // namespace url 826 } // namespace url
OLDNEW
« url/url_util.h ('K') | « url/url_util.h ('k') | url/url_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698