From 13f9fc8add4b829300f67d3cdf2fcbf1b055c6e1 Mon Sep 17 00:00:00 2001 From: "cbiesinger%web.de" Date: Tue, 31 Aug 2004 09:28:00 +0000 Subject: [PATCH] Bug 255432 make sure to set the content type on the channel early enough r=bzbarsky sr=darin --- xpfe/components/directory/nsDirectoryViewer.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/xpfe/components/directory/nsDirectoryViewer.cpp b/xpfe/components/directory/nsDirectoryViewer.cpp index f6ebd650eee..74ac72773c8 100644 --- a/xpfe/components/directory/nsDirectoryViewer.cpp +++ b/xpfe/components/directory/nsDirectoryViewer.cpp @@ -1389,7 +1389,9 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand, PRBool viewSource = (PL_strstr(aContentType,"view-source") != 0); if ((NS_FAILED(rv) || useXUL) && !viewSource) { - + // ... and setup the original channel's content type + (void)aChannel->SetContentType(NS_LITERAL_CSTRING("application/vnd.mozilla.xul+xml")); + // This is where we shunt the HTTP/Index stream into our datasource, // and open the directory viewer XUL file as the content stream to // load in its place. @@ -1441,13 +1443,13 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand, listener = do_QueryInterface(httpindex,&rv); *aDocListenerResult = listener.get(); NS_ADDREF(*aDocListenerResult); - - // ... and set the original channel's content type up - (void)aChannel->SetContentType(NS_LITERAL_CSTRING("application/vnd.mozilla.xul+xml")); return NS_OK; } - + + // setup the original channel's content type + (void)aChannel->SetContentType(NS_LITERAL_CSTRING("text/html")); + // Otherwise, lets use the html listing nsCOMPtr catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv)); if (NS_FAILED(rv)) @@ -1486,9 +1488,6 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand, if (NS_FAILED(rv)) return rv; - // ... and set the original channel's content type up - (void)aChannel->SetContentType(NS_LITERAL_CSTRING("text/html")); - return NS_OK; }