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