summaryrefslogtreecommitdiffstats
path: root/toolkit/components/downloads/nsIApplicationReputation.idl
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /toolkit/components/downloads/nsIApplicationReputation.idl
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/components/downloads/nsIApplicationReputation.idl')
-rw-r--r--toolkit/components/downloads/nsIApplicationReputation.idl122
1 files changed, 122 insertions, 0 deletions
diff --git a/toolkit/components/downloads/nsIApplicationReputation.idl b/toolkit/components/downloads/nsIApplicationReputation.idl
new file mode 100644
index 000000000..3250cbb75
--- /dev/null
+++ b/toolkit/components/downloads/nsIApplicationReputation.idl
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* 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 nsIApplicationReputationCallback;
+interface nsIApplicationReputationQuery;
+interface nsIArray;
+interface nsIURI;
+
+/*
+ * A service for asynchronously querying an application reputation service
+ * based on metadata of the downloaded file.
+ */
+[scriptable, uuid(c9f03479-fd68-4393-acb2-c88d4f563174)]
+interface nsIApplicationReputationService : nsISupports {
+ /**
+ * Indicates the reason for the application reputation block.
+ */
+ const unsigned long VERDICT_SAFE = 0;
+ const unsigned long VERDICT_DANGEROUS = 1;
+ const unsigned long VERDICT_UNCOMMON = 2;
+ const unsigned long VERDICT_POTENTIALLY_UNWANTED = 3;
+ const unsigned long VERDICT_DANGEROUS_HOST = 4;
+
+ /**
+ * Start querying the application reputation service.
+ *
+ * @param aQuery
+ * The nsIApplicationReputationQuery containing metadata of the
+ * downloaded file.
+ *
+ * @param aCallback
+ * The callback for receiving the results of the query.
+ *
+ * @remarks aCallback may not be null. onComplete is guaranteed to be called
+ * on aCallback. This function may not be called more than once with
+ * the same query object. If any of the attributes of aQuery have
+ * not been set or have been set with empty data (with the exception
+ * of sourceURI), then a valid request can still be constructed and
+ * will solicit a valid response, but won't produce any useful
+ * information.
+ */
+ void queryReputation(in nsIApplicationReputationQuery aQuery,
+ in nsIApplicationReputationCallback aCallback);
+};
+
+/**
+ * A single-use, write-once interface for recording the metadata of the
+ * downloaded file. nsIApplicationReputationService.Start() may only be called
+ * once with a single query.
+ */
+[scriptable, uuid(812d7509-a9a3-446e-a66f-3ed8cc91ebd0)]
+interface nsIApplicationReputationQuery : nsISupports {
+ /*
+ * The nsIURI from which the file was downloaded. This may not be null.
+ */
+ readonly attribute nsIURI sourceURI;
+
+ /*
+ * The reference, if any.
+ */
+ readonly attribute nsIURI referrerURI;
+
+ /*
+ * The target filename for the downloaded file, as inferred from the source
+ * URI or provided by the Content-Disposition attachment file name. If this
+ * is not set by the caller, it will be passed as an empty string but the
+ * query won't produce any useful information.
+ */
+ readonly attribute AString suggestedFileName;
+
+ /*
+ * The size of the downloaded file in bytes.
+ */
+ readonly attribute unsigned long fileSize;
+
+ /*
+ * The SHA256 hash of the downloaded file in raw bytes. If this is not set by
+ * the caller, it will be passed as an empty string but the query won't
+ * produce any useful information.
+ */
+ readonly attribute ACString sha256Hash;
+
+ /*
+ * The nsIArray of nsIX509CertList of nsIX509Cert that verify for this
+ * binary, if it is signed.
+ */
+ readonly attribute nsIArray signatureInfo;
+
+ /*
+ * The nsIArray of nsIPrincipal of redirects that lead to this download. The
+ * most recent redirect is the last element.
+ */
+ readonly attribute nsIArray redirects;
+};
+
+[scriptable, function, uuid(9a228470-cfe5-11e2-8b8b-0800200c9a66)]
+interface nsIApplicationReputationCallback : nsISupports {
+ /**
+ * Callback for the result of the application reputation query.
+ * @param aStatus
+ * NS_OK if and only if the query succeeded. If it did, then
+ * shouldBlock is meaningful (otherwise it defaults to false). This
+ * may be NS_ERROR_FAILURE if the response cannot be parsed, or
+ * NS_ERROR_NOT_AVAILABLE if the service has been disabled or is not
+ * reachable.
+ * @param aShouldBlock
+ * Whether or not the download should be blocked.
+ * @param aVerdict
+ * Indicates the result of the lookup that determines whether the
+ * download should be blocked, according to the "VERDICT_" constants.
+ * This may be set to a value different than "VERDICT_SAFE" even if
+ * aShouldBlock is false, so you should always check aShouldBlock.
+ */
+ void onComplete(in bool aShouldBlock,
+ in nsresult aStatus,
+ in unsigned long aVerdict);
+};