Bug 1215519 - Switch to DOMTimeStamp for RTCCertificate. r=bz, a=sylvestre
authorMartin Thomson <martin.thomson@gmail.com>
Thu, 22 Oct 2015 11:01:20 -0700
changeset 289617 e91b6fcbc1bb
parent 289616 807268f4e3c5
child 289618 894bc1fcf2a9
push id5224
push usermartin.thomson@gmail.com
push date2015-10-22 18:01 +0000
treeherdermozilla-beta@e91b6fcbc1bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, sylvestre
bugs1215519
milestone42.0
Bug 1215519 - Switch to DOMTimeStamp for RTCCertificate. r=bz, a=sylvestre
dom/media/PeerConnection.js
dom/media/tests/mochitest/test_peerConnection_certificates.html
dom/webidl/RTCCertificate.webidl
--- a/dom/media/PeerConnection.js
+++ b/dom/media/PeerConnection.js
@@ -446,17 +446,17 @@ RTCPeerConnection.prototype = {
   _initCertificate: function(certificates) {
     let certPromise;
     if (certificates && certificates.length > 0) {
       if (certificates.length > 1) {
         throw new this._win.DOMException(
           "RTCPeerConnection does not currently support multiple certificates",
           "NotSupportedError");
       }
-      let cert = certificates.find(c => c.expires.getTime() > Date.now());
+      let cert = certificates.find(c => c.expires > Date.now());
       if (!cert) {
         throw new this._win.DOMException(
           "Unable to create RTCPeerConnection with an expired certificate",
           "InvalidParameterError");
       }
       certPromise = Promise.resolve(cert);
     } else {
       certPromise = this._win.mozRTCPeerConnection.generateCertificate({
--- a/dom/media/tests/mochitest/test_peerConnection_certificates.html
+++ b/dom/media/tests/mochitest/test_peerConnection_certificates.html
@@ -95,25 +95,25 @@
     var expiredCert;
     return Promise.resolve()
       .then(() => mozRTCPeerConnection.generateCertificate({
         name: "ECDSA",
         namedCurve: "P-256",
         expires: 1 // smallest possible expiration window
       }))
       .then(cert => {
-        ok(cert.expires instanceof Date, 'cert has expiration time');
-        info('Expires at ' + cert.expires);
+        ok(!isNaN(cert.expires), 'cert has expiration time');
+        info('Expires at ' + new Date(cert.expires));
         expiredCert = cert;
       })
 
       .then(() => checkBadParameters())
 
       .then(() => {
-        var delay = expiredCert.expires.getTime() - Date.now();
+        var delay = expiredCert.expires - Date.now();
         // Hopefully this delay is never needed.
         if (delay > 0) {
           return new Promise(r => setTimeout(r, delay));
         }
       })
       .then(() => {
         ok(expiredCert.expires <= Date.now(), 'Cert should be at or past expiration');
         try {
--- a/dom/webidl/RTCCertificate.webidl
+++ b/dom/webidl/RTCCertificate.webidl
@@ -3,10 +3,10 @@
  * 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/.
  *
  * Specification: http://w3c.github.io/webrtc-pc/#certificate-management
  */
 
 [Pref="media.peerconnection.enabled"]
 interface RTCCertificate {
-  readonly attribute Date expires;
+  readonly attribute DOMTimeStamp expires;
 };