From 8f8ec513727a6e213984106dda6a8c808a743b46 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Wed, 8 Oct 2014 17:15:23 +0100 Subject: [PATCH] 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 --- b2g/components/FilePicker.js | 2 +- .../test/mochitest/test_filepicker_path.html | 6 +- content/base/public/{nsDOMFile.h => File.h} | 238 +++++---- content/base/public/moz.build | 2 +- content/base/src/{nsDOMFile.cpp => File.cpp} | 458 +++++++++--------- content/base/src/FileIOObject.cpp | 6 +- content/base/src/WebSocket.cpp | 5 +- content/base/src/WebSocket.h | 4 +- content/base/src/moz.build | 2 +- content/base/src/nsContentUtils.cpp | 6 +- content/base/src/nsDOMBlobBuilder.cpp | 82 ++-- content/base/src/nsDOMBlobBuilder.h | 57 ++- content/base/src/nsDOMDataChannel.cpp | 5 +- content/base/src/nsDOMDataChannel.h | 4 +- content/base/src/nsDOMFileReader.cpp | 12 +- content/base/src/nsDOMFileReader.h | 14 +- content/base/src/nsFormData.cpp | 7 +- content/base/src/nsFormData.h | 4 +- content/base/src/nsFrameMessageManager.cpp | 8 +- .../base/src/nsHostObjectProtocolHandler.cpp | 12 +- content/base/src/nsXMLHttpRequest.cpp | 7 +- content/base/src/nsXMLHttpRequest.h | 13 +- content/base/test/chrome/test_bug914381.html | 2 +- .../html/content/public/HTMLCanvasElement.h | 8 +- .../html/content/src/HTMLCanvasElement.cpp | 20 +- content/html/content/src/HTMLInputElement.cpp | 53 +- content/html/content/src/HTMLInputElement.h | 8 +- content/media/EncodedBufferCache.cpp | 14 +- content/media/EncodedBufferCache.h | 4 +- content/media/MediaRecorder.cpp | 4 +- content/media/imagecapture/CaptureTask.cpp | 10 +- content/media/imagecapture/CaptureTask.h | 4 +- content/media/imagecapture/ImageCapture.cpp | 8 +- content/media/imagecapture/ImageCapture.h | 4 +- content/media/webrtc/MediaEngine.h | 4 +- content/media/webrtc/MediaEngineDefault.cpp | 4 +- content/media/webrtc/MediaEngineWebRTC.h | 2 +- .../media/webrtc/MediaEngineWebRTCVideo.cpp | 6 +- dom/archivereader/ArchiveEvent.cpp | 2 +- dom/archivereader/ArchiveEvent.h | 4 +- dom/archivereader/ArchiveReader.cpp | 8 +- dom/archivereader/ArchiveReader.h | 8 +- dom/archivereader/ArchiveZipEvent.cpp | 4 +- dom/archivereader/ArchiveZipEvent.h | 2 +- dom/archivereader/ArchiveZipFile.cpp | 8 +- dom/archivereader/ArchiveZipFile.h | 12 +- dom/base/ImageEncoder.cpp | 4 +- dom/base/ImageEncoder.h | 4 +- dom/base/MessagePort.cpp | 16 +- dom/base/Navigator.cpp | 4 +- dom/base/URL.cpp | 4 +- dom/base/URL.h | 4 +- dom/base/nsDOMWindowUtils.cpp | 4 +- dom/base/nsGlobalWindow.cpp | 15 +- dom/bindings/Bindings.conf | 11 +- dom/bluetooth/BluetoothAdapter.cpp | 4 +- dom/bluetooth/BluetoothAdapter.h | 4 +- .../bluedroid/BluetoothOppManager.cpp | 6 +- dom/bluetooth/bluez/BluetoothOppManager.cpp | 6 +- dom/camera/DOMCameraControl.cpp | 4 +- dom/camera/DOMCameraControlListener.cpp | 10 +- dom/contacts/tests/test_contacts_blobs.html | 4 +- .../DeviceStorageRequestChild.cpp | 6 +- .../DeviceStorageRequestParent.cpp | 12 +- dom/devicestorage/nsDeviceStorage.cpp | 21 +- dom/events/DataTransfer.cpp | 3 +- dom/events/DataTransfer.h | 2 +- dom/fetch/Request.cpp | 8 +- dom/filehandle/FileHandle.cpp | 6 +- dom/filehandle/FileHandle.h | 4 +- dom/filesystem/CreateFileTask.cpp | 15 +- dom/filesystem/CreateFileTask.h | 14 +- dom/filesystem/DeviceStorageFileSystem.cpp | 4 +- dom/filesystem/DeviceStorageFileSystem.h | 2 +- dom/filesystem/Directory.cpp | 4 +- dom/filesystem/Directory.h | 2 +- dom/filesystem/FileSystemBase.h | 4 +- dom/filesystem/FileSystemTaskBase.cpp | 4 +- dom/filesystem/GetFileOrDirectoryTask.cpp | 10 +- dom/filesystem/GetFileOrDirectoryTask.h | 8 +- dom/filesystem/RemoveTask.cpp | 9 +- dom/filesystem/RemoveTask.h | 10 +- dom/indexedDB/ActorsChild.cpp | 4 +- dom/indexedDB/ActorsParent.cpp | 15 +- dom/indexedDB/FileSnapshot.cpp | 16 +- dom/indexedDB/FileSnapshot.h | 6 +- dom/indexedDB/IDBDatabase.cpp | 15 +- dom/indexedDB/IDBDatabase.h | 6 +- dom/indexedDB/IDBMutableFile.cpp | 4 +- dom/indexedDB/IDBObjectStore.cpp | 17 +- dom/indexedDB/IndexedDatabase.h | 4 +- dom/indexedDB/IndexedDatabaseInlines.h | 2 +- dom/indexedDB/IndexedDatabaseManager.h | 2 +- dom/ipc/Blob.cpp | 125 +++-- dom/ipc/BlobChild.h | 20 +- dom/ipc/BlobParent.h | 14 +- dom/ipc/ContentBridgeChild.cpp | 2 +- dom/ipc/ContentChild.cpp | 2 +- dom/ipc/ContentParent.cpp | 2 +- dom/ipc/FilePickerParent.cpp | 12 +- dom/ipc/StructuredCloneUtils.cpp | 12 +- dom/ipc/StructuredCloneUtils.h | 4 +- dom/ipc/nsIContentChild.cpp | 6 +- dom/ipc/nsIContentChild.h | 4 +- dom/ipc/nsIContentParent.cpp | 6 +- dom/ipc/nsIContentParent.h | 4 +- dom/media/MediaManager.cpp | 5 +- dom/mobilemessage/MmsMessage.cpp | 15 +- dom/mobilemessage/MmsMessage.h | 4 +- dom/mobilemessage/ipc/SmsParent.cpp | 8 +- dom/network/UDPSocket.cpp | 4 +- dom/workers/FileReaderSync.cpp | 10 +- dom/workers/FileReaderSync.h | 10 +- dom/workers/URL.cpp | 8 +- dom/workers/URL.h | 4 +- dom/workers/WorkerPrivate.cpp | 19 +- dom/workers/XMLHttpRequest.cpp | 4 +- dom/workers/XMLHttpRequest.h | 4 +- ipc/glue/BackgroundImpl.cpp | 7 +- ipc/glue/BackgroundParent.h | 6 +- ipc/glue/InputStreamUtils.cpp | 4 +- js/xpconnect/src/ExportHelpers.cpp | 12 +- parser/html/nsHtml5StreamParser.cpp | 2 +- widget/nsIFilePicker.idl | 4 +- widget/xpwidgets/nsBaseFilePicker.cpp | 6 +- widget/xpwidgets/nsFilePickerProxy.cpp | 6 +- 126 files changed, 912 insertions(+), 943 deletions(-) rename content/base/public/{nsDOMFile.h => File.h} (76%) rename content/base/src/{nsDOMFile.cpp => File.cpp} (64%) diff --git a/b2g/components/FilePicker.js b/b2g/components/FilePicker.js index 00b36f3477ba..b538cb17c01e 100644 --- a/b2g/components/FilePicker.js +++ b/b2g/components/FilePicker.js @@ -181,7 +181,7 @@ FilePicker.prototype = { } // The name to be shown can be part of the message, or can be taken from - // the DOMFile (if the blob is a DOMFile). + // the File (if the blob is a File). let name = data.result.name; if (!name && (data.result.blob instanceof this.mParent.File) && diff --git a/b2g/components/test/mochitest/test_filepicker_path.html b/b2g/components/test/mochitest/test_filepicker_path.html index 4baa736c5fe4..92c00dc682b9 100644 --- a/b2g/components/test/mochitest/test_filepicker_path.html +++ b/b2g/components/test/mochitest/test_filepicker_path.html @@ -67,7 +67,7 @@ var testCases = [ }, fileName: 'test5.txt'}, // case 6: returns file without name. This case may fail because we - // need to make sure the DOMFile can be sent through + // need to make sure the File can be sent through // sendAsyncMessage API. { pickedResult: { success: true, result: { @@ -96,7 +96,7 @@ function handleMessage(data) { break; case 'file-picked-posted': is(fileInput.value, activeTestCase.fileName, - 'DOMFile should be able to send through message.'); + 'File should be able to send through message.'); processTestCase(); break; } @@ -127,4 +127,4 @@ function processTestCase() { - \ No newline at end of file + diff --git a/content/base/public/nsDOMFile.h b/content/base/public/File.h similarity index 76% rename from content/base/public/nsDOMFile.h rename to content/base/public/File.h index bf4b40c0c7ce..44e991d09b4d 100644 --- a/content/base/public/nsDOMFile.h +++ b/content/base/public/File.h @@ -3,8 +3,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef mozilla_dom_DOMFile_h -#define mozilla_dom_DOMFile_h +#ifndef mozilla_dom_File_h +#define mozilla_dom_File_h #include "mozilla/Attributes.h" @@ -35,17 +35,17 @@ class nsIFile; class nsIInputStream; class nsIClassInfo; -#define PIDOMFILEIMPL_IID \ +#define PIFILEIMPL_IID \ { 0x218ee173, 0xf44f, 0x4d30, \ { 0xab, 0x0c, 0xd6, 0x66, 0xea, 0xc2, 0x84, 0x47 } } -class PIDOMFileImpl : public nsISupports +class PIFileImpl : public nsISupports { public: - NS_DECLARE_STATIC_IID_ACCESSOR(PIDOMFILEIMPL_IID) + NS_DECLARE_STATIC_IID_ACCESSOR(PIFILEIMPL_IID) }; -NS_DEFINE_STATIC_IID_ACCESSOR(PIDOMFileImpl, PIDOMFILEIMPL_IID) +NS_DEFINE_STATIC_IID_ACCESSOR(PIFileImpl, PIFILEIMPL_IID) namespace mozilla { namespace dom { @@ -56,17 +56,16 @@ class FileInfo; struct BlobPropertyBag; struct FilePropertyBag; -class DOMFileImpl; +class FileImpl; /* FOLLOWUP TODO: 1. remove nsDOMBlobBuilder.h -2. rename nsDOMFile.h/cpp to DOMFile.h/cpp */ -class DOMFile MOZ_FINAL : public nsIDOMFile - , public nsIXHRSendable - , public nsIMutable - , public nsSupportsWeakReference - , public nsWrapperCache +class File MOZ_FINAL : public nsIDOMFile + , public nsIXHRSendable + , public nsIMutable + , public nsSupportsWeakReference + , public nsWrapperCache { public: NS_DECL_NSIDOMBLOB @@ -75,68 +74,68 @@ public: NS_DECL_NSIMUTABLE NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(DOMFile, nsIDOMFile) + NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(File, nsIDOMFile) - static already_AddRefed + static already_AddRefed Create(nsISupports* aParent, const nsAString& aName, const nsAString& aContentType, uint64_t aLength, uint64_t aLastModifiedDate); - static already_AddRefed + static already_AddRefed Create(nsISupports* aParent, const nsAString& aName, const nsAString& aContentType, uint64_t aLength); - static already_AddRefed + static already_AddRefed Create(nsISupports* aParent, const nsAString& aContentType, uint64_t aLength); - static already_AddRefed + static already_AddRefed Create(nsISupports* aParent, const nsAString& aContentType, uint64_t aStart, uint64_t aLength); - static already_AddRefed + static already_AddRefed CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, uint64_t aLength, const nsAString& aName, const nsAString& aContentType, uint64_t aLastModifiedDate); - static already_AddRefed + static already_AddRefed CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, uint64_t aLength, const nsAString& aContentType); - static already_AddRefed + static already_AddRefed CreateTemporaryFileBlob(nsISupports* aParent, PRFileDesc* aFD, uint64_t aStartPos, uint64_t aLength, const nsAString& aContentType); - static already_AddRefed + static already_AddRefed CreateFromFile(nsISupports* aParent, nsIFile* aFile); - static already_AddRefed + static already_AddRefed CreateFromFile(nsISupports* aParent, const nsAString& aContentType, uint64_t aLength, nsIFile* aFile, indexedDB::FileInfo* aFileInfo); - static already_AddRefed + static already_AddRefed CreateFromFile(nsISupports* aParent, const nsAString& aName, const nsAString& aContentType, uint64_t aLength, nsIFile* aFile, indexedDB::FileInfo* aFileInfo); - static already_AddRefed + static already_AddRefed CreateFromFile(nsISupports* aParent, nsIFile* aFile, indexedDB::FileInfo* aFileInfo); - static already_AddRefed + static already_AddRefed CreateFromFile(nsISupports* aParent, nsIFile* aFile, const nsAString& aName, const nsAString& aContentType); - DOMFile(nsISupports* aParent, DOMFileImpl* aImpl); + File(nsISupports* aParent, FileImpl* aImpl); - DOMFileImpl* Impl() const + FileImpl* Impl() const { return mImpl; } - const nsTArray>* GetSubBlobImpls() const; + const nsTArray>* GetSubBlobImpls() const; bool IsSizeUnknown() const; @@ -147,7 +146,7 @@ public: void SetLazyData(const nsAString& aName, const nsAString& aContentType, uint64_t aLength, uint64_t aLastModifiedDate); - already_AddRefed + already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv); @@ -158,18 +157,18 @@ public: } // Blob constructor - static already_AddRefed + static already_AddRefed Constructor(const GlobalObject& aGlobal, ErrorResult& aRv); // Blob constructor - static already_AddRefed + static already_AddRefed Constructor(const GlobalObject& aGlobal, const Sequence& aData, const BlobPropertyBag& aBag, ErrorResult& aRv); // File constructor - static already_AddRefed + static already_AddRefed Constructor(const GlobalObject& aGlobal, const Sequence& aData, const nsAString& aName, @@ -177,21 +176,21 @@ public: ErrorResult& aRv); // File constructor - ChromeOnly - static already_AddRefed + static already_AddRefed Constructor(const GlobalObject& aGlobal, - DOMFile& aData, + File& aData, const FilePropertyBag& aBag, ErrorResult& aRv); // File constructor - ChromeOnly - static already_AddRefed + static already_AddRefed Constructor(const GlobalObject& aGlobal, const nsAString& aData, const FilePropertyBag& aBag, ErrorResult& aRv); // File constructor - ChromeOnly - static already_AddRefed + static already_AddRefed Constructor(const GlobalObject& aGlobal, nsIFile* aData, const FilePropertyBag& aBag, @@ -211,31 +210,31 @@ public: void GetMozFullPath(nsAString& aFilename, ErrorResult& aRv); - already_AddRefed Slice(const Optional& aStart, - const Optional& aEnd, - const nsAString& aContentType, - ErrorResult& aRv); + already_AddRefed Slice(const Optional& aStart, + const Optional& aEnd, + const nsAString& aContentType, + ErrorResult& aRv); private: - ~DOMFile() {}; + ~File() {}; - // The member is the real backend implementation of this DOMFile/DOMBlob. + // The member is the real backend implementation of this File/Blob. // It's thread-safe and not CC-able and it's the only element that is moved // between threads. // Note: we should not store any other state in this class! - const nsRefPtr mImpl; + const nsRefPtr mImpl; nsCOMPtr mParent; }; -// This is the abstract class for any DOMFile backend. It must be nsISupports +// This is the abstract class for any File backend. It must be nsISupports // because this class must be ref-counted and it has to work with IPC. -class DOMFileImpl : public PIDOMFileImpl +class FileImpl : public PIFileImpl { public: NS_DECL_THREADSAFE_ISUPPORTS - DOMFileImpl() {} + FileImpl() {} virtual void GetName(nsAString& aName) = 0; @@ -251,15 +250,15 @@ public: virtual void GetType(nsAString& aType) = 0; - already_AddRefed + already_AddRefed Slice(const Optional& aStart, const Optional& aEnd, const nsAString& aContentType, ErrorResult& aRv); - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) = 0; - virtual const nsTArray>* + virtual const nsTArray>* GetSubBlobImpls() const = 0; virtual nsresult GetInternalStream(nsIInputStream** aStream) = 0; @@ -303,14 +302,14 @@ public: } protected: - virtual ~DOMFileImpl() {} + virtual ~FileImpl() {} }; -class DOMFileImplBase : public DOMFileImpl +class FileImplBase : public FileImpl { public: - DOMFileImplBase(const nsAString& aName, const nsAString& aContentType, - uint64_t aLength, uint64_t aLastModifiedDate) + FileImplBase(const nsAString& aName, const nsAString& aContentType, + uint64_t aLength, uint64_t aLastModifiedDate) : mIsFile(true) , mImmutable(false) , mContentType(aContentType) @@ -323,8 +322,8 @@ public: mContentType.SetIsVoid(false); } - DOMFileImplBase(const nsAString& aName, const nsAString& aContentType, - uint64_t aLength) + FileImplBase(const nsAString& aName, const nsAString& aContentType, + uint64_t aLength) : mIsFile(true) , mImmutable(false) , mContentType(aContentType) @@ -337,7 +336,7 @@ public: mContentType.SetIsVoid(false); } - DOMFileImplBase(const nsAString& aContentType, uint64_t aLength) + FileImplBase(const nsAString& aContentType, uint64_t aLength) : mIsFile(false) , mImmutable(false) , mContentType(aContentType) @@ -349,8 +348,8 @@ public: mContentType.SetIsVoid(false); } - DOMFileImplBase(const nsAString& aContentType, uint64_t aStart, - uint64_t aLength) + FileImplBase(const nsAString& aContentType, uint64_t aStart, + uint64_t aLength) : mIsFile(false) , mImmutable(false) , mContentType(aContentType) @@ -382,14 +381,14 @@ public: virtual void GetType(nsAString& aType) MOZ_OVERRIDE; - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE { return nullptr; } - virtual const nsTArray>* + virtual const nsTArray>* GetSubBlobImpls() const MOZ_OVERRIDE { return nullptr; @@ -469,7 +468,7 @@ public: virtual void Traverse(nsCycleCollectionTraversalCallback &aCb) {} protected: - virtual ~DOMFileImplBase() {} + virtual ~FileImplBase() {} indexedDB::FileInfo* GetFileInfo() const { @@ -499,25 +498,22 @@ protected: * This class may be used off the main thread, and in particular, its * constructor and destructor may not run on the same thread. Be careful! */ -class DOMFileImplMemory MOZ_FINAL : public DOMFileImplBase +class FileImplMemory MOZ_FINAL : public FileImplBase { public: NS_DECL_ISUPPORTS_INHERITED - DOMFileImplMemory(void* aMemoryBuffer, uint64_t aLength, - const nsAString& aName, - const nsAString& aContentType, - uint64_t aLastModifiedDate) - : DOMFileImplBase(aName, aContentType, aLength, aLastModifiedDate) + FileImplMemory(void* aMemoryBuffer, uint64_t aLength, const nsAString& aName, + const nsAString& aContentType, uint64_t aLastModifiedDate) + : FileImplBase(aName, aContentType, aLength, aLastModifiedDate) , mDataOwner(new DataOwner(aMemoryBuffer, aLength)) { NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data"); } - DOMFileImplMemory(void* aMemoryBuffer, - uint64_t aLength, - const nsAString& aContentType) - : DOMFileImplBase(aContentType, aLength) + FileImplMemory(void* aMemoryBuffer, uint64_t aLength, + const nsAString& aContentType) + : FileImplBase(aContentType, aLength) , mDataOwner(new DataOwner(aMemoryBuffer, aLength)) { NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data"); @@ -525,7 +521,7 @@ public: virtual nsresult GetInternalStream(nsIInputStream** aStream) MOZ_OVERRIDE; - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE; @@ -580,29 +576,29 @@ public: private: // Create slice - DOMFileImplMemory(const DOMFileImplMemory* aOther, uint64_t aStart, - uint64_t aLength, const nsAString& aContentType) - : DOMFileImplBase(aContentType, aOther->mStart + aStart, aLength) + FileImplMemory(const FileImplMemory* aOther, uint64_t aStart, + uint64_t aLength, const nsAString& aContentType) + : FileImplBase(aContentType, aOther->mStart + aStart, aLength) , mDataOwner(aOther->mDataOwner) { NS_ASSERTION(mDataOwner && mDataOwner->mData, "must have data"); mImmutable = aOther->mImmutable; } - ~DOMFileImplMemory() {} + ~FileImplMemory() {} // Used when backed by a memory store nsRefPtr mDataOwner; }; -class DOMFileImplTemporaryFileBlob MOZ_FINAL : public DOMFileImplBase +class FileImplTemporaryFileBlob MOZ_FINAL : public FileImplBase { public: NS_DECL_ISUPPORTS_INHERITED - DOMFileImplTemporaryFileBlob(PRFileDesc* aFD, uint64_t aStartPos, - uint64_t aLength, const nsAString& aContentType) - : DOMFileImplBase(aContentType, aLength) + FileImplTemporaryFileBlob(PRFileDesc* aFD, uint64_t aStartPos, + uint64_t aLength, const nsAString& aContentType) + : FileImplBase(aContentType, aLength) , mLength(aLength) , mStartPos(aStartPos) , mContentType(aContentType) @@ -612,21 +608,21 @@ public: virtual nsresult GetInternalStream(nsIInputStream** aStream) MOZ_OVERRIDE; - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE; private: - DOMFileImplTemporaryFileBlob(const DOMFileImplTemporaryFileBlob* aOther, - uint64_t aStart, uint64_t aLength, - const nsAString& aContentType) - : DOMFileImplBase(aContentType, aLength) + FileImplTemporaryFileBlob(const FileImplTemporaryFileBlob* aOther, + uint64_t aStart, uint64_t aLength, + const nsAString& aContentType) + : FileImplBase(aContentType, aLength) , mLength(aLength) , mStartPos(aStart) , mFileDescOwner(aOther->mFileDescOwner) , mContentType(aContentType) {} - ~DOMFileImplTemporaryFileBlob() {} + ~FileImplTemporaryFileBlob() {} uint64_t mLength; uint64_t mStartPos; @@ -634,14 +630,14 @@ private: nsString mContentType; }; -class DOMFileImplFile : public DOMFileImplBase +class FileImplFile : public FileImplBase { public: NS_DECL_ISUPPORTS_INHERITED // Create as a file - explicit DOMFileImplFile(nsIFile* aFile) - : DOMFileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX) + explicit FileImplFile(nsIFile* aFile) + : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX) , mFile(aFile) , mWholeFile(true) , mStoredFile(false) @@ -652,8 +648,8 @@ public: mFile->GetLeafName(mName); } - DOMFileImplFile(nsIFile* aFile, indexedDB::FileInfo* aFileInfo) - : DOMFileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX) + FileImplFile(nsIFile* aFile, indexedDB::FileInfo* aFileInfo) + : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX) , mFile(aFile) , mWholeFile(true) , mStoredFile(true) @@ -668,9 +664,9 @@ public: } // Create as a file - DOMFileImplFile(const nsAString& aName, const nsAString& aContentType, - uint64_t aLength, nsIFile* aFile) - : DOMFileImplBase(aName, aContentType, aLength, UINT64_MAX) + FileImplFile(const nsAString& aName, const nsAString& aContentType, + uint64_t aLength, nsIFile* aFile) + : FileImplBase(aName, aContentType, aLength, UINT64_MAX) , mFile(aFile) , mWholeFile(true) , mStoredFile(false) @@ -678,10 +674,10 @@ public: NS_ASSERTION(mFile, "must have file"); } - DOMFileImplFile(const nsAString& aName, const nsAString& aContentType, - uint64_t aLength, nsIFile* aFile, - uint64_t aLastModificationDate) - : DOMFileImplBase(aName, aContentType, aLength, aLastModificationDate) + FileImplFile(const nsAString& aName, const nsAString& aContentType, + uint64_t aLength, nsIFile* aFile, + uint64_t aLastModificationDate) + : FileImplBase(aName, aContentType, aLength, aLastModificationDate) , mFile(aFile) , mWholeFile(true) , mStoredFile(false) @@ -690,9 +686,9 @@ public: } // Create as a file with custom name - DOMFileImplFile(nsIFile* aFile, const nsAString& aName, - const nsAString& aContentType) - : DOMFileImplBase(aName, aContentType, UINT64_MAX, UINT64_MAX) + FileImplFile(nsIFile* aFile, const nsAString& aName, + const nsAString& aContentType) + : FileImplBase(aName, aContentType, UINT64_MAX, UINT64_MAX) , mFile(aFile) , mWholeFile(true) , mStoredFile(false) @@ -705,10 +701,10 @@ public: } // Create as a stored file - DOMFileImplFile(const nsAString& aName, const nsAString& aContentType, - uint64_t aLength, nsIFile* aFile, - indexedDB::FileInfo* aFileInfo) - : DOMFileImplBase(aName, aContentType, aLength, UINT64_MAX) + FileImplFile(const nsAString& aName, const nsAString& aContentType, + uint64_t aLength, nsIFile* aFile, + indexedDB::FileInfo* aFileInfo) + : FileImplBase(aName, aContentType, aLength, UINT64_MAX) , mFile(aFile) , mWholeFile(true) , mStoredFile(true) @@ -718,9 +714,9 @@ public: } // Create as a stored blob - DOMFileImplFile(const nsAString& aContentType, uint64_t aLength, - nsIFile* aFile, indexedDB::FileInfo* aFileInfo) - : DOMFileImplBase(aContentType, aLength) + FileImplFile(const nsAString& aContentType, uint64_t aLength, + nsIFile* aFile, indexedDB::FileInfo* aFileInfo) + : FileImplBase(aContentType, aLength) , mFile(aFile) , mWholeFile(true) , mStoredFile(true) @@ -730,8 +726,8 @@ public: } // Create as a file to be later initialized - DOMFileImplFile() - : DOMFileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX) + FileImplFile() + : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX) , mWholeFile(true) , mStoredFile(false) { @@ -751,13 +747,13 @@ public: void SetPath(const nsAString& aFullPath); protected: - virtual ~DOMFileImplFile() {} + virtual ~FileImplFile() {} private: // Create slice - DOMFileImplFile(const DOMFileImplFile* aOther, uint64_t aStart, - uint64_t aLength, const nsAString& aContentType) - : DOMFileImplBase(aContentType, aOther->mStart + aStart, aLength) + FileImplFile(const FileImplFile* aOther, uint64_t aStart, + uint64_t aLength, const nsAString& aContentType) + : FileImplBase(aContentType, aOther->mStart + aStart, aLength) , mFile(aOther->mFile) , mWholeFile(false) , mStoredFile(aOther->mStoredFile) @@ -782,7 +778,7 @@ private: } } - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE; @@ -828,7 +824,7 @@ public: mParent = nullptr; } - bool Append(DOMFile *aFile) { return mFiles.AppendElement(aFile); } + bool Append(File *aFile) { return mFiles.AppendElement(aFile); } bool Remove(uint32_t aIndex) { if (aIndex < mFiles.Length()) { @@ -858,11 +854,11 @@ public: return static_cast(aSupports); } - DOMFile* Item(uint32_t aIndex) + File* Item(uint32_t aIndex) { return mFiles.SafeElementAt(aIndex); } - DOMFile* IndexedGetter(uint32_t aIndex, bool& aFound) + File* IndexedGetter(uint32_t aIndex, bool& aFound) { aFound = aIndex < mFiles.Length(); return aFound ? mFiles.ElementAt(aIndex) : nullptr; @@ -873,11 +869,11 @@ public: } private: - nsTArray> mFiles; + nsTArray> mFiles; nsISupports *mParent; }; } // dom namespace } // file namespace -#endif // mozilla_dom_DOMFile_h +#endif // mozilla_dom_File_h diff --git a/content/base/public/moz.build b/content/base/public/moz.build index b80c2ab0fece..49a74d15b0a7 100644 --- a/content/base/public/moz.build +++ b/content/base/public/moz.build @@ -43,7 +43,6 @@ EXPORTS += [ 'nsCopySupport.h', 'nsDeprecatedOperationList.h', 'nsDocElementCreatedNotificationRunner.h', - 'nsDOMFile.h', 'nsHostObjectProtocolHandler.h', 'nsIAttribute.h', 'nsIContent.h', @@ -70,6 +69,7 @@ EXPORTS.mozilla.dom += [ 'DirectionalityUtils.h', 'Element.h', 'ElementInlines.h', + 'File.h', 'FragmentOrElement.h', 'FromParser.h', ] diff --git a/content/base/src/nsDOMFile.cpp b/content/base/src/File.cpp similarity index 64% rename from content/base/src/nsDOMFile.cpp rename to content/base/src/File.cpp index 5a5b51df75f8..c6372b1ed974 100644 --- a/content/base/src/nsDOMFile.cpp +++ b/content/base/src/File.cpp @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "nsCExternalHandlerService.h" #include "nsContentCID.h" @@ -45,8 +45,8 @@ namespace mozilla { namespace dom { -// XXXkhuey the input stream that we pass out of a DOMFile -// can outlive the actual DOMFile object. Thus, we must +// XXXkhuey the input stream that we pass out of a File +// can outlive the actual File object. Thus, we must // ensure that the buffer underlying the stream we get // from NS_NewByteInputStream is held alive as long as the // stream is. We do that by passing back this class instead. @@ -54,7 +54,7 @@ class DataOwnerAdapter MOZ_FINAL : public nsIInputStream, public nsISeekableStream, public nsIIPCSerializableInputStream { - typedef DOMFileImplMemory::DataOwner DataOwner; + typedef FileImplMemory::DataOwner DataOwner; public: static nsresult Create(DataOwner* aDataOwner, uint32_t aStart, @@ -123,29 +123,29 @@ nsresult DataOwnerAdapter::Create(DataOwner* aDataOwner, } //////////////////////////////////////////////////////////////////////////// -// mozilla::dom::DOMFile implementation +// mozilla::dom::File implementation -NS_IMPL_CYCLE_COLLECTION_CLASS(DOMFile) +NS_IMPL_CYCLE_COLLECTION_CLASS(File) -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMFile) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(File) MOZ_ASSERT(tmp->mImpl); tmp->mImpl->Unlink(); NS_IMPL_CYCLE_COLLECTION_UNLINK(mParent) NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_UNLINK_END -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMFile) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(File) MOZ_ASSERT(tmp->mImpl); tmp->mImpl->Traverse(cb); NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParent) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMFile) +NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(File) NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_TRACE_END -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMFile) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(File) // This class should not receive any nsIRemoteBlob QI! MOZ_ASSERT(!aIID.Equals(NS_GET_IID(nsIRemoteBlob))); @@ -158,124 +158,124 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMFile) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_END -NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMFile) -NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMFile) +NS_IMPL_CYCLE_COLLECTING_ADDREF(File) +NS_IMPL_CYCLE_COLLECTING_RELEASE(File) -/* static */ already_AddRefed -DOMFile::Create(nsISupports* aParent, const nsAString& aName, - const nsAString& aContentType, uint64_t aLength, - uint64_t aLastModifiedDate) +/* static */ already_AddRefed +File::Create(nsISupports* aParent, const nsAString& aName, + const nsAString& aContentType, uint64_t aLength, + uint64_t aLastModifiedDate) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplBase(aName, aContentType, aLength, aLastModifiedDate)); + nsRefPtr file = new File(aParent, + new FileImplBase(aName, aContentType, aLength, aLastModifiedDate)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::Create(nsISupports* aParent, const nsAString& aName, - const nsAString& aContentType, uint64_t aLength) +/* static */ already_AddRefed +File::Create(nsISupports* aParent, const nsAString& aName, + const nsAString& aContentType, uint64_t aLength) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplBase(aName, aContentType, aLength)); + nsRefPtr file = new File(aParent, + new FileImplBase(aName, aContentType, aLength)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::Create(nsISupports* aParent, const nsAString& aContentType, - uint64_t aLength) +/* static */ already_AddRefed +File::Create(nsISupports* aParent, const nsAString& aContentType, + uint64_t aLength) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplBase(aContentType, aLength)); + nsRefPtr file = new File(aParent, + new FileImplBase(aContentType, aLength)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::Create(nsISupports* aParent, const nsAString& aContentType, +/* static */ already_AddRefed +File::Create(nsISupports* aParent, const nsAString& aContentType, uint64_t aStart, uint64_t aLength) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplBase(aContentType, aStart, aLength)); + nsRefPtr file = new File(aParent, + new FileImplBase(aContentType, aStart, aLength)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, - uint64_t aLength, const nsAString& aName, - const nsAString& aContentType, - uint64_t aLastModifiedDate) +/* static */ already_AddRefed +File::CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, + uint64_t aLength, const nsAString& aName, + const nsAString& aContentType, + uint64_t aLastModifiedDate) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplMemory(aMemoryBuffer, aLength, aName, - aContentType, aLastModifiedDate)); + nsRefPtr file = new File(aParent, + new FileImplMemory(aMemoryBuffer, aLength, aName, + aContentType, aLastModifiedDate)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, - uint64_t aLength, const nsAString& aContentType) +/* static */ already_AddRefed +File::CreateMemoryFile(nsISupports* aParent, void* aMemoryBuffer, + uint64_t aLength, const nsAString& aContentType) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplMemory(aMemoryBuffer, aLength, aContentType)); + nsRefPtr file = new File(aParent, + new FileImplMemory(aMemoryBuffer, aLength, aContentType)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::CreateTemporaryFileBlob(nsISupports* aParent, PRFileDesc* aFD, - uint64_t aStartPos, uint64_t aLength, - const nsAString& aContentType) +/* static */ already_AddRefed +File::CreateTemporaryFileBlob(nsISupports* aParent, PRFileDesc* aFD, + uint64_t aStartPos, uint64_t aLength, + const nsAString& aContentType) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplTemporaryFileBlob(aFD, aStartPos, aLength, aContentType)); + nsRefPtr file = new File(aParent, + new FileImplTemporaryFileBlob(aFD, aStartPos, aLength, aContentType)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::CreateFromFile(nsISupports* aParent, nsIFile* aFile) +/* static */ already_AddRefed +File::CreateFromFile(nsISupports* aParent, nsIFile* aFile) { - nsRefPtr file = new DOMFile(aParent, new DOMFileImplFile(aFile)); + nsRefPtr file = new File(aParent, new FileImplFile(aFile)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::CreateFromFile(nsISupports* aParent, const nsAString& aContentType, - uint64_t aLength, nsIFile* aFile, - indexedDB::FileInfo* aFileInfo) +/* static */ already_AddRefed +File::CreateFromFile(nsISupports* aParent, const nsAString& aContentType, + uint64_t aLength, nsIFile* aFile, + indexedDB::FileInfo* aFileInfo) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplFile(aContentType, aLength, aFile, aFileInfo)); + nsRefPtr file = new File(aParent, + new FileImplFile(aContentType, aLength, aFile, aFileInfo)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::CreateFromFile(nsISupports* aParent, const nsAString& aName, - const nsAString& aContentType, - uint64_t aLength, nsIFile* aFile, - indexedDB::FileInfo* aFileInfo) +/* static */ already_AddRefed +File::CreateFromFile(nsISupports* aParent, const nsAString& aName, + const nsAString& aContentType, + uint64_t aLength, nsIFile* aFile, + indexedDB::FileInfo* aFileInfo) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplFile(aName, aContentType, aLength, aFile, aFileInfo)); + nsRefPtr file = new File(aParent, + new FileImplFile(aName, aContentType, aLength, aFile, aFileInfo)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::CreateFromFile(nsISupports* aParent, nsIFile* aFile, - indexedDB::FileInfo* aFileInfo) +/* static */ already_AddRefed +File::CreateFromFile(nsISupports* aParent, nsIFile* aFile, + indexedDB::FileInfo* aFileInfo) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplFile(aFile, aFileInfo)); + nsRefPtr file = new File(aParent, + new FileImplFile(aFile, aFileInfo)); return file.forget(); } -/* static */ already_AddRefed -DOMFile::CreateFromFile(nsISupports* aParent, nsIFile* aFile, - const nsAString& aName, const nsAString& aContentType) +/* static */ already_AddRefed +File::CreateFromFile(nsISupports* aParent, nsIFile* aFile, + const nsAString& aName, const nsAString& aContentType) { - nsRefPtr file = new DOMFile(aParent, - new DOMFileImplFile(aFile, aName, aContentType)); + nsRefPtr file = new File(aParent, + new FileImplFile(aFile, aName, aContentType)); return file.forget(); } -DOMFile::DOMFile(nsISupports* aParent, DOMFileImpl* aImpl) +File::File(nsISupports* aParent, FileImpl* aImpl) : mImpl(aImpl) , mParent(aParent) { @@ -291,67 +291,67 @@ DOMFile::DOMFile(nsISupports* aParent, DOMFileImpl* aImpl) #endif } -const nsTArray>* -DOMFile::GetSubBlobImpls() const +const nsTArray>* +File::GetSubBlobImpls() const { return mImpl->GetSubBlobImpls(); } bool -DOMFile::IsSizeUnknown() const +File::IsSizeUnknown() const { return mImpl->IsSizeUnknown(); } bool -DOMFile::IsDateUnknown() const +File::IsDateUnknown() const { return mImpl->IsDateUnknown(); } bool -DOMFile::IsFile() const +File::IsFile() const { return mImpl->IsFile(); } void -DOMFile::SetLazyData(const nsAString& aName, const nsAString& aContentType, +File::SetLazyData(const nsAString& aName, const nsAString& aContentType, uint64_t aLength, uint64_t aLastModifiedDate) { return mImpl->SetLazyData(aName, aContentType, aLength, aLastModifiedDate); } -already_AddRefed -DOMFile::CreateSlice(uint64_t aStart, uint64_t aLength, - const nsAString& aContentType, - ErrorResult& aRv) +already_AddRefed +File::CreateSlice(uint64_t aStart, uint64_t aLength, + const nsAString& aContentType, + ErrorResult& aRv) { - nsRefPtr impl = mImpl->CreateSlice(aStart, aLength, - aContentType, aRv); + nsRefPtr impl = mImpl->CreateSlice(aStart, aLength, + aContentType, aRv); if (aRv.Failed()) { return nullptr; } - nsRefPtr file = new DOMFile(mParent, impl); + nsRefPtr file = new File(mParent, impl); return file.forget(); } NS_IMETHODIMP -DOMFile::GetName(nsAString& aFileName) +File::GetName(nsAString& aFileName) { mImpl->GetName(aFileName); return NS_OK; } NS_IMETHODIMP -DOMFile::GetPath(nsAString& aPath) +File::GetPath(nsAString& aPath) { return mImpl->GetPath(aPath); } NS_IMETHODIMP -DOMFile::GetLastModifiedDate(JSContext* aCx, +File::GetLastModifiedDate(JSContext* aCx, JS::MutableHandle aDate) { ErrorResult rv; @@ -368,7 +368,7 @@ DOMFile::GetLastModifiedDate(JSContext* aCx, } Date -DOMFile::GetLastModifiedDate(ErrorResult& aRv) +File::GetLastModifiedDate(ErrorResult& aRv) { int64_t value = GetLastModified(aRv); if (aRv.Failed()) { @@ -379,13 +379,13 @@ DOMFile::GetLastModifiedDate(ErrorResult& aRv) } int64_t -DOMFile::GetLastModified(ErrorResult& aRv) +File::GetLastModified(ErrorResult& aRv) { return mImpl->GetLastModified(aRv); } NS_IMETHODIMP -DOMFile::GetMozFullPath(nsAString& aFileName) +File::GetMozFullPath(nsAString& aFileName) { ErrorResult rv; GetMozFullPath(aFileName, rv); @@ -393,13 +393,13 @@ DOMFile::GetMozFullPath(nsAString& aFileName) } void -DOMFile::GetMozFullPath(nsAString& aFilename, ErrorResult& aRv) +File::GetMozFullPath(nsAString& aFilename, ErrorResult& aRv) { mImpl->GetMozFullPath(aFilename, aRv); } NS_IMETHODIMP -DOMFile::GetMozFullPathInternal(nsAString& aFileName) +File::GetMozFullPathInternal(nsAString& aFileName) { ErrorResult rv; mImpl->GetMozFullPathInternal(aFileName, rv); @@ -407,7 +407,7 @@ DOMFile::GetMozFullPathInternal(nsAString& aFileName) } NS_IMETHODIMP -DOMFile::GetSize(uint64_t* aSize) +File::GetSize(uint64_t* aSize) { MOZ_ASSERT(aSize); @@ -417,20 +417,20 @@ DOMFile::GetSize(uint64_t* aSize) } uint64_t -DOMFile::GetSize(ErrorResult& aRv) +File::GetSize(ErrorResult& aRv) { return mImpl->GetSize(aRv); } NS_IMETHODIMP -DOMFile::GetType(nsAString &aType) +File::GetType(nsAString &aType) { mImpl->GetType(aType); return NS_OK; } NS_IMETHODIMP -DOMFile::GetMozLastModifiedDate(uint64_t* aDate) +File::GetMozLastModifiedDate(uint64_t* aDate) { MOZ_ASSERT(aDate); @@ -477,9 +477,9 @@ ParseSize(int64_t aSize, int64_t& aStart, int64_t& aEnd) } NS_IMETHODIMP -DOMFile::Slice(int64_t aStart, int64_t aEnd, - const nsAString& aContentType, uint8_t aArgc, - nsIDOMBlob **aBlob) +File::Slice(int64_t aStart, int64_t aEnd, + const nsAString& aContentType, uint8_t aArgc, + nsIDOMBlob **aBlob) { Optional start; if (aArgc > 0) { @@ -492,7 +492,7 @@ DOMFile::Slice(int64_t aStart, int64_t aEnd, } ErrorResult rv; - nsRefPtr file = Slice(start, end, aContentType, rv); + nsRefPtr file = Slice(start, end, aContentType, rv); if (rv.Failed()) { return rv.ErrorCode(); } @@ -501,100 +501,100 @@ DOMFile::Slice(int64_t aStart, int64_t aEnd, return NS_OK; } -already_AddRefed -DOMFile::Slice(const Optional& aStart, - const Optional& aEnd, - const nsAString& aContentType, - ErrorResult& aRv) +already_AddRefed +File::Slice(const Optional& aStart, + const Optional& aEnd, + const nsAString& aContentType, + ErrorResult& aRv) { - nsRefPtr impl = + nsRefPtr impl = mImpl->Slice(aStart, aEnd, aContentType, aRv); if (aRv.Failed()) { return nullptr; } - nsRefPtr file = new DOMFile(mParent, impl); + nsRefPtr file = new File(mParent, impl); return file.forget(); } NS_IMETHODIMP -DOMFile::GetInternalStream(nsIInputStream** aStream) +File::GetInternalStream(nsIInputStream** aStream) { - return mImpl->GetInternalStream(aStream); + return mImpl->GetInternalStream(aStream); } NS_IMETHODIMP_(int64_t) -DOMFile::GetFileId() +File::GetFileId() { return mImpl->GetFileId(); } NS_IMETHODIMP_(void) -DOMFile::AddFileInfo(indexedDB::FileInfo* aFileInfo) +File::AddFileInfo(indexedDB::FileInfo* aFileInfo) { mImpl->AddFileInfo(aFileInfo); } indexedDB::FileInfo* -DOMFile::GetFileInfo(indexedDB::FileManager* aFileManager) +File::GetFileInfo(indexedDB::FileManager* aFileManager) { return mImpl->GetFileInfo(aFileManager); } NS_IMETHODIMP -DOMFile::GetSendInfo(nsIInputStream** aBody, - uint64_t* aContentLength, - nsACString& aContentType, - nsACString& aCharset) +File::GetSendInfo(nsIInputStream** aBody, + uint64_t* aContentLength, + nsACString& aContentType, + nsACString& aCharset) { return mImpl->GetSendInfo(aBody, aContentLength, aContentType, aCharset); } NS_IMETHODIMP -DOMFile::GetMutable(bool* aMutable) +File::GetMutable(bool* aMutable) { return mImpl->GetMutable(aMutable); } NS_IMETHODIMP -DOMFile::SetMutable(bool aMutable) +File::SetMutable(bool aMutable) { return mImpl->SetMutable(aMutable); } NS_IMETHODIMP_(bool) -DOMFile::IsMemoryFile() +File::IsMemoryFile() { return mImpl->IsMemoryFile(); } JSObject* -DOMFile::WrapObject(JSContext* aCx) +File::WrapObject(JSContext* aCx) { return IsFile() ? FileBinding::Wrap(aCx, this) : BlobBinding::Wrap(aCx, this); } -/* static */ already_AddRefed -DOMFile::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) +/* static */ already_AddRefed +File::Constructor(const GlobalObject& aGlobal, ErrorResult& aRv) { - nsRefPtr impl = new DOMMultipartFileImpl(); + nsRefPtr impl = new MultipartFileImpl(); impl->InitializeBlob(); MOZ_ASSERT(!impl->IsFile()); - nsRefPtr file = new DOMFile(aGlobal.GetAsSupports(), impl); + nsRefPtr file = new File(aGlobal.GetAsSupports(), impl); return file.forget(); } -/* static */ already_AddRefed -DOMFile::Constructor( +/* static */ already_AddRefed +File::Constructor( const GlobalObject& aGlobal, const Sequence& aData, const BlobPropertyBag& aBag, ErrorResult& aRv) { - nsRefPtr impl = new DOMMultipartFileImpl(); + nsRefPtr impl = new MultipartFileImpl(); impl->InitializeBlob(aGlobal.Context(), aData, aBag.mType, aBag.mEndings == EndingTypes::Native, aRv); @@ -603,19 +603,19 @@ DOMFile::Constructor( } MOZ_ASSERT(!impl->IsFile()); - nsRefPtr file = new DOMFile(aGlobal.GetAsSupports(), impl); + nsRefPtr file = new File(aGlobal.GetAsSupports(), impl); return file.forget(); } -/* static */ already_AddRefed -DOMFile::Constructor( +/* static */ already_AddRefed +File::Constructor( const GlobalObject& aGlobal, const Sequence& aData, const nsAString& aName, const FilePropertyBag& aBag, ErrorResult& aRv) { - nsRefPtr impl = new DOMMultipartFileImpl(aName); + nsRefPtr impl = new MultipartFileImpl(aName); impl->InitializeBlob(aGlobal.Context(), aData, aBag.mType, false, aRv); if (aRv.Failed()) { @@ -623,37 +623,37 @@ DOMFile::Constructor( } MOZ_ASSERT(impl->IsFile()); - nsRefPtr file = new DOMFile(aGlobal.GetAsSupports(), impl); + nsRefPtr file = new File(aGlobal.GetAsSupports(), impl); return file.forget(); } -/* static */ already_AddRefed -DOMFile::Constructor(const GlobalObject& aGlobal, - DOMFile& aData, - const FilePropertyBag& aBag, - ErrorResult& aRv) +/* static */ already_AddRefed +File::Constructor(const GlobalObject& aGlobal, + File& aData, + const FilePropertyBag& aBag, + ErrorResult& aRv) { if (!nsContentUtils::IsCallerChrome()) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } - nsRefPtr impl = new DOMMultipartFileImpl(EmptyString()); + nsRefPtr impl = new MultipartFileImpl(EmptyString()); impl->InitializeChromeFile(aData, aBag, aRv); if (aRv.Failed()) { return nullptr; } MOZ_ASSERT(impl->IsFile()); - nsRefPtr domFile = new DOMFile(aGlobal.GetAsSupports(), impl); + nsRefPtr domFile = new File(aGlobal.GetAsSupports(), impl); return domFile.forget(); } -/* static */ already_AddRefed -DOMFile::Constructor(const GlobalObject& aGlobal, - nsIFile* aData, - const FilePropertyBag& aBag, - ErrorResult& aRv) +/* static */ already_AddRefed +File::Constructor(const GlobalObject& aGlobal, + nsIFile* aData, + const FilePropertyBag& aBag, + ErrorResult& aRv) { if (!nsContentUtils::IsCallerChrome()) { aRv.Throw(NS_ERROR_FAILURE); @@ -662,22 +662,22 @@ DOMFile::Constructor(const GlobalObject& aGlobal, nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); - nsRefPtr impl = new DOMMultipartFileImpl(EmptyString()); + nsRefPtr impl = new MultipartFileImpl(EmptyString()); impl->InitializeChromeFile(window, aData, aBag, true, aRv); if (aRv.Failed()) { return nullptr; } MOZ_ASSERT(impl->IsFile()); - nsRefPtr domFile = new DOMFile(aGlobal.GetAsSupports(), impl); + nsRefPtr domFile = new File(aGlobal.GetAsSupports(), impl); return domFile.forget(); } -/* static */ already_AddRefed -DOMFile::Constructor(const GlobalObject& aGlobal, - const nsAString& aData, - const FilePropertyBag& aBag, - ErrorResult& aRv) +/* static */ already_AddRefed +File::Constructor(const GlobalObject& aGlobal, + const nsAString& aData, + const FilePropertyBag& aBag, + ErrorResult& aRv) { if (!nsContentUtils::IsCallerChrome()) { aRv.Throw(NS_ERROR_FAILURE); @@ -686,25 +686,25 @@ DOMFile::Constructor(const GlobalObject& aGlobal, nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); - nsRefPtr impl = new DOMMultipartFileImpl(EmptyString()); + nsRefPtr impl = new MultipartFileImpl(EmptyString()); impl->InitializeChromeFile(window, aData, aBag, aRv); if (aRv.Failed()) { return nullptr; } MOZ_ASSERT(impl->IsFile()); - nsRefPtr domFile = new DOMFile(aGlobal.GetAsSupports(), impl); + nsRefPtr domFile = new File(aGlobal.GetAsSupports(), impl); return domFile.forget(); } //////////////////////////////////////////////////////////////////////////// -// mozilla::dom::DOMFileImpl implementation +// mozilla::dom::FileImpl implementation -already_AddRefed -DOMFileImpl::Slice(const Optional& aStart, - const Optional& aEnd, - const nsAString& aContentType, - ErrorResult& aRv) +already_AddRefed +FileImpl::Slice(const Optional& aStart, + const Optional& aEnd, + const nsAString& aContentType, + ErrorResult& aRv) { // Truncate aStart and aEnd so that we stay within this file. uint64_t thisLength = GetSize(aRv); @@ -722,24 +722,24 @@ DOMFileImpl::Slice(const Optional& aStart, } //////////////////////////////////////////////////////////////////////////// -// DOMFileImpl implementation +// FileImpl implementation -NS_IMPL_ISUPPORTS(DOMFileImpl, PIDOMFileImpl) +NS_IMPL_ISUPPORTS(FileImpl, PIFileImpl) //////////////////////////////////////////////////////////////////////////// -// DOMFileImplFile implementation +// FileImplFile implementation -NS_IMPL_ISUPPORTS_INHERITED0(DOMFileImplFile, DOMFileImpl) +NS_IMPL_ISUPPORTS_INHERITED0(FileImplFile, FileImpl) void -DOMFileImplBase::GetName(nsAString& aName) +FileImplBase::GetName(nsAString& aName) { NS_ASSERTION(mIsFile, "Should only be called on files"); aName = mName; } nsresult -DOMFileImplBase::GetPath(nsAString& aPath) +FileImplBase::GetPath(nsAString& aPath) { NS_ASSERTION(mIsFile, "Should only be called on files"); aPath = mPath; @@ -747,7 +747,7 @@ DOMFileImplBase::GetPath(nsAString& aPath) } void -DOMFileImplBase::GetMozFullPath(nsAString& aFileName, ErrorResult& aRv) +FileImplBase::GetMozFullPath(nsAString& aFileName, ErrorResult& aRv) { NS_ASSERTION(mIsFile, "Should only be called on files"); @@ -771,7 +771,7 @@ DOMFileImplBase::GetMozFullPath(nsAString& aFileName, ErrorResult& aRv) } void -DOMFileImplBase::GetMozFullPathInternal(nsAString& aFileName, ErrorResult& aRv) +FileImplBase::GetMozFullPathInternal(nsAString& aFileName, ErrorResult& aRv) { if (!mIsFile) { aRv.Throw(NS_ERROR_FAILURE); @@ -782,13 +782,13 @@ DOMFileImplBase::GetMozFullPathInternal(nsAString& aFileName, ErrorResult& aRv) } void -DOMFileImplBase::GetType(nsAString& aType) +FileImplBase::GetType(nsAString& aType) { aType = mContentType; } int64_t -DOMFileImplBase::GetLastModified(ErrorResult& aRv) +FileImplBase::GetLastModified(ErrorResult& aRv) { NS_ASSERTION(mIsFile, "Should only be called on files"); if (IsDateUnknown()) { @@ -799,7 +799,7 @@ DOMFileImplBase::GetLastModified(ErrorResult& aRv) } int64_t -DOMFileImplBase::GetFileId() +FileImplBase::GetFileId() { int64_t id = -1; @@ -825,7 +825,7 @@ DOMFileImplBase::GetFileId() } void -DOMFileImplBase::AddFileInfo(indexedDB::FileInfo* aFileInfo) +FileImplBase::AddFileInfo(indexedDB::FileInfo* aFileInfo) { if (indexedDB::IndexedDatabaseManager::IsClosed()) { NS_ERROR("Shouldn't be called after shutdown!"); @@ -844,7 +844,7 @@ DOMFileImplBase::AddFileInfo(indexedDB::FileInfo* aFileInfo) } indexedDB::FileInfo* -DOMFileImplBase::GetFileInfo(indexedDB::FileManager* aFileManager) +FileImplBase::GetFileInfo(indexedDB::FileManager* aFileManager) { if (indexedDB::IndexedDatabaseManager::IsClosed()) { NS_ERROR("Shouldn't be called after shutdown!"); @@ -876,10 +876,8 @@ DOMFileImplBase::GetFileInfo(indexedDB::FileManager* aFileManager) } nsresult -DOMFileImplBase::GetSendInfo(nsIInputStream** aBody, - uint64_t* aContentLength, - nsACString& aContentType, - nsACString& aCharset) +FileImplBase::GetSendInfo(nsIInputStream** aBody, uint64_t* aContentLength, + nsACString& aContentType, nsACString& aCharset) { MOZ_ASSERT(aContentLength); @@ -907,14 +905,14 @@ DOMFileImplBase::GetSendInfo(nsIInputStream** aBody, } nsresult -DOMFileImplBase::GetMutable(bool* aMutable) const +FileImplBase::GetMutable(bool* aMutable) const { *aMutable = !mImmutable; return NS_OK; } nsresult -DOMFileImplBase::SetMutable(bool aMutable) +FileImplBase::SetMutable(bool aMutable) { nsresult rv = NS_OK; @@ -937,27 +935,27 @@ DOMFileImplBase::SetMutable(bool aMutable) } //////////////////////////////////////////////////////////////////////////// -// DOMFileImplFile implementation +// FileImplFile implementation -already_AddRefed -DOMFileImplFile::CreateSlice(uint64_t aStart, uint64_t aLength, - const nsAString& aContentType, - ErrorResult& aRv) +already_AddRefed +FileImplFile::CreateSlice(uint64_t aStart, uint64_t aLength, + const nsAString& aContentType, + ErrorResult& aRv) { - nsRefPtr impl = - new DOMFileImplFile(this, aStart, aLength, aContentType); + nsRefPtr impl = + new FileImplFile(this, aStart, aLength, aContentType); return impl.forget(); } void -DOMFileImplFile::GetMozFullPathInternal(nsAString& aFilename, ErrorResult& aRv) +FileImplFile::GetMozFullPathInternal(nsAString& aFilename, ErrorResult& aRv) { NS_ASSERTION(mIsFile, "Should only be called on files"); aRv = mFile->GetPath(aFilename); } uint64_t -DOMFileImplFile::GetSize(ErrorResult& aRv) +FileImplFile::GetSize(ErrorResult& aRv) { if (IsSizeUnknown()) { NS_ASSERTION(mWholeFile, @@ -980,7 +978,7 @@ DOMFileImplFile::GetSize(ErrorResult& aRv) } void -DOMFileImplFile::GetType(nsAString& aType) +FileImplFile::GetType(nsAString& aType) { if (mContentType.IsVoid()) { NS_ASSERTION(mWholeFile, @@ -1007,7 +1005,7 @@ DOMFileImplFile::GetType(nsAString& aType) } int64_t -DOMFileImplFile::GetLastModified(ErrorResult& aRv) +FileImplFile::GetLastModified(ErrorResult& aRv) { NS_ASSERTION(mIsFile, "Should only be called on files"); if (IsDateUnknown()) { @@ -1030,7 +1028,7 @@ const uint32_t sFileStreamFlags = nsIFileInputStream::SHARE_DELETE; nsresult -DOMFileImplFile::GetInternalStream(nsIInputStream** aStream) +FileImplFile::GetInternalStream(nsIInputStream** aStream) { return mWholeFile ? NS_NewLocalFileInputStream(aStream, mFile, -1, -1, sFileStreamFlags) : @@ -1039,7 +1037,7 @@ DOMFileImplFile::GetInternalStream(nsIInputStream** aStream) } void -DOMFileImplFile::SetPath(const nsAString& aPath) +FileImplFile::SetPath(const nsAString& aPath) { MOZ_ASSERT(aPath.IsEmpty() || aPath[aPath.Length() - 1] == char16_t('/'), @@ -1048,22 +1046,22 @@ DOMFileImplFile::SetPath(const nsAString& aPath) } //////////////////////////////////////////////////////////////////////////// -// DOMFileImplMemory implementation +// FileImplMemory implementation -NS_IMPL_ISUPPORTS_INHERITED0(DOMFileImplMemory, DOMFileImpl) +NS_IMPL_ISUPPORTS_INHERITED0(FileImplMemory, FileImpl) -already_AddRefed -DOMFileImplMemory::CreateSlice(uint64_t aStart, uint64_t aLength, - const nsAString& aContentType, - ErrorResult& aRv) +already_AddRefed +FileImplMemory::CreateSlice(uint64_t aStart, uint64_t aLength, + const nsAString& aContentType, + ErrorResult& aRv) { - nsRefPtr impl = - new DOMFileImplMemory(this, aStart, aLength, aContentType); + nsRefPtr impl = + new FileImplMemory(this, aStart, aLength, aContentType); return impl.forget(); } nsresult -DOMFileImplMemory::GetInternalStream(nsIInputStream** aStream) +FileImplMemory::GetInternalStream(nsIInputStream** aStream) { if (mLength > INT32_MAX) return NS_ERROR_FAILURE; @@ -1072,20 +1070,20 @@ DOMFileImplMemory::GetInternalStream(nsIInputStream** aStream) } /* static */ StaticMutex -DOMFileImplMemory::DataOwner::sDataOwnerMutex; +FileImplMemory::DataOwner::sDataOwnerMutex; -/* static */ StaticAutoPtr> -DOMFileImplMemory::DataOwner::sDataOwners; +/* static */ StaticAutoPtr> +FileImplMemory::DataOwner::sDataOwners; /* static */ bool -DOMFileImplMemory::DataOwner::sMemoryReporterRegistered = false; +FileImplMemory::DataOwner::sMemoryReporterRegistered = false; -MOZ_DEFINE_MALLOC_SIZE_OF(DOMMemoryFileDataOwnerMallocSizeOf) +MOZ_DEFINE_MALLOC_SIZE_OF(MemoryFileDataOwnerMallocSizeOf) -class DOMFileImplMemoryDataOwnerMemoryReporter MOZ_FINAL +class FileImplMemoryDataOwnerMemoryReporter MOZ_FINAL : public nsIMemoryReporter { - ~DOMFileImplMemoryDataOwnerMemoryReporter() {} + ~FileImplMemoryDataOwnerMemoryReporter() {} public: NS_DECL_THREADSAFE_ISUPPORTS @@ -1093,7 +1091,7 @@ public: NS_IMETHOD CollectReports(nsIMemoryReporterCallback *aCallback, nsISupports *aClosure, bool aAnonymize) { - typedef DOMFileImplMemory::DataOwner DataOwner; + typedef FileImplMemory::DataOwner DataOwner; StaticMutexAutoLock lock(DataOwner::sDataOwnerMutex); @@ -1107,7 +1105,7 @@ public: for (DataOwner *owner = DataOwner::sDataOwners->getFirst(); owner; owner = owner->getNext()) { - size_t size = DOMMemoryFileDataOwnerMallocSizeOf(owner->mData); + size_t size = MemoryFileDataOwnerMallocSizeOf(owner->mData); if (size < LARGE_OBJECT_MIN_SIZE) { smallObjectsTotal += size; @@ -1158,44 +1156,44 @@ public: } }; -NS_IMPL_ISUPPORTS(DOMFileImplMemoryDataOwnerMemoryReporter, nsIMemoryReporter) +NS_IMPL_ISUPPORTS(FileImplMemoryDataOwnerMemoryReporter, nsIMemoryReporter) /* static */ void -DOMFileImplMemory::DataOwner::EnsureMemoryReporterRegistered() +FileImplMemory::DataOwner::EnsureMemoryReporterRegistered() { sDataOwnerMutex.AssertCurrentThreadOwns(); if (sMemoryReporterRegistered) { return; } - RegisterStrongMemoryReporter(new DOMFileImplMemoryDataOwnerMemoryReporter()); + RegisterStrongMemoryReporter(new FileImplMemoryDataOwnerMemoryReporter()); sMemoryReporterRegistered = true; } //////////////////////////////////////////////////////////////////////////// -// DOMFileImplTemporaryFileBlob implementation +// FileImplTemporaryFileBlob implementation -NS_IMPL_ISUPPORTS_INHERITED0(DOMFileImplTemporaryFileBlob, DOMFileImpl) +NS_IMPL_ISUPPORTS_INHERITED0(FileImplTemporaryFileBlob, FileImpl) -already_AddRefed -DOMFileImplTemporaryFileBlob::CreateSlice(uint64_t aStart, uint64_t aLength, - const nsAString& aContentType, - ErrorResult& aRv) +already_AddRefed +FileImplTemporaryFileBlob::CreateSlice(uint64_t aStart, uint64_t aLength, + const nsAString& aContentType, + ErrorResult& aRv) { if (aStart + aLength > mLength) { aRv.Throw(NS_ERROR_UNEXPECTED); return nullptr; } - nsRefPtr impl = - new DOMFileImplTemporaryFileBlob(this, aStart + mStartPos, - aLength, aContentType); + nsRefPtr impl = + new FileImplTemporaryFileBlob(this, aStart + mStartPos, + aLength, aContentType); return impl.forget(); } nsresult -DOMFileImplTemporaryFileBlob::GetInternalStream(nsIInputStream** aStream) +FileImplTemporaryFileBlob::GetInternalStream(nsIInputStream** aStream) { nsCOMPtr stream = new nsTemporaryFileInputStream(mFileDescOwner, mStartPos, mStartPos + mLength); @@ -1234,7 +1232,7 @@ FileList::GetLength(uint32_t* aLength) NS_IMETHODIMP FileList::Item(uint32_t aIndex, nsIDOMFile **aFile) { - nsRefPtr file = Item(aIndex); + nsRefPtr file = Item(aIndex); file.forget(aFile); return NS_OK; } diff --git a/content/base/src/FileIOObject.cpp b/content/base/src/FileIOObject.cpp index 8f60b45a72a3..3eb569b93d89 100644 --- a/content/base/src/FileIOObject.cpp +++ b/content/base/src/FileIOObject.cpp @@ -4,12 +4,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "FileIOObject.h" +#include "mozilla/dom/File.h" +#include "mozilla/dom/ProgressEvent.h" #include "mozilla/EventDispatcher.h" -#include "nsDOMFile.h" +#include "nsComponentManagerUtils.h" #include "nsError.h" #include "nsIDOMEvent.h" -#include "mozilla/dom/ProgressEvent.h" -#include "nsComponentManagerUtils.h" #define ERROR_STR "error" #define ABORT_STR "abort" diff --git a/content/base/src/WebSocket.cpp b/content/base/src/WebSocket.cpp index 85122221e744..512d07b73b60 100644 --- a/content/base/src/WebSocket.cpp +++ b/content/base/src/WebSocket.cpp @@ -11,6 +11,7 @@ #include "jsfriendapi.h" #include "js/OldDebugAPI.h" #include "mozilla/DOMEventTargetHelper.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ScriptSettings.h" #include "nsIScriptGlobalObject.h" #include "nsIDOMWindow.h" @@ -38,7 +39,6 @@ #include "mozilla/Preferences.h" #include "xpcpublic.h" #include "nsContentPolicyUtils.h" -#include "nsDOMFile.h" #include "nsWrapperCacheInlines.h" #include "nsIObserverService.h" #include "nsIWebSocketChannel.h" @@ -1194,8 +1194,7 @@ WebSocket::Send(const nsAString& aData, } void -WebSocket::Send(DOMFile& aData, - ErrorResult& aRv) +WebSocket::Send(File& aData, ErrorResult& aRv) { NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); diff --git a/content/base/src/WebSocket.h b/content/base/src/WebSocket.h index 9c0826216d75..d934f0fac079 100644 --- a/content/base/src/WebSocket.h +++ b/content/base/src/WebSocket.h @@ -32,7 +32,7 @@ namespace mozilla { namespace dom { -class DOMFile; +class File; class WebSocket MOZ_FINAL : public DOMEventTargetHelper, public nsIInterfaceRequestor, @@ -133,7 +133,7 @@ public: // WebIDL interface: // webIDL: void send(DOMString|Blob|ArrayBufferView data); void Send(const nsAString& aData, ErrorResult& aRv); - void Send(DOMFile& aData, + void Send(File& aData, ErrorResult& aRv); void Send(const ArrayBuffer& aData, ErrorResult& aRv); diff --git a/content/base/src/moz.build b/content/base/src/moz.build index a660ba44cbc5..c9ac5f42647b 100644 --- a/content/base/src/moz.build +++ b/content/base/src/moz.build @@ -99,6 +99,7 @@ UNIFIED_SOURCES += [ 'DOMStringList.cpp', 'Element.cpp', 'EventSource.cpp', + 'File.cpp', 'FileIOObject.cpp', 'FragmentOrElement.cpp', 'ImportManager.cpp', @@ -126,7 +127,6 @@ UNIFIED_SOURCES += [ 'nsDOMAttributeMap.cpp', 'nsDOMBlobBuilder.cpp', 'nsDOMCaretPosition.cpp', - 'nsDOMFile.cpp', 'nsDOMFileReader.cpp', 'nsDOMMutationObserver.cpp', 'nsDOMSerializer.cpp', diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 5aa7c9af0da2..0cca795286d3 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -5999,11 +5999,11 @@ nsContentUtils::CreateBlobBuffer(JSContext* aCx, { uint32_t blobLen = aData.Length(); void* blobData = moz_malloc(blobLen); - nsRefPtr blob; + nsRefPtr blob; if (blobData) { memcpy(blobData, aData.BeginReading(), blobLen); - blob = mozilla::dom::DOMFile::CreateMemoryFile(aParent, blobData, blobLen, - EmptyString()); + blob = mozilla::dom::File::CreateMemoryFile(aParent, blobData, blobLen, + EmptyString()); } else { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/content/base/src/nsDOMBlobBuilder.cpp b/content/base/src/nsDOMBlobBuilder.cpp index a7f6128408f1..18f4d2ba09cb 100644 --- a/content/base/src/nsDOMBlobBuilder.cpp +++ b/content/base/src/nsDOMBlobBuilder.cpp @@ -20,10 +20,10 @@ using namespace mozilla; using namespace mozilla::dom; -NS_IMPL_ISUPPORTS_INHERITED0(DOMMultipartFileImpl, DOMFileImpl) +NS_IMPL_ISUPPORTS_INHERITED0(MultipartFileImpl, FileImpl) nsresult -DOMMultipartFileImpl::GetInternalStream(nsIInputStream** aStream) +MultipartFileImpl::GetInternalStream(nsIInputStream** aStream) { nsresult rv; *aStream = nullptr; @@ -35,7 +35,7 @@ DOMMultipartFileImpl::GetInternalStream(nsIInputStream** aStream) uint32_t i; for (i = 0; i < mBlobImpls.Length(); i++) { nsCOMPtr scratchStream; - DOMFileImpl* blobImpl = mBlobImpls.ElementAt(i).get(); + FileImpl* blobImpl = mBlobImpls.ElementAt(i).get(); rv = blobImpl->GetInternalStream(getter_AddRefs(scratchStream)); NS_ENSURE_SUCCESS(rv, rv); @@ -47,13 +47,13 @@ DOMMultipartFileImpl::GetInternalStream(nsIInputStream** aStream) return CallQueryInterface(stream, aStream); } -already_AddRefed -DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength, - const nsAString& aContentType, - ErrorResult& aRv) +already_AddRefed +MultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength, + const nsAString& aContentType, + ErrorResult& aRv) { // If we clamped to nothing we create an empty blob - nsTArray> blobImpls; + nsTArray> blobImpls; uint64_t length = aLength; uint64_t skipStart = aStart; @@ -61,7 +61,7 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength, // Prune the list of blobs if we can uint32_t i; for (i = 0; length && skipStart && i < mBlobImpls.Length(); i++) { - DOMFileImpl* blobImpl = mBlobImpls[i].get(); + FileImpl* blobImpl = mBlobImpls[i].get(); uint64_t l = blobImpl->GetSize(aRv); if (NS_WARN_IF(aRv.Failed())) { @@ -71,14 +71,14 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength, if (skipStart < l) { uint64_t upperBound = std::min(l - skipStart, length); - nsRefPtr firstBlobImpl = + nsRefPtr firstBlobImpl = blobImpl->CreateSlice(skipStart, upperBound, aContentType, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } - // Avoid wrapping a single blob inside an DOMMultipartFileImpl + // Avoid wrapping a single blob inside an MultipartFileImpl if (length == upperBound) { return firstBlobImpl.forget(); } @@ -93,7 +93,7 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength, // Now append enough blobs until we're done for (; length && i < mBlobImpls.Length(); i++) { - DOMFileImpl* blobImpl = mBlobImpls[i].get(); + FileImpl* blobImpl = mBlobImpls[i].get(); uint64_t l = blobImpl->GetSize(aRv); if (NS_WARN_IF(aRv.Failed())) { @@ -101,7 +101,7 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength, } if (length < l) { - nsRefPtr lastBlobImpl = + nsRefPtr lastBlobImpl = blobImpl->CreateSlice(0, length, aContentType, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; @@ -115,19 +115,19 @@ DOMMultipartFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength, } // we can create our blob now - nsRefPtr impl = - new DOMMultipartFileImpl(blobImpls, aContentType); + nsRefPtr impl = + new MultipartFileImpl(blobImpls, aContentType); return impl.forget(); } void -DOMMultipartFileImpl::InitializeBlob() +MultipartFileImpl::InitializeBlob() { SetLengthAndModifiedDate(); } void -DOMMultipartFileImpl::InitializeBlob( +MultipartFileImpl::InitializeBlob( JSContext* aCx, const Sequence& aData, const nsAString& aContentType, @@ -141,7 +141,7 @@ DOMMultipartFileImpl::InitializeBlob( const OwningArrayBufferOrArrayBufferViewOrBlobOrString& data = aData[i]; if (data.IsBlob()) { - nsRefPtr file = data.GetAsBlob().get(); + nsRefPtr file = data.GetAsBlob().get(); blobSet.AppendBlobImpl(file->Impl()); } @@ -181,7 +181,7 @@ DOMMultipartFileImpl::InitializeBlob( } void -DOMMultipartFileImpl::SetLengthAndModifiedDate() +MultipartFileImpl::SetLengthAndModifiedDate() { MOZ_ASSERT(mLength == UINT64_MAX); MOZ_ASSERT(mLastModificationDate == UINT64_MAX); @@ -189,7 +189,7 @@ DOMMultipartFileImpl::SetLengthAndModifiedDate() uint64_t totalLength = 0; for (uint32_t index = 0, count = mBlobImpls.Length(); index < count; index++) { - nsRefPtr& blob = mBlobImpls[index]; + nsRefPtr& blob = mBlobImpls[index]; #ifdef DEBUG MOZ_ASSERT(!blob->IsSizeUnknown()); @@ -216,17 +216,17 @@ DOMMultipartFileImpl::SetLengthAndModifiedDate() } void -DOMMultipartFileImpl::GetMozFullPathInternal(nsAString& aFilename, - ErrorResult& aRv) +MultipartFileImpl::GetMozFullPathInternal(nsAString& aFilename, + ErrorResult& aRv) { if (!mIsFromNsIFile || mBlobImpls.Length() == 0) { - DOMFileImplBase::GetMozFullPathInternal(aFilename, aRv); + FileImplBase::GetMozFullPathInternal(aFilename, aRv); return; } - DOMFileImpl* blobImpl = mBlobImpls.ElementAt(0).get(); + FileImpl* blobImpl = mBlobImpls.ElementAt(0).get(); if (!blobImpl) { - DOMFileImplBase::GetMozFullPathInternal(aFilename, aRv); + FileImplBase::GetMozFullPathInternal(aFilename, aRv); return; } @@ -234,9 +234,9 @@ DOMMultipartFileImpl::GetMozFullPathInternal(nsAString& aFilename, } void -DOMMultipartFileImpl::InitializeChromeFile(DOMFile& aBlob, - const FilePropertyBag& aBag, - ErrorResult& aRv) +MultipartFileImpl::InitializeChromeFile(File& aBlob, + const FilePropertyBag& aBag, + ErrorResult& aRv) { NS_ASSERTION(!mImmutable, "Something went wrong ..."); @@ -265,11 +265,11 @@ DOMMultipartFileImpl::InitializeChromeFile(DOMFile& aBlob, } void -DOMMultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, - nsIFile* aFile, - const FilePropertyBag& aBag, - bool aIsFromNsIFile, - ErrorResult& aRv) +MultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, + nsIFile* aFile, + const FilePropertyBag& aBag, + bool aIsFromNsIFile, + ErrorResult& aRv) { NS_ASSERTION(!mImmutable, "Something went wrong ..."); if (mImmutable) { @@ -309,7 +309,7 @@ DOMMultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, aFile->GetLeafName(mName); } - nsRefPtr blob = DOMFile::CreateFromFile(aWindow, aFile); + nsRefPtr blob = File::CreateFromFile(aWindow, aFile); // Pre-cache size. uint64_t unused; @@ -330,17 +330,17 @@ DOMMultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, } BlobSet blobSet; - blobSet.AppendBlobImpl(static_cast(blob.get())->Impl()); + blobSet.AppendBlobImpl(static_cast(blob.get())->Impl()); mBlobImpls = blobSet.GetBlobImpls(); SetLengthAndModifiedDate(); } void -DOMMultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, - const nsAString& aData, - const FilePropertyBag& aBag, - ErrorResult& aRv) +MultipartFileImpl::InitializeChromeFile(nsPIDOMWindow* aWindow, + const nsAString& aData, + const FilePropertyBag& aBag, + ErrorResult& aRv) { nsCOMPtr file; aRv = NS_NewLocalFile(aData, false, getter_AddRefs(file)); @@ -385,7 +385,7 @@ BlobSet::AppendString(const nsAString& aString, bool aNativeEOL, JSContext* aCx) } nsresult -BlobSet::AppendBlobImpl(DOMFileImpl* aBlobImpl) +BlobSet::AppendBlobImpl(FileImpl* aBlobImpl) { NS_ENSURE_ARG_POINTER(aBlobImpl); @@ -396,7 +396,7 @@ BlobSet::AppendBlobImpl(DOMFileImpl* aBlobImpl) } nsresult -BlobSet::AppendBlobImpls(const nsTArray>& aBlobImpls) +BlobSet::AppendBlobImpls(const nsTArray>& aBlobImpls) { Flush(); mBlobImpls.AppendElements(aBlobImpls); diff --git a/content/base/src/nsDOMBlobBuilder.h b/content/base/src/nsDOMBlobBuilder.h index e2597bf802f2..9e238eb86131 100644 --- a/content/base/src/nsDOMBlobBuilder.h +++ b/content/base/src/nsDOMBlobBuilder.h @@ -6,11 +6,10 @@ #ifndef nsDOMBlobBuilder_h #define nsDOMBlobBuilder_h -#include "nsDOMFile.h" - #include "mozilla/Attributes.h" #include "mozilla/CheckedInt.h" #include "mozilla/ErrorResult.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/BlobBinding.h" #include "mozilla/dom/FileBinding.h" #include @@ -18,16 +17,16 @@ using namespace mozilla; using namespace mozilla::dom; -class DOMMultipartFileImpl MOZ_FINAL : public DOMFileImplBase +class MultipartFileImpl MOZ_FINAL : public FileImplBase { public: NS_DECL_ISUPPORTS_INHERITED // Create as a file - DOMMultipartFileImpl(const nsTArray>& aBlobImpls, - const nsAString& aName, - const nsAString& aContentType) - : DOMFileImplBase(aName, aContentType, UINT64_MAX), + MultipartFileImpl(const nsTArray>& aBlobImpls, + const nsAString& aName, + const nsAString& aContentType) + : FileImplBase(aName, aContentType, UINT64_MAX), mBlobImpls(aBlobImpls), mIsFromNsIFile(false) { @@ -35,9 +34,9 @@ public: } // Create as a blob - DOMMultipartFileImpl(const nsTArray>& aBlobImpls, - const nsAString& aContentType) - : DOMFileImplBase(aContentType, UINT64_MAX), + MultipartFileImpl(const nsTArray>& aBlobImpls, + const nsAString& aContentType) + : FileImplBase(aContentType, UINT64_MAX), mBlobImpls(aBlobImpls), mIsFromNsIFile(false) { @@ -45,15 +44,15 @@ public: } // Create as a file to be later initialized - explicit DOMMultipartFileImpl(const nsAString& aName) - : DOMFileImplBase(aName, EmptyString(), UINT64_MAX), + explicit MultipartFileImpl(const nsAString& aName) + : FileImplBase(aName, EmptyString(), UINT64_MAX), mIsFromNsIFile(false) { } // Create as a blob to be later initialized - DOMMultipartFileImpl() - : DOMFileImplBase(EmptyString(), UINT64_MAX), + MultipartFileImpl() + : FileImplBase(EmptyString(), UINT64_MAX), mIsFromNsIFile(false) { } @@ -67,7 +66,7 @@ public: bool aNativeEOL, ErrorResult& aRv); - void InitializeChromeFile(DOMFile& aData, + void InitializeChromeFile(File& aData, const FilePropertyBag& aBag, ErrorResult& aRv); @@ -82,7 +81,7 @@ public: bool aIsFromNsIFile, ErrorResult& aRv); - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE; @@ -94,7 +93,7 @@ public: virtual nsresult GetInternalStream(nsIInputStream** aInputStream) MOZ_OVERRIDE; - virtual const nsTArray>* GetSubBlobImpls() const MOZ_OVERRIDE + virtual const nsTArray>* GetSubBlobImpls() const MOZ_OVERRIDE { return &mBlobImpls; } @@ -113,11 +112,11 @@ public: } protected: - virtual ~DOMMultipartFileImpl() {} + virtual ~MultipartFileImpl() {} void SetLengthAndModifiedDate(); - nsTArray> mBlobImpls; + nsTArray> mBlobImpls; bool mIsFromNsIFile; }; @@ -134,16 +133,16 @@ public: nsresult AppendVoidPtr(const void* aData, uint32_t aLength); nsresult AppendString(const nsAString& aString, bool nativeEOL, JSContext* aCx); - nsresult AppendBlobImpl(DOMFileImpl* aBlobImpl); - nsresult AppendBlobImpls(const nsTArray>& aBlobImpls); + nsresult AppendBlobImpl(FileImpl* aBlobImpl); + nsresult AppendBlobImpls(const nsTArray>& aBlobImpls); - nsTArray>& GetBlobImpls() { Flush(); return mBlobImpls; } + nsTArray>& GetBlobImpls() { Flush(); return mBlobImpls; } - already_AddRefed + already_AddRefed GetBlobInternal(nsISupports* aParent, const nsACString& aContentType) { - nsRefPtr blob = new DOMFile(aParent, - new DOMMultipartFileImpl(GetBlobImpls(), NS_ConvertASCIItoUTF16(aContentType))); + nsRefPtr blob = new File(aParent, + new MultipartFileImpl(GetBlobImpls(), NS_ConvertASCIItoUTF16(aContentType))); return blob.forget(); } @@ -181,16 +180,16 @@ protected: // If we have some data, create a blob for it // and put it on the stack - nsRefPtr blobImpl = - new DOMFileImplMemory(mData, mDataLen, EmptyString()); + nsRefPtr blobImpl = + new FileImplMemory(mData, mDataLen, EmptyString()); mBlobImpls.AppendElement(blobImpl); - mData = nullptr; // The nsDOMMemoryFile takes ownership of the buffer + mData = nullptr; // The FileImplMemory takes ownership of the buffer mDataLen = 0; mDataBufferLen = 0; } } - nsTArray> mBlobImpls; + nsTArray> mBlobImpls; void* mData; uint64_t mDataLen; uint64_t mDataBufferLen; diff --git a/content/base/src/nsDOMDataChannel.cpp b/content/base/src/nsDOMDataChannel.cpp index 671f4cd2f580..d72a5b143e61 100644 --- a/content/base/src/nsDOMDataChannel.cpp +++ b/content/base/src/nsDOMDataChannel.cpp @@ -22,10 +22,10 @@ extern PRLogModuleInfo* GetDataChannelLog(); #include "nsDOMDataChannelDeclarations.h" #include "nsDOMDataChannel.h" -#include "nsDOMFile.h" #include "nsIDOMDataChannel.h" #include "nsIDOMMessageEvent.h" #include "mozilla/DOMEventTargetHelper.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ScriptSettings.h" #include "nsError.h" @@ -34,7 +34,6 @@ extern PRLogModuleInfo* GetDataChannelLog(); #include "nsCycleCollectionParticipant.h" #include "nsIScriptObjectPrincipal.h" #include "nsNetUtil.h" -#include "nsDOMFile.h" #include "DataChannel.h" @@ -272,7 +271,7 @@ nsDOMDataChannel::Send(const nsAString& aData, ErrorResult& aRv) } void -nsDOMDataChannel::Send(DOMFile& aData, ErrorResult& aRv) +nsDOMDataChannel::Send(File& aData, ErrorResult& aRv) { NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); diff --git a/content/base/src/nsDOMDataChannel.h b/content/base/src/nsDOMDataChannel.h index 02542396cbfe..457796f3b65d 100644 --- a/content/base/src/nsDOMDataChannel.h +++ b/content/base/src/nsDOMDataChannel.h @@ -18,7 +18,7 @@ namespace mozilla { namespace dom { -class DOMFile; +class File; } class DataChannel; @@ -70,7 +70,7 @@ public: static_cast(aType)); } void Send(const nsAString& aData, mozilla::ErrorResult& aRv); - void Send(mozilla::dom::DOMFile& aData, mozilla::ErrorResult& aRv); + void Send(mozilla::dom::File& aData, mozilla::ErrorResult& aRv); void Send(const mozilla::dom::ArrayBuffer& aData, mozilla::ErrorResult& aRv); void Send(const mozilla::dom::ArrayBufferView& aData, mozilla::ErrorResult& aRv); diff --git a/content/base/src/nsDOMFileReader.cpp b/content/base/src/nsDOMFileReader.cpp index 24e4e5fa5574..7afab40039de 100644 --- a/content/base/src/nsDOMFileReader.cpp +++ b/content/base/src/nsDOMFileReader.cpp @@ -8,7 +8,6 @@ #include "nsContentCID.h" #include "nsContentUtils.h" #include "nsDOMClassInfoID.h" -#include "nsDOMFile.h" #include "nsError.h" #include "nsIFile.h" #include "nsNetCID.h" @@ -20,6 +19,7 @@ #include "nsCycleCollectionParticipant.h" #include "mozilla/Base64.h" #include "mozilla/dom/EncodingUtils.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/FileReaderBinding.h" #include "xpcpublic.h" #include "nsDOMJSUtils.h" @@ -186,7 +186,7 @@ nsDOMFileReader::ReadAsArrayBuffer(nsIDOMBlob* aFile, JSContext* aCx) { NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER); ErrorResult rv; - nsRefPtr file = static_cast(aFile); + nsRefPtr file = static_cast(aFile); ReadAsArrayBuffer(aCx, *file, rv); return rv.ErrorCode(); } @@ -196,7 +196,7 @@ nsDOMFileReader::ReadAsBinaryString(nsIDOMBlob* aFile) { NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER); ErrorResult rv; - nsRefPtr file = static_cast(aFile); + nsRefPtr file = static_cast(aFile); ReadAsBinaryString(*file, rv); return rv.ErrorCode(); } @@ -207,7 +207,7 @@ nsDOMFileReader::ReadAsText(nsIDOMBlob* aFile, { NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER); ErrorResult rv; - nsRefPtr file = static_cast(aFile); + nsRefPtr file = static_cast(aFile); ReadAsText(*file, aCharset, rv); return rv.ErrorCode(); } @@ -217,7 +217,7 @@ nsDOMFileReader::ReadAsDataURL(nsIDOMBlob* aFile) { NS_ENSURE_TRUE(aFile, NS_ERROR_NULL_POINTER); ErrorResult rv; - nsRefPtr file = static_cast(aFile); + nsRefPtr file = static_cast(aFile); ReadAsDataURL(*file, rv); return rv.ErrorCode(); } @@ -370,7 +370,7 @@ nsDOMFileReader::DoReadData(nsIAsyncInputStream* aStream, uint64_t aCount) void nsDOMFileReader::ReadFileContent(JSContext* aCx, - DOMFile& aFile, + File& aFile, const nsAString &aCharset, eDataFormat aDataFormat, ErrorResult& aRv) diff --git a/content/base/src/nsDOMFileReader.h b/content/base/src/nsDOMFileReader.h index 30071d9b7ed7..060661a09190 100644 --- a/content/base/src/nsDOMFileReader.h +++ b/content/base/src/nsDOMFileReader.h @@ -27,7 +27,7 @@ namespace mozilla { namespace dom { -class DOMFile; +class File; } } @@ -38,7 +38,7 @@ class nsDOMFileReader : public mozilla::dom::FileIOObject, { typedef mozilla::ErrorResult ErrorResult; typedef mozilla::dom::GlobalObject GlobalObject; - typedef mozilla::dom::DOMFile DOMFile; + typedef mozilla::dom::File File; public: nsDOMFileReader(); @@ -68,17 +68,17 @@ public: // WebIDL static already_AddRefed Constructor(const GlobalObject& aGlobal, ErrorResult& aRv); - void ReadAsArrayBuffer(JSContext* aCx, DOMFile& aBlob, ErrorResult& aRv) + void ReadAsArrayBuffer(JSContext* aCx, File& aBlob, ErrorResult& aRv) { ReadFileContent(aCx, aBlob, EmptyString(), FILE_AS_ARRAYBUFFER, aRv); } - void ReadAsText(DOMFile& aBlob, const nsAString& aLabel, ErrorResult& aRv) + void ReadAsText(File& aBlob, const nsAString& aLabel, ErrorResult& aRv) { ReadFileContent(nullptr, aBlob, aLabel, FILE_AS_TEXT, aRv); } - void ReadAsDataURL(DOMFile& aBlob, ErrorResult& aRv) + void ReadAsDataURL(File& aBlob, ErrorResult& aRv) { ReadFileContent(nullptr, aBlob, EmptyString(), FILE_AS_DATAURL, aRv); } @@ -102,7 +102,7 @@ public: using FileIOObject::SetOnerror; IMPL_EVENT_HANDLER(loadend) - void ReadAsBinaryString(DOMFile& aBlob, ErrorResult& aRv) + void ReadAsBinaryString(File& aBlob, ErrorResult& aRv) { ReadFileContent(nullptr, aBlob, EmptyString(), FILE_AS_BINARY, aRv); } @@ -124,7 +124,7 @@ protected: FILE_AS_DATAURL }; - void ReadFileContent(JSContext* aCx, DOMFile& aBlob, + void ReadFileContent(JSContext* aCx, File& aBlob, const nsAString &aCharset, eDataFormat aDataFormat, ErrorResult& aRv); nsresult GetAsText(nsIDOMBlob *aFile, const nsACString &aCharset, diff --git a/content/base/src/nsFormData.cpp b/content/base/src/nsFormData.cpp index c080c013eac3..b1fd0d85551b 100644 --- a/content/base/src/nsFormData.cpp +++ b/content/base/src/nsFormData.cpp @@ -2,10 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsDOMFile.h" #include "nsFormData.h" #include "nsIVariant.h" #include "nsIInputStream.h" +#include "mozilla/dom/File.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/HTMLFormElement.h" #include "mozilla/dom/FormDataBinding.h" @@ -73,7 +74,7 @@ nsFormData::Append(const nsAString& aName, const nsAString& aValue) } void -nsFormData::Append(const nsAString& aName, DOMFile& aBlob, +nsFormData::Append(const nsAString& aName, File& aBlob, const Optional& aFilename) { nsString filename; @@ -105,7 +106,7 @@ nsFormData::Append(const nsAString& aName, nsIVariant* aValue) nsMemory::Free(iid); nsCOMPtr domBlob = do_QueryInterface(supports); - nsRefPtr blob = static_cast(domBlob.get()); + nsRefPtr blob = static_cast(domBlob.get()); if (domBlob) { Optional temp; Append(aName, *blob, temp); diff --git a/content/base/src/nsFormData.h b/content/base/src/nsFormData.h index e2b2c067b1f7..64e6c4ee7199 100644 --- a/content/base/src/nsFormData.h +++ b/content/base/src/nsFormData.h @@ -18,7 +18,7 @@ namespace mozilla { class ErrorResult; namespace dom { -class DOMFile; +class File; class HTMLFormElement; class GlobalObject; } // namespace dom @@ -55,7 +55,7 @@ public: const mozilla::dom::Optional >& aFormElement, mozilla::ErrorResult& aRv); void Append(const nsAString& aName, const nsAString& aValue); - void Append(const nsAString& aName, mozilla::dom::DOMFile& aBlob, + void Append(const nsAString& aName, mozilla::dom::File& aBlob, const mozilla::dom::Optional& aFilename); // nsFormSubmission diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index 3dbd2494d5d8..cb1c4b642e27 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -27,10 +27,10 @@ #include "nsIScriptSecurityManager.h" #include "nsIJSRuntimeService.h" #include "nsIDOMClassInfo.h" -#include "nsIDOMFile.h" #include "xpcpublic.h" #include "mozilla/CycleCollectedJSRuntime.h" #include "mozilla/Preferences.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/nsIContentParent.h" #include "mozilla/dom/PermissionMessageUtils.h" #include "mozilla/dom/ScriptSettings.h" @@ -204,7 +204,7 @@ BuildClonedMessageData(typename BlobTraits::ConcreteContentManagerType* SerializedStructuredCloneBuffer& buffer = aClonedData.data(); buffer.data = aData.mData; buffer.dataLength = aData.mDataLength; - const nsTArray>& blobs = aData.mClosure.mBlobs; + const nsTArray>& blobs = aData.mClosure.mBlobs; if (!blobs.IsEmpty()) { typedef typename BlobTraits::ProtocolType ProtocolType; InfallibleTArray& blobList = DataBlobs::Blobs(aClonedData); @@ -256,12 +256,12 @@ UnpackClonedMessageData(const ClonedMessageData& aData) static_cast::BlobType*>(blobs[i]); MOZ_ASSERT(blob); - nsRefPtr blobImpl = blob->GetBlobImpl(); + nsRefPtr blobImpl = blob->GetBlobImpl(); MOZ_ASSERT(blobImpl); // This object will be duplicated with a correct parent before being // exposed to JS. - nsRefPtr domBlob = new DOMFile(nullptr, blobImpl); + nsRefPtr domBlob = new File(nullptr, blobImpl); cloneData.mClosure.mBlobs.AppendElement(domBlob); } } diff --git a/content/base/src/nsHostObjectProtocolHandler.cpp b/content/base/src/nsHostObjectProtocolHandler.cpp index d26c62a96bd7..bf04e2d533ff 100644 --- a/content/base/src/nsHostObjectProtocolHandler.cpp +++ b/content/base/src/nsHostObjectProtocolHandler.cpp @@ -10,14 +10,14 @@ #include "nsClassHashtable.h" #include "nsNetUtil.h" #include "nsIPrincipal.h" -#include "nsDOMFile.h" #include "DOMMediaStream.h" #include "mozilla/dom/MediaSource.h" #include "nsIMemoryReporter.h" +#include "mozilla/dom/File.h" #include "mozilla/Preferences.h" #include "mozilla/LoadInfo.h" -using mozilla::dom::DOMFileImpl; +using mozilla::dom::FileImpl; using mozilla::ErrorResult; using mozilla::LoadInfo; @@ -497,7 +497,7 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result) return NS_ERROR_DOM_BAD_URI; } - nsCOMPtr blobImpl = do_QueryInterface(info->mObject); + nsCOMPtr blobImpl = do_QueryInterface(info->mObject); if (!blobImpl) { return NS_ERROR_DOM_BAD_URI; } @@ -511,7 +511,7 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result) } #endif - DOMFileImpl* blob = static_cast(blobImpl.get()); + FileImpl* blob = static_cast(blobImpl.get()); nsCOMPtr stream; nsresult rv = blob->GetInternalStream(getter_AddRefs(stream)); NS_ENSURE_SUCCESS(rv, rv); @@ -596,12 +596,12 @@ NS_GetStreamForBlobURI(nsIURI* aURI, nsIInputStream** aStream) *aStream = nullptr; - nsCOMPtr blobImpl = do_QueryInterface(GetDataObject(aURI)); + nsCOMPtr blobImpl = do_QueryInterface(GetDataObject(aURI)); if (!blobImpl) { return NS_ERROR_DOM_BAD_URI; } - DOMFileImpl* blob = static_cast(blobImpl.get()); + FileImpl* blob = static_cast(blobImpl.get()); return blob->GetInternalStream(aStream); } diff --git a/content/base/src/nsXMLHttpRequest.cpp b/content/base/src/nsXMLHttpRequest.cpp index c7a0fc17aa16..59b48e51cc43 100644 --- a/content/base/src/nsXMLHttpRequest.cpp +++ b/content/base/src/nsXMLHttpRequest.cpp @@ -10,6 +10,7 @@ #include #endif #include "mozilla/ArrayUtils.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/XMLHttpRequestUploadBinding.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventListenerManager.h" @@ -56,7 +57,6 @@ #include "nsIContentSecurityPolicy.h" #include "nsAsyncRedirectVerifyHelper.h" #include "nsStringBuffer.h" -#include "nsDOMFile.h" #include "nsIFileChannel.h" #include "mozilla/Telemetry.h" #include "jsfriendapi.h" @@ -1898,9 +1898,8 @@ bool nsXMLHttpRequest::CreateDOMFile(nsIRequest *request) nsAutoCString contentType; mChannel->GetContentType(contentType); - mDOMFile = - DOMFile::CreateFromFile(GetOwner(), file, EmptyString(), - NS_ConvertASCIItoUTF16(contentType)); + mDOMFile = File::CreateFromFile(GetOwner(), file, EmptyString(), + NS_ConvertASCIItoUTF16(contentType)); mBlobSet = nullptr; NS_ASSERTION(mResponseBody.IsEmpty(), "mResponseBody should be empty"); diff --git a/content/base/src/nsXMLHttpRequest.h b/content/base/src/nsXMLHttpRequest.h index e2f65b6eda49..36c6c8df9d11 100644 --- a/content/base/src/nsXMLHttpRequest.h +++ b/content/base/src/nsXMLHttpRequest.h @@ -42,7 +42,6 @@ class AsyncVerifyRedirectCallbackForwarder; class BlobSet; -class nsDOMFile; class nsFormData; class nsIJARChannel; class nsILoadGroup; @@ -52,7 +51,7 @@ class nsIJSID; namespace mozilla { namespace dom { -class DOMFile; +class File; } // A helper for building up an ArrayBuffer object's data @@ -350,7 +349,7 @@ private: { mValue.mArrayBufferView = aArrayBufferView; } - explicit RequestBody(mozilla::dom::DOMFile& aBlob) : mType(Blob) + explicit RequestBody(mozilla::dom::File& aBlob) : mType(Blob) { mValue.mBlob = &aBlob; } @@ -384,7 +383,7 @@ private: union Value { const mozilla::dom::ArrayBuffer* mArrayBuffer; const mozilla::dom::ArrayBufferView* mArrayBufferView; - mozilla::dom::DOMFile* mBlob; + mozilla::dom::File* mBlob; nsIDocument* mDocument; const nsAString* mString; nsFormData* mFormData; @@ -440,7 +439,7 @@ public: { aRv = Send(RequestBody(&aArrayBufferView)); } - void Send(mozilla::dom::DOMFile& aBlob, ErrorResult& aRv) + void Send(mozilla::dom::File& aBlob, ErrorResult& aRv) { aRv = Send(RequestBody(aBlob)); } @@ -671,10 +670,10 @@ protected: // It is either a cached blob-response from the last call to GetResponse, // but is also explicitly set in OnStopRequest. - nsRefPtr mResponseBlob; + nsRefPtr mResponseBlob; // Non-null only when we are able to get a os-file representation of the // response, i.e. when loading from a file. - nsRefPtr mDOMFile; + nsRefPtr mDOMFile; // We stream data to mBlobSet when response type is "blob" or "moz-blob" // and mDOMFile is null. nsAutoPtr mBlobSet; diff --git a/content/base/test/chrome/test_bug914381.html b/content/base/test/chrome/test_bug914381.html index 7e6ba8564dd1..c85f685f02b3 100644 --- a/content/base/test/chrome/test_bug914381.html +++ b/content/base/test/chrome/test_bug914381.html @@ -33,7 +33,7 @@ function createFileWithData(fileData) { return testFile; } -/** Test for Bug 914381. DOMFile's created in JS using an nsIFile should allow mozGetFullPathInternal calls to succeed **/ +/** Test for Bug 914381. File's created in JS using an nsIFile should allow mozGetFullPathInternal calls to succeed **/ var file = createFileWithData("Test bug 914381"); var f = new File(file); is(f.mozFullPathInternal, undefined, "mozFullPathInternal is undefined from js"); diff --git a/content/html/content/public/HTMLCanvasElement.h b/content/html/content/public/HTMLCanvasElement.h index bea14426e56d..c4a8bd2d60be 100644 --- a/content/html/content/public/HTMLCanvasElement.h +++ b/content/html/content/public/HTMLCanvasElement.h @@ -30,7 +30,7 @@ class SourceSurface; namespace dom { -class DOMFile; +class File; class FileCallback; class HTMLCanvasPrintState; class PrintCallback; @@ -102,9 +102,9 @@ public: { SetHTMLBoolAttr(nsGkAtoms::moz_opaque, aValue, aRv); } - already_AddRefed MozGetAsFile(const nsAString& aName, - const nsAString& aType, - ErrorResult& aRv); + already_AddRefed MozGetAsFile(const nsAString& aName, + const nsAString& aType, + ErrorResult& aRv); already_AddRefed MozGetIPCContext(const nsAString& aContextId, ErrorResult& aRv) { diff --git a/content/html/content/src/HTMLCanvasElement.cpp b/content/html/content/src/HTMLCanvasElement.cpp index 91b39f986574..de08d8df56dc 100644 --- a/content/html/content/src/HTMLCanvasElement.cpp +++ b/content/html/content/src/HTMLCanvasElement.cpp @@ -12,6 +12,7 @@ #include "mozilla/Base64.h" #include "mozilla/CheckedInt.h" #include "mozilla/dom/CanvasRenderingContext2D.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/HTMLCanvasElementBinding.h" #include "mozilla/dom/UnionTypes.h" #include "mozilla/dom/MouseEvent.h" @@ -23,7 +24,6 @@ #include "nsAttrValueInlines.h" #include "nsContentUtils.h" #include "nsDisplayList.h" -#include "nsDOMFile.h" #include "nsDOMJSUtils.h" #include "nsIScriptSecurityManager.h" #include "nsITimer.h" @@ -549,9 +549,9 @@ HTMLCanvasElement::ToBlob(JSContext* aCx, , mFileCallback(aCallback) {} // This is called on main thread. - nsresult ReceiveBlob(already_AddRefed aBlob) + nsresult ReceiveBlob(already_AddRefed aBlob) { - nsRefPtr blob = aBlob; + nsRefPtr blob = aBlob; uint64_t size; nsresult rv = blob->GetSize(&size); if (NS_SUCCEEDED(rv)) { @@ -560,7 +560,7 @@ HTMLCanvasElement::ToBlob(JSContext* aCx, JS_updateMallocCounter(jsapi.cx(), size); } - nsRefPtr newBlob = new DOMFile(mGlobal, blob->Impl()); + nsRefPtr newBlob = new File(mGlobal, blob->Impl()); mozilla::ErrorResult error; mFileCallback->Call(*newBlob, error); @@ -587,14 +587,14 @@ HTMLCanvasElement::ToBlob(JSContext* aCx, callback); } -already_AddRefed +already_AddRefed HTMLCanvasElement::MozGetAsFile(const nsAString& aName, const nsAString& aType, ErrorResult& aRv) { nsCOMPtr file; aRv = MozGetAsFile(aName, aType, getter_AddRefs(file)); - nsRefPtr tmp = static_cast(file.get()); + nsRefPtr tmp = static_cast(file.get()); return tmp.forget(); } @@ -640,10 +640,10 @@ HTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName, nsCOMPtr win = do_QueryInterface(OwnerDoc()->GetScopeObject()); - // The DOMFile takes ownership of the buffer - nsRefPtr file = - DOMFile::CreateMemoryFile(win, imgData, (uint32_t)imgSize, aName, type, - PR_Now()); + // The File takes ownership of the buffer + nsRefPtr file = + File::CreateMemoryFile(win, imgData, (uint32_t)imgSize, aName, type, + PR_Now()); file.forget(aResult); return NS_OK; diff --git a/content/html/content/src/HTMLInputElement.cpp b/content/html/content/src/HTMLInputElement.cpp index caf973b7b3bd..6d89f9d468e0 100644 --- a/content/html/content/src/HTMLInputElement.cpp +++ b/content/html/content/src/HTMLInputElement.cpp @@ -73,9 +73,9 @@ #include "nsIRadioGroupContainer.h" // input type=file +#include "mozilla/dom/File.h" #include "nsIFile.h" #include "nsNetUtil.h" -#include "nsDOMFile.h" #include "nsDirectoryServiceDefs.h" #include "nsIContentPrefService.h" #include "nsIMIMEService.h" @@ -236,11 +236,11 @@ class HTMLInputElementState MOZ_FINAL : public nsISupports mValue = aValue; } - const nsTArray>& GetFiles() { + const nsTArray>& GetFiles() { return mFiles; } - void SetFiles(const nsTArray>& aFiles) { + void SetFiles(const nsTArray>& aFiles) { mFiles.Clear(); mFiles.AppendElements(aFiles); } @@ -255,7 +255,7 @@ class HTMLInputElementState MOZ_FINAL : public nsISupports ~HTMLInputElementState() {} nsString mValue; - nsTArray> mFiles; + nsTArray> mFiles; bool mChecked; bool mCheckedSet; }; @@ -316,7 +316,7 @@ UploadLastDir::ContentPrefCallback::HandleError(nsresult error) namespace { /** - * This enumerator returns DOMFile objects after wrapping a single + * This enumerator returns File objects after wrapping a single * nsIFile representing a directory. It enumerates the files under that * directory and its subdirectories as a flat list of files, ignoring/skipping * over symbolic links. @@ -376,7 +376,7 @@ public: } // The parent for this object will be set on the main thread. - nsRefPtr domFile = DOMFile::CreateFromFile(nullptr, mNextFile); + nsRefPtr domFile = File::CreateFromFile(nullptr, mNextFile); nsCString relDescriptor; nsresult rv = mNextFile->GetRelativeDescriptor(mTopDirsParent, relDescriptor); @@ -389,8 +389,7 @@ public: MOZ_ASSERT(length >= 0); if (length > 0) { // Note that we leave the trailing "/" on the path. - DOMFileImplFile* fileImpl = - static_cast(domFile->Impl()); + FileImplFile* fileImpl = static_cast(domFile->Impl()); MOZ_ASSERT(fileImpl); fileImpl->SetPath(Substring(path, 0, uint32_t(length))); } @@ -514,7 +513,7 @@ public: NS_IMETHOD Run() { if (!NS_IsMainThread()) { - // Build up list of DOMFile objects on this dedicated thread: + // Build up list of File objects on this dedicated thread: nsCOMPtr iter = new DirPickerRecursiveFileEnumerator(mTopDir); bool hasMore = true; @@ -523,7 +522,7 @@ public: iter->GetNext(getter_AddRefs(tmp)); nsCOMPtr domFile = do_QueryInterface(tmp); MOZ_ASSERT(domFile); - mFileList.AppendElement(static_cast(domFile.get())); + mFileList.AppendElement(static_cast(domFile.get())); mFileListLength = mFileList.Length(); if (mCanceled) { MOZ_ASSERT(!mInput, "This is bad - how did this happen?"); @@ -553,11 +552,11 @@ public: return NS_OK; } - // Recreate DOMFile with the correct parent object. + // Recreate File with the correct parent object. nsCOMPtr global = mInput->OwnerDoc()->GetScopeObject(); for (uint32_t i = 0; i < mFileList.Length(); ++i) { MOZ_ASSERT(!mFileList[i]->GetParentObject()); - mFileList[i] = new DOMFile(global, mFileList[i]->Impl()); + mFileList[i] = new File(global, mFileList[i]->Impl()); } // The text control frame (if there is one) isn't going to send a change @@ -603,7 +602,7 @@ public: private: nsRefPtr mInput; nsCOMPtr mTopDir; - nsTArray> mFileList; + nsTArray> mFileList; // We access the list length on both threads, so we need the indirection of // this atomic member to make the access thread safe: @@ -629,7 +628,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) if (mode == static_cast(nsIFilePicker::modeGetFolder)) { // Directory picking is different, since we still need to do more I/O to - // build up the list of DOMFile objects. Since this may block for a + // build up the list of File objects. Since this may block for a // long time, we need to build the list off on another dedicated thread to // avoid blocking any other activities that the browser is carrying out. @@ -664,7 +663,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) } // Collect new selected filenames - nsTArray> newFiles; + nsTArray> newFiles; if (mode == static_cast(nsIFilePicker::modeOpenMultiple)) { nsCOMPtr iter; nsresult rv = mFilePicker->GetDomfiles(getter_AddRefs(iter)); @@ -681,7 +680,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) iter->GetNext(getter_AddRefs(tmp)); nsCOMPtr domFile = do_QueryInterface(tmp); MOZ_ASSERT(domFile); - newFiles.AppendElement(static_cast(domFile.get())); + newFiles.AppendElement(static_cast(domFile.get())); } } else { MOZ_ASSERT(mode == static_cast(nsIFilePicker::modeOpen)); @@ -689,7 +688,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) nsresult rv = mFilePicker->GetDomfile(getter_AddRefs(domFile)); NS_ENSURE_SUCCESS(rv, rv); if (domFile) { - newFiles.AppendElement(static_cast(domFile.get())); + newFiles.AppendElement(static_cast(domFile.get())); } } @@ -945,7 +944,7 @@ HTMLInputElement::InitFilePicker(FilePickerType aType) // Set default directry and filename nsAutoString defaultName; - const nsTArray>& oldFiles = GetFilesInternal(); + const nsTArray>& oldFiles = GetFilesInternal(); nsCOMPtr callback = new HTMLInputElement::nsFilePickerShownCallback(this, filePicker); @@ -1725,7 +1724,7 @@ HTMLInputElement::IsValueEmpty() const void HTMLInputElement::ClearFiles(bool aSetValueChanged) { - nsTArray> files; + nsTArray> files; SetFiles(files, aSetValueChanged); } @@ -2319,7 +2318,7 @@ HTMLInputElement::MozGetFileNameArray(uint32_t* aLength, char16_t*** aFileNames) void HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames) { - nsTArray> files; + nsTArray> files; for (uint32_t i = 0; i < aFileNames.Length(); ++i) { nsCOMPtr file; @@ -2338,7 +2337,7 @@ HTMLInputElement::MozSetFileNameArray(const Sequence< nsString >& aFileNames) if (file) { nsCOMPtr global = OwnerDoc()->GetScopeObject(); - nsRefPtr domFile = DOMFile::CreateFromFile(global, file); + nsRefPtr domFile = File::CreateFromFile(global, file); files.AppendElement(domFile); } else { continue; // Not much we can do if the file doesn't exist @@ -2574,7 +2573,7 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const } void -HTMLInputElement::SetFiles(const nsTArray>& aFiles, +HTMLInputElement::SetFiles(const nsTArray>& aFiles, bool aSetValueChanged) { mFiles.Clear(); @@ -2594,7 +2593,7 @@ HTMLInputElement::SetFiles(nsIDOMFileList* aFiles, uint32_t listLength; aFiles->GetLength(&listLength); for (uint32_t i = 0; i < listLength; i++) { - nsRefPtr file = files->Item(i); + nsRefPtr file = files->Item(i); mFiles.AppendElement(file); } } @@ -2794,7 +2793,7 @@ HTMLInputElement::UpdateFileList() if (mFileList) { mFileList->Clear(); - const nsTArray>& files = GetFilesInternal(); + const nsTArray>& files = GetFilesInternal(); for (uint32_t i = 0; i < files.Length(); ++i) { if (!mFileList->Append(files[i])) { return NS_ERROR_FAILURE; @@ -5644,7 +5643,7 @@ HTMLInputElement::SubmitNamesValues(nsFormSubmission* aFormSubmission) if (mType == NS_FORM_INPUT_FILE) { // Submit files - const nsTArray>& files = GetFilesInternal(); + const nsTArray>& files = GetFilesInternal(); for (uint32_t i = 0; i < files.Length(); ++i) { aFormSubmission->AddNameFilePair(name, files[i], NullString()); @@ -5892,7 +5891,7 @@ HTMLInputElement::RestoreState(nsPresState* aState) break; case VALUE_MODE_FILENAME: { - const nsTArray>& files = inputState->GetFiles(); + const nsTArray>& files = inputState->GetFiles(); SetFiles(files, true); } break; @@ -6402,7 +6401,7 @@ HTMLInputElement::IsValueMissing() const return IsValueEmpty(); case VALUE_MODE_FILENAME: { - const nsTArray>& files = GetFilesInternal(); + const nsTArray>& files = GetFilesInternal(); return files.IsEmpty(); } case VALUE_MODE_DEFAULT_ON: diff --git a/content/html/content/src/HTMLInputElement.h b/content/html/content/src/HTMLInputElement.h index dbfc95029184..277104aab12c 100644 --- a/content/html/content/src/HTMLInputElement.h +++ b/content/html/content/src/HTMLInputElement.h @@ -37,7 +37,7 @@ namespace dom { class Date; class DirPickerFileListBuilderTask; -class DOMFile; +class File; class FileList; class UploadLastDir MOZ_FINAL : public nsIObserver, public nsSupportsWeakReference { @@ -211,12 +211,12 @@ public: void GetDisplayFileName(nsAString& aFileName) const; - const nsTArray>& GetFilesInternal() const + const nsTArray>& GetFilesInternal() const { return mFiles; } - void SetFiles(const nsTArray>& aFiles, bool aSetValueChanged); + void SetFiles(const nsTArray>& aFiles, bool aSetValueChanged); void SetFiles(nsIDOMFileList* aFiles, bool aSetValueChanged); // Called when a nsIFilePicker or a nsIColorPicker terminate. @@ -1252,7 +1252,7 @@ protected: * the frame. Whenever the frame wants to change the filename it has to call * SetFileNames to update this member. */ - nsTArray> mFiles; + nsTArray> mFiles; nsRefPtr mFileList; diff --git a/content/media/EncodedBufferCache.cpp b/content/media/EncodedBufferCache.cpp index 66b8f6c86127..ddb927c8f53b 100644 --- a/content/media/EncodedBufferCache.cpp +++ b/content/media/EncodedBufferCache.cpp @@ -5,8 +5,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "EncodedBufferCache.h" +#include "mozilla/dom/File.h" #include "nsAnonymousTemporaryFile.h" -#include "nsDOMFile.h" #include "prio.h" namespace mozilla { @@ -39,16 +39,16 @@ EncodedBufferCache::AppendBuffer(nsTArray & aBuf) } -already_AddRefed +already_AddRefed EncodedBufferCache::ExtractBlob(nsISupports* aParent, const nsAString &aContentType) { MutexAutoLock lock(mMutex); - nsRefPtr blob; + nsRefPtr blob; if (mTempFileEnabled) { // generate new temporary file to write - blob = dom::DOMFile::CreateTemporaryFileBlob(aParent, mFD, 0, mDataSize, - aContentType); + blob = dom::File::CreateTemporaryFileBlob(aParent, mFD, 0, mDataSize, + aContentType); // fallback to memory blob mTempFileEnabled = false; mDataSize = 0; @@ -63,8 +63,8 @@ EncodedBufferCache::ExtractBlob(nsISupports* aParent, mEncodedBuffers.ElementAt(i).Length()); offset += mEncodedBuffers.ElementAt(i).Length(); } - blob = dom::DOMFile::CreateMemoryFile(aParent, blobData, mDataSize, - aContentType); + blob = dom::File::CreateMemoryFile(aParent, blobData, mDataSize, + aContentType); mEncodedBuffers.Clear(); } else return nullptr; diff --git a/content/media/EncodedBufferCache.h b/content/media/EncodedBufferCache.h index 94ec37bdb881..f7acf2327ef7 100644 --- a/content/media/EncodedBufferCache.h +++ b/content/media/EncodedBufferCache.h @@ -17,7 +17,7 @@ class nsIDOMBlob; namespace mozilla { namespace dom { -class DOMFile; +class File; } class ReentrantMonitor; @@ -43,7 +43,7 @@ public: // aBuf will append to mEncodedBuffers or temporary File, aBuf also be cleared void AppendBuffer(nsTArray & aBuf); // Read all buffer from memory or file System, also Remove the temporary file or clean the buffers in memory. - already_AddRefed ExtractBlob(nsISupports* aParent, const nsAString &aContentType); + already_AddRefed ExtractBlob(nsISupports* aParent, const nsAString &aContentType); private: //array for storing the encoded data. diff --git a/content/media/MediaRecorder.cpp b/content/media/MediaRecorder.cpp index 3c914aee857c..51510626ccd3 100644 --- a/content/media/MediaRecorder.cpp +++ b/content/media/MediaRecorder.cpp @@ -15,11 +15,11 @@ #include "mozilla/Preferences.h" #include "mozilla/dom/AudioStreamTrack.h" #include "mozilla/dom/BlobEvent.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/RecordErrorEvent.h" #include "mozilla/dom/VideoStreamTrack.h" #include "nsError.h" #include "nsIDocument.h" -#include "nsIDOMFile.h" #include "nsIPrincipal.h" #include "nsMimeTypes.h" #include "nsProxyRelease.h" @@ -923,7 +923,7 @@ MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed&& aBlob) init.mCancelable = false; nsCOMPtr blob = aBlob; - init.mData = static_cast(blob.get()); + init.mData = static_cast(blob.get()); nsRefPtr event = BlobEvent::Constructor(this, diff --git a/content/media/imagecapture/CaptureTask.cpp b/content/media/imagecapture/CaptureTask.cpp index 3cd540b16ec4..4621a1e4ae0a 100644 --- a/content/media/imagecapture/CaptureTask.cpp +++ b/content/media/imagecapture/CaptureTask.cpp @@ -15,18 +15,18 @@ namespace mozilla { nsresult -CaptureTask::TaskComplete(already_AddRefed aBlob, nsresult aRv) +CaptureTask::TaskComplete(already_AddRefed aBlob, nsresult aRv) { MOZ_ASSERT(NS_IsMainThread()); DetachStream(); nsresult rv; - nsRefPtr blob(aBlob); + nsRefPtr blob(aBlob); // We have to set the parent because the blob has been generated with a valid one. if (blob) { - blob = new dom::DOMFile(mImageCapture->GetParentObject(), blob->Impl()); + blob = new dom::File(mImageCapture->GetParentObject(), blob->Impl()); } if (mPrincipalChanged) { @@ -104,9 +104,9 @@ CaptureTask::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, TrackID aID, public: explicit EncodeComplete(CaptureTask* aTask) : mTask(aTask) {} - nsresult ReceiveBlob(already_AddRefed aBlob) MOZ_OVERRIDE + nsresult ReceiveBlob(already_AddRefed aBlob) MOZ_OVERRIDE { - nsRefPtr blob(aBlob); + nsRefPtr blob(aBlob); mTask->TaskComplete(blob.forget(), NS_OK); mTask = nullptr; return NS_OK; diff --git a/content/media/imagecapture/CaptureTask.h b/content/media/imagecapture/CaptureTask.h index 2f91dc7eedfa..a706f93c7b57 100644 --- a/content/media/imagecapture/CaptureTask.h +++ b/content/media/imagecapture/CaptureTask.h @@ -13,8 +13,8 @@ namespace mozilla { namespace dom { +class File; class ImageCapture; -class DOMFile; } /** @@ -51,7 +51,7 @@ public: // // Note: // this function should be called on main thread. - nsresult TaskComplete(already_AddRefed aBlob, nsresult aRv); + nsresult TaskComplete(already_AddRefed aBlob, nsresult aRv); // Add listeners into MediaStream and PrincipalChangeObserver. It should be on // main thread only. diff --git a/content/media/imagecapture/ImageCapture.cpp b/content/media/imagecapture/ImageCapture.cpp index 2e355da31223..98f620e55805 100644 --- a/content/media/imagecapture/ImageCapture.cpp +++ b/content/media/imagecapture/ImageCapture.cpp @@ -7,11 +7,11 @@ #include "ImageCapture.h" #include "mozilla/dom/BlobEvent.h" #include "mozilla/dom/DOMException.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ImageCaptureError.h" #include "mozilla/dom/ImageCaptureErrorEvent.h" #include "mozilla/dom/ImageCaptureErrorEventBinding.h" #include "mozilla/dom/VideoStreamTrack.h" -#include "nsDOMFile.h" #include "nsIDocument.h" #include "CaptureTask.h" #include "MediaEngine.h" @@ -102,9 +102,9 @@ ImageCapture::TakePhotoByMediaEngine() mPrincipalChanged = true; } - nsresult PhotoComplete(already_AddRefed aBlob) MOZ_OVERRIDE + nsresult PhotoComplete(already_AddRefed aBlob) MOZ_OVERRIDE { - nsRefPtr blob = aBlob; + nsRefPtr blob = aBlob; if (mPrincipalChanged) { return PhotoError(NS_ERROR_DOM_SECURITY_ERR); @@ -172,7 +172,7 @@ ImageCapture::TakePhoto(ErrorResult& aResult) } nsresult -ImageCapture::PostBlobEvent(DOMFile* aBlob) +ImageCapture::PostBlobEvent(File* aBlob) { MOZ_ASSERT(NS_IsMainThread()); if (!CheckPrincipal()) { diff --git a/content/media/imagecapture/ImageCapture.h b/content/media/imagecapture/ImageCapture.h index bd552a17c8d4..ca7dfc643753 100644 --- a/content/media/imagecapture/ImageCapture.h +++ b/content/media/imagecapture/ImageCapture.h @@ -32,7 +32,7 @@ PRLogModuleInfo* GetICLog(); namespace dom { -class DOMFile; +class File; class VideoStreamTrack; /** @@ -80,7 +80,7 @@ public: ImageCapture(VideoStreamTrack* aVideoStreamTrack, nsPIDOMWindow* aOwnerWindow); // Post a Blob event to script. - nsresult PostBlobEvent(DOMFile* aBlob); + nsresult PostBlobEvent(File* aBlob); // Post an error event to script. // aErrorCode should be one of error codes defined in ImageCaptureError.h. diff --git a/content/media/webrtc/MediaEngine.h b/content/media/webrtc/MediaEngine.h index 3dff908fd871..5c19d6bc5678 100644 --- a/content/media/webrtc/MediaEngine.h +++ b/content/media/webrtc/MediaEngine.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { -class DOMFile; +class File; } struct VideoTrackConstraintsN; @@ -150,7 +150,7 @@ public: // aBlob is the image captured by MediaEngineSource. It is // called on main thread. - virtual nsresult PhotoComplete(already_AddRefed aBlob) = 0; + virtual nsresult PhotoComplete(already_AddRefed aBlob) = 0; // It is called on main thread. aRv is the error code. virtual nsresult PhotoError(nsresult aRv) = 0; diff --git a/content/media/webrtc/MediaEngineDefault.cpp b/content/media/webrtc/MediaEngineDefault.cpp index debf9e9676f7..0e87fce82454 100644 --- a/content/media/webrtc/MediaEngineDefault.cpp +++ b/content/media/webrtc/MediaEngineDefault.cpp @@ -5,7 +5,7 @@ #include "MediaEngineDefault.h" #include "nsCOMPtr.h" -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "nsILocalFile.h" #include "Layers.h" #include "ImageContainer.h" @@ -208,7 +208,7 @@ MediaEngineDefaultVideoSource::Snapshot(uint32_t aDuration, nsIDOMFile** aFile) return NS_OK; } - nsCOMPtr domFile = dom::DOMFile::CreateFromFile(nullptr, localFile); + nsCOMPtr domFile = dom::File::CreateFromFile(nullptr, localFile); domFile.forget(aFile); return NS_OK; #endif diff --git a/content/media/webrtc/MediaEngineWebRTC.h b/content/media/webrtc/MediaEngineWebRTC.h index 12ec8cbcfb22..79edfafe2d59 100644 --- a/content/media/webrtc/MediaEngineWebRTC.h +++ b/content/media/webrtc/MediaEngineWebRTC.h @@ -10,10 +10,10 @@ #include "nsIThread.h" #include "nsIRunnable.h" +#include "mozilla/dom/File.h" #include "mozilla/Mutex.h" #include "mozilla/Monitor.h" #include "nsCOMPtr.h" -#include "nsDOMFile.h" #include "nsThreadUtils.h" #include "DOMMediaStream.h" #include "nsDirectoryServiceDefs.h" diff --git a/content/media/webrtc/MediaEngineWebRTCVideo.cpp b/content/media/webrtc/MediaEngineWebRTCVideo.cpp index 0e287988622d..45160fc02c3a 100644 --- a/content/media/webrtc/MediaEngineWebRTCVideo.cpp +++ b/content/media/webrtc/MediaEngineWebRTCVideo.cpp @@ -943,11 +943,11 @@ MediaEngineWebRTCVideoSource::OnTakePictureComplete(uint8_t* aData, uint32_t aLe NS_IMETHOD Run() { - nsRefPtr blob = - dom::DOMFile::CreateMemoryFile(nullptr, mPhoto.Elements(), mPhoto.Length(), mMimeType); + nsRefPtr blob = + dom::File::CreateMemoryFile(nullptr, mPhoto.Elements(), mPhoto.Length(), mMimeType); uint32_t callbackCounts = mCallbacks.Length(); for (uint8_t i = 0; i < callbackCounts; i++) { - nsRefPtr tempBlob = blob; + nsRefPtr tempBlob = blob; mCallbacks[i]->PhotoComplete(tempBlob.forget()); } // PhotoCallback needs to dereference on main thread. diff --git a/dom/archivereader/ArchiveEvent.cpp b/dom/archivereader/ArchiveEvent.cpp index d4536c864dde..5f63b6038640 100644 --- a/dom/archivereader/ArchiveEvent.cpp +++ b/dom/archivereader/ArchiveEvent.cpp @@ -130,7 +130,7 @@ ArchiveReaderEvent::ShareMainThread() } } - // This is a nsDOMFile: + // This is a File: nsRefPtr file = item->File(mArchiveReader); if (file) { fileList.AppendElement(file); diff --git a/dom/archivereader/ArchiveEvent.h b/dom/archivereader/ArchiveEvent.h index 34e5d00acf2d..343d3989e5d9 100644 --- a/dom/archivereader/ArchiveEvent.h +++ b/dom/archivereader/ArchiveEvent.h @@ -9,9 +9,9 @@ #include "ArchiveReader.h" +#include "mozilla/dom/File.h" #include "nsISeekableStream.h" #include "nsIMIMEService.h" -#include "nsDOMFile.h" #include "ArchiveReaderCommon.h" @@ -35,7 +35,7 @@ public: // Getter for the filename virtual nsresult GetFilename(nsString& aFilename) = 0; - // Generate a DOMFile + // Generate a File virtual nsIDOMFile* File(ArchiveReader* aArchiveReader) = 0; protected: diff --git a/dom/archivereader/ArchiveReader.cpp b/dom/archivereader/ArchiveReader.cpp index 4b683e19f59d..08f16edd3b32 100644 --- a/dom/archivereader/ArchiveReader.cpp +++ b/dom/archivereader/ArchiveReader.cpp @@ -9,14 +9,14 @@ #include "ArchiveEvent.h" #include "ArchiveZipEvent.h" -#include "nsDOMFile.h" #include "nsIURI.h" #include "nsNetUtil.h" #include "mozilla/dom/ArchiveReaderBinding.h" #include "mozilla/dom/BindingDeclarations.h" -#include "mozilla/Preferences.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/EncodingUtils.h" +#include "mozilla/Preferences.h" using namespace mozilla; using namespace mozilla::dom; @@ -24,7 +24,7 @@ USING_ARCHIVEREADER_NAMESPACE /* static */ already_AddRefed ArchiveReader::Constructor(const GlobalObject& aGlobal, - DOMFile& aBlob, + File& aBlob, const ArchiveReaderOptions& aOptions, ErrorResult& aError) { @@ -46,7 +46,7 @@ ArchiveReader::Constructor(const GlobalObject& aGlobal, return reader.forget(); } -ArchiveReader::ArchiveReader(DOMFile& aBlob, nsPIDOMWindow* aWindow, +ArchiveReader::ArchiveReader(File& aBlob, nsPIDOMWindow* aWindow, const nsACString& aEncoding) : mBlob(&aBlob) , mWindow(aWindow) diff --git a/dom/archivereader/ArchiveReader.h b/dom/archivereader/ArchiveReader.h index 6e38d1bfd54f..96182e6ce00a 100644 --- a/dom/archivereader/ArchiveReader.h +++ b/dom/archivereader/ArchiveReader.h @@ -19,7 +19,7 @@ namespace mozilla { namespace dom { struct ArchiveReaderOptions; -class DOMFile; +class File; class GlobalObject; } // namespace dom } // namespace mozilla @@ -39,10 +39,10 @@ public: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ArchiveReader) static already_AddRefed - Constructor(const GlobalObject& aGlobal, DOMFile& aBlob, + Constructor(const GlobalObject& aGlobal, File& aBlob, const ArchiveReaderOptions& aOptions, ErrorResult& aError); - ArchiveReader(DOMFile& aBlob, nsPIDOMWindow* aWindow, + ArchiveReader(File& aBlob, nsPIDOMWindow* aWindow, const nsACString& aEncoding); nsIDOMWindow* GetParentObject() const @@ -76,7 +76,7 @@ private: protected: // The archive blob/file - nsRefPtr mBlob; + nsRefPtr mBlob; // The window is needed by the requests nsCOMPtr mWindow; diff --git a/dom/archivereader/ArchiveZipEvent.cpp b/dom/archivereader/ArchiveZipEvent.cpp index f6d6da5e8492..e17e5a174b21 100644 --- a/dom/archivereader/ArchiveZipEvent.cpp +++ b/dom/archivereader/ArchiveZipEvent.cpp @@ -74,7 +74,7 @@ ArchiveZipItem::GetFilename(nsString& aFilename) return NS_OK; } -// From zipItem to DOMFile: +// From zipItem to File: nsIDOMFile* ArchiveZipItem::File(ArchiveReader* aArchiveReader) { @@ -84,7 +84,7 @@ ArchiveZipItem::File(ArchiveReader* aArchiveReader) return nullptr; } - return new DOMFile(aArchiveReader, + return new dom::File(aArchiveReader, new ArchiveZipFileImpl(filename, NS_ConvertUTF8toUTF16(GetType()), StrToInt32(mCentralStruct.orglen), diff --git a/dom/archivereader/ArchiveZipEvent.h b/dom/archivereader/ArchiveZipEvent.h index 35b756a365a7..bb75ba821cf9 100644 --- a/dom/archivereader/ArchiveZipEvent.h +++ b/dom/archivereader/ArchiveZipEvent.h @@ -30,7 +30,7 @@ protected: public: nsresult GetFilename(nsString& aFilename) MOZ_OVERRIDE; - // From zipItem to DOMFile: + // From zipItem to File: virtual nsIDOMFile* File(ArchiveReader* aArchiveReader) MOZ_OVERRIDE; public: // for the event diff --git a/dom/archivereader/ArchiveZipFile.cpp b/dom/archivereader/ArchiveZipFile.cpp index cbf93061d413..25dc7180248a 100644 --- a/dom/archivereader/ArchiveZipFile.cpp +++ b/dom/archivereader/ArchiveZipFile.cpp @@ -7,10 +7,10 @@ #include "ArchiveZipFile.h" #include "ArchiveZipEvent.h" -#include "nsDOMFile.h" #include "nsIInputStream.h" #include "zlib.h" #include "mozilla/Attributes.h" +#include "mozilla/dom/File.h" using namespace mozilla::dom; USING_ARCHIVEREADER_NAMESPACE @@ -398,16 +398,16 @@ ArchiveZipFileImpl::Traverse(nsCycleCollectionTraversalCallback &cb) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArchiveReader); } -already_AddRefed +already_AddRefed ArchiveZipFileImpl::CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) { - nsRefPtr impl = + nsRefPtr impl = new ArchiveZipFileImpl(mFilename, mContentType, aStart, mLength, mCentral, mArchiveReader); return impl.forget(); } -NS_IMPL_ISUPPORTS_INHERITED0(ArchiveZipFileImpl, DOMFileImpl) +NS_IMPL_ISUPPORTS_INHERITED0(ArchiveZipFileImpl, FileImpl) diff --git a/dom/archivereader/ArchiveZipFile.h b/dom/archivereader/ArchiveZipFile.h index 31dd8548e878..fe605a2d3cb6 100644 --- a/dom/archivereader/ArchiveZipFile.h +++ b/dom/archivereader/ArchiveZipFile.h @@ -8,7 +8,7 @@ #define mozilla_dom_archivereader_domarchivefile_h__ #include "mozilla/Attributes.h" -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "ArchiveReader.h" @@ -18,9 +18,9 @@ BEGIN_ARCHIVEREADER_NAMESPACE /** - * ArchiveZipFileImpl to DOMFileImpl + * ArchiveZipFileImpl to FileImpl */ -class ArchiveZipFileImpl : public DOMFileImplBase +class ArchiveZipFileImpl : public FileImplBase { public: NS_DECL_ISUPPORTS_INHERITED @@ -30,7 +30,7 @@ public: uint64_t aLength, ZipCentral& aCentral, ArchiveReader* aReader) - : DOMFileImplBase(aName, aContentType, aLength), + : FileImplBase(aName, aContentType, aLength), mCentral(aCentral), mArchiveReader(aReader), mFilename(aName) @@ -45,7 +45,7 @@ public: uint64_t aLength, ZipCentral& aCentral, ArchiveReader* aReader) - : DOMFileImplBase(aContentType, aStart, aLength), + : FileImplBase(aContentType, aStart, aLength), mCentral(aCentral), mArchiveReader(aReader), mFilename(aName) @@ -71,7 +71,7 @@ protected: MOZ_COUNT_DTOR(ArchiveZipFileImpl); } - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE; diff --git a/dom/base/ImageEncoder.cpp b/dom/base/ImageEncoder.cpp index e2da60cfecc7..ad558867f92c 100644 --- a/dom/base/ImageEncoder.cpp +++ b/dom/base/ImageEncoder.cpp @@ -89,8 +89,8 @@ public: if (!mFailed) { // The correct parentObject has to be set by the mEncodeCompleteCallback. - nsRefPtr blob = - DOMFile::CreateMemoryFile(nullptr, mImgData, mImgSize, mType); + nsRefPtr blob = + File::CreateMemoryFile(nullptr, mImgData, mImgSize, mType); MOZ_ASSERT(blob); rv = mEncodeCompleteCallback->ReceiveBlob(blob.forget()); diff --git a/dom/base/ImageEncoder.h b/dom/base/ImageEncoder.h index 61aeeb41abbb..65965ad059cc 100644 --- a/dom/base/ImageEncoder.h +++ b/dom/base/ImageEncoder.h @@ -7,8 +7,8 @@ #define ImageEncoder_h #include "imgIEncoder.h" -#include "nsDOMFile.h" #include "nsError.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/HTMLCanvasElementBinding.h" #include "nsLayoutUtils.h" #include "nsNetUtil.h" @@ -115,7 +115,7 @@ class EncodeCompleteCallback public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EncodeCompleteCallback) - virtual nsresult ReceiveBlob(already_AddRefed aBlob) = 0; + virtual nsresult ReceiveBlob(already_AddRefed aBlob) = 0; protected: virtual ~EncodeCompleteCallback() {} diff --git a/dom/base/MessagePort.cpp b/dom/base/MessagePort.cpp index 92e963fa06db..b0e265b81776 100644 --- a/dom/base/MessagePort.cpp +++ b/dom/base/MessagePort.cpp @@ -7,12 +7,12 @@ #include "MessageEvent.h" #include "mozilla/dom/BlobBinding.h" #include "mozilla/dom/Event.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/MessageChannel.h" #include "mozilla/dom/MessagePortBinding.h" #include "mozilla/dom/MessagePortList.h" #include "mozilla/dom/StructuredCloneTags.h" #include "nsContentUtils.h" -#include "nsDOMFile.h" #include "nsGlobalWindow.h" #include "nsPresContext.h" #include "ScriptSettings.h" @@ -110,20 +110,20 @@ PostMessageReadStructuredClone(JSContext* cx, if (tag == SCTAG_DOM_BLOB) { NS_ASSERTION(!data, "Data should be empty"); - // What we get back from the reader is a DOMFileImpl. - // From that we create a new DOMFile. - DOMFileImpl* blobImpl; + // What we get back from the reader is a FileImpl. + // From that we create a new File. + FileImpl* blobImpl; if (JS_ReadBytes(reader, &blobImpl, sizeof(blobImpl))) { MOZ_ASSERT(blobImpl); - // nsRefPtr needs to go out of scope before toObjectOrNull() is + // nsRefPtr needs to go out of scope before toObjectOrNull() is // called because the static analysis thinks dereferencing XPCOM objects // can GC (because in some cases it can!), and a return statement with a // JSObject* type means that JSObject* is on the stack as a raw pointer // while destructors are running. JS::Rooted val(cx); { - nsRefPtr blob = new DOMFile(scInfo->mPort->GetParentObject(), + nsRefPtr blob = new File(scInfo->mPort->GetParentObject(), blobImpl); if (!WrapNewBindingObject(cx, blob, &val)) { return nullptr; @@ -167,9 +167,9 @@ PostMessageWriteStructuredClone(JSContext* cx, // See if this is a File/Blob object. { - DOMFile* blob = nullptr; + File* blob = nullptr; if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, obj, blob))) { - DOMFileImpl* blobImpl = blob->Impl(); + FileImpl* blobImpl = blob->Impl(); if (JS_WriteUint32Pair(writer, SCTAG_DOM_BLOB, 0) && JS_WriteBytes(writer, &blobImpl, sizeof(blobImpl))) { scInfo->mEvent->StoreISupports(blobImpl); diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 1e589d80a6bc..1e1cfe7fedb6 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -13,7 +13,7 @@ #include "nsMimeTypeArray.h" #include "mozilla/MemoryReporting.h" #include "mozilla/dom/DesktopNotification.h" -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "nsGeolocation.h" #include "nsIHttpProtocolHandler.h" #include "nsIContentPolicy.h" @@ -1158,7 +1158,7 @@ Navigator::SendBeacon(const nsAString& aUrl, in = strStream; } else if (aData.Value().IsBlob()) { - DOMFile& blob = aData.Value().GetAsBlob(); + File& blob = aData.Value().GetAsBlob(); rv = blob.GetInternalStream(getter_AddRefs(in)); if (NS_FAILED(rv)) { aRv.Throw(NS_ERROR_FAILURE); diff --git a/dom/base/URL.cpp b/dom/base/URL.cpp index 32ac6929071c..4e651efb79fb 100644 --- a/dom/base/URL.cpp +++ b/dom/base/URL.cpp @@ -6,8 +6,8 @@ #include "URL.h" #include "nsGlobalWindow.h" -#include "nsDOMFile.h" #include "DOMMediaStream.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/MediaSource.h" #include "mozilla/dom/URLBinding.h" #include "nsHostObjectProtocolHandler.h" @@ -111,7 +111,7 @@ URL::Constructor(const GlobalObject& aGlobal, const nsAString& aUrl, void URL::CreateObjectURL(const GlobalObject& aGlobal, - DOMFile& aBlob, + File& aBlob, const objectURLOptions& aOptions, nsString& aResult, ErrorResult& aError) diff --git a/dom/base/URL.h b/dom/base/URL.h index eb8c077d3763..54a82a9e6e4a 100644 --- a/dom/base/URL.h +++ b/dom/base/URL.h @@ -23,7 +23,7 @@ class DOMMediaStream; namespace dom { -class DOMFile; +class File; class MediaSource; class GlobalObject; struct objectURLOptions; @@ -54,7 +54,7 @@ public: const nsAString& aBase, ErrorResult& aRv); static void CreateObjectURL(const GlobalObject& aGlobal, - DOMFile& aBlob, + File& aBlob, const objectURLOptions& aOptions, nsString& aResult, ErrorResult& aError); diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 008471b5ce21..22cdecc27c17 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -48,11 +48,11 @@ #include "nsComputedDOMStyle.h" #include "nsIPresShell.h" #include "nsCSSProps.h" -#include "nsDOMFile.h" #include "nsTArrayHelpers.h" #include "nsIDocShell.h" #include "nsIContentViewer.h" #include "mozilla/StyleAnimationValue.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/DOMRect.h" #include @@ -2861,7 +2861,7 @@ nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile, return NS_ERROR_FAILURE; } - nsRefPtr file = DOMFile::CreateFromFile(innerWindow, aFile); + nsRefPtr file = File::CreateFromFile(innerWindow, aFile); file.forget(aDOMFile); return NS_OK; } diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 1fb2d04c1c09..c8578f4bfee2 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -122,7 +122,6 @@ #include "nsAutoPtr.h" #include "nsContentUtils.h" #include "nsCSSProps.h" -#include "nsIDOMFile.h" #include "nsIDOMFileList.h" #include "nsIURIFixup.h" #ifndef DEBUG @@ -7884,20 +7883,20 @@ PostMessageReadStructuredClone(JSContext* cx, if (tag == SCTAG_DOM_BLOB) { NS_ASSERTION(!data, "Data should be empty"); - // What we get back from the reader is a DOMFileImpl. - // From that we create a new DOMFile. - DOMFileImpl* blobImpl; + // What we get back from the reader is a FileImpl. + // From that we create a new File. + FileImpl* blobImpl; if (JS_ReadBytes(reader, &blobImpl, sizeof(blobImpl))) { MOZ_ASSERT(blobImpl); - // nsRefPtr needs to go out of scope before toObjectOrNull() is + // nsRefPtr needs to go out of scope before toObjectOrNull() is // called because the static analysis thinks dereferencing XPCOM objects // can GC (because in some cases it can!), and a return statement with a // JSObject* type means that JSObject* is on the stack as a raw pointer // while destructors are running. JS::Rooted val(cx); { - nsRefPtr blob = new DOMFile(scInfo->window, blobImpl); + nsRefPtr blob = new File(scInfo->window, blobImpl); if (!WrapNewBindingObject(cx, blob, &val)) { return nullptr; } @@ -7940,9 +7939,9 @@ PostMessageWriteStructuredClone(JSContext* cx, // See if this is a File/Blob object. { - DOMFile* blob = nullptr; + File* blob = nullptr; if (scInfo->subsumes && NS_SUCCEEDED(UNWRAP_OBJECT(Blob, obj, blob))) { - DOMFileImpl* blobImpl = blob->Impl(); + FileImpl* blobImpl = blob->Impl(); if (JS_WriteUint32Pair(writer, SCTAG_DOM_BLOB, 0) && JS_WriteBytes(writer, &blobImpl, sizeof(blobImpl))) { scInfo->event->StoreISupports(blobImpl); diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 308d9ee74c1f..20ae2c5903ab 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -137,8 +137,8 @@ DOMInterfaces = { }, 'Blob': { - 'nativeType': 'mozilla::dom::DOMFile', - 'headerFile': 'nsDOMFile.h', + 'nativeType': 'mozilla::dom::File', + 'headerFile': 'mozilla/dom/File.h', }, 'BatteryManager': { @@ -400,13 +400,8 @@ DOMInterfaces = { }, }, -'File': { - 'nativeType': 'mozilla::dom::DOMFile', - 'headerFile': 'nsDOMFile.h', -}, - 'FileList': { - 'headerFile': 'nsDOMFile.h', + 'headerFile': 'mozilla/dom/File.h', }, 'FileReader': { diff --git a/dom/bluetooth/BluetoothAdapter.cpp b/dom/bluetooth/BluetoothAdapter.cpp index b92103bd6d55..4009e428148b 100644 --- a/dom/bluetooth/BluetoothAdapter.cpp +++ b/dom/bluetooth/BluetoothAdapter.cpp @@ -8,7 +8,6 @@ #include "nsDOMClassInfo.h" #include "nsTArrayHelpers.h" #include "DOMRequest.h" -#include "nsDOMFile.h" #include "nsThreadUtils.h" #include "mozilla/dom/bluetooth/BluetoothTypes.h" @@ -17,6 +16,7 @@ #include "mozilla/dom/BluetoothDiscoveryStateChangedEvent.h" #include "mozilla/dom/BluetoothStatusChangedEvent.h" #include "mozilla/dom/ContentChild.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/LazyIdleThread.h" @@ -771,7 +771,7 @@ BluetoothAdapter::IsConnected(const uint16_t aServiceUuid, ErrorResult& aRv) already_AddRefed BluetoothAdapter::SendFile(const nsAString& aDeviceAddress, - DOMFile& aBlob, ErrorResult& aRv) + File& aBlob, ErrorResult& aRv) { nsCOMPtr win = GetOwner(); if (!win) { diff --git a/dom/bluetooth/BluetoothAdapter.h b/dom/bluetooth/BluetoothAdapter.h index 69a76635c9aa..e0798f837588 100644 --- a/dom/bluetooth/BluetoothAdapter.h +++ b/dom/bluetooth/BluetoothAdapter.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { -class DOMFile; +class File; class DOMRequest; struct MediaMetaData; struct MediaPlayStatus; @@ -134,7 +134,7 @@ public: GetConnectedDevices(uint16_t aServiceUuid, ErrorResult& aRv); already_AddRefed - SendFile(const nsAString& aDeviceAddress, DOMFile& aBlob, + SendFile(const nsAString& aDeviceAddress, File& aBlob, ErrorResult& aRv); already_AddRefed StopSendingFile(const nsAString& aDeviceAddress, ErrorResult& aRv); diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp index 6a804d2bc571..555a9e9b1d23 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp @@ -15,12 +15,12 @@ #include "mozilla/dom/bluetooth/BluetoothTypes.h" #include "mozilla/dom/ipc/BlobParent.h" +#include "mozilla/dom/File.h" #include "mozilla/RefPtr.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "nsAutoPtr.h" #include "nsCExternalHandlerService.h" -#include "nsDOMFile.h" #include "nsIObserver.h" #include "nsIObserverService.h" #include "nsIFile.h" @@ -350,8 +350,8 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress, { MOZ_ASSERT(NS_IsMainThread()); - nsRefPtr impl = aActor->GetBlobImpl(); - nsCOMPtr blob = new DOMFile(nullptr, impl); + nsRefPtr impl = aActor->GetBlobImpl(); + nsCOMPtr blob = new File(nullptr, impl); return SendFile(aDeviceAddress, blob.get()); } diff --git a/dom/bluetooth/bluez/BluetoothOppManager.cpp b/dom/bluetooth/bluez/BluetoothOppManager.cpp index c198bce38111..021a706a9e38 100644 --- a/dom/bluetooth/bluez/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluez/BluetoothOppManager.cpp @@ -14,13 +14,13 @@ #include "ObexBase.h" #include "mozilla/dom/bluetooth/BluetoothTypes.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/RefPtr.h" #include "mozilla/Services.h" #include "mozilla/StaticPtr.h" #include "nsAutoPtr.h" #include "nsCExternalHandlerService.h" -#include "nsDOMFile.h" #include "nsIObserver.h" #include "nsIObserverService.h" #include "nsIFile.h" @@ -372,8 +372,8 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress, { MOZ_ASSERT(NS_IsMainThread()); - nsRefPtr impl = aActor->GetBlobImpl(); - nsCOMPtr blob = new DOMFile(nullptr, impl); + nsRefPtr impl = aActor->GetBlobImpl(); + nsCOMPtr blob = new File(nullptr, impl); return SendFile(aDeviceAddress, blob.get()); } diff --git a/dom/camera/DOMCameraControl.cpp b/dom/camera/DOMCameraControl.cpp index 4f4209293908..1168c20796ca 100644 --- a/dom/camera/DOMCameraControl.cpp +++ b/dom/camera/DOMCameraControl.cpp @@ -10,6 +10,7 @@ #include "nsThread.h" #include "DeviceStorage.h" #include "DeviceStorageFileDescriptor.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/TabChild.h" #include "mozilla/ipc/FileDescriptorUtils.h" #include "mozilla/MediaManager.h" @@ -20,7 +21,6 @@ #include "nsIDOMDeviceStorage.h" #include "nsIDOMEventListener.h" #include "nsIScriptSecurityManager.h" -#include "nsDOMFile.h" #include "Navigator.h" #include "nsXULAppAPI.h" #include "DOMCameraManager.h" @@ -1445,7 +1445,7 @@ nsDOMCameraControl::OnTakePictureComplete(nsIDOMBlob* aPicture) promise->MaybeResolve(picture); } - nsRefPtr blob = static_cast(aPicture); + nsRefPtr blob = static_cast(aPicture); nsRefPtr cb = mTakePictureOnSuccessCb.forget(); mTakePictureOnErrorCb = nullptr; diff --git a/dom/camera/DOMCameraControlListener.cpp b/dom/camera/DOMCameraControlListener.cpp index f5a9847c5aae..ae9538840f2a 100644 --- a/dom/camera/DOMCameraControlListener.cpp +++ b/dom/camera/DOMCameraControlListener.cpp @@ -4,11 +4,11 @@ #include "DOMCameraControlListener.h" #include "nsThreadUtils.h" -#include "nsDOMFile.h" #include "CameraCommon.h" #include "DOMCameraControl.h" #include "CameraPreviewMediaStream.h" #include "mozilla/dom/CameraManagerBinding.h" +#include "mozilla/dom/File.h" using namespace mozilla; using namespace mozilla::dom; @@ -348,10 +348,10 @@ DOMCameraControlListener::OnTakePictureComplete(uint8_t* aData, uint32_t aLength RunCallback(nsDOMCameraControl* aDOMCameraControl) MOZ_OVERRIDE { nsCOMPtr picture = - DOMFile::CreateMemoryFile(mDOMCameraControl, - static_cast(mData), - static_cast(mLength), - mMimeType); + File::CreateMemoryFile(mDOMCameraControl, + static_cast(mData), + static_cast(mLength), + mMimeType); aDOMCameraControl->OnTakePictureComplete(picture); } diff --git a/dom/contacts/tests/test_contacts_blobs.html b/dom/contacts/tests/test_contacts_blobs.html index 32e3376d865b..f83d55a12dde 100644 --- a/dom/contacts/tests/test_contacts_blobs.html +++ b/dom/contacts/tests/test_contacts_blobs.html @@ -93,9 +93,9 @@ function verifyBlob(blob1, blob2, isLast) is(blob2 instanceof Blob, true, "blob2 is an instance of DOMBlob"); isnot(blob1 instanceof File, true, - "blob1 is an instance of DOMFile"); + "blob1 is an instance of File"); isnot(blob2 instanceof File, true, - "blob2 is an instance of DOMFile"); + "blob2 is an instance of File"); ise(blob1.size, blob2.size, "Same size"); ise(blob1.type, blob2.type, "Same type"); diff --git a/dom/devicestorage/DeviceStorageRequestChild.cpp b/dom/devicestorage/DeviceStorageRequestChild.cpp index c94b45ac9c95..b7c42a4b26d7 100644 --- a/dom/devicestorage/DeviceStorageRequestChild.cpp +++ b/dom/devicestorage/DeviceStorageRequestChild.cpp @@ -7,7 +7,7 @@ #include "DeviceStorageRequestChild.h" #include "DeviceStorageFileDescriptor.h" #include "nsDeviceStorage.h" -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ipc/BlobChild.h" namespace mozilla { @@ -103,8 +103,8 @@ DeviceStorageRequestChild:: { BlobResponse r = aValue; BlobChild* actor = static_cast(r.blobChild()); - nsRefPtr bloblImpl = actor->GetBlobImpl(); - nsRefPtr blob = new DOMFile(mRequest->GetParentObject(), bloblImpl); + nsRefPtr bloblImpl = actor->GetBlobImpl(); + nsRefPtr blob = new File(mRequest->GetParentObject(), bloblImpl); AutoJSContext cx; diff --git a/dom/devicestorage/DeviceStorageRequestParent.cpp b/dom/devicestorage/DeviceStorageRequestParent.cpp index 0776626fc364..6481c3cf99da 100644 --- a/dom/devicestorage/DeviceStorageRequestParent.cpp +++ b/dom/devicestorage/DeviceStorageRequestParent.cpp @@ -4,10 +4,10 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "DeviceStorageRequestParent.h" -#include "nsDOMFile.h" #include "nsIMIMEService.h" #include "nsCExternalHandlerService.h" #include "mozilla/unused.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ipc/BlobParent.h" #include "ContentParent.h" #include "nsProxyRelease.h" @@ -44,7 +44,7 @@ DeviceStorageRequestParent::Dispatch() new DeviceStorageFile(p.type(), p.storageName(), p.relpath()); BlobParent* bp = static_cast(p.blobParent()); - nsRefPtr blobImpl = bp->GetBlobImpl(); + nsRefPtr blobImpl = bp->GetBlobImpl(); nsCOMPtr stream; blobImpl->GetInternalStream(getter_AddRefs(stream)); @@ -67,7 +67,7 @@ DeviceStorageRequestParent::Dispatch() new DeviceStorageFile(p.type(), p.storageName(), p.relpath()); BlobParent* bp = static_cast(p.blobParent()); - nsRefPtr blobImpl = bp->GetBlobImpl(); + nsRefPtr blobImpl = bp->GetBlobImpl(); nsCOMPtr stream; blobImpl->GetInternalStream(getter_AddRefs(stream)); @@ -522,9 +522,9 @@ DeviceStorageRequestParent::PostBlobSuccessEvent::CancelableRun() { nsString fullPath; mFile->GetFullPath(fullPath); - nsRefPtr blob = new DOMFile(nullptr, - new DOMFileImplFile(fullPath, mime, mLength, mFile->mFile, - mLastModificationDate)); + nsRefPtr blob = new File(nullptr, + new FileImplFile(fullPath, mime, mLength, mFile->mFile, + mLastModificationDate)); ContentParent* cp = static_cast(mParent->Manager()); BlobParent* actor = cp->GetOrCreateActorForBlob(blob); diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index f17896f16b39..fac8f1b8457b 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -36,7 +36,6 @@ #include "nsIDirectoryEnumerator.h" #include "nsAppDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h" -#include "nsIDOMFile.h" #include "nsDOMBlobBuilder.h" #include "nsNetUtil.h" #include "nsCycleCollectionParticipant.h" @@ -1805,10 +1804,10 @@ nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile) MOZ_ASSERT(aFile->mLength != UINT64_MAX); MOZ_ASSERT(aFile->mLastModifiedDate != UINT64_MAX); - nsCOMPtr blob = new DOMFile(aWindow, - new DOMFileImplFile(fullPath, aFile->mMimeType, - aFile->mLength, aFile->mFile, - aFile->mLastModifiedDate)); + nsCOMPtr blob = new File(aWindow, + new FileImplFile(fullPath, aFile->mMimeType, + aFile->mLength, aFile->mFile, + aFile->mLastModifiedDate)); return InterfaceToJsval(aWindow, blob, &NS_GET_IID(nsIDOMBlob)); } @@ -2480,7 +2479,7 @@ private: class WriteFileEvent : public nsRunnable { public: - WriteFileEvent(DOMFileImpl* aBlobImpl, + WriteFileEvent(FileImpl* aBlobImpl, DeviceStorageFile *aFile, already_AddRefed aRequest, int32_t aRequestType) @@ -2546,7 +2545,7 @@ public: } private: - nsRefPtr mBlobImpl; + nsRefPtr mBlobImpl; nsRefPtr mFile; nsRefPtr mRequest; int32_t mRequestType; @@ -2915,7 +2914,7 @@ public: if (XRE_GetProcessType() != GeckoProcessType_Default) { BlobChild* actor = ContentChild::GetSingleton()->GetOrCreateActorForBlob( - static_cast(mBlob.get())); + static_cast(mBlob.get())); if (!actor) { return NS_ERROR_FAILURE; } @@ -2933,7 +2932,7 @@ public: return NS_OK; } - DOMFile* blob = static_cast(mBlob.get()); + File* blob = static_cast(mBlob.get()); r = new WriteFileEvent(blob->Impl(), mFile, mRequest.forget(), mRequestType); break; @@ -2961,7 +2960,7 @@ public: if (XRE_GetProcessType() != GeckoProcessType_Default) { BlobChild* actor = ContentChild::GetSingleton()->GetOrCreateActorForBlob( - static_cast(mBlob.get())); + static_cast(mBlob.get())); if (!actor) { return NS_ERROR_FAILURE; } @@ -2979,7 +2978,7 @@ public: return NS_OK; } - DOMFile* blob = static_cast(mBlob.get()); + File* blob = static_cast(mBlob.get()); r = new WriteFileEvent(blob->Impl(), mFile, mRequest.forget(), mRequestType); break; diff --git a/dom/events/DataTransfer.cpp b/dom/events/DataTransfer.cpp index 26fb7929d809..30ac19570ca4 100644 --- a/dom/events/DataTransfer.cpp +++ b/dom/events/DataTransfer.cpp @@ -303,8 +303,7 @@ DataTransfer::GetFiles(ErrorResult& aRv) if (!file) continue; - nsRefPtr domFile = - DOMFile::CreateFromFile(GetParentObject(), file); + nsRefPtr domFile = File::CreateFromFile(GetParentObject(), file); if (!mFiles->Append(domFile)) { aRv.Throw(NS_ERROR_FAILURE); diff --git a/dom/events/DataTransfer.h b/dom/events/DataTransfer.h index 1e869f7e4322..df393145fc53 100644 --- a/dom/events/DataTransfer.h +++ b/dom/events/DataTransfer.h @@ -16,8 +16,8 @@ #include "nsCycleCollectionParticipant.h" #include "nsAutoPtr.h" -#include "nsDOMFile.h" #include "mozilla/Attributes.h" +#include "mozilla/dom/File.h" class nsINode; class nsITransferable; diff --git a/dom/fetch/Request.cpp b/dom/fetch/Request.cpp index fe384594f905..092c271bc557 100644 --- a/dom/fetch/Request.cpp +++ b/dom/fetch/Request.cpp @@ -8,7 +8,6 @@ #include "nsIUnicodeDecoder.h" #include "nsIURI.h" -#include "nsDOMFile.h" #include "nsDOMString.h" #include "nsNetUtil.h" #include "nsPIDOMWindow.h" @@ -17,6 +16,7 @@ #include "mozilla/ErrorResult.h" #include "mozilla/dom/EncodingUtils.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/Headers.h" #include "mozilla/dom/Fetch.h" #include "mozilla/dom/Promise.h" @@ -357,11 +357,11 @@ Request::ConsumeBody(ConsumeType aType, ErrorResult& aRv) // with worker wrapping. uint32_t blobLen = buffer.Length(); void* blobData = moz_malloc(blobLen); - nsRefPtr blob; + nsRefPtr blob; if (blobData) { memcpy(blobData, buffer.BeginReading(), blobLen); - blob = DOMFile::CreateMemoryFile(GetParentObject(), blobData, blobLen, - NS_ConvertUTF8toUTF16(mMimeType)); + blob = File::CreateMemoryFile(GetParentObject(), blobData, blobLen, + NS_ConvertUTF8toUTF16(mMimeType)); } else { aRv = NS_ERROR_OUT_OF_MEMORY; return nullptr; diff --git a/dom/filehandle/FileHandle.cpp b/dom/filehandle/FileHandle.cpp index 74b1ffb77ccd..12a4cb624d87 100644 --- a/dom/filehandle/FileHandle.cpp +++ b/dom/filehandle/FileHandle.cpp @@ -13,11 +13,11 @@ #include "FileStreamWrappers.h" #include "MemoryStreams.h" #include "mozilla/dom/EncodingUtils.h" +#include "mozilla/dom/File.h" #include "MutableFile.h" #include "nsContentUtils.h" #include "nsDebug.h" #include "nsError.h" -#include "nsDOMFile.h" #include "nsIEventTarget.h" #include "nsISeekableStream.h" #include "nsNetUtil.h" @@ -622,10 +622,10 @@ FileHandleBase::GetInputStream(const ArrayBuffer& aValue, // static already_AddRefed -FileHandleBase::GetInputStream(const DOMFile& aValue, uint64_t* aInputLength, +FileHandleBase::GetInputStream(const File& aValue, uint64_t* aInputLength, ErrorResult& aRv) { - DOMFile& file = const_cast(aValue); + File& file = const_cast(aValue); uint64_t length = file.GetSize(aRv); if (aRv.Failed()) { return nullptr; diff --git a/dom/filehandle/FileHandle.h b/dom/filehandle/FileHandle.h index aba92ff40c97..f8a5db3f3591 100644 --- a/dom/filehandle/FileHandle.h +++ b/dom/filehandle/FileHandle.h @@ -25,7 +25,7 @@ class nsAString; namespace mozilla { namespace dom { -class DOMFile; +class File; class FileHelper; class FileRequestBase; class FileService; @@ -240,7 +240,7 @@ protected: ErrorResult& aRv); static already_AddRefed - GetInputStream(const DOMFile& aValue, uint64_t* aInputLength, + GetInputStream(const File& aValue, uint64_t* aInputLength, ErrorResult& aRv); static already_AddRefed diff --git a/dom/filesystem/CreateFileTask.cpp b/dom/filesystem/CreateFileTask.cpp index a47599508692..9b1bd7ac3564 100644 --- a/dom/filesystem/CreateFileTask.cpp +++ b/dom/filesystem/CreateFileTask.cpp @@ -10,12 +10,12 @@ #include "DOMError.h" #include "mozilla/Preferences.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/FileSystemBase.h" #include "mozilla/dom/FileSystemUtils.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/dom/ipc/BlobParent.h" -#include "nsDOMFile.h" #include "nsIFile.h" #include "nsNetUtil.h" #include "nsStringGlue.h" @@ -27,7 +27,7 @@ uint32_t CreateFileTask::sOutputBufferSize = 0; CreateFileTask::CreateFileTask(FileSystemBase* aFileSystem, const nsAString& aPath, - DOMFile* aBlobData, + File* aBlobData, InfallibleTArray& aArrayData, bool replace, ErrorResult& aRv) @@ -79,7 +79,7 @@ CreateFileTask::CreateFileTask(FileSystemBase* aFileSystem, } BlobParent* bp = static_cast(static_cast(data)); - nsRefPtr blobImpl = bp->GetBlobImpl(); + nsRefPtr blobImpl = bp->GetBlobImpl(); MOZ_ASSERT(blobImpl, "blobData should not be null."); nsresult rv = blobImpl->GetInternalStream(getter_AddRefs(mBlobStream)); @@ -127,7 +127,7 @@ FileSystemResponseValue CreateFileTask::GetSuccessRequestResult() const { MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!"); - nsRefPtr file = new DOMFile(mFileSystem->GetWindow(), + nsRefPtr file = new File(mFileSystem->GetWindow(), mTargetFileImpl); BlobParent* actor = GetBlobParent(file); if (!actor) { @@ -261,7 +261,7 @@ CreateFileTask::Work() return NS_ERROR_FAILURE; } - mTargetFileImpl = new DOMFileImplFile(file); + mTargetFileImpl = new FileImplFile(file); return NS_OK; } @@ -280,7 +280,7 @@ CreateFileTask::Work() return NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR; } - mTargetFileImpl = new DOMFileImplFile(file); + mTargetFileImpl = new FileImplFile(file); return NS_OK; } @@ -303,8 +303,7 @@ CreateFileTask::HandlerCallback() return; } - nsCOMPtr file = new DOMFile(mFileSystem->GetWindow(), - mTargetFileImpl); + nsCOMPtr file = new File(mFileSystem->GetWindow(), mTargetFileImpl); mPromise->MaybeResolve(file); mPromise = nullptr; mBlobData = nullptr; diff --git a/dom/filesystem/CreateFileTask.h b/dom/filesystem/CreateFileTask.h index 1adf5498b816..4d23863378ba 100644 --- a/dom/filesystem/CreateFileTask.h +++ b/dom/filesystem/CreateFileTask.h @@ -16,8 +16,8 @@ class nsIInputStream; namespace mozilla { namespace dom { -class DOMFile; -class DOMFileImpl; +class File; +class FileImpl; class Promise; class CreateFileTask MOZ_FINAL @@ -26,7 +26,7 @@ class CreateFileTask MOZ_FINAL public: CreateFileTask(FileSystemBase* aFileSystem, const nsAString& aPath, - DOMFile* aBlobData, + File* aBlobData, InfallibleTArray& aArrayData, bool replace, ErrorResult& aRv); @@ -68,15 +68,15 @@ private: nsString mTargetRealPath; // Not thread-safe and should be released on main thread. - nsRefPtr mBlobData; + nsRefPtr mBlobData; nsCOMPtr mBlobStream; InfallibleTArray mArrayData; bool mReplace; - // This cannot be a DOMFile because this object is created on a different - // thread and DOMFile is not thread-safe. Let's use the DOMFileImpl instead. - nsRefPtr mTargetFileImpl; + // This cannot be a File because this object is created on a different + // thread and File is not thread-safe. Let's use the FileImpl instead. + nsRefPtr mTargetFileImpl; }; } // namespace dom diff --git a/dom/filesystem/DeviceStorageFileSystem.cpp b/dom/filesystem/DeviceStorageFileSystem.cpp index 9c4b8924a312..cad94e29b694 100644 --- a/dom/filesystem/DeviceStorageFileSystem.cpp +++ b/dom/filesystem/DeviceStorageFileSystem.cpp @@ -9,11 +9,11 @@ #include "DeviceStorage.h" #include "mozilla/Preferences.h" #include "mozilla/dom/Directory.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/FileSystemUtils.h" #include "nsCOMPtr.h" #include "nsDebug.h" #include "nsDeviceStorage.h" -#include "nsDOMFile.h" #include "nsIFile.h" #include "nsPIDOMWindow.h" @@ -114,7 +114,7 @@ DeviceStorageFileSystem::GetLocalFile(const nsAString& aRealPath) const } bool -DeviceStorageFileSystem::GetRealPath(DOMFileImpl* aFile, nsAString& aRealPath) const +DeviceStorageFileSystem::GetRealPath(FileImpl* aFile, nsAString& aRealPath) const { MOZ_ASSERT(FileSystemUtils::IsParentProcess(), "Should be on parent process!"); diff --git a/dom/filesystem/DeviceStorageFileSystem.h b/dom/filesystem/DeviceStorageFileSystem.h index 1240e8c30dc0..9e7ba92e540f 100644 --- a/dom/filesystem/DeviceStorageFileSystem.h +++ b/dom/filesystem/DeviceStorageFileSystem.h @@ -37,7 +37,7 @@ public: GetLocalFile(const nsAString& aRealPath) const MOZ_OVERRIDE; virtual bool - GetRealPath(DOMFileImpl* aFile, nsAString& aRealPath) const MOZ_OVERRIDE; + GetRealPath(FileImpl* aFile, nsAString& aRealPath) const MOZ_OVERRIDE; virtual const nsAString& GetRootName() const MOZ_OVERRIDE; diff --git a/dom/filesystem/Directory.cpp b/dom/filesystem/Directory.cpp index c9fb62b92059..cdff47f34cb5 100644 --- a/dom/filesystem/Directory.cpp +++ b/dom/filesystem/Directory.cpp @@ -101,7 +101,7 @@ Directory::CreateFile(const nsAString& aPath, const CreateFileOptions& aOptions, { nsresult error = NS_OK; nsString realPath; - nsRefPtr blobData; + nsRefPtr blobData; InfallibleTArray arrayData; bool replace = (aOptions.mIfExists == CreateIfExistsMode::Replace); @@ -193,7 +193,7 @@ Directory::RemoveInternal(const StringOrFileOrDirectory& aPath, bool aRecursive, { nsresult error = NS_OK; nsString realPath; - nsRefPtr file; + nsRefPtr file; // Check and get the target path. diff --git a/dom/filesystem/Directory.h b/dom/filesystem/Directory.h index 5bd8c7dcef24..541ca3b2ead1 100644 --- a/dom/filesystem/Directory.h +++ b/dom/filesystem/Directory.h @@ -10,9 +10,9 @@ #include "mozilla/Attributes.h" #include "mozilla/ErrorResult.h" #include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/File.h" #include "nsAutoPtr.h" #include "nsCycleCollectionParticipant.h" -#include "nsDOMFile.h" #include "nsPIDOMWindow.h" #include "nsWrapperCache.h" diff --git a/dom/filesystem/FileSystemBase.h b/dom/filesystem/FileSystemBase.h index dffc48cf748b..3b535299948d 100644 --- a/dom/filesystem/FileSystemBase.h +++ b/dom/filesystem/FileSystemBase.h @@ -16,7 +16,7 @@ namespace mozilla { namespace dom { class Directory; -class DOMFileImpl; +class FileImpl; class FileSystemBase { @@ -73,7 +73,7 @@ public: * empty string. */ virtual bool - GetRealPath(DOMFileImpl* aFile, nsAString& aRealPath) const = 0; + GetRealPath(FileImpl* aFile, nsAString& aRealPath) const = 0; /* * Get the permission name required to access this file system. diff --git a/dom/filesystem/FileSystemTaskBase.cpp b/dom/filesystem/FileSystemTaskBase.cpp index fc1dc4537d38..b98cfa4a3802 100644 --- a/dom/filesystem/FileSystemTaskBase.cpp +++ b/dom/filesystem/FileSystemTaskBase.cpp @@ -8,6 +8,7 @@ #include "nsNetUtil.h" // Stream transport service. #include "mozilla/dom/ContentChild.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/FileSystemBase.h" #include "mozilla/dom/FileSystemRequestParent.h" #include "mozilla/dom/FileSystemUtils.h" @@ -15,7 +16,6 @@ #include "mozilla/dom/PContent.h" #include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/unused.h" -#include "nsDOMFile.h" namespace mozilla { namespace dom { @@ -170,7 +170,7 @@ FileSystemTaskBase::GetBlobParent(nsIDOMFile* aFile) const aFile->GetMozLastModifiedDate(&lastModifiedDate); ContentParent* cp = static_cast(mRequestParent->Manager()); - return cp->GetOrCreateActorForBlob(static_cast(aFile)); + return cp->GetOrCreateActorForBlob(static_cast(aFile)); } void diff --git a/dom/filesystem/GetFileOrDirectoryTask.cpp b/dom/filesystem/GetFileOrDirectoryTask.cpp index 7a1ea379061e..243e5f1fde53 100644 --- a/dom/filesystem/GetFileOrDirectoryTask.cpp +++ b/dom/filesystem/GetFileOrDirectoryTask.cpp @@ -9,12 +9,12 @@ #include "js/Value.h" #include "mozilla/dom/Directory.h" #include "mozilla/dom/DOMError.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/FileSystemBase.h" #include "mozilla/dom/FileSystemUtils.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/dom/ipc/BlobParent.h" -#include "nsDOMFile.h" #include "nsIFile.h" #include "nsStringGlue.h" @@ -82,8 +82,7 @@ GetFileOrDirectoryTask::GetSuccessRequestResult() const return FileSystemDirectoryResponse(mTargetRealPath); } - nsRefPtr file = new DOMFile(mFileSystem->GetWindow(), - mTargetFileImpl); + nsRefPtr file = new File(mFileSystem->GetWindow(), mTargetFileImpl); BlobParent* actor = GetBlobParent(file); if (!actor) { return FileSystemErrorResponse(NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR); @@ -186,7 +185,7 @@ GetFileOrDirectoryTask::Work() return NS_ERROR_DOM_SECURITY_ERR; } - mTargetFileImpl = new DOMFileImplFile(file); + mTargetFileImpl = new FileImplFile(file); return NS_OK; } @@ -215,8 +214,7 @@ GetFileOrDirectoryTask::HandlerCallback() return; } - nsCOMPtr file = new DOMFile(mFileSystem->GetWindow(), - mTargetFileImpl); + nsRefPtr file = new File(mFileSystem->GetWindow(), mTargetFileImpl); mPromise->MaybeResolve(file); mPromise = nullptr; } diff --git a/dom/filesystem/GetFileOrDirectoryTask.h b/dom/filesystem/GetFileOrDirectoryTask.h index 465f524d81a0..d0c039ffe4a8 100644 --- a/dom/filesystem/GetFileOrDirectoryTask.h +++ b/dom/filesystem/GetFileOrDirectoryTask.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { -class DOMFileImpl; +class FileImpl; class GetFileOrDirectoryTask MOZ_FINAL : public FileSystemTaskBase @@ -59,9 +59,9 @@ private: // Whether we get a directory. bool mIsDirectory; - // This cannot be a DOMFile bacause this object is created on a different - // thread and DOMFile is not thread-safe. Let's use the DOMFileImpl instead. - nsRefPtr mTargetFileImpl; + // This cannot be a File bacause this object is created on a different + // thread and File is not thread-safe. Let's use the FileImpl instead. + nsRefPtr mTargetFileImpl; }; } // namespace dom diff --git a/dom/filesystem/RemoveTask.cpp b/dom/filesystem/RemoveTask.cpp index f536be5c0240..1886f2290218 100644 --- a/dom/filesystem/RemoveTask.cpp +++ b/dom/filesystem/RemoveTask.cpp @@ -7,12 +7,12 @@ #include "RemoveTask.h" #include "DOMError.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/FileSystemBase.h" #include "mozilla/dom/FileSystemUtils.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/dom/ipc/BlobParent.h" -#include "nsDOMFile.h" #include "nsIFile.h" #include "nsStringGlue.h" @@ -21,7 +21,7 @@ namespace dom { RemoveTask::RemoveTask(FileSystemBase* aFileSystem, const nsAString& aDirPath, - DOMFileImpl* aTargetFile, + FileImpl* aTargetFile, const nsAString& aTargetPath, bool aRecursive, ErrorResult& aRv) @@ -92,8 +92,7 @@ RemoveTask::GetRequestParams(const nsString& aFileSystem) const param.directory() = mDirRealPath; param.recursive() = mRecursive; if (mTargetFileImpl) { - nsRefPtr file = new DOMFile(mFileSystem->GetWindow(), - mTargetFileImpl); + nsRefPtr file = new File(mFileSystem->GetWindow(), mTargetFileImpl); BlobChild* actor = ContentChild::GetSingleton()->GetOrCreateActorForBlob(file); if (actor) { @@ -131,7 +130,7 @@ RemoveTask::Work() return NS_ERROR_FAILURE; } - // Get the DOM path if a DOMFile is passed as the target. + // Get the DOM path if a File is passed as the target. if (mTargetFileImpl) { if (!mFileSystem->GetRealPath(mTargetFileImpl, mTargetRealPath)) { return NS_ERROR_DOM_SECURITY_ERR; diff --git a/dom/filesystem/RemoveTask.h b/dom/filesystem/RemoveTask.h index f7aa856c041d..13b1f1872d69 100644 --- a/dom/filesystem/RemoveTask.h +++ b/dom/filesystem/RemoveTask.h @@ -14,7 +14,7 @@ namespace mozilla { namespace dom { -class DOMFileImpl; +class FileImpl; class Promise; class RemoveTask MOZ_FINAL @@ -23,7 +23,7 @@ class RemoveTask MOZ_FINAL public: RemoveTask(FileSystemBase* aFileSystem, const nsAString& aDirPath, - DOMFileImpl* aTargetFile, + FileImpl* aTargetFile, const nsAString& aTargetPath, bool aRecursive, ErrorResult& aRv); @@ -59,9 +59,9 @@ protected: private: nsRefPtr mPromise; nsString mDirRealPath; - // This cannot be a DOMFile because this object will be used on a different - // thread and DOMFile is not thread-safe. Let's use the DOMFileImpl instead. - nsRefPtr mTargetFileImpl; + // This cannot be a File because this object will be used on a different + // thread and File is not thread-safe. Let's use the FileImpl instead. + nsRefPtr mTargetFileImpl; nsString mTargetRealPath; bool mRecursive; bool mReturnValue; diff --git a/dom/indexedDB/ActorsChild.cpp b/dom/indexedDB/ActorsChild.cpp index f9c213405c0a..5ac5d286667f 100644 --- a/dom/indexedDB/ActorsChild.cpp +++ b/dom/indexedDB/ActorsChild.cpp @@ -524,10 +524,10 @@ ConvertActorsToBlobs(IDBDatabase* aDatabase, for (uint32_t index = 0; index < count; index++) { BlobChild* actor = static_cast(blobs[index]); - nsRefPtr blobImpl = actor->GetBlobImpl(); + nsRefPtr blobImpl = actor->GetBlobImpl(); MOZ_ASSERT(blobImpl); - nsRefPtr blob = new DOMFile(aDatabase->GetOwner(), blobImpl); + nsRefPtr blob = new File(aDatabase->GetOwner(), blobImpl); nsRefPtr fileInfo; if (!fileInfos.IsEmpty()) { diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 7f08f4e9cb8e..be233bc14c5f 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -29,6 +29,7 @@ #include "mozilla/storage.h" #include "mozilla/unused.h" #include "mozilla/dom/ContentParent.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/StructuredCloneTags.h" #include "mozilla/dom/TabParent.h" #include "mozilla/dom/indexedDB/PBackgroundIDBCursorParent.h" @@ -56,12 +57,10 @@ #include "nsClassHashtable.h" #include "nsCOMPtr.h" #include "nsDataHashtable.h" -#include "nsDOMFile.h" #include "nsEscape.h" #include "nsHashKeys.h" #include "nsNetUtil.h" #include "nsIAppsService.h" -#include "nsIDOMFile.h" #include "nsIEventTarget.h" #include "nsIFile.h" #include "nsIFileURL.h" @@ -3028,7 +3027,7 @@ class DatabaseFile MOZ_FINAL { friend class Database; - nsRefPtr mBlobImpl; + nsRefPtr mBlobImpl; nsRefPtr mFileInfo; public: @@ -3075,7 +3074,7 @@ private: } // Called when receiving from the child. - DatabaseFile(DOMFileImpl* aBlobImpl, FileInfo* aFileInfo) + DatabaseFile(FileImpl* aBlobImpl, FileInfo* aFileInfo) : mBlobImpl(aBlobImpl) , mFileInfo(aFileInfo) { @@ -5013,11 +5012,11 @@ private: }; class NonMainThreadHackBlobImpl MOZ_FINAL - : public DOMFileImplFile + : public FileImplFile { public: NonMainThreadHackBlobImpl(nsIFile* aFile, FileInfo* aFileInfo) - : DOMFileImplFile(aFile, aFileInfo) + : FileImplFile(aFile, aFileInfo) { // Getting the content type is not currently supported off the main thread. // This isn't a problem here because: @@ -5500,7 +5499,7 @@ ConvertBlobsToActors(PBackgroundParent* aBackgroundActor, MOZ_ASSERT(NS_SUCCEEDED(nativeFile->IsFile(&isFile))); MOZ_ASSERT(isFile); - nsRefPtr impl = + nsRefPtr impl = new NonMainThreadHackBlobImpl(nativeFile, file.mFileInfo); PBlobParent* actor = @@ -6240,7 +6239,7 @@ Database::AllocPBackgroundIDBDatabaseFileParent(PBlobParent* aBlobParent) AssertIsOnBackgroundThread(); MOZ_ASSERT(aBlobParent); - nsRefPtr blobImpl = + nsRefPtr blobImpl = static_cast(aBlobParent)->GetBlobImpl(); MOZ_ASSERT(blobImpl); diff --git a/dom/indexedDB/FileSnapshot.cpp b/dom/indexedDB/FileSnapshot.cpp index aef35f1c8acc..e303ae39628b 100644 --- a/dom/indexedDB/FileSnapshot.cpp +++ b/dom/indexedDB/FileSnapshot.cpp @@ -26,10 +26,10 @@ FileImplSnapshot::FileImplSnapshot(const nsAString& aName, nsIFile* aFile, IDBFileHandle* aFileHandle, FileInfo* aFileInfo) - : DOMFileImplBase(aName, - aContentType, - aMetadataParams->Size(), - aMetadataParams->LastModified()) + : FileImplBase(aName, + aContentType, + aMetadataParams->Size(), + aMetadataParams->LastModified()) , mFile(aFile) , mFileHandle(aFileHandle) , mWholeFile(true) @@ -50,7 +50,7 @@ FileImplSnapshot::FileImplSnapshot(const FileImplSnapshot* aOther, uint64_t aStart, uint64_t aLength, const nsAString& aContentType) - : DOMFileImplBase(aContentType, aOther->mStart + aStart, aLength) + : FileImplBase(aContentType, aOther->mStart + aStart, aLength) , mFile(aOther->mFile) , mFileHandle(aOther->mFileHandle) , mWholeFile(false) @@ -86,7 +86,7 @@ FileImplSnapshot::AssertSanity() #endif // DEBUG -NS_IMPL_ISUPPORTS_INHERITED0(FileImplSnapshot, DOMFileImpl) +NS_IMPL_ISUPPORTS_INHERITED0(FileImplSnapshot, FileImpl) void FileImplSnapshot::Unlink() @@ -128,7 +128,7 @@ FileImplSnapshot::GetInternalStream(nsIInputStream** aStream) return NS_OK; } -already_AddRefed +already_AddRefed FileImplSnapshot::CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, @@ -136,7 +136,7 @@ FileImplSnapshot::CreateSlice(uint64_t aStart, { AssertSanity(); - nsRefPtr impl = + nsRefPtr impl = new FileImplSnapshot(this, aStart, aLength, aContentType); return impl.forget(); diff --git a/dom/indexedDB/FileSnapshot.h b/dom/indexedDB/FileSnapshot.h index de12287e4fc8..050dc3708d6c 100644 --- a/dom/indexedDB/FileSnapshot.h +++ b/dom/indexedDB/FileSnapshot.h @@ -8,9 +8,9 @@ #define mozilla_dom_indexeddb_filesnapshot_h__ #include "mozilla/Attributes.h" +#include "mozilla/dom/File.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" -#include "nsDOMFile.h" namespace mozilla { namespace dom { @@ -22,7 +22,7 @@ namespace indexedDB { class IDBFileHandle; class FileImplSnapshot MOZ_FINAL - : public DOMFileImplBase + : public FileImplBase { typedef mozilla::dom::MetadataParameters MetadataParameters; @@ -74,7 +74,7 @@ private: virtual bool IsCCed() const MOZ_OVERRIDE; - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, diff --git a/dom/indexedDB/IDBDatabase.cpp b/dom/indexedDB/IDBDatabase.cpp index 32ae95df66ea..3aa15a42a389 100644 --- a/dom/indexedDB/IDBDatabase.cpp +++ b/dom/indexedDB/IDBDatabase.cpp @@ -25,6 +25,7 @@ #include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/DOMStringList.h" #include "mozilla/dom/DOMStringListBinding.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/IDBDatabaseBinding.h" #include "mozilla/dom/IDBObjectStoreBinding.h" #include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseFileChild.h" @@ -38,9 +39,7 @@ #include "mozilla/ipc/InputStreamParams.h" #include "mozilla/ipc/InputStreamUtils.h" #include "nsCOMPtr.h" -#include "nsDOMFile.h" #include "nsIDocument.h" -#include "nsIDOMFile.h" #include "nsIObserver.h" #include "nsIObserverService.h" #include "nsISupportsPrimitives.h" @@ -803,15 +802,15 @@ IDBDatabase::AbortTransactions() } PBackgroundIDBDatabaseFileChild* -IDBDatabase::GetOrCreateFileActorForBlob(DOMFile* aBlob) +IDBDatabase::GetOrCreateFileActorForBlob(File* aBlob) { AssertIsOnOwningThread(); MOZ_ASSERT(aBlob); MOZ_ASSERT(mBackgroundActor); - // We use the DOMFile's nsIWeakReference as the key to the table because + // We use the File's nsIWeakReference as the key to the table because // a) it is unique per blob, b) it is reference-counted so that we can - // guarantee that it stays alive, and c) it doesn't hold the actual DOMFile + // guarantee that it stays alive, and c) it doesn't hold the actual File // alive. nsCOMPtr blob = aBlob; nsCOMPtr weakRef = do_GetWeakReference(blob); @@ -820,7 +819,7 @@ IDBDatabase::GetOrCreateFileActorForBlob(DOMFile* aBlob) PBackgroundIDBDatabaseFileChild* actor = nullptr; if (!mFileActors.Get(weakRef, &actor)) { - DOMFileImpl* blobImpl = aBlob->Impl(); + FileImpl* blobImpl = aBlob->Impl(); MOZ_ASSERT(blobImpl); if (mReceivedBlobs.GetEntry(weakRef)) { @@ -912,7 +911,7 @@ IDBDatabase::NoteFinishedFileActor(PBackgroundIDBDatabaseFileChild* aFileActor) } void -IDBDatabase::NoteReceivedBlob(DOMFile* aBlob) +IDBDatabase::NoteReceivedBlob(File* aBlob) { AssertIsOnOwningThread(); MOZ_ASSERT(aBlob); @@ -920,7 +919,7 @@ IDBDatabase::NoteReceivedBlob(DOMFile* aBlob) #ifdef DEBUG { - nsRefPtr blobImpl = aBlob->Impl(); + nsRefPtr blobImpl = aBlob->Impl(); MOZ_ASSERT(blobImpl); nsCOMPtr remoteBlob = do_QueryObject(blobImpl); diff --git a/dom/indexedDB/IDBDatabase.h b/dom/indexedDB/IDBDatabase.h index bc876c5a1429..811b7f2b8729 100644 --- a/dom/indexedDB/IDBDatabase.h +++ b/dom/indexedDB/IDBDatabase.h @@ -29,7 +29,7 @@ class EventChainPostVisitor; namespace dom { -class DOMFile; +class File; class DOMStringList; struct IDBObjectStoreParameters; template class Sequence; @@ -174,13 +174,13 @@ public: AbortTransactions(); PBackgroundIDBDatabaseFileChild* - GetOrCreateFileActorForBlob(DOMFile* aBlob); + GetOrCreateFileActorForBlob(File* aBlob); void NoteFinishedFileActor(PBackgroundIDBDatabaseFileChild* aFileActor); void - NoteReceivedBlob(DOMFile* aBlob); + NoteReceivedBlob(File* aBlob); void DelayedMaybeExpireFileActors(); diff --git a/dom/indexedDB/IDBMutableFile.cpp b/dom/indexedDB/IDBMutableFile.cpp index e9001b53b750..fada090d4570 100644 --- a/dom/indexedDB/IDBMutableFile.cpp +++ b/dom/indexedDB/IDBMutableFile.cpp @@ -343,7 +343,7 @@ already_AddRefed IDBMutableFile::CreateFileObject(IDBFileHandle* aFileHandle, MetadataParameters* aMetadataParams) { - nsRefPtr impl = + nsRefPtr impl = new FileImplSnapshot(mName, mType, aMetadataParams, @@ -351,7 +351,7 @@ IDBMutableFile::CreateFileObject(IDBFileHandle* aFileHandle, aFileHandle, mFileInfo); - nsCOMPtr fileSnapshot = new DOMFile(GetOwner(), impl); + nsCOMPtr fileSnapshot = new File(GetOwner(), impl); return fileSnapshot.forget(); } diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index aa0a4b597396..bc32935b264a 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -29,6 +29,7 @@ #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/DOMStringList.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/IDBMutableFileBinding.h" #include "mozilla/dom/BlobBinding.h" #include "mozilla/dom/IDBObjectStoreBinding.h" @@ -40,8 +41,6 @@ #include "mozilla/ipc/BackgroundChild.h" #include "mozilla/ipc/PBackgroundSharedTypes.h" #include "nsCOMPtr.h" -#include "nsDOMFile.h" -#include "nsIDOMFile.h" #include "ProfilerHelpers.h" #include "ReportInternalError.h" @@ -59,7 +58,7 @@ struct IDBObjectStore::StructuredCloneWriteInfo { struct BlobOrFileInfo { - nsRefPtr mBlob; + nsRefPtr mBlob; nsRefPtr mFileInfo; bool @@ -299,7 +298,7 @@ StructuredCloneWriteCallback(JSContext* aCx, MOZ_ASSERT(NS_IsMainThread(), "This can't work off the main thread!"); { - DOMFile* blob = nullptr; + File* blob = nullptr; if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, aObj, blob))) { uint64_t size; MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blob->GetSize(&size))); @@ -401,7 +400,7 @@ GetAddInfoCallback(JSContext* aCx, void* aClosure) } BlobChild* -ActorFromRemoteBlob(DOMFile* aBlob) +ActorFromRemoteBlob(File* aBlob) { MOZ_ASSERT(aBlob); @@ -427,7 +426,7 @@ ActorFromRemoteBlob(DOMFile* aBlob) } bool -ResolveMysteryFile(DOMFile* aBlob, +ResolveMysteryFile(File* aBlob, const nsString& aName, const nsString& aContentType, uint64_t aSize, @@ -442,7 +441,7 @@ ResolveMysteryFile(DOMFile* aBlob, } bool -ResolveMysteryBlob(DOMFile* aBlob, +ResolveMysteryBlob(File* aBlob, const nsString& aContentType, uint64_t aSize) { @@ -610,7 +609,7 @@ public: "This wrapping currently only works on the main thread!"); // It can happen that this IDB is chrome code, so there is no parent, but - // still we want to set a correct parent for the new DOMFile object. + // still we want to set a correct parent for the new File object. nsCOMPtr parent; if (aDatabase && aDatabase->GetParentObject()) { parent = aDatabase->GetParentObject(); @@ -619,7 +618,7 @@ public: } MOZ_ASSERT(parent); - nsRefPtr file = new DOMFile(parent, aFile.mFile->Impl()); + nsRefPtr file = new File(parent, aFile.mFile->Impl()); if (aData.tag == SCTAG_DOM_BLOB) { if (NS_WARN_IF(!ResolveMysteryBlob(aFile.mFile, diff --git a/dom/indexedDB/IndexedDatabase.h b/dom/indexedDB/IndexedDatabase.h index 6ada4daa62b6..a8b4542a0832 100644 --- a/dom/indexedDB/IndexedDatabase.h +++ b/dom/indexedDB/IndexedDatabase.h @@ -19,7 +19,7 @@ class nsIInputStream; namespace mozilla { namespace dom { -class DOMFile; +class File; namespace indexedDB { @@ -31,7 +31,7 @@ class SerializedStructuredCloneWriteInfo; struct StructuredCloneFile { - nsRefPtr mFile; + nsRefPtr mFile; nsRefPtr mFileInfo; // In IndexedDatabaseInlines.h diff --git a/dom/indexedDB/IndexedDatabaseInlines.h b/dom/indexedDB/IndexedDatabaseInlines.h index f772bbe7e6de..a2c73879dffc 100644 --- a/dom/indexedDB/IndexedDatabaseInlines.h +++ b/dom/indexedDB/IndexedDatabaseInlines.h @@ -13,7 +13,7 @@ #include "FileInfo.h" #include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h" -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "nsIInputStream.h" namespace mozilla { diff --git a/dom/indexedDB/IndexedDatabaseManager.h b/dom/indexedDB/IndexedDatabaseManager.h index 4ce140274ef2..c50c17d876b7 100644 --- a/dom/indexedDB/IndexedDatabaseManager.h +++ b/dom/indexedDB/IndexedDatabaseManager.h @@ -156,7 +156,7 @@ private: // protected by any mutex but it is only ever touched on the IO thread. nsClassHashtable mFileManagerInfos; - // Lock protecting FileManager.mFileInfos and nsDOMFileBase.mFileInfos + // Lock protecting FileManager.mFileInfos and FileImplBase.mFileInfos // It's s also used to atomically update FileInfo.mRefCnt, FileInfo.mDBRefCnt // and FileInfo.mSliceRefCnt mozilla::Mutex mFileMutex; diff --git a/dom/ipc/Blob.cpp b/dom/ipc/Blob.cpp index 5dc3dc551dfd..5ba755eeea06 100644 --- a/dom/ipc/Blob.cpp +++ b/dom/ipc/Blob.cpp @@ -16,6 +16,7 @@ #include "mozilla/Monitor.h" #include "mozilla/Mutex.h" #include "mozilla/unused.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/nsIContentParent.h" #include "mozilla/dom/nsIContentChild.h" #include "mozilla/dom/PBlobStreamChild.h" @@ -26,10 +27,8 @@ #include "mozilla/ipc/PBackgroundParent.h" #include "mozilla/ipc/PFileDescriptorSetParent.h" #include "nsDataHashtable.h" -#include "nsDOMFile.h" #include "nsHashKeys.h" #include "nsID.h" -#include "nsIDOMFile.h" #include "nsIInputStream.h" #include "nsIIPCSerializableInputStream.h" #include "nsIMultiplexInputStream.h" @@ -252,7 +251,7 @@ class BlobInputStreamTether MOZ_FINAL , public nsIIPCSerializableInputStream { nsCOMPtr mStream; - nsRefPtr mBlobImpl; + nsRefPtr mBlobImpl; nsIMultiplexInputStream* mWeakMultiplexStream; nsISeekableStream* mWeakSeekableStream; @@ -265,7 +264,7 @@ public: NS_FORWARD_SAFE_NSISEEKABLESTREAM(mWeakSeekableStream) NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(mWeakSerializableStream) - BlobInputStreamTether(nsIInputStream* aStream, DOMFileImpl* aBlobImpl) + BlobInputStreamTether(nsIInputStream* aStream, FileImpl* aBlobImpl) : mStream(aStream) , mBlobImpl(aBlobImpl) , mWeakMultiplexStream(nullptr) @@ -322,14 +321,14 @@ class RemoteInputStream MOZ_FINAL { Monitor mMonitor; nsCOMPtr mStream; - nsRefPtr mBlobImpl; + nsRefPtr mBlobImpl; nsCOMPtr mEventTarget; nsISeekableStream* mWeakSeekableStream; public: NS_DECL_THREADSAFE_ISUPPORTS - explicit RemoteInputStream(DOMFileImpl* aBlobImpl) + explicit RemoteInputStream(FileImpl* aBlobImpl) : mMonitor("RemoteInputStream.mMonitor") , mBlobImpl(aBlobImpl) , mWeakSeekableStream(nullptr) @@ -409,7 +408,7 @@ public: nsresult rv = BlockAndWaitForStream(); NS_ENSURE_SUCCESS(rv, rv); - nsRefPtr blobImpl; + nsRefPtr blobImpl; mBlobImpl.swap(blobImpl); rv = mStream->Close(); @@ -709,11 +708,11 @@ class BlobParent::IDTableEntry MOZ_FINAL { const nsID mID; const intptr_t mProcessID; - const nsRefPtr mBlobImpl; + const nsRefPtr mBlobImpl; public: static already_AddRefed - Create(const nsID& aID, intptr_t aProcessID, DOMFileImpl* aBlobImpl) + Create(const nsID& aID, intptr_t aProcessID, FileImpl* aBlobImpl) { MOZ_ASSERT(aBlobImpl); @@ -752,7 +751,7 @@ public: } static already_AddRefed - GetOrCreate(const nsID& aID, intptr_t aProcessID, DOMFileImpl* aBlobImpl) + GetOrCreate(const nsID& aID, intptr_t aProcessID, FileImpl* aBlobImpl) { MOZ_ASSERT(aBlobImpl); @@ -780,7 +779,7 @@ public: return mProcessID; } - DOMFileImpl* + FileImpl* BlobImpl() const { return mBlobImpl; @@ -789,13 +788,13 @@ public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IDTableEntry) private: - IDTableEntry(const nsID& aID, intptr_t aProcessID, DOMFileImpl* aBlobImpl); + IDTableEntry(const nsID& aID, intptr_t aProcessID, FileImpl* aBlobImpl); ~IDTableEntry(); static already_AddRefed GetOrCreateInternal(const nsID& aID, intptr_t aProcessID, - DOMFileImpl* aBlobImpl, + FileImpl* aBlobImpl, bool aMayCreate, bool aMayGet, bool aIgnoreProcessID); @@ -1051,7 +1050,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(BlobParent::OpenStreamRunnable, nsRunnable) ******************************************************************************/ class BlobChild::RemoteBlobImpl MOZ_FINAL - : public DOMFileImplBase + : public FileImplBase , public nsIRemoteBlob { class StreamHelper; @@ -1066,7 +1065,7 @@ public: const nsAString& aContentType, uint64_t aLength, uint64_t aModDate) - : DOMFileImplBase(aName, aContentType, aLength, aModDate) + : FileImplBase(aName, aContentType, aLength, aModDate) { CommonInit(aActor); } @@ -1074,14 +1073,14 @@ public: RemoteBlobImpl(BlobChild* aActor, const nsAString& aContentType, uint64_t aLength) - : DOMFileImplBase(aContentType, aLength) + : FileImplBase(aContentType, aLength) { CommonInit(aActor); } explicit RemoteBlobImpl(BlobChild* aActor) - : DOMFileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX) + : FileImplBase(EmptyString(), EmptyString(), UINT64_MAX, UINT64_MAX) { CommonInit(aActor); } @@ -1100,7 +1099,7 @@ public: virtual void GetMozFullPathInternal(nsAString& aFileName, ErrorResult& aRv) MOZ_OVERRIDE; - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE; @@ -1167,12 +1166,12 @@ class BlobChild::RemoteBlobImpl::StreamHelper MOZ_FINAL { Monitor mMonitor; BlobChild* mActor; - nsRefPtr mBlobImpl; + nsRefPtr mBlobImpl; nsRefPtr mInputStream; bool mDone; public: - StreamHelper(BlobChild* aActor, DOMFileImpl* aBlobImpl) + StreamHelper(BlobChild* aActor, FileImpl* aBlobImpl) : mMonitor("BlobChild::RemoteBlobImpl::StreamHelper::mMonitor") , mActor(aActor) , mBlobImpl(aBlobImpl) @@ -1268,7 +1267,7 @@ class BlobChild::RemoteBlobImpl::SliceHelper MOZ_FINAL { Monitor mMonitor; BlobChild* mActor; - nsRefPtr mSlice; + nsRefPtr mSlice; uint64_t mStart; uint64_t mLength; nsString mContentType; @@ -1287,7 +1286,7 @@ public: MOZ_ASSERT(aActor); } - DOMFileImpl* + FileImpl* GetSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType) @@ -1405,7 +1404,7 @@ private: NS_IMPL_ADDREF(BlobChild::RemoteBlobImpl) NS_IMPL_RELEASE_WITH_DESTROY(BlobChild::RemoteBlobImpl, Destroy()) NS_IMPL_QUERY_INTERFACE_INHERITED(BlobChild::RemoteBlobImpl, - DOMFileImpl, + FileImpl, nsIRemoteBlob) void @@ -1427,7 +1426,7 @@ RemoteBlobImpl::GetMozFullPathInternal(nsAString& aFilePath, aFilePath = filePath; } -already_AddRefed +already_AddRefed BlobChild:: RemoteBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) @@ -1439,7 +1438,7 @@ RemoteBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength, nsRefPtr helper = new SliceHelper(mActor); - nsRefPtr impl = helper->GetSlice(aStart, aLength, aContentType); + nsRefPtr impl = helper->GetSlice(aStart, aLength, aContentType); if (NS_WARN_IF(!impl)) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; @@ -1501,7 +1500,7 @@ RemoteBlobImpl::GetBlobParent() * BlobChild ******************************************************************************/ -BlobChild::BlobChild(nsIContentChild* aManager, DOMFileImpl* aBlobImpl) +BlobChild::BlobChild(nsIContentChild* aManager, FileImpl* aBlobImpl) : mBackgroundManager(nullptr) , mContentManager(aManager) { @@ -1511,7 +1510,7 @@ BlobChild::BlobChild(nsIContentChild* aManager, DOMFileImpl* aBlobImpl) CommonInit(aBlobImpl); } -BlobChild::BlobChild(PBackgroundChild* aManager, DOMFileImpl* aBlobImpl) +BlobChild::BlobChild(PBackgroundChild* aManager, FileImpl* aBlobImpl) : mBackgroundManager(aManager) , mContentManager(nullptr) { @@ -1586,7 +1585,7 @@ BlobChild::~BlobChild() } void -BlobChild::CommonInit(DOMFileImpl* aBlobImpl) +BlobChild::CommonInit(FileImpl* aBlobImpl) { AssertIsOnOwningThread(); MOZ_ASSERT(aBlobImpl); @@ -1612,7 +1611,7 @@ BlobChild::CommonInit(BlobChild* aOther) MOZ_COUNT_CTOR(BlobChild); - nsRefPtr otherImpl = aOther->GetBlobImpl(); + nsRefPtr otherImpl = aOther->GetBlobImpl(); MOZ_ASSERT(otherImpl); nsString contentType; @@ -1729,7 +1728,7 @@ BlobChild::Startup(const FriendKey& /* aKey */) // static BlobChild* -BlobChild::GetOrCreate(nsIContentChild* aManager, DOMFileImpl* aBlobImpl) +BlobChild::GetOrCreate(nsIContentChild* aManager, FileImpl* aBlobImpl) { AssertCorrectThreadForManager(aManager); MOZ_ASSERT(aManager); @@ -1739,7 +1738,7 @@ BlobChild::GetOrCreate(nsIContentChild* aManager, DOMFileImpl* aBlobImpl) // static BlobChild* -BlobChild::GetOrCreate(PBackgroundChild* aManager, DOMFileImpl* aBlobImpl) +BlobChild::GetOrCreate(PBackgroundChild* aManager, FileImpl* aBlobImpl) { AssertCorrectThreadForManager(aManager); MOZ_ASSERT(aManager); @@ -1773,7 +1772,7 @@ BlobChild::Create(PBackgroundChild* aManager, template BlobChild* BlobChild::GetOrCreateFromImpl(ChildManagerType* aManager, - DOMFileImpl* aBlobImpl) + FileImpl* aBlobImpl) { AssertCorrectThreadForManager(aManager); MOZ_ASSERT(aManager); @@ -1869,7 +1868,7 @@ BlobChild::CreateFromParams(ChildManagerType* aManager, static_cast(params.sourceChild())); MOZ_ASSERT(actor); - nsRefPtr source = actor->GetBlobImpl(); + nsRefPtr source = actor->GetBlobImpl(); MOZ_ASSERT(source); Optional start; @@ -1879,7 +1878,7 @@ BlobChild::CreateFromParams(ChildManagerType* aManager, start.Construct(params.end()); ErrorResult rv; - nsRefPtr slice = + nsRefPtr slice = source->Slice(start, end, params.contentType(), rv); if (NS_WARN_IF(rv.Failed())) { return nullptr; @@ -1999,13 +1998,13 @@ BlobChild::ParentID() const return mParentID; } -already_AddRefed +already_AddRefed BlobChild::GetBlobImpl() { AssertIsOnOwningThread(); MOZ_ASSERT(mBlobImpl); - nsRefPtr blobImpl; + nsRefPtr blobImpl; // Remote blobs are held alive until the first call to GetBlobImpl. Thereafter // we only hold a weak reference. Normal blobs are held alive until the actor @@ -2204,7 +2203,7 @@ private: class BlobParent::RemoteBlobImpl MOZ_FINAL : public RemoteBlobImplBase - , public DOMFileImplBase + , public FileImplBase , public nsIRemoteBlob { friend class mozilla::dom::BlobParent; @@ -2216,7 +2215,7 @@ class BlobParent::RemoteBlobImpl MOZ_FINAL public: NS_DECL_ISUPPORTS_INHERITED - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, ErrorResult& aRv) MOZ_OVERRIDE; @@ -2240,7 +2239,7 @@ private: uint64_t aLength, uint64_t aModDate) : RemoteBlobImplBase(aActor, /* aForwards */ false) - , DOMFileImplBase(aName, aContentType, aLength, aModDate) + , FileImplBase(aName, aContentType, aLength, aModDate) { CommonInit(aInputStreamParams); } @@ -2250,7 +2249,7 @@ private: const nsAString& aContentType, uint64_t aLength) : RemoteBlobImplBase(aActor, /* aForwards */ false) - , DOMFileImplBase(aContentType, aLength) + , FileImplBase(aContentType, aLength) { CommonInit(aInputStreamParams); } @@ -2274,7 +2273,7 @@ class BlobParent::RemoteBlobImpl::SliceHelper MOZ_FINAL { Monitor mMonitor; BlobParent* mActor; - nsRefPtr mSlice; + nsRefPtr mSlice; uint64_t mStart; uint64_t mLength; nsString mContentType; @@ -2293,7 +2292,7 @@ public: MOZ_ASSERT(aActor); } - DOMFileImpl* + FileImpl* GetSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType) @@ -2406,7 +2405,7 @@ private: class BlobParent::ForwardingRemoteBlobImpl MOZ_FINAL : public RemoteBlobImplBase - , public DOMFileImpl + , public FileImpl , public nsIRemoteBlob { friend class mozilla::dom::BlobParent; @@ -2414,7 +2413,7 @@ class BlobParent::ForwardingRemoteBlobImpl MOZ_FINAL typedef mozilla::dom::indexedDB::FileInfo FileInfo; typedef mozilla::dom::indexedDB::FileManager FileManager; - nsRefPtr mBlobImpl; + nsRefPtr mBlobImpl; nsCOMPtr mRemoteBlob; public: @@ -2462,7 +2461,7 @@ public: mBlobImpl->GetType(aType); } - virtual already_AddRefed + virtual already_AddRefed CreateSlice(uint64_t aStart, uint64_t aLength, const nsAString& aContentType, @@ -2471,7 +2470,7 @@ public: return mBlobImpl->CreateSlice(aStart, aLength, aContentType, aRv); } - virtual const nsTArray>* + virtual const nsTArray>* GetSubBlobImpls() const MOZ_OVERRIDE { return mBlobImpl->GetSubBlobImpls(); @@ -2588,7 +2587,7 @@ public: private: ForwardingRemoteBlobImpl(BlobParent* aActor, - DOMFileImpl* aBlobImpl) + FileImpl* aBlobImpl) : RemoteBlobImplBase(aActor, /* aForwards */ true) , mBlobImpl(aBlobImpl) , mRemoteBlob(do_QueryObject(aBlobImpl)) @@ -2611,10 +2610,10 @@ private: NS_IMPL_ADDREF(BlobParent::RemoteBlobImpl) NS_IMPL_RELEASE_WITH_DESTROY(BlobParent::RemoteBlobImpl, Destroy()) NS_IMPL_QUERY_INTERFACE_INHERITED(BlobParent::RemoteBlobImpl, - DOMFileImplBase, + FileImplBase, nsIRemoteBlob) -already_AddRefed +already_AddRefed BlobParent:: RemoteBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength, @@ -2628,7 +2627,7 @@ RemoteBlobImpl::CreateSlice(uint64_t aStart, nsRefPtr helper = new SliceHelper(mActor); - nsRefPtr impl = helper->GetSlice(aStart, aLength, aContentType); + nsRefPtr impl = helper->GetSlice(aStart, aLength, aContentType); if (NS_WARN_IF(!impl)) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; @@ -2686,7 +2685,7 @@ NS_IMPL_ADDREF(BlobParent::ForwardingRemoteBlobImpl) NS_IMPL_RELEASE_WITH_DESTROY(BlobParent::ForwardingRemoteBlobImpl, Destroy()) NS_INTERFACE_MAP_BEGIN(BlobParent::ForwardingRemoteBlobImpl) NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIRemoteBlob, mRemoteBlob) -NS_INTERFACE_MAP_END_INHERITING(DOMFileImpl) +NS_INTERFACE_MAP_END_INHERITING(FileImpl) /******************************************************************************* * BlobParent @@ -2797,7 +2796,7 @@ BlobParent::CommonInit(const ParentBlobConstructorParams& aParams, aParams.optionalInputStreamParams().type() == OptionalInputStreamParams::TInputStreamParams); - nsRefPtr remoteBlobImpl; + nsRefPtr remoteBlobImpl; RemoteBlobImplBase* remoteBlobBase = nullptr; switch (paramsType) { @@ -2893,7 +2892,7 @@ BlobParent::Startup(const FriendKey& /* aKey */) // static BlobParent* -BlobParent::GetOrCreate(nsIContentParent* aManager, DOMFileImpl* aBlobImpl) +BlobParent::GetOrCreate(nsIContentParent* aManager, FileImpl* aBlobImpl) { AssertCorrectThreadForManager(aManager); MOZ_ASSERT(aManager); @@ -2903,7 +2902,7 @@ BlobParent::GetOrCreate(nsIContentParent* aManager, DOMFileImpl* aBlobImpl) // static BlobParent* -BlobParent::GetOrCreate(PBackgroundParent* aManager, DOMFileImpl* aBlobImpl) +BlobParent::GetOrCreate(PBackgroundParent* aManager, FileImpl* aBlobImpl) { AssertCorrectThreadForManager(aManager); MOZ_ASSERT(aManager); @@ -2934,7 +2933,7 @@ BlobParent::Create(PBackgroundParent* aManager, } // static -already_AddRefed +already_AddRefed BlobParent::GetBlobImplForID(const nsID& aID) { if (NS_WARN_IF(gProcessType != GeckoProcessType_Default)) { @@ -2947,7 +2946,7 @@ BlobParent::GetBlobImplForID(const nsID& aID) return nullptr; } - nsRefPtr blobImpl = idTableEntry->BlobImpl(); + nsRefPtr blobImpl = idTableEntry->BlobImpl(); MOZ_ASSERT(blobImpl); return blobImpl.forget(); @@ -2957,7 +2956,7 @@ BlobParent::GetBlobImplForID(const nsID& aID) template BlobParent* BlobParent::GetOrCreateFromImpl(ParentManagerType* aManager, - DOMFileImpl* aBlobImpl) + FileImpl* aBlobImpl) { AssertCorrectThreadForManager(aManager); MOZ_ASSERT(aManager); @@ -3071,7 +3070,7 @@ BlobParent::CreateFromParams(ParentManagerType* aManager, static_cast(params.sourceParent())); MOZ_ASSERT(actor); - nsRefPtr source = actor->GetBlobImpl(); + nsRefPtr source = actor->GetBlobImpl(); MOZ_ASSERT(source); Optional start; @@ -3081,7 +3080,7 @@ BlobParent::CreateFromParams(ParentManagerType* aManager, end.Construct(params.end()); ErrorResult rv; - nsRefPtr slice = + nsRefPtr slice = source->Slice(start, end, params.contentType(), rv); if (NS_WARN_IF(rv.Failed())) { return nullptr; @@ -3184,13 +3183,13 @@ BlobParent::MaybeGetActorFromRemoteBlob(nsIRemoteBlob* aRemoteBlob, return nullptr; } -already_AddRefed +already_AddRefed BlobParent::GetBlobImpl() { AssertIsOnOwningThread(); MOZ_ASSERT(mBlobImpl); - nsRefPtr blobImpl; + nsRefPtr blobImpl; // Remote blobs are held alive until the first call to GetBlobImpl. Thereafter // we only hold a weak reference. Normal blobs are held alive until the actor @@ -3543,7 +3542,7 @@ InputStreamChild::Recv__delete__(const InputStreamParams& aParams, BlobParent:: IDTableEntry::IDTableEntry(const nsID& aID, intptr_t aProcessID, - DOMFileImpl* aBlobImpl) + FileImpl* aBlobImpl) : mID(aID) , mProcessID(aProcessID) , mBlobImpl(aBlobImpl) @@ -3575,7 +3574,7 @@ already_AddRefed BlobParent:: IDTableEntry::GetOrCreateInternal(const nsID& aID, intptr_t aProcessID, - DOMFileImpl* aBlobImpl, + FileImpl* aBlobImpl, bool aMayCreate, bool aMayGet, bool aIgnoreProcessID) diff --git a/dom/ipc/BlobChild.h b/dom/ipc/BlobChild.h index 0b3200ae8276..3ca042284ecf 100644 --- a/dom/ipc/BlobChild.h +++ b/dom/ipc/BlobChild.h @@ -25,7 +25,7 @@ class PBackgroundChild; namespace dom { class ContentChild; -class DOMFileImpl; +class FileImpl; class nsIContentChild; class PBlobStreamChild; @@ -37,7 +37,7 @@ class BlobChild MOZ_FINAL class RemoteBlobImpl; friend class RemoteBlobImpl; - DOMFileImpl* mBlobImpl; + FileImpl* mBlobImpl; RemoteBlobImpl* mRemoteBlobImpl; // One of these will be null and the other non-null. @@ -58,10 +58,10 @@ public: // These create functions are called on the sending side. static BlobChild* - GetOrCreate(nsIContentChild* aManager, DOMFileImpl* aBlobImpl); + GetOrCreate(nsIContentChild* aManager, FileImpl* aBlobImpl); static BlobChild* - GetOrCreate(PBackgroundChild* aManager, DOMFileImpl* aBlobImpl); + GetOrCreate(PBackgroundChild* aManager, FileImpl* aBlobImpl); // These create functions are called on the receiving side. static BlobChild* @@ -98,11 +98,11 @@ public: const nsID& ParentID() const; - // Get the DOMFileImpl associated with this actor. This may always be called + // Get the FileImpl associated with this actor. This may always be called // on the sending side. It may also be called on the receiving side unless // this is a "mystery" blob that has not yet received a SetMysteryBlobInfo() // call. - already_AddRefed + already_AddRefed GetBlobImpl(); // Use this for files. @@ -126,9 +126,9 @@ public: private: // These constructors are called on the sending side. - BlobChild(nsIContentChild* aManager, DOMFileImpl* aBlobImpl); + BlobChild(nsIContentChild* aManager, FileImpl* aBlobImpl); - BlobChild(PBackgroundChild* aManager, DOMFileImpl* aBlobImpl); + BlobChild(PBackgroundChild* aManager, FileImpl* aBlobImpl); BlobChild(nsIContentChild* aManager, BlobChild* aOther); @@ -145,7 +145,7 @@ private: ~BlobChild(); void - CommonInit(DOMFileImpl* aBlobImpl); + CommonInit(FileImpl* aBlobImpl); void CommonInit(BlobChild* aOther); @@ -155,7 +155,7 @@ private: template static BlobChild* - GetOrCreateFromImpl(ChildManagerType* aManager, DOMFileImpl* aBlobImpl); + GetOrCreateFromImpl(ChildManagerType* aManager, FileImpl* aBlobImpl); template static BlobChild* diff --git a/dom/ipc/BlobParent.h b/dom/ipc/BlobParent.h index ce4588419e9a..743d1502a990 100644 --- a/dom/ipc/BlobParent.h +++ b/dom/ipc/BlobParent.h @@ -33,7 +33,7 @@ class PBackgroundParent; namespace dom { class ContentParent; -class DOMFileImpl; +class FileImpl; class nsIContentParent; class PBlobStreamParent; @@ -57,7 +57,7 @@ class BlobParent MOZ_FINAL static StaticAutoPtr sIDTable; static StaticAutoPtr sIDTableMutex; - DOMFileImpl* mBlobImpl; + FileImpl* mBlobImpl; RemoteBlobImplBase* mRemoteBlobImpl; // One of these will be null and the other non-null. @@ -87,10 +87,10 @@ public: // These create functions are called on the sending side. static BlobParent* - GetOrCreate(nsIContentParent* aManager, DOMFileImpl* aBlobImpl); + GetOrCreate(nsIContentParent* aManager, FileImpl* aBlobImpl); static BlobParent* - GetOrCreate(PBackgroundParent* aManager, DOMFileImpl* aBlobImpl); + GetOrCreate(PBackgroundParent* aManager, FileImpl* aBlobImpl); // These create functions are called on the receiving side. static BlobParent* @@ -128,8 +128,8 @@ public: return mContentManager; } - // Get the DOMFileImpl associated with this actor. - already_AddRefed + // Get the FileImpl associated with this actor. + already_AddRefed GetBlobImpl(); void @@ -168,7 +168,7 @@ private: template static BlobParent* GetOrCreateFromImpl(ParentManagerType* aManager, - DOMFileImpl* aBlobImpl); + FileImpl* aBlobImpl); template static BlobParent* diff --git a/dom/ipc/ContentBridgeChild.cpp b/dom/ipc/ContentBridgeChild.cpp index a76cf0158aef..d7d68dc75b4d 100644 --- a/dom/ipc/ContentBridgeChild.cpp +++ b/dom/ipc/ContentBridgeChild.cpp @@ -6,11 +6,11 @@ #include "mozilla/dom/ContentBridgeChild.h" #include "mozilla/dom/ContentChild.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/StructuredCloneUtils.h" #include "mozilla/dom/TabChild.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/ipc/InputStreamUtils.h" -#include "nsDOMFile.h" #include "JavaScriptChild.h" using namespace base; diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index d942f6113ce7..ed1c744e7beb 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -130,6 +130,7 @@ #include "ipc/Nuwa.h" #endif +#include "mozilla/dom/File.h" #include "mozilla/dom/cellbroadcast/CellBroadcastIPCService.h" #include "mozilla/dom/mobileconnection/MobileConnectionChild.h" #include "mozilla/dom/mobilemessage/SmsChild.h" @@ -144,7 +145,6 @@ #include "mozilla/dom/PSpeechSynthesisChild.h" #endif -#include "nsDOMFile.h" #include "ProcessUtils.h" #include "StructuredCloneUtils.h" #include "URIUtils.h" diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 6e0459f4d094..d9bdcf1713c3 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -34,6 +34,7 @@ #include "mozilla/dom/DataStoreService.h" #include "mozilla/dom/DOMStorageIPC.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ExternalHelperAppParent.h" #include "mozilla/dom/FileSystemRequestParent.h" #include "mozilla/dom/GeolocationBinding.h" @@ -78,7 +79,6 @@ #include "nsConsoleMessage.h" #include "nsConsoleService.h" #include "nsDebugImpl.h" -#include "nsDOMFile.h" #include "nsFrameMessageManager.h" #include "nsHashPropertyBag.h" #include "nsIAlertsService.h" diff --git a/dom/ipc/FilePickerParent.cpp b/dom/ipc/FilePickerParent.cpp index 8be2c232e8da..1c4bf4082aa8 100644 --- a/dom/ipc/FilePickerParent.cpp +++ b/dom/ipc/FilePickerParent.cpp @@ -6,7 +6,6 @@ #include "FilePickerParent.h" #include "nsComponentManagerUtils.h" -#include "nsDOMFile.h" #include "nsNetCID.h" #include "nsIDocument.h" #include "nsIDOMFile.h" @@ -14,6 +13,7 @@ #include "nsIFile.h" #include "nsISimpleEnumerator.h" #include "mozilla/unused.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/TabParent.h" @@ -118,7 +118,7 @@ FilePickerParent::SendFiles(const nsCOMArray& aDomfiles) for (unsigned i = 0; i < aDomfiles.Length(); i++) { BlobParent* blob = parent->GetOrCreateActorForBlob( - static_cast(aDomfiles[i])); + static_cast(aDomfiles[i])); if (blob) { files.AppendElement(blob); } @@ -151,9 +151,9 @@ FilePickerParent::Done(int16_t aResult) if (supports) { nsCOMPtr file = do_QueryInterface(supports); - // A null parent is fine because DOMFile are not used in this process + // A null parent is fine because File are not used in this process // but only in the child. - nsCOMPtr domfile = DOMFile::CreateFromFile(nullptr, file); + nsCOMPtr domfile = File::CreateFromFile(nullptr, file); domfiles.AppendElement(domfile); } } @@ -161,9 +161,9 @@ FilePickerParent::Done(int16_t aResult) nsCOMPtr file; mFilePicker->GetFile(getter_AddRefs(file)); if (file) { - // A null parent is fine because DOMFile are not used in this process + // A null parent is fine because File are not used in this process // but only in the child. - nsCOMPtr domfile = DOMFile::CreateFromFile(nullptr, file); + nsCOMPtr domfile = File::CreateFromFile(nullptr, file); domfiles.AppendElement(domfile); } } diff --git a/dom/ipc/StructuredCloneUtils.cpp b/dom/ipc/StructuredCloneUtils.cpp index db8c48adff44..780d99b07785 100644 --- a/dom/ipc/StructuredCloneUtils.cpp +++ b/dom/ipc/StructuredCloneUtils.cpp @@ -11,7 +11,7 @@ #include "nsIXPConnect.h" #include "mozilla/dom/BlobBinding.h" -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "nsContentUtils.h" #include "nsJSEnvironment.h" #include "MainThreadUtils.h" @@ -40,7 +40,7 @@ Read(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag, static_cast(aClosure); if (aTag == SCTAG_DOM_BLOB) { - // nsRefPtr needs to go out of scope before toObjectOrNull() is + // nsRefPtr needs to go out of scope before toObjectOrNull() is // called because the static analysis thinks dereferencing XPCOM objects // can GC (because in some cases it can!), and a return statement with a // JSObject* type means that JSObject* is on the stack as a raw pointer @@ -48,7 +48,7 @@ Read(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag, JS::Rooted val(aCx); { MOZ_ASSERT(aData < closure->mBlobs.Length()); - nsRefPtr blob = closure->mBlobs[aData]; + nsRefPtr blob = closure->mBlobs[aData]; #ifdef DEBUG { @@ -63,7 +63,7 @@ Read(JSContext* aCx, JSStructuredCloneReader* aReader, uint32_t aTag, nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx)); MOZ_ASSERT(global); - nsRefPtr newBlob = new DOMFile(global, blob->Impl()); + nsRefPtr newBlob = new File(global, blob->Impl()); if (!WrapNewBindingObject(aCx, newBlob, &val)) { return nullptr; } @@ -85,9 +85,9 @@ Write(JSContext* aCx, JSStructuredCloneWriter* aWriter, StructuredCloneClosure* closure = static_cast(aClosure); - // See if the wrapped native is a DOMFile/Blob. + // See if the wrapped native is a File/Blob. { - DOMFile* blob = nullptr; + File* blob = nullptr; if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, aObj, blob)) && NS_SUCCEEDED(blob->SetMutable(false)) && JS_WriteUint32Pair(aWriter, SCTAG_DOM_BLOB, diff --git a/dom/ipc/StructuredCloneUtils.h b/dom/ipc/StructuredCloneUtils.h index 440dc0961101..c0171c407542 100644 --- a/dom/ipc/StructuredCloneUtils.h +++ b/dom/ipc/StructuredCloneUtils.h @@ -9,7 +9,7 @@ #include "nsCOMPtr.h" #include "nsTArray.h" -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "js/StructuredClone.h" @@ -22,7 +22,7 @@ namespace dom { struct StructuredCloneClosure { - nsTArray> mBlobs; + nsTArray> mBlobs; }; struct diff --git a/dom/ipc/nsIContentChild.cpp b/dom/ipc/nsIContentChild.cpp index 3e5e686eb2de..41580f6f1456 100644 --- a/dom/ipc/nsIContentChild.cpp +++ b/dom/ipc/nsIContentChild.cpp @@ -8,6 +8,7 @@ #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/DOMTypes.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/PermissionMessageUtils.h" #include "mozilla/dom/StructuredCloneUtils.h" #include "mozilla/dom/TabChild.h" @@ -15,7 +16,6 @@ #include "mozilla/ipc/InputStreamUtils.h" #include "JavaScriptChild.h" -#include "nsDOMFile.h" #include "nsIJSRuntimeService.h" #include "nsPrintfCString.h" @@ -97,12 +97,12 @@ nsIContentChild::DeallocPBlobChild(PBlobChild* aActor) } BlobChild* -nsIContentChild::GetOrCreateActorForBlob(DOMFile* aBlob) +nsIContentChild::GetOrCreateActorForBlob(File* aBlob) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aBlob); - nsRefPtr blobImpl = aBlob->Impl(); + nsRefPtr blobImpl = aBlob->Impl(); MOZ_ASSERT(blobImpl); BlobChild* actor = BlobChild::GetOrCreate(this, blobImpl); diff --git a/dom/ipc/nsIContentChild.h b/dom/ipc/nsIContentChild.h index ce5e27af7b1d..9a7f914f8f38 100644 --- a/dom/ipc/nsIContentChild.h +++ b/dom/ipc/nsIContentChild.h @@ -33,7 +33,7 @@ namespace dom { class BlobChild; class BlobConstructorParams; class ClonedMessageData; -class DOMFile; +class File; class IPCTabContext; class PBlobChild; class PBrowserChild; @@ -44,7 +44,7 @@ class nsIContentChild : public nsISupports public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTCHILD_IID) - BlobChild* GetOrCreateActorForBlob(DOMFile* aBlob); + BlobChild* GetOrCreateActorForBlob(File* aBlob); virtual PBlobChild* SendPBlobConstructor( PBlobChild* aActor, diff --git a/dom/ipc/nsIContentParent.cpp b/dom/ipc/nsIContentParent.cpp index c38cc13bb959..4ea9280bffa6 100644 --- a/dom/ipc/nsIContentParent.cpp +++ b/dom/ipc/nsIContentParent.cpp @@ -8,6 +8,7 @@ #include "mozilla/AppProcessChecker.h" #include "mozilla/Preferences.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/PTabContext.h" #include "mozilla/dom/PermissionMessageUtils.h" @@ -17,7 +18,6 @@ #include "mozilla/unused.h" #include "JavaScriptParent.h" -#include "nsDOMFile.h" #include "nsFrameMessageManager.h" #include "nsIJSRuntimeService.h" #include "nsPrintfCString.h" @@ -151,12 +151,12 @@ nsIContentParent::DeallocPBlobParent(PBlobParent* aActor) } BlobParent* -nsIContentParent::GetOrCreateActorForBlob(DOMFile* aBlob) +nsIContentParent::GetOrCreateActorForBlob(File* aBlob) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aBlob); - nsRefPtr blobImpl = aBlob->Impl(); + nsRefPtr blobImpl = aBlob->Impl(); MOZ_ASSERT(blobImpl); BlobParent* actor = BlobParent::GetOrCreate(this, blobImpl); diff --git a/dom/ipc/nsIContentParent.h b/dom/ipc/nsIContentParent.h index 484a381aa1f7..51e7193851c8 100644 --- a/dom/ipc/nsIContentParent.h +++ b/dom/ipc/nsIContentParent.h @@ -33,7 +33,7 @@ namespace dom { class BlobConstructorParams; class BlobParent; class ContentParent; -class DOMFile; +class File; class IPCTabContext; class PBlobParent; class PBrowserParent; @@ -47,7 +47,7 @@ public: nsIContentParent(); - BlobParent* GetOrCreateActorForBlob(DOMFile* aBlob); + BlobParent* GetOrCreateActorForBlob(File* aBlob); virtual uint64_t ChildID() = 0; virtual bool IsForApp() = 0; diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index 533eb8732a60..1de5d58027e3 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -13,7 +13,6 @@ #ifdef MOZ_WIDGET_GONK #include "nsIAudioManager.h" #endif -#include "nsIDOMFile.h" #include "nsIEventTarget.h" #include "nsIUUIDGenerator.h" #include "nsIScriptGlobalObject.h" @@ -29,6 +28,7 @@ #include "mozilla/Types.h" #include "mozilla/PeerIdentity.h" #include "mozilla/dom/ContentChild.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/MediaStreamBinding.h" #include "mozilla/dom/MediaStreamTrackBinding.h" #include "mozilla/dom/GetUserMediaRequestBinding.h" @@ -41,7 +41,6 @@ #include "prprf.h" #include "nsJSUtils.h" -#include "nsDOMFile.h" #include "nsGlobalWindow.h" /* Using WebRTC backend on Desktops (Mac, Windows, Linux), otherwise default */ @@ -1283,7 +1282,7 @@ public: } /** - * Allocates a video device, takes a snapshot and returns a DOMFile via + * Allocates a video device, takes a snapshot and returns a File via * a SuccessRunnable or an error via the ErrorRunnable. Off the main thread. */ void diff --git a/dom/mobilemessage/MmsMessage.cpp b/dom/mobilemessage/MmsMessage.cpp index f040eef997c5..9636e282f5cd 100644 --- a/dom/mobilemessage/MmsMessage.cpp +++ b/dom/mobilemessage/MmsMessage.cpp @@ -9,16 +9,15 @@ #include "jsfriendapi.h" // For js_DateGetMsecSinceEpoch #include "nsJSUtils.h" #include "nsContentUtils.h" -#include "nsIDOMFile.h" #include "nsTArrayHelpers.h" #include "mozilla/dom/ContentParent.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/mobilemessage/Constants.h" // For MessageType #include "mozilla/dom/mobilemessage/SmsTypes.h" #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/ToJSValue.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/dom/ipc/BlobParent.h" -#include "nsDOMFile.h" using namespace mozilla::dom::mobilemessage; @@ -95,11 +94,11 @@ MmsMessage::MmsMessage(const mobilemessage::MmsMessageData& aData) // mContent is not going to be exposed to JS directly so we can use // nullptr as parent. if (element.contentParent()) { - nsRefPtr impl = static_cast(element.contentParent())->GetBlobImpl(); - att.mContent = new DOMFile(nullptr, impl); + nsRefPtr impl = static_cast(element.contentParent())->GetBlobImpl(); + att.mContent = new File(nullptr, impl); } else if (element.contentChild()) { - nsRefPtr impl = static_cast(element.contentChild())->GetBlobImpl(); - att.mContent = new DOMFile(nullptr, impl); + nsRefPtr impl = static_cast(element.contentChild())->GetBlobImpl(); + att.mContent = new File(nullptr, impl); } else { NS_WARNING("MmsMessage: Unable to get attachment content."); } @@ -577,10 +576,10 @@ MmsMessage::GetAttachments(JSContext* aCx, JS::MutableHandle aAttachm // Get |attachment.mContent|. - // Duplicating the DOMFile with the correct parent object. + // Duplicating the File with the correct parent object. nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(aCx)); MOZ_ASSERT(global); - nsRefPtr newBlob = new DOMFile(global, attachment.content->Impl()); + nsRefPtr newBlob = new File(global, attachment.content->Impl()); JS::Rooted val(aCx); if (!WrapNewBindingObject(aCx, newBlob, &val)) { diff --git a/dom/mobilemessage/MmsMessage.h b/dom/mobilemessage/MmsMessage.h index ea7737682497..3d4612ae883b 100644 --- a/dom/mobilemessage/MmsMessage.h +++ b/dom/mobilemessage/MmsMessage.h @@ -16,7 +16,7 @@ namespace mozilla { namespace dom { -class DOMFile; +class File; namespace mobilemessage { class MmsMessageData; @@ -33,7 +33,7 @@ public: // If this is changed, change the WebIDL dictionary as well. struct Attachment MOZ_FINAL { - nsRefPtr content; + nsRefPtr content; nsString id; nsString location; diff --git a/dom/mobilemessage/ipc/SmsParent.cpp b/dom/mobilemessage/ipc/SmsParent.cpp index 85a9fd94cfad..707d2d508a30 100644 --- a/dom/mobilemessage/ipc/SmsParent.cpp +++ b/dom/mobilemessage/ipc/SmsParent.cpp @@ -15,9 +15,9 @@ #include "MmsMessage.h" #include "nsIMobileMessageDatabaseService.h" #include "MobileMessageThread.h" -#include "nsIDOMFile.h" #include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/dom/ContentParent.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/mobilemessage/Constants.h" // For MessageType #include "nsContentUtils.h" #include "nsTArrayHelpers.h" @@ -53,9 +53,9 @@ MmsAttachmentDataToJSObject(JSContext* aContext, return nullptr; } - nsRefPtr blobImpl = static_cast(aAttachment.contentParent())->GetBlobImpl(); + nsRefPtr blobImpl = static_cast(aAttachment.contentParent())->GetBlobImpl(); - // nsRefPtr needs to go out of scope before toObjectOrNull() is + // nsRefPtr needs to go out of scope before toObjectOrNull() is // called because the static analysis thinks dereferencing XPCOM objects // can GC (because in some cases it can!), and a return statement with a // JSObject* type means that JSObject* is on the stack as a raw pointer @@ -65,7 +65,7 @@ MmsAttachmentDataToJSObject(JSContext* aContext, nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(aContext)); MOZ_ASSERT(global); - nsRefPtr blob = new DOMFile(global, blobImpl); + nsRefPtr blob = new File(global, blobImpl); if (!WrapNewBindingObject(aContext, blob, &content)) { return nullptr; } diff --git a/dom/network/UDPSocket.cpp b/dom/network/UDPSocket.cpp index c5abdf7eb1b4..6f21860cafb6 100644 --- a/dom/network/UDPSocket.cpp +++ b/dom/network/UDPSocket.cpp @@ -6,6 +6,7 @@ #include "UDPSocket.h" #include "mozilla/AsyncEventDispatcher.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ErrorEvent.h" #include "mozilla/dom/UDPMessageEvent.h" #include "mozilla/dom/UDPSocketBinding.h" @@ -13,7 +14,6 @@ #include "mozilla/net/DNS.h" #include "nsComponentManagerUtils.h" #include "nsContentUtils.h" -#include "nsDOMFile.h" #include "nsINetAddr.h" #include "nsStringStream.h" @@ -328,7 +328,7 @@ UDPSocket::Send(const StringOrBlobOrArrayBufferOrArrayBufferView& aData, nsCOMPtr stream; if (aData.IsBlob()) { - DOMFile& blob = aData.GetAsBlob(); + File& blob = aData.GetAsBlob(); aRv = blob.GetInternalStream(getter_AddRefs(stream)); if (NS_WARN_IF(aRv.Failed())) { diff --git a/dom/workers/FileReaderSync.cpp b/dom/workers/FileReaderSync.cpp index f3d0bbdaacf3..0e6f195468ed 100644 --- a/dom/workers/FileReaderSync.cpp +++ b/dom/workers/FileReaderSync.cpp @@ -9,13 +9,13 @@ #include "jsfriendapi.h" #include "mozilla/Base64.h" #include "mozilla/dom/EncodingUtils.h" +#include "mozilla/dom/File.h" #include "nsContentUtils.h" #include "mozilla/dom/FileReaderSyncBinding.h" #include "nsCExternalHandlerService.h" #include "nsComponentManagerUtils.h" #include "nsCOMPtr.h" #include "nsDOMClassInfoID.h" -#include "nsDOMFile.h" #include "nsError.h" #include "nsIConverterInputStream.h" #include "nsIInputStream.h" @@ -50,7 +50,7 @@ FileReaderSync::WrapObject(JSContext* aCx) void FileReaderSync::ReadAsArrayBuffer(JSContext* aCx, JS::Handle aScopeObj, - DOMFile& aBlob, + File& aBlob, JS::MutableHandle aRetval, ErrorResult& aRv) { @@ -95,7 +95,7 @@ FileReaderSync::ReadAsArrayBuffer(JSContext* aCx, } void -FileReaderSync::ReadAsBinaryString(DOMFile& aBlob, +FileReaderSync::ReadAsBinaryString(File& aBlob, nsAString& aResult, ErrorResult& aRv) { @@ -125,7 +125,7 @@ FileReaderSync::ReadAsBinaryString(DOMFile& aBlob, } void -FileReaderSync::ReadAsText(DOMFile& aBlob, +FileReaderSync::ReadAsText(File& aBlob, const Optional& aEncoding, nsAString& aResult, ErrorResult& aRv) @@ -195,7 +195,7 @@ FileReaderSync::ReadAsText(DOMFile& aBlob, } void -FileReaderSync::ReadAsDataURL(DOMFile& aBlob, nsAString& aResult, +FileReaderSync::ReadAsDataURL(File& aBlob, nsAString& aResult, ErrorResult& aRv) { nsAutoString scratchResult; diff --git a/dom/workers/FileReaderSync.h b/dom/workers/FileReaderSync.h index f6841cc50f54..1ac06dcda713 100644 --- a/dom/workers/FileReaderSync.h +++ b/dom/workers/FileReaderSync.h @@ -16,7 +16,7 @@ namespace mozilla { class ErrorResult; namespace dom { -class DOMFile; +class File; class GlobalObject; template class Optional; } @@ -44,12 +44,12 @@ public: JSObject* WrapObject(JSContext* aCx); void ReadAsArrayBuffer(JSContext* aCx, JS::Handle aScopeObj, - DOMFile& aBlob, JS::MutableHandle aRetval, + File& aBlob, JS::MutableHandle aRetval, ErrorResult& aRv); - void ReadAsBinaryString(DOMFile& aBlob, nsAString& aResult, ErrorResult& aRv); - void ReadAsText(DOMFile& aBlob, const Optional& aEncoding, + void ReadAsBinaryString(File& aBlob, nsAString& aResult, ErrorResult& aRv); + void ReadAsText(File& aBlob, const Optional& aEncoding, nsAString& aResult, ErrorResult& aRv); - void ReadAsDataURL(DOMFile& aBlob, nsAString& aResult, ErrorResult& aRv); + void ReadAsDataURL(File& aBlob, nsAString& aResult, ErrorResult& aRv); }; END_WORKERS_NAMESPACE diff --git a/dom/workers/URL.cpp b/dom/workers/URL.cpp index 733b5b252301..0961edf93984 100644 --- a/dom/workers/URL.cpp +++ b/dom/workers/URL.cpp @@ -5,11 +5,11 @@ #include "URL.h" -#include "nsDOMFile.h" #include "nsIDocument.h" #include "nsIIOService.h" #include "nsPIDOMWindow.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/URL.h" #include "mozilla/dom/URLBinding.h" #include "mozilla/dom/URLSearchParams.h" @@ -66,11 +66,11 @@ private: class CreateURLRunnable : public WorkerMainThreadRunnable { private: - DOMFileImpl* mBlobImpl; + FileImpl* mBlobImpl; nsString& mURL; public: - CreateURLRunnable(WorkerPrivate* aWorkerPrivate, DOMFileImpl* aBlobImpl, + CreateURLRunnable(WorkerPrivate* aWorkerPrivate, FileImpl* aBlobImpl, const mozilla::dom::objectURLOptions& aOptions, nsString& aURL) : WorkerMainThreadRunnable(aWorkerPrivate), @@ -856,7 +856,7 @@ URL::CreateObjectURL(const GlobalObject& aGlobal, JSObject* aBlob, // static void -URL::CreateObjectURL(const GlobalObject& aGlobal, DOMFile& aBlob, +URL::CreateObjectURL(const GlobalObject& aGlobal, File& aBlob, const mozilla::dom::objectURLOptions& aOptions, nsString& aResult, mozilla::ErrorResult& aRv) { diff --git a/dom/workers/URL.h b/dom/workers/URL.h index 690db12c673b..305f983eec24 100644 --- a/dom/workers/URL.h +++ b/dom/workers/URL.h @@ -17,7 +17,7 @@ class nsIPrincipal; namespace mozilla { namespace dom { -class DOMFile; +class File; struct objectURLOptions; } } @@ -64,7 +64,7 @@ public: static void CreateObjectURL(const GlobalObject& aGlobal, - DOMFile& aArg, const objectURLOptions& aOptions, + File& aArg, const objectURLOptions& aOptions, nsString& aResult, ErrorResult& aRv); static void diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 69731a3a5551..cc9cff352851 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -12,7 +12,6 @@ #include "nsIConsoleService.h" #include "nsIDOMDOMException.h" #include "nsIDOMEvent.h" -#include "nsIDOMFile.h" #include "nsIDOMMessageEvent.h" #include "nsIDocument.h" #include "nsIDocShell.h" @@ -303,7 +302,7 @@ struct WorkerStructuredCloneCallbacks if (aTag == DOMWORKER_SCTAG_BLOB) { MOZ_ASSERT(!aData); - DOMFileImpl* blobImpl; + FileImpl* blobImpl; if (JS_ReadBytes(aReader, &blobImpl, sizeof(blobImpl))) { MOZ_ASSERT(blobImpl); @@ -319,7 +318,7 @@ struct WorkerStructuredCloneCallbacks { // New scope to protect |result| from a moving GC during ~nsRefPtr. - nsRefPtr blob = new DOMFile(nullptr, blobImpl); + nsRefPtr blob = new File(nullptr, blobImpl); JS::Rooted val(aCx); if (WrapNewBindingObject(aCx, blob, &val)) { result = val.toObjectOrNull(); @@ -351,9 +350,9 @@ struct WorkerStructuredCloneCallbacks // See if this is a Blob/File object. { - DOMFile* blob = nullptr; + File* blob = nullptr; if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, aObj, blob))) { - DOMFileImpl* blobImpl = blob->Impl(); + FileImpl* blobImpl = blob->Impl(); if (blobImpl && NS_SUCCEEDED(blobImpl->SetMutable(false)) && JS_WriteUint32Pair(aWriter, DOMWORKER_SCTAG_BLOB, 0) && JS_WriteBytes(aWriter, &blobImpl, sizeof(blobImpl))) { @@ -403,7 +402,7 @@ struct MainThreadWorkerStructuredCloneCallbacks if (aTag == DOMWORKER_SCTAG_BLOB) { MOZ_ASSERT(!aData); - DOMFileImpl* blobImpl; + FileImpl* blobImpl; if (JS_ReadBytes(aReader, &blobImpl, sizeof(blobImpl))) { MOZ_ASSERT(blobImpl); @@ -417,14 +416,14 @@ struct MainThreadWorkerStructuredCloneCallbacks } #endif - // nsRefPtr needs to go out of scope before toObjectOrNull() is + // nsRefPtr needs to go out of scope before toObjectOrNull() is // called because the static analysis thinks dereferencing XPCOM objects // can GC (because in some cases it can!), and a return statement with a // JSObject* type means that JSObject* is on the stack as a raw pointer // while destructors are running. JS::Rooted val(aCx); { - nsRefPtr blob = new DOMFile(nullptr, blobImpl); + nsRefPtr blob = new File(nullptr, blobImpl); if (!WrapNewBindingObject(aCx, blob, &val)) { return nullptr; } @@ -452,9 +451,9 @@ struct MainThreadWorkerStructuredCloneCallbacks // See if this is a Blob/File object. { - DOMFile* blob = nullptr; + File* blob = nullptr; if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, aObj, blob))) { - DOMFileImpl* blobImpl = blob->Impl(); + FileImpl* blobImpl = blob->Impl(); if (blobImpl->IsCCed()) { NS_WARNING("Cycle collected blob objects are not supported!"); } else if (NS_SUCCEEDED(blobImpl->SetMutable(false)) && diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index 83393b0dc095..ff316b88dfa5 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -15,10 +15,10 @@ #include "jsfriendapi.h" #include "mozilla/ArrayUtils.h" #include "mozilla/dom/Exceptions.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ProgressEvent.h" #include "nsComponentManagerUtils.h" #include "nsContentUtils.h" -#include "nsDOMFile.h" #include "nsJSUtils.h" #include "nsThreadUtils.h" @@ -2159,7 +2159,7 @@ XMLHttpRequest::Send(JS::Handle aBody, ErrorResult& aRv) } void -XMLHttpRequest::Send(DOMFile& aBody, ErrorResult& aRv) +XMLHttpRequest::Send(File& aBody, ErrorResult& aRv) { mWorkerPrivate->AssertIsOnWorkerThread(); JSContext* cx = mWorkerPrivate->GetJSContext(); diff --git a/dom/workers/XMLHttpRequest.h b/dom/workers/XMLHttpRequest.h index 0a4882f4a84d..7276dfa3d29f 100644 --- a/dom/workers/XMLHttpRequest.h +++ b/dom/workers/XMLHttpRequest.h @@ -18,7 +18,7 @@ namespace mozilla { namespace dom { -class DOMFile; +class File; } } @@ -170,7 +170,7 @@ public: Send(JS::Handle aBody, ErrorResult& aRv); void - Send(DOMFile& aBody, ErrorResult& aRv); + Send(File& aBody, ErrorResult& aRv); void Send(const ArrayBuffer& aBody, ErrorResult& aRv); diff --git a/ipc/glue/BackgroundImpl.cpp b/ipc/glue/BackgroundImpl.cpp index 9b79204f1e5a..df361894d787 100644 --- a/ipc/glue/BackgroundImpl.cpp +++ b/ipc/glue/BackgroundImpl.cpp @@ -20,14 +20,13 @@ #include "mozilla/unused.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/ContentParent.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/dom/ipc/BlobParent.h" #include "mozilla/dom/ipc/nsIRemoteBlob.h" #include "mozilla/ipc/ProtocolTypes.h" #include "nsAutoPtr.h" #include "nsCOMPtr.h" -#include "nsDOMFile.h" -#include "nsIDOMFile.h" #include "nsIEventTarget.h" #include "nsIIPCBackgroundChildCreateCallback.h" #include "nsIMutable.h" @@ -847,7 +846,7 @@ BackgroundParent::GetContentParent(PBackgroundParent* aBackgroundActor) PBlobParent* BackgroundParent::GetOrCreateActorForBlobImpl( PBackgroundParent* aBackgroundActor, - DOMFileImpl* aBlobImpl) + FileImpl* aBlobImpl) { AssertIsOnBackgroundThread(); MOZ_ASSERT(aBackgroundActor); @@ -923,7 +922,7 @@ BackgroundChild::GetOrCreateActorForBlob(PBackgroundChild* aBackgroundActor, MOZ_ASSERT(aBackgroundActor == GetForCurrentThread(), "BackgroundChild is bound to a different thread!"); - nsRefPtr blobImpl = static_cast(aBlob)->Impl(); + nsRefPtr blobImpl = static_cast(aBlob)->Impl(); MOZ_ASSERT(blobImpl); BlobChild* actor = BlobChild::GetOrCreate(aBackgroundActor, blobImpl); diff --git a/ipc/glue/BackgroundParent.h b/ipc/glue/BackgroundParent.h index a6d3a0402362..7bb860264bc2 100644 --- a/ipc/glue/BackgroundParent.h +++ b/ipc/glue/BackgroundParent.h @@ -15,7 +15,7 @@ namespace mozilla { namespace dom { class ContentParent; -class DOMFileImpl; +class FileImpl; class PBlobParent; } // namespace dom @@ -32,7 +32,7 @@ class BackgroundParent MOZ_FINAL typedef base::ProcessId ProcessId; typedef mozilla::dom::ContentParent ContentParent; - typedef mozilla::dom::DOMFileImpl DOMFileImpl; + typedef mozilla::dom::FileImpl FileImpl; typedef mozilla::ipc::Transport Transport; public: @@ -56,7 +56,7 @@ public: static mozilla::dom::PBlobParent* GetOrCreateActorForBlobImpl(PBackgroundParent* aBackgroundActor, - DOMFileImpl* aBlobImpl); + FileImpl* aBlobImpl); // Get a value that represents the ContentParent associated with the parent // actor for comparison. The value is not guaranteed to uniquely identify the diff --git a/ipc/glue/InputStreamUtils.cpp b/ipc/glue/InputStreamUtils.cpp index a2b17625b3a2..9ef59efe4fa0 100644 --- a/ipc/glue/InputStreamUtils.cpp +++ b/ipc/glue/InputStreamUtils.cpp @@ -7,11 +7,11 @@ #include "nsIIPCSerializableInputStream.h" #include "mozilla/Assertions.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/ipc/BlobChild.h" #include "mozilla/dom/ipc/BlobParent.h" #include "nsComponentManagerUtils.h" #include "nsDebug.h" -#include "nsDOMFile.h" #include "nsID.h" #include "nsIXULRuntime.h" #include "nsMIMEInputStream.h" @@ -112,7 +112,7 @@ DeserializeInputStream(const InputStreamParams& aParams, const nsID& id = aParams.get_RemoteInputStreamParams().id(); - nsRefPtr blobImpl = BlobParent::GetBlobImplForID(id); + nsRefPtr blobImpl = BlobParent::GetBlobImplForID(id); MOZ_ASSERT(blobImpl, "Invalid blob contents"); diff --git a/js/xpconnect/src/ExportHelpers.cpp b/js/xpconnect/src/ExportHelpers.cpp index 0a87703a973c..1e9044544869 100644 --- a/js/xpconnect/src/ExportHelpers.cpp +++ b/js/xpconnect/src/ExportHelpers.cpp @@ -13,9 +13,9 @@ #include "js/StructuredClone.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/BlobBinding.h" +#include "mozilla/dom/File.h" #include "nsGlobalWindow.h" #include "nsJSUtils.h" -#include "nsDOMFile.h" #include "nsIDOMFileList.h" using namespace mozilla; @@ -52,7 +52,7 @@ public: StackScopedCloneOptions *mOptions; AutoObjectVector mReflectors; AutoObjectVector mFunctions; - nsTArray> mBlobImpls; + nsTArray> mBlobImpls; }; static JSObject * @@ -108,11 +108,11 @@ StackScopedCloneRead(JSContext *cx, JSStructuredCloneReader *reader, uint32_t ta nsIGlobalObject *global = xpc::NativeGlobal(JS::CurrentGlobalOrNull(cx)); MOZ_ASSERT(global); - // nsRefPtr needs to go out of scope before toObjectOrNull() is called because + // nsRefPtr needs to go out of scope before toObjectOrNull() is called because // otherwise the static analysis thinks it can gc the JSObject via the stack. JS::Rooted val(cx); { - nsRefPtr blob = new DOMFile(global, cloneData->mBlobImpls[idx]); + nsRefPtr blob = new File(global, cloneData->mBlobImpls[idx]); if (!WrapNewBindingObject(cx, blob, &val)) { return nullptr; } @@ -154,9 +154,9 @@ StackScopedCloneWrite(JSContext *cx, JSStructuredCloneWriter *writer, StackScopedCloneData *cloneData = static_cast(closure); { - DOMFile* blob = nullptr; + File* blob = nullptr; if (NS_SUCCEEDED(UNWRAP_OBJECT(Blob, obj, blob))) { - DOMFileImpl* blobImpl = blob->Impl(); + FileImpl* blobImpl = blob->Impl(); MOZ_ASSERT(blobImpl); if (!cloneData->mBlobImpls.AppendElement(blobImpl)) diff --git a/parser/html/nsHtml5StreamParser.cpp b/parser/html/nsHtml5StreamParser.cpp index 5b4257ab141a..fd297eeec3c4 100644 --- a/parser/html/nsHtml5StreamParser.cpp +++ b/parser/html/nsHtml5StreamParser.cpp @@ -181,7 +181,7 @@ nsHtml5StreamParser::nsHtml5StreamParser(nsHtml5TreeOpExecutor* aExecutor, mTreeBuilder->EnableViewSource(highlighter); // doesn't own } - // Chardet instantiation adapted from nsDOMFile. + // Chardet instantiation adapted from File. // Chardet is initialized here even if it turns out to be useless // to make the chardet refcount its observer (nsHtml5StreamParser) // on the main thread. diff --git a/widget/nsIFilePicker.idl b/widget/nsIFilePicker.idl index fbb4e8af1989..5a0f1d4475fe 100644 --- a/widget/nsIFilePicker.idl +++ b/widget/nsIFilePicker.idl @@ -145,7 +145,7 @@ interface nsIFilePicker : nsISupports /** * Get the nsIDOMFile for the file. * - * @return Returns the file currently selected as DOMFile + * @return Returns the file currently selected as File */ readonly attribute nsIDOMFile domfile; @@ -153,7 +153,7 @@ interface nsIFilePicker : nsISupports * Get the enumerator for the selected files * only works in the modeOpenMultiple mode * - * @return Returns the files currently selected as DOMFiles + * @return Returns the files currently selected as Files */ readonly attribute nsISimpleEnumerator domfiles; diff --git a/widget/xpwidgets/nsBaseFilePicker.cpp b/widget/xpwidgets/nsBaseFilePicker.cpp index 3d4c01b1a7f8..a9de1c49eda8 100644 --- a/widget/xpwidgets/nsBaseFilePicker.cpp +++ b/widget/xpwidgets/nsBaseFilePicker.cpp @@ -16,8 +16,8 @@ #include "nsIServiceManager.h" #include "nsCOMArray.h" #include "nsIFile.h" -#include "nsDOMFile.h" #include "nsEnumeratorUtils.h" +#include "mozilla/dom/File.h" #include "mozilla/Services.h" #include "WidgetUtils.h" #include "nsThreadUtils.h" @@ -96,7 +96,7 @@ public: return NS_ERROR_FAILURE; } - nsCOMPtr domFile = DOMFile::CreateFromFile(mParent, localFile); + nsCOMPtr domFile = File::CreateFromFile(mParent, localFile); domFile.forget(aResult); return NS_OK; } @@ -318,7 +318,7 @@ nsBaseFilePicker::GetDomfile(nsIDOMFile** aDomfile) return NS_OK; } - nsRefPtr domFile = DOMFile::CreateFromFile(mParent, localFile); + nsRefPtr domFile = File::CreateFromFile(mParent, localFile); domFile.forget(aDomfile); return NS_OK; } diff --git a/widget/xpwidgets/nsFilePickerProxy.cpp b/widget/xpwidgets/nsFilePickerProxy.cpp index 05858faa03c0..b6eaac740aed 100644 --- a/widget/xpwidgets/nsFilePickerProxy.cpp +++ b/widget/xpwidgets/nsFilePickerProxy.cpp @@ -8,7 +8,7 @@ #include "nsComponentManagerUtils.h" #include "nsNetUtil.h" #include "nsIFile.h" -#include "nsDOMFile.h" +#include "mozilla/dom/File.h" #include "mozilla/dom/TabChild.h" #include "mozilla/dom/ipc/BlobChild.h" @@ -146,10 +146,10 @@ nsFilePickerProxy::Recv__delete__(const MaybeInputFiles& aFiles, const InfallibleTArray& files = aFiles.get_InputFiles().filesChild(); for (uint32_t i = 0; i < files.Length(); ++i) { BlobChild* actor = static_cast(files[i]); - nsRefPtr blobImpl = actor->GetBlobImpl(); + nsRefPtr blobImpl = actor->GetBlobImpl(); NS_ENSURE_TRUE(blobImpl, true); - nsCOMPtr blob = new DOMFile(mParent, blobImpl); + nsCOMPtr blob = new File(mParent, blobImpl); nsCOMPtr file(do_QueryInterface(blob)); NS_ENSURE_TRUE(file, true);