nsIURIClassifier.idl 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. interface nsIChannel;
  6. interface nsIPrincipal;
  7. interface nsIURI;
  8. /**
  9. * Callback function for nsIURIClassifier lookups.
  10. */
  11. [scriptable, function, uuid(8face46e-0c96-470f-af40-0037dcd797bd)]
  12. interface nsIURIClassifierCallback : nsISupports
  13. {
  14. /**
  15. * Called by the URI classifier service when it is done checking a URI.
  16. *
  17. * Clients are responsible for associating callback objects with classify()
  18. * calls.
  19. *
  20. * @param aErrorCode
  21. * The error code with which the channel should be cancelled, or
  22. * NS_OK if the load should continue normally.
  23. */
  24. void onClassifyComplete(in nsresult aErrorCode);
  25. };
  26. /**
  27. * The URI classifier service checks a URI against lists of phishing
  28. * and malware sites.
  29. */
  30. [scriptable, uuid(596620cc-76e3-4133-9d90-360e59a794cf)]
  31. interface nsIURIClassifier : nsISupports
  32. {
  33. /**
  34. * Classify a Principal using its URI.
  35. *
  36. * @param aPrincipal
  37. * The principal that should be checked by the URI classifier.
  38. * @param aTrackingProtectionEnabled
  39. * Whether or not to classify the given URI against tracking
  40. * protection lists
  41. *
  42. * @param aCallback
  43. * The URI classifier will call this callback when the URI has been
  44. * classified.
  45. *
  46. * @return <code>false</code> if classification is not necessary. The
  47. * callback will not be called.
  48. * <code>true</code> if classification will be performed. The
  49. * callback will be called.
  50. */
  51. boolean classify(in nsIPrincipal aPrincipal,
  52. in boolean aTrackingProtectionEnabled,
  53. in nsIURIClassifierCallback aCallback);
  54. /**
  55. * Synchronously classify a URI with a comma-separated string
  56. * containing the given tables. This does not make network requests.
  57. * The result is a comma-separated string of tables that match.
  58. */
  59. ACString classifyLocalWithTables(in nsIURI aURI, in ACString aTables);
  60. };