Bug 1514892 [wpt PR 14571] - Replace XRCoodinateSystem/FrameOfReference with XRSpace...
[gecko.git] / netwerk / url-classifier / nsIURIClassifier.idl
blob2697c9032b3cf3c1f1ec621229384b0bd20f4321
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 nsIEventTarget;
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 nsIEventTarget
62 * Event target for constructing actor in content process.
63 * The event target should be tied to Docgroup/Tabgroup by
64 * using EventTargetFor
66 * @param aCallback
67 * The URI classifier will call this callback when the URI has been
68 * classified.
70 * @return <code>false</code> if classification is not necessary. The
71 * callback will not be called.
72 * <code>true</code> if classification will be performed. The
73 * callback will be called.
75 boolean classify(in nsIPrincipal aPrincipal,
76 in nsIEventTarget aEventTarget,
77 in nsIURIClassifierCallback aCallback);
79 /**
80 * Asynchronously classify a URI with list of features. This does not make
81 * network requests.
83 void asyncClassifyLocalWithFeatures(in nsIURI aURI,
84 in Array<nsIUrlClassifierFeature> aFeatures,
85 in nsIUrlClassifierFeature_listType aListType,
86 in nsIUrlClassifierFeatureCallback aCallback);
88 /**
89 * Returns a feature named aFeatureName.
91 nsIUrlClassifierFeature getFeatureByName(in ACString aFeatureName);
93 /**
94 * Returns all the feature names.
96 Array<ACString> getFeatureNames();
98 /**
99 * Create a new feature with a list of tables. This method is just for
100 * testing! Don't use it elsewhere.
102 nsIUrlClassifierFeature createFeatureWithTables(in ACString aName,
103 in Array<ACString> aBlacklistTables,
104 in Array<ACString> aWhitelistTables);
107 * Report to the provider that a Safe Browsing warning was shown.
109 * @param aChannel
110 * Channel for which the URL matched something on the threat list.
111 * @param aProvider
112 * Provider to notify.
113 * @param aList
114 * List where the full hash was found.
115 * @param aFullHash
116 * Full URL hash that triggered the warning.
119 void sendThreatHitReport(in nsIChannel aChannel, in ACString aProvider,
120 in ACString aList, in ACString aFullHash);