188058 r=bzbarsky sr=darin When saving a .zip file "as...," Moz appends a .x after the .zip extension.

This commit is contained in:
cbiesinger%web.de 2003-07-01 14:16:06 +00:00
Родитель 31183f51ae
Коммит a36fa1715d
3 изменённых файлов: 30 добавлений и 16 удалений

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

@ -427,17 +427,13 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest *request, nsISupports *
// All attempts to dispatch this content have failed. Just pass it off to
// the helper app service.
nsCOMPtr<nsIURI> uri;
PRBool abortProcess = PR_FALSE;
aChannel->GetURI(getter_AddRefs(uri));
nsCOMPtr<nsIExternalHelperAppService> helperAppService =
do_GetService(NS_EXTERNALHELPERAPPSERVICE_CONTRACTID, &rv);
if (helperAppService)
{
rv = helperAppService->DoContent(contentType.get(),
uri,
request,
m_originalContext,
&abortProcess,
getter_AddRefs(contentStreamListener));
if (NS_SUCCEEDED(rv) && contentStreamListener) {
m_targetStreamListener = contentStreamListener;

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

@ -42,6 +42,7 @@
#include "nsIWebProgressListener.h"
#include "nsIDownload.h"
#include "nsReadableUtils.h"
#include "nsIRequest.h"
// used to manage our in memory data source of helper applications
#include "nsRDFCID.h"
@ -273,8 +274,10 @@ NS_IMETHODIMP nsExternalHelperAppService::CanHandleContent(const char *aMimeCont
return NS_OK;
}
NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType, nsIURI *aURI, nsISupports *aWindowContext,
PRBool *aAbortProcess, nsIStreamListener ** aStreamListener)
NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType,
nsIRequest *aRequest,
nsISupports *aWindowContext,
nsIStreamListener ** aStreamListener)
{
nsCOMPtr<nsIMIMEInfo> mimeInfo;
nsCAutoString fileExtension, query;
@ -282,7 +285,23 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
// (1) Try to find a mime object by looking the mime type
GetFromMIMEType(aMimeContentType, getter_AddRefs(mimeInfo));
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
// Get some stuff we will need later
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
nsCOMPtr<nsIURL> url;
PRBool methodIsPost = PR_FALSE;
if (channel) {
nsCOMPtr<nsIURI> uri;
channel->GetURI(getter_AddRefs(uri));
url = do_QueryInterface(uri);
nsCOMPtr<nsIHttpChannel> httpChan = do_QueryInterface(channel);
if (httpChan) {
nsCAutoString requestMethod;
httpChan->GetRequestMethod(requestMethod);
methodIsPost = requestMethod.Equals("POST");
}
}
if (!mimeInfo)
{
@ -294,8 +313,9 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
// If so, then the extension in the URL doesn't tell us
// anything about the content of the data, so don't try
// to find a handler based on that.
// Same if it's the result of POSTed data
url->GetQuery(query);
if (query.IsEmpty()) {
if (query.IsEmpty() && !methodIsPost) {
url->GetFileExtension(fileExtension);
GetFromExtension(fileExtension.get(), getter_AddRefs(mimeInfo));
// only over write mimeInfo if we got a non-null mime info object.
@ -376,10 +396,9 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const char *aMimeContentType
// should be the primary extension once we are doen.
// Ignore URL extension if data is output from a cgi script.
if (fileExtension.IsEmpty()) {
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
if (url) {
url->GetQuery(query);
if (query.IsEmpty()) {
if (query.IsEmpty() && !methodIsPost) {
url->GetFileExtension(fileExtension);
}
}

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

@ -27,6 +27,7 @@
#include "nsISupports.idl"
interface nsIURI;
interface nsIRequest;
interface nsIStreamListener;
interface nsIFile;
interface nsIMIMEInfo;
@ -47,14 +48,12 @@ interface nsIExternalHelperAppService : nsISupports
// into the returned stream listener. When the OnStopRequest is issued, the stream listener implementation
// will launch the helper app with this data.
// aMimeContentType --> the content type of the incoming data
// aURI --> the URI corresponding to the incoming data
// aRequest --> the request corresponding to the incoming data
// aWindowContext --> use GetInterface to retrieve properties like the dom window or parent window...
// the service might need this in order to bring up dialogs.
// aAbortProcess --> set to TRUE by the helper service if the caller should just forget about loading the document
// (typically this occurs if the helper app just wants the URI to run and not the data)
// returns a nsIStreamListener which the caller should pump the data into.
nsIStreamListener doContent (in string aMimeContentType, in nsIURI aURI,
in nsISupports aWindowContext, out boolean aAbortProcess);
nsIStreamListener doContent (in string aMimeContentType, in nsIRequest aRequest,
in nsISupports aWindowContext);
// applyDecodingForType: returns true if this type is to be decoded
// prior to saving or passing off to helper apps,