Open Bug 1959359 Opened 7 months ago Updated 21 days ago

Review usage of getFormattedTime in netmonitor

Categories

(DevTools :: Netmonitor, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

Details

The getFormattedTime helper https://searchfox.org/mozilla-central/rev/6cc05c6620814bf3eb05278ccf3b1f49690b7740/devtools/client/netmonitor/src/utils/format-utils.js#79-89

function getFormattedTime(ms) {
  if (ms < MAX_MILLISECOND) {
    return L10N.getFormatStr("networkMenu.millisecond", ms | 0);
  }
  if (ms < MAX_SECOND) {
    const sec = ms / MAX_MILLISECOND;
    return L10N.getFormatStr("networkMenu.second", getTimeWithDecimals(sec));
  }
  const min = ms / MAX_SECOND;
  return L10N.getFormatStr("networkMenu.minute", getTimeWithDecimals(min));
}

This helper handles NaN / undefined values weirdly, and shows them as "0 min". This helper is widely used in the netmonitor, in Bug 1953387 we are only updating calls in RequestListColumnTime.js to use an empty string in those cases, because "0 min" is surely wrong in this case.

But we should review each call site, and decide what makes sense to display for NaN / undefined values. Then we should either update the helper or introduce another helper if we need different behaviors for different components.

Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.