Merge m-c to b2g-inbound.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 06 Aug 2014 15:39:23 -0400
changeset 219772 e5e3ac96acc9663e3d699c50b71c55bc57932aef
parent 219771 3422b5ff6a475b2497feeaaaedb2d8affd55a4b7 (current diff)
parent 219706 f41a267983c1bab07c9fa31d04f48ac7c03806b6 (diff)
child 219773 d265bcfec5d89efb4814a9cc25043f27c964d5e3
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-c to b2g-inbound.
dom/nfc/nsNfc.js
dom/webidl/MozNFC.webidl
dom/webidl/MozNFCPeerEvent.webidl
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -256,20 +256,16 @@ const kEventConstructors = {
   MozMessageDeletedEvent:                    { create: function (aName, aProps) {
                                                          return new MozMessageDeletedEvent(aName, aProps);
                                                        },
                                              },
   MozMmsEvent:                               { create: function (aName, aProps) {
                                                          return new MozMmsEvent(aName, aProps);
                                                        },
                                              },
-  MozNFCPeerEvent:                           { create: function (aName, aProps) {
-                                                         return new MozNFCPeerEvent(aName, aProps);
-                                                       },
-                                             },
   MozOtaStatusEvent:                         { create: function (aName, aProps) {
                                                           return new MozOtaStatusEvent(aName, aProps);
                                                        },
                                              },
   MozSettingsEvent:                          { create: function (aName, aProps) {
                                                          return new MozSettingsEvent(aName, aProps);
                                                        },
                                              },
--- a/dom/nfc/nsNfc.js
+++ b/dom/nfc/nsNfc.js
@@ -152,16 +152,20 @@ function mozNfc() {
 
   this._nfcContentHelper.registerPeerEventListener(this);
 }
 mozNfc.prototype = {
   _nfcContentHelper: null,
   _window: null,
   nfcObject: null,
 
+  _wrap: function _wrap(obj) {
+    return Cu.cloneInto(obj, this._window);
+  },
+
   init: function init(aWindow) {
     debug("mozNfc init called");
     this._window = aWindow;
   },
 
   // Only apps which have nfc-manager permission can call the following interfaces
   // 'checkP2PRegistration' , 'notifyUserAcceptedP2P' , 'notifySendFileStatus',
   // 'startPoll', 'stopPoll', and 'powerOff'.
@@ -262,20 +266,20 @@ mozNfc.prototype = {
     if (this.hasDeadWrapper()) {
       dump("this._window or this.__DOM_IMPL__ is a dead wrapper.");
       return;
     }
 
     this.session = sessionToken;
 
     debug("fire onpeerready sessionToken : " + sessionToken);
-    let eventData = {
-      "peer":this.getNFCPeer(sessionToken)
+    let detail = {
+      "detail":sessionToken
     };
-    let event = new this._window.MozNFCPeerEvent("peerready", eventData);
+    let event = new this._window.CustomEvent("peerready", this._wrap(detail));
     this.__DOM_IMPL__.dispatchEvent(event);
   },
 
   notifyPeerLost: function notifyPeerLost(sessionToken) {
     if (this.hasDeadWrapper()) {
       dump("this._window or this.__DOM_IMPL__ is a dead wrapper.");
       return;
     }
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -683,18 +683,16 @@ var interfaceNamesInGlobalScope =
     "MozMobileMessageThread",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "MozNamedAttrMap",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "MozNDEFRecord", b2g: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "MozNFCPeer", b2g: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    {name: "MozNFCPeerEvent", b2g: true, permission: "nfc-write"},
-// IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "MozNFCTag", b2g: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "MozOtaStatusEvent", b2g: true, pref: "dom.mobileconnection.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "MozPowerManager",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "mozRTCIceCandidate", pref: "media.peerconnection.enabled"},
 // IMPORTANT: Do not change this list without review from a DOM peer!
--- a/dom/webidl/MozNFC.webidl
+++ b/dom/webidl/MozNFC.webidl
@@ -46,21 +46,16 @@ interface MozNFCManager {
  NavigatorProperty="mozNfc",
  Func="Navigator::HasNFCSupport"]
 interface MozNFC : EventTarget {
    [Throws]
    MozNFCTag getNFCTag(DOMString sessionId);
    [Throws]
    MozNFCPeer getNFCPeer(DOMString sessionId);
 
-   /**
-    * This event will be fired when another NFCPeer is detected, and user confirms
-    * to share data to the NFCPeer object by calling mozNFC.notifyUserAcceptedP2P.
-    * The event will be type of NFCPeerEvent.
-    */
    [CheckPermissions="nfc-write"]
    attribute EventHandler onpeerready;
    [CheckPermissions="nfc-write"]
    attribute EventHandler onpeerlost;
 };
 
 // Mozilla Only
 partial interface MozNFC {
deleted file mode 100644
--- a/dom/webidl/MozNFCPeerEvent.webidl
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/.
- */
-
-[Constructor(DOMString type, optional MozNFCPeerEventInit eventInitDict),
- Func="Navigator::HasNFCSupport"]
-interface MozNFCPeerEvent : Event
-{
-  /**
-   * The detected NFCPeer.
-   */
-  readonly attribute MozNFCPeer? peer;
-};
-
-dictionary MozNFCPeerEventInit : EventInit
-{
-  MozNFCPeer? peer = null;
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -721,21 +721,16 @@ if CONFIG['MOZ_B2G_RIL']:
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     GENERATED_EVENTS_WEBIDL_FILES += [
         'MozWifiConnectionInfoEvent.webidl',
         'MozWifiP2pStatusChangeEvent.webidl',
         'MozWifiStationInfoEvent.webidl',
         'MozWifiStatusChangeEvent.webidl',
     ]
 
-if CONFIG['MOZ_NFC']:
-    GENERATED_EVENTS_WEBIDL_FILES += [
-        'MozNFCPeerEvent.webidl',
-    ]
-
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'xulrunner']:
     WEBIDL_FILES += [
         'BrowserFeedWriter.webidl',
     ]
 
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
     WEBIDL_FILES += [
         'External.webidl',