netwerk/base/nsIURIClassifier.idl
author Fred Lin <gasolin@mozilla.com>
Mon, 19 Sep 2016 15:03:46 +0800
changeset 355684 8038403f9988bebba634447c8ba729e18f6eed0a
parent 288532 c58b7d331f5bc5b24bd1b0201e24c6adf6aed27e
child 369762 673b0b18d59905255e71556655a6878e105b0d17
permissions -rw-r--r--
Bug 1295151 - Install add-on should not show as a permission in the control center. r=MattN, a=ritu MozReview-Commit-ID: ChkG0AU743W

/* 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"

interface nsIChannel;
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.
   */
  void onClassifyComplete(in nsresult aErrorCode);
};

/**
 * 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 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 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 a comma-separated string of tables that match.
   */
  ACString classifyLocalWithTables(in nsIURI aURI, in ACString aTables);
};