Added more code to ShouldAddToGlobalHistory to properly weed out items such as "about", "imap", "news", and "mailbox" schemes from getting put into global history.

This commit is contained in:
tbogard%aol.net 2000-04-17 05:54:09 +00:00
Родитель 6cd8433000
Коммит 2440048faf
1 изменённых файлов: 20 добавлений и 2 удалений

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

@ -2742,13 +2742,31 @@ NS_IMETHODIMP nsDocShell::EnsureGlobalHistory()
NS_IMETHODIMP nsDocShell::ShouldAddToGlobalHistory(nsIURI* aURI,
PRBool* aShouldAdd)
{
if(typeContent == mItemType)
*aShouldAdd = PR_FALSE;
if(!aURI || (typeContent != mItemType))
return NS_OK;
nsXPIDLCString scheme;
NS_ENSURE_SUCCESS(aURI->GetScheme(getter_Copies(scheme)), NS_ERROR_FAILURE);
nsAutoString schemeStr(scheme);
// The model is really if we don't know differently then add which basically
// means we are suppose to try all the things we know not to allow in and
// then if we don't bail go on and allow it in. But here lets compare
// against the most common case we know to allow in and go on and say yes
// to it.
if(schemeStr.Equals("http") || schemeStr.Equals("https"))
{
*aShouldAdd = PR_TRUE;
return NS_OK;
}
*aShouldAdd = PR_FALSE;
if(schemeStr.Equals("about") || schemeStr.Equals("imap") ||
schemeStr.Equals("news") || schemeStr.Equals("mailbox"))
return NS_OK;
*aShouldAdd = PR_TRUE;
return NS_OK;
}