From 5bcb0da090ddb4a1a11b016be919b4367de16883 Mon Sep 17 00:00:00 2001 From: "tbogard%aol.net" Date: Thu, 17 Feb 2000 02:03:02 +0000 Subject: [PATCH] PDT+ Fix for Bug #27279. When the current docshell was asked to find an item of a given name, it failed to return out when it itself was the name being searched for. Also provided implementation for Set/ GetSessionHistory and and GetCurrentURI. None of these methods are called yet. Changed the mLoadCookie to only be on the contentListener. This will probably change to only be on the docshell, but regardless, there should only be one between the two of them. r=mscott, jar. a=jar --- docshell/base/nsDocShell.cpp | 60 ++++++++++++++++++++++++++++++------ docshell/base/nsDocShell.h | 8 +++-- 2 files changed, 56 insertions(+), 12 deletions(-) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 5fd7df5fe86..b259f98ba64 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -158,6 +158,10 @@ NS_IMETHODIMP nsDocShell::LoadURIVia(nsIURI* aUri, { NS_ENSURE_ARG(aUri); + // If Anchor, goto anchor + // Stop + // URI Load + nsCOMPtr uriLoader = do_GetService(NS_URI_LOADER_PROGID); NS_ENSURE_TRUE(uriLoader, NS_ERROR_FAILURE); @@ -601,6 +605,7 @@ NS_IMETHODIMP nsDocShell::FindItemWithName(const PRUnichar *aName, { *_retval = NS_STATIC_CAST(nsIDocShellTreeItem*, this); NS_ADDREF(*_retval); + return NS_OK; } // Second we check our children making sure not to ask a child if it @@ -842,6 +847,10 @@ NS_IMETHODIMP nsDocShell::GoForward() NS_IMETHODIMP nsDocShell::LoadURI(const PRUnichar* aURI) { + // Mangle URL + // If anchor goto Anchor + // Stop Current Loads + // URI Load //XXX First Checkin NS_ERROR("Not Yet Implemented"); return NS_ERROR_FAILURE; @@ -907,23 +916,39 @@ NS_IMETHODIMP nsDocShell::GetDocument(nsIDOMDocument** aDocument) NS_IMETHODIMP nsDocShell::GetCurrentURI(PRUnichar** aCurrentURI) { - //XXX First Checkin - NS_ERROR("Not Yet Implemented"); - return NS_ERROR_FAILURE; + NS_ENSURE_ARG_POINTER(aCurrentURI); + + if(!mCurrentURI) + { + *aCurrentURI = nsnull; + return NS_OK; + } + + char* spec; + NS_ENSURE_SUCCESS(mCurrentURI->GetSpec(&spec), NS_ERROR_FAILURE); + + nsAutoString strSpec(spec); + *aCurrentURI = strSpec.ToNewUnicode(); + + if(spec) + nsCRT::free(spec); + + return NS_OK; } NS_IMETHODIMP nsDocShell::SetSessionHistory(nsISHistory* aSessionHistory) { - //XXX First Checkin - NS_ERROR("Not Yet Implemented"); - return NS_ERROR_FAILURE; + mSessionHistory = aSessionHistory; + return NS_OK; } NS_IMETHODIMP nsDocShell::GetSessionHistory(nsISHistory** aSessionHistory) { - //XXX First Checkin - NS_ERROR("Not Yet Implemented"); - return NS_ERROR_FAILURE; + NS_ENSURE_ARG_POINTER(aSessionHistory); + + *aSessionHistory = mSessionHistory; + NS_IF_ADDREF(*aSessionHistory); + return NS_OK; } //***************************************************************************** @@ -1794,7 +1819,7 @@ nsresult nsDocShell::NewContentViewerObj(const char* aContentType, nsCOMPtr docLoaderFactory(do_CreateInstance(id)); NS_ENSURE_TRUE(docLoaderFactory, NS_ERROR_FAILURE); - nsCOMPtr loadGroup(do_QueryInterface(mLoadCookie)); + nsCOMPtr loadGroup(do_QueryInterface(mContentListener->mLoadCookie)); // Now create an instance of the content viewer nsXPIDLCString strCommand; // go to the uri loader and ask it to convert the uri load command into a old @@ -1934,6 +1959,21 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer) return NS_OK; } +NS_IMETHODIMP nsDocShell::StopCurrentLoads() +{ + // XXX + NS_ERROR("Not Yet Implemented"); + return NS_OK; +} + +NS_IMETHODIMP nsDocShell::AddCurrentSiteToHistories() +{ + // XXX + NS_ERROR("Not Yet Implemented"); + return NS_OK; +} + + NS_IMETHODIMP nsDocShell::FireStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI * aURL, //XXX: should be the channel? diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 9256c3d4208..013d7b7f63e 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -48,7 +48,8 @@ #include "nsDSURIContentListener.h" -// Latest includes +// Interfaces Needed +#include "nsISHistory.h" #include "nsIWebNavigation.h" @@ -124,6 +125,9 @@ protected: nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler); NS_IMETHOD SetupNewViewer(nsIContentViewer* aNewViewer); + NS_IMETHOD StopCurrentLoads(); + NS_IMETHOD AddCurrentSiteToHistories(); + NS_IMETHOD FireStartDocumentLoad(nsIDocumentLoader* aLoader, nsIURI* aURL, const char* aCommand); @@ -151,7 +155,7 @@ protected: nsCOMPtr mCurrentURI; nsCOMPtr mScriptGlobal; nsCOMPtr mScriptContext; - nsCOMPtr mLoadCookie; + nsCOMPtr mSessionHistory; PRInt32 mMarginWidth; PRInt32 mMarginHeight; PRInt32 mItemType;