| 
        
       | 
      
        
  
  Reduce buggy usage of the registry controlled domain service.
GetRegistryLength for host names canonicalizes the input for the caller, but
then returns the length in the canonicalized input, which is not necessarily
the same as the length in the original string. As a result, computations
performed by the caller based on this value can be wrong (see the bug for
more).
All callers of this function were audited and changed to use on of the
following:
- Many callers don't need the offsets. A new function
  HostHasRegistryControlledDomain is added to check for the presence of
  a R.C.D. without the risk of returning incorrect string lengths.
- Many callers already have guaranteed-canonical strings (they came out of
  a GURL or KURL object soon before the call) These were changed to use a
  new GetCanonicalHostRegistryLength function. A further advantage is that
  these calls will be faster.
- A new Permissive function is added that handles cases where the input
  is necessarily non-canonical.
Adds an IDN test case to the unit tests.
Removes checking for IP addresses in the already-known-canonical cases.
This requires a separate full canonicalization and IP addresses should
never match the R.C.D. list.
Reland of  https://codereview.chromium.org/2433583002/ with fix.
R=pkasting
BUG= 657199
Committed:  https://crrev.com/0a8baeebb5bb84e4dc2449c6860f32928eaa6d4c
Cr-Commit-Position: refs/heads/master@{#427779}
    
  
  
  
  
   
  
  
  
    
      Total comments: 2
      
     
  
  
  
   
  
  
  
  
    
  
  
    
       | 
      Unified diffs | 
      Side-by-side diffs | 
      Delta from patch set | 
      Stats (+654 lines, -272 lines) | 
      Patch | 
     
    
      
          | 
        M | 
        
          
            chrome/browser/android/history_report/delta_file_commons.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          2 chunks | 
          +5 lines, -5 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            chrome/browser/supervised_user/supervised_user_url_filter.h
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +1 line, -1 line | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            chrome/browser/supervised_user/supervised_user_url_filter.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          2 chunks | 
          +6 lines, -5 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            chrome/renderer/safe_browsing/phishing_url_feature_extractor.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +2 lines, -3 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/google/core/browser/google_util.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          5 chunks | 
          +24 lines, -20 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/history/core/browser/history_backend.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +1 line, -1 line | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/omnibox/browser/autocomplete_input.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +1 line, -1 line | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/omnibox/browser/history_quick_provider.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +7 lines, -8 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/omnibox/browser/history_url_provider.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +4 lines, -5 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/search_engines/template_url_service.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +2 lines, -3 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/ssl_errors/error_classification.h
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +1 line, -1 line | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/ssl_errors/error_classification.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          5 chunks | 
          +7 lines, -10 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/ssl_errors/error_classification_unittest.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +3 lines, -3 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            components/url_formatter/url_fixer.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +8 lines, -13 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            content/renderer/webpublicsuffixlist_impl.h
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +1 line, -1 line | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            content/renderer/webpublicsuffixlist_impl.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +7 lines, -6 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            extensions/common/csp_validator.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +2 lines, -4 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            extensions/common/manifest_handlers/externally_connectable.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          3 chunks | 
          +15 lines, -11 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            extensions/common/permissions/permission_message_util.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +5 lines, -4 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            extensions/common/url_pattern.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +11 lines, -15 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            net/base/registry_controlled_domains/effective_tld_names_unittest1.gperf
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +1 line, -0 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            net/base/registry_controlled_domains/registry_controlled_domain.h
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          2 chunks | 
          +53 lines, -5 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            net/base/registry_controlled_domains/registry_controlled_domain.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          3 chunks | 
          +173 lines, -14 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            net/base/registry_controlled_domains/registry_controlled_domain_unittest.cc
          
         | 
        
          
            View
          
         | 
        
        
          1
        
          2
        
         | 
        
          8 chunks | 
          +200 lines, -104 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            net/base/url_util.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +3 lines, -4 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            net/cert/cert_verify_proc.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +3 lines, -5 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            net/cert/x509_certificate.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +1 line, -1 line | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            third_party/WebKit/public/platform/WebPublicSuffixList.h
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +1 line, -1 line | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            url/url_canon.h
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +27 lines, -0 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            url/url_canon_host.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          4 chunks | 
          +35 lines, -18 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
      
          | 
        M | 
        
          
            url/url_canon_unittest.cc
          
         | 
        
          
            View
          
         | 
        
        
         | 
        
          1 chunk | 
          +44 lines, -0 lines | 
        
        
          
            0 comments
            
            
          
         | 
        
          
            Download
          
         | 
       
    
   
  
  
 
  
   
  
    
  
  
  
    
    Total messages: 21 (11 generated)
     
  
  
       |