2000-06-07 13:07:10 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
1999-11-08 00:55:12 +03:00
|
|
|
*
|
2004-04-19 02:01:16 +04:00
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-11-08 00:55:12 +03:00
|
|
|
*
|
2004-04-19 02:01:16 +04:00
|
|
|
* 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
|
1999-11-08 00:55:12 +03:00
|
|
|
* for the specific language governing rights and limitations under the
|
2004-04-19 02:01:16 +04:00
|
|
|
* 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.
|
1999-11-08 00:55:12 +03:00
|
|
|
*
|
2004-04-19 02:01:16 +04:00
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-11-08 00:55:12 +03:00
|
|
|
|
|
|
|
#include "nsJARURI.h"
|
1999-11-30 07:50:42 +03:00
|
|
|
#include "nsNetUtil.h"
|
1999-11-08 00:55:12 +03:00
|
|
|
#include "nsIIOService.h"
|
2004-09-14 22:32:13 +04:00
|
|
|
#include "nsIStandardURL.h"
|
1999-11-08 00:55:12 +03:00
|
|
|
#include "nsCRT.h"
|
|
|
|
#include "nsIComponentManager.h"
|
|
|
|
#include "nsIServiceManager.h"
|
1999-11-12 09:13:13 +03:00
|
|
|
#include "nsIZipReader.h"
|
2001-09-29 12:28:41 +04:00
|
|
|
#include "nsReadableUtils.h"
|
2004-05-21 03:29:52 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2004-12-02 10:00:25 +03:00
|
|
|
#include "nsNetCID.h"
|
|
|
|
#include "nsIObjectInputStream.h"
|
|
|
|
#include "nsIObjectOutputStream.h"
|
2006-03-15 07:59:42 +03:00
|
|
|
#include "nsIProgrammingLanguage.h"
|
2004-12-02 10:00:25 +03:00
|
|
|
|
|
|
|
static NS_DEFINE_CID(kJARURICID, NS_JARURI_CID);
|
2004-05-21 03:29:52 +04:00
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
nsJARURI::nsJARURI()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsJARURI::~nsJARURI()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2004-12-02 10:00:25 +03:00
|
|
|
// XXX Why is this threadsafe?
|
2004-05-21 03:29:52 +04:00
|
|
|
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)
|
2004-12-02 10:00:25 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
2006-05-02 22:54:19 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsINestedURI)
|
2004-05-21 03:29:52 +04:00
|
|
|
// see nsJARURI::Equals
|
2005-01-24 02:03:39 +03:00
|
|
|
if (aIID.Equals(NS_GET_IID(nsJARURI)))
|
2007-03-23 02:01:14 +03:00
|
|
|
foundInterface = NS_REINTERPRET_CAST(nsISupports*, this);
|
2004-05-21 03:29:52 +04:00
|
|
|
else
|
|
|
|
NS_INTERFACE_MAP_END
|
1999-11-08 00:55:12 +03:00
|
|
|
|
|
|
|
nsresult
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::Init(const char *charsetHint)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2002-03-06 10:48:55 +03:00
|
|
|
mCharsetHint = charsetHint;
|
1999-11-08 00:55:12 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-03-06 10:48:55 +03:00
|
|
|
#define NS_JAR_SCHEME NS_LITERAL_CSTRING("jar:")
|
|
|
|
#define NS_JAR_DELIMITER NS_LITERAL_CSTRING("!/")
|
2003-11-17 00:43:43 +03:00
|
|
|
#define NS_BOGUS_ENTRY_SCHEME NS_LITERAL_CSTRING("x:///")
|
1999-11-08 00:55:12 +03:00
|
|
|
|
2003-11-17 00:43:43 +03:00
|
|
|
// FormatSpec takes the entry spec (including the "x:///" at the
|
|
|
|
// beginning) and gives us a full JAR spec.
|
2000-01-27 11:57:14 +03:00
|
|
|
nsresult
|
2003-11-17 00:43:43 +03:00
|
|
|
nsJARURI::FormatSpec(const nsACString &entrySpec, nsACString &result,
|
2003-10-04 02:15:24 +04:00
|
|
|
PRBool aIncludeScheme)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2003-11-17 00:43:43 +03:00
|
|
|
// The entrySpec MUST start with "x:///"
|
|
|
|
NS_ASSERTION(StringBeginsWith(entrySpec, NS_BOGUS_ENTRY_SCHEME),
|
|
|
|
"bogus entry spec");
|
|
|
|
|
2002-03-06 10:48:55 +03:00
|
|
|
nsCAutoString fileSpec;
|
|
|
|
nsresult rv = mJARFile->GetSpec(fileSpec);
|
1999-11-08 00:55:12 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2003-10-04 02:15:24 +04:00
|
|
|
if (aIncludeScheme)
|
|
|
|
result = NS_JAR_SCHEME;
|
2003-11-17 00:43:43 +03:00
|
|
|
else
|
|
|
|
result.Truncate();
|
|
|
|
|
|
|
|
result.Append(fileSpec + NS_JAR_DELIMITER +
|
|
|
|
Substring(entrySpec, 5, entrySpec.Length() - 5));
|
2001-12-15 23:34:07 +03:00
|
|
|
return NS_OK;
|
2000-01-27 11:57:14 +03:00
|
|
|
}
|
|
|
|
|
2003-11-17 00:43:43 +03:00
|
|
|
nsresult
|
|
|
|
nsJARURI::CreateEntryURL(const nsACString& entryFilename,
|
|
|
|
const char* charset,
|
|
|
|
nsIURL** url)
|
|
|
|
{
|
|
|
|
*url = nsnull;
|
2004-09-14 22:32:13 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIStandardURL> stdURL(do_CreateInstance(NS_STANDARDURL_CONTRACTID));
|
2003-11-17 00:43:43 +03:00
|
|
|
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)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2004-09-14 22:32:13 +04:00
|
|
|
return CallQueryInterface(stdURL, url);
|
2003-11-17 00:43:43 +03:00
|
|
|
}
|
|
|
|
|
2000-01-27 11:57:14 +03:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2001-07-31 23:05:34 +04:00
|
|
|
// nsISerializable methods:
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-12-02 10:00:25 +03:00
|
|
|
nsJARURI::Read(nsIObjectInputStream* aInputStream)
|
2001-07-31 23:05:34 +04:00
|
|
|
{
|
2004-12-02 10:00:25 +03:00
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
rv = aInputStream->ReadObject(PR_TRUE, getter_AddRefs(mJARFile));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
rv = aInputStream->ReadObject(PR_TRUE, getter_AddRefs(mJAREntry));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
rv = aInputStream->ReadCString(mCharsetHint);
|
|
|
|
return rv;
|
2001-07-31 23:05:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-12-02 10:00:25 +03:00
|
|
|
nsJARURI::Write(nsIObjectOutputStream* aOutputStream)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
rv = aOutputStream->WriteCompoundObject(mJARFile, NS_GET_IID(nsIURI),
|
|
|
|
PR_TRUE);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
rv = aOutputStream->WriteCompoundObject(mJAREntry, NS_GET_IID(nsIURL),
|
|
|
|
PR_TRUE);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
rv = aOutputStream->WriteStringZ(mCharsetHint.get());
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsIClassInfo methods:
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetInterfaces(PRUint32 *count, nsIID * **array)
|
|
|
|
{
|
|
|
|
*count = 0;
|
|
|
|
*array = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetHelperForLanguage(PRUint32 language, nsISupports **_retval)
|
|
|
|
{
|
|
|
|
*_retval = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetContractID(char * *aContractID)
|
2001-07-31 23:05:34 +04:00
|
|
|
{
|
2004-12-02 10:00:25 +03:00
|
|
|
*aContractID = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetClassDescription(char * *aClassDescription)
|
|
|
|
{
|
|
|
|
*aClassDescription = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetClassID(nsCID * *aClassID)
|
|
|
|
{
|
|
|
|
*aClassID = (nsCID*) nsMemory::Alloc(sizeof(nsCID));
|
|
|
|
if (!*aClassID)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
return GetClassIDNoAlloc(*aClassID);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetImplementationLanguage(PRUint32 *aImplementationLanguage)
|
|
|
|
{
|
|
|
|
*aImplementationLanguage = nsIProgrammingLanguage::CPLUSPLUS;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetFlags(PRUint32 *aFlags)
|
|
|
|
{
|
|
|
|
// XXX We implement THREADSAFE addref/release, but probably shouldn't.
|
|
|
|
*aFlags = nsIClassInfo::MAIN_THREAD_ONLY;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetClassIDNoAlloc(nsCID *aClassIDNoAlloc)
|
|
|
|
{
|
|
|
|
*aClassIDNoAlloc = kJARURICID;
|
|
|
|
return NS_OK;
|
2001-07-31 23:05:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsIURI methods:
|
2000-01-27 11:57:14 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetSpec(nsACString &aSpec)
|
2000-01-27 11:57:14 +03:00
|
|
|
{
|
2003-11-17 00:43:43 +03:00
|
|
|
nsCAutoString entrySpec;
|
|
|
|
mJAREntry->GetSpec(entrySpec);
|
|
|
|
return FormatSpec(entrySpec, aSpec);
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-01-24 02:03:39 +03:00
|
|
|
nsJARURI::SetSpec(const nsACString& aSpec)
|
|
|
|
{
|
|
|
|
return SetSpecWithBase(aSpec, nsnull);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsJARURI::SetSpecWithBase(const nsACString &aSpec, nsIURI* aBaseURL)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
|
|
|
nsresult rv;
|
2005-01-24 02:03:39 +03:00
|
|
|
|
2002-08-15 22:38:46 +04:00
|
|
|
nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
|
2005-01-24 02:03:39 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
1999-11-08 00:55:12 +03:00
|
|
|
|
2002-03-06 10:48:55 +03:00
|
|
|
nsCAutoString scheme;
|
2004-09-14 22:32:13 +04:00
|
|
|
rv = ioServ->ExtractScheme(aSpec, scheme);
|
2005-01-24 02:03:39 +03:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
// not an absolute URI
|
|
|
|
if (!aBaseURL)
|
|
|
|
return NS_ERROR_MALFORMED_URI;
|
1999-11-08 00:55:12 +03:00
|
|
|
|
2005-01-24 02:03:39 +03:00
|
|
|
nsRefPtr<nsJARURI> otherJAR;
|
|
|
|
aBaseURL->QueryInterface(NS_GET_IID(nsJARURI), getter_AddRefs(otherJAR));
|
|
|
|
NS_ENSURE_TRUE(otherJAR, NS_NOINTERFACE);
|
|
|
|
|
|
|
|
mJARFile = otherJAR->mJARFile;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIStandardURL> entry(do_CreateInstance(NS_STANDARDURL_CONTRACTID));
|
|
|
|
if (!entry)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
rv = entry->Init(nsIStandardURL::URLTYPE_NO_AUTHORITY, -1,
|
|
|
|
aSpec, mCharsetHint.get(), otherJAR->mJAREntry);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
mJAREntry = do_QueryInterface(entry);
|
|
|
|
if (!mJAREntry)
|
|
|
|
return NS_NOINTERFACE;
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ENSURE_TRUE(scheme.EqualsLiteral("jar"), NS_ERROR_MALFORMED_URI);
|
|
|
|
|
|
|
|
nsACString::const_iterator begin, end;
|
|
|
|
aSpec.BeginReading(begin);
|
|
|
|
aSpec.EndReading(end);
|
|
|
|
|
|
|
|
while (begin != end && *begin != ':')
|
|
|
|
++begin;
|
|
|
|
|
|
|
|
++begin; // now we're past the "jar:"
|
1999-11-08 00:55:12 +03:00
|
|
|
|
|
|
|
// 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.
|
2005-01-24 02:03:39 +03:00
|
|
|
// Also, the outermost "inner" URI may be a relative URI:
|
|
|
|
// jar:../relative.jar!/a.html
|
1999-11-08 00:55:12 +03:00
|
|
|
|
2005-01-24 02:03:39 +03:00
|
|
|
nsACString::const_iterator delim_begin (begin),
|
|
|
|
delim_end (end);
|
2002-03-06 10:48:55 +03:00
|
|
|
|
|
|
|
if (!RFindInReadable(NS_JAR_DELIMITER, delim_begin, delim_end))
|
1999-11-08 00:55:12 +03:00
|
|
|
return NS_ERROR_MALFORMED_URI;
|
|
|
|
|
2005-01-24 02:03:39 +03:00
|
|
|
rv = ioServ->NewURI(Substring(begin, delim_begin), mCharsetHint.get(),
|
|
|
|
aBaseURL, getter_AddRefs(mJARFile));
|
1999-11-08 00:55:12 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2006-05-02 22:54:19 +04:00
|
|
|
NS_TryToSetImmutable(mJARFile);
|
|
|
|
|
2002-03-06 10:48:55 +03:00
|
|
|
// skip over any extra '/' chars
|
|
|
|
while (*delim_end == '/')
|
|
|
|
++delim_end;
|
1999-11-08 00:55:12 +03:00
|
|
|
|
2003-11-17 00:43:43 +03:00
|
|
|
return SetJAREntry(Substring(delim_end, end));
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
2000-05-17 11:12:40 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetPrePath(nsACString &prePath)
|
|
|
|
{
|
2003-10-04 02:15:24 +04:00
|
|
|
prePath = NS_JAR_SCHEME;
|
2002-03-06 10:48:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetScheme(nsACString &aScheme)
|
2000-05-17 11:12:40 +04:00
|
|
|
{
|
2002-03-06 10:48:55 +03:00
|
|
|
aScheme = "jar";
|
|
|
|
return NS_OK;
|
2000-05-17 11:12:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::SetScheme(const nsACString &aScheme)
|
2000-05-17 11:12:40 +04:00
|
|
|
{
|
2002-03-06 10:48:55 +03:00
|
|
|
// doesn't make sense to set the scheme of a jar: URL
|
|
|
|
return NS_ERROR_FAILURE;
|
2000-05-17 11:12:40 +04:00
|
|
|
}
|
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetUserPass(nsACString &aUserPass)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2002-03-06 10:48:55 +03:00
|
|
|
return NS_ERROR_FAILURE;
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::SetUserPass(const nsACString &aUserPass)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2000-01-27 11:57:14 +03:00
|
|
|
return NS_ERROR_FAILURE;
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
2000-02-03 06:44:22 +03:00
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetUsername(nsACString &aUsername)
|
2000-02-03 06:44:22 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::SetUsername(const nsACString &aUsername)
|
2000-02-03 06:44:22 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetPassword(nsACString &aPassword)
|
2000-02-03 06:44:22 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::SetPassword(const nsACString &aPassword)
|
2000-02-03 06:44:22 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetHostPort(nsACString &aHostPort)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::SetHostPort(const nsACString &aHostPort)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetHost(nsACString &aHost)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::SetHost(const nsACString &aHost)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
|
|
|
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
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetPath(nsACString &aPath)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2003-11-17 00:43:43 +03:00
|
|
|
nsCAutoString entrySpec;
|
|
|
|
mJAREntry->GetSpec(entrySpec);
|
|
|
|
return FormatSpec(entrySpec, aPath, PR_FALSE);
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::SetPath(const nsACString &aPath)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2002-03-06 10:48:55 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetAsciiSpec(nsACString &aSpec)
|
|
|
|
{
|
2003-11-17 00:43:43 +03:00
|
|
|
// XXX Shouldn't this like... make sure it returns ASCII or something?
|
2002-03-06 10:48:55 +03:00
|
|
|
return GetSpec(aSpec);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetAsciiHost(nsACString &aHost)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetOriginCharset(nsACString &aOriginCharset)
|
|
|
|
{
|
2003-11-17 00:43:43 +03:00
|
|
|
aOriginCharset = mCharsetHint;
|
2002-03-06 10:48:55 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
NS_IMETHODIMP
|
2000-01-27 11:57:14 +03:00
|
|
|
nsJARURI::Equals(nsIURI *other, PRBool *result)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2005-01-24 02:03:39 +03:00
|
|
|
nsresult rv;
|
|
|
|
|
2000-01-27 11:57:14 +03:00
|
|
|
*result = PR_FALSE;
|
|
|
|
|
2000-06-16 11:47:46 +04:00
|
|
|
if (other == nsnull)
|
|
|
|
return NS_OK; // not equal
|
|
|
|
|
2004-05-21 03:29:52 +04:00
|
|
|
nsRefPtr<nsJARURI> otherJAR;
|
2005-01-24 02:03:39 +03:00
|
|
|
other->QueryInterface(NS_GET_IID(nsJARURI), getter_AddRefs(otherJAR));
|
|
|
|
if (!otherJAR)
|
2000-01-27 11:57:14 +03:00
|
|
|
return NS_OK; // not equal
|
|
|
|
|
|
|
|
PRBool equal;
|
2004-05-21 03:29:52 +04:00
|
|
|
rv = mJARFile->Equals(otherJAR->mJARFile, &equal);
|
|
|
|
if (NS_FAILED(rv) || !equal) {
|
|
|
|
return rv; // not equal
|
|
|
|
}
|
2000-01-27 11:57:14 +03:00
|
|
|
|
2004-05-21 03:29:52 +04:00
|
|
|
rv = mJAREntry->Equals(otherJAR->mJAREntry, result);
|
2003-11-17 00:43:43 +03:00
|
|
|
return rv;
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
2001-01-31 04:33:03 +03:00
|
|
|
NS_IMETHODIMP
|
2001-03-13 05:01:07 +03:00
|
|
|
nsJARURI::SchemeIs(const char *i_Scheme, PRBool *o_Equals)
|
2001-01-31 04:33:03 +03:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(o_Equals);
|
2001-03-13 05:01:07 +03:00
|
|
|
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;
|
|
|
|
}
|
2001-01-31 04:33:03 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-08 00:55:12 +03:00
|
|
|
NS_IMETHODIMP
|
2000-01-27 11:57:14 +03:00
|
|
|
nsJARURI::Clone(nsIURI **result)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2000-01-27 11:57:14 +03:00
|
|
|
nsresult rv;
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
nsCOMPtr<nsIURI> newJARFile;
|
|
|
|
rv = mJARFile->Clone(getter_AddRefs(newJARFile));
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
NS_TryToSetImmutable(newJARFile);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> newJAREntryURI;
|
|
|
|
rv = mJAREntry->Clone(getter_AddRefs(newJAREntryURI));
|
2003-11-17 00:43:43 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
2000-01-27 11:57:14 +03:00
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
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;
|
|
|
|
rv = NS_OK;
|
|
|
|
} else {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::Resolve(const nsACString &relativePath, nsACString &result)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2000-01-27 11:57:14 +03:00
|
|
|
nsresult rv;
|
2000-06-07 13:07:10 +04:00
|
|
|
|
2004-09-14 22:32:13 +04:00
|
|
|
nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsCAutoString scheme;
|
|
|
|
rv = ioServ->ExtractScheme(relativePath, scheme);
|
2000-06-07 13:07:10 +04:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
// then aSpec is absolute
|
2002-03-06 10:48:55 +03:00
|
|
|
result = relativePath;
|
2000-06-07 13:07:10 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2003-11-17 00:43:43 +03:00
|
|
|
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)
|
|
|
|
{
|
2007-01-30 04:15:02 +03:00
|
|
|
return mJAREntry->GetQuery(query);
|
2003-11-17 00:43:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::SetQuery(const nsACString& query)
|
|
|
|
{
|
2007-01-30 04:15:02 +03:00
|
|
|
return mJAREntry->SetQuery(query);
|
2003-11-17 00:43:43 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2003-03-15 23:00:20 +03:00
|
|
|
}
|
2003-11-17 00:43:43 +03:00
|
|
|
|
|
|
|
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);
|
2000-01-27 11:57:14 +03:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
2003-11-17 00:43:43 +03:00
|
|
|
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;
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
Bit checkin for bug 68045, r/sr=waterson&shaver, second attempt. It all works
for me on optimized and debug gcc2.96, rh7.1.
- Better failure codes from nsXULPrototypeScript::Deserialize.
- Call nsXULDocument::AbortFastLoads after nsXULPrototypeScript::Serialize
failure, instead of just nulling the FastLoad service's output stream.
- Expose nsXULDocument::AbortFastLoads via nsIXULPrototypeCache, for use from
nsChromeProtocolHandler.cpp. AbortFastLoads flushes the XUL cache now, for
good measure.
- The needless "Current" adjective in nsIFastLoadService attribute and method
names is no more.
- Add a do_GetFastLoadService() helper, to use CID instead of contractid, and
to let the compiler consolidate the static inline CID.
- Add "nglayout.debug.checksum_xul_fastload_file" pref so people can do without
the checksum verification step when reading a FastLoad file.
- Verify the FastLoad file checksum, by default. Also, cache it in the FastLoad
service so we don't recompute it when re-opening the FastLoad file as mailnews
and other top-levels start up. Fill the checksum cache in EndFastLoad, when
the last pseudo-concurrent top-level finishes loading.
My hope to compute the checksum while writing the FastLoad file ran afoul of
misordered writes. The old code to checksum the in-memory nsFastLoadHeader
also was broken on little endian platforms. Now all checksumming is done via
a separate read pass over the complete file, save for the header's checksum
field, which is summed as if it contained zero.
- Track and check FastLoad file dependencies. This required groveling with a
bunch of Necko interfaces in nsChromeProtocolHandler::NewChannel -- read it
and weep. Dependency checking, as well as checksum access and computation,
use better-factored nsIFastLoad{File,Read,Write}Control interfaces.
- nsBufferedStream::Seek wasn't flushing the buffer when seeking backward
within the buffer, but it must, because mCursor bounds the amount to write
if the buffer contains the end of file.
- Add an unbufferedStream readonly attribute to nsIStreamBufferAccess, so we
don't have to screw around with the bufferying layer when checksumming. Also
implement nsIStreamBufferAccess in nsBufferedOutputStream.
- nsISeekableOutputStream was bogus, based on a bad state I had put the
nsBufferedOutputStream code in on its way from being completely broken when
you seek backwards outside of the buffer. Removing this interface required
using nsIFastLoadFileIO in nsFastLoadFileWriter, and it also required careful
ordering of Close calls (the Reader must close after the Writer or Updater,
so that the Reader's underlying, unbuffered input stream can be read by
nsFastLoadFileWriter::Close to compute the checksum.
- Miscellaneous tab/indentation, comment typo, bracing, if( => if ( style,
nsnull vs. 0, useless variable elimination, tortured control flow,
AutoString instead of String, and gratuitous ; after nsISupportsUtils.h
macro call cleanups.
2001-08-22 00:51:34 +04:00
|
|
|
// nsIJARURI methods:
|
1999-11-08 00:55:12 +03:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-01-27 11:57:14 +03:00
|
|
|
nsJARURI::GetJARFile(nsIURI* *jarFile)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2006-05-02 22:54:19 +04:00
|
|
|
return GetInnerURI(jarFile);
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::GetJAREntry(nsACString &entryPath)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2003-11-17 00:43:43 +03:00
|
|
|
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);
|
2002-03-06 10:48:55 +03:00
|
|
|
return NS_OK;
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-06 10:48:55 +03:00
|
|
|
nsJARURI::SetJAREntry(const nsACString &entryPath)
|
1999-11-08 00:55:12 +03:00
|
|
|
{
|
2003-11-17 00:43:43 +03:00
|
|
|
return CreateEntryURL(entryPath, mCharsetHint.get(),
|
|
|
|
getter_AddRefs(mJAREntry));
|
1999-11-08 00:55:12 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2006-05-02 22:54:19 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetInnerURI(nsIURI **uri)
|
|
|
|
{
|
|
|
|
return NS_EnsureSafeToReturn(mJARFile, uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsJARURI::GetInnermostURI(nsIURI** uri)
|
|
|
|
{
|
|
|
|
return NS_ImplGetInnermostURI(this, uri);
|
|
|
|
}
|
|
|
|
|