2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-09-17 20:12:41 +04:00
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
#ifndef nsJARChannel_h__
|
|
|
|
#define nsJARChannel_h__
|
1999-09-17 20:12:41 +04:00
|
|
|
|
2015-03-11 03:00:01 +03:00
|
|
|
#include "mozilla/net/MemoryDownloader.h"
|
1999-11-08 00:55:12 +03:00
|
|
|
#include "nsIJARChannel.h"
|
1999-11-12 09:13:13 +03:00
|
|
|
#include "nsIJARURI.h"
|
2003-01-18 05:15:14 +03:00
|
|
|
#include "nsIInputStreamPump.h"
|
1999-11-24 11:31:06 +03:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2003-01-18 05:15:14 +03:00
|
|
|
#include "nsIProgressEventSink.h"
|
|
|
|
#include "nsIStreamListener.h"
|
2003-06-24 02:58:28 +04:00
|
|
|
#include "nsIZipReader.h"
|
2003-01-18 05:15:14 +03:00
|
|
|
#include "nsILoadGroup.h"
|
2014-07-10 10:56:36 +04:00
|
|
|
#include "nsILoadInfo.h"
|
2014-06-17 20:39:23 +04:00
|
|
|
#include "nsIThreadRetargetableRequest.h"
|
|
|
|
#include "nsIThreadRetargetableStreamListener.h"
|
2009-02-19 23:25:18 +03:00
|
|
|
#include "nsHashPropertyBag.h"
|
2003-01-18 05:15:14 +03:00
|
|
|
#include "nsIFile.h"
|
|
|
|
#include "nsIURI.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2002-03-06 10:48:55 +03:00
|
|
|
#include "nsString.h"
|
2015-05-19 21:15:34 +03:00
|
|
|
#include "mozilla/Logging.h"
|
1999-09-17 20:12:41 +04:00
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
class nsJARInputThunk;
|
2015-05-22 10:32:25 +03:00
|
|
|
class nsInputStreamPump;
|
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
//-----------------------------------------------------------------------------
|
1999-11-08 00:55:12 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsJARChannel final : public nsIJARChannel
|
2015-03-27 21:52:19 +03:00
|
|
|
, public mozilla::net::MemoryDownloader::IObserver
|
|
|
|
, public nsIStreamListener
|
|
|
|
, public nsIThreadRetargetableRequest
|
|
|
|
, public nsIThreadRetargetableStreamListener
|
|
|
|
, public nsHashPropertyBag
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-07-14 23:21:34 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1999-11-08 00:55:12 +03:00
|
|
|
NS_DECL_NSIREQUEST
|
|
|
|
NS_DECL_NSICHANNEL
|
1999-09-17 20:12:41 +04:00
|
|
|
NS_DECL_NSIJARCHANNEL
|
2001-04-10 10:01:08 +04:00
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
1999-11-08 00:55:12 +03:00
|
|
|
NS_DECL_NSISTREAMLISTENER
|
2014-06-17 20:39:23 +04:00
|
|
|
NS_DECL_NSITHREADRETARGETABLEREQUEST
|
|
|
|
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
|
2002-03-13 03:34:54 +03:00
|
|
|
|
1999-09-17 20:12:41 +04:00
|
|
|
nsJARChannel();
|
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
nsresult Init(nsIURI *uri);
|
1999-11-08 00:55:12 +03:00
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
private:
|
2014-06-17 20:39:23 +04:00
|
|
|
virtual ~nsJARChannel();
|
|
|
|
|
2012-11-28 22:12:56 +04:00
|
|
|
nsresult CreateJarInput(nsIZipReaderCache *, nsJARInputThunk **);
|
2014-09-15 21:00:08 +04:00
|
|
|
nsresult LookupFile(bool aAllowAsync);
|
2013-02-16 02:27:21 +04:00
|
|
|
nsresult OpenLocalFile();
|
|
|
|
void NotifyError(nsresult aError);
|
2014-06-17 20:39:23 +04:00
|
|
|
void FireOnProgress(uint64_t aProgress);
|
2015-03-11 03:00:01 +03:00
|
|
|
virtual void OnDownloadComplete(mozilla::net::MemoryDownloader* aDownloader,
|
|
|
|
nsIRequest* aRequest,
|
|
|
|
nsISupports* aCtxt,
|
|
|
|
nsresult aStatus,
|
|
|
|
mozilla::net::MemoryDownloader::Data aData)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2014-06-17 20:39:23 +04:00
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCString mSpec;
|
|
|
|
|
2012-08-28 03:34:30 +04:00
|
|
|
bool mOpened;
|
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIJARURI> mJarURI;
|
|
|
|
nsCOMPtr<nsIURI> mOriginalURI;
|
|
|
|
nsCOMPtr<nsISupports> mOwner;
|
2014-07-10 10:56:36 +04:00
|
|
|
nsCOMPtr<nsILoadInfo> mLoadInfo;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
2004-04-21 18:58:45 +04:00
|
|
|
nsCOMPtr<nsISupports> mSecurityInfo;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIProgressEventSink> mProgressSink;
|
|
|
|
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
|
|
|
nsCOMPtr<nsIStreamListener> mListener;
|
|
|
|
nsCOMPtr<nsISupports> mListenerContext;
|
|
|
|
nsCString mContentType;
|
|
|
|
nsCString mContentCharset;
|
2011-09-10 02:41:04 +04:00
|
|
|
nsCString mContentDispositionHeader;
|
|
|
|
/* mContentDisposition is uninitialized if mContentDispositionHeader is
|
|
|
|
* empty */
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mContentDisposition;
|
2012-10-22 21:51:07 +04:00
|
|
|
int64_t mContentLength;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLoadFlags;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsresult mStatus;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIsPending;
|
|
|
|
bool mIsUnsafe;
|
2003-01-18 05:15:14 +03:00
|
|
|
|
2015-03-11 03:00:01 +03:00
|
|
|
mozilla::net::MemoryDownloader::Data mTempMem;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIInputStreamPump> mPump;
|
2014-06-17 20:39:23 +04:00
|
|
|
// mRequest is only non-null during OnStartRequest, so we'll have a pointer
|
|
|
|
// to the request if we get called back via RetargetDeliveryTo.
|
|
|
|
nsCOMPtr<nsIRequest> mRequest;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIFile> mJarFile;
|
|
|
|
nsCOMPtr<nsIURI> mJarBaseURI;
|
|
|
|
nsCString mJarEntry;
|
2010-09-09 07:38:34 +04:00
|
|
|
nsCString mInnerJarEntry;
|
2015-05-22 10:32:25 +03:00
|
|
|
|
2015-08-05 06:55:00 +03:00
|
|
|
// True if this channel should not download any remote files.
|
|
|
|
bool mBlockRemoteFiles;
|
1999-09-17 20:12:41 +04:00
|
|
|
};
|
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
#endif // nsJARChannel_h__
|