Bug 1038675 expiresAt parameter of /call-url/ response has changed from hours to seconds with the latest server version (Loop desktop client doesn't register on startup of browser). r=nperriault
authorMark Banner <standard8@mozilla.com>
Wed, 16 Jul 2014 15:15:08 +0100
changeset 216315 79a9cefa3538ba94f2b6833b302342d4c132ddd5
parent 216314 a73ed0f644d6cddae4828fc8844655d2df399271
child 216316 9fc90ba5662e39d62090367cd0cb6af7b8ed4380
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnperriault
bugs1038675
milestone33.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 1038675 expiresAt parameter of /call-url/ response has changed from hours to seconds with the latest server version (Loop desktop client doesn't register on startup of browser). r=nperriault
browser/components/loop/content/js/client.js
browser/components/loop/test/desktop-local/client_test.js
--- a/browser/components/loop/content/js/client.js
+++ b/browser/components/loop/content/js/client.js
@@ -30,23 +30,16 @@ loop.Client = (function($) {
       this.mozLoop = navigator.mozLoop;
     }
 
     this.settings = settings;
   }
 
   Client.prototype = {
     /**
-     * Converts from hours to seconds
-     */
-    _hoursToSeconds: function(value) {
-      return value * 60 * 60;
-    },
-
-    /**
      * Validates a data object to confirm it has the specified properties.
      *
      * @param  {Object} The data object to verify
      * @param  {Array} The list of properties to verify within the object
      * @return This returns either the specific property if only one
      *         property is specified, or it returns all properties
      */
     _validate: function(data, properties) {
@@ -119,18 +112,17 @@ loop.Client = (function($) {
           // XXX Support an alternate call_url property for
           // backwards compatibility whilst we switch over servers.
           // Bug 1033988 will want to remove these two lines.
           if (urlData.call_url)
             urlData.callUrl = urlData.call_url;
 
           cb(null, this._validate(urlData, expectedCallUrlProperties));
 
-          var expiresHours = this._hoursToSeconds(urlData.expiresAt);
-          this.mozLoop.noteCallUrlExpiry(expiresHours);
+          this.mozLoop.noteCallUrlExpiry(urlData.expiresAt);
         } catch (err) {
           console.log("Error requesting call info", err);
           cb(err);
         }
       });
     },
 
     /**
--- a/browser/components/loop/test/desktop-local/client_test.js
+++ b/browser/components/loop/test/desktop-local/client_test.js
@@ -86,30 +86,29 @@ describe("loop.Client", function() {
         client.requestCallUrl("foo", callback);
 
         sinon.assert.calledWithExactly(callback, null, callUrlData);
       });
 
       it("should note the call url expiry when the request succeeds", function() {
         var callUrlData = {
           "callUrl": "fakeCallUrl",
-          "expiresAt": 60
+          "expiresAt": 6000
         };
 
         // Sets up the hawkRequest stub to trigger the callback with no error
         // and the url.
         hawkRequestStub.callsArgWith(3, null,
                                      JSON.stringify(callUrlData));
 
         client.requestCallUrl("foo", callback);
 
-        // expiresAt is in hours, and noteCallUrlExpiry wants seconds.
         sinon.assert.calledOnce(mozLoop.noteCallUrlExpiry);
         sinon.assert.calledWithExactly(mozLoop.noteCallUrlExpiry,
-          60 * 60 * 60);
+          6000);
       });
 
       it("should send an error when the request fails", function() {
         // Sets up the hawkRequest stub to trigger the callback with
         // an error
         hawkRequestStub.callsArgWith(3, fakeErrorRes);
 
         client.requestCallUrl("foo", callback);