зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1047483 - patch 3 - Renaming DOMFile to File, r=ehsan
--HG-- rename : content/base/public/nsDOMFile.h => content/base/public/File.h rename : content/base/src/nsDOMFile.cpp => content/base/src/File.cpp
This commit is contained in:
Родитель
090b876c2a
Коммит
8f8ec51372
|
@ -181,7 +181,7 @@ FilePicker.prototype = {
|
|||
}
|
||||
|
||||
// The name to be shown can be part of the message, or can be taken from
|
||||
// the DOMFile (if the blob is a DOMFile).
|
||||
// the File (if the blob is a File).
|
||||
let name = data.result.name;
|
||||
if (!name &&
|
||||
(data.result.blob instanceof this.mParent.File) &&
|
||||
|
|
|
@ -67,7 +67,7 @@ var testCases = [
|
|||
},
|
||||
fileName: 'test5.txt'},
|
||||
// case 6: returns file without name. This case may fail because we
|
||||
// need to make sure the DOMFile can be sent through
|
||||
// need to make sure the File can be sent through
|
||||
// sendAsyncMessage API.
|
||||
{ pickedResult: { success: true,
|
||||
result: {
|
||||
|
@ -96,7 +96,7 @@ function handleMessage(data) {
|
|||
break;
|
||||
case 'file-picked-posted':
|
||||
is(fileInput.value, activeTestCase.fileName,
|
||||
'DOMFile should be able to send through message.');
|
||||
'File should be able to send through message.');
|
||||
processTestCase();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_DOMFile_h
|
||||
#define mozilla_dom_DOMFile_h
|
||||
#ifndef mozilla_dom_File_h
|
||||
#define mozilla_dom_File_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
|
@ -35,17 +35,17 @@ class nsIFile;
|
|||
class nsIInputStream;
|
||||
class nsIClassInfo;
|
||||
|
||||
#define PIDOMFILEIMPL_IID \
|
||||
#define PIFILEIMPL_IID \
|
||||
{ 0x218ee173, 0xf44f, 0x4d30, \
|
||||
{ 0xab, 0x0c, 0xd6, 0x66, 0xea, 0xc2, 0x84, 0x47 } }
|
||||
|
||||
class PIDOMFileImpl : public nsISupports
|
||||
class PIFileImpl : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(PIDOMFILEIMPL_IID)
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(PIFILEIMPL_IID)
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(PIDOMFileImpl, PIDOMFILEIMPL_IID)
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(PIFileImpl, PIFILEIMPL_IID)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -56,17 +56,16 @@ class FileInfo;
|
|||
|
||||
struct BlobPropertyBag;
|
||||
struct FilePropertyBag;
|
||||
class DOMFileImpl;
|
||||
class FileImpl;
|
||||
|
||||
/* FOLLOWUP TODO:
|
||||
1. remove nsDOMBlobBuilder.h
|
||||
2. rename nsDOMFile.h/cpp to DOMFile.h/cpp
|
||||
*/
|
||||
class DOMFile MOZ_FINAL : public nsIDOMFile
|
||||
, public nsIXHRSendable
|
||||
, public nsIMutable
|
||||
, public nsSupportsWeakReference
|
||||
, public nsWrapperCache
|
||||
class File MOZ_FINAL : public nsIDOMFile
|
||||
, public nsIXHRSendable
|
||||
, public nsIMutable
|
||||
, public nsSupportsWeakReference
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_NSIDOMBLOB
|
||||
|
@ -75,68 +74,68 @@ public:
|
|||
NS_DECL_NSIMUTABLE
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(DOMFile, nsIDOMFile)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(File, nsIDOMFile)
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Create(nsISupports* aParent, const nsAString& aName,
|
||||
const nsAString& aContentType, uint64_t aLength,
|
||||
uint64_t aLastModifiedDate);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Create(nsISupports* aParent, const nsAString& aName,
|
||||
const nsAString& aContentType, uint64_t aLength);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Create(nsISupports* aParent, const nsAString& aContentType,
|
||||
uint64_t aLength);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Create(nsISupports* aParent, const nsAString& aContentType, uint64_t aStart,
|
||||
uint64_t aLength);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, uint64_t aLength,
|
||||
const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLastModifiedDate);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, uint64_t aLength,
|
||||
const nsAString& aContentType);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
CreateTemporaryFileBlob(nsISupports* aParent, PRFileDesc* aFD,
|
||||
uint64_t aStartPos, uint64_t aLength,
|
||||
const nsAString& aContentType);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
CreateFromFile(nsISupports* aParent, nsIFile* aFile);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
CreateFromFile(nsISupports* aParent, const nsAString& aContentType,
|
||||
uint64_t aLength, nsIFile* aFile,
|
||||
indexedDB::FileInfo* aFileInfo);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
CreateFromFile(nsISupports* aParent, const nsAString& aName,
|
||||
const nsAString& aContentType, uint64_t aLength,
|
||||
nsIFile* aFile, indexedDB::FileInfo* aFileInfo);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
CreateFromFile(nsISupports* aParent, nsIFile* aFile,
|
||||
indexedDB::FileInfo* aFileInfo);
|
||||
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
CreateFromFile(nsISupports* aParent, nsIFile* aFile, const nsAString& aName,
|
||||
const nsAString& aContentType);
|
||||
|
||||
DOMFile(nsISupports* aParent, DOMFileImpl* aImpl);
|
||||
File(nsISupports* aParent, FileImpl* aImpl);
|
||||
|
||||
DOMFileImpl* Impl() const
|
||||
FileImpl* Impl() const
|
||||
{
|
||||
return mImpl;
|
||||
}
|
||||
|
||||
const nsTArray<nsRefPtr<DOMFileImpl>>* GetSubBlobImpls() const;
|
||||
const nsTArray<nsRefPtr<FileImpl>>* GetSubBlobImpls() const;
|
||||
|
||||
bool IsSizeUnknown() const;
|
||||
|
||||
|
@ -147,7 +146,7 @@ public:
|
|||
void SetLazyData(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, uint64_t aLastModifiedDate);
|
||||
|
||||
already_AddRefed<DOMFile>
|
||||
already_AddRefed<File>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType,
|
||||
ErrorResult& aRv);
|
||||
|
||||
|
@ -158,18 +157,18 @@ public:
|
|||
}
|
||||
|
||||
// Blob constructor
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
|
||||
|
||||
// Blob constructor
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const Sequence<OwningArrayBufferOrArrayBufferViewOrBlobOrString>& aData,
|
||||
const BlobPropertyBag& aBag,
|
||||
ErrorResult& aRv);
|
||||
|
||||
// File constructor
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const Sequence<OwningArrayBufferOrArrayBufferViewOrBlobOrString>& aData,
|
||||
const nsAString& aName,
|
||||
|
@ -177,21 +176,21 @@ public:
|
|||
ErrorResult& aRv);
|
||||
|
||||
// File constructor - ChromeOnly
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
DOMFile& aData,
|
||||
File& aData,
|
||||
const FilePropertyBag& aBag,
|
||||
ErrorResult& aRv);
|
||||
|
||||
// File constructor - ChromeOnly
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aData,
|
||||
const FilePropertyBag& aBag,
|
||||
ErrorResult& aRv);
|
||||
|
||||
// File constructor - ChromeOnly
|
||||
static already_AddRefed<DOMFile>
|
||||
static already_AddRefed<File>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
nsIFile* aData,
|
||||
const FilePropertyBag& aBag,
|
||||
|
@ -211,31 +210,31 @@ public:
|
|||
|
||||
void GetMozFullPath(nsAString& aFilename, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<DOMFile> Slice(const Optional<int64_t>& aStart,
|
||||
const Optional<int64_t>& aEnd,
|
||||
const nsAString& aContentType,
|
||||
ErrorResult& aRv);
|
||||
already_AddRefed<File> Slice(const Optional<int64_t>& aStart,
|
||||
const Optional<int64_t>& aEnd,
|
||||
const nsAString& aContentType,
|
||||
ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
~DOMFile() {};
|
||||
~File() {};
|
||||
|
||||
// The member is the real backend implementation of this DOMFile/DOMBlob.
|
||||
// The member is the real backend implementation of this File/Blob.
|
||||
// It's thread-safe and not CC-able and it's the only element that is moved
|
||||
// between threads.
|
||||
// Note: we should not store any other state in this class!
|
||||
const nsRefPtr<DOMFileImpl> mImpl;
|
||||
const nsRefPtr<FileImpl> mImpl;
|
||||
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
};
|
||||
|
||||
// This is the abstract class for any DOMFile backend. It must be nsISupports
|
||||
// This is the abstract class for any File backend. It must be nsISupports
|
||||
// because this class must be ref-counted and it has to work with IPC.
|
||||
class DOMFileImpl : public PIDOMFileImpl
|
||||
class FileImpl : public PIFileImpl
|
||||
{
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
DOMFileImpl() {}
|
||||
FileImpl() {}
|
||||
|
||||
virtual void GetName(nsAString& aName) = 0;
|
||||
|
||||
|
@ -251,15 +250,15 @@ public:
|
|||
|
||||
virtual void GetType(nsAString& aType) = 0;
|
||||
|
||||
already_AddRefed<DOMFileImpl>
|
||||
already_AddRefed<FileImpl>
|
||||
Slice(const Optional<int64_t>& aStart, const Optional<int64_t>& aEnd,
|
||||
const nsAString& aContentType, ErrorResult& aRv);
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType, ErrorResult& aRv) = 0;
|
||||
|
||||
virtual const nsTArray<nsRefPtr<DOMFileImpl>>*
|
||||
virtual const nsTArray<nsRefPtr<FileImpl>>*
|
||||
GetSubBlobImpls() const = 0;
|
||||
|
||||
virtual nsresult GetInternalStream(nsIInputStream** aStream) = 0;
|
||||
|
@ -303,14 +302,14 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
virtual ~DOMFileImpl() {}
|
||||
virtual ~FileImpl() {}
|
||||
};
|
||||
|
||||
class DOMFileImplBase : public DOMFileImpl
|
||||
class FileImplBase : public FileImpl
|
||||
{
|
||||
public:
|
||||
DOMFileImplBase(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, uint64_t aLastModifiedDate)
|
||||
FileImplBase(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, uint64_t aLastModifiedDate)
|
||||
: mIsFile(true)
|
||||
, mImmutable(false)
|
||||
, mContentType(aContentType)
|
||||
|
@ -323,8 +322,8 @@ public:
|
|||
mContentType.SetIsVoid(false);
|
||||
}
|
||||
|
||||
DOMFileImplBase(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength)
|
||||
FileImplBase(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength)
|
||||
: mIsFile(true)
|
||||
, mImmutable(false)
|
||||
, mContentType(aContentType)
|
||||
|
@ -337,7 +336,7 @@ public:
|
|||
mContentType.SetIsVoid(false);
|
||||
}
|
||||
|
||||
DOMFileImplBase(const nsAString& aContentType, uint64_t aLength)
|
||||
FileImplBase(const nsAString& aContentType, uint64_t aLength)
|
||||
: mIsFile(false)
|
||||
, mImmutable(false)
|
||||
, mContentType(aContentType)
|
||||
|
@ -349,8 +348,8 @@ public:
|
|||
mContentType.SetIsVoid(false);
|
||||
}
|
||||
|
||||
DOMFileImplBase(const nsAString& aContentType, uint64_t aStart,
|
||||
uint64_t aLength)
|
||||
FileImplBase(const nsAString& aContentType, uint64_t aStart,
|
||||
uint64_t aLength)
|
||||
: mIsFile(false)
|
||||
, mImmutable(false)
|
||||
, mContentType(aContentType)
|
||||
|
@ -382,14 +381,14 @@ public:
|
|||
|
||||
virtual void GetType(nsAString& aType) MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual const nsTArray<nsRefPtr<DOMFileImpl>>*
|
||||
virtual const nsTArray<nsRefPtr<FileImpl>>*
|
||||
GetSubBlobImpls() const MOZ_OVERRIDE
|
||||
{
|
||||
return nullptr;
|
||||
|
@ -469,7 +468,7 @@ public:
|
|||
virtual void Traverse(nsCycleCollectionTraversalCallback &aCb) {}
|
||||
|
||||
protected:
|
||||
virtual ~DOMFileImplBase() {}
|
||||
virtual ~FileImplBase() {}
|
||||
|
||||
indexedDB::FileInfo* GetFileInfo() const
|
||||
{
|
||||
|
@ -499,25 +498,22 @@ protected:
|
|||
* This class may be used off the main thread, and in particular, its
|
||||
* constructor and destructor may not run on the same thread. Be careful!
|
||||
*/
|
||||
class DOMFileImplMemory MOZ_FINAL : public DOMFileImplBase
|
||||
class FileImplMemory MOZ_FINAL : public FileImplBase
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
DOMFileImplMemory(void* aMemoryBuffer, uint64_t aLength,
|
||||
const nsAString& aName,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLastModifiedDate)
|
||||
: DOMFileImplBase(aName, aContentType, aLength, aLastModifiedDate)
|
||||
FileImplMemory(void* aMemoryBuffer, uint64_t aLength, const nsAString& aName,
|
||||
const nsAString& aContentType, uint64_t aLastModifiedDate)
|
||||
: FileImplBase(aName, aContentType, aLength, aLastModifiedDate)
|
||||
, mDataOwner(new DataOwner(aMemoryBuffer, aLength))
|
||||
{
|
||||
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
|
||||
}
|
||||
|
||||
DOMFileImplMemory(void* aMemoryBuffer,
|
||||
uint64_t aLength,
|
||||
const nsAString& aContentType)
|
||||
: DOMFileImplBase(aContentType, aLength)
|
||||
FileImplMemory(void* aMemoryBuffer, uint64_t aLength,
|
||||
const nsAString& aContentType)
|
||||
: FileImplBase(aContentType, aLength)
|
||||
, mDataOwner(new DataOwner(aMemoryBuffer, aLength))
|
||||
{
|
||||
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
|
||||
|
@ -525,7 +521,7 @@ public:
|
|||
|
||||
virtual nsresult GetInternalStream(nsIInputStream** aStream) MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -580,29 +576,29 @@ public:
|
|||
|
||||
private:
|
||||
// Create slice
|
||||
DOMFileImplMemory(const DOMFileImplMemory* aOther, uint64_t aStart,
|
||||
uint64_t aLength, const nsAString& aContentType)
|
||||
: DOMFileImplBase(aContentType, aOther->mStart + aStart, aLength)
|
||||
FileImplMemory(const FileImplMemory* aOther, uint64_t aStart,
|
||||
uint64_t aLength, const nsAString& aContentType)
|
||||
: FileImplBase(aContentType, aOther->mStart + aStart, aLength)
|
||||
, mDataOwner(aOther->mDataOwner)
|
||||
{
|
||||
NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data");
|
||||
mImmutable = aOther->mImmutable;
|
||||
}
|
||||
|
||||
~DOMFileImplMemory() {}
|
||||
~FileImplMemory() {}
|
||||
|
||||
// Used when backed by a memory store
|
||||
nsRefPtr<DataOwner> mDataOwner;
|
||||
};
|
||||
|
||||
class DOMFileImplTemporaryFileBlob MOZ_FINAL : public DOMFileImplBase
|
||||
class FileImplTemporaryFileBlob MOZ_FINAL : public FileImplBase
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
DOMFileImplTemporaryFileBlob(PRFileDesc* aFD, uint64_t aStartPos,
|
||||
uint64_t aLength, const nsAString& aContentType)
|
||||
: DOMFileImplBase(aContentType, aLength)
|
||||
FileImplTemporaryFileBlob(PRFileDesc* aFD, uint64_t aStartPos,
|
||||
uint64_t aLength, const nsAString& aContentType)
|
||||
: FileImplBase(aContentType, aLength)
|
||||
, mLength(aLength)
|
||||
, mStartPos(aStartPos)
|
||||
, mContentType(aContentType)
|
||||
|
@ -612,21 +608,21 @@ public:
|
|||
|
||||
virtual nsresult GetInternalStream(nsIInputStream** aStream) MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
DOMFileImplTemporaryFileBlob(const DOMFileImplTemporaryFileBlob* aOther,
|
||||
uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType)
|
||||
: DOMFileImplBase(aContentType, aLength)
|
||||
FileImplTemporaryFileBlob(const FileImplTemporaryFileBlob* aOther,
|
||||
uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType)
|
||||
: FileImplBase(aContentType, aLength)
|
||||
, mLength(aLength)
|
||||
, mStartPos(aStart)
|
||||
, mFileDescOwner(aOther->mFileDescOwner)
|
||||
, mContentType(aContentType) {}
|
||||
|
||||
~DOMFileImplTemporaryFileBlob() {}
|
||||
~FileImplTemporaryFileBlob() {}
|
||||
|
||||
uint64_t mLength;
|
||||
uint64_t mStartPos;
|
||||
|
@ -634,14 +630,14 @@ private:
|
|||
nsString mContentType;
|
||||
};
|
||||
|
||||
class DOMFileImplFile : public DOMFileImplBase
|
||||
class FileImplFile : public FileImplBase
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Create as a file
|
||||
explicit DOMFileImplFile(nsIFile* aFile)
|
||||
: DOMFileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
|
||||
explicit FileImplFile(nsIFile* aFile)
|
||||
: FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
|
||||
, mFile(aFile)
|
||||
, mWholeFile(true)
|
||||
, mStoredFile(false)
|
||||
|
@ -652,8 +648,8 @@ public:
|
|||
mFile->GetLeafName(mName);
|
||||
}
|
||||
|
||||
DOMFileImplFile(nsIFile* aFile, indexedDB::FileInfo* aFileInfo)
|
||||
: DOMFileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
|
||||
FileImplFile(nsIFile* aFile, indexedDB::FileInfo* aFileInfo)
|
||||
: FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
|
||||
, mFile(aFile)
|
||||
, mWholeFile(true)
|
||||
, mStoredFile(true)
|
||||
|
@ -668,9 +664,9 @@ public:
|
|||
}
|
||||
|
||||
// Create as a file
|
||||
DOMFileImplFile(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, nsIFile* aFile)
|
||||
: DOMFileImplBase(aName, aContentType, aLength, UINT64_MAX)
|
||||
FileImplFile(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, nsIFile* aFile)
|
||||
: FileImplBase(aName, aContentType, aLength, UINT64_MAX)
|
||||
, mFile(aFile)
|
||||
, mWholeFile(true)
|
||||
, mStoredFile(false)
|
||||
|
@ -678,10 +674,10 @@ public:
|
|||
NS_ASSERTION(mFile, "must have file");
|
||||
}
|
||||
|
||||
DOMFileImplFile(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, nsIFile* aFile,
|
||||
uint64_t aLastModificationDate)
|
||||
: DOMFileImplBase(aName, aContentType, aLength, aLastModificationDate)
|
||||
FileImplFile(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, nsIFile* aFile,
|
||||
uint64_t aLastModificationDate)
|
||||
: FileImplBase(aName, aContentType, aLength, aLastModificationDate)
|
||||
, mFile(aFile)
|
||||
, mWholeFile(true)
|
||||
, mStoredFile(false)
|
||||
|
@ -690,9 +686,9 @@ public:
|
|||
}
|
||||
|
||||
// Create as a file with custom name
|
||||
DOMFileImplFile(nsIFile* aFile, const nsAString& aName,
|
||||
const nsAString& aContentType)
|
||||
: DOMFileImplBase(aName, aContentType, UINT64_MAX, UINT64_MAX)
|
||||
FileImplFile(nsIFile* aFile, const nsAString& aName,
|
||||
const nsAString& aContentType)
|
||||
: FileImplBase(aName, aContentType, UINT64_MAX, UINT64_MAX)
|
||||
, mFile(aFile)
|
||||
, mWholeFile(true)
|
||||
, mStoredFile(false)
|
||||
|
@ -705,10 +701,10 @@ public:
|
|||
}
|
||||
|
||||
// Create as a stored file
|
||||
DOMFileImplFile(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, nsIFile* aFile,
|
||||
indexedDB::FileInfo* aFileInfo)
|
||||
: DOMFileImplBase(aName, aContentType, aLength, UINT64_MAX)
|
||||
FileImplFile(const nsAString& aName, const nsAString& aContentType,
|
||||
uint64_t aLength, nsIFile* aFile,
|
||||
indexedDB::FileInfo* aFileInfo)
|
||||
: FileImplBase(aName, aContentType, aLength, UINT64_MAX)
|
||||
, mFile(aFile)
|
||||
, mWholeFile(true)
|
||||
, mStoredFile(true)
|
||||
|
@ -718,9 +714,9 @@ public:
|
|||
}
|
||||
|
||||
// Create as a stored blob
|
||||
DOMFileImplFile(const nsAString& aContentType, uint64_t aLength,
|
||||
nsIFile* aFile, indexedDB::FileInfo* aFileInfo)
|
||||
: DOMFileImplBase(aContentType, aLength)
|
||||
FileImplFile(const nsAString& aContentType, uint64_t aLength,
|
||||
nsIFile* aFile, indexedDB::FileInfo* aFileInfo)
|
||||
: FileImplBase(aContentType, aLength)
|
||||
, mFile(aFile)
|
||||
, mWholeFile(true)
|
||||
, mStoredFile(true)
|
||||
|
@ -730,8 +726,8 @@ public:
|
|||
}
|
||||
|
||||
// Create as a file to be later initialized
|
||||
DOMFileImplFile()
|
||||
: DOMFileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
|
||||
FileImplFile()
|
||||
: FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
|
||||
, mWholeFile(true)
|
||||
, mStoredFile(false)
|
||||
{
|
||||
|
@ -751,13 +747,13 @@ public:
|
|||
void SetPath(const nsAString& aFullPath);
|
||||
|
||||
protected:
|
||||
virtual ~DOMFileImplFile() {}
|
||||
virtual ~FileImplFile() {}
|
||||
|
||||
private:
|
||||
// Create slice
|
||||
DOMFileImplFile(const DOMFileImplFile* aOther, uint64_t aStart,
|
||||
uint64_t aLength, const nsAString& aContentType)
|
||||
: DOMFileImplBase(aContentType, aOther->mStart + aStart, aLength)
|
||||
FileImplFile(const FileImplFile* aOther, uint64_t aStart,
|
||||
uint64_t aLength, const nsAString& aContentType)
|
||||
: FileImplBase(aContentType, aOther->mStart + aStart, aLength)
|
||||
, mFile(aOther->mFile)
|
||||
, mWholeFile(false)
|
||||
, mStoredFile(aOther->mStoredFile)
|
||||
|
@ -782,7 +778,7 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -828,7 +824,7 @@ public:
|
|||
mParent = nullptr;
|
||||
}
|
||||
|
||||
bool Append(DOMFile *aFile) { return mFiles.AppendElement(aFile); }
|
||||
bool Append(File *aFile) { return mFiles.AppendElement(aFile); }
|
||||
|
||||
bool Remove(uint32_t aIndex) {
|
||||
if (aIndex < mFiles.Length()) {
|
||||
|
@ -858,11 +854,11 @@ public:
|
|||
return static_cast<FileList*>(aSupports);
|
||||
}
|
||||
|
||||
DOMFile* Item(uint32_t aIndex)
|
||||
File* Item(uint32_t aIndex)
|
||||
{
|
||||
return mFiles.SafeElementAt(aIndex);
|
||||
}
|
||||
DOMFile* IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
File* IndexedGetter(uint32_t aIndex, bool& aFound)
|
||||
{
|
||||
aFound = aIndex < mFiles.Length();
|
||||
return aFound ? mFiles.ElementAt(aIndex) : nullptr;
|
||||
|
@ -873,11 +869,11 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
nsTArray<nsRefPtr<DOMFile>> mFiles;
|
||||
nsTArray<nsRefPtr<File>> mFiles;
|
||||
nsISupports *mParent;
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
} // file namespace
|
||||
|
||||
#endif // mozilla_dom_DOMFile_h
|
||||
#endif // mozilla_dom_File_h
|
|
@ -43,7 +43,6 @@ EXPORTS += [
|
|||
'nsCopySupport.h',
|
||||
'nsDeprecatedOperationList.h',
|
||||
'nsDocElementCreatedNotificationRunner.h',
|
||||
'nsDOMFile.h',
|
||||
'nsHostObjectProtocolHandler.h',
|
||||
'nsIAttribute.h',
|
||||
'nsIContent.h',
|
||||
|
@ -70,6 +69,7 @@ EXPORTS.mozilla.dom += [
|
|||
'DirectionalityUtils.h',
|
||||
'Element.h',
|
||||
'ElementInlines.h',
|
||||
'File.h',
|
||||
'FragmentOrElement.h',
|
||||
'FromParser.h',
|
||||
]
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -4,12 +4,12 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "FileIOObject.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ProgressEvent.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "mozilla/dom/ProgressEvent.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
||||
#define ERROR_STR "error"
|
||||
#define ABORT_STR "abort"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "jsfriendapi.h"
|
||||
#include "js/OldDebugAPI.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
|
@ -38,7 +39,6 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIWebSocketChannel.h"
|
||||
|
@ -1194,8 +1194,7 @@ WebSocket::Send(const nsAString& aData,
|
|||
}
|
||||
|
||||
void
|
||||
WebSocket::Send(DOMFile& aData,
|
||||
ErrorResult& aRv)
|
||||
WebSocket::Send(File& aData, ErrorResult& aRv)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMFile;
|
||||
class File;
|
||||
|
||||
class WebSocket MOZ_FINAL : public DOMEventTargetHelper,
|
||||
public nsIInterfaceRequestor,
|
||||
|
@ -133,7 +133,7 @@ public: // WebIDL interface:
|
|||
// webIDL: void send(DOMString|Blob|ArrayBufferView data);
|
||||
void Send(const nsAString& aData,
|
||||
ErrorResult& aRv);
|
||||
void Send(DOMFile& aData,
|
||||
void Send(File& aData,
|
||||
ErrorResult& aRv);
|
||||
void Send(const ArrayBuffer& aData,
|
||||
ErrorResult& aRv);
|
||||
|
|
|
@ -99,6 +99,7 @@ UNIFIED_SOURCES += [
|
|||
'DOMStringList.cpp',
|
||||
'Element.cpp',
|
||||
'EventSource.cpp',
|
||||
'File.cpp',
|
||||
'FileIOObject.cpp',
|
||||
'FragmentOrElement.cpp',
|
||||
'ImportManager.cpp',
|
||||
|
@ -126,7 +127,6 @@ UNIFIED_SOURCES += [
|
|||
'nsDOMAttributeMap.cpp',
|
||||
'nsDOMBlobBuilder.cpp',
|
||||
'nsDOMCaretPosition.cpp',
|
||||
'nsDOMFile.cpp',
|
||||
'nsDOMFileReader.cpp',
|
||||
'nsDOMMutationObserver.cpp',
|
||||
'nsDOMSerializer.cpp',
|
||||
|
|
|
@ -5999,11 +5999,11 @@ nsContentUtils::CreateBlobBuffer(JSContext* aCx,
|
|||
{
|
||||
uint32_t blobLen = aData.Length();
|
||||
void* blobData = moz_malloc(blobLen);
|
||||
nsRefPtr<DOMFile> blob;
|
||||
nsRefPtr<File> blob;
|
||||
if (blobData) {
|
||||
memcpy(blobData, aData.BeginReading(), blobLen);
|
||||
blob = mozilla::dom::DOMFile::CreateMemoryFile(aParent, blobData, blobLen,
|
||||
EmptyString());
|
||||
blob = mozilla::dom::File::CreateMemoryFile(aParent, blobData, blobLen,
|
||||
EmptyString());
|
||||
} else {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(DOMMultipartFileImpl, DOMFileImpl)
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(MultipartFileImpl, FileImpl)
|
||||
|
||||
nsresult
|
||||
DOMMultipartFileImpl::GetInternalStream(nsIInputStream** aStream)
|
||||
MultipartFileImpl::GetInternalStream(nsIInputStream** aStream)
|
||||
{
|
||||
nsresult rv;
|
||||
*aStream = nullptr;
|
||||
|
@ -35,7 +35,7 @@ DOMMultipartFileImpl::GetInternalStream(nsIInputStream** aStream)
|
|||
uint32_t i;
|
||||
for (i = 0; i < mBlobImpls.Length(); i++) {
|
||||
nsCOMPtr<nsIInputStream> scratchStream;
|
||||
DOMFileImpl* blobImpl = mBlobImpls.ElementAt(i).get();
|
||||
FileImpl* blobImpl = mBlobImpls.ElementAt(i).get();
|
||||
|
||||
rv = blobImpl->GetInternalStream(getter_AddRefs(scratchStream));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -47,13 +47,13 @@ DOMMultipartFileImpl::GetInternalStream(nsIInputStream** aStream)
|
|||
return CallQueryInterface(stream, aStream);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMFileImpl>
|
||||
DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType,
|
||||
ErrorResult& aRv)
|
||||
already_AddRefed<FileImpl>
|
||||
MultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
// If we clamped to nothing we create an empty blob
|
||||
nsTArray<nsRefPtr<DOMFileImpl>> blobImpls;
|
||||
nsTArray<nsRefPtr<FileImpl>> blobImpls;
|
||||
|
||||
uint64_t length = aLength;
|
||||
uint64_t skipStart = aStart;
|
||||
|
@ -61,7 +61,7 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
|||
// Prune the list of blobs if we can
|
||||
uint32_t i;
|
||||
for (i = 0; length && skipStart && i < mBlobImpls.Length(); i++) {
|
||||
DOMFileImpl* blobImpl = mBlobImpls[i].get();
|
||||
FileImpl* blobImpl = mBlobImpls[i].get();
|
||||
|
||||
uint64_t l = blobImpl->GetSize(aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
|
@ -71,14 +71,14 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
|||
if (skipStart < l) {
|
||||
uint64_t upperBound = std::min<uint64_t>(l - skipStart, length);
|
||||
|
||||
nsRefPtr<DOMFileImpl> firstBlobImpl =
|
||||
nsRefPtr<FileImpl> firstBlobImpl =
|
||||
blobImpl->CreateSlice(skipStart, upperBound,
|
||||
aContentType, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Avoid wrapping a single blob inside an DOMMultipartFileImpl
|
||||
// Avoid wrapping a single blob inside an MultipartFileImpl
|
||||
if (length == upperBound) {
|
||||
return firstBlobImpl.forget();
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
|||
|
||||
// Now append enough blobs until we're done
|
||||
for (; length && i < mBlobImpls.Length(); i++) {
|
||||
DOMFileImpl* blobImpl = mBlobImpls[i].get();
|
||||
FileImpl* blobImpl = mBlobImpls[i].get();
|
||||
|
||||
uint64_t l = blobImpl->GetSize(aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
|
@ -101,7 +101,7 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
|||
}
|
||||
|
||||
if (length < l) {
|
||||
nsRefPtr<DOMFileImpl> lastBlobImpl =
|
||||
nsRefPtr<FileImpl> lastBlobImpl =
|
||||
blobImpl->CreateSlice(0, length, aContentType, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
|
@ -115,19 +115,19 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
|||
}
|
||||
|
||||
// we can create our blob now
|
||||
nsRefPtr<DOMFileImpl> impl =
|
||||
new DOMMultipartFileImpl(blobImpls, aContentType);
|
||||
nsRefPtr<FileImpl> impl =
|
||||
new MultipartFileImpl(blobImpls, aContentType);
|
||||
return impl.forget();
|
||||
}
|
||||
|
||||
void
|
||||
DOMMultipartFileImpl::InitializeBlob()
|
||||
MultipartFileImpl::InitializeBlob()
|
||||
{
|
||||
SetLengthAndModifiedDate();
|
||||
}
|
||||
|
||||
void
|
||||
DOMMultipartFileImpl::InitializeBlob(
|
||||
MultipartFileImpl::InitializeBlob(
|
||||
JSContext* aCx,
|
||||
const Sequence<OwningArrayBufferOrArrayBufferViewOrBlobOrString>& aData,
|
||||
const nsAString& aContentType,
|
||||
|
@ -141,7 +141,7 @@ DOMMultipartFileImpl::InitializeBlob(
|
|||
const OwningArrayBufferOrArrayBufferViewOrBlobOrString& data = aData[i];
|
||||
|
||||
if (data.IsBlob()) {
|
||||
nsRefPtr<DOMFile> file = data.GetAsBlob().get();
|
||||
nsRefPtr<File> file = data.GetAsBlob().get();
|
||||
blobSet.AppendBlobImpl(file->Impl());
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ DOMMultipartFileImpl::InitializeBlob(
|
|||
}
|
||||
|
||||
void
|
||||
DOMMultipartFileImpl::SetLengthAndModifiedDate()
|
||||
MultipartFileImpl::SetLengthAndModifiedDate()
|
||||
{
|
||||
MOZ_ASSERT(mLength == UINT64_MAX);
|
||||
MOZ_ASSERT(mLastModificationDate == UINT64_MAX);
|
||||
|
@ -189,7 +189,7 @@ DOMMultipartFileImpl::SetLengthAndModifiedDate()
|
|||
uint64_t totalLength = 0;
|
||||
|
||||
for (uint32_t index = 0, count = mBlobImpls.Length(); index < count; index++) {
|
||||
nsRefPtr<DOMFileImpl>& blob = mBlobImpls[index];
|
||||
nsRefPtr<FileImpl>& blob = mBlobImpls[index];
|
||||
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(!blob->IsSizeUnknown());
|
||||
|
@ -216,17 +216,17 @@ DOMMultipartFileImpl::SetLengthAndModifiedDate()
|
|||
}
|
||||
|
||||
void
|
||||
DOMMultipartFileImpl::GetMozFullPathInternal(nsAString& aFilename,
|
||||
ErrorResult& aRv)
|
||||
MultipartFileImpl::GetMozFullPathInternal(nsAString& aFilename,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!mIsFromNsIFile || mBlobImpls.Length() == 0) {
|
||||
DOMFileImplBase::GetMozFullPathInternal(aFilename, aRv);
|
||||
FileImplBase::GetMozFullPathInternal(aFilename, aRv);
|
||||
return;
|
||||
}
|
||||
|
||||
DOMFileImpl* blobImpl = mBlobImpls.ElementAt(0).get();
|
||||
FileImpl* blobImpl = mBlobImpls.ElementAt(0).get();
|
||||
if (!blobImpl) {
|
||||
DOMFileImplBase::GetMozFullPathInternal(aFilename, aRv);
|
||||
FileImplBase::GetMozFullPathInternal(aFilename, aRv);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -234,9 +234,9 @@ DOMMultipartFileImpl::GetMozFullPathInternal(nsAString& aFilename,
|
|||
}
|
||||
|
||||
void
|
||||
DOMMultipartFileImpl::InitializeChromeFile(DOMFile& aBlob,
|
||||
const FilePropertyBag& aBag,
|
||||
ErrorResult& aRv)
|
||||
MultipartFileImpl::InitializeChromeFile(File& aBlob,
|
||||
const FilePropertyBag& aBag,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ASSERTION(!mImmutable, "Something went wrong ...");
|
||||
|
||||
|
@ -265,11 +265,11 @@ DOMMultipartFileImpl::InitializeChromeFile(DOMFile& aBlob,
|
|||
}
|
||||
|
||||
void
|
||||
DOMMultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
|
||||
nsIFile* aFile,
|
||||
const FilePropertyBag& aBag,
|
||||
bool aIsFromNsIFile,
|
||||
ErrorResult& aRv)
|
||||
MultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
|
||||
nsIFile* aFile,
|
||||
const FilePropertyBag& aBag,
|
||||
bool aIsFromNsIFile,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
NS_ASSERTION(!mImmutable, "Something went wrong ...");
|
||||
if (mImmutable) {
|
||||
|
@ -309,7 +309,7 @@ DOMMultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
|
|||
aFile->GetLeafName(mName);
|
||||
}
|
||||
|
||||
nsRefPtr<DOMFile> blob = DOMFile::CreateFromFile(aWindow, aFile);
|
||||
nsRefPtr<File> blob = File::CreateFromFile(aWindow, aFile);
|
||||
|
||||
// Pre-cache size.
|
||||
uint64_t unused;
|
||||
|
@ -330,17 +330,17 @@ DOMMultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
|
|||
}
|
||||
|
||||
BlobSet blobSet;
|
||||
blobSet.AppendBlobImpl(static_cast<DOMFile*>(blob.get())->Impl());
|
||||
blobSet.AppendBlobImpl(static_cast<File*>(blob.get())->Impl());
|
||||
mBlobImpls = blobSet.GetBlobImpls();
|
||||
|
||||
SetLengthAndModifiedDate();
|
||||
}
|
||||
|
||||
void
|
||||
DOMMultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
|
||||
const nsAString& aData,
|
||||
const FilePropertyBag& aBag,
|
||||
ErrorResult& aRv)
|
||||
MultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow,
|
||||
const nsAString& aData,
|
||||
const FilePropertyBag& aBag,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIFile> file;
|
||||
aRv = NS_NewLocalFile(aData, false, getter_AddRefs(file));
|
||||
|
@ -385,7 +385,7 @@ BlobSet::AppendString(const nsAString& aString, bool aNativeEOL, JSContext* aCx)
|
|||
}
|
||||
|
||||
nsresult
|
||||
BlobSet::AppendBlobImpl(DOMFileImpl* aBlobImpl)
|
||||
BlobSet::AppendBlobImpl(FileImpl* aBlobImpl)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aBlobImpl);
|
||||
|
||||
|
@ -396,7 +396,7 @@ BlobSet::AppendBlobImpl(DOMFileImpl* aBlobImpl)
|
|||
}
|
||||
|
||||
nsresult
|
||||
BlobSet::AppendBlobImpls(const nsTArray<nsRefPtr<DOMFileImpl>>& aBlobImpls)
|
||||
BlobSet::AppendBlobImpls(const nsTArray<nsRefPtr<FileImpl>>& aBlobImpls)
|
||||
{
|
||||
Flush();
|
||||
mBlobImpls.AppendElements(aBlobImpls);
|
||||
|
|
|
@ -6,11 +6,10 @@
|
|||
#ifndef nsDOMBlobBuilder_h
|
||||
#define nsDOMBlobBuilder_h
|
||||
|
||||
#include "nsDOMFile.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/BlobBinding.h"
|
||||
#include "mozilla/dom/FileBinding.h"
|
||||
#include <algorithm>
|
||||
|
@ -18,16 +17,16 @@
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
class DOMMultipartFileImpl MOZ_FINAL : public DOMFileImplBase
|
||||
class MultipartFileImpl MOZ_FINAL : public FileImplBase
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Create as a file
|
||||
DOMMultipartFileImpl(const nsTArray<nsRefPtr<DOMFileImpl>>& aBlobImpls,
|
||||
const nsAString& aName,
|
||||
const nsAString& aContentType)
|
||||
: DOMFileImplBase(aName, aContentType, UINT64_MAX),
|
||||
MultipartFileImpl(const nsTArray<nsRefPtr<FileImpl>>& aBlobImpls,
|
||||
const nsAString& aName,
|
||||
const nsAString& aContentType)
|
||||
: FileImplBase(aName, aContentType, UINT64_MAX),
|
||||
mBlobImpls(aBlobImpls),
|
||||
mIsFromNsIFile(false)
|
||||
{
|
||||
|
@ -35,9 +34,9 @@ public:
|
|||
}
|
||||
|
||||
// Create as a blob
|
||||
DOMMultipartFileImpl(const nsTArray<nsRefPtr<DOMFileImpl>>& aBlobImpls,
|
||||
const nsAString& aContentType)
|
||||
: DOMFileImplBase(aContentType, UINT64_MAX),
|
||||
MultipartFileImpl(const nsTArray<nsRefPtr<FileImpl>>& aBlobImpls,
|
||||
const nsAString& aContentType)
|
||||
: FileImplBase(aContentType, UINT64_MAX),
|
||||
mBlobImpls(aBlobImpls),
|
||||
mIsFromNsIFile(false)
|
||||
{
|
||||
|
@ -45,15 +44,15 @@ public:
|
|||
}
|
||||
|
||||
// Create as a file to be later initialized
|
||||
explicit DOMMultipartFileImpl(const nsAString& aName)
|
||||
: DOMFileImplBase(aName, EmptyString(), UINT64_MAX),
|
||||
explicit MultipartFileImpl(const nsAString& aName)
|
||||
: FileImplBase(aName, EmptyString(), UINT64_MAX),
|
||||
mIsFromNsIFile(false)
|
||||
{
|
||||
}
|
||||
|
||||
// Create as a blob to be later initialized
|
||||
DOMMultipartFileImpl()
|
||||
: DOMFileImplBase(EmptyString(), UINT64_MAX),
|
||||
MultipartFileImpl()
|
||||
: FileImplBase(EmptyString(), UINT64_MAX),
|
||||
mIsFromNsIFile(false)
|
||||
{
|
||||
}
|
||||
|
@ -67,7 +66,7 @@ public:
|
|||
bool aNativeEOL,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void InitializeChromeFile(DOMFile& aData,
|
||||
void InitializeChromeFile(File& aData,
|
||||
const FilePropertyBag& aBag,
|
||||
ErrorResult& aRv);
|
||||
|
||||
|
@ -82,7 +81,7 @@ public:
|
|||
bool aIsFromNsIFile,
|
||||
ErrorResult& aRv);
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType,
|
||||
ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
@ -94,7 +93,7 @@ public:
|
|||
|
||||
virtual nsresult GetInternalStream(nsIInputStream** aInputStream) MOZ_OVERRIDE;
|
||||
|
||||
virtual const nsTArray<nsRefPtr<DOMFileImpl>>* GetSubBlobImpls() const MOZ_OVERRIDE
|
||||
virtual const nsTArray<nsRefPtr<FileImpl>>* GetSubBlobImpls() const MOZ_OVERRIDE
|
||||
{
|
||||
return &mBlobImpls;
|
||||
}
|
||||
|
@ -113,11 +112,11 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
virtual ~DOMMultipartFileImpl() {}
|
||||
virtual ~MultipartFileImpl() {}
|
||||
|
||||
void SetLengthAndModifiedDate();
|
||||
|
||||
nsTArray<nsRefPtr<DOMFileImpl>> mBlobImpls;
|
||||
nsTArray<nsRefPtr<FileImpl>> mBlobImpls;
|
||||
bool mIsFromNsIFile;
|
||||
};
|
||||
|
||||
|
@ -134,16 +133,16 @@ public:
|
|||
|
||||
nsresult AppendVoidPtr(const void* aData, uint32_t aLength);
|
||||
nsresult AppendString(const nsAString& aString, bool nativeEOL, JSContext* aCx);
|
||||
nsresult AppendBlobImpl(DOMFileImpl* aBlobImpl);
|
||||
nsresult AppendBlobImpls(const nsTArray<nsRefPtr<DOMFileImpl>>& aBlobImpls);
|
||||
nsresult AppendBlobImpl(FileImpl* aBlobImpl);
|
||||
nsresult AppendBlobImpls(const nsTArray<nsRefPtr<FileImpl>>& aBlobImpls);
|
||||
|
||||
nsTArray<nsRefPtr<DOMFileImpl>>& GetBlobImpls() { Flush(); return mBlobImpls; }
|
||||
nsTArray<nsRefPtr<FileImpl>>& GetBlobImpls() { Flush(); return mBlobImpls; }
|
||||
|
||||
already_AddRefed<DOMFile>
|
||||
already_AddRefed<File>
|
||||
GetBlobInternal(nsISupports* aParent, const nsACString& aContentType)
|
||||
{
|
||||
nsRefPtr<DOMFile> blob = new DOMFile(aParent,
|
||||
new DOMMultipartFileImpl(GetBlobImpls(), NS_ConvertASCIItoUTF16(aContentType)));
|
||||
nsRefPtr<File> blob = new File(aParent,
|
||||
new MultipartFileImpl(GetBlobImpls(), NS_ConvertASCIItoUTF16(aContentType)));
|
||||
return blob.forget();
|
||||
}
|
||||
|
||||
|
@ -181,16 +180,16 @@ protected:
|
|||
// If we have some data, create a blob for it
|
||||
// and put it on the stack
|
||||
|
||||
nsRefPtr<DOMFileImpl> blobImpl =
|
||||
new DOMFileImplMemory(mData, mDataLen, EmptyString());
|
||||
nsRefPtr<FileImpl> blobImpl =
|
||||
new FileImplMemory(mData, mDataLen, EmptyString());
|
||||
mBlobImpls.AppendElement(blobImpl);
|
||||
mData = nullptr; // The nsDOMMemoryFile takes ownership of the buffer
|
||||
mData = nullptr; // The FileImplMemory takes ownership of the buffer
|
||||
mDataLen = 0;
|
||||
mDataBufferLen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
nsTArray<nsRefPtr<DOMFileImpl>> mBlobImpls;
|
||||
nsTArray<nsRefPtr<FileImpl>> mBlobImpls;
|
||||
void* mData;
|
||||
uint64_t mDataLen;
|
||||
uint64_t mDataBufferLen;
|
||||
|
|
|
@ -22,10 +22,10 @@ extern PRLogModuleInfo* GetDataChannelLog();
|
|||
|
||||
#include "nsDOMDataChannelDeclarations.h"
|
||||
#include "nsDOMDataChannel.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIDOMDataChannel.h"
|
||||
#include "nsIDOMMessageEvent.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
#include "nsError.h"
|
||||
|
@ -34,7 +34,6 @@ extern PRLogModuleInfo* GetDataChannelLog();
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsDOMFile.h"
|
||||
|
||||
#include "DataChannel.h"
|
||||
|
||||
|
@ -272,7 +271,7 @@ nsDOMDataChannel::Send(const nsAString& aData, ErrorResult& aRv)
|
|||
}
|
||||
|
||||
void
|
||||
nsDOMDataChannel::Send(DOMFile& aData, ErrorResult& aRv)
|
||||
nsDOMDataChannel::Send(File& aData, ErrorResult& aRv)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class DOMFile;
|
||||
class File;
|
||||
}
|
||||
|
||||
class DataChannel;
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
static_cast<int>(aType));
|
||||
}
|
||||
void Send(const nsAString& aData, mozilla::ErrorResult& aRv);
|
||||
void Send(mozilla::dom::DOMFile& aData, mozilla::ErrorResult& aRv);
|
||||
void Send(mozilla::dom::File& aData, mozilla::ErrorResult& aRv);
|
||||
void Send(const mozilla::dom::ArrayBuffer& aData, mozilla::ErrorResult& aRv);
|
||||
void Send(const mozilla::dom::ArrayBufferView& aData,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "nsContentCID.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsNetCID.h"
|
||||
|
@ -20,6 +19,7 @@
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FileReaderBinding.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
|
@ -186,7 +186,7 @@ nsDOMFileReader::ReadAsArrayBuffer(nsIDOMBlob* aFile, JSContext* aCx)
|
|||
{
|
||||
NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
|
||||
ErrorResult rv;
|
||||
nsRefPtr<DOMFile> file = static_cast<DOMFile*>(aFile);
|
||||
nsRefPtr<File> file = static_cast<File*>(aFile);
|
||||
ReadAsArrayBuffer(aCx, *file, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ nsDOMFileReader::ReadAsBinaryString(nsIDOMBlob* aFile)
|
|||
{
|
||||
NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
|
||||
ErrorResult rv;
|
||||
nsRefPtr<DOMFile> file = static_cast<DOMFile*>(aFile);
|
||||
nsRefPtr<File> file = static_cast<File*>(aFile);
|
||||
ReadAsBinaryString(*file, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ nsDOMFileReader::ReadAsText(nsIDOMBlob* aFile,
|
|||
{
|
||||
NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
|
||||
ErrorResult rv;
|
||||
nsRefPtr<DOMFile> file = static_cast<DOMFile*>(aFile);
|
||||
nsRefPtr<File> file = static_cast<File*>(aFile);
|
||||
ReadAsText(*file, aCharset, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ nsDOMFileReader::ReadAsDataURL(nsIDOMBlob* aFile)
|
|||
{
|
||||
NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER);
|
||||
ErrorResult rv;
|
||||
nsRefPtr<DOMFile> file = static_cast<DOMFile*>(aFile);
|
||||
nsRefPtr<File> file = static_cast<File*>(aFile);
|
||||
ReadAsDataURL(*file, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ nsDOMFileReader::DoReadData(nsIAsyncInputStream* aStream, uint64_t aCount)
|
|||
|
||||
void
|
||||
nsDOMFileReader::ReadFileContent(JSContext* aCx,
|
||||
DOMFile& aFile,
|
||||
File& aFile,
|
||||
const nsAString &aCharset,
|
||||
eDataFormat aDataFormat,
|
||||
ErrorResult& aRv)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class DOMFile;
|
||||
class File;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ class nsDOMFileReader : public mozilla::dom::FileIOObject,
|
|||
{
|
||||
typedef mozilla::ErrorResult ErrorResult;
|
||||
typedef mozilla::dom::GlobalObject GlobalObject;
|
||||
typedef mozilla::dom::DOMFile DOMFile;
|
||||
typedef mozilla::dom::File File;
|
||||
public:
|
||||
nsDOMFileReader();
|
||||
|
||||
|
@ -68,17 +68,17 @@ public:
|
|||
// WebIDL
|
||||
static already_AddRefed<nsDOMFileReader>
|
||||
Constructor(const GlobalObject& aGlobal, ErrorResult& aRv);
|
||||
void ReadAsArrayBuffer(JSContext* aCx, DOMFile& aBlob, ErrorResult& aRv)
|
||||
void ReadAsArrayBuffer(JSContext* aCx, File& aBlob, ErrorResult& aRv)
|
||||
{
|
||||
ReadFileContent(aCx, aBlob, EmptyString(), FILE_AS_ARRAYBUFFER, aRv);
|
||||
}
|
||||
|
||||
void ReadAsText(DOMFile& aBlob, const nsAString& aLabel, ErrorResult& aRv)
|
||||
void ReadAsText(File& aBlob, const nsAString& aLabel, ErrorResult& aRv)
|
||||
{
|
||||
ReadFileContent(nullptr, aBlob, aLabel, FILE_AS_TEXT, aRv);
|
||||
}
|
||||
|
||||
void ReadAsDataURL(DOMFile& aBlob, ErrorResult& aRv)
|
||||
void ReadAsDataURL(File& aBlob, ErrorResult& aRv)
|
||||
{
|
||||
ReadFileContent(nullptr, aBlob, EmptyString(), FILE_AS_DATAURL, aRv);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
using FileIOObject::SetOnerror;
|
||||
IMPL_EVENT_HANDLER(loadend)
|
||||
|
||||
void ReadAsBinaryString(DOMFile& aBlob, ErrorResult& aRv)
|
||||
void ReadAsBinaryString(File& aBlob, ErrorResult& aRv)
|
||||
{
|
||||
ReadFileContent(nullptr, aBlob, EmptyString(), FILE_AS_BINARY, aRv);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ protected:
|
|||
FILE_AS_DATAURL
|
||||
};
|
||||
|
||||
void ReadFileContent(JSContext* aCx, DOMFile& aBlob,
|
||||
void ReadFileContent(JSContext* aCx, File& aBlob,
|
||||
const nsAString &aCharset, eDataFormat aDataFormat,
|
||||
ErrorResult& aRv);
|
||||
nsresult GetAsText(nsIDOMBlob *aFile, const nsACString &aCharset,
|
||||
|
|
|
@ -2,10 +2,11 @@
|
|||
* 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 "nsDOMFile.h"
|
||||
#include "nsFormData.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/dom/FormDataBinding.h"
|
||||
|
||||
|
@ -73,7 +74,7 @@ nsFormData::Append(const nsAString& aName, const nsAString& aValue)
|
|||
}
|
||||
|
||||
void
|
||||
nsFormData::Append(const nsAString& aName, DOMFile& aBlob,
|
||||
nsFormData::Append(const nsAString& aName, File& aBlob,
|
||||
const Optional<nsAString>& aFilename)
|
||||
{
|
||||
nsString filename;
|
||||
|
@ -105,7 +106,7 @@ nsFormData::Append(const nsAString& aName, nsIVariant* aValue)
|
|||
nsMemory::Free(iid);
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> domBlob = do_QueryInterface(supports);
|
||||
nsRefPtr<DOMFile> blob = static_cast<DOMFile*>(domBlob.get());
|
||||
nsRefPtr<File> blob = static_cast<File*>(domBlob.get());
|
||||
if (domBlob) {
|
||||
Optional<nsAString> temp;
|
||||
Append(aName, *blob, temp);
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace mozilla {
|
|||
class ErrorResult;
|
||||
|
||||
namespace dom {
|
||||
class DOMFile;
|
||||
class File;
|
||||
class HTMLFormElement;
|
||||
class GlobalObject;
|
||||
} // namespace dom
|
||||
|
@ -55,7 +55,7 @@ public:
|
|||
const mozilla::dom::Optional<mozilla::dom::NonNull<mozilla::dom::HTMLFormElement> >& aFormElement,
|
||||
mozilla::ErrorResult& aRv);
|
||||
void Append(const nsAString& aName, const nsAString& aValue);
|
||||
void Append(const nsAString& aName, mozilla::dom::DOMFile& aBlob,
|
||||
void Append(const nsAString& aName, mozilla::dom::File& aBlob,
|
||||
const mozilla::dom::Optional<nsAString>& aFilename);
|
||||
|
||||
// nsFormSubmission
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIDOMClassInfo.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/CycleCollectedJSRuntime.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/nsIContentParent.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
@ -204,7 +204,7 @@ BuildClonedMessageData(typename BlobTraits<Flavor>::ConcreteContentManagerType*
|
|||
SerializedStructuredCloneBuffer& buffer = aClonedData.data();
|
||||
buffer.data = aData.mData;
|
||||
buffer.dataLength = aData.mDataLength;
|
||||
const nsTArray<nsRefPtr<DOMFile>>& blobs = aData.mClosure.mBlobs;
|
||||
const nsTArray<nsRefPtr<File>>& blobs = aData.mClosure.mBlobs;
|
||||
if (!blobs.IsEmpty()) {
|
||||
typedef typename BlobTraits<Flavor>::ProtocolType ProtocolType;
|
||||
InfallibleTArray<ProtocolType*>& blobList = DataBlobs<Flavor>::Blobs(aClonedData);
|
||||
|
@ -256,12 +256,12 @@ UnpackClonedMessageData(const ClonedMessageData& aData)
|
|||
static_cast<typename BlobTraits<Flavor>::BlobType*>(blobs[i]);
|
||||
MOZ_ASSERT(blob);
|
||||
|
||||
nsRefPtr<DOMFileImpl> blobImpl = blob->GetBlobImpl();
|
||||
nsRefPtr<FileImpl> blobImpl = blob->GetBlobImpl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
// This object will be duplicated with a correct parent before being
|
||||
// exposed to JS.
|
||||
nsRefPtr<DOMFile> domBlob = new DOMFile(nullptr, blobImpl);
|
||||
nsRefPtr<File> domBlob = new File(nullptr, blobImpl);
|
||||
cloneData.mClosure.mBlobs.AppendElement(domBlob);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
#include "nsClassHashtable.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "DOMMediaStream.h"
|
||||
#include "mozilla/dom/MediaSource.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
|
||||
using mozilla::dom::DOMFileImpl;
|
||||
using mozilla::dom::FileImpl;
|
||||
using mozilla::ErrorResult;
|
||||
using mozilla::LoadInfo;
|
||||
|
||||
|
@ -497,7 +497,7 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
|
|||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
nsCOMPtr<PIDOMFileImpl> blobImpl = do_QueryInterface(info->mObject);
|
||||
nsCOMPtr<PIFileImpl> blobImpl = do_QueryInterface(info->mObject);
|
||||
if (!blobImpl) {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
|
|||
}
|
||||
#endif
|
||||
|
||||
DOMFileImpl* blob = static_cast<DOMFileImpl*>(blobImpl.get());
|
||||
FileImpl* blob = static_cast<FileImpl*>(blobImpl.get());
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
nsresult rv = blob->GetInternalStream(getter_AddRefs(stream));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -596,12 +596,12 @@ NS_GetStreamForBlobURI(nsIURI* aURI, nsIInputStream** aStream)
|
|||
|
||||
*aStream = nullptr;
|
||||
|
||||
nsCOMPtr<PIDOMFileImpl> blobImpl = do_QueryInterface(GetDataObject(aURI));
|
||||
nsCOMPtr<PIFileImpl> blobImpl = do_QueryInterface(GetDataObject(aURI));
|
||||
if (!blobImpl) {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
DOMFileImpl* blob = static_cast<DOMFileImpl*>(blobImpl.get());
|
||||
FileImpl* blob = static_cast<FileImpl*>(blobImpl.get());
|
||||
return blob->GetInternalStream(aStream);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
|
@ -56,7 +57,6 @@
|
|||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsAsyncRedirectVerifyHelper.h"
|
||||
#include "nsStringBuffer.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIFileChannel.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
@ -1898,9 +1898,8 @@ bool nsXMLHttpRequest::CreateDOMFile(nsIRequest *request)
|
|||
nsAutoCString contentType;
|
||||
mChannel->GetContentType(contentType);
|
||||
|
||||
mDOMFile =
|
||||
DOMFile::CreateFromFile(GetOwner(), file, EmptyString(),
|
||||
NS_ConvertASCIItoUTF16(contentType));
|
||||
mDOMFile = File::CreateFromFile(GetOwner(), file, EmptyString(),
|
||||
NS_ConvertASCIItoUTF16(contentType));
|
||||
|
||||
mBlobSet = nullptr;
|
||||
NS_ASSERTION(mResponseBody.IsEmpty(), "mResponseBody should be empty");
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
class AsyncVerifyRedirectCallbackForwarder;
|
||||
class BlobSet;
|
||||
class nsDOMFile;
|
||||
class nsFormData;
|
||||
class nsIJARChannel;
|
||||
class nsILoadGroup;
|
||||
|
@ -52,7 +51,7 @@ class nsIJSID;
|
|||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class DOMFile;
|
||||
class File;
|
||||
}
|
||||
|
||||
// A helper for building up an ArrayBuffer object's data
|
||||
|
@ -350,7 +349,7 @@ private:
|
|||
{
|
||||
mValue.mArrayBufferView = aArrayBufferView;
|
||||
}
|
||||
explicit RequestBody(mozilla::dom::DOMFile& aBlob) : mType(Blob)
|
||||
explicit RequestBody(mozilla::dom::File& aBlob) : mType(Blob)
|
||||
{
|
||||
mValue.mBlob = &aBlob;
|
||||
}
|
||||
|
@ -384,7 +383,7 @@ private:
|
|||
union Value {
|
||||
const mozilla::dom::ArrayBuffer* mArrayBuffer;
|
||||
const mozilla::dom::ArrayBufferView* mArrayBufferView;
|
||||
mozilla::dom::DOMFile* mBlob;
|
||||
mozilla::dom::File* mBlob;
|
||||
nsIDocument* mDocument;
|
||||
const nsAString* mString;
|
||||
nsFormData* mFormData;
|
||||
|
@ -440,7 +439,7 @@ public:
|
|||
{
|
||||
aRv = Send(RequestBody(&aArrayBufferView));
|
||||
}
|
||||
void Send(mozilla::dom::DOMFile& aBlob, ErrorResult& aRv)
|
||||
void Send(mozilla::dom::File& aBlob, ErrorResult& aRv)
|
||||
{
|
||||
aRv = Send(RequestBody(aBlob));
|
||||
}
|
||||
|
@ -671,10 +670,10 @@ protected:
|
|||
|
||||
// It is either a cached blob-response from the last call to GetResponse,
|
||||
// but is also explicitly set in OnStopRequest.
|
||||
nsRefPtr<mozilla::dom::DOMFile> mResponseBlob;
|
||||
nsRefPtr<mozilla::dom::File> mResponseBlob;
|
||||
// Non-null only when we are able to get a os-file representation of the
|
||||
// response, i.e. when loading from a file.
|
||||
nsRefPtr<mozilla::dom::DOMFile> mDOMFile;
|
||||
nsRefPtr<mozilla::dom::File> mDOMFile;
|
||||
// We stream data to mBlobSet when response type is "blob" or "moz-blob"
|
||||
// and mDOMFile is null.
|
||||
nsAutoPtr<BlobSet> mBlobSet;
|
||||
|
|
|
@ -33,7 +33,7 @@ function createFileWithData(fileData) {
|
|||
return testFile;
|
||||
}
|
||||
|
||||
/** Test for Bug 914381. DOMFile's created in JS using an nsIFile should allow mozGetFullPathInternal calls to succeed **/
|
||||
/** Test for Bug 914381. File's created in JS using an nsIFile should allow mozGetFullPathInternal calls to succeed **/
|
||||
var file = createFileWithData("Test bug 914381");
|
||||
var f = new File(file);
|
||||
is(f.mozFullPathInternal, undefined, "mozFullPathInternal is undefined from js");
|
||||
|
|
|
@ -30,7 +30,7 @@ class SourceSurface;
|
|||
|
||||
namespace dom {
|
||||
|
||||
class DOMFile;
|
||||
class File;
|
||||
class FileCallback;
|
||||
class HTMLCanvasPrintState;
|
||||
class PrintCallback;
|
||||
|
@ -102,9 +102,9 @@ public:
|
|||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::moz_opaque, aValue, aRv);
|
||||
}
|
||||
already_AddRefed<DOMFile> MozGetAsFile(const nsAString& aName,
|
||||
const nsAString& aType,
|
||||
ErrorResult& aRv);
|
||||
already_AddRefed<File> MozGetAsFile(const nsAString& aName,
|
||||
const nsAString& aType,
|
||||
ErrorResult& aRv);
|
||||
already_AddRefed<nsISupports> MozGetIPCContext(const nsAString& aContextId,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mozilla/Base64.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/HTMLCanvasElementBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/dom/MouseEvent.h"
|
||||
|
@ -23,7 +24,6 @@
|
|||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsITimer.h"
|
||||
|
@ -549,9 +549,9 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
|
|||
, mFileCallback(aCallback) {}
|
||||
|
||||
// This is called on main thread.
|
||||
nsresult ReceiveBlob(already_AddRefed<DOMFile> aBlob)
|
||||
nsresult ReceiveBlob(already_AddRefed<File> aBlob)
|
||||
{
|
||||
nsRefPtr<DOMFile> blob = aBlob;
|
||||
nsRefPtr<File> blob = aBlob;
|
||||
uint64_t size;
|
||||
nsresult rv = blob->GetSize(&size);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -560,7 +560,7 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
|
|||
JS_updateMallocCounter(jsapi.cx(), size);
|
||||
}
|
||||
|
||||
nsRefPtr<DOMFile> newBlob = new DOMFile(mGlobal, blob->Impl());
|
||||
nsRefPtr<File> newBlob = new File(mGlobal, blob->Impl());
|
||||
|
||||
mozilla::ErrorResult error;
|
||||
mFileCallback->Call(*newBlob, error);
|
||||
|
@ -587,14 +587,14 @@ HTMLCanvasElement::ToBlob(JSContext* aCx,
|
|||
callback);
|
||||
}
|
||||
|
||||
already_AddRefed<DOMFile>
|
||||
already_AddRefed<File>
|
||||
HTMLCanvasElement::MozGetAsFile(const nsAString& aName,
|
||||
const nsAString& aType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIDOMFile> file;
|
||||
aRv = MozGetAsFile(aName, aType, getter_AddRefs(file));
|
||||
nsRefPtr<DOMFile> tmp = static_cast<DOMFile*>(file.get());
|
||||
nsRefPtr<File> tmp = static_cast<File*>(file.get());
|
||||
return tmp.forget();
|
||||
}
|
||||
|
||||
|
@ -640,10 +640,10 @@ HTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
|
|||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(OwnerDoc()->GetScopeObject());
|
||||
|
||||
// The DOMFile takes ownership of the buffer
|
||||
nsRefPtr<DOMFile> file =
|
||||
DOMFile::CreateMemoryFile(win, imgData, (uint32_t)imgSize, aName, type,
|
||||
PR_Now());
|
||||
// The File takes ownership of the buffer
|
||||
nsRefPtr<File> file =
|
||||
File::CreateMemoryFile(win, imgData, (uint32_t)imgSize, aName, type,
|
||||
PR_Now());
|
||||
|
||||
file.forget(aResult);
|
||||
return NS_OK;
|
||||
|
|
|
@ -73,9 +73,9 @@
|
|||
#include "nsIRadioGroupContainer.h"
|
||||
|
||||
// input type=file
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIContentPrefService.h"
|
||||
#include "nsIMIMEService.h"
|
||||
|
@ -236,11 +236,11 @@ class HTMLInputElementState MOZ_FINAL : public nsISupports
|
|||
mValue = aValue;
|
||||
}
|
||||
|
||||
const nsTArray<nsRefPtr<DOMFile>>& GetFiles() {
|
||||
const nsTArray<nsRefPtr<File>>& GetFiles() {
|
||||
return mFiles;
|
||||
}
|
||||
|
||||
void SetFiles(const nsTArray<nsRefPtr<DOMFile>>& aFiles) {
|
||||
void SetFiles(const nsTArray<nsRefPtr<File>>& aFiles) {
|
||||
mFiles.Clear();
|
||||
mFiles.AppendElements(aFiles);
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ class HTMLInputElementState MOZ_FINAL : public nsISupports
|
|||
~HTMLInputElementState() {}
|
||||
|
||||
nsString mValue;
|
||||
nsTArray<nsRefPtr<DOMFile>> mFiles;
|
||||
nsTArray<nsRefPtr<File>> mFiles;
|
||||
bool mChecked;
|
||||
bool mCheckedSet;
|
||||
};
|
||||
|
@ -316,7 +316,7 @@ UploadLastDir::ContentPrefCallback::HandleError(nsresult error)
|
|||
namespace {
|
||||
|
||||
/**
|
||||
* This enumerator returns DOMFile objects after wrapping a single
|
||||
* This enumerator returns File objects after wrapping a single
|
||||
* nsIFile representing a directory. It enumerates the files under that
|
||||
* directory and its subdirectories as a flat list of files, ignoring/skipping
|
||||
* over symbolic links.
|
||||
|
@ -376,7 +376,7 @@ public:
|
|||
}
|
||||
|
||||
// The parent for this object will be set on the main thread.
|
||||
nsRefPtr<DOMFile> domFile = DOMFile::CreateFromFile(nullptr, mNextFile);
|
||||
nsRefPtr<File> domFile = File::CreateFromFile(nullptr, mNextFile);
|
||||
nsCString relDescriptor;
|
||||
nsresult rv =
|
||||
mNextFile->GetRelativeDescriptor(mTopDirsParent, relDescriptor);
|
||||
|
@ -389,8 +389,7 @@ public:
|
|||
MOZ_ASSERT(length >= 0);
|
||||
if (length > 0) {
|
||||
// Note that we leave the trailing "/" on the path.
|
||||
DOMFileImplFile* fileImpl =
|
||||
static_cast<DOMFileImplFile*>(domFile->Impl());
|
||||
FileImplFile* fileImpl = static_cast<FileImplFile*>(domFile->Impl());
|
||||
MOZ_ASSERT(fileImpl);
|
||||
fileImpl->SetPath(Substring(path, 0, uint32_t(length)));
|
||||
}
|
||||
|
@ -514,7 +513,7 @@ public:
|
|||
|
||||
NS_IMETHOD Run() {
|
||||
if (!NS_IsMainThread()) {
|
||||
// Build up list of DOMFile objects on this dedicated thread:
|
||||
// Build up list of File objects on this dedicated thread:
|
||||
nsCOMPtr<nsISimpleEnumerator> iter =
|
||||
new DirPickerRecursiveFileEnumerator(mTopDir);
|
||||
bool hasMore = true;
|
||||
|
@ -523,7 +522,7 @@ public:
|
|||
iter->GetNext(getter_AddRefs(tmp));
|
||||
nsCOMPtr<nsIDOMFile> domFile = do_QueryInterface(tmp);
|
||||
MOZ_ASSERT(domFile);
|
||||
mFileList.AppendElement(static_cast<DOMFile*>(domFile.get()));
|
||||
mFileList.AppendElement(static_cast<File*>(domFile.get()));
|
||||
mFileListLength = mFileList.Length();
|
||||
if (mCanceled) {
|
||||
MOZ_ASSERT(!mInput, "This is bad - how did this happen?");
|
||||
|
@ -553,11 +552,11 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Recreate DOMFile with the correct parent object.
|
||||
// Recreate File with the correct parent object.
|
||||
nsCOMPtr<nsIGlobalObject> global = mInput->OwnerDoc()->GetScopeObject();
|
||||
for (uint32_t i = 0; i < mFileList.Length(); ++i) {
|
||||
MOZ_ASSERT(!mFileList[i]->GetParentObject());
|
||||
mFileList[i] = new DOMFile(global, mFileList[i]->Impl());
|
||||
mFileList[i] = new File(global, mFileList[i]->Impl());
|
||||
}
|
||||
|
||||
// The text control frame (if there is one) isn't going to send a change
|
||||
|
@ -603,7 +602,7 @@ public:
|
|||
private:
|
||||
nsRefPtr<HTMLInputElement> mInput;
|
||||
nsCOMPtr<nsIFile> mTopDir;
|
||||
nsTArray<nsRefPtr<DOMFile>> mFileList;
|
||||
nsTArray<nsRefPtr<File>> mFileList;
|
||||
|
||||
// We access the list length on both threads, so we need the indirection of
|
||||
// this atomic member to make the access thread safe:
|
||||
|
@ -629,7 +628,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
|
|||
|
||||
if (mode == static_cast<int16_t>(nsIFilePicker::modeGetFolder)) {
|
||||
// Directory picking is different, since we still need to do more I/O to
|
||||
// build up the list of DOMFile objects. Since this may block for a
|
||||
// build up the list of File objects. Since this may block for a
|
||||
// long time, we need to build the list off on another dedicated thread to
|
||||
// avoid blocking any other activities that the browser is carrying out.
|
||||
|
||||
|
@ -664,7 +663,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
|
|||
}
|
||||
|
||||
// Collect new selected filenames
|
||||
nsTArray<nsRefPtr<DOMFile>> newFiles;
|
||||
nsTArray<nsRefPtr<File>> newFiles;
|
||||
if (mode == static_cast<int16_t>(nsIFilePicker::modeOpenMultiple)) {
|
||||
nsCOMPtr<nsISimpleEnumerator> iter;
|
||||
nsresult rv = mFilePicker->GetDomfiles(getter_AddRefs(iter));
|
||||
|
@ -681,7 +680,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
|
|||
iter->GetNext(getter_AddRefs(tmp));
|
||||
nsCOMPtr<nsIDOMFile> domFile = do_QueryInterface(tmp);
|
||||
MOZ_ASSERT(domFile);
|
||||
newFiles.AppendElement(static_cast<DOMFile*>(domFile.get()));
|
||||
newFiles.AppendElement(static_cast<File*>(domFile.get()));
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(mode == static_cast<int16_t>(nsIFilePicker::modeOpen));
|
||||
|
@ -689,7 +688,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
|
|||
nsresult rv = mFilePicker->GetDomfile(getter_AddRefs(domFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (domFile) {
|
||||
newFiles.AppendElement(static_cast<DOMFile*>(domFile.get()));
|
||||
newFiles.AppendElement(static_cast<File*>(domFile.get()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -945,7 +944,7 @@ HTMLInputElement::InitFilePicker(FilePickerType aType)
|
|||
// Set default directry and filename
|
||||
nsAutoString defaultName;
|
||||
|
||||
const nsTArray<nsRefPtr<DOMFile>>& oldFiles = GetFilesInternal();
|
||||
const nsTArray<nsRefPtr<File>>& oldFiles = GetFilesInternal();
|
||||
|
||||
nsCOMPtr<nsIFilePickerShownCallback> callback =
|
||||
new HTMLInputElement::nsFilePickerShownCallback(this, filePicker);
|
||||
|
@ -1725,7 +1724,7 @@ HTMLInputElement::IsValueEmpty() const
|
|||
void
|
||||
HTMLInputElement::ClearFiles(bool aSetValueChanged)
|
||||
{
|
||||
nsTArray<nsRefPtr<DOMFile>> files;
|
||||
nsTArray<nsRefPtr<File>> files;
|
||||
SetFiles(files, aSetValueChanged);
|
||||
}
|
||||
|
||||
|
@ -2319,7 +2318,7 @@ HTMLInputElement::MozGetFileNameArray(uint32_t* aLength, char16_t*** aFileNames)
|
|||
void
|
||||
HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames)
|
||||
{
|
||||
nsTArray<nsRefPtr<DOMFile>> files;
|
||||
nsTArray<nsRefPtr<File>> files;
|
||||
for (uint32_t i = 0; i < aFileNames.Length(); ++i) {
|
||||
nsCOMPtr<nsIFile> file;
|
||||
|
||||
|
@ -2338,7 +2337,7 @@ HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames)
|
|||
|
||||
if (file) {
|
||||
nsCOMPtr<nsIGlobalObject> global = OwnerDoc()->GetScopeObject();
|
||||
nsRefPtr<DOMFile> domFile = DOMFile::CreateFromFile(global, file);
|
||||
nsRefPtr<File> domFile = File::CreateFromFile(global, file);
|
||||
files.AppendElement(domFile);
|
||||
} else {
|
||||
continue; // Not much we can do if the file doesn't exist
|
||||
|
@ -2574,7 +2573,7 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
|
|||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::SetFiles(const nsTArray<nsRefPtr<DOMFile>>& aFiles,
|
||||
HTMLInputElement::SetFiles(const nsTArray<nsRefPtr<File>>& aFiles,
|
||||
bool aSetValueChanged)
|
||||
{
|
||||
mFiles.Clear();
|
||||
|
@ -2594,7 +2593,7 @@ HTMLInputElement::SetFiles(nsIDOMFileList* aFiles,
|
|||
uint32_t listLength;
|
||||
aFiles->GetLength(&listLength);
|
||||
for (uint32_t i = 0; i < listLength; i++) {
|
||||
nsRefPtr<DOMFile> file = files->Item(i);
|
||||
nsRefPtr<File> file = files->Item(i);
|
||||
mFiles.AppendElement(file);
|
||||
}
|
||||
}
|
||||
|
@ -2794,7 +2793,7 @@ HTMLInputElement::UpdateFileList()
|
|||
if (mFileList) {
|
||||
mFileList->Clear();
|
||||
|
||||
const nsTArray<nsRefPtr<DOMFile>>& files = GetFilesInternal();
|
||||
const nsTArray<nsRefPtr<File>>& files = GetFilesInternal();
|
||||
for (uint32_t i = 0; i < files.Length(); ++i) {
|
||||
if (!mFileList->Append(files[i])) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -5644,7 +5643,7 @@ HTMLInputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
|
|||
if (mType == NS_FORM_INPUT_FILE) {
|
||||
// Submit files
|
||||
|
||||
const nsTArray<nsRefPtr<DOMFile>>& files = GetFilesInternal();
|
||||
const nsTArray<nsRefPtr<File>>& files = GetFilesInternal();
|
||||
|
||||
for (uint32_t i = 0; i < files.Length(); ++i) {
|
||||
aFormSubmission->AddNameFilePair(name, files[i], NullString());
|
||||
|
@ -5892,7 +5891,7 @@ HTMLInputElement::RestoreState(nsPresState* aState)
|
|||
break;
|
||||
case VALUE_MODE_FILENAME:
|
||||
{
|
||||
const nsTArray<nsRefPtr<DOMFile>>& files = inputState->GetFiles();
|
||||
const nsTArray<nsRefPtr<File>>& files = inputState->GetFiles();
|
||||
SetFiles(files, true);
|
||||
}
|
||||
break;
|
||||
|
@ -6402,7 +6401,7 @@ HTMLInputElement::IsValueMissing() const
|
|||
return IsValueEmpty();
|
||||
case VALUE_MODE_FILENAME:
|
||||
{
|
||||
const nsTArray<nsRefPtr<DOMFile>>& files = GetFilesInternal();
|
||||
const nsTArray<nsRefPtr<File>>& files = GetFilesInternal();
|
||||
return files.IsEmpty();
|
||||
}
|
||||
case VALUE_MODE_DEFAULT_ON:
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace dom {
|
|||
|
||||
class Date;
|
||||
class DirPickerFileListBuilderTask;
|
||||
class DOMFile;
|
||||
class File;
|
||||
class FileList;
|
||||
|
||||
class UploadLastDir MOZ_FINAL : public nsIObserver, public nsSupportsWeakReference {
|
||||
|
@ -211,12 +211,12 @@ public:
|
|||
|
||||
void GetDisplayFileName(nsAString& aFileName) const;
|
||||
|
||||
const nsTArray<nsRefPtr<DOMFile>>& GetFilesInternal() const
|
||||
const nsTArray<nsRefPtr<File>>& GetFilesInternal() const
|
||||
{
|
||||
return mFiles;
|
||||
}
|
||||
|
||||
void SetFiles(const nsTArray<nsRefPtr<DOMFile>>& aFiles, bool aSetValueChanged);
|
||||
void SetFiles(const nsTArray<nsRefPtr<File>>& aFiles, bool aSetValueChanged);
|
||||
void SetFiles(nsIDOMFileList* aFiles, bool aSetValueChanged);
|
||||
|
||||
// Called when a nsIFilePicker or a nsIColorPicker terminate.
|
||||
|
@ -1252,7 +1252,7 @@ protected:
|
|||
* the frame. Whenever the frame wants to change the filename it has to call
|
||||
* SetFileNames to update this member.
|
||||
*/
|
||||
nsTArray<nsRefPtr<DOMFile>> mFiles;
|
||||
nsTArray<nsRefPtr<File>> mFiles;
|
||||
|
||||
nsRefPtr<FileList> mFileList;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "EncodedBufferCache.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsAnonymousTemporaryFile.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "prio.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -39,16 +39,16 @@ EncodedBufferCache::AppendBuffer(nsTArray<uint8_t> & aBuf)
|
|||
|
||||
}
|
||||
|
||||
already_AddRefed<dom::DOMFile>
|
||||
already_AddRefed<dom::File>
|
||||
EncodedBufferCache::ExtractBlob(nsISupports* aParent,
|
||||
const nsAString &aContentType)
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
nsRefPtr<dom::DOMFile> blob;
|
||||
nsRefPtr<dom::File> blob;
|
||||
if (mTempFileEnabled) {
|
||||
// generate new temporary file to write
|
||||
blob = dom::DOMFile::CreateTemporaryFileBlob(aParent, mFD, 0, mDataSize,
|
||||
aContentType);
|
||||
blob = dom::File::CreateTemporaryFileBlob(aParent, mFD, 0, mDataSize,
|
||||
aContentType);
|
||||
// fallback to memory blob
|
||||
mTempFileEnabled = false;
|
||||
mDataSize = 0;
|
||||
|
@ -63,8 +63,8 @@ EncodedBufferCache::ExtractBlob(nsISupports* aParent,
|
|||
mEncodedBuffers.ElementAt(i).Length());
|
||||
offset += mEncodedBuffers.ElementAt(i).Length();
|
||||
}
|
||||
blob = dom::DOMFile::CreateMemoryFile(aParent, blobData, mDataSize,
|
||||
aContentType);
|
||||
blob = dom::File::CreateMemoryFile(aParent, blobData, mDataSize,
|
||||
aContentType);
|
||||
mEncodedBuffers.Clear();
|
||||
} else
|
||||
return nullptr;
|
||||
|
|
|
@ -17,7 +17,7 @@ class nsIDOMBlob;
|
|||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class DOMFile;
|
||||
class File;
|
||||
}
|
||||
|
||||
class ReentrantMonitor;
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
// aBuf will append to mEncodedBuffers or temporary File, aBuf also be cleared
|
||||
void AppendBuffer(nsTArray<uint8_t> & aBuf);
|
||||
// Read all buffer from memory or file System, also Remove the temporary file or clean the buffers in memory.
|
||||
already_AddRefed<dom::DOMFile> ExtractBlob(nsISupports* aParent, const nsAString &aContentType);
|
||||
already_AddRefed<dom::File> ExtractBlob(nsISupports* aParent, const nsAString &aContentType);
|
||||
|
||||
private:
|
||||
//array for storing the encoded data.
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/AudioStreamTrack.h"
|
||||
#include "mozilla/dom/BlobEvent.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/RecordErrorEvent.h"
|
||||
#include "mozilla/dom/VideoStreamTrack.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsProxyRelease.h"
|
||||
|
@ -923,7 +923,7 @@ MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed<nsIDOMBlob>&& aBlob)
|
|||
init.mCancelable = false;
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> blob = aBlob;
|
||||
init.mData = static_cast<DOMFile*>(blob.get());
|
||||
init.mData = static_cast<File*>(blob.get());
|
||||
|
||||
nsRefPtr<BlobEvent> event =
|
||||
BlobEvent::Constructor(this,
|
||||
|
|
|
@ -15,18 +15,18 @@
|
|||
namespace mozilla {
|
||||
|
||||
nsresult
|
||||
CaptureTask::TaskComplete(already_AddRefed<dom::DOMFile> aBlob, nsresult aRv)
|
||||
CaptureTask::TaskComplete(already_AddRefed<dom::File> aBlob, nsresult aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
DetachStream();
|
||||
|
||||
nsresult rv;
|
||||
nsRefPtr<dom::DOMFile> blob(aBlob);
|
||||
nsRefPtr<dom::File> blob(aBlob);
|
||||
|
||||
// We have to set the parent because the blob has been generated with a valid one.
|
||||
if (blob) {
|
||||
blob = new dom::DOMFile(mImageCapture->GetParentObject(), blob->Impl());
|
||||
blob = new dom::File(mImageCapture->GetParentObject(), blob->Impl());
|
||||
}
|
||||
|
||||
if (mPrincipalChanged) {
|
||||
|
@ -104,9 +104,9 @@ CaptureTask::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID,
|
|||
public:
|
||||
explicit EncodeComplete(CaptureTask* aTask) : mTask(aTask) {}
|
||||
|
||||
nsresult ReceiveBlob(already_AddRefed<dom::DOMFile> aBlob) MOZ_OVERRIDE
|
||||
nsresult ReceiveBlob(already_AddRefed<dom::File> aBlob) MOZ_OVERRIDE
|
||||
{
|
||||
nsRefPtr<dom::DOMFile> blob(aBlob);
|
||||
nsRefPtr<dom::File> blob(aBlob);
|
||||
mTask->TaskComplete(blob.forget(), NS_OK);
|
||||
mTask = nullptr;
|
||||
return NS_OK;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class File;
|
||||
class ImageCapture;
|
||||
class DOMFile;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
//
|
||||
// Note:
|
||||
// this function should be called on main thread.
|
||||
nsresult TaskComplete(already_AddRefed<dom::DOMFile> aBlob, nsresult aRv);
|
||||
nsresult TaskComplete(already_AddRefed<dom::File> aBlob, nsresult aRv);
|
||||
|
||||
// Add listeners into MediaStream and PrincipalChangeObserver. It should be on
|
||||
// main thread only.
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
#include "ImageCapture.h"
|
||||
#include "mozilla/dom/BlobEvent.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ImageCaptureError.h"
|
||||
#include "mozilla/dom/ImageCaptureErrorEvent.h"
|
||||
#include "mozilla/dom/ImageCaptureErrorEventBinding.h"
|
||||
#include "mozilla/dom/VideoStreamTrack.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "CaptureTask.h"
|
||||
#include "MediaEngine.h"
|
||||
|
@ -102,9 +102,9 @@ ImageCapture::TakePhotoByMediaEngine()
|
|||
mPrincipalChanged = true;
|
||||
}
|
||||
|
||||
nsresult PhotoComplete(already_AddRefed<DOMFile> aBlob) MOZ_OVERRIDE
|
||||
nsresult PhotoComplete(already_AddRefed<File> aBlob) MOZ_OVERRIDE
|
||||
{
|
||||
nsRefPtr<DOMFile> blob = aBlob;
|
||||
nsRefPtr<File> blob = aBlob;
|
||||
|
||||
if (mPrincipalChanged) {
|
||||
return PhotoError(NS_ERROR_DOM_SECURITY_ERR);
|
||||
|
@ -172,7 +172,7 @@ ImageCapture::TakePhoto(ErrorResult& aResult)
|
|||
}
|
||||
|
||||
nsresult
|
||||
ImageCapture::PostBlobEvent(DOMFile* aBlob)
|
||||
ImageCapture::PostBlobEvent(File* aBlob)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!CheckPrincipal()) {
|
||||
|
|
|
@ -32,7 +32,7 @@ PRLogModuleInfo* GetICLog();
|
|||
|
||||
namespace dom {
|
||||
|
||||
class DOMFile;
|
||||
class File;
|
||||
class VideoStreamTrack;
|
||||
|
||||
/**
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
ImageCapture(VideoStreamTrack* aVideoStreamTrack, nsPIDOMWindow* aOwnerWindow);
|
||||
|
||||
// Post a Blob event to script.
|
||||
nsresult PostBlobEvent(DOMFile* aBlob);
|
||||
nsresult PostBlobEvent(File* aBlob);
|
||||
|
||||
// Post an error event to script.
|
||||
// aErrorCode should be one of error codes defined in ImageCaptureError.h.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class DOMFile;
|
||||
class File;
|
||||
}
|
||||
|
||||
struct VideoTrackConstraintsN;
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
|
||||
// aBlob is the image captured by MediaEngineSource. It is
|
||||
// called on main thread.
|
||||
virtual nsresult PhotoComplete(already_AddRefed<dom::DOMFile> aBlob) = 0;
|
||||
virtual nsresult PhotoComplete(already_AddRefed<dom::File> aBlob) = 0;
|
||||
|
||||
// It is called on main thread. aRv is the error code.
|
||||
virtual nsresult PhotoError(nsresult aRv) = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "MediaEngineDefault.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "Layers.h"
|
||||
#include "ImageContainer.h"
|
||||
|
@ -208,7 +208,7 @@ MediaEngineDefaultVideoSource::Snapshot(uint32_t aDuration, nsIDOMFile** aFile)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMFile> domFile = dom::DOMFile::CreateFromFile(nullptr, localFile);
|
||||
nsCOMPtr<nsIDOMFile> domFile = dom::File::CreateFromFile(nullptr, localFile);
|
||||
domFile.forget(aFile);
|
||||
return NS_OK;
|
||||
#endif
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
#include "nsIThread.h"
|
||||
#include "nsIRunnable.h"
|
||||
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "DOMMediaStream.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
|
|
|
@ -943,11 +943,11 @@ MediaEngineWebRTCVideoSource::OnTakePictureComplete(uint8_t* aData, uint32_t aLe
|
|||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
nsRefPtr<dom::DOMFile> blob =
|
||||
dom::DOMFile::CreateMemoryFile(nullptr, mPhoto.Elements(), mPhoto.Length(), mMimeType);
|
||||
nsRefPtr<dom::File> blob =
|
||||
dom::File::CreateMemoryFile(nullptr, mPhoto.Elements(), mPhoto.Length(), mMimeType);
|
||||
uint32_t callbackCounts = mCallbacks.Length();
|
||||
for (uint8_t i = 0; i < callbackCounts; i++) {
|
||||
nsRefPtr<dom::DOMFile> tempBlob = blob;
|
||||
nsRefPtr<dom::File> tempBlob = blob;
|
||||
mCallbacks[i]->PhotoComplete(tempBlob.forget());
|
||||
}
|
||||
// PhotoCallback needs to dereference on main thread.
|
||||
|
|
|
@ -130,7 +130,7 @@ ArchiveReaderEvent::ShareMainThread()
|
|||
}
|
||||
}
|
||||
|
||||
// This is a nsDOMFile:
|
||||
// This is a File:
|
||||
nsRefPtr<nsIDOMFile> file = item->File(mArchiveReader);
|
||||
if (file) {
|
||||
fileList.AppendElement(file);
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#include "ArchiveReader.h"
|
||||
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsDOMFile.h"
|
||||
|
||||
#include "ArchiveReaderCommon.h"
|
||||
|
||||
|
@ -35,7 +35,7 @@ public:
|
|||
// Getter for the filename
|
||||
virtual nsresult GetFilename(nsString& aFilename) = 0;
|
||||
|
||||
// Generate a DOMFile
|
||||
// Generate a File
|
||||
virtual nsIDOMFile* File(ArchiveReader* aArchiveReader) = 0;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
#include "ArchiveEvent.h"
|
||||
#include "ArchiveZipEvent.h"
|
||||
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
#include "mozilla/dom/ArchiveReaderBinding.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -24,7 +24,7 @@ USING_ARCHIVEREADER_NAMESPACE
|
|||
|
||||
/* static */ already_AddRefed<ArchiveReader>
|
||||
ArchiveReader::Constructor(const GlobalObject& aGlobal,
|
||||
DOMFile& aBlob,
|
||||
File& aBlob,
|
||||
const ArchiveReaderOptions& aOptions,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ ArchiveReader::Constructor(const GlobalObject& aGlobal,
|
|||
return reader.forget();
|
||||
}
|
||||
|
||||
ArchiveReader::ArchiveReader(DOMFile& aBlob, nsPIDOMWindow* aWindow,
|
||||
ArchiveReader::ArchiveReader(File& aBlob, nsPIDOMWindow* aWindow,
|
||||
const nsACString& aEncoding)
|
||||
: mBlob(&aBlob)
|
||||
, mWindow(aWindow)
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
struct ArchiveReaderOptions;
|
||||
class DOMFile;
|
||||
class File;
|
||||
class GlobalObject;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -39,10 +39,10 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ArchiveReader)
|
||||
|
||||
static already_AddRefed<ArchiveReader>
|
||||
Constructor(const GlobalObject& aGlobal, DOMFile& aBlob,
|
||||
Constructor(const GlobalObject& aGlobal, File& aBlob,
|
||||
const ArchiveReaderOptions& aOptions, ErrorResult& aError);
|
||||
|
||||
ArchiveReader(DOMFile& aBlob, nsPIDOMWindow* aWindow,
|
||||
ArchiveReader(File& aBlob, nsPIDOMWindow* aWindow,
|
||||
const nsACString& aEncoding);
|
||||
|
||||
nsIDOMWindow* GetParentObject() const
|
||||
|
@ -76,7 +76,7 @@ private:
|
|||
|
||||
protected:
|
||||
// The archive blob/file
|
||||
nsRefPtr<DOMFile> mBlob;
|
||||
nsRefPtr<File> mBlob;
|
||||
|
||||
// The window is needed by the requests
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
|
|
|
@ -74,7 +74,7 @@ ArchiveZipItem::GetFilename(nsString& aFilename)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// From zipItem to DOMFile:
|
||||
// From zipItem to File:
|
||||
nsIDOMFile*
|
||||
ArchiveZipItem::File(ArchiveReader* aArchiveReader)
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ ArchiveZipItem::File(ArchiveReader* aArchiveReader)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return new DOMFile(aArchiveReader,
|
||||
return new dom::File(aArchiveReader,
|
||||
new ArchiveZipFileImpl(filename,
|
||||
NS_ConvertUTF8toUTF16(GetType()),
|
||||
StrToInt32(mCentralStruct.orglen),
|
||||
|
|
|
@ -30,7 +30,7 @@ protected:
|
|||
public:
|
||||
nsresult GetFilename(nsString& aFilename) MOZ_OVERRIDE;
|
||||
|
||||
// From zipItem to DOMFile:
|
||||
// From zipItem to File:
|
||||
virtual nsIDOMFile* File(ArchiveReader* aArchiveReader) MOZ_OVERRIDE;
|
||||
|
||||
public: // for the event
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#include "ArchiveZipFile.h"
|
||||
#include "ArchiveZipEvent.h"
|
||||
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "zlib.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
USING_ARCHIVEREADER_NAMESPACE
|
||||
|
@ -398,16 +398,16 @@ ArchiveZipFileImpl::Traverse(nsCycleCollectionTraversalCallback &cb)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArchiveReader);
|
||||
}
|
||||
|
||||
already_AddRefed<mozilla::dom::DOMFileImpl>
|
||||
already_AddRefed<mozilla::dom::FileImpl>
|
||||
ArchiveZipFileImpl::CreateSlice(uint64_t aStart,
|
||||
uint64_t aLength,
|
||||
const nsAString& aContentType,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsRefPtr<DOMFileImpl> impl =
|
||||
nsRefPtr<FileImpl> impl =
|
||||
new ArchiveZipFileImpl(mFilename, mContentType, aStart, mLength, mCentral,
|
||||
mArchiveReader);
|
||||
return impl.forget();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(ArchiveZipFileImpl, DOMFileImpl)
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(ArchiveZipFileImpl, FileImpl)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#define mozilla_dom_archivereader_domarchivefile_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
#include "ArchiveReader.h"
|
||||
|
||||
|
@ -18,9 +18,9 @@
|
|||
BEGIN_ARCHIVEREADER_NAMESPACE
|
||||
|
||||
/**
|
||||
* ArchiveZipFileImpl to DOMFileImpl
|
||||
* ArchiveZipFileImpl to FileImpl
|
||||
*/
|
||||
class ArchiveZipFileImpl : public DOMFileImplBase
|
||||
class ArchiveZipFileImpl : public FileImplBase
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
uint64_t aLength,
|
||||
ZipCentral& aCentral,
|
||||
ArchiveReader* aReader)
|
||||
: DOMFileImplBase(aName, aContentType, aLength),
|
||||
: FileImplBase(aName, aContentType, aLength),
|
||||
mCentral(aCentral),
|
||||
mArchiveReader(aReader),
|
||||
mFilename(aName)
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
uint64_t aLength,
|
||||
ZipCentral& aCentral,
|
||||
ArchiveReader* aReader)
|
||||
: DOMFileImplBase(aContentType, aStart, aLength),
|
||||
: FileImplBase(aContentType, aStart, aLength),
|
||||
mCentral(aCentral),
|
||||
mArchiveReader(aReader),
|
||||
mFilename(aName)
|
||||
|
@ -71,7 +71,7 @@ protected:
|
|||
MOZ_COUNT_DTOR(ArchiveZipFileImpl);
|
||||
}
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType,
|
||||
ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ public:
|
|||
|
||||
if (!mFailed) {
|
||||
// The correct parentObject has to be set by the mEncodeCompleteCallback.
|
||||
nsRefPtr<DOMFile> blob =
|
||||
DOMFile::CreateMemoryFile(nullptr, mImgData, mImgSize, mType);
|
||||
nsRefPtr<File> blob =
|
||||
File::CreateMemoryFile(nullptr, mImgData, mImgSize, mType);
|
||||
MOZ_ASSERT(blob);
|
||||
|
||||
rv = mEncodeCompleteCallback->ReceiveBlob(blob.forget());
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#define ImageEncoder_h
|
||||
|
||||
#include "imgIEncoder.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsError.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/HTMLCanvasElementBinding.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -115,7 +115,7 @@ class EncodeCompleteCallback
|
|||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EncodeCompleteCallback)
|
||||
|
||||
virtual nsresult ReceiveBlob(already_AddRefed<DOMFile> aBlob) = 0;
|
||||
virtual nsresult ReceiveBlob(already_AddRefed<File> aBlob) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~EncodeCompleteCallback() {}
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
#include "MessageEvent.h"
|
||||
#include "mozilla/dom/BlobBinding.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/MessageChannel.h"
|
||||
#include "mozilla/dom/MessagePortBinding.h"
|
||||
#include "mozilla/dom/MessagePortList.h"
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "ScriptSettings.h"
|
||||
|
@ -110,20 +110,20 @@ PostMessageReadStructuredClone(JSContext* cx,
|
|||
if (tag == SCTAG_DOM_BLOB) {
|
||||
NS_ASSERTION(!data, "Data should be empty");
|
||||
|
||||
// What we get back from the reader is a DOMFileImpl.
|
||||
// From that we create a new DOMFile.
|
||||
DOMFileImpl* blobImpl;
|
||||
// What we get back from the reader is a FileImpl.
|
||||
// From that we create a new File.
|
||||
FileImpl* blobImpl;
|
||||
if (JS_ReadBytes(reader, &blobImpl, sizeof(blobImpl))) {
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
// nsRefPtr<DOMFile> needs to go out of scope before toObjectOrNull() is
|
||||
// nsRefPtr<File> needs to go out of scope before toObjectOrNull() is
|
||||
// called because the static analysis thinks dereferencing XPCOM objects
|
||||
// can GC (because in some cases it can!), and a return statement with a
|
||||
// JSObject* type means that JSObject* is on the stack as a raw pointer
|
||||
// while destructors are running.
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
{
|
||||
nsRefPtr<DOMFile> blob = new DOMFile(scInfo->mPort->GetParentObject(),
|
||||
nsRefPtr<File> blob = new File(scInfo->mPort->GetParentObject(),
|
||||
blobImpl);
|
||||
if (!WrapNewBindingObject(cx, blob, &val)) {
|
||||
return nullptr;
|
||||
|
@ -167,9 +167,9 @@ PostMessageWriteStructuredClone(JSContext* cx,
|
|||
|
||||
// See if this is a File/Blob object.
|
||||
{
|
||||
DOMFile* blob = nullptr;
|
||||
File* blob = nullptr;
|
||||
if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, obj, blob))) {
|
||||
DOMFileImpl* blobImpl = blob->Impl();
|
||||
FileImpl* blobImpl = blob->Impl();
|
||||
if (JS_WriteUint32Pair(writer, SCTAG_DOM_BLOB, 0) &&
|
||||
JS_WriteBytes(writer, &blobImpl, sizeof(blobImpl))) {
|
||||
scInfo->mEvent->StoreISupports(blobImpl);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "nsMimeTypeArray.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/DesktopNotification.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsGeolocation.h"
|
||||
#include "nsIHttpProtocolHandler.h"
|
||||
#include "nsIContentPolicy.h"
|
||||
|
@ -1158,7 +1158,7 @@ Navigator::SendBeacon(const nsAString& aUrl,
|
|||
in = strStream;
|
||||
|
||||
} else if (aData.Value().IsBlob()) {
|
||||
DOMFile& blob = aData.Value().GetAsBlob();
|
||||
File& blob = aData.Value().GetAsBlob();
|
||||
rv = blob.GetInternalStream(getter_AddRefs(in));
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
#include "URL.h"
|
||||
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "DOMMediaStream.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/MediaSource.h"
|
||||
#include "mozilla/dom/URLBinding.h"
|
||||
#include "nsHostObjectProtocolHandler.h"
|
||||
|
@ -111,7 +111,7 @@ URL::Constructor(const GlobalObject& aGlobal, const nsAString& aUrl,
|
|||
|
||||
void
|
||||
URL::CreateObjectURL(const GlobalObject& aGlobal,
|
||||
DOMFile& aBlob,
|
||||
File& aBlob,
|
||||
const objectURLOptions& aOptions,
|
||||
nsString& aResult,
|
||||
ErrorResult& aError)
|
||||
|
|
|
@ -23,7 +23,7 @@ class DOMMediaStream;
|
|||
|
||||
namespace dom {
|
||||
|
||||
class DOMFile;
|
||||
class File;
|
||||
class MediaSource;
|
||||
class GlobalObject;
|
||||
struct objectURLOptions;
|
||||
|
@ -54,7 +54,7 @@ public:
|
|||
const nsAString& aBase, ErrorResult& aRv);
|
||||
|
||||
static void CreateObjectURL(const GlobalObject& aGlobal,
|
||||
DOMFile& aBlob,
|
||||
File& aBlob,
|
||||
const objectURLOptions& aOptions,
|
||||
nsString& aResult,
|
||||
ErrorResult& aError);
|
||||
|
|
|
@ -48,11 +48,11 @@
|
|||
#include "nsComputedDOMStyle.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsTArrayHelpers.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "mozilla/StyleAnimationValue.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -2861,7 +2861,7 @@ nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<DOMFile> file = DOMFile::CreateFromFile(innerWindow, aFile);
|
||||
nsRefPtr<File> file = File::CreateFromFile(innerWindow, aFile);
|
||||
file.forget(aDOMFile);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,6 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIDOMFileList.h"
|
||||
#include "nsIURIFixup.h"
|
||||
#ifndef DEBUG
|
||||
|
@ -7884,20 +7883,20 @@ PostMessageReadStructuredClone(JSContext* cx,
|
|||
if (tag == SCTAG_DOM_BLOB) {
|
||||
NS_ASSERTION(!data, "Data should be empty");
|
||||
|
||||
// What we get back from the reader is a DOMFileImpl.
|
||||
// From that we create a new DOMFile.
|
||||
DOMFileImpl* blobImpl;
|
||||
// What we get back from the reader is a FileImpl.
|
||||
// From that we create a new File.
|
||||
FileImpl* blobImpl;
|
||||
if (JS_ReadBytes(reader, &blobImpl, sizeof(blobImpl))) {
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
// nsRefPtr<DOMFile> needs to go out of scope before toObjectOrNull() is
|
||||
// nsRefPtr<File> needs to go out of scope before toObjectOrNull() is
|
||||
// called because the static analysis thinks dereferencing XPCOM objects
|
||||
// can GC (because in some cases it can!), and a return statement with a
|
||||
// JSObject* type means that JSObject* is on the stack as a raw pointer
|
||||
// while destructors are running.
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
{
|
||||
nsRefPtr<DOMFile> blob = new DOMFile(scInfo->window, blobImpl);
|
||||
nsRefPtr<File> blob = new File(scInfo->window, blobImpl);
|
||||
if (!WrapNewBindingObject(cx, blob, &val)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -7940,9 +7939,9 @@ PostMessageWriteStructuredClone(JSContext* cx,
|
|||
|
||||
// See if this is a File/Blob object.
|
||||
{
|
||||
DOMFile* blob = nullptr;
|
||||
File* blob = nullptr;
|
||||
if (scInfo->subsumes && NS_SUCCEEDED(UNWRAP_OBJECT(Blob, obj, blob))) {
|
||||
DOMFileImpl* blobImpl = blob->Impl();
|
||||
FileImpl* blobImpl = blob->Impl();
|
||||
if (JS_WriteUint32Pair(writer, SCTAG_DOM_BLOB, 0) &&
|
||||
JS_WriteBytes(writer, &blobImpl, sizeof(blobImpl))) {
|
||||
scInfo->event->StoreISupports(blobImpl);
|
||||
|
|
|
@ -137,8 +137,8 @@ DOMInterfaces = {
|
|||
},
|
||||
|
||||
'Blob': {
|
||||
'nativeType': 'mozilla::dom::DOMFile',
|
||||
'headerFile': 'nsDOMFile.h',
|
||||
'nativeType': 'mozilla::dom::File',
|
||||
'headerFile': 'mozilla/dom/File.h',
|
||||
},
|
||||
|
||||
'BatteryManager': {
|
||||
|
@ -400,13 +400,8 @@ DOMInterfaces = {
|
|||
},
|
||||
},
|
||||
|
||||
'File': {
|
||||
'nativeType': 'mozilla::dom::DOMFile',
|
||||
'headerFile': 'nsDOMFile.h',
|
||||
},
|
||||
|
||||
'FileList': {
|
||||
'headerFile': 'nsDOMFile.h',
|
||||
'headerFile': 'mozilla/dom/File.h',
|
||||
},
|
||||
|
||||
'FileReader': {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "nsDOMClassInfo.h"
|
||||
#include "nsTArrayHelpers.h"
|
||||
#include "DOMRequest.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
|
@ -17,6 +16,7 @@
|
|||
#include "mozilla/dom/BluetoothDiscoveryStateChangedEvent.h"
|
||||
#include "mozilla/dom/BluetoothStatusChangedEvent.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/LazyIdleThread.h"
|
||||
|
||||
|
@ -771,7 +771,7 @@ BluetoothAdapter::IsConnected(const uint16_t aServiceUuid, ErrorResult& aRv)
|
|||
|
||||
already_AddRefed<DOMRequest>
|
||||
BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
DOMFile& aBlob, ErrorResult& aRv)
|
||||
File& aBlob, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||
if (!win) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class DOMFile;
|
||||
class File;
|
||||
class DOMRequest;
|
||||
struct MediaMetaData;
|
||||
struct MediaPlayStatus;
|
||||
|
@ -134,7 +134,7 @@ public:
|
|||
GetConnectedDevices(uint16_t aServiceUuid, ErrorResult& aRv);
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
SendFile(const nsAString& aDeviceAddress, DOMFile& aBlob,
|
||||
SendFile(const nsAString& aDeviceAddress, File& aBlob,
|
||||
ErrorResult& aRv);
|
||||
already_AddRefed<DOMRequest>
|
||||
StopSendingFile(const nsAString& aDeviceAddress, ErrorResult& aRv);
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIFile.h"
|
||||
|
@ -350,8 +350,8 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsRefPtr<DOMFileImpl> impl = aActor->GetBlobImpl();
|
||||
nsCOMPtr<nsIDOMBlob> blob = new DOMFile(nullptr, impl);
|
||||
nsRefPtr<FileImpl> impl = aActor->GetBlobImpl();
|
||||
nsCOMPtr<nsIDOMBlob> blob = new File(nullptr, impl);
|
||||
|
||||
return SendFile(aDeviceAddress, blob.get());
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
#include "ObexBase.h"
|
||||
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIFile.h"
|
||||
|
@ -372,8 +372,8 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsRefPtr<DOMFileImpl> impl = aActor->GetBlobImpl();
|
||||
nsCOMPtr<nsIDOMBlob> blob = new DOMFile(nullptr, impl);
|
||||
nsRefPtr<FileImpl> impl = aActor->GetBlobImpl();
|
||||
nsCOMPtr<nsIDOMBlob> blob = new File(nullptr, impl);
|
||||
|
||||
return SendFile(aDeviceAddress, blob.get());
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsThread.h"
|
||||
#include "DeviceStorage.h"
|
||||
#include "DeviceStorageFileDescriptor.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/ipc/FileDescriptorUtils.h"
|
||||
#include "mozilla/MediaManager.h"
|
||||
|
@ -20,7 +21,6 @@
|
|||
#include "nsIDOMDeviceStorage.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "Navigator.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "DOMCameraManager.h"
|
||||
|
@ -1445,7 +1445,7 @@ nsDOMCameraControl::OnTakePictureComplete(nsIDOMBlob* aPicture)
|
|||
promise->MaybeResolve(picture);
|
||||
}
|
||||
|
||||
nsRefPtr<DOMFile> blob = static_cast<DOMFile*>(aPicture);
|
||||
nsRefPtr<File> blob = static_cast<File*>(aPicture);
|
||||
|
||||
nsRefPtr<CameraTakePictureCallback> cb = mTakePictureOnSuccessCb.forget();
|
||||
mTakePictureOnErrorCb = nullptr;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#include "DOMCameraControlListener.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "CameraCommon.h"
|
||||
#include "DOMCameraControl.h"
|
||||
#include "CameraPreviewMediaStream.h"
|
||||
#include "mozilla/dom/CameraManagerBinding.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
@ -348,10 +348,10 @@ DOMCameraControlListener::OnTakePictureComplete(uint8_t* aData, uint32_t aLength
|
|||
RunCallback(nsDOMCameraControl* aDOMCameraControl) MOZ_OVERRIDE
|
||||
{
|
||||
nsCOMPtr<nsIDOMBlob> picture =
|
||||
DOMFile::CreateMemoryFile(mDOMCameraControl,
|
||||
static_cast<void*>(mData),
|
||||
static_cast<uint64_t>(mLength),
|
||||
mMimeType);
|
||||
File::CreateMemoryFile(mDOMCameraControl,
|
||||
static_cast<void*>(mData),
|
||||
static_cast<uint64_t>(mLength),
|
||||
mMimeType);
|
||||
aDOMCameraControl->OnTakePictureComplete(picture);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,9 +93,9 @@ function verifyBlob(blob1, blob2, isLast)
|
|||
is(blob2 instanceof Blob, true,
|
||||
"blob2 is an instance of DOMBlob");
|
||||
isnot(blob1 instanceof File, true,
|
||||
"blob1 is an instance of DOMFile");
|
||||
"blob1 is an instance of File");
|
||||
isnot(blob2 instanceof File, true,
|
||||
"blob2 is an instance of DOMFile");
|
||||
"blob2 is an instance of File");
|
||||
ise(blob1.size, blob2.size, "Same size");
|
||||
ise(blob1.type, blob2.type, "Same type");
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "DeviceStorageRequestChild.h"
|
||||
#include "DeviceStorageFileDescriptor.h"
|
||||
#include "nsDeviceStorage.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -103,8 +103,8 @@ DeviceStorageRequestChild::
|
|||
{
|
||||
BlobResponse r = aValue;
|
||||
BlobChild* actor = static_cast<BlobChild*>(r.blobChild());
|
||||
nsRefPtr<DOMFileImpl> bloblImpl = actor->GetBlobImpl();
|
||||
nsRefPtr<DOMFile> blob = new DOMFile(mRequest->GetParentObject(), bloblImpl);
|
||||
nsRefPtr<FileImpl> bloblImpl = actor->GetBlobImpl();
|
||||
nsRefPtr<File> blob = new File(mRequest->GetParentObject(), bloblImpl);
|
||||
|
||||
AutoJSContext cx;
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "DeviceStorageRequestParent.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIMIMEService.h"
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "ContentParent.h"
|
||||
#include "nsProxyRelease.h"
|
||||
|
@ -44,7 +44,7 @@ DeviceStorageRequestParent::Dispatch()
|
|||
new DeviceStorageFile(p.type(), p.storageName(), p.relpath());
|
||||
|
||||
BlobParent* bp = static_cast<BlobParent*>(p.blobParent());
|
||||
nsRefPtr<DOMFileImpl> blobImpl = bp->GetBlobImpl();
|
||||
nsRefPtr<FileImpl> blobImpl = bp->GetBlobImpl();
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
blobImpl->GetInternalStream(getter_AddRefs(stream));
|
||||
|
@ -67,7 +67,7 @@ DeviceStorageRequestParent::Dispatch()
|
|||
new DeviceStorageFile(p.type(), p.storageName(), p.relpath());
|
||||
|
||||
BlobParent* bp = static_cast<BlobParent*>(p.blobParent());
|
||||
nsRefPtr<DOMFileImpl> blobImpl = bp->GetBlobImpl();
|
||||
nsRefPtr<FileImpl> blobImpl = bp->GetBlobImpl();
|
||||
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
blobImpl->GetInternalStream(getter_AddRefs(stream));
|
||||
|
@ -522,9 +522,9 @@ DeviceStorageRequestParent::PostBlobSuccessEvent::CancelableRun() {
|
|||
|
||||
nsString fullPath;
|
||||
mFile->GetFullPath(fullPath);
|
||||
nsRefPtr<DOMFile> blob = new DOMFile(nullptr,
|
||||
new DOMFileImplFile(fullPath, mime, mLength, mFile->mFile,
|
||||
mLastModificationDate));
|
||||
nsRefPtr<File> blob = new File(nullptr,
|
||||
new FileImplFile(fullPath, mime, mLength, mFile->mFile,
|
||||
mLastModificationDate));
|
||||
|
||||
ContentParent* cp = static_cast<ContentParent*>(mParent->Manager());
|
||||
BlobParent* actor = cp->GetOrCreateActorForBlob(blob);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "nsIDirectoryEnumerator.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsDOMBlobBuilder.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
@ -1805,10 +1804,10 @@ nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile)
|
|||
MOZ_ASSERT(aFile->mLength != UINT64_MAX);
|
||||
MOZ_ASSERT(aFile->mLastModifiedDate != UINT64_MAX);
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> blob = new DOMFile(aWindow,
|
||||
new DOMFileImplFile(fullPath, aFile->mMimeType,
|
||||
aFile->mLength, aFile->mFile,
|
||||
aFile->mLastModifiedDate));
|
||||
nsCOMPtr<nsIDOMBlob> blob = new File(aWindow,
|
||||
new FileImplFile(fullPath, aFile->mMimeType,
|
||||
aFile->mLength, aFile->mFile,
|
||||
aFile->mLastModifiedDate));
|
||||
return InterfaceToJsval(aWindow, blob, &NS_GET_IID(nsIDOMBlob));
|
||||
}
|
||||
|
||||
|
@ -2480,7 +2479,7 @@ private:
|
|||
class WriteFileEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
WriteFileEvent(DOMFileImpl* aBlobImpl,
|
||||
WriteFileEvent(FileImpl* aBlobImpl,
|
||||
DeviceStorageFile *aFile,
|
||||
already_AddRefed<DOMRequest> aRequest,
|
||||
int32_t aRequestType)
|
||||
|
@ -2546,7 +2545,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<DOMFileImpl> mBlobImpl;
|
||||
nsRefPtr<FileImpl> mBlobImpl;
|
||||
nsRefPtr<DeviceStorageFile> mFile;
|
||||
nsRefPtr<DOMRequest> mRequest;
|
||||
int32_t mRequestType;
|
||||
|
@ -2915,7 +2914,7 @@ public:
|
|||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
BlobChild* actor
|
||||
= ContentChild::GetSingleton()->GetOrCreateActorForBlob(
|
||||
static_cast<DOMFile*>(mBlob.get()));
|
||||
static_cast<File*>(mBlob.get()));
|
||||
if (!actor) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -2933,7 +2932,7 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
DOMFile* blob = static_cast<DOMFile*>(mBlob.get());
|
||||
File* blob = static_cast<File*>(mBlob.get());
|
||||
r = new WriteFileEvent(blob->Impl(), mFile, mRequest.forget(),
|
||||
mRequestType);
|
||||
break;
|
||||
|
@ -2961,7 +2960,7 @@ public:
|
|||
if (XRE_GetProcessType() != GeckoProcessType_Default) {
|
||||
BlobChild* actor
|
||||
= ContentChild::GetSingleton()->GetOrCreateActorForBlob(
|
||||
static_cast<DOMFile*>(mBlob.get()));
|
||||
static_cast<File*>(mBlob.get()));
|
||||
if (!actor) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -2979,7 +2978,7 @@ public:
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
DOMFile* blob = static_cast<DOMFile*>(mBlob.get());
|
||||
File* blob = static_cast<File*>(mBlob.get());
|
||||
r = new WriteFileEvent(blob->Impl(), mFile, mRequest.forget(),
|
||||
mRequestType);
|
||||
break;
|
||||
|
|
|
@ -303,8 +303,7 @@ DataTransfer::GetFiles(ErrorResult& aRv)
|
|||
if (!file)
|
||||
continue;
|
||||
|
||||
nsRefPtr<DOMFile> domFile =
|
||||
DOMFile::CreateFromFile(GetParentObject(), file);
|
||||
nsRefPtr<File> domFile = File::CreateFromFile(GetParentObject(), file);
|
||||
|
||||
if (!mFiles->Append(domFile)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
class nsINode;
|
||||
class nsITransferable;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
@ -17,6 +16,7 @@
|
|||
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/Headers.h"
|
||||
#include "mozilla/dom/Fetch.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
@ -357,11 +357,11 @@ Request::ConsumeBody(ConsumeType aType, ErrorResult& aRv)
|
|||
// with worker wrapping.
|
||||
uint32_t blobLen = buffer.Length();
|
||||
void* blobData = moz_malloc(blobLen);
|
||||
nsRefPtr<DOMFile> blob;
|
||||
nsRefPtr<File> blob;
|
||||
if (blobData) {
|
||||
memcpy(blobData, buffer.BeginReading(), blobLen);
|
||||
blob = DOMFile::CreateMemoryFile(GetParentObject(), blobData, blobLen,
|
||||
NS_ConvertUTF8toUTF16(mMimeType));
|
||||
blob = File::CreateMemoryFile(GetParentObject(), blobData, blobLen,
|
||||
NS_ConvertUTF8toUTF16(mMimeType));
|
||||
} else {
|
||||
aRv = NS_ERROR_OUT_OF_MEMORY;
|
||||
return nullptr;
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
#include "FileStreamWrappers.h"
|
||||
#include "MemoryStreams.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "MutableFile.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -622,10 +622,10 @@ FileHandleBase::GetInputStream(const ArrayBuffer& aValue,
|
|||
|
||||
// static
|
||||
already_AddRefed<nsIInputStream>
|
||||
FileHandleBase::GetInputStream(const DOMFile& aValue, uint64_t* aInputLength,
|
||||
FileHandleBase::GetInputStream(const File& aValue, uint64_t* aInputLength,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
DOMFile& file = const_cast<DOMFile&>(aValue);
|
||||
File& file = const_cast<File&>(aValue);
|
||||
uint64_t length = file.GetSize(aRv);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
|
|
|
@ -25,7 +25,7 @@ class nsAString;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMFile;
|
||||
class File;
|
||||
class FileHelper;
|
||||
class FileRequestBase;
|
||||
class FileService;
|
||||
|
@ -240,7 +240,7 @@ protected:
|
|||
ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<nsIInputStream>
|
||||
GetInputStream(const DOMFile& aValue, uint64_t* aInputLength,
|
||||
GetInputStream(const File& aValue, uint64_t* aInputLength,
|
||||
ErrorResult& aRv);
|
||||
|
||||
static already_AddRefed<nsIInputStream>
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
|
||||
#include "DOMError.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FileSystemBase.h"
|
||||
#include "mozilla/dom/FileSystemUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
@ -27,7 +27,7 @@ uint32_t CreateFileTask::sOutputBufferSize = 0;
|
|||
|
||||
CreateFileTask::CreateFileTask(FileSystemBase* aFileSystem,
|
||||
const nsAString& aPath,
|
||||
DOMFile* aBlobData,
|
||||
File* aBlobData,
|
||||
InfallibleTArray<uint8_t>& aArrayData,
|
||||
bool replace,
|
||||
ErrorResult& aRv)
|
||||
|
@ -79,7 +79,7 @@ CreateFileTask::CreateFileTask(FileSystemBase* aFileSystem,
|
|||
}
|
||||
|
||||
BlobParent* bp = static_cast<BlobParent*>(static_cast<PBlobParent*>(data));
|
||||
nsRefPtr<DOMFileImpl> blobImpl = bp->GetBlobImpl();
|
||||
nsRefPtr<FileImpl> blobImpl = bp->GetBlobImpl();
|
||||
MOZ_ASSERT(blobImpl, "blobData should not be null.");
|
||||
|
||||
nsresult rv = blobImpl->GetInternalStream(getter_AddRefs(mBlobStream));
|
||||
|
@ -127,7 +127,7 @@ FileSystemResponseValue
|
|||
CreateFileTask::GetSuccessRequestResult() const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
|
||||
nsRefPtr<DOMFile> file = new DOMFile(mFileSystem->GetWindow(),
|
||||
nsRefPtr<File> file = new File(mFileSystem->GetWindow(),
|
||||
mTargetFileImpl);
|
||||
BlobParent* actor = GetBlobParent(file);
|
||||
if (!actor) {
|
||||
|
@ -261,7 +261,7 @@ CreateFileTask::Work()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mTargetFileImpl = new DOMFileImplFile(file);
|
||||
mTargetFileImpl = new FileImplFile(file);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ CreateFileTask::Work()
|
|||
return NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
mTargetFileImpl = new DOMFileImplFile(file);
|
||||
mTargetFileImpl = new FileImplFile(file);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -303,8 +303,7 @@ CreateFileTask::HandlerCallback()
|
|||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMFile> file = new DOMFile(mFileSystem->GetWindow(),
|
||||
mTargetFileImpl);
|
||||
nsCOMPtr<nsIDOMFile> file = new File(mFileSystem->GetWindow(), mTargetFileImpl);
|
||||
mPromise->MaybeResolve(file);
|
||||
mPromise = nullptr;
|
||||
mBlobData = nullptr;
|
||||
|
|
|
@ -16,8 +16,8 @@ class nsIInputStream;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMFile;
|
||||
class DOMFileImpl;
|
||||
class File;
|
||||
class FileImpl;
|
||||
class Promise;
|
||||
|
||||
class CreateFileTask MOZ_FINAL
|
||||
|
@ -26,7 +26,7 @@ class CreateFileTask MOZ_FINAL
|
|||
public:
|
||||
CreateFileTask(FileSystemBase* aFileSystem,
|
||||
const nsAString& aPath,
|
||||
DOMFile* aBlobData,
|
||||
File* aBlobData,
|
||||
InfallibleTArray<uint8_t>& aArrayData,
|
||||
bool replace,
|
||||
ErrorResult& aRv);
|
||||
|
@ -68,15 +68,15 @@ private:
|
|||
nsString mTargetRealPath;
|
||||
|
||||
// Not thread-safe and should be released on main thread.
|
||||
nsRefPtr<DOMFile> mBlobData;
|
||||
nsRefPtr<File> mBlobData;
|
||||
|
||||
nsCOMPtr<nsIInputStream> mBlobStream;
|
||||
InfallibleTArray<uint8_t> mArrayData;
|
||||
bool mReplace;
|
||||
|
||||
// This cannot be a DOMFile because this object is created on a different
|
||||
// thread and DOMFile is not thread-safe. Let's use the DOMFileImpl instead.
|
||||
nsRefPtr<DOMFileImpl> mTargetFileImpl;
|
||||
// This cannot be a File because this object is created on a different
|
||||
// thread and File is not thread-safe. Let's use the FileImpl instead.
|
||||
nsRefPtr<FileImpl> mTargetFileImpl;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
#include "DeviceStorage.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/Directory.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FileSystemUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsDeviceStorage.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
|
@ -114,7 +114,7 @@ DeviceStorageFileSystem::GetLocalFile(const nsAString& aRealPath) const
|
|||
}
|
||||
|
||||
bool
|
||||
DeviceStorageFileSystem::GetRealPath(DOMFileImpl* aFile, nsAString& aRealPath) const
|
||||
DeviceStorageFileSystem::GetRealPath(FileImpl* aFile, nsAString& aRealPath) const
|
||||
{
|
||||
MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
|
||||
"Should be on parent process!");
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
GetLocalFile(const nsAString& aRealPath) const MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
GetRealPath(DOMFileImpl* aFile, nsAString& aRealPath) const MOZ_OVERRIDE;
|
||||
GetRealPath(FileImpl* aFile, nsAString& aRealPath) const MOZ_OVERRIDE;
|
||||
|
||||
virtual const nsAString&
|
||||
GetRootName() const MOZ_OVERRIDE;
|
||||
|
|
|
@ -101,7 +101,7 @@ Directory::CreateFile(const nsAString& aPath, const CreateFileOptions& aOptions,
|
|||
{
|
||||
nsresult error = NS_OK;
|
||||
nsString realPath;
|
||||
nsRefPtr<DOMFile> blobData;
|
||||
nsRefPtr<File> blobData;
|
||||
InfallibleTArray<uint8_t> arrayData;
|
||||
bool replace = (aOptions.mIfExists == CreateIfExistsMode::Replace);
|
||||
|
||||
|
@ -193,7 +193,7 @@ Directory::RemoveInternal(const StringOrFileOrDirectory& aPath, bool aRecursive,
|
|||
{
|
||||
nsresult error = NS_OK;
|
||||
nsString realPath;
|
||||
nsRefPtr<DOMFileImpl> file;
|
||||
nsRefPtr<FileImpl> file;
|
||||
|
||||
// Check and get the target path.
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
class Directory;
|
||||
class DOMFileImpl;
|
||||
class FileImpl;
|
||||
|
||||
class FileSystemBase
|
||||
{
|
||||
|
@ -73,7 +73,7 @@ public:
|
|||
* empty string.
|
||||
*/
|
||||
virtual bool
|
||||
GetRealPath(DOMFileImpl* aFile, nsAString& aRealPath) const = 0;
|
||||
GetRealPath(FileImpl* aFile, nsAString& aRealPath) const = 0;
|
||||
|
||||
/*
|
||||
* Get the permission name required to access this file system.
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "nsNetUtil.h" // Stream transport service.
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FileSystemBase.h"
|
||||
#include "mozilla/dom/FileSystemRequestParent.h"
|
||||
#include "mozilla/dom/FileSystemUtils.h"
|
||||
|
@ -15,7 +16,6 @@
|
|||
#include "mozilla/dom/PContent.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsDOMFile.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -170,7 +170,7 @@ FileSystemTaskBase::GetBlobParent(nsIDOMFile* aFile) const
|
|||
aFile->GetMozLastModifiedDate(&lastModifiedDate);
|
||||
|
||||
ContentParent* cp = static_cast<ContentParent*>(mRequestParent->Manager());
|
||||
return cp->GetOrCreateActorForBlob(static_cast<DOMFile*>(aFile));
|
||||
return cp->GetOrCreateActorForBlob(static_cast<File*>(aFile));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
#include "js/Value.h"
|
||||
#include "mozilla/dom/Directory.h"
|
||||
#include "mozilla/dom/DOMError.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FileSystemBase.h"
|
||||
#include "mozilla/dom/FileSystemUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
|
@ -82,8 +82,7 @@ GetFileOrDirectoryTask::GetSuccessRequestResult() const
|
|||
return FileSystemDirectoryResponse(mTargetRealPath);
|
||||
}
|
||||
|
||||
nsRefPtr<DOMFile> file = new DOMFile(mFileSystem->GetWindow(),
|
||||
mTargetFileImpl);
|
||||
nsRefPtr<File> file = new File(mFileSystem->GetWindow(), mTargetFileImpl);
|
||||
BlobParent* actor = GetBlobParent(file);
|
||||
if (!actor) {
|
||||
return FileSystemErrorResponse(NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR);
|
||||
|
@ -186,7 +185,7 @@ GetFileOrDirectoryTask::Work()
|
|||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
mTargetFileImpl = new DOMFileImplFile(file);
|
||||
mTargetFileImpl = new FileImplFile(file);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -215,8 +214,7 @@ GetFileOrDirectoryTask::HandlerCallback()
|
|||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMFile> file = new DOMFile(mFileSystem->GetWindow(),
|
||||
mTargetFileImpl);
|
||||
nsRefPtr<File> file = new File(mFileSystem->GetWindow(), mTargetFileImpl);
|
||||
mPromise->MaybeResolve(file);
|
||||
mPromise = nullptr;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMFileImpl;
|
||||
class FileImpl;
|
||||
|
||||
class GetFileOrDirectoryTask MOZ_FINAL
|
||||
: public FileSystemTaskBase
|
||||
|
@ -59,9 +59,9 @@ private:
|
|||
// Whether we get a directory.
|
||||
bool mIsDirectory;
|
||||
|
||||
// This cannot be a DOMFile bacause this object is created on a different
|
||||
// thread and DOMFile is not thread-safe. Let's use the DOMFileImpl instead.
|
||||
nsRefPtr<DOMFileImpl> mTargetFileImpl;
|
||||
// This cannot be a File bacause this object is created on a different
|
||||
// thread and File is not thread-safe. Let's use the FileImpl instead.
|
||||
nsRefPtr<FileImpl> mTargetFileImpl;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
#include "RemoveTask.h"
|
||||
|
||||
#include "DOMError.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FileSystemBase.h"
|
||||
#include "mozilla/dom/FileSystemUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
|
@ -21,7 +21,7 @@ namespace dom {
|
|||
|
||||
RemoveTask::RemoveTask(FileSystemBase* aFileSystem,
|
||||
const nsAString& aDirPath,
|
||||
DOMFileImpl* aTargetFile,
|
||||
FileImpl* aTargetFile,
|
||||
const nsAString& aTargetPath,
|
||||
bool aRecursive,
|
||||
ErrorResult& aRv)
|
||||
|
@ -92,8 +92,7 @@ RemoveTask::GetRequestParams(const nsString& aFileSystem) const
|
|||
param.directory() = mDirRealPath;
|
||||
param.recursive() = mRecursive;
|
||||
if (mTargetFileImpl) {
|
||||
nsRefPtr<DOMFile> file = new DOMFile(mFileSystem->GetWindow(),
|
||||
mTargetFileImpl);
|
||||
nsRefPtr<File> file = new File(mFileSystem->GetWindow(), mTargetFileImpl);
|
||||
BlobChild* actor
|
||||
= ContentChild::GetSingleton()->GetOrCreateActorForBlob(file);
|
||||
if (actor) {
|
||||
|
@ -131,7 +130,7 @@ RemoveTask::Work()
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Get the DOM path if a DOMFile is passed as the target.
|
||||
// Get the DOM path if a File is passed as the target.
|
||||
if (mTargetFileImpl) {
|
||||
if (!mFileSystem->GetRealPath(mTargetFileImpl, mTargetRealPath)) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMFileImpl;
|
||||
class FileImpl;
|
||||
class Promise;
|
||||
|
||||
class RemoveTask MOZ_FINAL
|
||||
|
@ -23,7 +23,7 @@ class RemoveTask MOZ_FINAL
|
|||
public:
|
||||
RemoveTask(FileSystemBase* aFileSystem,
|
||||
const nsAString& aDirPath,
|
||||
DOMFileImpl* aTargetFile,
|
||||
FileImpl* aTargetFile,
|
||||
const nsAString& aTargetPath,
|
||||
bool aRecursive,
|
||||
ErrorResult& aRv);
|
||||
|
@ -59,9 +59,9 @@ protected:
|
|||
private:
|
||||
nsRefPtr<Promise> mPromise;
|
||||
nsString mDirRealPath;
|
||||
// This cannot be a DOMFile because this object will be used on a different
|
||||
// thread and DOMFile is not thread-safe. Let's use the DOMFileImpl instead.
|
||||
nsRefPtr<DOMFileImpl> mTargetFileImpl;
|
||||
// This cannot be a File because this object will be used on a different
|
||||
// thread and File is not thread-safe. Let's use the FileImpl instead.
|
||||
nsRefPtr<FileImpl> mTargetFileImpl;
|
||||
nsString mTargetRealPath;
|
||||
bool mRecursive;
|
||||
bool mReturnValue;
|
||||
|
|
|
@ -524,10 +524,10 @@ ConvertActorsToBlobs(IDBDatabase* aDatabase,
|
|||
for (uint32_t index = 0; index < count; index++) {
|
||||
BlobChild* actor = static_cast<BlobChild*>(blobs[index]);
|
||||
|
||||
nsRefPtr<DOMFileImpl> blobImpl = actor->GetBlobImpl();
|
||||
nsRefPtr<FileImpl> blobImpl = actor->GetBlobImpl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
nsRefPtr<DOMFile> blob = new DOMFile(aDatabase->GetOwner(), blobImpl);
|
||||
nsRefPtr<File> blob = new File(aDatabase->GetOwner(), blobImpl);
|
||||
|
||||
nsRefPtr<FileInfo> fileInfo;
|
||||
if (!fileInfos.IsEmpty()) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "mozilla/storage.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/dom/indexedDB/PBackgroundIDBCursorParent.h"
|
||||
|
@ -56,12 +57,10 @@
|
|||
#include "nsClassHashtable.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIFileURL.h"
|
||||
|
@ -3028,7 +3027,7 @@ class DatabaseFile MOZ_FINAL
|
|||
{
|
||||
friend class Database;
|
||||
|
||||
nsRefPtr<DOMFileImpl> mBlobImpl;
|
||||
nsRefPtr<FileImpl> mBlobImpl;
|
||||
nsRefPtr<FileInfo> mFileInfo;
|
||||
|
||||
public:
|
||||
|
@ -3075,7 +3074,7 @@ private:
|
|||
}
|
||||
|
||||
// Called when receiving from the child.
|
||||
DatabaseFile(DOMFileImpl* aBlobImpl, FileInfo* aFileInfo)
|
||||
DatabaseFile(FileImpl* aBlobImpl, FileInfo* aFileInfo)
|
||||
: mBlobImpl(aBlobImpl)
|
||||
, mFileInfo(aFileInfo)
|
||||
{
|
||||
|
@ -5013,11 +5012,11 @@ private:
|
|||
};
|
||||
|
||||
class NonMainThreadHackBlobImpl MOZ_FINAL
|
||||
: public DOMFileImplFile
|
||||
: public FileImplFile
|
||||
{
|
||||
public:
|
||||
NonMainThreadHackBlobImpl(nsIFile* aFile, FileInfo* aFileInfo)
|
||||
: DOMFileImplFile(aFile, aFileInfo)
|
||||
: FileImplFile(aFile, aFileInfo)
|
||||
{
|
||||
// Getting the content type is not currently supported off the main thread.
|
||||
// This isn't a problem here because:
|
||||
|
@ -5500,7 +5499,7 @@ ConvertBlobsToActors(PBackgroundParent* aBackgroundActor,
|
|||
MOZ_ASSERT(NS_SUCCEEDED(nativeFile->IsFile(&isFile)));
|
||||
MOZ_ASSERT(isFile);
|
||||
|
||||
nsRefPtr<DOMFileImpl> impl =
|
||||
nsRefPtr<FileImpl> impl =
|
||||
new NonMainThreadHackBlobImpl(nativeFile, file.mFileInfo);
|
||||
|
||||
PBlobParent* actor =
|
||||
|
@ -6240,7 +6239,7 @@ Database::AllocPBackgroundIDBDatabaseFileParent(PBlobParent* aBlobParent)
|
|||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aBlobParent);
|
||||
|
||||
nsRefPtr<DOMFileImpl> blobImpl =
|
||||
nsRefPtr<FileImpl> blobImpl =
|
||||
static_cast<BlobParent*>(aBlobParent)->GetBlobImpl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@ FileImplSnapshot::FileImplSnapshot(const nsAString& aName,
|
|||
nsIFile* aFile,
|
||||
IDBFileHandle* aFileHandle,
|
||||
FileInfo* aFileInfo)
|
||||
: DOMFileImplBase(aName,
|
||||
aContentType,
|
||||
aMetadataParams->Size(),
|
||||
aMetadataParams->LastModified())
|
||||
: FileImplBase(aName,
|
||||
aContentType,
|
||||
aMetadataParams->Size(),
|
||||
aMetadataParams->LastModified())
|
||||
, mFile(aFile)
|
||||
, mFileHandle(aFileHandle)
|
||||
, mWholeFile(true)
|
||||
|
@ -50,7 +50,7 @@ FileImplSnapshot::FileImplSnapshot(const FileImplSnapshot* aOther,
|
|||
uint64_t aStart,
|
||||
uint64_t aLength,
|
||||
const nsAString& aContentType)
|
||||
: DOMFileImplBase(aContentType, aOther->mStart + aStart, aLength)
|
||||
: FileImplBase(aContentType, aOther->mStart + aStart, aLength)
|
||||
, mFile(aOther->mFile)
|
||||
, mFileHandle(aOther->mFileHandle)
|
||||
, mWholeFile(false)
|
||||
|
@ -86,7 +86,7 @@ FileImplSnapshot::AssertSanity()
|
|||
|
||||
#endif // DEBUG
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(FileImplSnapshot, DOMFileImpl)
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(FileImplSnapshot, FileImpl)
|
||||
|
||||
void
|
||||
FileImplSnapshot::Unlink()
|
||||
|
@ -128,7 +128,7 @@ FileImplSnapshot::GetInternalStream(nsIInputStream** aStream)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMFileImpl>
|
||||
already_AddRefed<FileImpl>
|
||||
FileImplSnapshot::CreateSlice(uint64_t aStart,
|
||||
uint64_t aLength,
|
||||
const nsAString& aContentType,
|
||||
|
@ -136,7 +136,7 @@ FileImplSnapshot::CreateSlice(uint64_t aStart,
|
|||
{
|
||||
AssertSanity();
|
||||
|
||||
nsRefPtr<DOMFileImpl> impl =
|
||||
nsRefPtr<FileImpl> impl =
|
||||
new FileImplSnapshot(this, aStart, aLength, aContentType);
|
||||
|
||||
return impl.forget();
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
#define mozilla_dom_indexeddb_filesnapshot_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMFile.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -22,7 +22,7 @@ namespace indexedDB {
|
|||
class IDBFileHandle;
|
||||
|
||||
class FileImplSnapshot MOZ_FINAL
|
||||
: public DOMFileImplBase
|
||||
: public FileImplBase
|
||||
{
|
||||
typedef mozilla::dom::MetadataParameters MetadataParameters;
|
||||
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
virtual bool
|
||||
IsCCed() const MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart,
|
||||
uint64_t aLength,
|
||||
const nsAString& aContentType,
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/DOMStringList.h"
|
||||
#include "mozilla/dom/DOMStringListBinding.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/IDBDatabaseBinding.h"
|
||||
#include "mozilla/dom/IDBObjectStoreBinding.h"
|
||||
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseFileChild.h"
|
||||
|
@ -38,9 +39,7 @@
|
|||
#include "mozilla/ipc/InputStreamParams.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
|
@ -803,15 +802,15 @@ IDBDatabase::AbortTransactions()
|
|||
}
|
||||
|
||||
PBackgroundIDBDatabaseFileChild*
|
||||
IDBDatabase::GetOrCreateFileActorForBlob(DOMFile* aBlob)
|
||||
IDBDatabase::GetOrCreateFileActorForBlob(File* aBlob)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(aBlob);
|
||||
MOZ_ASSERT(mBackgroundActor);
|
||||
|
||||
// We use the DOMFile's nsIWeakReference as the key to the table because
|
||||
// We use the File's nsIWeakReference as the key to the table because
|
||||
// a) it is unique per blob, b) it is reference-counted so that we can
|
||||
// guarantee that it stays alive, and c) it doesn't hold the actual DOMFile
|
||||
// guarantee that it stays alive, and c) it doesn't hold the actual File
|
||||
// alive.
|
||||
nsCOMPtr<nsIDOMBlob> blob = aBlob;
|
||||
nsCOMPtr<nsIWeakReference> weakRef = do_GetWeakReference(blob);
|
||||
|
@ -820,7 +819,7 @@ IDBDatabase::GetOrCreateFileActorForBlob(DOMFile* aBlob)
|
|||
PBackgroundIDBDatabaseFileChild* actor = nullptr;
|
||||
|
||||
if (!mFileActors.Get(weakRef, &actor)) {
|
||||
DOMFileImpl* blobImpl = aBlob->Impl();
|
||||
FileImpl* blobImpl = aBlob->Impl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
if (mReceivedBlobs.GetEntry(weakRef)) {
|
||||
|
@ -912,7 +911,7 @@ IDBDatabase::NoteFinishedFileActor(PBackgroundIDBDatabaseFileChild* aFileActor)
|
|||
}
|
||||
|
||||
void
|
||||
IDBDatabase::NoteReceivedBlob(DOMFile* aBlob)
|
||||
IDBDatabase::NoteReceivedBlob(File* aBlob)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(aBlob);
|
||||
|
@ -920,7 +919,7 @@ IDBDatabase::NoteReceivedBlob(DOMFile* aBlob)
|
|||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsRefPtr<DOMFileImpl> blobImpl = aBlob->Impl();
|
||||
nsRefPtr<FileImpl> blobImpl = aBlob->Impl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
nsCOMPtr<nsIRemoteBlob> remoteBlob = do_QueryObject(blobImpl);
|
||||
|
|
|
@ -29,7 +29,7 @@ class EventChainPostVisitor;
|
|||
|
||||
namespace dom {
|
||||
|
||||
class DOMFile;
|
||||
class File;
|
||||
class DOMStringList;
|
||||
struct IDBObjectStoreParameters;
|
||||
template <typename> class Sequence;
|
||||
|
@ -174,13 +174,13 @@ public:
|
|||
AbortTransactions();
|
||||
|
||||
PBackgroundIDBDatabaseFileChild*
|
||||
GetOrCreateFileActorForBlob(DOMFile* aBlob);
|
||||
GetOrCreateFileActorForBlob(File* aBlob);
|
||||
|
||||
void
|
||||
NoteFinishedFileActor(PBackgroundIDBDatabaseFileChild* aFileActor);
|
||||
|
||||
void
|
||||
NoteReceivedBlob(DOMFile* aBlob);
|
||||
NoteReceivedBlob(File* aBlob);
|
||||
|
||||
void
|
||||
DelayedMaybeExpireFileActors();
|
||||
|
|
|
@ -343,7 +343,7 @@ already_AddRefed<nsIDOMFile>
|
|||
IDBMutableFile::CreateFileObject(IDBFileHandle* aFileHandle,
|
||||
MetadataParameters* aMetadataParams)
|
||||
{
|
||||
nsRefPtr<DOMFileImpl> impl =
|
||||
nsRefPtr<FileImpl> impl =
|
||||
new FileImplSnapshot(mName,
|
||||
mType,
|
||||
aMetadataParams,
|
||||
|
@ -351,7 +351,7 @@ IDBMutableFile::CreateFileObject(IDBFileHandle* aFileHandle,
|
|||
aFileHandle,
|
||||
mFileInfo);
|
||||
|
||||
nsCOMPtr<nsIDOMFile> fileSnapshot = new DOMFile(GetOwner(), impl);
|
||||
nsCOMPtr<nsIDOMFile> fileSnapshot = new File(GetOwner(), impl);
|
||||
return fileSnapshot.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/DOMStringList.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/IDBMutableFileBinding.h"
|
||||
#include "mozilla/dom/BlobBinding.h"
|
||||
#include "mozilla/dom/IDBObjectStoreBinding.h"
|
||||
|
@ -40,8 +41,6 @@
|
|||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "ProfilerHelpers.h"
|
||||
#include "ReportInternalError.h"
|
||||
|
||||
|
@ -59,7 +58,7 @@ struct IDBObjectStore::StructuredCloneWriteInfo
|
|||
{
|
||||
struct BlobOrFileInfo
|
||||
{
|
||||
nsRefPtr<DOMFile> mBlob;
|
||||
nsRefPtr<File> mBlob;
|
||||
nsRefPtr<FileInfo> mFileInfo;
|
||||
|
||||
bool
|
||||
|
@ -299,7 +298,7 @@ StructuredCloneWriteCallback(JSContext* aCx,
|
|||
MOZ_ASSERT(NS_IsMainThread(), "This can't work off the main thread!");
|
||||
|
||||
{
|
||||
DOMFile* blob = nullptr;
|
||||
File* blob = nullptr;
|
||||
if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, aObj, blob))) {
|
||||
uint64_t size;
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blob->GetSize(&size)));
|
||||
|
@ -401,7 +400,7 @@ GetAddInfoCallback(JSContext* aCx, void* aClosure)
|
|||
}
|
||||
|
||||
BlobChild*
|
||||
ActorFromRemoteBlob(DOMFile* aBlob)
|
||||
ActorFromRemoteBlob(File* aBlob)
|
||||
{
|
||||
MOZ_ASSERT(aBlob);
|
||||
|
||||
|
@ -427,7 +426,7 @@ ActorFromRemoteBlob(DOMFile* aBlob)
|
|||
}
|
||||
|
||||
bool
|
||||
ResolveMysteryFile(DOMFile* aBlob,
|
||||
ResolveMysteryFile(File* aBlob,
|
||||
const nsString& aName,
|
||||
const nsString& aContentType,
|
||||
uint64_t aSize,
|
||||
|
@ -442,7 +441,7 @@ ResolveMysteryFile(DOMFile* aBlob,
|
|||
}
|
||||
|
||||
bool
|
||||
ResolveMysteryBlob(DOMFile* aBlob,
|
||||
ResolveMysteryBlob(File* aBlob,
|
||||
const nsString& aContentType,
|
||||
uint64_t aSize)
|
||||
{
|
||||
|
@ -610,7 +609,7 @@ public:
|
|||
"This wrapping currently only works on the main thread!");
|
||||
|
||||
// It can happen that this IDB is chrome code, so there is no parent, but
|
||||
// still we want to set a correct parent for the new DOMFile object.
|
||||
// still we want to set a correct parent for the new File object.
|
||||
nsCOMPtr<nsISupports> parent;
|
||||
if (aDatabase && aDatabase->GetParentObject()) {
|
||||
parent = aDatabase->GetParentObject();
|
||||
|
@ -619,7 +618,7 @@ public:
|
|||
}
|
||||
|
||||
MOZ_ASSERT(parent);
|
||||
nsRefPtr<DOMFile> file = new DOMFile(parent, aFile.mFile->Impl());
|
||||
nsRefPtr<File> file = new File(parent, aFile.mFile->Impl());
|
||||
|
||||
if (aData.tag == SCTAG_DOM_BLOB) {
|
||||
if (NS_WARN_IF(!ResolveMysteryBlob(aFile.mFile,
|
||||
|
|
|
@ -19,7 +19,7 @@ class nsIInputStream;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class DOMFile;
|
||||
class File;
|
||||
|
||||
namespace indexedDB {
|
||||
|
||||
|
@ -31,7 +31,7 @@ class SerializedStructuredCloneWriteInfo;
|
|||
|
||||
struct StructuredCloneFile
|
||||
{
|
||||
nsRefPtr<DOMFile> mFile;
|
||||
nsRefPtr<File> mFile;
|
||||
nsRefPtr<FileInfo> mFileInfo;
|
||||
|
||||
// In IndexedDatabaseInlines.h
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "FileInfo.h"
|
||||
#include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -156,7 +156,7 @@ private:
|
|||
// protected by any mutex but it is only ever touched on the IO thread.
|
||||
nsClassHashtable<nsCStringHashKey, FileManagerInfo> mFileManagerInfos;
|
||||
|
||||
// Lock protecting FileManager.mFileInfos and nsDOMFileBase.mFileInfos
|
||||
// Lock protecting FileManager.mFileInfos and FileImplBase.mFileInfos
|
||||
// It's s also used to atomically update FileInfo.mRefCnt, FileInfo.mDBRefCnt
|
||||
// and FileInfo.mSliceRefCnt
|
||||
mozilla::Mutex mFileMutex;
|
||||
|
|
125
dom/ipc/Blob.cpp
125
dom/ipc/Blob.cpp
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/nsIContentParent.h"
|
||||
#include "mozilla/dom/nsIContentChild.h"
|
||||
#include "mozilla/dom/PBlobStreamChild.h"
|
||||
|
@ -26,10 +27,8 @@
|
|||
#include "mozilla/ipc/PBackgroundParent.h"
|
||||
#include "mozilla/ipc/PFileDescriptorSetParent.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsID.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIIPCSerializableInputStream.h"
|
||||
#include "nsIMultiplexInputStream.h"
|
||||
|
@ -252,7 +251,7 @@ class BlobInputStreamTether MOZ_FINAL
|
|||
, public nsIIPCSerializableInputStream
|
||||
{
|
||||
nsCOMPtr<nsIInputStream> mStream;
|
||||
nsRefPtr<DOMFileImpl> mBlobImpl;
|
||||
nsRefPtr<FileImpl> mBlobImpl;
|
||||
|
||||
nsIMultiplexInputStream* mWeakMultiplexStream;
|
||||
nsISeekableStream* mWeakSeekableStream;
|
||||
|
@ -265,7 +264,7 @@ public:
|
|||
NS_FORWARD_SAFE_NSISEEKABLESTREAM(mWeakSeekableStream)
|
||||
NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(mWeakSerializableStream)
|
||||
|
||||
BlobInputStreamTether(nsIInputStream* aStream, DOMFileImpl* aBlobImpl)
|
||||
BlobInputStreamTether(nsIInputStream* aStream, FileImpl* aBlobImpl)
|
||||
: mStream(aStream)
|
||||
, mBlobImpl(aBlobImpl)
|
||||
, mWeakMultiplexStream(nullptr)
|
||||
|
@ -322,14 +321,14 @@ class RemoteInputStream MOZ_FINAL
|
|||
{
|
||||
Monitor mMonitor;
|
||||
nsCOMPtr<nsIInputStream> mStream;
|
||||
nsRefPtr<DOMFileImpl> mBlobImpl;
|
||||
nsRefPtr<FileImpl> mBlobImpl;
|
||||
nsCOMPtr<nsIEventTarget> mEventTarget;
|
||||
nsISeekableStream* mWeakSeekableStream;
|
||||
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
explicit RemoteInputStream(DOMFileImpl* aBlobImpl)
|
||||
explicit RemoteInputStream(FileImpl* aBlobImpl)
|
||||
: mMonitor("RemoteInputStream.mMonitor")
|
||||
, mBlobImpl(aBlobImpl)
|
||||
, mWeakSeekableStream(nullptr)
|
||||
|
@ -409,7 +408,7 @@ public:
|
|||
nsresult rv = BlockAndWaitForStream();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<DOMFileImpl> blobImpl;
|
||||
nsRefPtr<FileImpl> blobImpl;
|
||||
mBlobImpl.swap(blobImpl);
|
||||
|
||||
rv = mStream->Close();
|
||||
|
@ -709,11 +708,11 @@ class BlobParent::IDTableEntry MOZ_FINAL
|
|||
{
|
||||
const nsID mID;
|
||||
const intptr_t mProcessID;
|
||||
const nsRefPtr<DOMFileImpl> mBlobImpl;
|
||||
const nsRefPtr<FileImpl> mBlobImpl;
|
||||
|
||||
public:
|
||||
static already_AddRefed<IDTableEntry>
|
||||
Create(const nsID& aID, intptr_t aProcessID, DOMFileImpl* aBlobImpl)
|
||||
Create(const nsID& aID, intptr_t aProcessID, FileImpl* aBlobImpl)
|
||||
{
|
||||
MOZ_ASSERT(aBlobImpl);
|
||||
|
||||
|
@ -752,7 +751,7 @@ public:
|
|||
}
|
||||
|
||||
static already_AddRefed<IDTableEntry>
|
||||
GetOrCreate(const nsID& aID, intptr_t aProcessID, DOMFileImpl* aBlobImpl)
|
||||
GetOrCreate(const nsID& aID, intptr_t aProcessID, FileImpl* aBlobImpl)
|
||||
{
|
||||
MOZ_ASSERT(aBlobImpl);
|
||||
|
||||
|
@ -780,7 +779,7 @@ public:
|
|||
return mProcessID;
|
||||
}
|
||||
|
||||
DOMFileImpl*
|
||||
FileImpl*
|
||||
BlobImpl() const
|
||||
{
|
||||
return mBlobImpl;
|
||||
|
@ -789,13 +788,13 @@ public:
|
|||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IDTableEntry)
|
||||
|
||||
private:
|
||||
IDTableEntry(const nsID& aID, intptr_t aProcessID, DOMFileImpl* aBlobImpl);
|
||||
IDTableEntry(const nsID& aID, intptr_t aProcessID, FileImpl* aBlobImpl);
|
||||
~IDTableEntry();
|
||||
|
||||
static already_AddRefed<IDTableEntry>
|
||||
GetOrCreateInternal(const nsID& aID,
|
||||
intptr_t aProcessID,
|
||||
DOMFileImpl* aBlobImpl,
|
||||
FileImpl* aBlobImpl,
|
||||
bool aMayCreate,
|
||||
bool aMayGet,
|
||||
bool aIgnoreProcessID);
|
||||
|
@ -1051,7 +1050,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(BlobParent::OpenStreamRunnable, nsRunnable)
|
|||
******************************************************************************/
|
||||
|
||||
class BlobChild::RemoteBlobImpl MOZ_FINAL
|
||||
: public DOMFileImplBase
|
||||
: public FileImplBase
|
||||
, public nsIRemoteBlob
|
||||
{
|
||||
class StreamHelper;
|
||||
|
@ -1066,7 +1065,7 @@ public:
|
|||
const nsAString& aContentType,
|
||||
uint64_t aLength,
|
||||
uint64_t aModDate)
|
||||
: DOMFileImplBase(aName, aContentType, aLength, aModDate)
|
||||
: FileImplBase(aName, aContentType, aLength, aModDate)
|
||||
{
|
||||
CommonInit(aActor);
|
||||
}
|
||||
|
@ -1074,14 +1073,14 @@ public:
|
|||
RemoteBlobImpl(BlobChild* aActor,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength)
|
||||
: DOMFileImplBase(aContentType, aLength)
|
||||
: FileImplBase(aContentType, aLength)
|
||||
{
|
||||
CommonInit(aActor);
|
||||
}
|
||||
|
||||
explicit
|
||||
RemoteBlobImpl(BlobChild* aActor)
|
||||
: DOMFileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
|
||||
: FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX)
|
||||
{
|
||||
CommonInit(aActor);
|
||||
}
|
||||
|
@ -1100,7 +1099,7 @@ public:
|
|||
virtual void
|
||||
GetMozFullPathInternal(nsAString& aFileName, ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -1167,12 +1166,12 @@ class BlobChild::RemoteBlobImpl::StreamHelper MOZ_FINAL
|
|||
{
|
||||
Monitor mMonitor;
|
||||
BlobChild* mActor;
|
||||
nsRefPtr<DOMFileImpl> mBlobImpl;
|
||||
nsRefPtr<FileImpl> mBlobImpl;
|
||||
nsRefPtr<RemoteInputStream> mInputStream;
|
||||
bool mDone;
|
||||
|
||||
public:
|
||||
StreamHelper(BlobChild* aActor, DOMFileImpl* aBlobImpl)
|
||||
StreamHelper(BlobChild* aActor, FileImpl* aBlobImpl)
|
||||
: mMonitor("BlobChild::RemoteBlobImpl::StreamHelper::mMonitor")
|
||||
, mActor(aActor)
|
||||
, mBlobImpl(aBlobImpl)
|
||||
|
@ -1268,7 +1267,7 @@ class BlobChild::RemoteBlobImpl::SliceHelper MOZ_FINAL
|
|||
{
|
||||
Monitor mMonitor;
|
||||
BlobChild* mActor;
|
||||
nsRefPtr<DOMFileImpl> mSlice;
|
||||
nsRefPtr<FileImpl> mSlice;
|
||||
uint64_t mStart;
|
||||
uint64_t mLength;
|
||||
nsString mContentType;
|
||||
|
@ -1287,7 +1286,7 @@ public:
|
|||
MOZ_ASSERT(aActor);
|
||||
}
|
||||
|
||||
DOMFileImpl*
|
||||
FileImpl*
|
||||
GetSlice(uint64_t aStart,
|
||||
uint64_t aLength,
|
||||
const nsAString& aContentType)
|
||||
|
@ -1405,7 +1404,7 @@ private:
|
|||
NS_IMPL_ADDREF(BlobChild::RemoteBlobImpl)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(BlobChild::RemoteBlobImpl, Destroy())
|
||||
NS_IMPL_QUERY_INTERFACE_INHERITED(BlobChild::RemoteBlobImpl,
|
||||
DOMFileImpl,
|
||||
FileImpl,
|
||||
nsIRemoteBlob)
|
||||
|
||||
void
|
||||
|
@ -1427,7 +1426,7 @@ RemoteBlobImpl::GetMozFullPathInternal(nsAString& aFilePath,
|
|||
aFilePath = filePath;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMFileImpl>
|
||||
already_AddRefed<FileImpl>
|
||||
BlobChild::
|
||||
RemoteBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
||||
const nsAString& aContentType, ErrorResult& aRv)
|
||||
|
@ -1439,7 +1438,7 @@ RemoteBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
|
|||
|
||||
nsRefPtr<SliceHelper> helper = new SliceHelper(mActor);
|
||||
|
||||
nsRefPtr<DOMFileImpl> impl = helper->GetSlice(aStart, aLength, aContentType);
|
||||
nsRefPtr<FileImpl> impl = helper->GetSlice(aStart, aLength, aContentType);
|
||||
if (NS_WARN_IF(!impl)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
|
@ -1501,7 +1500,7 @@ RemoteBlobImpl::GetBlobParent()
|
|||
* BlobChild
|
||||
******************************************************************************/
|
||||
|
||||
BlobChild::BlobChild(nsIContentChild* aManager, DOMFileImpl* aBlobImpl)
|
||||
BlobChild::BlobChild(nsIContentChild* aManager, FileImpl* aBlobImpl)
|
||||
: mBackgroundManager(nullptr)
|
||||
, mContentManager(aManager)
|
||||
{
|
||||
|
@ -1511,7 +1510,7 @@ BlobChild::BlobChild(nsIContentChild* aManager, DOMFileImpl* aBlobImpl)
|
|||
CommonInit(aBlobImpl);
|
||||
}
|
||||
|
||||
BlobChild::BlobChild(PBackgroundChild* aManager, DOMFileImpl* aBlobImpl)
|
||||
BlobChild::BlobChild(PBackgroundChild* aManager, FileImpl* aBlobImpl)
|
||||
: mBackgroundManager(aManager)
|
||||
, mContentManager(nullptr)
|
||||
{
|
||||
|
@ -1586,7 +1585,7 @@ BlobChild::~BlobChild()
|
|||
}
|
||||
|
||||
void
|
||||
BlobChild::CommonInit(DOMFileImpl* aBlobImpl)
|
||||
BlobChild::CommonInit(FileImpl* aBlobImpl)
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(aBlobImpl);
|
||||
|
@ -1612,7 +1611,7 @@ BlobChild::CommonInit(BlobChild* aOther)
|
|||
|
||||
MOZ_COUNT_CTOR(BlobChild);
|
||||
|
||||
nsRefPtr<DOMFileImpl> otherImpl = aOther->GetBlobImpl();
|
||||
nsRefPtr<FileImpl> otherImpl = aOther->GetBlobImpl();
|
||||
MOZ_ASSERT(otherImpl);
|
||||
|
||||
nsString contentType;
|
||||
|
@ -1729,7 +1728,7 @@ BlobChild::Startup(const FriendKey& /* aKey */)
|
|||
|
||||
// static
|
||||
BlobChild*
|
||||
BlobChild::GetOrCreate(nsIContentChild* aManager, DOMFileImpl* aBlobImpl)
|
||||
BlobChild::GetOrCreate(nsIContentChild* aManager, FileImpl* aBlobImpl)
|
||||
{
|
||||
AssertCorrectThreadForManager(aManager);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
@ -1739,7 +1738,7 @@ BlobChild::GetOrCreate(nsIContentChild* aManager, DOMFileImpl* aBlobImpl)
|
|||
|
||||
// static
|
||||
BlobChild*
|
||||
BlobChild::GetOrCreate(PBackgroundChild* aManager, DOMFileImpl* aBlobImpl)
|
||||
BlobChild::GetOrCreate(PBackgroundChild* aManager, FileImpl* aBlobImpl)
|
||||
{
|
||||
AssertCorrectThreadForManager(aManager);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
@ -1773,7 +1772,7 @@ BlobChild::Create(PBackgroundChild* aManager,
|
|||
template <class ChildManagerType>
|
||||
BlobChild*
|
||||
BlobChild::GetOrCreateFromImpl(ChildManagerType* aManager,
|
||||
DOMFileImpl* aBlobImpl)
|
||||
FileImpl* aBlobImpl)
|
||||
{
|
||||
AssertCorrectThreadForManager(aManager);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
@ -1869,7 +1868,7 @@ BlobChild::CreateFromParams(ChildManagerType* aManager,
|
|||
static_cast<const BlobChild*>(params.sourceChild()));
|
||||
MOZ_ASSERT(actor);
|
||||
|
||||
nsRefPtr<DOMFileImpl> source = actor->GetBlobImpl();
|
||||
nsRefPtr<FileImpl> source = actor->GetBlobImpl();
|
||||
MOZ_ASSERT(source);
|
||||
|
||||
Optional<int64_t> start;
|
||||
|
@ -1879,7 +1878,7 @@ BlobChild::CreateFromParams(ChildManagerType* aManager,
|
|||
start.Construct(params.end());
|
||||
|
||||
ErrorResult rv;
|
||||
nsRefPtr<DOMFileImpl> slice =
|
||||
nsRefPtr<FileImpl> slice =
|
||||
source->Slice(start, end, params.contentType(), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return nullptr;
|
||||
|
@ -1999,13 +1998,13 @@ BlobChild::ParentID() const
|
|||
return mParentID;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMFileImpl>
|
||||
already_AddRefed<FileImpl>
|
||||
BlobChild::GetBlobImpl()
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mBlobImpl);
|
||||
|
||||
nsRefPtr<DOMFileImpl> blobImpl;
|
||||
nsRefPtr<FileImpl> blobImpl;
|
||||
|
||||
// Remote blobs are held alive until the first call to GetBlobImpl. Thereafter
|
||||
// we only hold a weak reference. Normal blobs are held alive until the actor
|
||||
|
@ -2204,7 +2203,7 @@ private:
|
|||
|
||||
class BlobParent::RemoteBlobImpl MOZ_FINAL
|
||||
: public RemoteBlobImplBase
|
||||
, public DOMFileImplBase
|
||||
, public FileImplBase
|
||||
, public nsIRemoteBlob
|
||||
{
|
||||
friend class mozilla::dom::BlobParent;
|
||||
|
@ -2216,7 +2215,7 @@ class BlobParent::RemoteBlobImpl MOZ_FINAL
|
|||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType,
|
||||
ErrorResult& aRv) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -2240,7 +2239,7 @@ private:
|
|||
uint64_t aLength,
|
||||
uint64_t aModDate)
|
||||
: RemoteBlobImplBase(aActor, /* aForwards */ false)
|
||||
, DOMFileImplBase(aName, aContentType, aLength, aModDate)
|
||||
, FileImplBase(aName, aContentType, aLength, aModDate)
|
||||
{
|
||||
CommonInit(aInputStreamParams);
|
||||
}
|
||||
|
@ -2250,7 +2249,7 @@ private:
|
|||
const nsAString& aContentType,
|
||||
uint64_t aLength)
|
||||
: RemoteBlobImplBase(aActor, /* aForwards */ false)
|
||||
, DOMFileImplBase(aContentType, aLength)
|
||||
, FileImplBase(aContentType, aLength)
|
||||
{
|
||||
CommonInit(aInputStreamParams);
|
||||
}
|
||||
|
@ -2274,7 +2273,7 @@ class BlobParent::RemoteBlobImpl::SliceHelper MOZ_FINAL
|
|||
{
|
||||
Monitor mMonitor;
|
||||
BlobParent* mActor;
|
||||
nsRefPtr<DOMFileImpl> mSlice;
|
||||
nsRefPtr<FileImpl> mSlice;
|
||||
uint64_t mStart;
|
||||
uint64_t mLength;
|
||||
nsString mContentType;
|
||||
|
@ -2293,7 +2292,7 @@ public:
|
|||
MOZ_ASSERT(aActor);
|
||||
}
|
||||
|
||||
DOMFileImpl*
|
||||
FileImpl*
|
||||
GetSlice(uint64_t aStart,
|
||||
uint64_t aLength,
|
||||
const nsAString& aContentType)
|
||||
|
@ -2406,7 +2405,7 @@ private:
|
|||
|
||||
class BlobParent::ForwardingRemoteBlobImpl MOZ_FINAL
|
||||
: public RemoteBlobImplBase
|
||||
, public DOMFileImpl
|
||||
, public FileImpl
|
||||
, public nsIRemoteBlob
|
||||
{
|
||||
friend class mozilla::dom::BlobParent;
|
||||
|
@ -2414,7 +2413,7 @@ class BlobParent::ForwardingRemoteBlobImpl MOZ_FINAL
|
|||
typedef mozilla::dom::indexedDB::FileInfo FileInfo;
|
||||
typedef mozilla::dom::indexedDB::FileManager FileManager;
|
||||
|
||||
nsRefPtr<DOMFileImpl> mBlobImpl;
|
||||
nsRefPtr<FileImpl> mBlobImpl;
|
||||
nsCOMPtr<nsIRemoteBlob> mRemoteBlob;
|
||||
|
||||
public:
|
||||
|
@ -2462,7 +2461,7 @@ public:
|
|||
mBlobImpl->GetType(aType);
|
||||
}
|
||||
|
||||
virtual already_AddRefed<DOMFileImpl>
|
||||
virtual already_AddRefed<FileImpl>
|
||||
CreateSlice(uint64_t aStart,
|
||||
uint64_t aLength,
|
||||
const nsAString& aContentType,
|
||||
|
@ -2471,7 +2470,7 @@ public:
|
|||
return mBlobImpl->CreateSlice(aStart, aLength, aContentType, aRv);
|
||||
}
|
||||
|
||||
virtual const nsTArray<nsRefPtr<DOMFileImpl>>*
|
||||
virtual const nsTArray<nsRefPtr<FileImpl>>*
|
||||
GetSubBlobImpls() const MOZ_OVERRIDE
|
||||
{
|
||||
return mBlobImpl->GetSubBlobImpls();
|
||||
|
@ -2588,7 +2587,7 @@ public:
|
|||
|
||||
private:
|
||||
ForwardingRemoteBlobImpl(BlobParent* aActor,
|
||||
DOMFileImpl* aBlobImpl)
|
||||
FileImpl* aBlobImpl)
|
||||
: RemoteBlobImplBase(aActor, /* aForwards */ true)
|
||||
, mBlobImpl(aBlobImpl)
|
||||
, mRemoteBlob(do_QueryObject(aBlobImpl))
|
||||
|
@ -2611,10 +2610,10 @@ private:
|
|||
NS_IMPL_ADDREF(BlobParent::RemoteBlobImpl)
|
||||
NS_IMPL_RELEASE_WITH_DESTROY(BlobParent::RemoteBlobImpl, Destroy())
|
||||
NS_IMPL_QUERY_INTERFACE_INHERITED(BlobParent::RemoteBlobImpl,
|
||||
DOMFileImplBase,
|
||||
FileImplBase,
|
||||
nsIRemoteBlob)
|
||||
|
||||
already_AddRefed<DOMFileImpl>
|
||||
already_AddRefed<FileImpl>
|
||||
BlobParent::
|
||||
RemoteBlobImpl::CreateSlice(uint64_t aStart,
|
||||
uint64_t aLength,
|
||||
|
@ -2628,7 +2627,7 @@ RemoteBlobImpl::CreateSlice(uint64_t aStart,
|
|||
|
||||
nsRefPtr<SliceHelper> helper = new SliceHelper(mActor);
|
||||
|
||||
nsRefPtr<DOMFileImpl> impl = helper->GetSlice(aStart, aLength, aContentType);
|
||||
nsRefPtr<FileImpl> impl = helper->GetSlice(aStart, aLength, aContentType);
|
||||
if (NS_WARN_IF(!impl)) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
|
@ -2686,7 +2685,7 @@ NS_IMPL_ADDREF(BlobParent::ForwardingRemoteBlobImpl)
|
|||
NS_IMPL_RELEASE_WITH_DESTROY(BlobParent::ForwardingRemoteBlobImpl, Destroy())
|
||||
NS_INTERFACE_MAP_BEGIN(BlobParent::ForwardingRemoteBlobImpl)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIRemoteBlob, mRemoteBlob)
|
||||
NS_INTERFACE_MAP_END_INHERITING(DOMFileImpl)
|
||||
NS_INTERFACE_MAP_END_INHERITING(FileImpl)
|
||||
|
||||
/*******************************************************************************
|
||||
* BlobParent
|
||||
|
@ -2797,7 +2796,7 @@ BlobParent::CommonInit(const ParentBlobConstructorParams& aParams,
|
|||
aParams.optionalInputStreamParams().type() ==
|
||||
OptionalInputStreamParams::TInputStreamParams);
|
||||
|
||||
nsRefPtr<DOMFileImpl> remoteBlobImpl;
|
||||
nsRefPtr<FileImpl> remoteBlobImpl;
|
||||
RemoteBlobImplBase* remoteBlobBase = nullptr;
|
||||
|
||||
switch (paramsType) {
|
||||
|
@ -2893,7 +2892,7 @@ BlobParent::Startup(const FriendKey& /* aKey */)
|
|||
|
||||
// static
|
||||
BlobParent*
|
||||
BlobParent::GetOrCreate(nsIContentParent* aManager, DOMFileImpl* aBlobImpl)
|
||||
BlobParent::GetOrCreate(nsIContentParent* aManager, FileImpl* aBlobImpl)
|
||||
{
|
||||
AssertCorrectThreadForManager(aManager);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
@ -2903,7 +2902,7 @@ BlobParent::GetOrCreate(nsIContentParent* aManager, DOMFileImpl* aBlobImpl)
|
|||
|
||||
// static
|
||||
BlobParent*
|
||||
BlobParent::GetOrCreate(PBackgroundParent* aManager, DOMFileImpl* aBlobImpl)
|
||||
BlobParent::GetOrCreate(PBackgroundParent* aManager, FileImpl* aBlobImpl)
|
||||
{
|
||||
AssertCorrectThreadForManager(aManager);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
@ -2934,7 +2933,7 @@ BlobParent::Create(PBackgroundParent* aManager,
|
|||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<DOMFileImpl>
|
||||
already_AddRefed<FileImpl>
|
||||
BlobParent::GetBlobImplForID(const nsID& aID)
|
||||
{
|
||||
if (NS_WARN_IF(gProcessType != GeckoProcessType_Default)) {
|
||||
|
@ -2947,7 +2946,7 @@ BlobParent::GetBlobImplForID(const nsID& aID)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<DOMFileImpl> blobImpl = idTableEntry->BlobImpl();
|
||||
nsRefPtr<FileImpl> blobImpl = idTableEntry->BlobImpl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
return blobImpl.forget();
|
||||
|
@ -2957,7 +2956,7 @@ BlobParent::GetBlobImplForID(const nsID& aID)
|
|||
template <class ParentManagerType>
|
||||
BlobParent*
|
||||
BlobParent::GetOrCreateFromImpl(ParentManagerType* aManager,
|
||||
DOMFileImpl* aBlobImpl)
|
||||
FileImpl* aBlobImpl)
|
||||
{
|
||||
AssertCorrectThreadForManager(aManager);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
@ -3071,7 +3070,7 @@ BlobParent::CreateFromParams(ParentManagerType* aManager,
|
|||
static_cast<const BlobParent*>(params.sourceParent()));
|
||||
MOZ_ASSERT(actor);
|
||||
|
||||
nsRefPtr<DOMFileImpl> source = actor->GetBlobImpl();
|
||||
nsRefPtr<FileImpl> source = actor->GetBlobImpl();
|
||||
MOZ_ASSERT(source);
|
||||
|
||||
Optional<int64_t> start;
|
||||
|
@ -3081,7 +3080,7 @@ BlobParent::CreateFromParams(ParentManagerType* aManager,
|
|||
end.Construct(params.end());
|
||||
|
||||
ErrorResult rv;
|
||||
nsRefPtr<DOMFileImpl> slice =
|
||||
nsRefPtr<FileImpl> slice =
|
||||
source->Slice(start, end, params.contentType(), rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return nullptr;
|
||||
|
@ -3184,13 +3183,13 @@ BlobParent::MaybeGetActorFromRemoteBlob(nsIRemoteBlob* aRemoteBlob,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<DOMFileImpl>
|
||||
already_AddRefed<FileImpl>
|
||||
BlobParent::GetBlobImpl()
|
||||
{
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mBlobImpl);
|
||||
|
||||
nsRefPtr<DOMFileImpl> blobImpl;
|
||||
nsRefPtr<FileImpl> blobImpl;
|
||||
|
||||
// Remote blobs are held alive until the first call to GetBlobImpl. Thereafter
|
||||
// we only hold a weak reference. Normal blobs are held alive until the actor
|
||||
|
@ -3543,7 +3542,7 @@ InputStreamChild::Recv__delete__(const InputStreamParams& aParams,
|
|||
BlobParent::
|
||||
IDTableEntry::IDTableEntry(const nsID& aID,
|
||||
intptr_t aProcessID,
|
||||
DOMFileImpl* aBlobImpl)
|
||||
FileImpl* aBlobImpl)
|
||||
: mID(aID)
|
||||
, mProcessID(aProcessID)
|
||||
, mBlobImpl(aBlobImpl)
|
||||
|
@ -3575,7 +3574,7 @@ already_AddRefed<BlobParent::IDTableEntry>
|
|||
BlobParent::
|
||||
IDTableEntry::GetOrCreateInternal(const nsID& aID,
|
||||
intptr_t aProcessID,
|
||||
DOMFileImpl* aBlobImpl,
|
||||
FileImpl* aBlobImpl,
|
||||
bool aMayCreate,
|
||||
bool aMayGet,
|
||||
bool aIgnoreProcessID)
|
||||
|
|
|
@ -25,7 +25,7 @@ class PBackgroundChild;
|
|||
namespace dom {
|
||||
|
||||
class ContentChild;
|
||||
class DOMFileImpl;
|
||||
class FileImpl;
|
||||
class nsIContentChild;
|
||||
class PBlobStreamChild;
|
||||
|
||||
|
@ -37,7 +37,7 @@ class BlobChild MOZ_FINAL
|
|||
class RemoteBlobImpl;
|
||||
friend class RemoteBlobImpl;
|
||||
|
||||
DOMFileImpl* mBlobImpl;
|
||||
FileImpl* mBlobImpl;
|
||||
RemoteBlobImpl* mRemoteBlobImpl;
|
||||
|
||||
// One of these will be null and the other non-null.
|
||||
|
@ -58,10 +58,10 @@ public:
|
|||
|
||||
// These create functions are called on the sending side.
|
||||
static BlobChild*
|
||||
GetOrCreate(nsIContentChild* aManager, DOMFileImpl* aBlobImpl);
|
||||
GetOrCreate(nsIContentChild* aManager, FileImpl* aBlobImpl);
|
||||
|
||||
static BlobChild*
|
||||
GetOrCreate(PBackgroundChild* aManager, DOMFileImpl* aBlobImpl);
|
||||
GetOrCreate(PBackgroundChild* aManager, FileImpl* aBlobImpl);
|
||||
|
||||
// These create functions are called on the receiving side.
|
||||
static BlobChild*
|
||||
|
@ -98,11 +98,11 @@ public:
|
|||
const nsID&
|
||||
ParentID() const;
|
||||
|
||||
// Get the DOMFileImpl associated with this actor. This may always be called
|
||||
// Get the FileImpl associated with this actor. This may always be called
|
||||
// on the sending side. It may also be called on the receiving side unless
|
||||
// this is a "mystery" blob that has not yet received a SetMysteryBlobInfo()
|
||||
// call.
|
||||
already_AddRefed<DOMFileImpl>
|
||||
already_AddRefed<FileImpl>
|
||||
GetBlobImpl();
|
||||
|
||||
// Use this for files.
|
||||
|
@ -126,9 +126,9 @@ public:
|
|||
|
||||
private:
|
||||
// These constructors are called on the sending side.
|
||||
BlobChild(nsIContentChild* aManager, DOMFileImpl* aBlobImpl);
|
||||
BlobChild(nsIContentChild* aManager, FileImpl* aBlobImpl);
|
||||
|
||||
BlobChild(PBackgroundChild* aManager, DOMFileImpl* aBlobImpl);
|
||||
BlobChild(PBackgroundChild* aManager, FileImpl* aBlobImpl);
|
||||
|
||||
BlobChild(nsIContentChild* aManager, BlobChild* aOther);
|
||||
|
||||
|
@ -145,7 +145,7 @@ private:
|
|||
~BlobChild();
|
||||
|
||||
void
|
||||
CommonInit(DOMFileImpl* aBlobImpl);
|
||||
CommonInit(FileImpl* aBlobImpl);
|
||||
|
||||
void
|
||||
CommonInit(BlobChild* aOther);
|
||||
|
@ -155,7 +155,7 @@ private:
|
|||
|
||||
template <class ChildManagerType>
|
||||
static BlobChild*
|
||||
GetOrCreateFromImpl(ChildManagerType* aManager, DOMFileImpl* aBlobImpl);
|
||||
GetOrCreateFromImpl(ChildManagerType* aManager, FileImpl* aBlobImpl);
|
||||
|
||||
template <class ChildManagerType>
|
||||
static BlobChild*
|
||||
|
|
|
@ -33,7 +33,7 @@ class PBackgroundParent;
|
|||
namespace dom {
|
||||
|
||||
class ContentParent;
|
||||
class DOMFileImpl;
|
||||
class FileImpl;
|
||||
class nsIContentParent;
|
||||
class PBlobStreamParent;
|
||||
|
||||
|
@ -57,7 +57,7 @@ class BlobParent MOZ_FINAL
|
|||
static StaticAutoPtr<IDTable> sIDTable;
|
||||
static StaticAutoPtr<Mutex> sIDTableMutex;
|
||||
|
||||
DOMFileImpl* mBlobImpl;
|
||||
FileImpl* mBlobImpl;
|
||||
RemoteBlobImplBase* mRemoteBlobImpl;
|
||||
|
||||
// One of these will be null and the other non-null.
|
||||
|
@ -87,10 +87,10 @@ public:
|
|||
|
||||
// These create functions are called on the sending side.
|
||||
static BlobParent*
|
||||
GetOrCreate(nsIContentParent* aManager, DOMFileImpl* aBlobImpl);
|
||||
GetOrCreate(nsIContentParent* aManager, FileImpl* aBlobImpl);
|
||||
|
||||
static BlobParent*
|
||||
GetOrCreate(PBackgroundParent* aManager, DOMFileImpl* aBlobImpl);
|
||||
GetOrCreate(PBackgroundParent* aManager, FileImpl* aBlobImpl);
|
||||
|
||||
// These create functions are called on the receiving side.
|
||||
static BlobParent*
|
||||
|
@ -128,8 +128,8 @@ public:
|
|||
return mContentManager;
|
||||
}
|
||||
|
||||
// Get the DOMFileImpl associated with this actor.
|
||||
already_AddRefed<DOMFileImpl>
|
||||
// Get the FileImpl associated with this actor.
|
||||
already_AddRefed<FileImpl>
|
||||
GetBlobImpl();
|
||||
|
||||
void
|
||||
|
@ -168,7 +168,7 @@ private:
|
|||
template <class ParentManagerType>
|
||||
static BlobParent*
|
||||
GetOrCreateFromImpl(ParentManagerType* aManager,
|
||||
DOMFileImpl* aBlobImpl);
|
||||
FileImpl* aBlobImpl);
|
||||
|
||||
template <class ParentManagerType>
|
||||
static BlobParent*
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
#include "mozilla/dom/ContentBridgeChild.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/StructuredCloneUtils.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "JavaScriptChild.h"
|
||||
|
||||
using namespace base;
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
#include "ipc/Nuwa.h"
|
||||
#endif
|
||||
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/cellbroadcast/CellBroadcastIPCService.h"
|
||||
#include "mozilla/dom/mobileconnection/MobileConnectionChild.h"
|
||||
#include "mozilla/dom/mobilemessage/SmsChild.h"
|
||||
|
@ -144,7 +145,6 @@
|
|||
#include "mozilla/dom/PSpeechSynthesisChild.h"
|
||||
#endif
|
||||
|
||||
#include "nsDOMFile.h"
|
||||
#include "ProcessUtils.h"
|
||||
#include "StructuredCloneUtils.h"
|
||||
#include "URIUtils.h"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "mozilla/dom/DataStoreService.h"
|
||||
#include "mozilla/dom/DOMStorageIPC.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ExternalHelperAppParent.h"
|
||||
#include "mozilla/dom/FileSystemRequestParent.h"
|
||||
#include "mozilla/dom/GeolocationBinding.h"
|
||||
|
@ -78,7 +79,6 @@
|
|||
#include "nsConsoleMessage.h"
|
||||
#include "nsConsoleService.h"
|
||||
#include "nsDebugImpl.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsFrameMessageManager.h"
|
||||
#include "nsHashPropertyBag.h"
|
||||
#include "nsIAlertsService.h"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "FilePickerParent.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMFile.h"
|
||||
|
@ -14,6 +13,7 @@
|
|||
#include "nsIFile.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
|
@ -118,7 +118,7 @@ FilePickerParent::SendFiles(const nsCOMArray<nsIDOMFile>& aDomfiles)
|
|||
|
||||
for (unsigned i = 0; i < aDomfiles.Length(); i++) {
|
||||
BlobParent* blob = parent->GetOrCreateActorForBlob(
|
||||
static_cast<DOMFile*>(aDomfiles[i]));
|
||||
static_cast<File*>(aDomfiles[i]));
|
||||
if (blob) {
|
||||
files.AppendElement(blob);
|
||||
}
|
||||
|
@ -151,9 +151,9 @@ FilePickerParent::Done(int16_t aResult)
|
|||
if (supports) {
|
||||
nsCOMPtr<nsIFile> file = do_QueryInterface(supports);
|
||||
|
||||
// A null parent is fine because DOMFile are not used in this process
|
||||
// A null parent is fine because File are not used in this process
|
||||
// but only in the child.
|
||||
nsCOMPtr<nsIDOMFile> domfile = DOMFile::CreateFromFile(nullptr, file);
|
||||
nsCOMPtr<nsIDOMFile> domfile = File::CreateFromFile(nullptr, file);
|
||||
domfiles.AppendElement(domfile);
|
||||
}
|
||||
}
|
||||
|
@ -161,9 +161,9 @@ FilePickerParent::Done(int16_t aResult)
|
|||
nsCOMPtr<nsIFile> file;
|
||||
mFilePicker->GetFile(getter_AddRefs(file));
|
||||
if (file) {
|
||||
// A null parent is fine because DOMFile are not used in this process
|
||||
// A null parent is fine because File are not used in this process
|
||||
// but only in the child.
|
||||
nsCOMPtr<nsIDOMFile> domfile = DOMFile::CreateFromFile(nullptr, file);
|
||||
nsCOMPtr<nsIDOMFile> domfile = File::CreateFromFile(nullptr, file);
|
||||
domfiles.AppendElement(domfile);
|
||||
}
|
||||
}
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче