зеркало из https://github.com/mozilla/pjs.git
Fix pref observer usage so that nsFormHistory notices when the user has turned off form autofill (bug 254485). r=ben.
This commit is contained in:
Родитель
ea2f3df3b9
Коммит
be6b93ebc9
|
@ -143,12 +143,15 @@ nsFormHistory::FormHistoryEnabled()
|
|||
{
|
||||
if (!gPrefsInitialized) {
|
||||
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
nsCOMPtr<nsIPrefBranch> branch;
|
||||
prefService->GetBranch(PREF_FORMFILL_BRANCH, getter_AddRefs(branch));
|
||||
branch->GetBoolPref(PREF_FORMFILL_ENABLE, &gFormHistoryEnabled);
|
||||
|
||||
nsCOMPtr<nsIPrefBranchInternal> branchInternal = do_QueryInterface(branch);
|
||||
branchInternal->AddObserver(PREF_FORMFILL_BRANCH, gFormHistory, PR_TRUE);
|
||||
prefService->GetBranch(PREF_FORMFILL_BRANCH,
|
||||
getter_AddRefs(gFormHistory->mPrefBranch));
|
||||
gFormHistory->mPrefBranch->GetBoolPref(PREF_FORMFILL_ENABLE,
|
||||
&gFormHistoryEnabled);
|
||||
|
||||
nsCOMPtr<nsIPrefBranchInternal> branchInternal =
|
||||
do_QueryInterface(gFormHistory->mPrefBranch);
|
||||
branchInternal->AddObserver(PREF_FORMFILL_ENABLE, gFormHistory, PR_TRUE);
|
||||
|
||||
gPrefsInitialized = PR_TRUE;
|
||||
}
|
||||
|
@ -338,8 +341,7 @@ NS_IMETHODIMP
|
|||
nsFormHistory::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
|
||||
{
|
||||
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
|
||||
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(aSubject);
|
||||
branch->GetBoolPref(PREF_FORMFILL_ENABLE, &gFormHistoryEnabled);
|
||||
mPrefBranch->GetBoolPref(PREF_FORMFILL_ENABLE, &gFormHistoryEnabled);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "mdb.h"
|
||||
|
||||
|
@ -101,6 +102,7 @@ protected:
|
|||
static PRBool gPrefsInitialized;
|
||||
|
||||
nsCOMPtr<nsIMdbFactory> mMdbFactory;
|
||||
nsCOMPtr<nsIPrefBranch> mPrefBranch;
|
||||
nsIMdbEnv* mEnv;
|
||||
nsIMdbStore* mStore;
|
||||
nsIMdbTable* mTable;
|
||||
|
|
Загрузка…
Ссылка в новой задаче