mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 436925 - THREADSAFE nsCharsetConverterManager uses NS_CHARSETALIAS_CONTRACTID (nothreadsafe) from a random thread - triggered by Expired cert and nsDateTimeFormat, r=smontagu, sr=jst
This commit is contained in:
parent
0d45025b8a
commit
69848d6b7c
@ -52,6 +52,8 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsStringEnumerator.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
@ -370,6 +372,18 @@ nsCharsetConverterManager::GetCharsetAlias(const char * aCharset,
|
||||
if (!aCharset)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// We must not use the charset alias from a background thread
|
||||
if (!NS_IsMainThread()) {
|
||||
nsCOMPtr<nsICharsetConverterManager> self;
|
||||
nsresult rv =
|
||||
NS_GetProxyForObject(NS_PROXY_TO_MAIN_THREAD,
|
||||
NS_GET_IID(nsICharsetConverterManager),
|
||||
this, NS_PROXY_SYNC | NS_PROXY_ALWAYS,
|
||||
getter_AddRefs(self));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return self->GetCharsetAlias(aCharset, aResult);
|
||||
}
|
||||
|
||||
// We try to obtain the preferred name for this charset from the charset
|
||||
// aliases. If we don't get it from there, we just use the original string
|
||||
nsDependentCString charset(aCharset);
|
||||
|
Loading…
Reference in New Issue
Block a user