2012-07-28 04:21:34 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "ArchiveZipFile.h"
|
|
|
|
#include "ArchiveZipEvent.h"
|
|
|
|
|
|
|
|
#include "nsIInputStream.h"
|
|
|
|
#include "zlib.h"
|
2012-07-29 04:33:58 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
USING_FILE_NAMESPACE
|
|
|
|
|
|
|
|
#define ZIP_CHUNK 16384
|
|
|
|
|
2012-11-07 03:23:13 +04:00
|
|
|
/**
|
|
|
|
* Input stream object for zip files
|
|
|
|
*/
|
2012-08-18 05:04:03 +04:00
|
|
|
class ArchiveInputStream MOZ_FINAL : public nsIInputStream,
|
|
|
|
public nsISeekableStream
|
2012-07-28 04:21:34 +04:00
|
|
|
{
|
|
|
|
public:
|
2012-08-22 19:56:38 +04:00
|
|
|
ArchiveInputStream(uint64_t aParentSize,
|
2012-08-18 05:04:03 +04:00
|
|
|
nsIInputStream* aInputStream,
|
2012-07-28 04:21:34 +04:00
|
|
|
nsString& aFilename,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aStart,
|
|
|
|
uint32_t aLength,
|
2012-07-28 04:21:34 +04:00
|
|
|
ZipCentral& aCentral)
|
2012-08-18 05:04:03 +04:00
|
|
|
: mCentral(aCentral),
|
2012-07-28 04:21:34 +04:00
|
|
|
mFilename(aFilename),
|
|
|
|
mStart(aStart),
|
|
|
|
mLength(aLength),
|
2012-08-08 22:11:15 +04:00
|
|
|
mStatus(NotStarted)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(ArchiveInputStream);
|
2012-08-18 05:04:03 +04:00
|
|
|
|
|
|
|
// Reset the data:
|
|
|
|
memset(&mData, 0, sizeof(mData));
|
|
|
|
|
|
|
|
mData.parentSize = aParentSize;
|
|
|
|
mData.inputStream = aInputStream;
|
2012-08-08 22:11:15 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2012-08-08 22:11:15 +04:00
|
|
|
virtual ~ArchiveInputStream()
|
2012-07-28 04:21:34 +04:00
|
|
|
{
|
2012-08-08 22:11:15 +04:00
|
|
|
MOZ_COUNT_DTOR(ArchiveInputStream);
|
2012-07-28 04:21:34 +04:00
|
|
|
Close();
|
|
|
|
}
|
|
|
|
|
2013-07-19 06:21:20 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2012-07-28 04:21:34 +04:00
|
|
|
NS_DECL_NSIINPUTSTREAM
|
2012-08-18 05:04:03 +04:00
|
|
|
NS_DECL_NSISEEKABLESTREAM
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
private: // data
|
|
|
|
ZipCentral mCentral;
|
|
|
|
nsString mFilename;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mStart;
|
|
|
|
uint32_t mLength;
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
z_stream mZs;
|
|
|
|
|
2012-08-08 22:11:15 +04:00
|
|
|
enum {
|
|
|
|
NotStarted,
|
|
|
|
Started,
|
|
|
|
Done
|
|
|
|
} mStatus;
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
struct {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t parentSize;
|
2012-07-28 04:21:34 +04:00
|
|
|
nsCOMPtr<nsIInputStream> inputStream;
|
2012-08-18 05:04:03 +04:00
|
|
|
|
2012-07-28 04:21:34 +04:00
|
|
|
unsigned char input[ZIP_CHUNK];
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t sizeToBeRead;
|
|
|
|
uint32_t cursor;
|
2012-08-18 05:04:03 +04:00
|
|
|
|
2012-07-28 04:21:34 +04:00
|
|
|
bool compressed; // a zip file can contain stored or compressed files
|
|
|
|
} mData;
|
|
|
|
};
|
|
|
|
|
2013-07-19 06:21:20 +04:00
|
|
|
NS_IMPL_ISUPPORTS2(ArchiveInputStream,
|
|
|
|
nsIInputStream,
|
|
|
|
nsISeekableStream)
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
nsresult
|
|
|
|
ArchiveInputStream::Init()
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
memset(&mZs, 0, sizeof(z_stream));
|
|
|
|
int zerr = inflateInit2(&mZs, -MAX_WBITS);
|
2012-11-07 03:23:13 +04:00
|
|
|
if (zerr != Z_OK) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
mData.sizeToBeRead = ArchiveZipItem::StrToInt32(mCentral.size);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t offset = ArchiveZipItem::StrToInt32(mCentral.localhdr_offset);
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2012-08-18 05:04:03 +04:00
|
|
|
// The file is corrupt
|
2012-11-07 03:23:13 +04:00
|
|
|
if (offset + ZIPLOCAL_SIZE > mData.parentSize) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
// From the input stream to a seekable stream
|
|
|
|
nsCOMPtr<nsISeekableStream> seekableStream;
|
|
|
|
seekableStream = do_QueryInterface(mData.inputStream);
|
2012-11-07 03:23:13 +04:00
|
|
|
if (!seekableStream) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
// Seek + read the ZipLocal struct
|
|
|
|
seekableStream->Seek(nsISeekableStream::NS_SEEK_SET, offset);
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t buffer[ZIPLOCAL_SIZE];
|
|
|
|
uint32_t ret;
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
rv = mData.inputStream->Read((char*)buffer, ZIPLOCAL_SIZE, &ret);
|
2012-11-07 03:23:13 +04:00
|
|
|
if (NS_FAILED(rv) || ret != ZIPLOCAL_SIZE) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
// Signature check:
|
2012-11-07 03:23:13 +04:00
|
|
|
if (ArchiveZipItem::StrToInt32(buffer) != LOCALSIG) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
ZipLocal local;
|
|
|
|
memcpy(&local, buffer, ZIPLOCAL_SIZE);
|
|
|
|
|
|
|
|
// Seek to the real data:
|
|
|
|
offset += ZIPLOCAL_SIZE +
|
|
|
|
ArchiveZipItem::StrToInt16(local.filename_len) +
|
|
|
|
ArchiveZipItem::StrToInt16(local.extrafield_len);
|
|
|
|
|
|
|
|
// The file is corrupt if there is not enough data
|
2012-11-07 03:23:13 +04:00
|
|
|
if (offset + mData.sizeToBeRead > mData.parentSize) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
// Data starts here:
|
|
|
|
seekableStream->Seek(nsISeekableStream::NS_SEEK_SET, offset);
|
|
|
|
|
|
|
|
// The file is compressed or not?
|
|
|
|
mData.compressed = (ArchiveZipItem::StrToInt16(mCentral.method) != 0);
|
|
|
|
|
|
|
|
// We have to skip the first mStart bytes:
|
|
|
|
if (mStart != 0) {
|
2012-08-18 05:04:03 +04:00
|
|
|
rv = Seek(NS_SEEK_SET, mStart);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2012-07-28 04:21:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
ArchiveInputStream::Close()
|
|
|
|
{
|
2012-08-08 22:11:15 +04:00
|
|
|
if (mStatus != NotStarted) {
|
2012-07-28 04:21:34 +04:00
|
|
|
inflateEnd(&mZs);
|
2012-08-08 22:11:15 +04:00
|
|
|
mStatus = NotStarted;
|
2012-07-28 04:21:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
ArchiveInputStream::Available(uint64_t* _retval)
|
2012-07-28 04:21:34 +04:00
|
|
|
{
|
2012-08-18 05:04:03 +04:00
|
|
|
*_retval = mLength - mData.cursor - mStart;
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
ArchiveInputStream::Read(char* aBuffer,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aCount,
|
|
|
|
uint32_t* _retval)
|
2012-07-28 04:21:34 +04:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aBuffer);
|
|
|
|
NS_ENSURE_ARG_POINTER(_retval);
|
|
|
|
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// This is the first time:
|
2012-08-08 22:11:15 +04:00
|
|
|
if (mStatus == NotStarted) {
|
|
|
|
mStatus = Started;
|
|
|
|
|
2012-07-28 04:21:34 +04:00
|
|
|
rv = Init();
|
2012-11-07 03:23:13 +04:00
|
|
|
if (NS_FAILED(rv)) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return rv;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-08-08 22:11:15 +04:00
|
|
|
|
|
|
|
// Let's set avail_out to -1 so we read something from the stream.
|
|
|
|
mZs.avail_out = (uInt)-1;
|
2012-07-28 04:21:34 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Nothing more can be read
|
2012-08-08 22:11:15 +04:00
|
|
|
if (mStatus == Done) {
|
2012-07-28 04:21:34 +04:00
|
|
|
*_retval = 0;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stored file:
|
2012-11-07 03:23:13 +04:00
|
|
|
if (!mData.compressed) {
|
2012-07-28 04:21:34 +04:00
|
|
|
rv = mData.inputStream->Read(aBuffer,
|
|
|
|
(mData.sizeToBeRead > aCount ?
|
2012-08-18 05:04:03 +04:00
|
|
|
aCount : mData.sizeToBeRead),
|
2012-07-28 04:21:34 +04:00
|
|
|
_retval);
|
2012-08-18 05:04:03 +04:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2012-07-28 04:21:34 +04:00
|
|
|
mData.sizeToBeRead -= *_retval;
|
2012-08-18 05:04:03 +04:00
|
|
|
mData.cursor += *_retval;
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2012-11-07 03:23:13 +04:00
|
|
|
if (mData.sizeToBeRead == 0) {
|
2012-08-08 22:11:15 +04:00
|
|
|
mStatus = Done;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-08-08 22:11:15 +04:00
|
|
|
}
|
|
|
|
|
2012-07-28 04:21:34 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// We have nothing ready to be processed:
|
2012-11-07 03:23:13 +04:00
|
|
|
if (mZs.avail_out != 0 && mData.sizeToBeRead != 0) {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t ret;
|
2012-07-28 04:21:34 +04:00
|
|
|
rv = mData.inputStream->Read((char*)mData.input,
|
|
|
|
(mData.sizeToBeRead > sizeof(mData.input) ?
|
|
|
|
sizeof(mData.input) : mData.sizeToBeRead),
|
|
|
|
&ret);
|
2012-11-07 03:23:13 +04:00
|
|
|
if (NS_FAILED(rv)) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return rv;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
// Terminator:
|
|
|
|
if (ret == 0) {
|
|
|
|
*_retval = 0;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
mData.sizeToBeRead -= ret;
|
|
|
|
mZs.avail_in = ret;
|
|
|
|
mZs.next_in = mData.input;
|
|
|
|
}
|
|
|
|
|
|
|
|
mZs.avail_out = aCount;
|
|
|
|
mZs.next_out = (unsigned char*)aBuffer;
|
|
|
|
|
2012-08-08 22:11:15 +04:00
|
|
|
int ret = inflate(&mZs, mData.sizeToBeRead ? Z_NO_FLUSH : Z_FINISH);
|
2012-11-07 03:23:13 +04:00
|
|
|
if (ret != Z_BUF_ERROR && ret != Z_OK && ret != Z_STREAM_END) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2012-11-07 03:23:13 +04:00
|
|
|
if (ret == Z_STREAM_END) {
|
2012-08-08 22:11:15 +04:00
|
|
|
mStatus = Done;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-08-08 22:11:15 +04:00
|
|
|
|
2012-07-28 04:21:34 +04:00
|
|
|
*_retval = aCount - mZs.avail_out;
|
2012-08-18 05:04:03 +04:00
|
|
|
mData.cursor += *_retval;
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
ArchiveInputStream::ReadSegments(nsWriteSegmentFun aWriter,
|
|
|
|
void* aClosure,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aCount,
|
|
|
|
uint32_t* _retval)
|
2012-07-28 04:21:34 +04:00
|
|
|
{
|
|
|
|
// don't have a buffer to read from, so this better not be called!
|
|
|
|
NS_NOTREACHED("Consumers should be using Read()!");
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
ArchiveInputStream::IsNonBlocking(bool* _retval)
|
|
|
|
{
|
|
|
|
// We are blocking
|
|
|
|
*_retval = false;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-08-18 05:04:03 +04:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
ArchiveInputStream::Seek(int32_t aWhence, int64_t aOffset)
|
2012-08-18 05:04:03 +04:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
int64_t pos = aOffset;
|
2012-08-18 05:04:03 +04:00
|
|
|
|
|
|
|
switch (aWhence) {
|
|
|
|
case NS_SEEK_SET:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_SEEK_CUR:
|
|
|
|
pos += mData.cursor;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_SEEK_END:
|
|
|
|
pos += mLength;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
NS_NOTREACHED("unexpected whence value");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2012-11-07 03:23:13 +04:00
|
|
|
if (pos == int64_t(mData.cursor)) {
|
2012-08-18 05:04:03 +04:00
|
|
|
return NS_OK;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-08-18 05:04:03 +04:00
|
|
|
|
2012-11-07 03:23:13 +04:00
|
|
|
if (pos < 0 || pos >= mLength) {
|
2012-08-18 05:04:03 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-08-18 05:04:03 +04:00
|
|
|
|
|
|
|
// We have to terminate the previous operation:
|
|
|
|
nsresult rv;
|
|
|
|
if (mStatus != NotStarted) {
|
|
|
|
rv = Close();
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reset the cursor:
|
|
|
|
mData.cursor = 0;
|
|
|
|
|
|
|
|
// Note: This code is heavy but inflate does not have any seek() support:
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t ret;
|
2012-08-18 05:04:03 +04:00
|
|
|
char buffer[1024];
|
|
|
|
while (pos > 0) {
|
2012-08-22 19:56:38 +04:00
|
|
|
rv = Read(buffer, pos > int64_t(sizeof(buffer)) ? sizeof(buffer) : pos, &ret);
|
2012-11-07 03:23:13 +04:00
|
|
|
if (NS_FAILED(rv)) {
|
2012-08-18 05:04:03 +04:00
|
|
|
return rv;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-08-18 05:04:03 +04:00
|
|
|
|
2012-11-07 03:23:13 +04:00
|
|
|
if (ret == 0) {
|
2012-08-18 05:04:03 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-08-18 05:04:03 +04:00
|
|
|
|
|
|
|
pos -= ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 19:56:38 +04:00
|
|
|
ArchiveInputStream::Tell(int64_t *aResult)
|
2012-08-18 05:04:03 +04:00
|
|
|
{
|
2012-10-26 03:25:57 +04:00
|
|
|
*aResult = mData.cursor;
|
2012-08-18 05:04:03 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
ArchiveInputStream::SetEOF()
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
// ArchiveZipFile
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
ArchiveZipFile::GetInternalStream(nsIInputStream** aStream)
|
|
|
|
{
|
2012-11-07 03:23:13 +04:00
|
|
|
if (mLength > INT32_MAX) {
|
2012-07-28 04:21:34 +04:00
|
|
|
return NS_ERROR_FAILURE;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t size;
|
2012-08-18 05:04:03 +04:00
|
|
|
nsresult rv = mArchiveReader->GetSize(&size);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIInputStream> inputStream;
|
|
|
|
rv = mArchiveReader->GetInputStream(getter_AddRefs(inputStream));
|
2012-11-07 03:23:13 +04:00
|
|
|
if (NS_FAILED(rv) || !inputStream) {
|
2012-08-18 05:04:03 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-08-18 05:04:03 +04:00
|
|
|
|
|
|
|
nsRefPtr<ArchiveInputStream> stream = new ArchiveInputStream(size,
|
|
|
|
inputStream,
|
2012-07-28 04:21:34 +04:00
|
|
|
mFilename,
|
|
|
|
mStart,
|
|
|
|
mLength,
|
|
|
|
mCentral);
|
|
|
|
NS_ADDREF(stream);
|
|
|
|
|
|
|
|
*aStream = stream;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsIDOMBlob>
|
2012-08-22 19:56:38 +04:00
|
|
|
ArchiveZipFile::CreateSlice(uint64_t aStart,
|
|
|
|
uint64_t aLength,
|
2012-07-28 04:21:34 +04:00
|
|
|
const nsAString& aContentType)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIDOMBlob> t = new ArchiveZipFile(mFilename,
|
|
|
|
mContentType,
|
|
|
|
aStart,
|
|
|
|
mLength,
|
|
|
|
mCentral,
|
|
|
|
mArchiveReader);
|
|
|
|
return t.forget();
|
|
|
|
}
|
|
|
|
|
2012-12-02 12:53:35 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_1(ArchiveZipFile,
|
|
|
|
mArchiveReader)
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ArchiveZipFile)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFile)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMBlob)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIDOMFile, mIsFile)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIXHRSendable)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIMutable)
|
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsDOMFileCC)
|
|
|
|
|
2013-07-09 21:30:58 +04:00
|
|
|
NS_IMPL_ADDREF_INHERITED(ArchiveZipFile, nsDOMFileCC)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(ArchiveZipFile, nsDOMFileCC)
|