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 nsISerialEventTarget
;
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.
62 * The URI classifier will call this callback when the URI has been
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
);
74 * Asynchronously classify a URI with list of features. This does not make
77 void asyncClassifyLocalWithFeatures
(in nsIURI aURI
,
78 in Array
<nsIUrlClassifierFeature
> aFeatures
,
79 in nsIUrlClassifierFeature_listType aListType
,
80 in nsIUrlClassifierFeatureCallback aCallback
);
83 * Returns a feature named aFeatureName.
85 nsIUrlClassifierFeature getFeatureByName
(in ACString aFeatureName
);
88 * Returns all the feature names.
90 Array
<ACString
> getFeatureNames
();
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.
104 * Channel for which the URL matched something on the threat list.
106 * Provider to notify.
108 * List where the full hash was found.
110 * Full URL hash that triggered the warning.
113 void sendThreatHitReport
(in nsIChannel aChannel
, in ACString aProvider
,
114 in ACString aList
, in ACString aFullHash
);