Don't hold the pref service forever in a static nsCOMPtr. b=198895 r=peterlubczynski sr=bryner,alecf

This commit is contained in:
dbaron%dbaron.org 2003-03-25 14:55:35 +00:00
Родитель 03e008637d
Коммит 4f9693d38e
1 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -3658,13 +3658,15 @@ nsPluginTag::RegisterWithCategoryManager(PRBool aOverrideInternalTypes,
return;
// XXX temporary for testing transition
static nsCOMPtr<nsIPrefService> sPrefService;
static PRBool sLoadViaPlugin = PR_FALSE;
if (!sPrefService) {
sPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (sPrefService) {
static PRBool sLoadViaPluginInitialized = PR_FALSE;
if (!sLoadViaPluginInitialized) {
nsCOMPtr<nsIPrefService> prefService =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefService) {
sLoadViaPluginInitialized = PR_TRUE;
nsCOMPtr<nsIPrefBranch> prefBranch;
sPrefService->GetBranch(nsnull, getter_AddRefs(prefBranch));
prefService->GetBranch(nsnull, getter_AddRefs(prefBranch));
if (prefBranch)
prefBranch->GetBoolPref("plugin.disable_load_full_page_via_content", &sLoadViaPlugin);
}