Bug 1047483 - patch 2 - Renaming nsDOMFileList to FileList, r=ehsan
☠☠ backed out by 47a1219c6324 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 07 Oct 2014 15:20:53 +0100
changeset 209187 e087289ccfbb9db1a0b471b6baa665810d95edaf
parent 209186 6238ff5d3ed0cdc42ec39ec772a1ffd705ed7846
child 209188 18830d07884c13f1d7af36fbad444c4578859630
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehsan
bugs1047483
milestone35.0a1
Bug 1047483 - patch 2 - Renaming nsDOMFileList to FileList, r=ehsan
content/base/public/nsDOMFile.h
content/base/src/nsDOMFile.cpp
content/html/content/src/HTMLInputElement.cpp
content/html/content/src/HTMLInputElement.h
dom/bindings/Bindings.conf
dom/events/DataTransfer.cpp
dom/events/DataTransfer.h
--- a/content/base/public/nsDOMFile.h
+++ b/content/base/public/nsDOMFile.h
@@ -56,17 +56,16 @@ class FileInfo;
 
 struct BlobPropertyBag;
 struct FilePropertyBag;
 class DOMFileImpl;
 
 /* FOLLOWUP TODO:
 1. remove nsDOMBlobBuilder.h
 2. rename nsDOMFile.h/cpp to DOMFile.h/cpp
-3. rename nsDOMFileList to DOMFileList
 */
 class DOMFile MOZ_FINAL : public nsIDOMFile
                         , public nsIXHRSendable
                         , public nsIMutable
                         , public nsSupportsWeakReference
                         , public nsWrapperCache
 {
 public:
@@ -797,28 +796,28 @@ private:
     return mWholeFile;
   }
 
   nsCOMPtr<nsIFile> mFile;
   bool mWholeFile;
   bool mStoredFile;
 };
 
-class nsDOMFileList MOZ_FINAL : public nsIDOMFileList,
-                                public nsWrapperCache
+class FileList MOZ_FINAL : public nsIDOMFileList,
+                           public nsWrapperCache
 {
-  ~nsDOMFileList() {}
+  ~FileList() {}
 
 public:
-  explicit nsDOMFileList(nsISupports *aParent) : mParent(aParent)
+  explicit FileList(nsISupports *aParent) : mParent(aParent)
   {
   }
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMFileList)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FileList)
 
   NS_DECL_NSIDOMFILELIST
 
   virtual JSObject* WrapObject(JSContext *cx) MOZ_OVERRIDE;
 
   nsISupports* GetParentObject()
   {
     return mParent;
@@ -837,31 +836,31 @@ public:
       return true;
     }
 
     return false;
   }
 
   void Clear() { return mFiles.Clear(); }
 
-  static nsDOMFileList* FromSupports(nsISupports* aSupports)
+  static FileList* FromSupports(nsISupports* aSupports)
   {
 #ifdef DEBUG
     {
       nsCOMPtr<nsIDOMFileList> list_qi = do_QueryInterface(aSupports);
 
       // If this assertion fires the QI implementation for the object in
       // question doesn't use the nsIDOMFileList pointer as the nsISupports
       // pointer. That must be fixed, or we'll crash...
       NS_ASSERTION(list_qi == static_cast<nsIDOMFileList*>(aSupports),
                    "Uh, fix QI!");
     }
 #endif
 
-    return static_cast<nsDOMFileList*>(aSupports);
+    return static_cast<FileList*>(aSupports);
   }
 
   DOMFile* Item(uint32_t aIndex)
   {
     return mFiles.SafeElementAt(aIndex);
   }
   DOMFile* IndexedGetter(uint32_t aIndex, bool& aFound)
   {
--- a/content/base/src/nsDOMFile.cpp
+++ b/content/base/src/nsDOMFile.cpp
@@ -1200,45 +1200,45 @@ DOMFileImplTemporaryFileBlob::GetInterna
 {
   nsCOMPtr<nsIInputStream> stream =
     new nsTemporaryFileInputStream(mFileDescOwner, mStartPos, mStartPos + mLength);
   stream.forget(aStream);
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////
-// nsDOMFileList implementation
+// FileList implementation
 
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsDOMFileList, mFiles)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(FileList, mFiles)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMFileList)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FileList)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMFileList)
   NS_INTERFACE_MAP_ENTRY(nsIDOMFileList)
 NS_INTERFACE_MAP_END
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMFileList)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMFileList)
+NS_IMPL_CYCLE_COLLECTING_ADDREF(FileList)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(FileList)
 
 JSObject*
