зеркало из https://github.com/mozilla/gecko-dev.git
bug 248044 move jar protocol handler into libjar. removing now-unused files
r=bsmedberg sr=darin
This commit is contained in:
Родитель
595ae5033f
Коммит
98b4eea0df
|
@ -1 +0,0 @@
|
|||
Makefile
|
|
@ -1,48 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1 +0,0 @@
|
|||
Makefile
|
|
@ -1,54 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
XPIDL_MODULE = necko_jar
|
||||
GRE_MODULE = 1
|
||||
|
||||
XPIDLSRCS = nsIJARURI.idl \
|
||||
nsIJARChannel.idl \
|
||||
nsIJARProtocolHandler.idl
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIChannel.idl"
|
||||
|
||||
[scriptable, uuid(c7e410d1-85f2-11d3-9f63-006008a6efe9)]
|
||||
interface nsIJARChannel : nsIChannel
|
||||
{
|
||||
};
|
|
@ -1,49 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIProtocolHandler.idl"
|
||||
|
||||
interface nsIZipReaderCache;
|
||||
|
||||
[scriptable, uuid(92c3b42c-98c4-11d3-8cd9-0060b0fc14a3)]
|
||||
interface nsIJARProtocolHandler : nsIProtocolHandler {
|
||||
|
||||
/**
|
||||
* JARCache contains the collection of open jar files.
|
||||
*/
|
||||
readonly attribute nsIZipReaderCache JARCache;
|
||||
};
|
|
@ -1,64 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIURL.idl"
|
||||
|
||||
/**
|
||||
* JAR URLs have the following syntax
|
||||
*
|
||||
* jar:<jar-file-uri>!/<jar-entry>
|
||||
*
|
||||
* EXAMPLE: jar:http://www.big.com/blue.jar!/ocean.html
|
||||
*
|
||||
* The nsIURL methods operate on the <jar-entry> part of the spec.
|
||||
*/
|
||||
[scriptable, uuid(c7e410d3-85f2-11d3-9f63-006008a6efe9)]
|
||||
interface nsIJARURI : nsIURL {
|
||||
|
||||
/**
|
||||
* Returns the root URI (the one for the actual JAR file) for this JAR.
|
||||
* eg http://www.big.com/blue.jar
|
||||
*/
|
||||
attribute nsIURI JARFile;
|
||||
|
||||
/**
|
||||
* Returns the entry specified for this JAR URI.
|
||||
* eg ocean.html
|
||||
*/
|
||||
attribute AUTF8String JAREntry;
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
Makefile
|
|
@ -1,71 +0,0 @@
|
|||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# 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.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = necko
|
||||
LIBRARY_NAME = nkjar_s
|
||||
REQUIRES = xpcom \
|
||||
string \
|
||||
jar \
|
||||
mimetype \
|
||||
caps \
|
||||
js \
|
||||
pref \
|
||||
xpconnect \
|
||||
uconv \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsJARProtocolHandler.cpp \
|
||||
nsJARChannel.cpp \
|
||||
nsJARURI.cpp \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../../../base/src
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
# static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
|
@ -1,720 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsJARChannel.h"
|
||||
#include "nsJARProtocolHandler.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIJAR.h"
|
||||
|
||||
static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
//
|
||||
// set NSPR_LOG_MODULES=nsJarProtocol:5
|
||||
//
|
||||
static PRLogModuleInfo *gJarProtocolLog = nsnull;
|
||||
#endif
|
||||
|
||||
#define LOG(args) PR_LOG(gJarProtocolLog, PR_LOG_DEBUG, args)
|
||||
#define LOG_ENABLED() PR_LOG_TEST(gJarProtocolLog, 4)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsJARInputThunk
|
||||
//
|
||||
// this class allows us to do some extra work on the stream transport thread.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class nsJARInputThunk : public nsIInputStream
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIINPUTSTREAM
|
||||
|
||||
nsJARInputThunk(nsIFile *jarFile, const nsACString &jarEntry,
|
||||
nsIZipReaderCache *jarCache)
|
||||
: mJarCache(jarCache)
|
||||
, mJarFile(jarFile)
|
||||
, mJarEntry(jarEntry)
|
||||
, mContentLength(-1)
|
||||
{
|
||||
NS_ASSERTION(mJarFile, "no jar file");
|
||||
}
|
||||
|
||||
virtual ~nsJARInputThunk()
|
||||
{
|
||||
if (!mJarCache && mJarReader)
|
||||
mJarReader->Close();
|
||||
}
|
||||
|
||||
void GetJarReader(nsIZipReader **result)
|
||||
{
|
||||
NS_IF_ADDREF(*result = mJarReader);
|
||||
}
|
||||
|
||||
PRInt32 GetContentLength()
|
||||
{
|
||||
return mContentLength;
|
||||
}
|
||||
|
||||
nsresult EnsureJarStream();
|
||||
|
||||
private:
|
||||
|
||||
nsCOMPtr<nsIZipReaderCache> mJarCache;
|
||||
nsCOMPtr<nsIZipReader> mJarReader;
|
||||
nsCOMPtr<nsIFile> mJarFile;
|
||||
nsCOMPtr<nsIInputStream> mJarStream;
|
||||
nsCString mJarEntry;
|
||||
PRInt32 mContentLength;
|
||||
};
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsJARInputThunk, nsIInputStream)
|
||||
|
||||
nsresult
|
||||
nsJARInputThunk::EnsureJarStream()
|
||||
{
|
||||
if (mJarStream)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
if (mJarCache)
|
||||
rv = mJarCache->GetZip(mJarFile, getter_AddRefs(mJarReader));
|
||||
else {
|
||||
// create an uncached jar reader
|
||||
mJarReader = do_CreateInstance(kZipReaderCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJarReader->Init(mJarFile);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJarReader->Open();
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJarReader->GetInputStream(mJarEntry.get(),
|
||||
getter_AddRefs(mJarStream));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// ask the JarStream for the content length
|
||||
mJarStream->Available((PRUint32 *) &mContentLength);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARInputThunk::Close()
|
||||
{
|
||||
if (mJarStream)
|
||||
return mJarStream->Close();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARInputThunk::Available(PRUint32 *avail)
|
||||
{
|
||||
nsresult rv = EnsureJarStream();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return mJarStream->Available(avail);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARInputThunk::Read(char *buf, PRUint32 count, PRUint32 *countRead)
|
||||
{
|
||||
nsresult rv = EnsureJarStream();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return mJarStream->Read(buf, count, countRead);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARInputThunk::ReadSegments(nsWriteSegmentFun writer, void *closure,
|
||||
PRUint32 count, PRUint32 *countRead)
|
||||
{
|
||||
// stream transport does only calls Read()
|
||||
NS_NOTREACHED("nsJarInputThunk::ReadSegments");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARInputThunk::IsNonBlocking(PRBool *nonBlocking)
|
||||
{
|
||||
*nonBlocking = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsJARChannel::nsJARChannel()
|
||||
: mContentLength(-1)
|
||||
, mLoadFlags(LOAD_NORMAL)
|
||||
, mStatus(NS_OK)
|
||||
, mIsPending(PR_FALSE)
|
||||
, mJarInput(nsnull)
|
||||
{
|
||||
#if defined(PR_LOGGING)
|
||||
if (!gJarProtocolLog)
|
||||
gJarProtocolLog = PR_NewLogModule("nsJarProtocol");
|
||||
#endif
|
||||
|
||||
// hold an owning reference to the jar handler
|
||||
NS_ADDREF(gJarHandler);
|
||||
}
|
||||
|
||||
nsJARChannel::~nsJARChannel()
|
||||
{
|
||||
// with the exception of certain error cases mJarInput will already be null.
|
||||
NS_IF_RELEASE(mJarInput);
|
||||
|
||||
// release owning reference to the jar handler
|
||||
nsJARProtocolHandler *handler = gJarHandler;
|
||||
NS_RELEASE(handler); // NULL parameter
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS6(nsJARChannel,
|
||||
nsIRequest,
|
||||
nsIChannel,
|
||||
nsIStreamListener,
|
||||
nsIRequestObserver,
|
||||
nsIDownloadObserver,
|
||||
nsIJARChannel)
|
||||
|
||||
nsresult
|
||||
nsJARChannel::Init(nsIURI *uri)
|
||||
{
|
||||
nsresult rv;
|
||||
mJarURI = do_QueryInterface(uri, &rv);
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
mJarURI->GetSpec(mSpec);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARChannel::CreateJarInput(nsIZipReaderCache *jarCache)
|
||||
{
|
||||
// important to pass a clone of the file since the nsIFile impl is not
|
||||
// necessarily MT-safe
|
||||
nsCOMPtr<nsIFile> clonedFile;
|
||||
nsresult rv = mJarFile->Clone(getter_AddRefs(clonedFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mJarInput = new nsJARInputThunk(clonedFile, mJarEntry, jarCache);
|
||||
if (!mJarInput)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(mJarInput);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARChannel::EnsureJarInput(PRBool blocking)
|
||||
{
|
||||
LOG(("nsJARChannel::EnsureJarInput [this=%x %s]\n", this, mSpec.get()));
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
rv = mJarURI->GetJARFile(getter_AddRefs(mJarBaseURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJarURI->GetJAREntry(mJarEntry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// try to get a nsIFile directly from the url, which will often succeed.
|
||||
{
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mJarBaseURI);
|
||||
if (fileURL)
|
||||
fileURL->GetFile(getter_AddRefs(mJarFile));
|
||||
}
|
||||
|
||||
if (mJarFile) {
|
||||
// NOTE: we do not need to deal with mSecurityInfo here,
|
||||
// because we're loading from a local file
|
||||
rv = CreateJarInput(gJarHandler->JarCache());
|
||||
}
|
||||
else if (blocking) {
|
||||
NS_NOTREACHED("need sync downloader");
|
||||
rv = NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
else {
|
||||
// kick off an async download of the base URI...
|
||||
rv = NS_NewDownloader(getter_AddRefs(mDownloader), this);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = NS_OpenURI(mDownloader, nsnull, mJarBaseURI, nsnull,
|
||||
mLoadGroup, mCallbacks,
|
||||
mLoadFlags & ~LOAD_DOCUMENT_URI);
|
||||
}
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsIRequest
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetName(nsACString &result)
|
||||
{
|
||||
return mJarURI->GetSpec(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::IsPending(PRBool *result)
|
||||
{
|
||||
*result = mIsPending;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetStatus(nsresult *status)
|
||||
{
|
||||
if (mPump && NS_SUCCEEDED(mStatus))
|
||||
mPump->GetStatus(status);
|
||||
else
|
||||
*status = mStatus;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Cancel(nsresult status)
|
||||
{
|
||||
mStatus = status;
|
||||
if (mPump)
|
||||
return mPump->Cancel(status);
|
||||
|
||||
NS_ASSERTION(!mIsPending, "need to implement cancel when downloading");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Suspend()
|
||||
{
|
||||
if (mPump)
|
||||
return mPump->Suspend();
|
||||
|
||||
NS_ASSERTION(!mIsPending, "need to implement suspend when downloading");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Resume()
|
||||
{
|
||||
if (mPump)
|
||||
return mPump->Resume();
|
||||
|
||||
NS_ASSERTION(!mIsPending, "need to implement resume when downloading");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetLoadFlags(nsLoadFlags *aLoadFlags)
|
||||
{
|
||||
*aLoadFlags = mLoadFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetLoadFlags(nsLoadFlags aLoadFlags)
|
||||
{
|
||||
mLoadFlags = aLoadFlags;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetLoadGroup(nsILoadGroup **aLoadGroup)
|
||||
{
|
||||
NS_IF_ADDREF(*aLoadGroup = mLoadGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetLoadGroup(nsILoadGroup *aLoadGroup)
|
||||
{
|
||||
mLoadGroup = aLoadGroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsIChannel
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetOriginalURI(nsIURI **aURI)
|
||||
{
|
||||
if (mOriginalURI)
|
||||
*aURI = mOriginalURI;
|
||||
else
|
||||
*aURI = mJarURI;
|
||||
NS_IF_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetOriginalURI(nsIURI *aURI)
|
||||
{
|
||||
mOriginalURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetURI(nsIURI **aURI)
|
||||
{
|
||||
NS_IF_ADDREF(*aURI = mJarURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetOwner(nsISupports **result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (mOwner) {
|
||||
NS_ADDREF(*result = mOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!mJarInput) {
|
||||
*result = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-- Verify signature, if one is present, and set owner accordingly
|
||||
nsCOMPtr<nsIZipReader> jarReader;
|
||||
mJarInput->GetJarReader(getter_AddRefs(jarReader));
|
||||
if (!jarReader)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIJAR> jar = do_QueryInterface(jarReader, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("nsIJAR not supported");
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> cert;
|
||||
rv = jar->GetCertificatePrincipal(mJarEntry.get(), getter_AddRefs(cert));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (cert) {
|
||||
nsXPIDLCString certID;
|
||||
rv = cert->GetCertificateID(getter_Copies(certID));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsXPIDLCString commonName;
|
||||
rv = cert->GetCommonName(getter_Copies(commonName));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = secMan->GetCertificatePrincipal(certID, mJarBaseURI,
|
||||
getter_AddRefs(cert));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = cert->SetCommonName(commonName);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mOwner = do_QueryInterface(cert, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
NS_ADDREF(*result = mOwner);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetOwner(nsISupports *aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetNotificationCallbacks(nsIInterfaceRequestor **aCallbacks)
|
||||
{
|
||||
NS_IF_ADDREF(*aCallbacks = mCallbacks);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetNotificationCallbacks(nsIInterfaceRequestor *aCallbacks)
|
||||
{
|
||||
mCallbacks = aCallbacks;
|
||||
mProgressSink = do_GetInterface(mCallbacks);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetSecurityInfo(nsISupports **aSecurityInfo)
|
||||
{
|
||||
NS_PRECONDITION(aSecurityInfo, "Null out param");
|
||||
NS_IF_ADDREF(*aSecurityInfo = mSecurityInfo);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentType(nsACString &result)
|
||||
{
|
||||
if (mContentType.IsEmpty()) {
|
||||
//
|
||||
// generate content type and set it
|
||||
//
|
||||
if (mJarEntry.IsEmpty()) {
|
||||
LOG(("mJarEntry is empty!\n"));
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
const char *ext = nsnull, *fileName = mJarEntry.get();
|
||||
PRInt32 len = mJarEntry.Length();
|
||||
for (PRInt32 i = len-1; i >= 0; i--) {
|
||||
if (fileName[i] == '.') {
|
||||
ext = &fileName[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ext) {
|
||||
nsIMIMEService *mimeServ = gJarHandler->MimeService();
|
||||
if (mimeServ)
|
||||
mimeServ->GetTypeFromExtension(nsDependentCString(ext), mContentType);
|
||||
}
|
||||
if (mContentType.IsEmpty())
|
||||
mContentType.AssignLiteral(UNKNOWN_CONTENT_TYPE);
|
||||
}
|
||||
result = mContentType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetContentType(const nsACString &aContentType)
|
||||
{
|
||||
// If someone gives us a type hint we should just use that type instead of
|
||||
// doing our guessing. So we don't care when this is being called.
|
||||
|
||||
// mContentCharset is unchanged if not parsed
|
||||
NS_ParseContentType(aContentType, mContentType, mContentCharset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentCharset(nsACString &aContentCharset)
|
||||
{
|
||||
// If someone gives us a charset hint we should just use that charset.
|
||||
// So we don't care when this is being called.
|
||||
aContentCharset = mContentCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
{
|
||||
mContentCharset = aContentCharset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::GetContentLength(PRInt32 *result)
|
||||
{
|
||||
// if content length is unknown, query mJarInput...
|
||||
if (mContentLength < 0 && mJarInput)
|
||||
mContentLength = mJarInput->GetContentLength();
|
||||
|
||||
*result = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::SetContentLength(PRInt32 aContentLength)
|
||||
{
|
||||
// XXX does this really make any sense at all?
|
||||
mContentLength = aContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::Open(nsIInputStream **stream)
|
||||
{
|
||||
LOG(("nsJARChannel::Open [this=%x]\n", this));
|
||||
|
||||
NS_ENSURE_TRUE(!mJarInput, NS_ERROR_IN_PROGRESS);
|
||||
NS_ENSURE_TRUE(!mIsPending, NS_ERROR_IN_PROGRESS);
|
||||
|
||||
nsresult rv = EnsureJarInput(PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!mJarInput)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
// force load the jar file now so GetContentLength will return a
|
||||
// meaningful value once we return.
|
||||
mJarInput->EnsureJarStream();
|
||||
|
||||
NS_ADDREF(*stream = mJarInput);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctx)
|
||||
{
|
||||
LOG(("nsJARChannel::AsyncOpen [this=%x]\n", this));
|
||||
|
||||
NS_ENSURE_TRUE(!mIsPending, NS_ERROR_IN_PROGRESS);
|
||||
|
||||
nsresult rv = EnsureJarInput(PR_FALSE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (mJarInput) {
|
||||
// create input stream pump
|
||||
rv = NS_NewInputStreamPump(getter_AddRefs(mPump), mJarInput);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mPump->AsyncRead(this, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->AddRequest(this, nsnull);
|
||||
|
||||
mListener = listener;
|
||||
mListenerContext = ctx;
|
||||
mIsPending = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsIDownloadObserver
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnDownloadComplete(nsIDownloader *downloader,
|
||||
nsIRequest *request,
|
||||
nsISupports *context,
|
||||
nsresult status,
|
||||
nsIFile *file)
|
||||
{
|
||||
// Grab the security info from our base channel
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
if (channel)
|
||||
channel->GetSecurityInfo(getter_AddRefs(mSecurityInfo));
|
||||
|
||||
if (NS_SUCCEEDED(status)) {
|
||||
mJarFile = file;
|
||||
|
||||
nsresult rv = CreateJarInput(nsnull);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// create input stream pump
|
||||
rv = NS_NewInputStreamPump(getter_AddRefs(mPump), mJarInput);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = mPump->AsyncRead(this, nsnull);
|
||||
}
|
||||
status = rv;
|
||||
}
|
||||
|
||||
if (NS_FAILED(status)) {
|
||||
OnStartRequest(nsnull, nsnull);
|
||||
OnStopRequest(nsnull, nsnull, status);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsIStreamListener
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnStartRequest(nsIRequest *req, nsISupports *ctx)
|
||||
{
|
||||
LOG(("nsJARChannel::OnStartRequest [this=%x %s]\n", this, mSpec.get()));
|
||||
|
||||
return mListener->OnStartRequest(this, mListenerContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnStopRequest(nsIRequest *req, nsISupports *ctx, nsresult status)
|
||||
{
|
||||
LOG(("nsJARChannel::OnStopRequest [this=%x %s status=%x]\n",
|
||||
this, mSpec.get(), status));
|
||||
|
||||
if (NS_SUCCEEDED(mStatus))
|
||||
mStatus = status;
|
||||
|
||||
if (mListener) {
|
||||
mListener->OnStopRequest(this, mListenerContext, status);
|
||||
mListener = 0;
|
||||
mListenerContext = 0;
|
||||
}
|
||||
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->RemoveRequest(this, nsnull, status);
|
||||
|
||||
mPump = 0;
|
||||
NS_IF_RELEASE(mJarInput);
|
||||
mIsPending = PR_FALSE;
|
||||
mDownloader = 0; // this may delete the underlying jar file
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARChannel::OnDataAvailable(nsIRequest *req, nsISupports *ctx,
|
||||
nsIInputStream *stream,
|
||||
PRUint32 offset, PRUint32 count)
|
||||
{
|
||||
#if defined(PR_LOGGING)
|
||||
LOG(("nsJARChannel::OnDataAvailable [this=%x %s]\n", this, mSpec.get()));
|
||||
#endif
|
||||
|
||||
nsresult rv;
|
||||
|
||||
rv = mListener->OnDataAvailable(this, mListenerContext, stream, offset, count);
|
||||
|
||||
// simply report progress here instead of hooking ourselves up as a
|
||||
// nsITransportEventSink implementation.
|
||||
if (mProgressSink && NS_SUCCEEDED(rv) && !(mLoadFlags & LOAD_BACKGROUND))
|
||||
mProgressSink->OnProgress(this, nsnull, offset + count, mContentLength);
|
||||
|
||||
return rv; // let the pump cancel on failure
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsJARChannel_h__
|
||||
#define nsJARChannel_h__
|
||||
|
||||
#include "nsIJARChannel.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsIInputStreamPump.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIZipReader.h"
|
||||
#include "nsIDownloader.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "prlog.h"
|
||||
|
||||
class nsJARInputThunk;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class nsJARChannel : public nsIJARChannel
|
||||
, public nsIDownloadObserver
|
||||
, public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSIJARCHANNEL
|
||||
NS_DECL_NSIDOWNLOADOBSERVER
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
nsJARChannel();
|
||||
virtual ~nsJARChannel();
|
||||
|
||||
nsresult Init(nsIURI *uri);
|
||||
|
||||
private:
|
||||
nsresult CreateJarInput(nsIZipReaderCache *);
|
||||
nsresult EnsureJarInput(PRBool blocking);
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
nsCString mSpec;
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIJARURI> mJarURI;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mSecurityInfo;
|
||||
nsCOMPtr<nsIProgressEventSink> mProgressSink;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
nsCOMPtr<nsISupports> mListenerContext;
|
||||
nsCString mContentType;
|
||||
nsCString mContentCharset;
|
||||
PRInt32 mContentLength;
|
||||
PRUint32 mLoadFlags;
|
||||
nsresult mStatus;
|
||||
PRBool mIsPending;
|
||||
|
||||
nsJARInputThunk *mJarInput;
|
||||
nsCOMPtr<nsIStreamListener> mDownloader;
|
||||
nsCOMPtr<nsIInputStreamPump> mPump;
|
||||
nsCOMPtr<nsIFile> mJarFile;
|
||||
nsCOMPtr<nsIURI> mJarBaseURI;
|
||||
nsCString mJarEntry;
|
||||
};
|
||||
|
||||
#endif // nsJARChannel_h__
|
|
@ -1,217 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsJARProtocolHandler.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsJARURI.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsJARChannel.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsString.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsMimeTypes.h"
|
||||
|
||||
static NS_DEFINE_CID(kZipReaderCacheCID, NS_ZIPREADERCACHE_CID);
|
||||
|
||||
#define NS_JAR_CACHE_SIZE 32
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
nsJARProtocolHandler *gJarHandler = nsnull;
|
||||
|
||||
nsJARProtocolHandler::nsJARProtocolHandler()
|
||||
{
|
||||
gJarHandler = this;
|
||||
}
|
||||
|
||||
nsJARProtocolHandler::~nsJARProtocolHandler()
|
||||
{
|
||||
gJarHandler = nsnull;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARProtocolHandler::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsComponentManager::CreateInstance(kZipReaderCacheCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIZipReaderCache),
|
||||
getter_AddRefs(mJARCache));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mJARCache->Init(NS_JAR_CACHE_SIZE);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsIMIMEService *
|
||||
nsJARProtocolHandler::MimeService()
|
||||
{
|
||||
if (!mMimeService)
|
||||
mMimeService = do_GetService("@mozilla.org/mime;1");
|
||||
|
||||
return mMimeService.get();
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS3(nsJARProtocolHandler,
|
||||
nsIJARProtocolHandler,
|
||||
nsIProtocolHandler,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
NS_METHOD
|
||||
nsJARProtocolHandler::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
nsJARProtocolHandler* ph = new nsJARProtocolHandler();
|
||||
if (ph == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(ph);
|
||||
nsresult rv = ph->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = ph->QueryInterface(aIID, aResult);
|
||||
}
|
||||
NS_RELEASE(ph);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::GetJARCache(nsIZipReaderCache* *result)
|
||||
{
|
||||
*result = mJARCache;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIProtocolHandler methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::GetScheme(nsACString &result)
|
||||
{
|
||||
result.AssignLiteral("jar");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::GetDefaultPort(PRInt32 *result)
|
||||
{
|
||||
*result = -1; // no port for JAR: URLs
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::GetProtocolFlags(PRUint32 *result)
|
||||
{
|
||||
*result = URI_NORELATIVE | URI_NOAUTH;
|
||||
/* Although jar uris have their own concept of relative urls
|
||||
it is very different from the standard behaviour, so we
|
||||
have to say norelative here! */
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::NewURI(const nsACString &aSpec,
|
||||
const char *aCharset,
|
||||
nsIURI *aBaseURI,
|
||||
nsIURI **result)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIURI* url;
|
||||
|
||||
nsJARURI *jarURI = new nsJARURI();
|
||||
if (!jarURI)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(url = jarURI);
|
||||
|
||||
rv = jarURI->Init(aCharset);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (aBaseURI) {
|
||||
nsCAutoString aResolvedURI;
|
||||
rv = aBaseURI->Resolve(aSpec, aResolvedURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = url->SetSpec(aResolvedURI);
|
||||
}
|
||||
else
|
||||
rv = url->SetSpec(aSpec);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(url);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = url;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result)
|
||||
{
|
||||
nsJARChannel *chan = new nsJARChannel();
|
||||
if (!chan)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(chan);
|
||||
|
||||
nsresult rv = chan->Init(uri);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_RELEASE(chan);
|
||||
return rv;
|
||||
}
|
||||
|
||||
*result = chan;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::AllowPort(PRInt32 port, const char *scheme, PRBool *_retval)
|
||||
{
|
||||
// don't override anything.
|
||||
*_retval = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,77 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsJARProtocolHandler_h__
|
||||
#define nsJARProtocolHandler_h__
|
||||
|
||||
#include "nsIJARProtocolHandler.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsIZipReader.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsJARProtocolHandler : public nsIJARProtocolHandler
|
||||
, public nsSupportsWeakReference
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
NS_DECL_NSIJARPROTOCOLHANDLER
|
||||
|
||||
// nsJARProtocolHandler methods:
|
||||
nsJARProtocolHandler();
|
||||
virtual ~nsJARProtocolHandler();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
|
||||
// returns non addref'ed pointer.
|
||||
nsIMIMEService *MimeService();
|
||||
nsIZipReaderCache *JarCache() { return mJARCache; }
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIZipReaderCache> mJARCache;
|
||||
nsCOMPtr<nsIMIMEService> mMimeService;
|
||||
};
|
||||
|
||||
extern nsJARProtocolHandler *gJarHandler;
|
||||
|
||||
#endif // !nsJARProtocolHandler_h__
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsJARProtocolHandler.h"
|
||||
|
||||
|
||||
static const nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "JAR Protocol Handler",
|
||||
NS_JARPROTOCOLHANDLER_CID,
|
||||
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "jar",
|
||||
nsJARProtocolHandler::Create
|
||||
},
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(nsJarProtocolModule, components)
|
||||
|
||||
|
|
@ -1,664 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsJARURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIZipReader.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsURLHelper.h"
|
||||
#include "nsStandardURL.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
static NS_DEFINE_CID(kThisImplCID, NS_THIS_JARURI_IMPL_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsJARURI::nsJARURI()
|
||||
{
|
||||
}
|
||||
|
||||
nsJARURI::~nsJARURI()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsJARURI)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsJARURI)
|
||||
NS_INTERFACE_MAP_BEGIN(nsJARURI)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIJARURI)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIURI)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIURL)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJARURI)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISerializable)
|
||||
// see nsJARURI::Equals
|
||||
if (aIID.Equals(kThisImplCID))
|
||||
foundInterface = NS_STATIC_CAST(nsIJARURI *, this);
|
||||
else
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsresult
|
||||
nsJARURI::Init(const char *charsetHint)
|
||||
{
|
||||
mCharsetHint = charsetHint;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#define NS_JAR_SCHEME NS_LITERAL_CSTRING("jar:")
|
||||
#define NS_JAR_DELIMITER NS_LITERAL_CSTRING("!/")
|
||||
#define NS_BOGUS_ENTRY_SCHEME NS_LITERAL_CSTRING("x:///")
|
||||
|
||||
// FormatSpec takes the entry spec (including the "x:///" at the
|
||||
// beginning) and gives us a full JAR spec.
|
||||
nsresult
|
||||
nsJARURI::FormatSpec(const nsACString &entrySpec, nsACString &result,
|
||||
PRBool aIncludeScheme)
|
||||
{
|
||||
// The entrySpec MUST start with "x:///"
|
||||
NS_ASSERTION(StringBeginsWith(entrySpec, NS_BOGUS_ENTRY_SCHEME),
|
||||
"bogus entry spec");
|
||||
|
||||
nsCAutoString fileSpec;
|
||||
nsresult rv = mJARFile->GetSpec(fileSpec);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (aIncludeScheme)
|
||||
result = NS_JAR_SCHEME;
|
||||
else
|
||||
result.Truncate();
|
||||
|
||||
result.Append(fileSpec + NS_JAR_DELIMITER +
|
||||
Substring(entrySpec, 5, entrySpec.Length() - 5));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJARURI::CreateEntryURL(const nsACString& entryFilename,
|
||||
const char* charset,
|
||||
nsIURL** url)
|
||||
{
|
||||
*url = nsnull;
|
||||
|
||||
nsStandardURL* stdURL = new nsStandardURL();
|
||||
if (!stdURL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Flatten the concatenation, just in case. See bug 128288
|
||||
nsCAutoString spec(NS_BOGUS_ENTRY_SCHEME + entryFilename);
|
||||
nsresult rv = stdURL->Init(nsIStandardURL::URLTYPE_NO_AUTHORITY, -1,
|
||||
spec, charset, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete stdURL;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ADDREF(*url = stdURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISerializable methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Read(nsIObjectInputStream* aStream)
|
||||
{
|
||||
NS_NOTREACHED("nsJARURI::Read");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Write(nsIObjectOutputStream* aStream)
|
||||
{
|
||||
NS_NOTREACHED("nsJARURI::Write");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIURI methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetSpec(nsACString &aSpec)
|
||||
{
|
||||
nsCAutoString entrySpec;
|
||||
mJAREntry->GetSpec(entrySpec);
|
||||
return FormatSpec(entrySpec, aSpec);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetSpec(const nsACString &aSpec)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString scheme;
|
||||
rv = net_ExtractURLScheme(aSpec, nsnull, nsnull, &scheme);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (strcmp("jar", scheme.get()) != 0)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
// Search backward from the end for the "!/" delimiter. Remember, jar URLs
|
||||
// can nest, e.g.:
|
||||
// jar:jar:http://www.foo.com/bar.jar!/a.jar!/b.html
|
||||
// This gets the b.html document from out of the a.jar file, that's
|
||||
// contained within the bar.jar file.
|
||||
|
||||
nsACString::const_iterator begin, end, delim_begin, delim_end;
|
||||
aSpec.BeginReading(begin);
|
||||
aSpec.EndReading(end);
|
||||
|
||||
delim_begin = begin;
|
||||
delim_end = end;
|
||||
|
||||
if (!RFindInReadable(NS_JAR_DELIMITER, delim_begin, delim_end))
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
begin.advance(4);
|
||||
|
||||
rv = ioServ->NewURI(Substring(begin, delim_begin), mCharsetHint.get(), nsnull, getter_AddRefs(mJARFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// skip over any extra '/' chars
|
||||
while (*delim_end == '/')
|
||||
++delim_end;
|
||||
|
||||
return SetJAREntry(Substring(delim_end, end));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetPrePath(nsACString &prePath)
|
||||
{
|
||||
prePath = NS_JAR_SCHEME;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetScheme(nsACString &aScheme)
|
||||
{
|
||||
aScheme = "jar";
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetScheme(const nsACString &aScheme)
|
||||
{
|
||||
// doesn't make sense to set the scheme of a jar: URL
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetUserPass(nsACString &aUserPass)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetUserPass(const nsACString &aUserPass)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetUsername(nsACString &aUsername)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetUsername(const nsACString &aUsername)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetPassword(nsACString &aPassword)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetPassword(const nsACString &aPassword)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetHostPort(nsACString &aHostPort)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetHostPort(const nsACString &aHostPort)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetHost(nsACString &aHost)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetHost(const nsACString &aHost)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetPort(PRInt32 *aPort)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetPort(PRInt32 aPort)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetPath(nsACString &aPath)
|
||||
{
|
||||
nsCAutoString entrySpec;
|
||||
mJAREntry->GetSpec(entrySpec);
|
||||
return FormatSpec(entrySpec, aPath, PR_FALSE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetPath(const nsACString &aPath)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetAsciiSpec(nsACString &aSpec)
|
||||
{
|
||||
// XXX Shouldn't this like... make sure it returns ASCII or something?
|
||||
return GetSpec(aSpec);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetAsciiHost(nsACString &aHost)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetOriginCharset(nsACString &aOriginCharset)
|
||||
{
|
||||
aOriginCharset = mCharsetHint;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Equals(nsIURI *other, PRBool *result)
|
||||
{
|
||||
*result = PR_FALSE;
|
||||
|
||||
if (other == nsnull)
|
||||
return NS_OK; // not equal
|
||||
|
||||
nsRefPtr<nsJARURI> otherJAR;
|
||||
nsresult rv = other->QueryInterface(kThisImplCID, getter_AddRefs(otherJAR));
|
||||
if (NS_FAILED(rv))
|
||||
return NS_OK; // not equal
|
||||
|
||||
PRBool equal;
|
||||
rv = mJARFile->Equals(otherJAR->mJARFile, &equal);
|
||||
if (NS_FAILED(rv) || !equal) {
|
||||
return rv; // not equal
|
||||
}
|
||||
|
||||
rv = mJAREntry->Equals(otherJAR->mJAREntry, result);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SchemeIs(const char *i_Scheme, PRBool *o_Equals)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(o_Equals);
|
||||
if (!i_Scheme) return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (*i_Scheme == 'j' || *i_Scheme == 'J') {
|
||||
*o_Equals = PL_strcasecmp("jar", i_Scheme) ? PR_FALSE : PR_TRUE;
|
||||
} else {
|
||||
*o_Equals = PR_FALSE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Clone(nsIURI **result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIURI> newJARFile;
|
||||
rv = mJARFile->Clone(getter_AddRefs(newJARFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURI> newJAREntryURI;
|
||||
rv = mJAREntry->Clone(getter_AddRefs(newJAREntryURI));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURL> newJAREntry(do_QueryInterface(newJAREntryURI));
|
||||
NS_ASSERTION(newJAREntry, "This had better QI to nsIURL!");
|
||||
|
||||
nsJARURI* uri = new nsJARURI();
|
||||
if (uri) {
|
||||
NS_ADDREF(uri);
|
||||
uri->mJARFile = newJARFile;
|
||||
uri->mJAREntry = newJAREntry;
|
||||
*result = uri;
|
||||
} else {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::Resolve(const nsACString &relativePath, nsACString &result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
rv = net_ExtractURLScheme(relativePath, nsnull, nsnull, nsnull);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// then aSpec is absolute
|
||||
result = relativePath;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCAutoString resolvedPath;
|
||||
mJAREntry->Resolve(relativePath, resolvedPath);
|
||||
|
||||
return FormatSpec(resolvedPath, result);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIURL methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetFilePath(nsACString& filePath)
|
||||
{
|
||||
return mJAREntry->GetFilePath(filePath);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetFilePath(const nsACString& filePath)
|
||||
{
|
||||
return mJAREntry->SetFilePath(filePath);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetParam(nsACString& param)
|
||||
{
|
||||
param.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetParam(const nsACString& param)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetQuery(nsACString& query)
|
||||
{
|
||||
query.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetQuery(const nsACString& query)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetRef(nsACString& ref)
|
||||
{
|
||||
return mJAREntry->GetRef(ref);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetRef(const nsACString& ref)
|
||||
{
|
||||
return mJAREntry->SetRef(ref);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetDirectory(nsACString& directory)
|
||||
{
|
||||
return mJAREntry->GetDirectory(directory);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetDirectory(const nsACString& directory)
|
||||
{
|
||||
return mJAREntry->SetDirectory(directory);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetFileName(nsACString& fileName)
|
||||
{
|
||||
return mJAREntry->GetFileName(fileName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetFileName(const nsACString& fileName)
|
||||
{
|
||||
return mJAREntry->SetFileName(fileName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetFileBaseName(nsACString& fileBaseName)
|
||||
{
|
||||
return mJAREntry->GetFileBaseName(fileBaseName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetFileBaseName(const nsACString& fileBaseName)
|
||||
{
|
||||
return mJAREntry->SetFileBaseName(fileBaseName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetFileExtension(nsACString& fileExtension)
|
||||
{
|
||||
return mJAREntry->GetFileExtension(fileExtension);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetFileExtension(const nsACString& fileExtension)
|
||||
{
|
||||
return mJAREntry->SetFileExtension(fileExtension);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetCommonBaseSpec(nsIURI* uriToCompare, nsACString& commonSpec)
|
||||
{
|
||||
commonSpec.Truncate();
|
||||
|
||||
NS_ENSURE_ARG_POINTER(uriToCompare);
|
||||
|
||||
commonSpec.Truncate();
|
||||
nsCOMPtr<nsIJARURI> otherJARURI(do_QueryInterface(uriToCompare));
|
||||
if (!otherJARURI) {
|
||||
// Nothing in common
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> otherJARFile;
|
||||
nsresult rv = otherJARURI->GetJARFile(getter_AddRefs(otherJARFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool equal;
|
||||
rv = mJARFile->Equals(otherJARFile, &equal);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!equal) {
|
||||
// See what the JAR file URIs have in common
|
||||
nsCOMPtr<nsIURL> ourJARFileURL(do_QueryInterface(mJARFile));
|
||||
if (!ourJARFileURL) {
|
||||
// Not a URL, so nothing in common
|
||||
return NS_OK;
|
||||
}
|
||||
nsCAutoString common;
|
||||
rv = ourJARFileURL->GetCommonBaseSpec(otherJARFile, common);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
commonSpec = NS_JAR_SCHEME + common;
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
// At this point we have the same JAR file. Compare the JAREntrys
|
||||
nsCAutoString otherEntry;
|
||||
rv = otherJARURI->GetJAREntry(otherEntry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString otherCharset;
|
||||
rv = uriToCompare->GetOriginCharset(otherCharset);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURL> url;
|
||||
rv = CreateEntryURL(otherEntry, otherCharset.get(), getter_AddRefs(url));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString common;
|
||||
rv = mJAREntry->GetCommonBaseSpec(url, common);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = FormatSpec(common, commonSpec);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetRelativeSpec(nsIURI* uriToCompare, nsACString& relativeSpec)
|
||||
{
|
||||
GetSpec(relativeSpec);
|
||||
|
||||
NS_ENSURE_ARG_POINTER(uriToCompare);
|
||||
|
||||
nsCOMPtr<nsIJARURI> otherJARURI(do_QueryInterface(uriToCompare));
|
||||
if (!otherJARURI) {
|
||||
// Nothing in common
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> otherJARFile;
|
||||
nsresult rv = otherJARURI->GetJARFile(getter_AddRefs(otherJARFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool equal;
|
||||
rv = mJARFile->Equals(otherJARFile, &equal);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!equal) {
|
||||
// We live in different JAR files. Nothing in common.
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Same JAR file. Compare the JAREntrys
|
||||
nsCAutoString otherEntry;
|
||||
rv = otherJARURI->GetJAREntry(otherEntry);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString otherCharset;
|
||||
rv = uriToCompare->GetOriginCharset(otherCharset);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURL> url;
|
||||
rv = CreateEntryURL(otherEntry, otherCharset.get(), getter_AddRefs(url));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString relativeEntrySpec;
|
||||
rv = mJAREntry->GetRelativeSpec(url, relativeEntrySpec);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!StringBeginsWith(relativeEntrySpec, NS_BOGUS_ENTRY_SCHEME)) {
|
||||
// An actual relative spec!
|
||||
relativeSpec = relativeEntrySpec;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIJARURI methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetJARFile(nsIURI* *jarFile)
|
||||
{
|
||||
*jarFile = mJARFile;
|
||||
NS_ADDREF(*jarFile);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetJARFile(nsIURI* jarFile)
|
||||
{
|
||||
mJARFile = jarFile;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::GetJAREntry(nsACString &entryPath)
|
||||
{
|
||||
nsCAutoString filePath;
|
||||
mJAREntry->GetFilePath(filePath);
|
||||
NS_ASSERTION(filePath.Length() > 0, "path should never be empty!");
|
||||
// Trim off the leading '/'
|
||||
entryPath = Substring(filePath, 1, filePath.Length() - 1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARURI::SetJAREntry(const nsACString &entryPath)
|
||||
{
|
||||
return CreateEntryURL(entryPath, mCharsetHint.get(),
|
||||
getter_AddRefs(mJAREntry));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
|
@ -1,83 +0,0 @@
|
|||
/* -*- Mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* 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.org Code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsJARURI_h__
|
||||
#define nsJARURI_h__
|
||||
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsISerializable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#define NS_THIS_JARURI_IMPL_CID \
|
||||
{ /* 9a55f629-730b-4d08-b75b-fa7d9570a691 */ \
|
||||
0x9a55f629, \
|
||||
0x730b, \
|
||||
0x4d08, \
|
||||
{0xb7, 0x5b, 0xfa, 0x7d, 0x95, 0x70, 0xa6, 0x91} \
|
||||
}
|
||||
|
||||
class nsJARURI : public nsIJARURI, nsISerializable
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIURI
|
||||
NS_DECL_NSIURL
|
||||
NS_DECL_NSIJARURI
|
||||
NS_DECL_NSISERIALIZABLE
|
||||
|
||||
// nsJARURI
|
||||
nsJARURI();
|
||||
virtual ~nsJARURI();
|
||||
|
||||
nsresult Init(const char *charsetHint);
|
||||
nsresult FormatSpec(const nsACString &entryPath, nsACString &result,
|
||||
PRBool aIncludeScheme = PR_TRUE);
|
||||
nsresult CreateEntryURL(const nsACString& entryFilename,
|
||||
const char* charset,
|
||||
nsIURL** url);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mJARFile;
|
||||
// mJarEntry stored as a URL so that we can easily access things
|
||||
// like extensions, refs, etc.
|
||||
nsCOMPtr<nsIURL> mJAREntry;
|
||||
nsCString mCharsetHint;
|
||||
};
|
||||
|
||||
#endif // nsJARURI_h__
|
Загрузка…
Ссылка в новой задаче