From fb7314f248ab30a5dddbf2f1df9fd35fa18acc99 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Thu, 5 Aug 1999 05:14:45 +0000 Subject: [PATCH] Add global history. git-svn-id: svn://10.0.0.236/trunk@42280 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 22 +++++++++++++++++++++- mozilla/webshell/src/nsWebShell.cpp | 22 +++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 239d0807c2d..d0ffb048b4b 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -828,7 +828,6 @@ nsWebShell::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } - #ifdef NECKO if (aIID.Equals(nsIPrompt::GetIID())) { *aInstancePtr = (void*) ((nsIPrompt*)this); @@ -1879,6 +1878,16 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec, { + // Ugh. It sucks that we have to hack webshell like this. Forgive me, Father. + do { + nsresult rv; + NS_WITH_SERVICE(nsIGlobalHistory, history, "component://netscape/browser/global-history", &rv); + if (NS_FAILED(rv)) break; + + rv = history->AddPage(nsCAutoString(aUrlSpec), nsnull /* referrer */, PR_Now()); + if (NS_FAILED(rv)) break; + } while (0); + // If it's a normal reload that uses the cache, look at the destination anchor // and see if it's an element within the current document @@ -2426,6 +2435,17 @@ nsWebShell::SetTitle(const PRUnichar* aTitle) if (nsnull != browserWindow) { browserWindow->SetTitle(aTitle); NS_RELEASE(browserWindow); + + // Oh this hack sucks. But there isn't any other way that I can + // reliably get the title text. Sorry. + do { + nsresult rv; + NS_WITH_SERVICE(nsIGlobalHistory, history, "component://netscape/browser/global-history", &rv); + if (NS_FAILED(rv)) break; + + rv = history->SetPageTitle(nsCAutoString(mURL), aTitle); + if (NS_FAILED(rv)) break; + } while (0); } } else { NS_RELEASE(parent); diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index 239d0807c2d..d0ffb048b4b 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -828,7 +828,6 @@ nsWebShell::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } - #ifdef NECKO if (aIID.Equals(nsIPrompt::GetIID())) { *aInstancePtr = (void*) ((nsIPrompt*)this); @@ -1879,6 +1878,16 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec, { + // Ugh. It sucks that we have to hack webshell like this. Forgive me, Father. + do { + nsresult rv; + NS_WITH_SERVICE(nsIGlobalHistory, history, "component://netscape/browser/global-history", &rv); + if (NS_FAILED(rv)) break; + + rv = history->AddPage(nsCAutoString(aUrlSpec), nsnull /* referrer */, PR_Now()); + if (NS_FAILED(rv)) break; + } while (0); + // If it's a normal reload that uses the cache, look at the destination anchor // and see if it's an element within the current document @@ -2426,6 +2435,17 @@ nsWebShell::SetTitle(const PRUnichar* aTitle) if (nsnull != browserWindow) { browserWindow->SetTitle(aTitle); NS_RELEASE(browserWindow); + + // Oh this hack sucks. But there isn't any other way that I can + // reliably get the title text. Sorry. + do { + nsresult rv; + NS_WITH_SERVICE(nsIGlobalHistory, history, "component://netscape/browser/global-history", &rv); + if (NS_FAILED(rv)) break; + + rv = history->SetPageTitle(nsCAutoString(mURL), aTitle); + if (NS_FAILED(rv)) break; + } while (0); } } else { NS_RELEASE(parent);