зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1558735 part 2. Stop using [array] in nsIX509Cert.getEmailAddresses. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D34671 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d40a269ffc
Коммит
7add525d55
|
@ -187,7 +187,7 @@ NSSDialogs.prototype = {
|
|||
detailLines.push(this.formatString("clientAuthAsk.keyUsages",
|
||||
[keyUsages]));
|
||||
}
|
||||
let emailAddresses = cert.getEmailAddresses({});
|
||||
let emailAddresses = cert.getEmailAddresses();
|
||||
if (emailAddresses.length > 0) {
|
||||
let joinedAddresses = emailAddresses.join(", ");
|
||||
detailLines.push(this.formatString("clientAuthAsk.emailAddresses",
|
||||
|
|
|
@ -121,7 +121,7 @@ function setDetails() {
|
|||
detailLines.push(bundle.getFormattedString("clientAuthKeyUsages",
|
||||
[keyUsages]));
|
||||
}
|
||||
let emailAddresses = cert.getEmailAddresses({});
|
||||
let emailAddresses = cert.getEmailAddresses();
|
||||
if (emailAddresses.length > 0) {
|
||||
let joinedAddresses = emailAddresses.join(", ");
|
||||
detailLines.push(bundle.getFormattedString("clientAuthEmailAddresses",
|
||||
|
|
|
@ -43,12 +43,10 @@ interface nsIX509Cert : nsISupports {
|
|||
* Obtain a list of all email addresses
|
||||
* contained in the certificate.
|
||||
*
|
||||
* @param length The number of strings in the returned array.
|
||||
* @return An array of email addresses.
|
||||
*/
|
||||
[must_use]
|
||||
void getEmailAddresses(out unsigned long length,
|
||||
[retval, array, size_is(length)] out wstring addresses);
|
||||
Array<AString> getEmailAddresses();
|
||||
|
||||
/**
|
||||
* Check whether a given address is contained in the certificate.
|
||||
|
|
|
@ -395,24 +395,18 @@ nsNSSCertificate::GetEmailAddress(nsAString& aEmailAddress) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNSSCertificate::GetEmailAddresses(uint32_t* aLength, char16_t*** aAddresses) {
|
||||
NS_ENSURE_ARG(aLength);
|
||||
NS_ENSURE_ARG(aAddresses);
|
||||
|
||||
*aLength = 0;
|
||||
|
||||
nsNSSCertificate::GetEmailAddresses(nsTArray<nsString>& aAddresses) {
|
||||
uint32_t length = 0;
|
||||
for (const char* aAddr = CERT_GetFirstEmailAddress(mCert.get()); aAddr;
|
||||
aAddr = CERT_GetNextEmailAddress(mCert.get(), aAddr)) {
|
||||
++(*aLength);
|
||||
++(length);
|
||||
}
|
||||
|
||||
*aAddresses = (char16_t**)moz_xmalloc(sizeof(char16_t*) * (*aLength));
|
||||
aAddresses.SetCapacity(length);
|
||||
|
||||
uint32_t iAddr = 0;
|
||||
for (const char* aAddr = CERT_GetFirstEmailAddress(mCert.get()); aAddr;
|
||||
aAddr = CERT_GetNextEmailAddress(mCert.get(), aAddr)) {
|
||||
(*aAddresses)[iAddr] = ToNewUnicode(nsDependentCString(aAddr));
|
||||
iAddr++;
|
||||
CopyASCIItoUTF16(MakeStringSpan(aAddr), *aAddresses.AppendElement());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -101,7 +101,7 @@ function testUTF8InField(field, replacementPrefix, certificateBytesToAlter) {
|
|||
notEqual(cert[field], null, `accessing nsIX509Cert.${field} shouldn't fail`);
|
||||
notEqual(cert.ASN1Structure, null,
|
||||
"accessing nsIX509Cert.ASN1Structure shouldn't assert");
|
||||
notEqual(cert.getEmailAddresses({}), null,
|
||||
notEqual(cert.getEmailAddresses(), null,
|
||||
"calling nsIX509Cert.getEmailAddresses() shouldn't assert");
|
||||
ok(!cert.containsEmailAddress("test@test.test"),
|
||||
"calling nsIX509Cert.containsEmailAddress() shouldn't assert");
|
||||
|
|
Загрузка…
Ссылка в новой задаче