From c6d84b5d21fcf8d70432ec13fb25d4f2eab63a54 Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Thu, 30 Jul 2015 01:41:00 -0400 Subject: [PATCH] Bug 1189162 - Clamp gamepad.timestamp and VideoPlaybackQuality.creationTime. r=bz --- dom/gamepad/Gamepad.cpp | 2 +- dom/html/HTMLVideoElement.cpp | 2 +- dom/tests/mochitest/gamepad/test_gamepad.html | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dom/gamepad/Gamepad.cpp b/dom/gamepad/Gamepad.cpp index ad58f593254..ee927c9e0fd 100644 --- a/dom/gamepad/Gamepad.cpp +++ b/dom/gamepad/Gamepad.cpp @@ -31,7 +31,7 @@ Gamepad::UpdateTimestamp() if(newWindow) { nsPerformance* perf = newWindow->GetPerformance(); if (perf) { - mTimestamp = perf->GetDOMTiming()->TimeStampToDOMHighRes(TimeStamp::Now()); + mTimestamp = perf->Now(); } } } diff --git a/dom/html/HTMLVideoElement.cpp b/dom/html/HTMLVideoElement.cpp index b80808bc5f1..1fec058b836 100644 --- a/dom/html/HTMLVideoElement.cpp +++ b/dom/html/HTMLVideoElement.cpp @@ -213,7 +213,7 @@ HTMLVideoElement::GetVideoPlaybackQuality() if (window) { nsPerformance* perf = window->GetPerformance(); if (perf) { - creationTime = perf->GetDOMTiming()->TimeStampToDOMHighRes(TimeStamp::Now()); + creationTime = perf->Now(); } } diff --git a/dom/tests/mochitest/gamepad/test_gamepad.html b/dom/tests/mochitest/gamepad/test_gamepad.html index 04c071e6005..7a206338d10 100644 --- a/dom/tests/mochitest/gamepad/test_gamepad.html +++ b/dom/tests/mochitest/gamepad/test_gamepad.html @@ -19,7 +19,8 @@ var index = GamepadService.addGamepad("test gamepad", // id 2);// axes GamepadService.newButtonEvent(index, 0, true); function connecthandler(e) { - ok(e.gamepad.timestamp <= performance.now()); + ok(e.gamepad.timestamp <= performance.now(), + "gamepad.timestamp should less than or equal to performance.now()"); is(e.gamepad.index, 0, "correct gamepad index"); is(e.gamepad.id, "test gamepad", "correct gamepad name"); is(e.gamepad.mapping, "standard", "standard mapping");