mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
In origin telemetry, we want to record the matching statistic of each entry in our tracking tables. To identify which entry a given URL matches, it needs the hash value that matches the safe browsing database. This patch passes the hash value to ProcessChannel so Features can obtain the information and pass it. Note that it is possible that an URL may find multiple matches. If an URL matches hash A of list 1 and hash B of list 2, the parameter in ProcessChannel looks like: aList = [list 1, list2] aHashes = [hash A, hash B] Differential Revision: https://phabricator.services.mozilla.com/D28789 --HG-- extra : moz-landing-system : lando
111 lines
3.5 KiB
Text
111 lines
3.5 KiB
Text
/* 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>);
|
|
[ref] native ConstStringArrayRef(const nsTArray<nsCString>);
|
|
|
|
interface nsIChannel;
|
|
interface nsIURI;
|
|
|
|
/**
|
|
* A single URLClassifier feature.
|
|
*/
|
|
[builtinclass, scriptable, uuid(a6c9b24e-b4f1-426e-af58-2c976c3943a8)]
|
|
interface nsIUrlClassifierFeature : nsISupports
|
|
{
|
|
cenum listType: 8 {
|
|
blacklist = 0,
|
|
whitelist = 1,
|
|
};
|
|
|
|
/**
|
|
* The feature name
|
|
*/
|
|
readonly attribute ACString name;
|
|
|
|
/**
|
|
* Returns the tables for one of the possible lists.
|
|
*/
|
|
[noscript] StringArrayRef getTables(in nsIUrlClassifierFeature_listType aListType);
|
|
|
|
/**
|
|
* Returns true if |aTable| is part of the tables of |aListType| type.
|
|
*/
|
|
[noscript] boolean hasTable(in ACString aTable,
|
|
in nsIUrlClassifierFeature_listType aListType);
|
|
|
|
/**
|
|
* Returns true if |aHost| is contained in the preference of |aListType| type.
|
|
* |aPrefTableName| will be set to the table name to use.
|
|
*/
|
|
[noscript] boolean hasHostInPreferences(in ACString aHost,
|
|
in nsIUrlClassifierFeature_listType aListType,
|
|
out ACString aPrefTableName);
|
|
|
|
/**
|
|
* Returns a comma-separated list of hosts to be ignored.
|
|
*/
|
|
readonly attribute ACString skipHostList;
|
|
|
|
/**
|
|
* When this feature matches the channel, this method is executed to do
|
|
* 'something' on the channel. For instance, a tracking-annotation feature
|
|
* would mark the channel as tracker, a tracking-protection feature would
|
|
* cancel the channel.
|
|
* Returns if we should process other feature results or not. For instance,
|
|
* tracking-protection cancel the channel, and after that we should stop
|
|
* processing other features.
|
|
*/
|
|
[noscript] boolean processChannel(in nsIChannel aChannel,
|
|
in ConstStringArrayRef aList,
|
|
in ConstStringArrayRef aHashes);
|
|
|
|
/**
|
|
* Features can work with different URLs from a channel (channel url, or
|
|
* top-level, or something else). This method returns what we need to use for
|
|
* the current list.
|
|
*/
|
|
[noscript] nsIURI getURIByListType(in nsIChannel channel,
|
|
in nsIUrlClassifierFeature_listType listType);
|
|
};
|
|
|
|
/**
|
|
* The result of the classifier operation is this interface.
|
|
* See asyncClassifyLocalWithFeatures() in nsIURIClassifier.idl.
|
|
*/
|
|
[builtinclass, scriptable, uuid(ccb88140-5d66-4873-9815-a1b98d6cdc92)]
|
|
interface nsIUrlClassifierFeatureResult : nsISupports
|
|
{
|
|
readonly attribute nsIURI uri;
|
|
|
|
readonly attribute nsIUrlClassifierFeature feature;
|
|
|
|
// Comma separate tables or preferences.
|
|
readonly attribute ACString list;
|
|
};
|
|
|
|
/**
|
|
* Callback function for nsIURIClassifier lookups.
|
|
* See asyncClassifyLocalWithFeatures() in nsIURIClassifier.idl.
|
|
*/
|
|
[scriptable, function, uuid(2ea83c26-dfc9-44ed-9cfc-171d4753d78e)]
|
|
interface nsIUrlClassifierFeatureCallback : 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 aResults
|
|
* List of nsIUrlClassifierFeatureResult objects.
|
|
*/
|
|
void onClassifyComplete(in Array<nsIUrlClassifierFeatureResult> aResults);
|
|
};
|