Skip to content

Cargo timings graph is broken in Firefox #8850

Open
@Lucretiel

Description

When I run cargo +nightly -Z timings, it produces a timings report in HTML as expected. This renders correctly in Chrome and Safari. However, in Firefox, I only see the summary table and timings breakdown table. I can see the controls for the graph, but the graph itself doesn't render:
image

In the error console, I see the following uncaught exception:

Uncaught 
    Exception
        columnNumber: 0
        data: null
        filename: "http://localhost:8080/cargo-timing.html"
        lineNumber: 24173
        message: ""
        name: "NS_ERROR_FAILURE"
        result: 2147500037
        stack: "setup_canvas@http://localhost:8080/cargo-timing.html:24173:7\ndraw_graph_axes@http://localhost:8080/cargo-timing.html:24187:25\nrender_pipeline_graph@http://localhost:8080/cargo-timing.html:23930:86\n@http://localhost:8080/cargo-timing.html:24331:1\n"
        <prototype>: ExceptionPrototype { toString: toString(), name: Getter, message: Getter, … }

This exception is being thrown from the following function, specifically at ctx.scale(dpr, dpr) near the end:

function setup_canvas(id, width, height) {
  let g = document.getElementById(id);
  let dpr = window.devicePixelRatio || 1;
  g.width = width * dpr;
  g.height = height * dpr;
  g.style.width = width;
  g.style.height = height;
  let ctx = g.getContext('2d');
  ctx.scale(dpr, dpr);  // Exception thrown here
  return ctx;
}

Digging into the debugger, there don't seem to be any obvious issue with that line of code. ctx is of prototype CanvasRenderingContext2DPrototype, and the scale method has been supported in firefox pretty much forever. dpr == 2.

Meta

rustc --version --verbose:

cargo 1.49.0-nightly (79b397d72 2020-10-15)
release: 1.49.0
commit-hash: 79b397d72c557eb6444a2ba0dc00a211a226a35a
commit-date: 2020-10-15
  • macOS Catalina, version 10.15.7 (19H2)
  • Firefox 81.0.2 (64-bit)

Metadata

Assignees

No one assigned

    Labels

    A-timingsArea: timingsC-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions