diff --git a/b2g/components/test/mochitest/screenshot_helper.js b/b2g/components/test/mochitest/screenshot_helper.js index d10234f9281..cf40528f0ee 100644 --- a/b2g/components/test/mochitest/screenshot_helper.js +++ b/b2g/components/test/mochitest/screenshot_helper.js @@ -1,6 +1,8 @@ const Cu = Components.utils; const Ci = Components.interfaces; +Cu.importGlobalProperties(['File']); + const { Services } = Cu.import("resource://gre/modules/Services.jsm"); // Load a duplicated copy of the jsm to prevent messing with the currently running one @@ -25,7 +27,7 @@ function next() { let steps = [ function getScreenshot() { let screenshot = Screenshot.get(); - assert.ok(screenshot instanceof Ci.nsIDOMFile, + assert.ok(screenshot instanceof File, "Screenshot.get() returns a File"); next(); }, diff --git a/dom/apps/ImportExport.jsm b/dom/apps/ImportExport.jsm index e990b9a6c53..a2b13f61927 100644 --- a/dom/apps/ImportExport.jsm +++ b/dom/apps/ImportExport.jsm @@ -14,6 +14,8 @@ Cu.import("resource://gre/modules/AppsUtils.jsm"); Cu.import("resource://gre/modules/Promise.jsm"); Cu.import("resource://gre/modules/Webapps.jsm"); +Cu.importGlobalProperties(['File']); + XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm"); @@ -284,7 +286,7 @@ this.ImportExport = { throw "NoBlobFound"; } - let isFileBlob = aBlob instanceof Ci.nsIDOMFile; + let isFileBlob = aBlob instanceof File; // We can't QI the DOMFile to nsIFile, so we need to create one. let zipFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); if (!isFileBlob) { @@ -498,7 +500,7 @@ this.ImportExport = { throw "NoBlobFound"; } - let isFileBlob = aBlob instanceof Ci.nsIDOMFile; + let isFileBlob = aBlob instanceof File; // We can't QI the DOMFile to nsIFile, so we need to create one. let zipFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); if (!isFileBlob) { diff --git a/dom/base/File.cpp b/dom/base/File.cpp index 2cb3bde2212..c8e9d94cd95 100644 --- a/dom/base/File.cpp +++ b/dom/base/File.cpp @@ -439,22 +439,6 @@ Blob::GetInternalStream(nsIInputStream** aStream) //////////////////////////////////////////////////////////////////////////// // mozilla::dom::File implementation -NS_IMPL_CYCLE_COLLECTION_CLASS(File) - -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(File, Blob) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END - -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(File, Blob) -NS_IMPL_CYCLE_COLLECTION_UNLINK_END - -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(File) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFile) - NS_INTERFACE_MAP_ENTRY(nsIDOMFile) -NS_INTERFACE_MAP_END_INHERITING(Blob) - -NS_IMPL_ADDREF_INHERITED(File, Blob) -NS_IMPL_RELEASE_INHERITED(File, Blob) - File::File(nsISupports* aParent, BlobImpl* aImpl) : Blob(aParent, aImpl) { @@ -1282,9 +1266,9 @@ FileList::GetLength(uint32_t* aLength) } NS_IMETHODIMP -FileList::Item(uint32_t aIndex, nsIDOMFile **aFile) +FileList::Item(uint32_t aIndex, nsISupports** aFile) { - nsRefPtr file = Item(aIndex); + nsCOMPtr file = Item(aIndex); file.forget(aFile); return NS_OK; } diff --git a/dom/base/File.h b/dom/base/File.h index a7ecd7fa145..5c660b11a40 100644 --- a/dom/base/File.h +++ b/dom/base/File.h @@ -20,7 +20,7 @@ #include "nsAutoPtr.h" #include "nsCycleCollectionParticipant.h" #include "nsCOMPtr.h" -#include "nsIDOMFile.h" +#include "nsIDOMBlob.h" #include "nsIDOMFileList.h" #include "nsIFile.h" #include "nsIMutable.h" @@ -157,17 +157,10 @@ private: }; class File final : public Blob - , public nsIDOMFile { friend class Blob; public: - NS_DECL_NSIDOMFILE - NS_FORWARD_NSIDOMBLOB(Blob::) - - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(File, Blob); - // Note: BlobImpl must be a File in order to use this method. // Check impl->IsFile(). static File* diff --git a/dom/base/FileIOObject.h b/dom/base/FileIOObject.h index cb96b93b89c..67069d8971c 100644 --- a/dom/base/FileIOObject.h +++ b/dom/base/FileIOObject.h @@ -9,7 +9,6 @@ #include "mozilla/DOMEventTargetHelper.h" #include "nsIFile.h" -#include "nsIDOMFile.h" #include "nsITimer.h" #include "nsCOMPtr.h" #include "nsIAsyncInputStream.h" diff --git a/dom/base/moz.build b/dom/base/moz.build index 27fcf10ad55..acbaa665e83 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -11,10 +11,10 @@ XPIDL_SOURCES += [ 'nsIContentPolicy.idl', 'nsIContentPolicyBase.idl', 'nsIDocumentEncoder.idl', + 'nsIDOMBlob.idl', 'nsIDOMDataChannel.idl', 'nsIDOMDOMCursor.idl', 'nsIDOMDOMRequest.idl', - 'nsIDOMFile.idl', 'nsIDOMFileList.idl', 'nsIDOMFileReader.idl', 'nsIDOMFormData.idl', diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 24eb63b19b7..2d026e72478 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -2593,7 +2593,7 @@ nsDOMWindowUtils::GetContainerElement(nsIDOMElement** aResult) NS_IMETHODIMP nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile, - nsIDOMFile **aDOMFile) + nsISupports **aDOMFile) { MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome()); @@ -2609,8 +2609,8 @@ nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile, return NS_ERROR_FAILURE; } - nsRefPtr file = File::CreateFromFile(innerWindow, aFile); - file.forget(aDOMFile); + nsCOMPtr blob = File::CreateFromFile(innerWindow, aFile); + blob.forget(aDOMFile); return NS_OK; } diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index d9b2a3cf049..114a9b176a7 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -23,7 +23,6 @@ #include "nsIContentViewer.h" #include "nsIDocument.h" #include "nsIDOMDocument.h" -#include "nsIDOMFile.h" #include "nsPIDOMWindow.h" #include "nsIWebNavigation.h" #include "nsIWebProgress.h" diff --git a/dom/base/nsIDOMFile.idl b/dom/base/nsIDOMBlob.idl similarity index 80% rename from dom/base/nsIDOMFile.idl rename to dom/base/nsIDOMBlob.idl index f0f643a33be..efdc1be84f3 100644 --- a/dom/base/nsIDOMFile.idl +++ b/dom/base/nsIDOMBlob.idl @@ -53,14 +53,3 @@ interface nsIDOMBlob : nsISupports // Return true if this blob is a memory file. [notxpcom] bool isMemoryFile(); }; - -// We want to avoid multiple inheritance of nsIDOMBlob so we can downcast from -// nsIDOMBlob to Blob safely. Our chain is: -// - Blob -> nsIDOMBlob -// - File -> nsIDOMFile and Blob -[scriptable, builtinclass, uuid(26e292a6-f5aa-4560-b523-ae22a4c7dfca)] -interface nsIDOMFile : nsISupports -{ - // Empty interface used by addons and some test to check if the object is a - // blob or file. This interface will be removed by bug 1163388 -}; diff --git a/dom/base/nsIDOMFileList.idl b/dom/base/nsIDOMFileList.idl index 29186604c5f..338bd72793e 100644 --- a/dom/base/nsIDOMFileList.idl +++ b/dom/base/nsIDOMFileList.idl @@ -5,11 +5,10 @@ #include "nsISupports.idl" -interface nsIDOMFile; - -[uuid(283aa7b2-da81-4c72-aea2-9797b440fe34)] +[uuid(57128a85-34de-42db-a252-84dd57724a59)] interface nsIDOMFileList : nsISupports { readonly attribute unsigned long length; - nsIDOMFile item(in unsigned long index); + // returns a DOM File object + nsISupports item(in unsigned long index); }; diff --git a/dom/bindings/ToJSValue.h b/dom/bindings/ToJSValue.h index 5cfef1895ce..f80652e2c58 100644 --- a/dom/bindings/ToJSValue.h +++ b/dom/bindings/ToJSValue.h @@ -172,7 +172,7 @@ ToJSValue(JSContext* aCx, } // Accept objects that inherit from nsISupports but not nsWrapperCache (e.g. -// nsIDOMFile). +// DOM File). template MOZ_WARN_UNUSED_RESULT typename EnableIf::value && diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp index 1d20800417e..ac325f088e9 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.cpp @@ -72,14 +72,14 @@ BEGIN_BLUETOOTH_NAMESPACE class BluetoothOppManager::SendFileBatch final { public: - SendFileBatch(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob) + SendFileBatch(const nsAString& aDeviceAddress, Blob* aBlob) : mDeviceAddress(aDeviceAddress) { mBlobs.AppendElement(aBlob); } nsString mDeviceAddress; - nsCOMArray mBlobs; + nsTArray> mBlobs; }; NS_IMETHODIMP @@ -420,7 +420,7 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress, bool BluetoothOppManager::SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob) + Blob* aBlob) { MOZ_ASSERT(NS_IsMainThread()); @@ -434,7 +434,7 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress, void BluetoothOppManager::AppendBlobToSend(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob) + Blob* aBlob) { MOZ_ASSERT(NS_IsMainThread()); @@ -794,7 +794,7 @@ BluetoothOppManager::RetrieveSentFileName() { mFileName.Truncate(); - nsRefPtr file = static_cast(mBlob.get()).ToFile(); + nsRefPtr file = static_cast(mBlob.get())->ToFile(); if (file) { file->GetName(mFileName); } diff --git a/dom/bluetooth/bluedroid/BluetoothOppManager.h b/dom/bluetooth/bluedroid/BluetoothOppManager.h index d87bb0aef08..5833846e4a7 100644 --- a/dom/bluetooth/bluedroid/BluetoothOppManager.h +++ b/dom/bluetooth/bluedroid/BluetoothOppManager.h @@ -14,13 +14,13 @@ #include "mozilla/ipc/SocketBase.h" #include "nsCOMArray.h" -class nsIDOMBlob; class nsIOutputStream; class nsIInputStream; class nsIVolumeMountLock; namespace mozilla { namespace dom { +class Blob; class BlobParent; } } @@ -55,7 +55,7 @@ public: bool Listen(); bool SendFile(const nsAString& aDeviceAddress, BlobParent* aActor); - bool SendFile(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob); + bool SendFile(const nsAString& aDeviceAddress, Blob* aBlob); bool StopSendingFile(); bool ConfirmReceivingFile(bool aConfirm); @@ -102,7 +102,7 @@ private: void NotifyAboutFileChange(); bool AcquireSdcardMountLock(); void SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize); - void AppendBlobToSend(const nsAString& aDeviceAddress, nsIDOMBlob* aBlob); + void AppendBlobToSend(const nsAString& aDeviceAddress, Blob* aBlob); void DiscardBlobsToSend(); bool ProcessNextBatch(); void ConnectInternal(const nsAString& aDeviceAddress); @@ -199,7 +199,7 @@ private: nsAutoArrayPtr mReceivedDataBuffer; int mCurrentBlobIndex; - nsCOMPtr mBlob; + nsRefPtr mBlob; nsTArray mBatches; /** diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp index cf7b6118d43..c3f2eb41e3c 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp @@ -1827,7 +1827,7 @@ BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress, void BluetoothServiceBluedroid::SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable) { MOZ_ASSERT(NS_IsMainThread()); diff --git a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h index 57fe121aba7..bbebf2c96c7 100644 --- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h +++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h @@ -130,7 +130,7 @@ public: virtual void SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable); virtual void @@ -435,7 +435,7 @@ public: virtual void SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable); virtual void diff --git a/dom/bluetooth/bluetooth2/BluetoothService.h b/dom/bluetooth/bluetooth2/BluetoothService.h index 99fcfab7513..d362a79cc35 100644 --- a/dom/bluetooth/bluetooth2/BluetoothService.h +++ b/dom/bluetooth/bluetooth2/BluetoothService.h @@ -12,15 +12,13 @@ #include "BluetoothProfileManagerBase.h" #include "nsAutoPtr.h" #include "nsClassHashtable.h" -#include "nsIDOMFile.h" #include "nsIObserver.h" #include "nsTObserverArray.h" #include "nsThreadUtils.h" -class nsIDOMBlob; - namespace mozilla { namespace dom { +class Blob; class BlobChild; class BlobParent; } @@ -295,7 +293,7 @@ public: virtual void SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable) = 0; virtual void diff --git a/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.cpp b/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.cpp index 867df1aeada..303769395c9 100644 --- a/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.cpp +++ b/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.cpp @@ -316,7 +316,7 @@ BluetoothServiceChildProcess::SendFile( void BluetoothServiceChildProcess::SendFile( const nsAString& aDeviceAddress, - nsIDOMBlob* aBlobChild, + Blob* aBlobChild, BluetoothReplyRunnable* aRunnable) { // Parent-process-only method diff --git a/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.h b/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.h index ab7bdbac5a7..aebf930de77 100644 --- a/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.h +++ b/dom/bluetooth/bluetooth2/ipc/BluetoothServiceChildProcess.h @@ -140,7 +140,7 @@ public: virtual void SendFile(const nsAString& aDeviceAddress, - nsIDOMBlob* aBlob, + Blob* aBlob, BluetoothReplyRunnable* aRunnable) override; virtual void diff --git a/dom/fetch/InternalResponse.cpp b/dom/fetch/InternalResponse.cpp index 6d7c1125b4d..6ee065c7bc3 100644 --- a/dom/fetch/InternalResponse.cpp +++ b/dom/fetch/InternalResponse.cpp @@ -6,8 +6,6 @@ #include "InternalResponse.h" -#include "nsIDOMFile.h" - #include "mozilla/dom/InternalHeaders.h" #include "nsStreamUtils.h" #include "nsSerializationHelper.h" diff --git a/dom/html/HTMLCanvasElement.cpp b/dom/html/HTMLCanvasElement.cpp index 85992ced064..e3fbbb61962 100644 --- a/dom/html/HTMLCanvasElement.cpp +++ b/dom/html/HTMLCanvasElement.cpp @@ -647,16 +647,22 @@ HTMLCanvasElement::MozGetAsFile(const nsAString& aName, const nsAString& aType, ErrorResult& aRv) { - nsCOMPtr file; + nsCOMPtr file; aRv = MozGetAsFile(aName, aType, getter_AddRefs(file)); - nsRefPtr tmp = static_cast(file.get()); - return tmp.forget(); + if (NS_WARN_IF(aRv.Failed())) { + return nullptr; + } + + nsCOMPtr blob = do_QueryInterface(file); + nsRefPtr domBlob = static_cast(blob.get()); + MOZ_ASSERT(domBlob->IsFile()); + return domBlob->ToFile(); } NS_IMETHODIMP HTMLCanvasElement::MozGetAsFile(const nsAString& aName, const nsAString& aType, - nsIDOMFile** aResult) + nsISupports** aResult) { OwnerDoc()->WarnOnceAbout(nsIDocument::eMozGetAsFile); @@ -672,7 +678,7 @@ HTMLCanvasElement::MozGetAsFile(const nsAString& aName, nsresult HTMLCanvasElement::MozGetAsBlobImpl(const nsAString& aName, const nsAString& aType, - nsIDOMFile** aResult) + nsISupports** aResult) { nsCOMPtr stream; nsAutoString type(aType); @@ -696,7 +702,7 @@ HTMLCanvasElement::MozGetAsBlobImpl(const nsAString& aName, nsCOMPtr win = do_QueryInterface(OwnerDoc()->GetScopeObject()); // The File takes ownership of the buffer - nsRefPtr file = + nsCOMPtr file = File::CreateMemoryFile(win, imgData, (uint32_t)imgSize, aName, type, PR_Now()); diff --git a/dom/html/HTMLCanvasElement.h b/dom/html/HTMLCanvasElement.h index 5da35892100..fa28265f155 100644 --- a/dom/html/HTMLCanvasElement.h +++ b/dom/html/HTMLCanvasElement.h @@ -237,7 +237,7 @@ protected: nsAString& aDataURL); nsresult MozGetAsBlobImpl(const nsAString& aName, const nsAString& aType, - nsIDOMFile** aResult); + nsISupports** aResult); void CallPrintCallback(); CanvasContextType mCurrentContextType; diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index a4404dd0f15..e7f2c876681 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -405,7 +405,9 @@ public: MOZ_ASSERT(blobImpl); blobImpl->SetPath(Substring(path, 0, uint32_t(length))); } - *aResult = domFile.forget().downcast().take(); + + nsCOMPtr blob = domFile.get(); + blob.forget(aResult); LookupAndCacheNext(); return NS_OK; } @@ -488,7 +490,7 @@ NS_IMPL_ISUPPORTS(DirPickerRecursiveFileEnumerator, nsISimpleEnumerator) /** * This may return nullptr if aDomFile's implementation of - * nsIDOMFile::mozFullPathInternal does not successfully return a non-empty + * File::mozFullPathInternal does not successfully return a non-empty * string that is a valid path. This can happen on Firefox OS, for example, * where the file picker can create Blobs. */ @@ -537,9 +539,9 @@ public: nsCOMPtr tmp; while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) { iter->GetNext(getter_AddRefs(tmp)); - nsCOMPtr domFile = do_QueryInterface(tmp); - MOZ_ASSERT(domFile); - mFileList.AppendElement(static_cast(domFile.get())); + nsCOMPtr domBlob = do_QueryInterface(tmp); + MOZ_ASSERT(domBlob); + mFileList.AppendElement(static_cast(domBlob.get())); mFileListLength = mFileList.Length(); if (mCanceled) { MOZ_ASSERT(!mInput, "This is bad - how did this happen?"); @@ -696,20 +698,23 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult) while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) { iter->GetNext(getter_AddRefs(tmp)); - nsCOMPtr domFile = do_QueryInterface(tmp); - NS_WARN_IF_FALSE(domFile, + nsCOMPtr domBlob = do_QueryInterface(tmp); + NS_WARN_IF_FALSE(domBlob, "Null file object from FilePicker's file enumerator?"); - if (domFile) { - newFiles.AppendElement(static_cast(domFile.get())); + if (domBlob) { + newFiles.AppendElement(static_cast(domBlob.get())); } } } else { MOZ_ASSERT(mode == static_cast(nsIFilePicker::modeOpen)); - nsCOMPtr domFile; - nsresult rv = mFilePicker->GetDomfile(getter_AddRefs(domFile)); + nsCOMPtr tmp; + nsresult rv = mFilePicker->GetDomfile(getter_AddRefs(tmp)); NS_ENSURE_SUCCESS(rv, rv); - if (domFile) { - newFiles.AppendElement(static_cast(domFile.get())); + + nsCOMPtr blob = do_QueryInterface(tmp); + if (blob) { + nsRefPtr file = static_cast(blob.get())->ToFile(); + newFiles.AppendElement(file); } } diff --git a/dom/html/nsFormSubmission.cpp b/dom/html/nsFormSubmission.cpp index 31e2d5f0579..93ae02ccc62 100644 --- a/dom/html/nsFormSubmission.cpp +++ b/dom/html/nsFormSubmission.cpp @@ -18,7 +18,6 @@ #include "nsAttrValueInlines.h" #include "nsISaveAsCharset.h" #include "nsIFile.h" -#include "nsIDOMFile.h" #include "nsDirectoryServiceDefs.h" #include "nsStringStream.h" #include "nsIURI.h" diff --git a/dom/indexedDB/IDBMutableFile.cpp b/dom/indexedDB/IDBMutableFile.cpp index b7dd0ce53cb..fd84c2ce315 100644 --- a/dom/indexedDB/IDBMutableFile.cpp +++ b/dom/indexedDB/IDBMutableFile.cpp @@ -27,7 +27,6 @@ #include "nsContentUtils.h" #include "nsDebug.h" #include "nsError.h" -#include "nsIDOMFile.h" #include "nsIPrincipal.h" namespace mozilla { @@ -328,7 +327,7 @@ IDBMutableFile::GetFileId() const return mFileInfo->Id(); } -already_AddRefed +already_AddRefed IDBMutableFile::CreateFileObject(IDBFileHandle* aFileHandle, MetadataParameters* aMetadataParams) { @@ -393,12 +392,10 @@ GetFileHelper::GetSuccessResult(JSContext* aCx, auto fileHandle = static_cast(mFileHandle.get()); - nsCOMPtr domFile = + nsRefPtr domFile = mMutableFile->CreateFileObject(fileHandle, mParams); - nsresult rv = - nsContentUtils::WrapNative(aCx, domFile, &NS_GET_IID(nsIDOMFile), aVal); - if (NS_WARN_IF(NS_FAILED(rv))) { + if (!ToJSValue(aCx, domFile, aVal)) { return NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR; } diff --git a/dom/indexedDB/IDBMutableFile.h b/dom/indexedDB/IDBMutableFile.h index ca26c78908c..45f78b9c67d 100644 --- a/dom/indexedDB/IDBMutableFile.h +++ b/dom/indexedDB/IDBMutableFile.h @@ -18,7 +18,6 @@ #include "nsAutoPtr.h" #include "nsCycleCollectionParticipant.h" -class nsIDOMFile; class nsPIDOMWindow; namespace mozilla { @@ -28,6 +27,7 @@ class ErrorResult; namespace dom { class DOMRequest; +class File; class MetadataParameters; namespace indexedDB { @@ -83,7 +83,7 @@ public: return mFileInfo; } - already_AddRefed + already_AddRefed CreateFileObject(IDBFileHandle* aFileHandle, MetadataParameters* aMetadataParams); diff --git a/dom/indexedDB/IDBTransaction.cpp b/dom/indexedDB/IDBTransaction.cpp index c93b8ea9590..90d6f2820a5 100644 --- a/dom/indexedDB/IDBTransaction.cpp +++ b/dom/indexedDB/IDBTransaction.cpp @@ -17,7 +17,6 @@ #include "mozilla/dom/DOMStringList.h" #include "mozilla/ipc/BackgroundChild.h" #include "nsIAppShell.h" -#include "nsIDOMFile.h" #include "nsPIDOMWindow.h" #include "nsServiceManagerUtils.h" #include "nsTHashtable.h" diff --git a/dom/indexedDB/test/file.js b/dom/indexedDB/test/file.js index db0761910d3..ae63af38f99 100644 --- a/dom/indexedDB/test/file.js +++ b/dom/indexedDB/test/file.js @@ -94,12 +94,11 @@ function verifyBlob(blob1, blob2, fileId, blobReadHandler) { is(blob1 instanceof Components.interfaces.nsIDOMBlob, true, "Instance of nsIDOMBlob"); - is(blob1 instanceof Components.interfaces.nsIDOMFile, - blob2 instanceof Components.interfaces.nsIDOMFile, - "Instance of nsIDOMFile"); + is(blob1 instanceof File, blob2 instanceof File, + "Instance of DOM File"); is(blob1.size, blob2.size, "Correct size"); is(blob1.type, blob2.type, "Correct type"); - if (blob2 instanceof Components.interfaces.nsIDOMFile) { + if (blob2 instanceof File) { is(blob1.name, blob2.name, "Correct name"); } is(utils.getFileId(blob1), fileId, "Correct file id"); diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 22e545baec7..fcfb1250f12 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -39,8 +39,6 @@ interface nsIDOMStyleSheet; interface nsITransferable; interface nsIQueryContentEventResult; interface nsIDOMWindow; -interface nsIDOMBlob; -interface nsIDOMFile; interface nsIFile; interface nsIDOMClientRect; interface nsIURI; @@ -51,7 +49,7 @@ interface nsIJSRAIIHelper; interface nsIContentPermissionRequest; interface nsIObserver; -[scriptable, uuid(1a75c351-d115-4d51-94df-731dd1723a1f)] +[scriptable, uuid(34a42cdc-7a04-4e71-8a5c-63e092fba58e)] interface nsIDOMWindowUtils : nsISupports { /** @@ -1445,9 +1443,10 @@ interface nsIDOMWindowUtils : nsISupports { in AString value2); /** - * Wrap an nsIFile in an nsIDOMFile + * Wrap an nsIFile in an DOM File + * Returns a File object. */ - nsIDOMFile wrapDOMFile(in nsIFile aFile); + nsISupports wrapDOMFile(in nsIFile aFile); /** * Get the type of the currently focused html input, if any. diff --git a/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl b/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl index 3ec838bb592..eaccc631b02 100644 --- a/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLCanvasElement.idl @@ -16,11 +16,10 @@ */ interface nsIDOMBlob; -interface nsIDOMFile; interface nsIVariant; interface nsIInputStreamCallback; -[uuid(8978d1c5-2981-4678-a1c3-b0b7bae04fbc)] +[uuid(2c984658-2e7c-4774-8ac5-cf1b39f8bec3)] interface nsIDOMHTMLCanvasElement : nsISupports { attribute unsigned long width; @@ -38,7 +37,8 @@ interface nsIDOMHTMLCanvasElement : nsISupports // Valid calls are // mozGetAsFile(name); -- defaults to image/png // mozGetAsFile(name, type); -- uses given type - nsIDOMFile mozGetAsFile(in DOMString name, [optional] in DOMString type); + // The return value is a File object. + nsISupports mozGetAsFile(in DOMString name, [optional] in DOMString type); // A Mozilla-only extension to get a canvas context backed by double-buffered // shared memory. Only privileged callers can call this. diff --git a/dom/ipc/FilePickerParent.cpp b/dom/ipc/FilePickerParent.cpp index e1d48ce97b1..3ee1189045a 100644 --- a/dom/ipc/FilePickerParent.cpp +++ b/dom/ipc/FilePickerParent.cpp @@ -8,7 +8,6 @@ #include "nsComponentManagerUtils.h" #include "nsNetCID.h" #include "nsIDocument.h" -#include "nsIDOMFile.h" #include "nsIDOMWindow.h" #include "nsIFile.h" #include "nsISimpleEnumerator.h" diff --git a/dom/ipc/FilePickerParent.h b/dom/ipc/FilePickerParent.h index 7a2f0e896ed..72cc41dc099 100644 --- a/dom/ipc/FilePickerParent.h +++ b/dom/ipc/FilePickerParent.h @@ -7,7 +7,6 @@ #ifndef mozilla_dom_FilePickerParent_h #define mozilla_dom_FilePickerParent_h -#include "nsIDOMFile.h" #include "nsIEventTarget.h" #include "nsIFilePicker.h" #include "nsCOMArray.h" diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index f33d1a2f936..e849a7c6cc5 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -113,6 +113,7 @@ GetMediaManagerLog() } #define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg) +using dom::File; using dom::MediaStreamConstraints; using dom::MediaTrackConstraintSet; using dom::MediaTrackConstraints; @@ -264,53 +265,6 @@ private: nsRefPtr mManager; // get ref to this when creating the runnable }; -/** - * Invoke the "onSuccess" callback in content. The callback will take a - * DOMBlob in the case of {picture:true}, and a MediaStream in the case of - * {audio:true} or {video:true}. There is a constructor available for each - * form. Do this only on the main thread. - */ -class SuccessCallbackRunnable : public nsRunnable -{ -public: - SuccessCallbackRunnable( - nsCOMPtr& aOnSuccess, - nsCOMPtr& aOnFailure, - nsIDOMFile* aFile, uint64_t aWindowID) - : mFile(aFile) - , mWindowID(aWindowID) - , mManager(MediaManager::GetInstance()) - { - mOnSuccess.swap(aOnSuccess); - mOnFailure.swap(aOnFailure); - } - - NS_IMETHOD - Run() - { - // Only run if the window is still active. - NS_ASSERTION(NS_IsMainThread(), "Only call on main thread"); - - nsCOMPtr onSuccess = mOnSuccess.forget(); - nsCOMPtr onFailure = mOnFailure.forget(); - - if (!(mManager->IsWindowStillActive(mWindowID))) { - return NS_OK; - } - // This is safe since we're on main-thread, and the windowlist can only - // be invalidated from the main-thread (see OnNavigation) - onSuccess->OnSuccess(mFile); - return NS_OK; - } - -private: - nsCOMPtr mOnSuccess; - nsCOMPtr mOnFailure; - nsCOMPtr mFile; - uint64_t mWindowID; - nsRefPtr mManager; // get ref to this when creating the runnable -}; - /** * Invoke the GetUserMediaDevices success callback. Wrapped in a runnable * so that it may be called on the main thread. The error callback is also diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.h b/dom/media/webrtc/MediaEngineGonkVideoSource.h index b072f193f5f..bfa12293f76 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.h +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.h @@ -112,7 +112,7 @@ protected: mozilla::ReentrantMonitor mCallbackMonitor; // Monitor for camera callback handling // This is only modified on MainThread (AllocImpl and DeallocImpl) nsRefPtr mCameraControl; - nsCOMPtr mLastCapture; + nsRefPtr mLastCapture; android::sp mCameraSource; diff --git a/dom/nfc/nsINfcContentHelper.idl b/dom/nfc/nsINfcContentHelper.idl index 0454bf8636a..fc172fcad05 100644 --- a/dom/nfc/nsINfcContentHelper.idl +++ b/dom/nfc/nsINfcContentHelper.idl @@ -210,7 +210,7 @@ interface nsINfcContentHelper : nsISupports * * @param blob * Raw data of the file to be sent. This object represents a file-like - * (nsIDOMFile) object of immutable, raw data. The blob data needs + * (DOM File) object of immutable, raw data. The blob data needs * to be 'object wrapped' before calling this interface. * * @param sessionToken diff --git a/dom/settings/SettingsDB.jsm b/dom/settings/SettingsDB.jsm index e30273352db..492bff72bf4 100644 --- a/dom/settings/SettingsDB.jsm +++ b/dom/settings/SettingsDB.jsm @@ -8,7 +8,7 @@ let Cc = Components.classes; let Ci = Components.interfaces; let Cu = Components.utils; -Cu.importGlobalProperties(['Blob']); +Cu.importGlobalProperties(['Blob', 'File']); Cu.import("resource://gre/modules/Services.jsm"); this.EXPORTED_SYMBOLS = ["SettingsDB", "SETTINGSDB_NAME", "SETTINGSSTORE_NAME"]; @@ -209,7 +209,7 @@ SettingsDB.prototype = { return "primitive"; } else if (Array.isArray(aObject)) { return "array"; - } else if (aObject instanceof Ci.nsIDOMFile) { + } else if (aObject instanceof File) { return "file"; } else if (aObject instanceof Ci.nsIDOMBlob) { return "blob"; diff --git a/dom/settings/SettingsRequestManager.jsm b/dom/settings/SettingsRequestManager.jsm index 0edac13d65c..92a015fe952 100644 --- a/dom/settings/SettingsRequestManager.jsm +++ b/dom/settings/SettingsRequestManager.jsm @@ -8,6 +8,8 @@ const Cc = Components.classes; const Ci = Components.interfaces; const Cu = Components.utils; +Cu.importGlobalProperties(['File']); + this.EXPORTED_SYMBOLS = ["SettingsRequestManager"]; Cu.import("resource://gre/modules/SettingsDB.jsm"); @@ -245,7 +247,7 @@ let SettingsRequestManager = { if (!aValue || !aValue.constructor) { return false; } - return (aValue.constructor.name == "Date") || (aValue instanceof Ci.nsIDOMFile) || + return (aValue.constructor.name == "Date") || (aValue instanceof File) || (aValue instanceof Ci.nsIDOMBlob); } // We need to serialize settings objects, otherwise they can change between diff --git a/dom/wifi/WifiCertService.cpp b/dom/wifi/WifiCertService.cpp index 1ec5cf3c184..405ee4685dc 100644 --- a/dom/wifi/WifiCertService.cpp +++ b/dom/wifi/WifiCertService.cpp @@ -18,7 +18,7 @@ #include "cert.h" #include "certdb.h" #include "CryptoTask.h" -#include "nsIDOMFile.h" +#include "nsIDOMBlob.h" #include "nsIWifiService.h" #include "nsNetUtil.h" #include "nsServiceManagerUtils.h" diff --git a/js/xpconnect/src/XPCComponents.cpp b/js/xpconnect/src/XPCComponents.cpp index 298b7e89069..659cd7c102f 100644 --- a/js/xpconnect/src/XPCComponents.cpp +++ b/js/xpconnect/src/XPCComponents.cpp @@ -28,7 +28,6 @@ #include "mozilla/dom/StructuredCloneTags.h" #include "mozilla/dom/WindowBinding.h" #include "nsZipArchive.h" -#include "nsIDOMFile.h" #include "nsIDOMFileList.h" #include "nsWindowMemoryReporter.h" #include "nsDOMClassInfo.h" diff --git a/js/xpconnect/tests/chrome/test_cloneInto.xul b/js/xpconnect/tests/chrome/test_cloneInto.xul index e5f58783b50..db4c61b0f3a 100644 --- a/js/xpconnect/tests/chrome/test_cloneInto.xul +++ b/js/xpconnect/tests/chrome/test_cloneInto.xul @@ -49,7 +49,7 @@ if (Array.isArray(a)) return 'array'; - if (a instanceof Ci.nsIDOMFile) + if (a instanceof File) return 'file'; if (a instanceof Ci.nsIDOMBlob) diff --git a/js/xpconnect/tests/unit/component-blob.js b/js/xpconnect/tests/unit/component-blob.js index fd528c86be7..7c50f7c925d 100644 --- a/js/xpconnect/tests/unit/component-blob.js +++ b/js/xpconnect/tests/unit/component-blob.js @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); -Components.utils.importGlobalProperties(['Blob']); +Components.utils.importGlobalProperties(['Blob', 'File']); const Cc = Components.classes; const Ci = Components.interfaces; @@ -31,7 +31,7 @@ BlobComponent.prototype = // do some tests do_check_true(f1 instanceof Ci.nsIDOMBlob, "Should be a DOM Blob"); - do_check_true(!(f1 instanceof Ci.nsIDOMFile), "Should not be a DOM File"); + do_check_true(!(f1 instanceof File), "Should not be a DOM File"); do_check_true(f1.type == "text/xml", "Wrong type"); diff --git a/js/xpconnect/tests/unit/component-file.js b/js/xpconnect/tests/unit/component-file.js index 6a1b6ac8d77..d9c51d9f3fe 100644 --- a/js/xpconnect/tests/unit/component-file.js +++ b/js/xpconnect/tests/unit/component-file.js @@ -36,8 +36,8 @@ FileComponent.prototype = var f2 = new File(file); // do some tests - do_check_true(f1 instanceof Ci.nsIDOMFile, "Should be a DOM File"); - do_check_true(f2 instanceof Ci.nsIDOMFile, "Should be a DOM File"); + do_check_true(f1 instanceof File, "Should be a DOM File"); + do_check_true(f2 instanceof File, "Should be a DOM File"); do_check_true(f1.name == "xpcshell.ini", "Should be the right file"); do_check_true(f2.name == "xpcshell.ini", "Should be the right file"); diff --git a/js/xpconnect/tests/unit/test_blob2.js b/js/xpconnect/tests/unit/test_blob2.js index 2d39532f4dd..e031d0813c8 100644 --- a/js/xpconnect/tests/unit/test_blob2.js +++ b/js/xpconnect/tests/unit/test_blob2.js @@ -2,7 +2,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/. */ -Components.utils.importGlobalProperties(['Blob']); +Components.utils.importGlobalProperties(['Blob', 'File']); const Ci = Components.interfaces; @@ -15,7 +15,7 @@ function run_test() { // do some tests do_check_true(f1 instanceof Ci.nsIDOMBlob, "Should be a DOM Blob"); - do_check_true(!(f1 instanceof Ci.nsIDOMFile), "Should not be a DOM File"); + do_check_true(!(f1 instanceof File), "Should not be a DOM File"); do_check_true(f1.type == "text/xml", "Wrong type"); diff --git a/js/xpconnect/tests/unit/test_file2.js b/js/xpconnect/tests/unit/test_file2.js index 7e52f8be853..375ba248854 100644 --- a/js/xpconnect/tests/unit/test_file2.js +++ b/js/xpconnect/tests/unit/test_file2.js @@ -21,8 +21,8 @@ function run_test() { var f2 = new File(file); // do some tests - do_check_true(f1 instanceof Ci.nsIDOMFile, "Should be a DOM File"); - do_check_true(f2 instanceof Ci.nsIDOMFile, "Should be a DOM File"); + do_check_true(f1 instanceof File, "Should be a DOM File"); + do_check_true(f2 instanceof File, "Should be a DOM File"); do_check_true(f1.name == "xpcshell.ini", "Should be the right file"); do_check_true(f2.name == "xpcshell.ini", "Should be the right file"); diff --git a/toolkit/components/filepicker/nsFilePicker.js b/toolkit/components/filepicker/nsFilePicker.js index 25156c4ac55..dc3ad70e4b9 100644 --- a/toolkit/components/filepicker/nsFilePicker.js +++ b/toolkit/components/filepicker/nsFilePicker.js @@ -93,7 +93,7 @@ nsFilePicker.prototype = { /* readonly attribute nsISimpleEnumerator files; */ get files() { return this.mFilesEnumerator; }, - /* readonly attribute nsIDOMFile domfile; */ + /* readonly attribute DOM File domfile; */ get domfile() { let enumerator = this.domfiles; return enumerator ? enumerator.mFiles[0] : null; diff --git a/toolkit/modules/PropertyListUtils.jsm b/toolkit/modules/PropertyListUtils.jsm index 8602a4e4651..436caef9fe0 100644 --- a/toolkit/modules/PropertyListUtils.jsm +++ b/toolkit/modules/PropertyListUtils.jsm @@ -83,7 +83,7 @@ this.PropertyListUtils = Object.freeze({ * The reaon for failure is reported to the Error Console. */ read: function PLU_read(aFile, aCallback) { - if (!(aFile instanceof Ci.nsILocalFile || aFile instanceof Ci.nsIDOMFile)) + if (!(aFile instanceof Ci.nsILocalFile || aFile instanceof File)) throw new Error("aFile is not a file object"); if (typeof(aCallback) != "function") throw new Error("Invalid value for aCallback"); diff --git a/widget/nsBaseFilePicker.cpp b/widget/nsBaseFilePicker.cpp index 7576b6cd498..37aec317d8e 100644 --- a/widget/nsBaseFilePicker.cpp +++ b/widget/nsBaseFilePicker.cpp @@ -96,7 +96,7 @@ public: return NS_ERROR_FAILURE; } - nsCOMPtr domFile = File::CreateFromFile(mParent, localFile); + nsCOMPtr domFile = File::CreateFromFile(mParent, localFile); domFile.forget(aResult); return NS_OK; } @@ -311,7 +311,7 @@ nsBaseFilePicker::GetMode(int16_t* aMode) } NS_IMETHODIMP -nsBaseFilePicker::GetDomfile(nsIDOMFile** aDomfile) +nsBaseFilePicker::GetDomfile(nsISupports** aDomfile) { nsCOMPtr localFile; nsresult rv = GetFile(getter_AddRefs(localFile)); @@ -322,7 +322,7 @@ nsBaseFilePicker::GetDomfile(nsIDOMFile** aDomfile) return NS_OK; } - nsRefPtr domFile = File::CreateFromFile(mParent, localFile); + nsCOMPtr domFile = File::CreateFromFile(mParent, localFile); domFile.forget(aDomfile); return NS_OK; } diff --git a/widget/nsBaseFilePicker.h b/widget/nsBaseFilePicker.h index 1a470674631..b192a162573 100644 --- a/widget/nsBaseFilePicker.h +++ b/widget/nsBaseFilePicker.h @@ -37,7 +37,7 @@ public: NS_IMETHOD SetAddToRecentDocs(bool aFlag); NS_IMETHOD GetMode(int16_t *aMode); - NS_IMETHOD GetDomfile(nsIDOMFile** aDomfile); + NS_IMETHOD GetDomfile(nsISupports** aDomfile); NS_IMETHOD GetDomfiles(nsISimpleEnumerator** aDomfiles); protected: diff --git a/widget/nsFilePickerProxy.cpp b/widget/nsFilePickerProxy.cpp index 54a73aaa099..b1eb2911de3 100644 --- a/widget/nsFilePickerProxy.cpp +++ b/widget/nsFilePickerProxy.cpp @@ -165,7 +165,7 @@ nsFilePickerProxy::Recv__delete__(const MaybeInputFiles& aFiles, nsRefPtr file = File::Create(mParent, blobImpl); MOZ_ASSERT(file); - mDomfiles.AppendObject(file); + mDomfiles.AppendElement(file); } } @@ -178,7 +178,7 @@ nsFilePickerProxy::Recv__delete__(const MaybeInputFiles& aFiles, } NS_IMETHODIMP -nsFilePickerProxy::GetDomfile(nsIDOMFile** aDomfile) +nsFilePickerProxy::GetDomfile(nsISupports** aDomfile) { *aDomfile = nullptr; if (mDomfiles.IsEmpty()) { @@ -186,13 +186,55 @@ nsFilePickerProxy::GetDomfile(nsIDOMFile** aDomfile) } MOZ_ASSERT(mDomfiles.Length() == 1); - nsCOMPtr domfile = mDomfiles[0]; - domfile.forget(aDomfile); + nsCOMPtr blob = mDomfiles[0].get(); + blob.forget(aDomfile); return NS_OK; } +namespace { + +class SimpleEnumerator final : public nsISimpleEnumerator +{ +public: + NS_DECL_ISUPPORTS + + explicit SimpleEnumerator(const nsTArray>& aFiles) + : mFiles(aFiles) + , mIndex(0) + {} + + NS_IMETHOD + HasMoreElements(bool* aRetvalue) override + { + MOZ_ASSERT(aRetvalue); + *aRetvalue = mFiles.Length() >= mIndex; + return NS_OK; + } + + NS_IMETHOD + GetNext(nsISupports** aSupports) override + { + nsCOMPtr blob = mFiles[mIndex++].get(); + blob.forget(aSupports); + return NS_OK; + } + +private: + ~SimpleEnumerator() + {} + + nsTArray> mFiles; + uint32_t mIndex; +}; + +NS_IMPL_ISUPPORTS(SimpleEnumerator, nsISimpleEnumerator) + +} // anonymous namespace + NS_IMETHODIMP nsFilePickerProxy::GetDomfiles(nsISimpleEnumerator** aDomfiles) { - return NS_NewArrayEnumerator(aDomfiles, mDomfiles); + nsRefPtr enumerator = new SimpleEnumerator(mDomfiles); + enumerator.forget(aDomfiles); + return NS_OK; } diff --git a/widget/nsFilePickerProxy.h b/widget/nsFilePickerProxy.h index 63c50fee273..aaba9857772 100644 --- a/widget/nsFilePickerProxy.h +++ b/widget/nsFilePickerProxy.h @@ -18,6 +18,12 @@ class nsIWidget; class nsIFile; class nsPIDOMWindow; +namespace mozilla { +namespace dom { +class File; +} +} + /** This class creates a proxy file picker to be used in content processes. The file picker just collects the initialization data and when Show() is @@ -45,7 +51,7 @@ public: NS_IMETHODIMP GetFileURL(nsIURI** aFileURL) override; NS_IMETHODIMP GetFiles(nsISimpleEnumerator** aFiles) override; - NS_IMETHODIMP GetDomfile(nsIDOMFile** aFile) override; + NS_IMETHODIMP GetDomfile(nsISupports** aFile) override; NS_IMETHODIMP GetDomfiles(nsISimpleEnumerator** aFiles) override; NS_IMETHODIMP Show(int16_t* aReturn) override; @@ -59,7 +65,7 @@ private: ~nsFilePickerProxy(); void InitNative(nsIWidget*, const nsAString&) override; - nsCOMArray mDomfiles; + nsTArray> mDomfiles; nsCOMPtr mCallback; int16_t mSelectedType; diff --git a/widget/nsIFilePicker.idl b/widget/nsIFilePicker.idl index 5a0f1d4475f..c51db99a336 100644 --- a/widget/nsIFilePicker.idl +++ b/widget/nsIFilePicker.idl @@ -8,7 +8,6 @@ interface nsIFile; interface nsIURI; -interface nsIDOMFile; interface nsIDOMWindow; interface nsISimpleEnumerator; @@ -24,7 +23,7 @@ interface nsIFilePickerShownCallback : nsISupports void done(in short aResult); }; -[scriptable, uuid(f93509a0-0434-11e3-8ffd-0800200c9a66)] +[scriptable, uuid(9840d564-42c8-4d78-9a4d-71002343c918)] interface nsIFilePicker : nsISupports { const short modeOpen = 0; // Load a file or directory @@ -143,11 +142,11 @@ interface nsIFilePicker : nsISupports readonly attribute nsISimpleEnumerator files; /** - * Get the nsIDOMFile for the file. + * Get the DOM File for the file. * * @return Returns the file currently selected as File */ - readonly attribute nsIDOMFile domfile; + readonly attribute nsISupports domfile; /** * Get the enumerator for the selected files