Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / netwerk / url-classifier / nsIURIClassifier.idl
blob788d7b346574ae1ad47c84814f797a6ce8064016
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/. */
5 #include "nsISupports.idl"
6 #include "nsIUrlClassifierFeature.idl"
8 %{C++
9 #include "nsStringFwd.h"
10 #include "nsTArrayForwardDeclare.h"
12 [ref] native StringArrayRef(nsTArray<nsCString>);
14 interface nsIChannel;
15 interface nsISerialEventTarget;
16 interface nsIPrincipal;
17 interface nsIURI;
18 interface nsIUrlClassifierFeatureCallback;
20 /**
21 * Callback function for nsIURIClassifier lookups.
23 [scriptable, function, uuid(8face46e-0c96-470f-af40-0037dcd797bd)]
24 interface nsIURIClassifierCallback : nsISupports
26 /**
27 * Called by the URI classifier service when it is done checking a URI.
29 * Clients are responsible for associating callback objects with classify()
30 * calls.
32 * @param aErrorCode
33 * The error code with which the channel should be cancelled, or
34 * NS_OK if the load should continue normally.
35 * @param aList
36 * Name of the list that matched
37 * @param aProvider
38 * Name of provider that matched
39 * @param aFullHash
40 * Full hash of URL that matched
42 void onClassifyComplete(in nsresult aErrorCode,
43 in ACString aList,
44 in ACString aProvider,
45 in ACString aFullHash);
48 /**
49 * The URI classifier service checks a URI against lists of phishing
50 * and malware sites.
52 [scriptable, uuid(596620cc-76e3-4133-9d90-360e59a794cf)]
53 interface nsIURIClassifier : nsISupports
55 /**
56 * Classify a Principal using its URI.
58 * @param aPrincipal
59 * The principal that should be checked by the URI classifier.
61 * @param aCallback
62 * The URI classifier will call this callback when the URI has been
63 * classified.
65 * @return <code>false</code> if classification is not necessary. The
66 * callback will not be called.
67 * <code>true</code> if classification will be performed. The
68 * callback will be called.
70 boolean classify(in nsIPrincipal aPrincipal,
71 in nsIURIClassifierCallback aCallback);
73 /**
74 * Asynchronously classify a URI with list of features. This does not make
75 * network requests.
77 void asyncClassifyLocalWithFeatures(in nsIURI aURI,
78 in Array<nsIUrlClassifierFeature> aFeatures,
79 in nsIUrlClassifierFeature_listType aListType,
80 in nsIUrlClassifierFeatureCallback aCallback);
82 /**
83 * Returns a feature named aFeatureName.
85 nsIUrlClassifierFeature getFeatureByName(in ACString aFeatureName);
87 /**
88 * Returns all the feature names.
90 Array<ACString> getFeatureNames();
92 /**
93 * Create a new feature with a list of tables. This method is just for
94 * testing! Don't use it elsewhere.
96 nsIUrlClassifierFeature createFeatureWithTables(in ACString aName,
97 in Array<ACString> aBlocklistTables,
98 in Array<ACString> aEntitylistTables);
101 * Report to the provider that a Safe Browsing warning was shown.
103 * @param aChannel
104 * Channel for which the URL matched something on the threat list.
105 * @param aProvider
106 * Provider to notify.
107 * @param aList
108 * List where the full hash was found.
109 * @param aFullHash
110 * Full URL hash that triggered the warning.
113 void sendThreatHitReport(in nsIChannel aChannel, in ACString aProvider,
114 in ACString aList, in ACString aFullHash);