Bug 322106: Subframe and redirected URLs stay "hidden" permanently in history. r=cbiesinger, sr=neil

This commit is contained in:
ajschult%verizon.net 2006-02-05 16:13:49 +00:00
Родитель 4cc8a7950f
Коммит 9a41e832ee
1 изменённых файлов: 18 добавлений и 18 удалений

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

@ -614,11 +614,26 @@ nsGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aTopLevel, nsIURI
rv = gRDFService->GetDateLiteral(now, getter_AddRefs(date));
if (NS_FAILED(rv)) return rv;
PRBool isJavascript;
rv = aURI->SchemeIs("javascript", &isJavascript);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIMdbRow> row;
rv = FindRow(kToken_URLColumn, URISpec.get(), getter_AddRefs(row));
if (NS_SUCCEEDED(rv)) {
// If this is not a JS url, not a redirected URI and not in a frame,
// unhide it since URIs are added hidden if they are redirected, in a
// frame or typed.
PRBool wasTyped = HasCell(mEnv, row, kToken_TypedColumn);
if (wasTyped) {
mTypedHiddenURIs.Remove(URISpec);
}
if ((!isJavascript && !aRedirect && aTopLevel) || wasTyped) {
row->CutColumn(mEnv, kToken_HiddenColumn);
}
// update the database, and get the old info back
PRTime oldDate;
PRInt32 oldCount;
@ -655,16 +670,12 @@ nsGlobalHistory::AddURI(nsIURI *aURI, PRBool aRedirect, PRBool aTopLevel, nsIURI
NS_ASSERTION(NS_SUCCEEDED(rv), "AddNewPageToDatabase failed; see bug 88961");
if (NS_FAILED(rv)) return rv;
PRBool isJavascript;
rv = aURI->SchemeIs("javascript", &isJavascript);
NS_ENSURE_SUCCESS(rv, rv);
if (isJavascript || aRedirect || !aTopLevel) {
// if this is a JS url, or a redirected URI or in a frame, hide it in
// global history so that it doesn't show up in the autocomplete
// dropdown. AddExistingPageToDatabase has logic to override this
// behavior for URIs which were typed. See bug 197127 and bug 161531
// for details.
// dropdown. We'll unhide non-JS urls later if we visit the URI not as
// part of a redirect and not in a frame. See bug 197127, bug 161531 and
// bug 322106 for details.
rv = SetRowValue(row, kToken_HiddenColumn, 1);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -714,17 +725,6 @@ nsGlobalHistory::AddExistingPageToDatabase(nsIMdbRow *row,
nsresult rv;
nsCAutoString oldReferrer;
// if the page was typed, unhide it now because it's
// known to be valid
if (HasCell(mEnv, row, kToken_TypedColumn)) {
nsCAutoString URISpec;
rv = GetRowValue(row, kToken_URLColumn, URISpec);
NS_ENSURE_SUCCESS(rv, rv);
mTypedHiddenURIs.Remove(URISpec);
row->CutColumn(mEnv, kToken_HiddenColumn);
}
// Update last visit date.
// First get the old date so we can update observers...
rv = GetRowValue(row, kToken_LastVisitDateColumn, aOldDate);