From f822655e4e9ba34625dbad1ac2a69258751828d6 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 6 Aug 2014 16:58:31 +0100 Subject: [PATCH] Backed out changeset b2ef6a444640 (bug 1046554) since the gaia part has been reverted --- .../test/test_all_synthetic_events.html | 4 ---- dom/nfc/nsNfc.js | 10 +++++++--- .../mochitest/general/test_interfaces.html | 2 -- dom/webidl/MozNFC.webidl | 5 ----- dom/webidl/MozNFCPeerEvent.webidl | 20 ------------------- dom/webidl/moz.build | 5 ----- 6 files changed, 7 insertions(+), 39 deletions(-) delete mode 100644 dom/webidl/MozNFCPeerEvent.webidl diff --git a/dom/events/test/test_all_synthetic_events.html b/dom/events/test/test_all_synthetic_events.html index b7ff5ebfb69c..07c5fe413413 100644 --- a/dom/events/test/test_all_synthetic_events.html +++ b/dom/events/test/test_all_synthetic_events.html @@ -261,10 +261,6 @@ const kEventConstructors = { 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); }, diff --git a/dom/nfc/nsNfc.js b/dom/nfc/nsNfc.js index 668d6baf6c46..3cc1c08d88bf 100644 --- a/dom/nfc/nsNfc.js +++ b/dom/nfc/nsNfc.js @@ -157,6 +157,10 @@ mozNfc.prototype = { _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; @@ -267,10 +271,10 @@ mozNfc.prototype = { 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); }, diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index 0067a0a2f662..e3aa55e27e30 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -687,8 +687,6 @@ var interfaceNamesInGlobalScope = {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! diff --git a/dom/webidl/MozNFC.webidl b/dom/webidl/MozNFC.webidl index 770644fef1f0..a615e94184a4 100644 --- a/dom/webidl/MozNFC.webidl +++ b/dom/webidl/MozNFC.webidl @@ -51,11 +51,6 @@ interface MozNFC : EventTarget { [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"] diff --git a/dom/webidl/MozNFCPeerEvent.webidl b/dom/webidl/MozNFCPeerEvent.webidl deleted file mode 100644 index d9100764bc88..000000000000 --- 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; -}; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 46919a416880..22c3b717d2b5 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -726,11 +726,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': 'MozWifiStatusChangeEvent.webidl', ] -if CONFIG['MOZ_NFC']: - GENERATED_EVENTS_WEBIDL_FILES += [ - 'MozNFCPeerEvent.webidl', - ] - if CONFIG['MOZ_BUILD_APP'] in ['browser', 'xulrunner']: WEBIDL_FILES += [ 'BrowserFeedWriter.webidl',