From 306c5ad966c602b944d5b70e7662df6a4f05bfc4 Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Thu, 11 Aug 2005 05:06:22 +0000 Subject: [PATCH] Bug 78510. bryner's checkin fixed the Firefox problems so I'm undoing my previous partial-backout. git-svn-id: svn://10.0.0.236/trunk@177538 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index d8bf45554e1..1120377cab6 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -66,6 +66,7 @@ #include "nsIWebBrowserChrome.h" #include "nsPoint.h" #include "nsGfxCIID.h" +#include "nsIObserverService.h" #include "nsIPrompt.h" #include "nsIAuthPrompt.h" #include "nsTextFormatter.h" @@ -7831,13 +7832,27 @@ NS_IMETHODIMP nsDocShell::MakeEditable(PRBool inWaitForUriLoad) nsresult nsDocShell::AddToGlobalHistory(nsIURI * aURI, PRBool aRedirect, nsIURI * aReferrer) { - if (mItemType != typeContent) + if (mItemType != typeContent || !mGlobalHistory) return NS_OK; - if (!mGlobalHistory) - return NS_OK; + PRBool visited; + nsresult rv = mGlobalHistory->IsVisited(aURI, &visited); + if (NS_FAILED(rv)) + return rv; + + rv = mGlobalHistory->AddURI(aURI, aRedirect, !IsFrame(), aReferrer); + if (NS_FAILED(rv)) + return rv; - return mGlobalHistory->AddURI(aURI, aRedirect, !IsFrame(), aReferrer); + if (!visited) { + nsCOMPtr obsService = + do_GetService("@mozilla.org/observer-service;1"); + if (obsService) { + obsService->NotifyObservers(aURI, NS_LINK_VISITED_EVENT_TOPIC, nsnull); + } + } + + return NS_OK; } //*****************************************************************************