Bug 938635 - Implement forceAuthentication for firefox accounts. Part 3: UI glue. r=fabrice
authorFernando Jiménez <ferjmoreno@gmail.com>
Wed, 19 Feb 2014 11:47:11 +0100
changeset 169547 2cf9d97e26841c1afff969163180c45799361c94
parent 169546 a8cdafcb11f054b67a9e2ca13d5f3625dcfbb909
child 169548 0707af6d54c8ee9edecebecb38bbc36bdd0d064b
push id39993
push userryanvm@gmail.com
push dateWed, 19 Feb 2014 20:45:10 +0000
treeherdermozilla-inbound@a304d2065f65 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs938635
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 938635 - Implement forceAuthentication for firefox accounts. Part 3: UI glue. r=fabrice
b2g/components/FxAccountsMgmtService.jsm
b2g/components/FxAccountsUIGlue.js
services/fxaccounts/interfaces/nsIFxAccountsUIGlue.idl
--- a/b2g/components/FxAccountsMgmtService.jsm
+++ b/b2g/components/FxAccountsMgmtService.jsm
@@ -124,16 +124,17 @@ this.FxAccountsMgmtService = {
           },
           reason => {
             self._onReject(msg.id, reason);
           }
         ).then(null, Components.utils.reportError);
         break;
       case "signIn":
       case "signUp":
+      case "refreshAuthentication":
         FxAccountsManager[data.method](data.accountId, data.password).then(
           user => {
             self._onFullfill(msg.id, user);
           },
           reason => {
             self._onReject(msg.id, reason);
           }
         ).then(null, Components.utils.reportError);
--- a/b2g/components/FxAccountsUIGlue.js
+++ b/b2g/components/FxAccountsUIGlue.js
@@ -17,17 +17,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
 
 function FxAccountsUIGlue() {
 }
 
 FxAccountsUIGlue.prototype = {
 
   _browser: Services.wm.getMostRecentWindow("navigator:browser"),
 
-  signInFlow: function() {
+  _contentRequest: function(aEventName, aData) {
     let deferred = Promise.defer();
 
     let content = this._browser.getContentWindow();
     if (!content) {
       deferred.reject("InternalErrorNoContent");
       return;
     }
 
@@ -50,23 +50,34 @@ FxAccountsUIGlue.prototype = {
       } else {
         deferred.resolve(msg.result);
       }
       content.removeEventListener("mozFxAccountsRPContentEvent",
                                   onContentEvent);
     });
 
     let detail = {
-       eventName: "openFlow",
-       id: id
+       eventName: aEventName,
+       id: id,
+       data: aData
     };
     log.debug("Send chrome event " + JSON.stringify(detail));
     this._browser.shell.sendCustomEvent("mozFxAccountsUnsolChromeEvent", detail);
 
     return deferred.promise;
   },
 
+  signInFlow: function() {
+    return this._contentRequest("openFlow");
+  },
+
+  refreshAuthentication: function(aAccountId) {
+    return this._contentRequest("refreshAuthentication", {
+      accountId: aAccountId
+    });
+  },
+
   classID: Components.ID("{51875c14-91d7-4b8c-b65d-3549e101228c}"),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIFxAccountsUIGlue])
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FxAccountsUIGlue]);
--- a/services/fxaccounts/interfaces/nsIFxAccountsUIGlue.idl
+++ b/services/fxaccounts/interfaces/nsIFxAccountsUIGlue.idl
@@ -1,12 +1,15 @@
 /* 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/. */
 
 #include "nsISupports.idl"
 
-[scriptable, uuid(5805ac8b-7cbe-4fbd-97ad-d3ae8cd29f79)]
+[scriptable, uuid(ab8d0700-9577-11e3-a5e2-0800200c9a66)]
 interface nsIFxAccountsUIGlue : nsISupports
 {
   // Returns a Promise.
   jsval signInFlow();
+
+  // Returns a Promise.
+  jsval refreshAuthentication(in DOMString accountId);
 };