mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 08:13:35 +00:00
1e487450bd
The ThreatHit requests were never being sent because SetMatchedInfo() was called on the channel _after_ calling SendThreatHitReport(). Additionally, the telemetry was sent in OnStartRequest() and so errors returned in OnStopRequest() would not be caught. This patch also includes some improvements to the logging of these requests which can be toggled using: MOZ_LOG="UrlClassifierDbService:5,nsChannelClassifier:5" MozReview-Commit-ID: 9dtRgEPVS3g --HG-- extra : rebase_source : 6d0e4b745e203a54489ddd479935d008ab9a82d7
121 lines
4.1 KiB
Plaintext
121 lines
4.1 KiB
Plaintext
/* 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/. */
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
%{C++
|
|
#include "nsStringFwd.h"
|
|
#include "nsTArrayForwardDeclare.h"
|
|
%}
|
|
[ref] native StringArrayRef(nsTArray<nsCString>);
|
|
|
|
interface nsIChannel;
|
|
interface nsIEventTarget;
|
|
interface nsIPrincipal;
|
|
interface nsIURI;
|
|
|
|
/**
|
|
* 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.
|
|
* @param aList
|
|
* Name of the list that matched
|
|
* @param aProvider
|
|
* Name of provider that matched
|
|
* @param aFullHash
|
|
* Full hash of URL that matched
|
|
*/
|
|
void onClassifyComplete(in nsresult aErrorCode,
|
|
in ACString aList,
|
|
in ACString aProvider,
|
|
in ACString aFullHash);
|
|
};
|
|
|
|
/**
|
|
* The URI classifier service checks a URI against lists of phishing
|
|
* and malware sites.
|
|
*/
|
|
[scriptable, uuid(596620cc-76e3-4133-9d90-360e59a794cf)]
|
|
interface nsIURIClassifier : nsISupports
|
|
{
|
|
/**
|
|
* Classify a Principal using its URI.
|
|
*
|
|
* @param aPrincipal
|
|
* The principal that should be checked by the URI classifier.
|
|
*
|
|
* @param nsIEventTarget
|
|
* Event target for constructing actor in content process.
|
|
* The event target should be tied to Docgroup/Tabgroup by
|
|
* using EventTargetFor
|
|
*
|
|
* @param aTrackingProtectionEnabled
|
|
* Whether or not to classify the given URI against tracking
|
|
* protection lists
|
|
*
|
|
* @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.
|
|
*/
|
|
boolean classify(in nsIPrincipal aPrincipal,
|
|
in nsIEventTarget aEventTarget,
|
|
in boolean aTrackingProtectionEnabled,
|
|
in nsIURIClassifierCallback aCallback);
|
|
|
|
/**
|
|
* Synchronously classify a URI with a comma-separated string
|
|
* containing the given tables. This does not make network requests.
|
|
* The result is an array of table names that match.
|
|
*/
|
|
[noscript] StringArrayRef classifyLocalWithTables(in nsIURI aURI, in ACString aTables);
|
|
/**
|
|
* 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);
|
|
/**
|
|
* Same as above, but returns a comma separated list of table names.
|
|
* This is an internal interface used only for testing purposes.
|
|
*/
|
|
ACString classifyLocal(in nsIURI aURI, in ACString aTables);
|
|
|
|
/**
|
|
* Report to the provider that a Safe Browsing warning was shown.
|
|
*
|
|
* @param aChannel
|
|
* Channel for which the URL matched something on the threat list.
|
|
* @param aProvider
|
|
* Provider to notify.
|
|
* @param aList
|
|
* List where the full hash was found.
|
|
* @param aFullHash
|
|
* Full URL hash that triggered the warning.
|
|
*/
|
|
|
|
void sendThreatHitReport(in nsIChannel aChannel, in ACString aProvider,
|
|
in ACString aList, in ACString aFullHash);
|
|
};
|