nsIUrlClassifierUtils.idl 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #include "nsISupports.idl"
  5. /**
  6. * Some utility methods used by the url classifier.
  7. */
  8. interface nsIURI;
  9. [scriptable, uuid(e4f0e59c-b922-48b0-a7b6-1735c1f96fed)]
  10. interface nsIUrlClassifierUtils : nsISupports
  11. {
  12. /**
  13. * Get the lookup string for a given URI. This normalizes the hostname,
  14. * url-decodes the string, and strips off the protocol.
  15. *
  16. * @param uri URI to get the lookup key for.
  17. *
  18. * @returns String containing the canonicalized URI.
  19. */
  20. ACString getKeyForURI(in nsIURI uri);
  21. /**
  22. * Get the provider by table name.
  23. *
  24. * @param tableName The table name that we want to lookup
  25. *
  26. * @returns the provider name that the given table belongs.
  27. */
  28. ACString getProvider(in ACString tableName);
  29. /**
  30. * Get the protocol version for the given provider.
  31. *
  32. * @param provider String the provider name. e.g. "google"
  33. *
  34. * @returns String to indicate the protocol version. e.g. "2.2"
  35. */
  36. ACString getProtocolVersion(in ACString provider);
  37. /**
  38. * Convert threat type to list name.
  39. *
  40. * @param Integer to indicate threat type.
  41. *
  42. * @returns The list names separated by ','. For example,
  43. * 'goog-phish-proto,test-phish-proto'.
  44. */
  45. ACString convertThreatTypeToListNames(in uint32_t threatType);
  46. /**
  47. * Convert list name to threat type.
  48. *
  49. * @param The list name.
  50. *
  51. * @returns The threat type in integer.
  52. */
  53. uint32_t convertListNameToThreatType(in ACString listName);
  54. /**
  55. * Make update request for given lists and their states.
  56. *
  57. * @param aListNames An array of list name represented in string.
  58. * @param aState An array of states (encoded in base64 format) for each list.
  59. * @param aCount The array length of aList and aState.
  60. *
  61. * @returns A base64url encoded string.
  62. */
  63. ACString makeUpdateRequestV4([array, size_is(aCount)] in string aListNames,
  64. [array, size_is(aCount)] in string aStatesBase64,
  65. in uint32_t aCount);
  66. };