Bug 331522. By default, do not allow keyword searches when navigating to URLs; modify browser UI code to enable keyword searches only on selected URL input mechanisms (e.g., typed into the URL bar). r+sr=darin,r=mconnor

git-svn-id: svn://10.0.0.236/trunk@193458 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2006-04-03 23:17:51 +00:00
parent 75a4bcdd89
commit e9fd34c810
15 changed files with 107 additions and 58 deletions

View File

@@ -259,6 +259,7 @@ nsDocShell::nsDocShell():
mUseErrorPages(PR_FALSE),
mObserveErrorPages(PR_TRUE),
mAllowAuth(PR_TRUE),
mAllowKeywordFixup(PR_FALSE),
mFiredUnloadEvent(PR_FALSE),
mEODForCurrentDocument(PR_FALSE),
mURIResultedInDocument(PR_FALSE),
@@ -801,6 +802,9 @@ nsDocShell::LoadURI(nsIURI * aURI,
if (!sendReferrer)
flags |= INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER;
if (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP)
flags |= INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
rv = InternalLoad(aURI,
referrer,
@@ -828,6 +832,8 @@ nsDocShell::LoadStream(nsIInputStream *aStream, nsIURI * aURI,
{
NS_ENSURE_ARG(aStream);
mAllowKeywordFixup = PR_FALSE;
// if the caller doesn't pass in a URI we need to create a dummy URI. necko
// currently requires a URI in various places during the load. Some consumers
// do as well.
@@ -2793,8 +2799,11 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
rv = NS_NewURI(getter_AddRefs(uri), uriString);
} else {
// Call the fixup object
rv = sURIFixup->CreateFixupURI(NS_ConvertUTF16toUTF8(aURI),
nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP,
PRUint32 fixupFlags = 0;
if (aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) {
fixupFlags |= nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
}
rv = sURIFixup->CreateFixupURI(NS_ConvertUTF16toUTF8(aURI), fixupFlags,
getter_AddRefs(uri));
}
@@ -2815,8 +2824,9 @@ nsDocShell::LoadURI(const PRUnichar * aURI,
loadInfo->SetReferrer(aReferringURI);
loadInfo->SetHeadersStream(aHeaderStream);
rv = LoadURI(uri, loadInfo, 0, PR_TRUE);
rv = LoadURI(uri, loadInfo,
aLoadFlags & LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP, PR_TRUE);
return rv;
}
@@ -6361,6 +6371,8 @@ nsDocShell::InternalLoad(nsIURI * aURI,
return rv;
}
mAllowKeywordFixup =
(aFlags & INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP) != 0;
mURIResultedInDocument = PR_FALSE; // reset the clock...
//