Bug 1020108: use DOMTimestamp in MozCellBroadcastMessage. r=gene

This commit is contained in:
Vicamo Yang 2014-06-05 10:06:28 +08:00
Родитель a16682988c
Коммит 4d62306ff0
4 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -2,6 +2,7 @@
* 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;
@ -10,7 +11,7 @@ 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
{
/**
@ -53,7 +54,7 @@ interface nsIDOMMozCellBroadcastMessage : nsISupports
/**
* System time stamp at receival.
*/
readonly attribute jsval timestamp; // jsval is for Date.
readonly attribute DOMTimeStamp timestamp;
/**
* Additional ETWS-specific info.

Просмотреть файл

@ -196,7 +196,7 @@ function testReceiving_ETWS_Timestamp() {
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");
});

Просмотреть файл

@ -361,7 +361,7 @@ function testReceiving_GSM_Timestamp() {
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");
});

Просмотреть файл

@ -312,7 +312,7 @@ function CellBroadcastMessage(pdu) {
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);