mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1046554 - B2G NFC: pass NFCPeerEvent in onpeerready. r=smaug, dimi
This commit is contained in:
parent
c47835efd2
commit
47606c7455
@ -261,6 +261,10 @@ const kEventConstructors = {
|
|||||||
return new MozMmsEvent(aName, aProps);
|
return new MozMmsEvent(aName, aProps);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
MozNFCPeerEvent: { create: function (aName, aProps) {
|
||||||
|
return new MozNFCPeerEvent(aName, aProps);
|
||||||
|
},
|
||||||
|
},
|
||||||
MozOtaStatusEvent: { create: function (aName, aProps) {
|
MozOtaStatusEvent: { create: function (aName, aProps) {
|
||||||
return new MozOtaStatusEvent(aName, aProps);
|
return new MozOtaStatusEvent(aName, aProps);
|
||||||
},
|
},
|
||||||
|
@ -157,10 +157,6 @@ mozNfc.prototype = {
|
|||||||
_window: null,
|
_window: null,
|
||||||
nfcObject: null,
|
nfcObject: null,
|
||||||
|
|
||||||
_wrap: function _wrap(obj) {
|
|
||||||
return Cu.cloneInto(obj, this._window);
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function init(aWindow) {
|
init: function init(aWindow) {
|
||||||
debug("mozNfc init called");
|
debug("mozNfc init called");
|
||||||
this._window = aWindow;
|
this._window = aWindow;
|
||||||
@ -271,10 +267,10 @@ mozNfc.prototype = {
|
|||||||
this.session = sessionToken;
|
this.session = sessionToken;
|
||||||
|
|
||||||
debug("fire onpeerready sessionToken : " + sessionToken);
|
debug("fire onpeerready sessionToken : " + sessionToken);
|
||||||
let detail = {
|
let eventData = {
|
||||||
"detail":sessionToken
|
"peer":this.getNFCPeer(sessionToken)
|
||||||
};
|
};
|
||||||
let event = new this._window.CustomEvent("peerready", this._wrap(detail));
|
let event = new this._window.MozNFCPeerEvent("peerready", eventData);
|
||||||
this.__DOM_IMPL__.dispatchEvent(event);
|
this.__DOM_IMPL__.dispatchEvent(event);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -687,6 +687,8 @@ var interfaceNamesInGlobalScope =
|
|||||||
{name: "MozNDEFRecord", b2g: true},
|
{name: "MozNDEFRecord", b2g: true},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{name: "MozNFCPeer", b2g: true},
|
{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!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
{name: "MozNFCTag", b2g: true},
|
{name: "MozNFCTag", b2g: true},
|
||||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||||
|
@ -51,6 +51,11 @@ interface MozNFC : EventTarget {
|
|||||||
[Throws]
|
[Throws]
|
||||||
MozNFCPeer getNFCPeer(DOMString sessionId);
|
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"]
|
[CheckPermissions="nfc-write"]
|
||||||
attribute EventHandler onpeerready;
|
attribute EventHandler onpeerready;
|
||||||
[CheckPermissions="nfc-write"]
|
[CheckPermissions="nfc-write"]
|
||||||
|
20
dom/webidl/MozNFCPeerEvent.webidl
Normal file
20
dom/webidl/MozNFCPeerEvent.webidl
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/* -*- 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;
|
||||||
|
};
|
@ -726,6 +726,11 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
|||||||
'MozWifiStatusChangeEvent.webidl',
|
'MozWifiStatusChangeEvent.webidl',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if CONFIG['MOZ_NFC']:
|
||||||
|
GENERATED_EVENTS_WEBIDL_FILES += [
|
||||||
|
'MozNFCPeerEvent.webidl',
|
||||||
|
]
|
||||||
|
|
||||||
if CONFIG['MOZ_BUILD_APP'] in ['browser', 'xulrunner']:
|
if CONFIG['MOZ_BUILD_APP'] in ['browser', 'xulrunner']:
|
||||||
WEBIDL_FILES += [
|
WEBIDL_FILES += [
|
||||||
'BrowserFeedWriter.webidl',
|
'BrowserFeedWriter.webidl',
|
||||||
|
Loading…
Reference in New Issue
Block a user