LCOV - code coverage report
Current view: top level - toolkit/components/url-classifier - nsUrlClassifierUtils.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       3             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #ifndef nsUrlClassifierUtils_h_
       6             : #define nsUrlClassifierUtils_h_
       7             : 
       8             : #include "nsAutoPtr.h"
       9             : #include "nsIUrlClassifierUtils.h"
      10             : #include "nsClassHashtable.h"
      11             : #include "nsIObserver.h"
      12             : 
      13             : #define TESTING_TABLE_PROVIDER_NAME "test"
      14             : 
      15             : class nsUrlClassifierUtils final : public nsIUrlClassifierUtils,
      16             :                                    public nsIObserver
      17             : {
      18             : public:
      19             :   typedef nsClassHashtable<nsCStringHashKey, nsCString> ProviderDictType;
      20             : 
      21             :   nsUrlClassifierUtils();
      22             : 
      23             :   NS_DECL_THREADSAFE_ISUPPORTS
      24             :   NS_DECL_NSIURLCLASSIFIERUTILS
      25             :   NS_DECL_NSIOBSERVER
      26             : 
      27             :   nsresult Init();
      28             : 
      29             :   nsresult CanonicalizeHostname(const nsACString & hostname,
      30             :                                 nsACString & _retval);
      31             :   nsresult CanonicalizePath(const nsACString & url, nsACString & _retval);
      32             : 
      33             :   // This function will encode all "special" characters in typical url encoding,
      34             :   // that is %hh where h is a valid hex digit.  The characters which are encoded
      35             :   // by this function are any ascii characters under 32(control characters and
      36             :   // space), 37(%), and anything 127 or above (special characters).  Url is the
      37             :   // string to encode, ret is the encoded string.  Function returns true if
      38             :   // ret != url.
      39             :   bool SpecialEncode(const nsACString & url,
      40             :                        bool foldSlashes,
      41             :                        nsACString & _retval);
      42             : 
      43             :   void ParseIPAddress(const nsACString & host, nsACString & _retval);
      44             :   void CanonicalNum(const nsACString & num,
      45             :                     uint32_t bytes,
      46             :                     bool allowOctal,
      47             :                     nsACString & _retval);
      48             : 
      49             : private:
      50           0 :   ~nsUrlClassifierUtils() {}
      51             : 
      52             :   // Disallow copy constructor
      53             :   nsUrlClassifierUtils(const nsUrlClassifierUtils&);
      54             : 
      55             :   // Function to tell if we should encode a character.
      56             :   bool ShouldURLEscape(const unsigned char c) const;
      57             : 
      58             :   void CleanupHostname(const nsACString & host, nsACString & _retval);
      59             : 
      60             :   nsresult ReadProvidersFromPrefs(ProviderDictType& aDict);
      61             : 
      62             :   // The provider lookup table and its mutex.
      63             :   ProviderDictType mProviderDict;
      64             :   mozilla::Mutex mProviderDictLock;
      65             : };
      66             : 
      67             : #endif // nsUrlClassifierUtils_h_

Generated by: LCOV version 1.13