2012-07-28 04:21:34 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 22:32:37 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-07-28 04:21:34 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "ArchiveZipFile.h"
|
|
|
|
#include "ArchiveZipEvent.h"
|
|
|
|
|
|
|
|
#include "nsIInputStream.h"
|
|
|
|
#include "zlib.h"
|
2012-07-29 04:33:58 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-10-08 20:15:23 +04:00
|
|
|
#include "mozilla/dom/File.h"
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2014-10-08 20:15:22 +04:00
|
|
|
using namespace mozilla::dom;
|
2014-05-07 18:32:12 +04:00
|
|
|
USING_ARCHIVEREADER_NAMESPACE
|
2012-07-28 04:21:34 +04:00
|
|
|
|
|
|
|
#define ZIP_CHUNK 16384
|
|
|
|
|
2012-11-07 03:23:13 +04:00
|
|
|
/**
|
|
|
|
* Input stream object for zip files
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class ArchiveInputStream final : public nsIInputStream,
|
2015-03-27 21:52:19 +03:00
|
|
|
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
|
|
|
|
2014-06-23 23:56:07 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
|
|
NS_DECL_NSIINPUTSTREAM
|
|
|
|
NS_DECL_NSISEEKABLESTREAM
|
|
|
|
|
|
|
|
private:
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(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
|
2015-06-04 17:04:10 +03:00
|
|
|
if (mData.parentSize < ZIPLOCAL_SIZE ||
|
|
|
|
offset > mData.parentSize - 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
|
|
|
|
|
|
|
// 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
|
2015-06-04 17:04:10 +03:00
|
|
|
if (mData.parentSize < mData.sizeToBeRead ||
|
|
|
|
offset > mData.parentSize - mData.sizeToBeRead) {
|
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
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
// ArchiveZipBlobImpl
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2015-05-19 17:36:37 +03:00
|
|
|
void
|
|
|
|
ArchiveZipBlobImpl::GetInternalStream(nsIInputStream** aStream,
|
|
|
|
ErrorResult& aRv)
|
2012-07-28 04:21:34 +04:00
|
|
|
{
|
2012-11-07 03:23:13 +04:00
|
|
|
if (mLength > INT32_MAX) {
|
2015-05-19 17:36:37 +03:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return;
|
2012-11-07 03:23:13 +04:00
|
|
|
}
|
2012-07-28 04:21:34 +04:00
|
|
|
|
2015-05-19 17:36:37 +03:00
|
|
|
uint64_t size = mBlobImpl->GetSize(aRv);
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
return;
|
2015-01-12 00:34:57 +03:00
|
|
|
}
|
2012-08-18 05:04:03 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIInputStream> inputStream;
|
2015-05-19 17:36:37 +03:00
|
|
|
mBlobImpl->GetInternalStream(getter_AddRefs(inputStream), aRv);
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
return;
|
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);
|
|
|
|
|
2014-12-25 23:18:38 +03:00
|
|
|
stream.forget(aStream);
|
2012-07-28 04:21:34 +04:00
|
|
|
}
|
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
already_AddRefed<mozilla::dom::BlobImpl>
|
|
|
|
ArchiveZipBlobImpl::CreateSlice(uint64_t aStart,
|
2014-06-26 20:47:44 +04:00
|
|
|
uint64_t aLength,
|
2014-10-08 20:15:22 +04:00
|
|
|
const nsAString& aContentType,
|
2014-10-08 23:39:25 +04:00
|
|
|
mozilla::ErrorResult& aRv)
|
2014-06-26 20:47:44 +04:00
|
|
|
{
|
2015-05-12 15:11:03 +03:00
|
|
|
nsRefPtr<BlobImpl> impl =
|
|
|
|
new ArchiveZipBlobImpl(mFilename, mContentType, aStart, mLength, mCentral,
|
|
|
|
mBlobImpl);
|
2014-09-27 03:21:57 +04:00
|
|
|
return impl.forget();
|
2014-06-26 20:47:44 +04:00
|
|
|
}
|
2014-06-27 07:46:34 +04:00
|
|
|
|
2015-05-12 15:11:03 +03:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(ArchiveZipBlobImpl, BlobImpl)
|