зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1089558 - Add 'Impl' for objects defined in nsNfc.js. r=dimi
From 5d02c407d6322d79f086b66d61ffc208f4b1213c Mon Sep 17 00:00:00 2001 --- dom/nfc/nsNfc.js | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-)
This commit is contained in:
Родитель
69f5a862bf
Коммит
df4fb725c9
|
@ -24,14 +24,14 @@ XPCOMUtils.defineLazyServiceGetter(this,
|
|||
"nsIAppsService");
|
||||
|
||||
/**
|
||||
* NFCTag
|
||||
* Implementation of NFCTag.
|
||||
*
|
||||
* @param window global window object.
|
||||
* @param sessionToken session token received from parent process.
|
||||
* @parem event type of nsINfcTagEvent received from parent process.
|
||||
*/
|
||||
function MozNFCTag(window, sessionToken, event) {
|
||||
debug("In MozNFCTag Constructor");
|
||||
function MozNFCTagImpl(window, sessionToken, event) {
|
||||
debug("In MozNFCTagImpl Constructor");
|
||||
this._nfcContentHelper = Cc["@mozilla.org/nfc/content-helper;1"]
|
||||
.getService(Ci.nsINfcContentHelper);
|
||||
this._window = window;
|
||||
|
@ -46,7 +46,7 @@ function MozNFCTag(window, sessionToken, event) {
|
|||
this.type == "mifare_classic") :
|
||||
null;
|
||||
}
|
||||
MozNFCTag.prototype = {
|
||||
MozNFCTagImpl.prototype = {
|
||||
_nfcContentHelper: null,
|
||||
_window: null,
|
||||
session: null,
|
||||
|
@ -75,17 +75,20 @@ MozNFCTag.prototype = {
|
|||
};
|
||||
|
||||
/**
|
||||
* NFCPeer
|
||||
* Implementation of NFCPeer.
|
||||
*
|
||||
* @param window global window object.
|
||||
* @param sessionToken session token received from parent process.
|
||||
*/
|
||||
function MozNFCPeer(aWindow, aSessionToken) {
|
||||
debug("In MozNFCPeer Constructor");
|
||||
function MozNFCPeerImpl(aWindow, aSessionToken) {
|
||||
debug("In MozNFCPeerImpl Constructor");
|
||||
this._nfcContentHelper = Cc["@mozilla.org/nfc/content-helper;1"]
|
||||
.getService(Ci.nsINfcContentHelper);
|
||||
|
||||
this._window = aWindow;
|
||||
this.session = aSessionToken;
|
||||
}
|
||||
MozNFCPeer.prototype = {
|
||||
MozNFCPeerImpl.prototype = {
|
||||
_nfcContentHelper: null,
|
||||
_window: null,
|
||||
_isLost: false,
|
||||
|
@ -123,10 +126,10 @@ MozNFCPeer.prototype = {
|
|||
};
|
||||
|
||||
/**
|
||||
* Navigator NFC object
|
||||
* Implementation of navigator NFC object.
|
||||
*/
|
||||
function mozNfc() {
|
||||
debug("In mozNfc Constructor");
|
||||
function MozNFCImpl() {
|
||||
debug("In MozNFCImpl Constructor");
|
||||
try {
|
||||
this._nfcContentHelper = Cc["@mozilla.org/nfc/content-helper;1"]
|
||||
.getService(Ci.nsINfcContentHelper);
|
||||
|
@ -136,13 +139,13 @@ function mozNfc() {
|
|||
|
||||
this._nfcContentHelper.registerEventTarget(this);
|
||||
}
|
||||
mozNfc.prototype = {
|
||||
MozNFCImpl.prototype = {
|
||||
_nfcContentHelper: null,
|
||||
_window: null,
|
||||
nfcObject: null,
|
||||
|
||||
init: function init(aWindow) {
|
||||
debug("mozNfc init called");
|
||||
debug("MozNFCImpl init called");
|
||||
this._window = aWindow;
|
||||
this.defineEventHandlerGetterSetter("ontagfound");
|
||||
this.defineEventHandlerGetterSetter("ontaglost");
|
||||
|
@ -192,7 +195,7 @@ mozNfc.prototype = {
|
|||
}
|
||||
|
||||
if (!this.nfcObject || this.nfcObject.session != sessionToken) {
|
||||
let obj = new MozNFCPeer(this._window, sessionToken);
|
||||
let obj = new MozNFCPeerImpl(this._window, sessionToken);
|
||||
this.nfcObject = obj;
|
||||
this.nfcObject.contentObject = this._window.MozNFCPeer._create(this._window, obj);
|
||||
}
|
||||
|
@ -239,8 +242,8 @@ mozNfc.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let tag = new MozNFCTag(this._window, sessionToken, event);
|
||||
let tagContentObj = this._window.MozNFCTag._create(this._window, tag);
|
||||
let tagImpl = new MozNFCTagImpl(this._window, sessionToken, event);
|
||||
let tag = this._window.MozNFCTag._create(this._window, tagImpl);
|
||||
|
||||
let length = records ? records.length : 0;
|
||||
let ndefRecords = records ? [] : null;
|
||||
|
@ -253,7 +256,7 @@ mozNfc.prototype = {
|
|||
}
|
||||
|
||||
let eventData = {
|
||||
"tag": tagContentObj,
|
||||
"tag": tag,
|
||||
"ndefRecords": ndefRecords
|
||||
};
|
||||
|
||||
|
@ -349,4 +352,5 @@ mozNfc.prototype = {
|
|||
Ci.nsINfcDOMEventTarget]),
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MozNFCTag, MozNFCPeer, mozNfc]);
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MozNFCTagImpl,
|
||||
MozNFCPeerImpl, MozNFCImpl]);
|
||||
|
|
Загрузка…
Ссылка в новой задаче