Bug 1291700 - Allow negotiate/ntml to work when in the 'Never remember history' mode. r=jduell

--HG--
extra : rebase_source : 179a11fa222061f4c1c1cc2c1485ca49ca226d29
This commit is contained in:
Honza Bambas 2016-08-16 06:24:00 -04:00
Родитель 9f35496517
Коммит d90344d529
2 изменённых файлов: 34 добавлений и 4 удалений

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

@ -65,7 +65,27 @@ TestNotInPBMode(nsIHttpAuthenticableChannel *authChannel)
{
nsCOMPtr<nsIChannel> bareChannel = do_QueryInterface(authChannel);
MOZ_ASSERT(bareChannel);
return !NS_UsePrivateBrowsing(bareChannel);
if (!NS_UsePrivateBrowsing(bareChannel)) {
return true;
}
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs) {
return true;
}
// When the "Never remember history" option is set, all channels are
// set PB mode flag, but here we want to make an exception, users
// want their credentials go out.
bool dontRememberHistory;
if (NS_SUCCEEDED(prefs->GetBoolPref("browser.privatebrowsing.autostart",
&dontRememberHistory)) &&
dontRememberHistory) {
return true;
}
return false;
}
NS_IMETHODIMP

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

@ -187,17 +187,27 @@ static bool
CanUseDefaultCredentials(nsIHttpAuthenticableChannel *channel,
bool isProxyAuth)
{
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
// Prevent using default credentials for authentication when we are in the
// private browsing mode. It would cause a privacy data leak.
nsCOMPtr<nsIChannel> bareChannel = do_QueryInterface(channel);
MOZ_ASSERT(bareChannel);
if (NS_UsePrivateBrowsing(bareChannel)) {
return false;
// But allow when in the "Never remember history" mode.
bool dontRememberHistory;
if (prefs &&
NS_SUCCEEDED(prefs->GetBoolPref("browser.privatebrowsing.autostart",
&dontRememberHistory)) &&
!dontRememberHistory) {
return false;
}
}
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
if (!prefs) {
return false;
}
if (isProxyAuth) {
bool val;