зеркало из https://github.com/mozilla/pjs.git
move contentEncodings and applyConversion to a new interface. r=neeti@netscape.com, sr=darin@netscape.com, b=157133
This commit is contained in:
Родитель
5f0d0e6951
Коммит
0ec338eb4b
|
@ -38,6 +38,7 @@
|
|||
#include "nsIFileTransportService.h"
|
||||
#include "nsIStorageStream.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIEncodedChannel.h"
|
||||
#include "nsIUploadChannel.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
@ -1111,10 +1112,10 @@ nsresult nsWebBrowserPersist::SaveURIInternal(
|
|||
// Disable content conversion
|
||||
if (mPersistFlags & PERSIST_FLAGS_NO_CONVERSION)
|
||||
{
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(inputChannel));
|
||||
if (httpChannel)
|
||||
nsCOMPtr<nsIEncodedChannel> encodedChannel(do_QueryInterface(inputChannel));
|
||||
if (encodedChannel)
|
||||
{
|
||||
httpChannel->SetApplyConversion(PR_FALSE);
|
||||
encodedChannel->SetApplyConversion(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ nsIAuthPrompt.idl
|
|||
nsIChannel.idl
|
||||
nsIDirectoryListing.idl
|
||||
nsIDownloader.idl
|
||||
nsIEncodedChannel.idl
|
||||
nsIFileURL.idl
|
||||
nsIFileChannel.idl
|
||||
nsIFileTransportService.idl
|
||||
|
|
|
@ -44,6 +44,7 @@ XPIDLSRCS = \
|
|||
nsIAuthPrompt.idl \
|
||||
nsIDirectoryListing.idl \
|
||||
nsIDownloader.idl \
|
||||
nsIEncodedChannel.idl \
|
||||
nsIFileChannel.idl \
|
||||
nsIFileStreams.idl \
|
||||
nsIFileTransportService.idl \
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is Mozilla.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications. Portions created by Netscape Communications are
|
||||
* Copyright (C) 2001 by Netscape Communications. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISimpleEnumerator;
|
||||
/**
|
||||
* A channel interface which allows special handling of encoded content
|
||||
*/
|
||||
|
||||
[scriptable, uuid(30d7ec3a-f376-4652-9276-3092ec57abb6)]
|
||||
interface nsIEncodedChannel : nsISupports
|
||||
{
|
||||
/**
|
||||
* This attribute holds the MIME types corresponding to the content
|
||||
* encodings on the channel. The enumerator returns nsISupportsCString
|
||||
* objects. The first one corresponds to the outermost encoding on the
|
||||
* channel and then we work our way inward. "identity" is skipped and not
|
||||
* represented on the list. Unknown encodings make the enumeration stop.
|
||||
* If you want the actual Content-Encoding value, use
|
||||
* getResponseHeader("Content-Encoding").
|
||||
*
|
||||
* When there is no Content-Encoding header, this property is null.
|
||||
*
|
||||
* Modifying the Content-Encoding header on the channel will cause
|
||||
* this enumerator to have undefined behavior. Don't do it.
|
||||
*
|
||||
* Also not that contentEncodings only exist during or after OnStartRequest.
|
||||
* Calling contentEncodings before OnStartRequest is an error.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator contentEncodings;
|
||||
|
||||
/**
|
||||
* This attribute controls whether or not content conversion should be
|
||||
* done per the Content-Encoding response header. applyConversion can only
|
||||
* be set before or during OnStartRequest. Calling this during
|
||||
* OnDataAvailable is an error.
|
||||
*
|
||||
* TRUE by default.
|
||||
*/
|
||||
attribute boolean applyConversion;
|
||||
};
|
|
@ -1246,6 +1246,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEncodedChannel.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsISecretDecoderRing.idl</PATH>
|
||||
|
@ -1797,6 +1804,11 @@
|
|||
<PATH>nsIDownloader.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEncodedChannel.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsISecretDecoderRing.idl</PATH>
|
||||
|
@ -3170,6 +3182,13 @@
|
|||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEncodedChannel.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsISecretDecoderRing.idl</PATH>
|
||||
|
@ -3716,6 +3735,11 @@
|
|||
<PATH>nsIDownloader.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEncodedChannel.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsISecretDecoderRing.idl</PATH>
|
||||
|
@ -3992,6 +4016,12 @@
|
|||
<PATH>nsIDownloader.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEncodedChannel.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
|
|
@ -87,30 +87,6 @@ interface nsIHttpChannel : nsIChannel
|
|||
*/
|
||||
boolean isNoCacheResponse();
|
||||
|
||||
/**
|
||||
* This attribute holds the MIME types corresponding to the content
|
||||
* encodings on the channel. The enumerator returns nsISupportsCString
|
||||
* objects. The first one corresponds to the outermost encoding on the
|
||||
* channel and then we work our way inward. "identity" is skipped and not
|
||||
* represented on the list. Unknown encodings make the enumeration stop.
|
||||
* If you want the actual Content-Encoding value, use
|
||||
* getResponseHeader("Content-Encoding").
|
||||
*
|
||||
* When there is no Content-Encoding header, this property is null.
|
||||
*
|
||||
* Modifying the Content-Encoding header on the channel will cause
|
||||
* this enumerator to have undefined behavior. Don't do it.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator contentEncodings;
|
||||
|
||||
/**
|
||||
* This attribute controls whether or not content conversion should be
|
||||
* done per the Content-Encoding response header.
|
||||
*
|
||||
* TRUE by default.
|
||||
*/
|
||||
attribute boolean applyConversion;
|
||||
|
||||
/**
|
||||
* This attribute is a hint to the channel to indicate whether or not
|
||||
* the underlying HTTP transaction should be allowed to be pipelined
|
||||
|
|
|
@ -1547,8 +1547,12 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType)
|
|||
// convey the referrer if one was used for this channel to the next one
|
||||
if (mReferrer)
|
||||
httpChannel->SetReferrer(mReferrer);
|
||||
|
||||
// convey the mApplyConversion flag (bug 91862)
|
||||
httpChannel->SetApplyConversion(mApplyConversion);
|
||||
nsCOMPtr<nsIEncodedChannel> encodedChannel(do_QueryInterface(httpChannel));
|
||||
NS_ENSURE_TRUE(encodedChannel, NS_ERROR_UNEXPECTED);
|
||||
encodedChannel->SetApplyConversion(mApplyConversion);
|
||||
|
||||
// convey the mAllowPipelining flag
|
||||
httpChannel->SetAllowPipelining(mAllowPipelining);
|
||||
// convey the new redirection limit
|
||||
|
@ -2071,7 +2075,7 @@ nsHttpChannel::GetCurrentPath(nsACString &path)
|
|||
// nsHttpChannel::nsISupports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS10(nsHttpChannel,
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS11(nsHttpChannel,
|
||||
nsIRequest,
|
||||
nsIChannel,
|
||||
nsIRequestObserver,
|
||||
|
@ -2081,7 +2085,8 @@ NS_IMPL_THREADSAFE_ISUPPORTS10(nsHttpChannel,
|
|||
nsIProgressEventSink,
|
||||
nsICachingChannel,
|
||||
nsIUploadChannel,
|
||||
nsICacheListener)
|
||||
nsICacheListener,
|
||||
nsIEncodedChannel)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsHttpChannel::nsIRequest
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "nsICachingChannel.h"
|
||||
#include "nsICacheEntryDescriptor.h"
|
||||
#include "nsICacheListener.h"
|
||||
#include "nsIEncodedChannel.h"
|
||||
#include "nsITransport.h"
|
||||
#include "nsIUploadChannel.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
@ -65,6 +66,7 @@ class nsHttpChannel : public nsIHttpChannel
|
|||
, public nsICachingChannel
|
||||
, public nsIUploadChannel
|
||||
, public nsICacheListener
|
||||
, public nsIEncodedChannel
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -78,6 +80,7 @@ public:
|
|||
NS_DECL_NSICACHINGCHANNEL
|
||||
NS_DECL_NSIUPLOADCHANNEL
|
||||
NS_DECL_NSICACHELISTENER
|
||||
NS_DECL_NSIENCODEDCHANNEL
|
||||
|
||||
nsHttpChannel();
|
||||
virtual ~nsHttpChannel();
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "nsMimeTypes.h"
|
||||
// used for header disposition information.
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIEncodedChannel.h"
|
||||
#include "nsIMultiPartChannel.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIObserverService.h" // so we can be an xpcom shutdown observer
|
||||
|
@ -1200,7 +1201,9 @@ NS_IMETHODIMP nsExternalAppHandler::OnStartRequest(nsIRequest *request, nsISuppo
|
|||
}
|
||||
}
|
||||
|
||||
httpChannel->SetApplyConversion( applyConversion );
|
||||
nsCOMPtr<nsIEncodedChannel> encodedChannel(do_QueryInterface(httpChannel));
|
||||
NS_ENSURE_TRUE(encodedChannel, NS_ERROR_UNEXPECTED);
|
||||
encodedChannel->SetApplyConversion( applyConversion );
|
||||
}
|
||||
|
||||
mTimeDownloadStarted = PR_Now();
|
||||
|
|
|
@ -447,6 +447,24 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
|||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
#define NS_IMPL_QUERY_INTERFACE11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
|
||||
_i7, _i8, _i9, _i10) \
|
||||
NS_INTERFACE_MAP_BEGIN(_class) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i1) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i2) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i3) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i4) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i5) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i6) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i7) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i8) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i9) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i10) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i11) \
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE0 NS_IMPL_QUERY_INTERFACE0
|
||||
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE1 NS_IMPL_QUERY_INTERFACE1
|
||||
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE2 NS_IMPL_QUERY_INTERFACE2
|
||||
|
@ -458,6 +476,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
|||
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE8 NS_IMPL_QUERY_INTERFACE8
|
||||
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE9 NS_IMPL_QUERY_INTERFACE9
|
||||
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE10 NS_IMPL_QUERY_INTERFACE10
|
||||
#define NS_IMPL_THREADSAFE_QUERY_INTERFACE11 NS_IMPL_QUERY_INTERFACE11
|
||||
|
||||
/**
|
||||
* Declare that you're going to inherit from something that already
|
||||
|
@ -613,6 +632,13 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \
|
|||
NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
|
||||
_i9, _i10)
|
||||
|
||||
#define NS_IMPL_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
|
||||
_i9, _i10, _i11) \
|
||||
NS_IMPL_ADDREF(_class) \
|
||||
NS_IMPL_RELEASE(_class) \
|
||||
NS_IMPL_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, _i8, \
|
||||
_i9, _i10, _i11)
|
||||
|
||||
#define NS_IMPL_ISUPPORTS_INHERITED0(Class, Super) \
|
||||
NS_IMPL_QUERY_INTERFACE_INHERITED0(Class, Super) \
|
||||
NS_IMPL_ADDREF_INHERITED(Class, Super) \
|
||||
|
@ -773,6 +799,13 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \
|
|||
NS_IMPL_THREADSAFE_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
|
||||
_i7, _i8, _i9, _i10)
|
||||
|
||||
#define NS_IMPL_THREADSAFE_ISUPPORTS11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
|
||||
_i7, _i8, _i9, _i10, _i11) \
|
||||
NS_IMPL_THREADSAFE_ADDREF(_class) \
|
||||
NS_IMPL_THREADSAFE_RELEASE(_class) \
|
||||
NS_IMPL_THREADSAFE_QUERY_INTERFACE10(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
|
||||
_i7, _i8, _i9, _i10, _i11)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Macros for implementing nsIClassInfo-related stuff.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1070,6 +1103,22 @@ NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count, nsIID ***array) \
|
|||
NS_CLASSINFO_HELPER_ENTRY(9, _i10) \
|
||||
NS_CLASSINFO_HELPER_END
|
||||
|
||||
#define NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
|
||||
_i7, _i8, _i9, _i10, _i11) \
|
||||
NS_CLASSINFO_HELPER_BEGIN(_class, 10) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(0, _i1) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(1, _i2) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(2, _i3) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(3, _i4) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(4, _i5) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(5, _i6) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(6, _i7) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(7, _i8) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(8, _i9) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(9, _i10) \
|
||||
NS_CLASSINFO_HELPER_ENTRY(10, _i11) \
|
||||
NS_CLASSINFO_HELPER_END
|
||||
|
||||
#define NS_IMPL_QUERY_INTERFACE10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
|
||||
_i7, _i8, _i9, _i10) \
|
||||
NS_INTERFACE_MAP_BEGIN(_class) \
|
||||
|
@ -1087,6 +1136,24 @@ NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count, nsIID ***array) \
|
|||
NS_IMPL_QUERY_CLASSINFO(_class) \
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
#define NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, \
|
||||
_i7, _i8, _i9, _i10, _i11) \
|
||||
NS_INTERFACE_MAP_BEGIN(_class) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i1) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i2) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i3) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i4) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i5) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i6) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i7) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i8) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i9) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i10) \
|
||||
NS_INTERFACE_MAP_ENTRY(_i11) \
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, _i1) \
|
||||
NS_IMPL_QUERY_CLASSINFO(_class) \
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
#define NS_IMPL_ISUPPORTS10_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
|
||||
_i8, _i9, _i10) \
|
||||
NS_IMPL_ADDREF(_class) \
|
||||
|
@ -1096,6 +1163,15 @@ NS_CI_INTERFACE_GETTER_NAME(_class)(PRUint32 *count, nsIID ***array) \
|
|||
NS_IMPL_CI_INTERFACE_GETTER10(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
|
||||
_i8, _i9, _i10)
|
||||
|
||||
#define NS_IMPL_ISUPPORTS11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
|
||||
_i8, _i9, _i10, _i11) \
|
||||
NS_IMPL_ADDREF(_class) \
|
||||
NS_IMPL_RELEASE(_class) \
|
||||
NS_IMPL_QUERY_INTERFACE11_CI(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
|
||||
_i8, _i9, _i10, _i11) \
|
||||
NS_IMPL_CI_INTERFACE_GETTER11(_class, _i1, _i2, _i3, _i4, _i5, _i6, _i7, \
|
||||
_i8, _i9, _i10, _i11)
|
||||
|
||||
#define NS_INTERFACE_MAP_END_THREADSAFE NS_IMPL_QUERY_TAIL_GUTS
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче