Bug 1170053 - [Aries] Not able to share a picture using NFC. r=yoshi
authorDimi Lee <dlee@mozilla.com>
Wed, 03 Jun 2015 15:54:55 +0800
changeset 269573 dcb7f4814c61d56d87f9613d238777b53ca5d9b2
parent 269572 86d8bdbc56fdecabd4f85ae6e62788edce65cb2a
child 269574 6b791ecdb4704b89e0737ea4ea7db3ff206321d5
push id2540
push userwcosta@mozilla.com
push dateWed, 03 Jun 2015 20:55:41 +0000
reviewersyoshi
bugs1170053
milestone41.0a1
Bug 1170053 - [Aries] Not able to share a picture using NFC. r=yoshi
dom/nfc/NfcContentHelper.js
dom/nfc/gonk/Nfc.js
dom/nfc/nsINfcContentHelper.idl
dom/nfc/nsNfc.js
--- a/dom/nfc/NfcContentHelper.js
+++ b/dom/nfc/NfcContentHelper.js
@@ -213,20 +213,19 @@ NfcContentHelper.prototype = {
     this._requestMap[requestId] = callback;
 
     cpmm.sendAsyncMessage("NFC:CheckP2PRegistration", {
       appId: appId,
       requestId: requestId
     });
   },
 
-  notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId, tabId) {
+  notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId) {
     cpmm.sendAsyncMessage("NFC:NotifyUserAcceptedP2P", {
-      appId: appId,
-      tabId: tabId
+      appId: appId
     });
   },
 
   changeRFState: function changeRFState(rfState, callback) {
     let requestId = callback.getCallbackId();
     this._requestMap[requestId] = callback;
 
     cpmm.sendAsyncMessage("NFC:ChangeRFState",
--- a/dom/nfc/gonk/Nfc.js
+++ b/dom/nfc/gonk/Nfc.js
@@ -287,26 +287,26 @@ XPCOMUtils.defineLazyGetter(this, "gMess
       let respMsg = { requestId: message.data.requestId };
       if (!isValid) {
         respMsg.errorMsg = this.nfc.getErrorMessage(NFC.NFC_GECKO_ERROR_P2P_REG_INVALID);
       }
       // Notify the content process immediately of the status
       message.target.sendAsyncMessage(message.name + "Response", respMsg);
     },
 
-    notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId, tabId) {
+    notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId) {
       let target = this.peerTargets[appId];
       let sessionToken = SessionHelper.getCurrentP2PToken();
       let isValid = (sessionToken != null) && (target != null);
       if (!isValid) {
         debug("Peer already lost or " + appId + " is not a registered PeerReadytarget");
         return;
       }
 
-      this.notifyDOMEvent(target, {tabId: tabId,
+      this.notifyDOMEvent(target, {tabId: this.focusApp,
                                    event: NFC.PEER_EVENT_READY,
                                    sessionToken: sessionToken});
     },
 
     notifySendFileStatus: function notifySendFileStatus(message) {
       if (message.data.status) {
         message.data.errorMsg =
             this.nfc.getErrorMessage(NFC.NFC_GECKO_ERROR_SEND_FILE_FAILED);
@@ -403,17 +403,17 @@ XPCOMUtils.defineLazyGetter(this, "gMess
           return null;
         case "NFC:UnregisterPeerReadyTarget":
           this.unregisterPeerReadyTarget(message.data.appId);
           return null;
         case "NFC:CheckP2PRegistration":
           this.checkP2PRegistration(message);
           return null;
         case "NFC:NotifyUserAcceptedP2P":
-          this.notifyUserAcceptedP2P(message.data.appId, message.data.tabId);
+          this.notifyUserAcceptedP2P(message.data.appId);
           return null;
         case "NFC:NotifySendFileStatus":
           // Upon receiving the status of sendFile operation, send the response
           // to appropriate content process.
           this.notifySendFileStatus(message);
           return null;
         case "NFC:CallDefaultFoundHandler":
           this.callDefaultFoundHandler(message.data);
--- a/dom/nfc/nsINfcContentHelper.idl
+++ b/dom/nfc/nsINfcContentHelper.idl
@@ -119,17 +119,17 @@ interface nsINfcRequestCallback : nsISup
 interface nsINfcBrowserAPI : nsISupports
 {
   const int32_t SYSTEM_APP_ID = 0;
 
   void setFocusApp(in uint64_t tabId,
                    in boolean isFocus);
 };
 
-[scriptable, uuid(f0ed35c5-3f59-4806-b6bb-e77b879887af)]
+[scriptable, uuid(75f0c8c0-2e5a-491f-a75d-4f3849c4feec)]
 interface nsINfcContentHelper : nsISupports
 {
   /**
    * Read current NDEF data on the tag.
    *
    * @param sessionToken
    *        Current token
    *
@@ -272,20 +272,18 @@ interface nsINfcContentHelper : nsISuppo
   void checkP2PRegistration(in unsigned long appId,
                             in nsINfcRequestCallback callback);
 
   /**
    * Notify the parent process that user has accepted to share nfc message on P2P UI
    *
    * @param appId
    *        Application ID that is capable of handling NFC_EVENT_PEER_READY event
-   * @param tabId
-   *        Tab Id of the window calling this interface.
    */
-  void notifyUserAcceptedP2P(in unsigned long appId, in uint64_t tabId);
+  void notifyUserAcceptedP2P(in unsigned long appId);
 
   /**
    * Notify the status of sendFile operation to parent process
    *
    * @param status
    *        Status of sendFile operation
    *
    * @param requestId
--- a/dom/nfc/nsNfc.js
+++ b/dom/nfc/nsNfc.js
@@ -415,17 +415,17 @@ MozNFCImpl.prototype = {
     let callback = new NfcCallback(this.window);
     this._nfcContentHelper.checkP2PRegistration(appID, callback);
     return callback.promise;
   },
 
   notifyUserAcceptedP2P: function notifyUserAcceptedP2P(manifestUrl) {
     let appID = appsService.getAppLocalIdByManifestURL(manifestUrl);
     // Notify chrome process of user's acknowledgement
-    this._nfcContentHelper.notifyUserAcceptedP2P(appID, this._tabId);
+    this._nfcContentHelper.notifyUserAcceptedP2P(appID);
   },
 
   notifySendFileStatus: function notifySendFileStatus(status, requestId) {
     this._nfcContentHelper.notifySendFileStatus(status, requestId);
   },
 
   startPoll: function startPoll() {
     let callback = new NfcCallback(this.window);