Bug 1309301 - Port bug 1298243 part 7. Change DataTransfer.types from being a DOMStringList to being a frozen array: im. r?aleth draft
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 11 Oct 2016 19:41:59 +0200
changeset 20938 1bd4a1066011874a88d15c7dce054673c355de99
parent 20935 6d463070d845ed47088ee322e0bca4dc4bf12ae3
child 20939 5075108269563a3d2a4dd3b49402d29f695885f6
push id73
push userarchaeopteryx@coole-files.de
push dateTue, 11 Oct 2016 17:42:27 +0000
reviewersaleth
bugs1309301, 1298243
Bug 1309301 - Port bug 1298243 part 7. Change DataTransfer.types from being a DOMStringList to being a frozen array: im. r?aleth MozReview-Commit-ID: 1EkPtrFrR8O
im/content/buddy.xml
im/content/contact.xml
--- a/im/content/buddy.xml
+++ b/im/content/buddy.xml
@@ -179,22 +179,22 @@
      <method name="_checkDrag">
       <parameter name="aEvent"/>
       <body>
       <![CDATA[
         if (this.state != "visible")
           return;
 
         let dt = aEvent.dataTransfer;
-        if (dt.types.contains("application/x-ib-contact")) {
+        if (dt.types.includes("application/x-ib-contact")) {
           if (dt.getData("application/x-ib-contact") != this.buddy.contact.id)
             this._DragOk(aEvent);
           aEvent.stopPropagation();
         }
-        else if (dt.types.contains("application/x-ib-buddy")) {
+        else if (dt.types.includes("application/x-ib-buddy")) {
           if (dt.getData("application/x-ib-buddy") != this.buddy.id)
             this._DragOk(aEvent);
           aEvent.stopPropagation();
         }
       ]]>
       </body>
      </method>
     </implementation>
@@ -221,21 +221,21 @@
        <![CDATA[
          if (this.hasAttribute("dummy")) {
            // Droppped onto the drop target. The event will bubble to
            // the contact.
            return;
          }
          let contact = this.buddy.contact;
          let dt = event.dataTransfer;
-         if (dt.types.contains("application/x-ib-contact")) {
+         if (dt.types.includes("application/x-ib-contact")) {
            let id = dt.getData("application/x-ib-contact");
            contact.mergeContact(Services.contacts.getContactById(id));
          }
-         else if (dt.types.contains("application/x-ib-buddy")) {
+         else if (dt.types.includes("application/x-ib-buddy")) {
            let id = dt.getData("application/x-ib-buddy");
            let from = Services.contacts.getBuddyById(id);
            if (from.contact.id != contact.id)
              contact.adoptBuddy(from);
            contact.moveBuddyBefore(from, this.buddy);
          }
          else
            throw "Invalid drop on buddy!";
--- a/im/content/contact.xml
+++ b/im/content/contact.xml
@@ -430,23 +430,23 @@
      <method name="_checkDrag">
       <parameter name="aEvent"/>
       <body>
       <![CDATA[
         if (this.state != "visible")
           return;
 
         let dt = aEvent.dataTransfer;
-        if (dt.types.contains("application/x-ib-contact")) {
+        if (dt.types.includes("application/x-ib-contact")) {
           if (dt.getData("application/x-ib-contact") != this.contact.id)
             this._DragOk(aEvent);
           else
             aEvent.stopPropagation();
         }
-        else if (dt.types.contains("application/x-ib-buddy"))
+        else if (dt.types.includes("application/x-ib-buddy"))
           this._DragOk(aEvent);
       ]]>
       </body>
      </method>
     </implementation>
     <handlers>
      <handler event="blur">
        <![CDATA[
@@ -487,21 +487,21 @@
          event.dataTransfer.setData("application/x-ib-contact",
                                     this.contact.id);
          event.stopPropagation();
        ]]>
      </handler>
      <handler event="drop">
        <![CDATA[
          let dt = event.dataTransfer;
-         if (dt.types.contains("application/x-ib-contact")) {
+         if (dt.types.includes("application/x-ib-contact")) {
            let id = dt.getData("application/x-ib-contact");
            this.contact.mergeContact(Services.contacts.getContactById(id));
          }
-         else if (dt.types.contains("application/x-ib-buddy")) {
+         else if (dt.types.includes("application/x-ib-buddy")) {
            let id = dt.getData("application/x-ib-buddy");
            let from = Services.contacts.getBuddyById(id);
            if (from.contact.id != this.contact.id)
              contact.adoptBuddy(from);
            else
              contact.moveBuddyBefore(from);
          }
          else