Bug 1020108 - Use DOMTimestamp in MozCellBroadcastMessage. r=gene, a=1.3+
authorVicamo Yang <vyang@mozilla.com>
Thu, 05 Jun 2014 10:06:28 +0800
changeset 171598 c072b84f2280a0e16530eb7261e1d54e98f8f5f1
parent 171597 9365d44d678ead2b84c822fae5ac392f880ae8f7
child 171599 b9087513a198ceeb362111bdd471ffee7ef977d1
push id579
push userryanvm@gmail.com
push dateWed, 09 Jul 2014 14:49:28 +0000
reviewersgene, 1
bugs1020108
milestone28.0
Bug 1020108 - Use DOMTimestamp in MozCellBroadcastMessage. r=gene, a=1.3+
dom/cellbroadcast/interfaces/nsIDOMMozCellBroadcastMessage.idl
dom/cellbroadcast/tests/marionette/test_cellbroadcast_etws.js
dom/cellbroadcast/tests/marionette/test_cellbroadcast_gsm.js
dom/system/gonk/RILContentHelper.js
--- a/dom/cellbroadcast/interfaces/nsIDOMMozCellBroadcastMessage.idl
+++ b/dom/cellbroadcast/interfaces/nsIDOMMozCellBroadcastMessage.idl
@@ -1,21 +1,22 @@
 /* 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 "domstubs.idl"
 #include "nsISupports.idl"
 
 interface nsIDOMMozCellBroadcastEtwsInfo;
 
 /**
  * MozCellBroadcastMessage encapsulates Cell Broadcast short message service
  * (CBS) messages.
  */
-[scriptable, uuid(6abe65de-6729-41f7-906a-3f3a2dbe30ae)]
+[scriptable, uuid(701e74a9-5fc4-4e2d-a324-9b7693395159)]
 interface nsIDOMMozCellBroadcastMessage : nsISupports
 {
   /**
    * Indication of the geographical area over which the Message Code is unique,
    * and the display mode.
    *
    * Possible values are: "cell-immediate", "plmn", "location-area" and "cell".
    */
@@ -48,17 +49,17 @@ interface nsIDOMMozCellBroadcastMessage 
    * Possible values are "normal", "class-0", "class-1", "class-2", "class-3",
    * "user-1", and "user-2".
    */
   readonly attribute DOMString messageClass;
 
   /**
    * System time stamp at receival.
    */
-  readonly attribute jsval timestamp; // jsval is for Date.
+  readonly attribute DOMTimeStamp timestamp;
 
   /**
    * Additional ETWS-specific info.
    */
   readonly attribute nsIDOMMozCellBroadcastEtwsInfo etws;
 
   /**
    * Service Category.
--- a/dom/cellbroadcast/tests/marionette/test_cellbroadcast_etws.js
+++ b/dom/cellbroadcast/tests/marionette/test_cellbroadcast_etws.js
@@ -191,17 +191,17 @@ function testReceiving_ETWS_MessageId() 
 function testReceiving_ETWS_Timestamp() {
   log("Test receiving ETWS Primary Notification - Timestamp");
 
   // Here we use a simple ETWS message for test.
   let pdu = buildHexStr(0, 12); // 6 octets
   doTestHelper(pdu, testReceiving_ETWS_WarningType, function (message) {
     // Cell Broadcast messages do not contain a timestamp field (however, ETWS
     // does). We only check the timestamp doesn't go too far (60 seconds) here.
-    let msMessage = message.timestamp.getTime();
+    let msMessage = message.timestamp;
     let msNow = Date.now();
     ok(Math.abs(msMessage - msNow) < (1000 * 60), "message.timestamp");
   });
 }
 
 function testReceiving_ETWS_WarningType() {
   log("Test receiving ETWS Primary Notification - Warning Type");
 
--- a/dom/cellbroadcast/tests/marionette/test_cellbroadcast_gsm.js
+++ b/dom/cellbroadcast/tests/marionette/test_cellbroadcast_gsm.js
@@ -356,17 +356,17 @@ function testReceiving_GSM_Language_and_
 
 function testReceiving_GSM_Timestamp() {
   log("Test receiving GSM Cell Broadcast - Timestamp");
 
   let pdu = buildHexStr(0, CB_MESSAGE_SIZE_GSM * 2);
   doTestHelper(pdu, testReceiving_GSM_WarningType, function (message) {
     // Cell Broadcast messages do not contain a timestamp field (however, ETWS
     // does). We only check the timestamp doesn't go too far (60 seconds) here.
-    let msMessage = message.timestamp.getTime();
+    let msMessage = message.timestamp;
     let msNow = Date.now();
     ok(Math.abs(msMessage - msNow) < (1000 * 60), "message.timestamp");
   });
 }
 
 function testReceiving_GSM_WarningType() {
   log("Test receiving GSM Cell Broadcast - Warning Type");
 
--- a/dom/system/gonk/RILContentHelper.js
+++ b/dom/system/gonk/RILContentHelper.js
@@ -326,17 +326,17 @@ MobileCFInfo.prototype = {
 
 function CellBroadcastMessage(pdu) {
   this.gsmGeographicalScope = RIL.CB_GSM_GEOGRAPHICAL_SCOPE_NAMES[pdu.geographicalScope];
   this.messageCode = pdu.messageCode;
   this.messageId = pdu.messageId;
   this.language = pdu.language;
   this.body = pdu.fullBody;
   this.messageClass = pdu.messageClass;
-  this.timestamp = new Date(pdu.timestamp);
+  this.timestamp = pdu.timestamp;
 
   if (pdu.etws != null) {
     this.etws = new CellBroadcastEtwsInfo(pdu.etws);
   }
 
   this.cdmaServiceCategory = pdu.serviceCategory;
 }
 CellBroadcastMessage.prototype = {