зеркало из https://github.com/mozilla/gecko-dev.git
bug 1424392 - remove unnecessary nsINSSComponent usage in nsNSSCallbacks r=mgoodwin
PK11PasswordPromptRunnable::RunOnTargetThread instantiates nsINSSComponent and calls GetPIPNSSBundleString/PIPBundleFormatStringFromName to get some localized strings. Since that runs on the main thread, we can call the helpers in nsNSSCertHelper instead. MozReview-Commit-ID: GsHoGDKBKdB --HG-- extra : rebase_source : 7c18498ad0d01ab01f6e7d8c3d2ccdb1d6e20734
This commit is contained in:
Родитель
42065fc66b
Коммит
95159e1851
|
@ -24,6 +24,7 @@
|
|||
#include "nsITokenDialogs.h"
|
||||
#include "nsIUploadChannel.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsNSSCertHelper.h"
|
||||
#include "nsNSSCertificate.h"
|
||||
#include "nsNSSComponent.h"
|
||||
#include "nsNSSIOLayer.h"
|
||||
|
@ -763,8 +764,6 @@ PK11PasswordPromptRunnable::~PK11PasswordPromptRunnable()
|
|||
void
|
||||
PK11PasswordPromptRunnable::RunOnTargetThread()
|
||||
{
|
||||
static NS_DEFINE_CID(kNSSComponentCID, NS_NSSCOMPONENT_CID);
|
||||
|
||||
nsNSSShutDownPreventionLock locker;
|
||||
if (isAlreadyShutDown()) {
|
||||
return;
|
||||
|
@ -791,24 +790,17 @@ PK11PasswordPromptRunnable::RunOnTargetThread()
|
|||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINSSComponent> nssComponent(do_GetService(kNSSComponentCID));
|
||||
if (!nssComponent) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoString promptString;
|
||||
if (PK11_IsInternal(mSlot)) {
|
||||
rv = nssComponent->GetPIPNSSBundleString("CertPassPromptDefault",
|
||||
promptString);
|
||||
rv = GetPIPNSSBundleString("CertPassPromptDefault", promptString);
|
||||
} else {
|
||||
NS_ConvertUTF8toUTF16 tokenName(PK11_GetTokenName(mSlot));
|
||||
const char16_t* formatStrings[] = {
|
||||
tokenName.get(),
|
||||
};
|
||||
rv = nssComponent->PIPBundleFormatStringFromName("CertPassPrompt",
|
||||
formatStrings,
|
||||
ArrayLength(formatStrings),
|
||||
promptString);
|
||||
rv = PIPBundleFormatStringFromName("CertPassPrompt", formatStrings,
|
||||
ArrayLength(formatStrings),
|
||||
promptString);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
|
|
|
@ -109,7 +109,7 @@ GetPIPNSSBundleString(const char* stringName, nsAString& result)
|
|||
return pipnssBundle->GetStringFromName(stringName, result);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
nsresult
|
||||
PIPBundleFormatStringFromName(const char* stringName, const char16_t** params,
|
||||
uint32_t numParams, nsAString& result)
|
||||
{
|
||||
|
|
|
@ -22,5 +22,8 @@ GetCertFingerprintByOidTag(CERTCertificate* nsscert, SECOidTag aOidTag,
|
|||
// Must be used on the main thread only.
|
||||
nsresult
|
||||
GetPIPNSSBundleString(const char* stringName, nsAString& result);
|
||||
nsresult
|
||||
PIPBundleFormatStringFromName(const char* stringName, const char16_t** params,
|
||||
uint32_t numParams, nsAString& result);
|
||||
|
||||
#endif // nsNSSCertHelper_h
|
||||
|
|
Загрузка…
Ссылка в новой задаче