Bug 409836 - download link is not styled :visited when clicked. r=Mano, a=beltzner

This commit is contained in:
sdwilsh@shawnwilsher.com 2007-12-26 17:48:19 -08:00
parent a9b4d699f6
commit ef5983668a
2 changed files with 7 additions and 15 deletions

View File

@ -2029,9 +2029,10 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
// Normally docshell send the link visited observer notification for us (this
// will tell all the documents to update their visited link coloring).
// However, for redirects (since we implement nsIGlobalHistory3) this will
// not happen and we need to send it ourselves.
if (newItem && aIsRedirect) {
// However, for redirects (since we implement nsIGlobalHistory3) and downloads
// (since we implement nsIDownloadHistory) this will not happen and we need to
// send it ourselves.
if (newItem && (aIsRedirect || aTransitionType == TRANSITION_DOWNLOAD)) {
nsCOMPtr<nsIObserverService> obsService =
do_GetService("@mozilla.org/observer-service;1");
if (obsService)
@ -3507,19 +3508,9 @@ NS_IMETHODIMP
nsNavHistory::AddDownload(nsIURI* aSource, nsIURI* aReferrer,
PRTime aStartTime)
{
PRInt64 visitID, sessionID = 0;
// If we've already visited this page, we won't need to send a notification
// about having a new visited link. We do this because docshell doesn't mark
// downloads running through exthandler as visited, so we get to do it.
if (!FindLastVisit(aSource, &visitID, &sessionID)) {
nsCOMPtr<nsIObserverService> os =
do_GetService("@mozilla.org/observer-service;1");
if (os)
(void)os->NotifyObservers(aSource, NS_LINK_VISITED_EVENT_TOPIC, nsnull);
}
PRInt64 visitID;
return AddVisit(aSource, aStartTime, aReferrer, TRANSITION_DOWNLOAD, PR_FALSE,
sessionID, &visitID);
0, &visitID);
}
// nsIObserver *****************************************************************

View File

@ -86,6 +86,7 @@ function run_test() {
observe: function tlvo_observe(aSubject, aTopic, aData)
{
if (NS_LINK_VISITED_EVENT_TOPIC == aTopic) {
do_check_true(uri_in_db(testURI));
do_check_eq(testURI, aSubject);
topicReceived = true;
}