2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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"
|
2018-03-01 11:12:00 +03:00
|
|
|
#include "nsIEventTarget.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;
|
2017-10-30 02:02:40 +03:00
|
|
|
class nsJARProtocolHandler;
|
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 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
|
2018-11-30 13:46:48 +03:00
|
|
|
|
1999-09-17 20:12:41 +04:00
|
|
|
nsJARChannel();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-05-01 11:47:10 +03:00
|
|
|
nsresult Init(nsIURI* uri);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-05-01 11:47:10 +03:00
|
|
|
void SetFile(nsIFile* file);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
private:
|
2014-06-17 20:39:23 +04:00
|
|
|
virtual ~nsJARChannel();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-05-01 11:47:10 +03:00
|
|
|
nsresult CreateJarInput(nsIZipReaderCache*, nsJARInputThunk**);
|
2018-03-01 11:12:00 +03:00
|
|
|
nsresult LookupFile();
|
2013-02-16 02:27:21 +04:00
|
|
|
nsresult OpenLocalFile();
|
2019-05-01 11:47:10 +03:00
|
|
|
nsresult ContinueOpenLocalFile(nsJARInputThunk* aInput, bool aIsSyncCall);
|
2018-03-01 11:12:00 +03:00
|
|
|
nsresult OnOpenLocalFileComplete(nsresult aResult, bool aIsSyncCall);
|
|
|
|
nsresult CheckPendingEvents();
|
2013-02-16 02:27:21 +04:00
|
|
|
void NotifyError(nsresult aError);
|
2014-06-17 20:39:23 +04:00
|
|
|
void FireOnProgress(uint64_t aProgress);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCString mSpec;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-08-28 03:34:30 +04:00
|
|
|
bool mOpened;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-10-30 02:02:40 +03:00
|
|
|
RefPtr<nsJARProtocolHandler> mJarHandler;
|
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;
|
|
|
|
nsCString mContentType;
|
|
|
|
nsCString mContentCharset;
|
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;
|
2018-03-01 11:12:00 +03:00
|
|
|
bool mIsPending; // the AsyncOpen is in progress.
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-03-01 11:12:00 +03:00
|
|
|
bool mEnableOMT;
|
|
|
|
// |Cancel()|, |Suspend()|, and |Resume()| might be called during AsyncOpen.
|
|
|
|
struct {
|
|
|
|
bool isCanceled;
|
|
|
|
uint32_t suspendCount;
|
|
|
|
} mPendingEvent;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
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;
|
2017-06-24 03:10:54 +03:00
|
|
|
nsCOMPtr<nsIFile> mJarFileOverride;
|
2017-07-22 01:19:09 +03:00
|
|
|
nsCOMPtr<nsIZipReader> mPreCachedJarReader;
|
2003-01-18 05:15:14 +03:00
|
|
|
nsCOMPtr<nsIURI> mJarBaseURI;
|
|
|
|
nsCString mJarEntry;
|
2010-09-09 07:38:34 +04:00
|
|
|
nsCString mInnerJarEntry;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-03-01 11:12:00 +03:00
|
|
|
// use StreamTransportService as background thread
|
|
|
|
nsCOMPtr<nsIEventTarget> mWorker;
|
1999-09-17 20:12:41 +04:00
|
|
|
};
|
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
#endif // nsJARChannel_h__
|