JS Pause Graph script no longer working

RESOLVED INVALID

Status

()

Core
DOM
RESOLVED INVALID
4 years ago
3 years ago

People

(Reporter: Mark Straver, Unassigned)

Tracking

24 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
Created attachment 795178 [details]
JS GC pause graph script (html)

I used to use the GC pause graph script attached to this bug to test GC, but it's no longer working - At first glance I can't figure out why this stopped working, and it may be a functional regression.

Regression window:
Last good nightly: 2013-04-25
First bad nightly: 2013-04-26

Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=690b5e0f6562&tochange=a6104e0e5a2c

Updated

4 years ago
Attachment #795178 - Attachment mime type: text/plain → text/html
Component: Untriaged → JavaScript Engine
Product: Firefox → Core
The problem is that the "handler" function is used as the requestAnimationFrame callback and does this:

  function handler(timestamp)
...
    var delay = timestamp - prev;

But "prev" is initially set as:

    start = prev = Date.now();

which is broken, because the timestamp passed to the handler is number of ms since page load started while "prev" is initially set to number of ms since start of 1970.

The pushlog includes bug 704063.  Before that, the testcase was picking up the prefixed requestAnimationFrame, which passes timestamps compatible with Date.now().  The unprefixed version, which the testcase uses if available, uses timestamps compatible with performance.now().

If I replace all instances of Date.now() with performance.now() in the script, it works fine.

The script just needs to be fixed to use Date.now() when using prefixed requestAnimationFrame, and performance.now() otherwise.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Component: JavaScript Engine → DOM
Resolution: --- → INVALID
(Reporter)

Comment 2

3 years ago
Thanks for the explanation. This difference was not at all clear from the available dev docs.
Ah, good point.  I updated the note on https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame to make this clearer.
You need to log in before you can comment on or make changes to this bug.