From e03114c23582d755701513ce292155fa9c4e7b82 Mon Sep 17 00:00:00 2001 From: Albert Crespell Date: Thu, 23 May 2013 11:36:31 +0200 Subject: [PATCH] Bug 875245 - Mochitest for NetworkStats failure. r=gene --- dom/network/src/NetworkStatsDB.jsm | 8 ++++---- dom/network/tests/test_networkstats_basics.html | 11 ++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dom/network/src/NetworkStatsDB.jsm b/dom/network/src/NetworkStatsDB.jsm index 5c0c4fd8746..a5ec3227b4a 100644 --- a/dom/network/src/NetworkStatsDB.jsm +++ b/dom/network/src/NetworkStatsDB.jsm @@ -269,8 +269,8 @@ NetworkStatsDB.prototype = { this.fillResultSamples(start, end, data); txn.result.connectionType = aOptions.connectionType; - txn.result.start = new Date(aOptions.start); - txn.result.end = new Date(aOptions.end); + txn.result.start = aOptions.start; + txn.result.end = aOptions.end; txn.result.data = data; }.bind(this); }.bind(this), aResultCb); @@ -315,8 +315,8 @@ NetworkStatsDB.prototype = { this.fillResultSamples(start, end, data); txn.result.connectionType = aOptions.connectionType; - txn.result.start = new Date(aOptions.start); - txn.result.end = new Date(aOptions.end); + txn.result.start = aOptions.start; + txn.result.end = aOptions.end; txn.result.data = data; }.bind(this); }.bind(this), aResultCb); diff --git a/dom/network/tests/test_networkstats_basics.html b/dom/network/tests/test_networkstats_basics.html index bac487c290a..958838c65ec 100644 --- a/dom/network/tests/test_networkstats_basics.html +++ b/dom/network/tests/test_networkstats_basics.html @@ -51,9 +51,8 @@ function test() { } function checkDataDates(data, start, end, sampleRate){ - var offset = new Date().getTimezoneOffset() * 60 * 1000; - start = Math.floor((start.getTime() - offset) / sampleRate) * sampleRate + offset; - end = Math.floor((end.getTime() - offset) / sampleRate) * sampleRate + offset; + start = Math.floor(start.getTime() / sampleRate) * sampleRate; + end = Math.floor(end.getTime() / sampleRate) * sampleRate; var counter = 0; var date = start; @@ -150,8 +149,7 @@ var steps = [ // Get samplerate in millis var sampleRate = netStats.sampleRate * 1000; // Get date with samplerate's precision - var offset = new Date().getTimezoneOffset() * 60 * 1000; - var endDate = new Date(Math.floor((new Date().getTime() - offset) / sampleRate) * sampleRate + offset); + var endDate = new Date(Math.floor(new Date().getTime() / sampleRate) * sampleRate); var startDate = new Date(endDate.getTime() - (sampleRate * diff)); // Calculate the number of samples that should be returned based on the // the samplerate and including final and initial samples. @@ -181,8 +179,7 @@ var steps = [ // Get samplerate in millis var sampleRate = netStats.sampleRate * 1000; // Get date with samplerate's precision - var offset = new Date().getTimezoneOffset() * 60 * 1000; - var endDate = new Date(Math.floor((new Date().getTime() - offset) / sampleRate) * sampleRate + offset); + var endDate = new Date(Math.floor(new Date().getTime() / sampleRate) * sampleRate); var startDate = new Date(endDate.getTime() - (sampleRate * diff)); // Calculate the number of samples that should be returned based on the // the samplerate and including final and initial samples.