2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-09-01 03:18:46 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2016-11-30 00:04:43 +03:00
|
|
|
%{C++
|
|
|
|
#include "nsTArrayForwardDeclare.h"
|
|
|
|
class nsCString;
|
|
|
|
%}
|
|
|
|
[ref] native StringArrayRef(nsTArray<nsCString>);
|
|
|
|
|
2007-09-01 03:18:46 +04:00
|
|
|
interface nsIChannel;
|
2017-03-08 06:06:36 +03:00
|
|
|
interface nsIEventTarget;
|
2015-08-07 23:08:22 +03:00
|
|
|
interface nsIPrincipal;
|
|
|
|
interface nsIURI;
|
2007-09-01 03:18:46 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback function for nsIURIClassifier lookups.
|
|
|
|
*/
|
|
|
|
[scriptable, function, uuid(8face46e-0c96-470f-af40-0037dcd797bd)]
|
|
|
|
interface nsIURIClassifierCallback : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Called by the URI classifier service when it is done checking a URI.
|
|
|
|
*
|
|
|
|
* Clients are responsible for associating callback objects with classify()
|
|
|
|
* calls.
|
|
|
|
*
|
|
|
|
* @param aErrorCode
|
|
|
|
* The error code with which the channel should be cancelled, or
|
|
|
|
* NS_OK if the load should continue normally.
|
2017-02-21 04:46:36 +03:00
|
|
|
* @param aList
|
|
|
|
* Name of the list that matched
|
|
|
|
* @param aProvider
|
|
|
|
* Name of provider that matched
|
|
|
|
* @param aPrefix
|
|
|
|
* Hash prefix of URL that matched
|
2007-09-01 03:18:46 +04:00
|
|
|
*/
|
2017-02-21 04:46:36 +03:00
|
|
|
void onClassifyComplete(in nsresult aErrorCode,
|
|
|
|
in ACString aList,
|
|
|
|
in ACString aProvider,
|
|
|
|
in ACString aPrefix);
|
2007-09-01 03:18:46 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The URI classifier service checks a URI against lists of phishing
|
|
|
|
* and malware sites.
|
|
|
|
*/
|
2015-08-07 23:08:22 +03:00
|
|
|
[scriptable, uuid(596620cc-76e3-4133-9d90-360e59a794cf)]
|
2007-09-01 03:18:46 +04:00
|
|
|
interface nsIURIClassifier : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
2013-09-07 04:12:33 +04:00
|
|
|
* Classify a Principal using its URI.
|
2007-09-01 03:18:46 +04:00
|
|
|
*
|
2012-07-20 20:46:59 +04:00
|
|
|
* @param aPrincipal
|
|
|
|
* The principal that should be checked by the URI classifier.
|
2017-03-08 06:06:36 +03:00
|
|
|
*
|
|
|
|
* @param nsIEventTarget
|
|
|
|
* Event target for constructing actor in content process.
|
|
|
|
* The event target should be tied to Docgroup/Tabgroup by
|
|
|
|
* using EventTargetFor
|
|
|
|
*
|
2014-07-24 21:59:00 +04:00
|
|
|
* @param aTrackingProtectionEnabled
|
|
|
|
* Whether or not to classify the given URI against tracking
|
|
|
|
* protection lists
|
|
|
|
*
|
2007-09-01 03:18:46 +04:00
|
|
|
* @param aCallback
|
|
|
|
* The URI classifier will call this callback when the URI has been
|
|
|
|
* classified.
|
|
|
|
*
|
|
|
|
* @return <code>false</code> if classification is not necessary. The
|
|
|
|
* callback will not be called.
|
|
|
|
* <code>true</code> if classification will be performed. The
|
|
|
|
* callback will be called.
|
|
|
|
*/
|
2012-07-20 20:46:59 +04:00
|
|
|
boolean classify(in nsIPrincipal aPrincipal,
|
2017-03-08 06:06:36 +03:00
|
|
|
in nsIEventTarget aEventTarget,
|
2014-07-24 21:59:00 +04:00
|
|
|
in boolean aTrackingProtectionEnabled,
|
2007-09-01 03:18:46 +04:00
|
|
|
in nsIURIClassifierCallback aCallback);
|
2014-12-18 21:18:09 +03:00
|
|
|
|
2015-03-27 01:24:19 +03:00
|
|
|
/**
|
2015-08-07 23:08:22 +03:00
|
|
|
* Synchronously classify a URI with a comma-separated string
|
|
|
|
* containing the given tables. This does not make network requests.
|
2016-11-30 00:04:43 +03:00
|
|
|
* The result is an array of table names that match.
|
|
|
|
*/
|
|
|
|
[noscript] StringArrayRef classifyLocalWithTables(in nsIURI aURI, in ACString aTables);
|
2017-03-01 06:27:51 +03:00
|
|
|
/**
|
|
|
|
* Asynchronously classify a URI with a comma-separated string
|
|
|
|
* containing the given tables. This does not make network requests.
|
|
|
|
* The callback does NOT totally follow nsIURIClassifierCallback's
|
|
|
|
* semantics described above. Only |aList| will be meaningful, which
|
|
|
|
* is a comma separated list of table names. (same as what classifyLocal
|
|
|
|
* returns.)
|
|
|
|
*/
|
|
|
|
void asyncClassifyLocalWithTables(in nsIURI aURI,
|
|
|
|
in ACString aTables,
|
|
|
|
in nsIURIClassifierCallback aCallback);
|
2016-11-30 00:04:43 +03:00
|
|
|
/**
|
|
|
|
* Same as above, but returns a comma separated list of table names.
|
|
|
|
* This is an internal interface used only for testing purposes.
|
2015-03-27 01:24:19 +03:00
|
|
|
*/
|
2016-11-30 00:04:43 +03:00
|
|
|
ACString classifyLocal(in nsIURI aURI, in ACString aTables);
|
2007-09-01 03:18:46 +04:00
|
|
|
};
|