Bug 1087861 - Remove initialize() from MozNFCTag and MozNFCPeer. r=dlee

This commit is contained in:
Yoshi Huang 2014-10-23 12:19:22 +08:00
parent fc32462502
commit 5a109c9eac

View File

@ -26,21 +26,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
/**
* NFCTag
*/
function MozNFCTag() {
function MozNFCTag(aWindow, aSessionToken) {
debug("In MozNFCTag Constructor");
this._nfcContentHelper = Cc["@mozilla.org/nfc/content-helper;1"]
.getService(Ci.nsINfcContentHelper);
this.session = null;
this._window = aWindow;
this.session = aSessionToken;
}
MozNFCTag.prototype = {
_nfcContentHelper: null,
_window: null,
initialize: function(aWindow, aSessionToken) {
this._window = aWindow;
this.session = aSessionToken;
},
// NFCTag interface:
readNDEF: function readNDEF() {
return this._nfcContentHelper.readNDEF(this._window, this.session);
@ -61,22 +57,19 @@ MozNFCTag.prototype = {
/**
* NFCPeer
*/
function MozNFCPeer() {
function MozNFCPeer(aWindow, aSessionToken) {
debug("In MozNFCPeer Constructor");
this._nfcContentHelper = Cc["@mozilla.org/nfc/content-helper;1"]
.getService(Ci.nsINfcContentHelper);
this.session = null;
this._window = aWindow;
this.session = aSessionToken;
}
MozNFCPeer.prototype = {
_nfcContentHelper: null,
_window: null,
_isLost: false,
initialize: function(aWindow, aSessionToken) {
this._window = aWindow;
this.session = aSessionToken;
},
// NFCPeer interface:
sendNDEF: function sendNDEF(records) {
if (this._isLost) {
@ -170,8 +163,7 @@ mozNfc.prototype = {
},
getNFCTag: function getNFCTag(sessionToken) {
let obj = new MozNFCTag();
obj.initialize(this._window, sessionToken);
let obj = new MozNFCTag(this._window, sessionToken);
if (this._nfcContentHelper.checkSessionToken(sessionToken)) {
return this._window.MozNFCTag._create(this._window, obj);
}
@ -184,8 +176,7 @@ mozNfc.prototype = {
}
if (!this.nfcObject || this.nfcObject.session != sessionToken) {
let obj = new MozNFCPeer();
obj.initialize(this._window, sessionToken);
let obj = new MozNFCPeer(this._window, sessionToken);
this.nfcObject = obj;
this.nfcObject.contentObject = this._window.MozNFCPeer._create(this._window, obj);
}