Bug 255432 make sure to set the content type on the channel early enough

r=bzbarsky sr=darin
This commit is contained in:
cbiesinger%web.de 2004-08-31 09:28:00 +00:00
Родитель 3d7c70e8e9
Коммит 13f9fc8add
1 изменённых файлов: 7 добавлений и 8 удалений

Просмотреть файл

@ -1389,6 +1389,8 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
PRBool viewSource = (PL_strstr(aContentType,"view-source") != 0); PRBool viewSource = (PL_strstr(aContentType,"view-source") != 0);
if ((NS_FAILED(rv) || useXUL) && !viewSource) { 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, // This is where we shunt the HTTP/Index stream into our datasource,
// and open the directory viewer XUL file as the content stream to // and open the directory viewer XUL file as the content stream to
@ -1442,12 +1444,12 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
*aDocListenerResult = listener.get(); *aDocListenerResult = listener.get();
NS_ADDREF(*aDocListenerResult); 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; return NS_OK;
} }
// setup the original channel's content type
(void)aChannel->SetContentType(NS_LITERAL_CSTRING("text/html"));
// Otherwise, lets use the html listing // Otherwise, lets use the html listing
nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv)); nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
if (NS_FAILED(rv)) if (NS_FAILED(rv))
@ -1486,9 +1488,6 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
if (NS_FAILED(rv)) return rv; 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; return NS_OK;
} }