author | Serge Gautherie <sgautherie.bz@free.fr> |
Thu, 14 Apr 2011 17:25:00 +0200 | |
changeset 68362 | b79af914191dc0551135186aea549b2ac2ef4450 |
parent 68361 | d40935669248dc6eb6f1001b3534c8dd3430fbcd |
child 68363 | 3afa19c50a85cd6056bfdb640277c636346dabe8 |
push id | 76 |
push user | bzbarsky@mozilla.com |
push date | Tue, 05 Jul 2011 17:00:57 +0000 |
treeherder | mozilla-beta@d3a2732c35f1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 228448 |
milestone | 6.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/extensions/cookie/nsCookiePromptService.cpp +++ b/extensions/cookie/nsCookiePromptService.cpp @@ -67,22 +67,20 @@ nsCookiePromptService::CookieDialog(nsID PRBool *aRememberDecision, PRInt32 *aAccept) { nsresult rv; nsCOMPtr<nsIDialogParamBlock> block = do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID,&rv); if (NS_FAILED(rv)) return rv; - // since we're setting PRInt32's here, we have to sanitize the PRBool's first. - // (myBool != PR_FALSE) is guaranteed to return either 1 or 0. block->SetInt(nsICookieAcceptDialog::ACCEPT_COOKIE, 1); block->SetString(nsICookieAcceptDialog::HOSTNAME, NS_ConvertUTF8toUTF16(aHostname).get()); block->SetInt(nsICookieAcceptDialog::COOKIESFROMHOST, aCookiesFromHost); - block->SetInt(nsICookieAcceptDialog::CHANGINGCOOKIE, aChangingCookie != PR_FALSE); + block->SetInt(nsICookieAcceptDialog::CHANGINGCOOKIE, aChangingCookie ? 1 : 0); nsCOMPtr<nsIMutableArray> objects = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; rv = objects->AppendElement(aCookie, PR_FALSE); if (NS_FAILED(rv)) return rv;
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp +++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp @@ -239,17 +239,16 @@ NS_IMETHODIMP nsAutoConfig::Observe(nsIS return rv; } nsresult nsAutoConfig::downloadAutoConfig() { nsresult rv; nsCAutoString emailAddr; nsXPIDLCString urlName; - PRBool appendMail = PR_FALSE, offline = PR_FALSE; static PRBool firstTime = PR_TRUE; if (mConfigURL.IsEmpty()) { PR_LOG(MCD, PR_LOG_DEBUG, ("global config url is empty - did you set autoadmin.global_config_url?\n")); NS_WARNING("AutoConfig called without global_config_url"); return NS_OK; } @@ -262,61 +261,55 @@ nsresult nsAutoConfig::downloadAutoConfi mConfigURL.Truncate(index); // Clean up the previous read, the new read is going to use the same buffer if (!mBuf.IsEmpty()) mBuf.Truncate(0); // Get the preferences branch and save it to the member variable if (!mPrefBranch) { - nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; rv = prefs->GetBranch(nsnull,getter_AddRefs(mPrefBranch)); if (NS_FAILED(rv)) return rv; } // Check to see if the network is online/offline nsCOMPtr<nsIIOService> ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; + PRBool offline; rv = ios->GetOffline(&offline); if (NS_FAILED(rv)) return rv; if (offline) { - - PRBool offlineFailover = PR_FALSE; + PRBool offlineFailover; rv = mPrefBranch->GetBoolPref("autoadmin.offline_failover", &offlineFailover); - // Read the failover.jsc if the network is offline and the pref says so - if (offlineFailover) { + if (NS_SUCCEEDED(rv) && offlineFailover) return readOfflineFile(); - } } - /* Append user's identity at the end of the URL if the pref says so. First we are checking for the user's email address but if it is not available in the case where the client is used without messenger, user's profile name will be used as an unique identifier */ - + PRBool appendMail; rv = mPrefBranch->GetBoolPref("autoadmin.append_emailaddr", &appendMail); - if (NS_SUCCEEDED(rv) && appendMail) { rv = getEmailAddr(emailAddr); if (NS_SUCCEEDED(rv) && emailAddr.get()) { - /* Adding the unique identifier at the end of autoconfig URL. In this case the autoconfig URL is a script and emailAddr as passed as an argument */ mConfigURL.Append("?"); mConfigURL.Append(emailAddr); } } @@ -333,29 +326,27 @@ nsresult nsAutoConfig::downloadAutoConfi } PR_LOG(MCD, PR_LOG_DEBUG, ("running MCD url %s\n", mConfigURL.get())); // open a channel for the url rv = NS_NewChannel(getter_AddRefs(channel),url, nsnull, nsnull, nsnull, nsIRequest::INHIBIT_PERSISTENT_CACHING | nsIRequest::LOAD_BYPASS_CACHE); if (NS_FAILED(rv)) return rv; - rv = channel->AsyncOpen(this, nsnull); if (NS_FAILED(rv)) { readOfflineFile(); return rv; } // Set a repeating timer if the pref is set. // This is to be done only once. // Also We are having the event queue processing only for the startup // It is not needed with the repeating timer. if (firstTime) { - firstTime = PR_FALSE; // Getting the current thread. If we start an AsyncOpen, the thread // needs to wait before the reading of autoconfig is done nsCOMPtr<nsIThread> thread = do_GetCurrentThread(); NS_ENSURE_STATE(thread); @@ -365,78 +356,74 @@ nsresult nsAutoConfig::downloadAutoConfi onStopRequest or readOfflineFile methods There is a possibility of deadlock so we need to make sure that mLoaded will be set to true in any case (success/failure) */ while (!mLoaded) NS_ENSURE_STATE(NS_ProcessNextEvent(thread)); - PRInt32 minutes = 0; + PRInt32 minutes; rv = mPrefBranch->GetIntPref("autoadmin.refresh_interval", &minutes); if (NS_SUCCEEDED(rv) && minutes > 0) { - // Create a new timer and pass this nsAutoConfig // object as a timer callback. mTimer = do_CreateInstance("@mozilla.org/timer;1",&rv); if (NS_FAILED(rv)) return rv; rv = mTimer->InitWithCallback(this, minutes * 60 * 1000, nsITimer::TYPE_REPEATING_SLACK); if (NS_FAILED(rv)) return rv; } - } //first_time return NS_OK; - } // nsPref::downloadAutoConfig() nsresult nsAutoConfig::readOfflineFile() { - PRBool failCache = PR_TRUE; nsresult rv; - PRBool offline; /* Releasing the lock to allow main thread to start execution. At this point we do not need to stall the thread since all network activities are done. */ mLoaded = PR_TRUE; + PRBool failCache; rv = mPrefBranch->GetBoolPref("autoadmin.failover_to_cached", &failCache); - - if (failCache == PR_FALSE) { - + if (NS_SUCCEEDED(rv) && !failCache) { // disable network connections and return. nsCOMPtr<nsIIOService> ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); if (NS_FAILED(rv)) return rv; + PRBool offline; rv = ios->GetOffline(&offline); if (NS_FAILED(rv)) return rv; if (!offline) { rv = ios->SetOffline(PR_TRUE); if (NS_FAILED(rv)) return rv; } // lock the "network.online" prference so user cannot toggle back to // online mode. rv = mPrefBranch->SetBoolPref("network.online", PR_FALSE); if (NS_FAILED(rv)) return rv; + mPrefBranch->LockPref("network.online"); return NS_OK; } /* faiover_to_cached is set to true so Open the file and read the content. execute the javascript file */ @@ -513,17 +500,16 @@ nsresult nsAutoConfig::getEmailAddr(nsAC First getting a default account with "mail.accountmanager.defaultaccount" second getting an associated id with the default account Third getting an email address with id */ rv = mPrefBranch->GetCharPref("mail.accountmanager.defaultaccount", getter_Copies(prefValue)); - if (NS_SUCCEEDED(rv) && !prefValue.IsEmpty()) { emailAddr = NS_LITERAL_CSTRING("mail.account.") + prefValue + NS_LITERAL_CSTRING(".identities"); rv = mPrefBranch->GetCharPref(PromiseFlatCString(emailAddr).get(), getter_Copies(prefValue)); if (NS_FAILED(rv) || prefValue.IsEmpty()) return PromptForEMailAddress(emailAddr); PRInt32 commandIndex = prefValue.FindChar(','); @@ -575,9 +561,8 @@ nsresult nsAutoConfig::PromptForEMailAdd PRBool success; rv = promptService->Prompt(nsnull, title.get(), err.get(), getter_Copies(emailResult), nsnull, &check, &success); if (!success) return NS_ERROR_FAILURE; NS_ENSURE_SUCCESS(rv, rv); LossyCopyUTF16toASCII(emailResult, emailAddress); return NS_OK; } -
--- a/extensions/pref/system-pref/src/nsSystemPref.cpp +++ b/extensions/pref/system-pref/src/nsSystemPref.cpp @@ -205,17 +205,17 @@ nsSystemPref::Observe(nsISupports *aSubj rv = UseMozillaPrefs(); } } // if the system pref notify us that some pref has been changed by user // outside mozilla. We need to read it again. else if (!nsCRT::strcmp(aTopic, NS_SYSTEMPREF_PREFCHANGE_TOPIC_ID) && aData) { - NS_ASSERTION(mEnabled == PR_TRUE, "Should not listen when disabled"); + NS_ASSERTION(mEnabled, "Should not listen when disabled"); SYSPREF_LOG(("====== System Pref Notify topic=%s data=%s\n", aTopic, (char*)aData)); rv = ReadSystemPref(NS_LossyConvertUTF16toASCII(aData).get()); return NS_OK; } else if (!nsCRT::strcmp(aTopic,"profile-before-change")) { //roll back to mozilla prefs if (mEnabled) UseMozillaPrefs();