-nsDOMFileList::WrapObject(JSContext *cx)
+FileList::WrapObject(JSContext *cx)
 {
   return mozilla::dom::FileListBinding::Wrap(cx, this);
 }
 
 NS_IMETHODIMP
-nsDOMFileList::GetLength(uint32_t* aLength)
+FileList::GetLength(uint32_t* aLength)
 {
   *aLength = Length();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMFileList::Item(uint32_t aIndex, nsIDOMFile **aFile)
+FileList::Item(uint32_t aIndex, nsIDOMFile **aFile)
 {
   nsRefPtr<DOMFile> file = Item(aIndex);
   file.forget(aFile);
   return NS_OK;
 }
 
 } // dom namespace
 } // mozilla namespace
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -2582,17 +2582,17 @@ HTMLInputElement::SetFiles(const nsTArra
 
   AfterSetFiles(aSetValueChanged);
 }
 
 void
 HTMLInputElement::SetFiles(nsIDOMFileList* aFiles,
                            bool aSetValueChanged)
 {
-  nsRefPtr<nsDOMFileList> files = static_cast<nsDOMFileList*>(aFiles);
+  nsRefPtr<FileList> files = static_cast<FileList*>(aFiles);
   mFiles.Clear();
 
   if (aFiles) {
     uint32_t listLength;
     aFiles->GetLength(&listLength);
     for (uint32_t i = 0; i < listLength; i++) {
       nsRefPtr<DOMFile> file = files->Item(i);
       mFiles.AppendElement(file);
@@ -2637,25 +2637,25 @@ HTMLInputElement::FireChangeEventIfNeede
   // Dispatch the change event.
   mFocusedValue = value;
   nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
                                        static_cast<nsIContent*>(this),
                                        NS_LITERAL_STRING("change"), true,
                                        false);
 }
 
-nsDOMFileList*
+FileList*
 HTMLInputElement::GetFiles()
 {
   if (mType != NS_FORM_INPUT_FILE) {
     return nullptr;
   }
 
   if (!mFileList) {
-    mFileList = new nsDOMFileList(static_cast<nsIContent*>(this));
+    mFileList = new FileList(static_cast<nsIContent*>(this));
     UpdateFileList();
   }
 
   return mFileList;
 }
 
 void
 HTMLInputElement::OpenDirectoryPicker(ErrorResult& aRv)
@@ -5372,17 +5372,17 @@ HTMLInputElement::SetSelectionEnd(int32_
   ErrorResult rv;
   SetSelectionEnd(aSelectionEnd, rv);
   return rv.ErrorCode();
 }
 
 NS_IMETHODIMP
 HTMLInputElement::GetFiles(nsIDOMFileList** aFileList)
 {
-  nsRefPtr<nsDOMFileList> list = GetFiles();
+  nsRefPtr<FileList> list = GetFiles();
   list.forget(aFileList);
   return NS_OK;
 }
 
 nsresult
 HTMLInputElement::GetSelectionRange(int32_t* aSelectionStart,
                                     int32_t* aSelectionEnd)
 {
--- a/content/html/content/src/HTMLInputElement.h
+++ b/content/html/content/src/HTMLInputElement.h
@@ -33,17 +33,17 @@ namespace mozilla {
 class EventChainPostVisitor;
 class EventChainPreVisitor;
 
 namespace dom {
 
 class Date;
 class DirPickerFileListBuilderTask;
 class DOMFile;
-class nsDOMFileList;
+class FileList;
 
 class UploadLastDir MOZ_FINAL : public nsIObserver, public nsSupportsWeakReference {
 
   ~UploadLastDir() {}
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
@@ -428,17 +428,17 @@ public:
 
   void SetDisabled(bool aValue,ErrorResult& aRv)
   {
     SetHTMLBoolAttr(nsGkAtoms::disabled, aValue, aRv);
   }
 
   // XPCOM GetForm() is OK
 
-  nsDOMFileList* GetFiles();
+  FileList* GetFiles();
 
   void OpenDirectoryPicker(ErrorResult& aRv);
   void CancelDirectoryPickerScanIfRunning();
 
   void StartProgressEventTimer();
   void MaybeDispatchProgressEvent(bool aFinalProgress);
   void DispatchProgressEvent(const nsAString& aType,
                              bool aLengthComputable,
@@ -1249,17 +1249,17 @@ protected:
    * to a file-input. Additionally, the logic for this value is kept as simple
    * as possible to avoid accidental errors where the wrong filename is used.
    * Therefor the list of filenames is always owned by this member, never by
    * the frame. Whenever the frame wants to change the filename it has to call
    * SetFileNames to update this member.
    */
   nsTArray<nsRefPtr<DOMFile>> mFiles;
 
-  nsRefPtr<nsDOMFileList>  mFileList;
+  nsRefPtr<FileList>  mFileList;
 
   nsRefPtr<DirPickerFileListBuilderTask> mDirPickerFileListBuilderTask;
 
   nsString mStaticDocFileList;
   
   /** 
    * The value of the input element when first initialized and it is updated
    * when the element is either changed through a script, focused or dispatches   
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -401,17 +401,16 @@ DOMInterfaces = {
 },
 
 'File': {
     'nativeType': 'mozilla::dom::DOMFile',
     'headerFile': 'nsDOMFile.h',
 },
 
 'FileList': {
-    'nativeType': 'mozilla::dom::nsDOMFileList',
     'headerFile': 'nsDOMFile.h',
 },
 
 'FileReader': {
     'nativeType': 'nsDOMFileReader',
     'implicitJSContext': [ 'readAsArrayBuffer' ],
 },
 
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -264,26 +264,26 @@ DataTransfer::SetEffectAllowedInt(uint32
 
 NS_IMETHODIMP
 DataTransfer::GetMozUserCancelled(bool* aUserCancelled)
 {
   *aUserCancelled = MozUserCancelled();
   return NS_OK;
 }
 
-nsDOMFileList*
+FileList*
 DataTransfer::GetFiles(ErrorResult& aRv)
 {
   if (mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
       mEventType != NS_PASTE) {
     return nullptr;
   }
 
   if (!mFiles) {
-    mFiles = new nsDOMFileList(static_cast<nsIDOMDataTransfer*>(this));
+    mFiles = new FileList(static_cast<nsIDOMDataTransfer*>(this));
 
     uint32_t count = mItems.Length();
 
     for (uint32_t i = 0; i < count; i++) {
       nsCOMPtr<nsIVariant> variant;
       aRv = MozGetDataAt(NS_ConvertUTF8toUTF16(kFileMime), i, getter_AddRefs(variant));
       if (aRv.Failed()) {
         return nullptr;
--- a/dom/events/DataTransfer.h
+++ b/dom/events/DataTransfer.h
@@ -138,17 +138,17 @@ public:
   void SetDragImage(Element& aElement, int32_t aX, int32_t aY,
                     ErrorResult& aRv);
   already_AddRefed<DOMStringList> Types();
   void GetData(const nsAString& aFormat, nsAString& aData, ErrorResult& aRv);
   void SetData(const nsAString& aFormat, const nsAString& aData,
                ErrorResult& aRv);
   void ClearData(const mozilla::dom::Optional<nsAString>& aFormat,
                  mozilla::ErrorResult& aRv);
-  nsDOMFileList* GetFiles(mozilla::ErrorResult& aRv);
+  FileList* GetFiles(mozilla::ErrorResult& aRv);
   void AddElement(Element& aElement, mozilla::ErrorResult& aRv);
   uint32_t MozItemCount()
   {
     return mItems.Length();
   }
   void GetMozCursor(nsString& aCursor)
   {
     if (mCursorState) {
@@ -273,17 +273,17 @@ protected:
   // Indicates which clipboard type to use for clipboard operations. Ignored for
   // drag and drop.
   int32_t mClipboardType;
 
   // array of items, each containing an array of format->data pairs
   nsTArray<nsTArray<TransferItem> > mItems;
 
   // array of files, containing only the files present in the dataTransfer
-  nsRefPtr<nsDOMFileList> mFiles;
+  nsRefPtr<FileList> mFiles;
 
   // the target of the drag. The drag and dragend events will fire at this.
   nsCOMPtr<mozilla::dom::Element> mDragTarget;
 
   // the custom drag image and coordinates within the image. If mDragImage is
   // null, the default image is created from the drag target.
   nsCOMPtr<mozilla::dom::Element> mDragImage;
   uint32_t mDragImageX;