Bug 1306220 - Get rid of nsIDOMDataTransfer::clearData and mozClearDataAt, r=ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 29 Sep 2016 22:47:01 +0200
changeset 315921 8b70b53f6f27a27716706ed305ff69cb17b59606
parent 315920 9643bfae6b315489c3fbafc7fac15d5e241ca585
child 315922 0d50320d6916ab7c21348a7532c828e5390ba0a6
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1306220
milestone52.0a1
Bug 1306220 - Get rid of nsIDOMDataTransfer::clearData and mozClearDataAt, r=ehsan
dom/events/DataTransfer.cpp
dom/interfaces/events/nsIDOMDataTransfer.idl
--- a/dom/events/DataTransfer.cpp
+++ b/dom/events/DataTransfer.cpp
@@ -467,26 +467,16 @@ DataTransfer::ClearData(const Optional<n
   if (aFormat.WasPassed()) {
     MozClearDataAtHelper(aFormat.Value(), 0, aSubjectPrincipal, aRv);
   } else {
     MozClearDataAtHelper(EmptyString(), 0, aSubjectPrincipal, aRv);
   }
 }
 
 NS_IMETHODIMP
-DataTransfer::ClearData(const nsAString& aFormat)
-{
-  Optional<nsAString> format;
-  format = &aFormat;
-  ErrorResult rv;
-  ClearData(format, Some(nsContentUtils::SubjectPrincipal()), rv);
-  return rv.StealNSResult();
-}
-
-NS_IMETHODIMP
 DataTransfer::GetMozItemCount(uint32_t* aCount)
 {
   *aCount = MozItemCount();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DataTransfer::GetMozCursor(nsAString& aCursorState)
@@ -797,24 +787,16 @@ DataTransfer::MozClearDataAtHelper(const
   MOZ_ASSERT(aSubjectPrincipal.isSome());
 
   nsAutoString format;
   GetRealFormat(aFormat, format);
 
   mItems->MozRemoveByTypeAt(format, aIndex, aSubjectPrincipal, aRv);
 }
 
-NS_IMETHODIMP
-DataTransfer::MozClearDataAt(const nsAString& aFormat, uint32_t aIndex)
-{
-  ErrorResult rv;
-  MozClearDataAt(aFormat, aIndex, Some(nsContentUtils::SubjectPrincipal()), rv);
-  return rv.StealNSResult();
-}
-
 void
 DataTransfer::SetDragImage(Element& aImage, int32_t aX, int32_t aY,
                            ErrorResult& aRv)
 {
   if (mReadOnly) {
     aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
   }
--- a/dom/interfaces/events/nsIDOMDataTransfer.idl
+++ b/dom/interfaces/events/nsIDOMDataTransfer.idl
@@ -69,24 +69,16 @@ interface nsIDOMDataTransfer : nsISuppor
   /**
    * Holds a list of the format types of the data that is stored for the first
    * item, in the same order the data was added. An empty list will be
    * returned if no data was added.
    */
   readonly attribute nsISupports types;
 
   /**
-   * Remove the data associated with a given format. If format is empty or not
-   * specified, the data associated with all formats is removed. If data for
-   * the specified format does not exist, or the data transfer contains no
-   * data, this method will have no effect.
-   */
-  void clearData([optional] in DOMString format);
-
-  /**
    * Retrieves the data for a given format, or an empty string if data for
    * that format does not exist or the data transfer contains no data.
    */
   DOMString getData(in DOMString format);
 
   /**
    * Set the image to be used for dragging if a custom one is desired. Most of
    * the time, this would not be set, as a default image is created from the
@@ -140,32 +132,16 @@ interface nsIDOMDataTransfer : nsISuppor
   /**
    * Holds a list of the format types of the data that is stored for an item
    * at the specified index. If the index is not in the range from 0 to
    * itemCount - 1, an empty string list is returned.
    */
   nsISupports mozTypesAt(in unsigned long index);
 
   /**
-   * Remove the data associated with the given format for an item at the
-   * specified index. The index is in the range from zero to itemCount - 1.
-   *
-   * If the last format for the item is removed, the entire item is removed,
-   * reducing the itemCount by one.
-   *
-   * If format is empty, then the data associated with all formats is removed.
-   * If the format is not found, then this method has no effect.
-   *
-   * @param format the format to remove
-   * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount
-   * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified
-   */
-  void mozClearDataAt(in DOMString format, in unsigned long index);
-
-  /**
    * Will be true when the user has cancelled the drag (typically by pressing
    * Escape) and when the drag has been cancelled unexpectedly.  This will be
    * false otherwise, including when the drop has been rejected by its target.
    * This property is only relevant for the dragend event.
    */
   readonly attribute boolean mozUserCancelled;
 
   /**