tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DataTransfer.h (23238B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_dom_DataTransfer_h
      8 #define mozilla_dom_DataTransfer_h
      9 
     10 #include "mozilla/Assertions.h"
     11 #include "mozilla/EventForwards.h"
     12 #include "mozilla/dom/BindingDeclarations.h"
     13 #include "mozilla/dom/DataTransferItemList.h"
     14 #include "mozilla/dom/File.h"
     15 #include "nsCycleCollectionParticipant.h"
     16 #include "nsIClipboard.h"
     17 #include "nsIDragService.h"
     18 #include "nsIPrincipal.h"
     19 #include "nsITransferable.h"
     20 #include "nsIVariant.h"
     21 #include "nsString.h"
     22 #include "nsStringStream.h"
     23 #include "nsTArray.h"
     24 
     25 class nsIClipboardDataSnapshot;
     26 class nsINode;
     27 class nsITransferable;
     28 class nsILoadContext;
     29 
     30 namespace mozilla {
     31 
     32 class EventStateManager;
     33 
     34 namespace dom {
     35 
     36 class IPCDataTransfer;
     37 class DataTransferItem;
     38 class DataTransferItemList;
     39 class DOMStringList;
     40 class Element;
     41 class FileList;
     42 class Promise;
     43 template <typename T>
     44 class Optional;
     45 class WindowContext;
     46 
     47 #define NS_DATATRANSFER_IID \
     48  {0x6c5f90d1, 0xa886, 0x42c8, {0x85, 0x06, 0x10, 0xbe, 0x5c, 0x0d, 0xc6, 0x77}}
     49 
     50 /**
     51 * See <https://html.spec.whatwg.org/multipage/dnd.html#datatransfer>.
     52 */
     53 class DataTransfer final : public nsISupports, public nsWrapperCache {
     54 public:
     55  NS_INLINE_DECL_STATIC_IID(NS_DATATRANSFER_IID)
     56 
     57  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     58 
     59  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(DataTransfer)
     60 
     61  friend class mozilla::EventStateManager;
     62 
     63  /// An enum which represents which "Drag Data Store Mode" the DataTransfer is
     64  /// in according to the spec.
     65  enum class Mode : uint8_t {
     66    ReadWrite,
     67    ReadOnly,
     68    Protected,
     69  };
     70 
     71 protected:
     72  // hide the default constructor
     73  DataTransfer();
     74 
     75  // this constructor is used only by the Clone method to copy the fields as
     76  // needed to a new data transfer.
     77  // NOTE: Do not call this method directly.
     78  DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
     79               const uint32_t aEffectAllowed, bool aCursorState,
     80               bool aIsExternal, bool aUserCancelled,
     81               bool aIsCrossDomainSubFrameDrop,
     82               mozilla::Maybe<nsIClipboard::ClipboardType> aClipboardType,
     83               nsCOMPtr<nsIClipboardDataSnapshot> aClipboardDataSnapshot,
     84               DataTransferItemList* aItems, Element* aDragImage,
     85               uint32_t aDragImageX, uint32_t aDragImageY,
     86               bool aShowFailAnimation);
     87 
     88  ~DataTransfer();
     89 
     90  static const char sEffects[8][9];
     91 
     92 public:
     93  // Constructor for DataTransfer.
     94  //
     95  // aIsExternal must only be true when used to create a dataTransfer for a
     96  // paste, a drag or an input that was started without using a data transfer.
     97  // The case of a drag will occur when an external drag occurs, that is, a
     98  // drag where the source is another application, or a drag is started by
     99  // calling the drag service directly. For clipboard operations,
    100  // aClipboardType indicates which clipboard to use, from nsIClipboard, or
    101  // Nothing for non-clipboard operations, or if access to the system clipboard
    102  // should not be allowed.
    103  DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
    104               bool aIsExternal,
    105               mozilla::Maybe<nsIClipboard::ClipboardType> aClipboardType);
    106  DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
    107               nsITransferable* aTransferable);
    108  DataTransfer(nsISupports* aParent, EventMessage aEventMessage,
    109               const nsAString& aString);
    110  DataTransfer(nsISupports* aParent, nsIClipboard::ClipboardType aClipboardType,
    111               nsIClipboardDataSnapshot* aClipboardDataSnapshot);
    112 
    113  virtual JSObject* WrapObject(JSContext* aCx,
    114                               JS::Handle<JSObject*> aGivenProto) override;
    115 
    116  nsISupports* GetParentObject() const { return mParent; }
    117 
    118  void SetParentObject(nsISupports* aNewParent) {
    119    MOZ_ASSERT(aNewParent);
    120    // Setting the parent after we've been wrapped is pointless, so
    121    // make sure we aren't wrapped yet.
    122    MOZ_ASSERT(!GetWrapperPreserveColor());
    123    mParent = aNewParent;
    124  }
    125 
    126  static already_AddRefed<DataTransfer> Constructor(
    127      const GlobalObject& aGlobal);
    128 
    129  /**
    130   * This creates a DataTransfer by calling nsIClipboard::GetDataSnapshot() to
    131   * obtain an nsIClipboardDataSnapshot first, in order to trigger the security
    132   * checks, i.e. showing a paste contextmenu to request user confirmation if
    133   * the clipboard data originated from a cross-origin page. All of that is
    134   * handled in the parent process, so we spin the event loop here to wait for
    135   * the result.
    136   */
    137  MOZ_CAN_RUN_SCRIPT
    138  static already_AddRefed<DataTransfer> WaitForClipboardDataSnapshotAndCreate(
    139      nsPIDOMWindowOuter* aWindow, nsIPrincipal* aSubjectPrincipal);
    140 
    141  /**
    142   * The actual effect that will be used, and should always be one of the
    143   * possible values of effectAllowed.
    144   *
    145   * For dragstart, drag and dragleave events, the dropEffect is initialized
    146   * to none. Any value assigned to the dropEffect will be set, but the value
    147   * isn't used for anything.
    148   *
    149   * For the dragenter and dragover events, the dropEffect will be initialized
    150   * based on what action the user is requesting. How this is determined is
    151   * platform specific, but typically the user can press modifier keys to
    152   * adjust which action is desired. Within an event handler for the dragenter
    153   * and dragover events, the dropEffect should be modified if the action the
    154   * user is requesting is not the one that is desired.
    155   *
    156   * For the drop and dragend events, the dropEffect will be initialized to
    157   * the action that was desired, which will be the value that the dropEffect
    158   * had after the last dragenter or dragover event.
    159   *
    160   * Possible values:
    161   *  copy - a copy of the source item is made at the new location
    162   *  move - an item is moved to a new location
    163   *  link - a link is established to the source at the new location
    164   *  none - the item may not be dropped
    165   *
    166   * Assigning any other value has no effect and retains the old value.
    167   */
    168  void GetDropEffect(nsAString& aDropEffect) {
    169    aDropEffect.AssignASCII(sEffects[mDropEffect]);
    170  }
    171  void SetDropEffect(const nsAString& aDropEffect);
    172 
    173  /*
    174   * Specifies the effects that are allowed for this drag. You may set this in
    175   * the dragstart event to set the desired effects for the source, and within
    176   * the dragenter and dragover events to set the desired effects for the
    177   * target. The value is not used for other events.
    178   *
    179   * Possible values:
    180   *  copy - a copy of the source item is made at the new location
    181   *  move - an item is moved to a new location
    182   *  link - a link is established to the source at the new location
    183   *  copyLink, copyMove, linkMove, all - combinations of the above
    184   *  none - the item may not be dropped
    185   *  uninitialized - the default value when the effect has not been set,
    186   *                  equivalent to all.
    187   *
    188   * Assigning any other value has no effect and retains the old value.
    189   */
    190  void GetEffectAllowed(nsAString& aEffectAllowed) {
    191    if (mEffectAllowed == nsIDragService::DRAGDROP_ACTION_UNINITIALIZED) {
    192      aEffectAllowed.AssignLiteral("uninitialized");
    193    } else {
    194      aEffectAllowed.AssignASCII(sEffects[mEffectAllowed]);
    195    }
    196  }
    197  void SetEffectAllowed(const nsAString& aEffectAllowed);
    198 
    199  /**
    200   * Set the image to be used for dragging if a custom one is desired. Most of
    201   * the time, this would not be set, as a default image is created from the
    202   * node that was dragged.
    203   *
    204   * If the node is an HTML img element, an HTML canvas element or a XUL image
    205   * element, the image data is used. Otherwise, image should be a visible
    206   * node and the drag image will be created from this. If image is null, any
    207   * custom drag image is cleared and the default is used instead.
    208   *
    209   * The coordinates specify the offset into the image where the mouse cursor
    210   * should be. To center the image for instance, use values that are half the
    211   * width and height.
    212   *
    213   * @param image a node to use
    214   * @param x the horizontal offset
    215   * @param y the vertical offset
    216   */
    217  void SetDragImage(Element& aElement, int32_t aX, int32_t aY);
    218  void UpdateDragImage(Element& aElement, int32_t aX, int32_t aY);
    219 
    220  void GetTypes(nsTArray<nsString>& aTypes, CallerType aCallerType) const;
    221  bool HasType(const nsAString& aType) const;
    222  bool HasFile() const;
    223 
    224  void GetData(const nsAString& aFormat, nsAString& aData,
    225               nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv) const;
    226 
    227  void SetData(const nsAString& aFormat, const nsAString& aData,
    228               nsIPrincipal& aSubjectPrincipal, ErrorResult& aRv);
    229 
    230  void ClearData(const mozilla::dom::Optional<nsAString>& aFormat,
    231                 nsIPrincipal& aSubjectPrincipal, mozilla::ErrorResult& aRv);
    232 
    233  /**
    234   * Holds a list of all the local files available on this data transfer.
    235   * A dataTransfer containing no files will return an empty list, and an
    236   * invalid index access on the resulting file list will return null.
    237   */
    238  already_AddRefed<FileList> GetFiles(nsIPrincipal& aSubjectPrincipal);
    239 
    240  void AddElement(Element& aElement, mozilla::ErrorResult& aRv);
    241 
    242  uint32_t MozItemCount() const;
    243 
    244  void GetMozCursor(nsAString& aCursor) {
    245    if (mCursorState) {
    246      aCursor.AssignLiteral("default");
    247    } else {
    248      aCursor.AssignLiteral("auto");
    249    }
    250  }
    251  void SetMozCursor(const nsAString& aCursor);
    252 
    253  already_AddRefed<DOMStringList> MozTypesAt(uint32_t aIndex,
    254                                             mozilla::ErrorResult& aRv) const;
    255 
    256  void MozClearDataAt(const nsAString& aFormat, uint32_t aIndex,
    257                      mozilla::ErrorResult& aRv);
    258 
    259  void MozSetDataAt(JSContext* aCx, const nsAString& aFormat,
    260                    JS::Handle<JS::Value> aData, uint32_t aIndex,
    261                    mozilla::ErrorResult& aRv);
    262 
    263  void MozGetDataAt(JSContext* aCx, const nsAString& aFormat, uint32_t aIndex,
    264                    JS::MutableHandle<JS::Value> aRetval,
    265                    mozilla::ErrorResult& aRv);
    266 
    267  bool MozUserCancelled() const { return mUserCancelled; }
    268 
    269  already_AddRefed<nsINode> GetMozSourceNode();
    270 
    271  already_AddRefed<WindowContext> GetSourceTopWindowContext();
    272 
    273  /*
    274   * Integer version of dropEffect, set to one of the constants in
    275   * nsIDragService.
    276   */
    277  uint32_t DropEffectInt() const { return mDropEffect; }
    278  void SetDropEffectInt(uint32_t aDropEffectInt) {
    279    MOZ_RELEASE_ASSERT(aDropEffectInt < std::size(sEffects),
    280                       "Bogus drop effect value");
    281    mDropEffect = aDropEffectInt;
    282  }
    283 
    284  /*
    285   * Integer version of effectAllowed, set to one or a combination of the
    286   * constants in nsIDragService.
    287   */
    288  uint32_t EffectAllowedInt() const { return mEffectAllowed; }
    289 
    290  void GetMozTriggeringPrincipalURISpec(nsAString& aPrincipalURISpec);
    291 
    292  nsIPolicyContainer* GetPolicyContainer();
    293 
    294  mozilla::dom::Element* GetDragTarget() const { return mDragTarget; }
    295 
    296  nsresult GetDataAtNoSecurityCheck(const nsAString& aFormat, uint32_t aIndex,
    297                                    nsIVariant** aData) const;
    298 
    299  DataTransferItemList* Items() const { return mItems; }
    300 
    301  // Returns the current "Drag Data Store Mode" of the DataTransfer. This
    302  // determines what modifications may be performed on the DataTransfer, and
    303  // what data may be read from it.
    304  Mode GetMode() const { return mMode; }
    305  void SetMode(Mode aMode);
    306 
    307  // Helper method. Is true if the DataTransfer's mode is ReadOnly or Protected,
    308  // which means that the DataTransfer cannot be modified.
    309  bool IsReadOnly() const { return mMode != Mode::ReadWrite; }
    310  // Helper method. Is true if the DataTransfer's mode is Protected, which means
    311  // that DataTransfer type information may be read, but data may not be.
    312  bool IsProtected() const { return mMode == Mode::Protected; }
    313 
    314  nsITransferable* GetTransferable() const { return mTransferable; }
    315  mozilla::Maybe<nsIClipboard::ClipboardType> ClipboardType() const {
    316    return mClipboardType;
    317  }
    318  EventMessage GetEventMessage() const { return mEventMessage; }
    319  bool IsCrossDomainSubFrameDrop() const { return mIsCrossDomainSubFrameDrop; }
    320 
    321  // converts the data into an array of nsITransferable objects to be used for
    322  // drag and drop or clipboard operations.
    323  already_AddRefed<nsIArray> GetTransferables(nsINode* aDragTarget);
    324 
    325  already_AddRefed<nsIArray> GetTransferables(nsILoadContext* aLoadContext);
    326 
    327  // converts the data for a single item at aIndex into an nsITransferable
    328  // object.
    329  already_AddRefed<nsITransferable> GetTransferable(
    330      uint32_t aIndex, nsILoadContext* aLoadContext);
    331 
    332  // converts the data in the variant to an nsISupportString if possible or
    333  // an nsISupports or null otherwise.
    334  bool ConvertFromVariant(nsIVariant* aVariant, nsISupports** aSupports,
    335                          uint32_t* aLength) const;
    336 
    337  // Disconnects the DataTransfer from the Drag Data Store. If the
    338  // dom.dataTransfer.disconnect pref is enabled, this will clear the
    339  // DataTransfer and set it to the `Protected` state, otherwise this method is
    340  // a no-op.
    341  void Disconnect();
    342 
    343  // clears all of the data
    344  void ClearAll();
    345 
    346  // Similar to SetData except also specifies the principal to store.
    347  // aData may be null when called from CacheExternalDragFormats or
    348  // CacheExternalClipboardFormats.
    349  nsresult SetDataWithPrincipal(const nsAString& aFormat, nsIVariant* aData,
    350                                uint32_t aIndex, nsIPrincipal* aPrincipal,
    351                                bool aHidden = false);
    352 
    353  // Variation of SetDataWithPrincipal with handles extracting
    354  // kCustomTypesMime data into separate types.
    355  //
    356  // @param aHidden if true and `aFormat != kCustomTypesMime`, the data will be
    357  //                hidden from non-chrome code.
    358  //                TODO: unclear, whether `aHidden` should be considered for
    359  //                the custom types.
    360  void SetDataWithPrincipalFromOtherProcess(const nsAString& aFormat,
    361                                            nsIVariant* aData, uint32_t aIndex,
    362                                            nsIPrincipal* aPrincipal,
    363                                            bool aHidden);
    364 
    365  // returns a weak reference to the drag image
    366  Element* GetDragImage(int32_t* aX, int32_t* aY) const {
    367    *aX = mDragImageX;
    368    *aY = mDragImageY;
    369    return mDragImage;
    370  }
    371 
    372  // This method makes a copy of the DataTransfer object, with a few properties
    373  // changed, and the mode updated to reflect the correct mode for the given
    374  // event. This method is used during the drag operation to generate the
    375  // DataTransfer objects for each event after `dragstart`. Event objects will
    376  // lazily clone the DataTransfer stored in the DragSession (which is a clone
    377  // of the DataTransfer used in the `dragstart` event) when requested.
    378  nsresult Clone(nsISupports* aParent, EventMessage aEventMessage,
    379                 bool aUserCancelled, bool aIsCrossDomainSubFrameDrop,
    380                 DataTransfer** aResult);
    381 
    382  // converts some formats used for compatibility in aInFormat into aOutFormat.
    383  // Text becomes text/plain, and URL becomes text/uri-list
    384  void GetRealFormat(const nsAString& aInFormat, nsAString& aOutFormat) const;
    385 
    386  static bool PrincipalMaySetData(const nsAString& aFormat, nsIVariant* aData,
    387                                  nsIPrincipal* aPrincipal);
    388 
    389  // Notify the DataTransfer that the list returned from GetTypes may have
    390  // changed.  This can happen due to items we care about for purposes of
    391  // GetTypes being added or removed or changing item kinds.
    392  void TypesListMayHaveChanged();
    393 
    394  // Testing method used to emulate internal DataTransfer management.
    395  // NOTE: Please don't use this. See the comments in the webidl for more.
    396  already_AddRefed<DataTransfer> MozCloneForEvent(const nsAString& aEvent,
    397                                                  ErrorResult& aRv);
    398 
    399  void SetMozShowFailAnimation(bool aShouldAnimate) {
    400    mShowFailAnimation = aShouldAnimate;
    401  }
    402  bool MozShowFailAnimation() const { return mShowFailAnimation; }
    403 
    404  // Retrieve a list of supporting formats in aTransferable.
    405  //
    406  // If kFileMime is supported, then it will be placed either at
    407  // index 0 or at index 1 in aResult
    408  static void GetExternalTransferableFormats(nsITransferable* aTransferable,
    409                                             bool aPlainTextOnly,
    410                                             nsTArray<nsCString>* aResult);
    411 
    412  // Formats that are "known" and won't be converted to the kCustomTypesMime.
    413  static inline const char* const kKnownFormats[] = {kTextMime,
    414                                                     kHTMLMime,
    415                                                     kNativeHTMLMime,
    416                                                     kRTFMime,
    417                                                     kURLMime,
    418                                                     kURLDataMime,
    419                                                     kURLDescriptionMime,
    420                                                     kURLPrivateMime,
    421                                                     kPNGImageMime,
    422                                                     kJPEGImageMime,
    423                                                     kGIFImageMime,
    424                                                     kNativeImageMime,
    425                                                     kFileMime,
    426                                                     kFilePromiseMime,
    427                                                     kFilePromiseURLMime,
    428                                                     kFilePromiseDestFilename,
    429                                                     kFilePromiseDirectoryMime,
    430                                                     kMozTextInternal,
    431                                                     kHTMLContext,
    432                                                     kHTMLInfo,
    433                                                     kImageRequestMime,
    434                                                     kPDFJSMime};
    435 
    436  already_AddRefed<nsIGlobalObject> GetGlobal() const;
    437 
    438  already_AddRefed<WindowContext> GetWindowContext() const;
    439 
    440  nsIClipboardDataSnapshot* GetClipboardDataSnapshot() const;
    441 
    442  // The drag session on the widget of the owner, if any.
    443  nsIDragSession* GetOwnerDragSession();
    444 
    445  // format is first element, data is second
    446  using ParseExternalCustomTypesStringData = std::pair<nsString&&, nsString&&>;
    447 
    448  // Parses out the contents of aString and calls aCallback for every data
    449  // of type eCustomClipboardTypeId_String.
    450  static void ParseExternalCustomTypesString(
    451      mozilla::Span<const char> aString,
    452      std::function<void(ParseExternalCustomTypesStringData&&)>&& aCallback);
    453 
    454  // Clears this DataTransfer that was used for paste
    455  void ClearForPaste();
    456 
    457  bool HasPrivateHTMLFlavor() const;
    458 
    459 protected:
    460  // Retrieve a list of clipboard formats supported
    461  //
    462  // If kFileMime is supported, then it will be placed either at
    463  // index 0 or at index 1 in aResult
    464  void GetExternalClipboardFormats(const bool& aPlainTextOnly,
    465                                   nsTArray<nsCString>& aResult);
    466 
    467  // caches text and uri-list data formats that exist in the drag service or
    468  // clipboard for retrieval later.
    469  nsresult CacheExternalData(const char* aFormat, uint32_t aIndex,
    470                             nsIPrincipal* aPrincipal, bool aHidden);
    471 
    472  // caches the formats that exist in the drag service that were added by an
    473  // external drag
    474  void CacheExternalDragFormats();
    475 
    476  // caches the formats that exist in the clipboard
    477  void CacheExternalClipboardFormats(bool aPlainTextOnly);
    478 
    479  // caches the formats that exist in mTransferable
    480  void CacheTransferableFormats();
    481 
    482  // caches the formats specified by aTypes.
    483  void CacheExternalData(const nsTArray<nsCString>& aTypes,
    484                         nsIPrincipal* aPrincipal);
    485 
    486  FileList* GetFilesInternal(ErrorResult& aRv, nsIPrincipal* aSubjectPrincipal);
    487  nsresult GetDataAtInternal(const nsAString& aFormat, uint32_t aIndex,
    488                             nsIPrincipal* aSubjectPrincipal,
    489                             nsIVariant** aData) const;
    490 
    491  nsresult SetDataAtInternal(const nsAString& aFormat, nsIVariant* aData,
    492                             uint32_t aIndex, nsIPrincipal* aSubjectPrincipal);
    493 
    494  friend class BrowserParent;
    495  friend class Clipboard;
    496 
    497  void FillAllExternalData();
    498 
    499  void FillInExternalCustomTypes(uint32_t aIndex, nsIPrincipal* aPrincipal);
    500 
    501  void FillInExternalCustomTypes(nsIVariant* aData, uint32_t aIndex,
    502                                 nsIPrincipal* aPrincipal);
    503 
    504  void MozClearDataAtHelper(const nsAString& aFormat, uint32_t aIndex,
    505                            nsIPrincipal& aSubjectPrincipal,
    506                            mozilla::ErrorResult& aRv);
    507 
    508  // Returns the widget of the owner, if known.
    509  nsIWidget* GetOwnerWidget();
    510 
    511  nsCOMPtr<nsISupports> mParent;
    512 
    513  // If DataTransfer is initialized with an instance of nsITransferable, it's
    514  // grabbed with this member **until** the constructor fills all data of all
    515  // items.
    516  nsCOMPtr<nsITransferable> mTransferable;
    517 
    518  // the drop effect and effect allowed
    519  uint32_t mDropEffect = nsIDragService::DRAGDROP_ACTION_NONE;
    520  uint32_t mEffectAllowed = nsIDragService::DRAGDROP_ACTION_UNINITIALIZED;
    521 
    522  // the event message this data transfer is for. This will correspond to an
    523  // event->mMessage value.
    524  EventMessage mEventMessage;
    525 
    526  // Indicates the behavior of the cursor during drag operations
    527  bool mCursorState = false;
    528 
    529  // The current "Drag Data Store Mode" which the DataTransfer is in.
    530  Mode mMode;
    531 
    532  // true for drags started without a data transfer, for example, those from
    533  // another application.
    534  bool mIsExternal = false;
    535 
    536  // true if the user cancelled the drag. Used only for the dragend event.
    537  bool mUserCancelled = false;
    538 
    539  // true if this is a cross-domain drop from a subframe where access to the
    540  // data should be prevented
    541  bool mIsCrossDomainSubFrameDrop = false;
    542 
    543  // Indicates which clipboard type to use for clipboard operations. Ignored for
    544  // drag and drop.
    545  mozilla::Maybe<nsIClipboard::ClipboardType> mClipboardType;
    546 
    547  // The nsIClipboardDataSnapshot that is used for getting clipboard formats and
    548  // data.
    549  nsCOMPtr<nsIClipboardDataSnapshot> mClipboardDataSnapshot;
    550 
    551  // The items contained with the DataTransfer
    552  RefPtr<DataTransferItemList> mItems;
    553 
    554  // the target of the drag. The drag and dragend events will fire at this.
    555  nsCOMPtr<mozilla::dom::Element> mDragTarget;
    556 
    557  // the custom drag image and coordinates within the image. If mDragImage is
    558  // null, the default image is created from the drag target.
    559  nsCOMPtr<mozilla::dom::Element> mDragImage;
    560  uint32_t mDragImageX = 0;
    561  uint32_t mDragImageY = 0;
    562 
    563  // Whether to animate the drag back to its starting point if it fails.
    564  // Not supported everywhere.
    565  bool mShowFailAnimation = true;
    566 };
    567 
    568 }  // namespace dom
    569 }  // namespace mozilla
    570 
    571 #endif /* mozilla_dom_DataTransfer_h */