gecko-dev/security/manager/ssl/nsIClientAuthDialogs.idl

49 строки
1.8 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"
interface nsIArray;
interface nsIInterfaceRequestor;
/**
* Provides UI for SSL client-auth dialogs.
*/
[scriptable, uuid(fa4c7520-1433-11d5-ba24-00108303b117)]
interface nsIClientAuthDialogs : nsISupports
{
/**
Bug 307081 - Clean up nsIClientAuthDialogs.idl and implementations. r=kats,keeler This fixes the following in the IDL: 1. Misleading or unclear parameter names in the IDL. |cn| in practice is the concatenation of the CN of the server cert and the port of the server, and |issuer| is the Organization of the issuer cert of the server cert. 2. Use of the |wstring| type. |AString| is generally preferred, and has the benefit of letting implementations skip null checks due to the use of references. 3. Using an explicit |canceled| outparam instead of just setting a return type. There is no need for the outparam if the return type can be used. 4. Using |long| (int32_t) for |selectedIndex|. |unsigned long| (uint32_t) is more logical, and paves the way for future changes. This fixes the following in the Android implementation: 1. Lack of checks to ensure the QueryInterface() call succeeded. In practice, the call will always succeed, but it's good practice to check anyways. 2. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. This fixes the following in the desktop implementation: 1. Lack of null pointer checking. 2. Trying to get a parent window ref off a context that doesn't actually support doing so. 3. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. 4. Abusal of the CAPS bundle. 5. Unnecessary variables. 6. Variables declared far away from where they are used. 7. Variable shadowing. 8. Style issues. 9. Lack of documentation. This also fixes the following: 1. Lack of localisation notes. MozReview-Commit-ID: FTc6XecJd6h --HG-- extra : transplant_source : %ABQ%8F%E6%A3%25%FE%94%E4%D6X%3D%28%2C%05%5E%FB%84.-
2016-06-24 10:12:11 +03:00
* Called when a user is asked to choose a certificate for client auth.
*
* @param ctx Context that allows at least nsIClientAuthUserDecision to be
* queried.
* @param hostname Hostname of the server.
* @param port Port of the server.
Bug 307081 - Clean up nsIClientAuthDialogs.idl and implementations. r=kats,keeler This fixes the following in the IDL: 1. Misleading or unclear parameter names in the IDL. |cn| in practice is the concatenation of the CN of the server cert and the port of the server, and |issuer| is the Organization of the issuer cert of the server cert. 2. Use of the |wstring| type. |AString| is generally preferred, and has the benefit of letting implementations skip null checks due to the use of references. 3. Using an explicit |canceled| outparam instead of just setting a return type. There is no need for the outparam if the return type can be used. 4. Using |long| (int32_t) for |selectedIndex|. |unsigned long| (uint32_t) is more logical, and paves the way for future changes. This fixes the following in the Android implementation: 1. Lack of checks to ensure the QueryInterface() call succeeded. In practice, the call will always succeed, but it's good practice to check anyways. 2. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. This fixes the following in the desktop implementation: 1. Lack of null pointer checking. 2. Trying to get a parent window ref off a context that doesn't actually support doing so. 3. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. 4. Abusal of the CAPS bundle. 5. Unnecessary variables. 6. Variables declared far away from where they are used. 7. Variable shadowing. 8. Style issues. 9. Lack of documentation. This also fixes the following: 1. Lack of localisation notes. MozReview-Commit-ID: FTc6XecJd6h --HG-- extra : transplant_source : %ABQ%8F%E6%A3%25%FE%94%E4%D6X%3D%28%2C%05%5E%FB%84.-
2016-06-24 10:12:11 +03:00
* @param organization Organization field of the server cert.
* @param issuerOrg Organization field of the issuer cert of the server cert.
* @param certList List of certificates the user can choose from.
* @param selectedIndex Index of the cert in |certList| that the user chose.
* Ignored if the return value is false.
Bug 307081 - Clean up nsIClientAuthDialogs.idl and implementations. r=kats,keeler This fixes the following in the IDL: 1. Misleading or unclear parameter names in the IDL. |cn| in practice is the concatenation of the CN of the server cert and the port of the server, and |issuer| is the Organization of the issuer cert of the server cert. 2. Use of the |wstring| type. |AString| is generally preferred, and has the benefit of letting implementations skip null checks due to the use of references. 3. Using an explicit |canceled| outparam instead of just setting a return type. There is no need for the outparam if the return type can be used. 4. Using |long| (int32_t) for |selectedIndex|. |unsigned long| (uint32_t) is more logical, and paves the way for future changes. This fixes the following in the Android implementation: 1. Lack of checks to ensure the QueryInterface() call succeeded. In practice, the call will always succeed, but it's good practice to check anyways. 2. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. This fixes the following in the desktop implementation: 1. Lack of null pointer checking. 2. Trying to get a parent window ref off a context that doesn't actually support doing so. 3. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. 4. Abusal of the CAPS bundle. 5. Unnecessary variables. 6. Variables declared far away from where they are used. 7. Variable shadowing. 8. Style issues. 9. Lack of documentation. This also fixes the following: 1. Lack of localisation notes. MozReview-Commit-ID: FTc6XecJd6h --HG-- extra : transplant_source : %ABQ%8F%E6%A3%25%FE%94%E4%D6X%3D%28%2C%05%5E%FB%84.-
2016-06-24 10:12:11 +03:00
* @return true if a certificate was chosen. false if the user canceled.
*/
[must_use]
Bug 307081 - Clean up nsIClientAuthDialogs.idl and implementations. r=kats,keeler This fixes the following in the IDL: 1. Misleading or unclear parameter names in the IDL. |cn| in practice is the concatenation of the CN of the server cert and the port of the server, and |issuer| is the Organization of the issuer cert of the server cert. 2. Use of the |wstring| type. |AString| is generally preferred, and has the benefit of letting implementations skip null checks due to the use of references. 3. Using an explicit |canceled| outparam instead of just setting a return type. There is no need for the outparam if the return type can be used. 4. Using |long| (int32_t) for |selectedIndex|. |unsigned long| (uint32_t) is more logical, and paves the way for future changes. This fixes the following in the Android implementation: 1. Lack of checks to ensure the QueryInterface() call succeeded. In practice, the call will always succeed, but it's good practice to check anyways. 2. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. This fixes the following in the desktop implementation: 1. Lack of null pointer checking. 2. Trying to get a parent window ref off a context that doesn't actually support doing so. 3. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. 4. Abusal of the CAPS bundle. 5. Unnecessary variables. 6. Variables declared far away from where they are used. 7. Variable shadowing. 8. Style issues. 9. Lack of documentation. This also fixes the following: 1. Lack of localisation notes. MozReview-Commit-ID: FTc6XecJd6h --HG-- extra : transplant_source : %ABQ%8F%E6%A3%25%FE%94%E4%D6X%3D%28%2C%05%5E%FB%84.-
2016-06-24 10:12:11 +03:00
boolean chooseCertificate(in nsIInterfaceRequestor ctx,
in AUTF8String hostname,
in long port,
in AUTF8String organization,
in AUTF8String issuerOrg,
in nsIArray certList,
Bug 307081 - Clean up nsIClientAuthDialogs.idl and implementations. r=kats,keeler This fixes the following in the IDL: 1. Misleading or unclear parameter names in the IDL. |cn| in practice is the concatenation of the CN of the server cert and the port of the server, and |issuer| is the Organization of the issuer cert of the server cert. 2. Use of the |wstring| type. |AString| is generally preferred, and has the benefit of letting implementations skip null checks due to the use of references. 3. Using an explicit |canceled| outparam instead of just setting a return type. There is no need for the outparam if the return type can be used. 4. Using |long| (int32_t) for |selectedIndex|. |unsigned long| (uint32_t) is more logical, and paves the way for future changes. This fixes the following in the Android implementation: 1. Lack of checks to ensure the QueryInterface() call succeeded. In practice, the call will always succeed, but it's good practice to check anyways. 2. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. This fixes the following in the desktop implementation: 1. Lack of null pointer checking. 2. Trying to get a parent window ref off a context that doesn't actually support doing so. 3. Setting a variable to an nsIPrefService instance initially, then later setting it to a pref branch instance later on. This is confusing and unnecessary. 4. Abusal of the CAPS bundle. 5. Unnecessary variables. 6. Variables declared far away from where they are used. 7. Variable shadowing. 8. Style issues. 9. Lack of documentation. This also fixes the following: 1. Lack of localisation notes. MozReview-Commit-ID: FTc6XecJd6h --HG-- extra : transplant_source : %ABQ%8F%E6%A3%25%FE%94%E4%D6X%3D%28%2C%05%5E%FB%84.-
2016-06-24 10:12:11 +03:00
out unsigned long selectedIndex);
};
[scriptable, uuid(95c4373e-bdd4-4a63-b431-f5b000367721)]
interface nsIClientAuthUserDecision : nsISupports
{
attribute boolean rememberClientAuthCertificate;
};
%{C++
#define NS_CLIENTAUTHDIALOGS_CONTRACTID "@mozilla.org/nsClientAuthDialogs;1"
%}