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"
9 #include
"nsStringFwd.h"
10 #include
"nsTArrayForwardDeclare.h"
12 [ref] native StringArrayRef
(nsTArray
<nsCString
>);
15 interface nsIEventTarget
;
16 interface nsIPrincipal
;
18 interface nsIUrlClassifierFeatureCallback
;
21 * Callback function for nsIURIClassifier lookups.
23 [scriptable
, function
, uuid(8face46e
-0c96
-470f
-af40
-0037dcd797bd
)]
24 interface nsIURIClassifierCallback
: nsISupports
27 * Called by the URI classifier service when it is done checking a URI.
29 * Clients are responsible for associating callback objects with classify()
33 * The error code with which the channel should be cancelled, or
34 * NS_OK if the load should continue normally.
36 * Name of the list that matched
38 * Name of provider that matched
40 * Full hash of URL that matched
42 void onClassifyComplete
(in nsresult aErrorCode
,
44 in ACString aProvider
,
45 in ACString aFullHash
);
49 * The URI classifier service checks a URI against lists of phishing
52 [scriptable
, uuid(596620cc
-76e3
-4133-9d90
-360e59a794cf
)]
53 interface nsIURIClassifier
: nsISupports
56 * Classify a Principal using its URI.
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
67 * The URI classifier will call this callback when the URI has been
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
);
80 * Asynchronously classify a URI with list of features. This does not make
83 void asyncClassifyLocalWithFeatures
(in nsIURI aURI
,
84 in Array
<nsIUrlClassifierFeature
> aFeatures
,
85 in nsIUrlClassifierFeature_listType aListType
,
86 in nsIUrlClassifierFeatureCallback aCallback
);
89 * Returns a feature named aFeatureName.
91 nsIUrlClassifierFeature getFeatureByName
(in ACString aFeatureName
);
94 * Returns all the feature names.
96 Array
<ACString
> getFeatureNames
();
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.
110 * Channel for which the URL matched something on the threat list.
112 * Provider to notify.
114 * List where the full hash was found.
116 * Full URL hash that triggered the warning.
119 void sendThreatHitReport
(in nsIChannel aChannel
, in ACString aProvider
,
120 in ACString aList
, in ACString aFullHash
);