Closed Bug 1953387 Opened 4 months ago Closed 2 months ago

Duration for incomplete requests should not show "0 min"

Categories

(DevTools :: Netmonitor, defect, P3)

defect

Tracking

(firefox139 fixed)

RESOLVED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: jdescottes, Assigned: joel.mozillaosi, Mentored, NeedInfo)

References

(Blocks 1 open bug)

Details

(Keywords: good-next-bug, Whiteboard: [lang=js])

Attachments

(1 file)

Spotted while looking at Bug 1920146.
The Duration column shows "0 min" for incomplete requests. This seems to mess up with the sorting of the column and it's also incorrect.

It should probably say "pending" or something similar.
Can be a good next bug.

I'd be happy to work on this

(In reply to Joshua O'Brien from comment #1)

I'd be happy to work on this

Thanks for your interest and sorry about the delay, I was off since last week.

So for this particular issue, the string is generated here https://searchfox.org/mozilla-central/rev/be3db2aef8d3916c891527794a2d5e2f2dc9fab1/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));
}

But for pending requests, ms is set to undefined. So we end up in the last branch (for minutes), and compute the incorrect "0 min" string.
For reference, the localized strings used here are at https://searchfox.org/mozilla-central/rev/be3db2aef8d3916c891527794a2d5e2f2dc9fab1/devtools/client/locales/en-US/netmonitor.properties#354-356

# LOCALIZATION NOTE (networkMenu.minute): This is the label displayed
# in the network menu specifying timing interval divisions (in minutes).
networkMenu.minute=%S min

The idea would be to add another branch in this method to handle the case where ms is undefined and create a new localized string (for instance set to "pending").

I see you already fixed a few bugs, so I'll let you upload a patch once you have something we can look at, and the bug will be automatically assigned to you!

(feel free to ask questions if needed of course :) )

Flags: needinfo?(joshua.obrien)

Hey Julian and Joshua, I'm also a new contributor and have a patch that addresses this issue as outlined in comment 2. I don't mean to step on your toes Joshua but noticed that there hadn't been any activity for over a week and was having a hard time sourcing similarly-accessible bugs.

(In reply to joel.mozillaosi from comment #4)

Hey Julian and Joshua, I'm also a new contributor and have a patch that addresses this issue as outlined in comment 2. I don't mean to step on your toes Joshua but noticed that there hadn't been any activity for over a week and was having a hard time sourcing similarly-accessible bugs.

No problem at all! I haven't had a chance to look at this yet, so all good :)

Assignee: nobody → joel.mozillaosi
Attachment #9475201 - Attachment description: WIP: Bug 1953387 - Duration for incomplete requests should not show 0 min → Bug 1953387 - add branch to conditional logic of getFormattedTime to handle when ms is undefined and add localized string. r?jdescottes
Status: NEW → ASSIGNED
Attachment #9475201 - Attachment description: Bug 1953387 - add branch to conditional logic of getFormattedTime to handle when ms is undefined and add localized string. r?jdescottes → Bug 1953387 - update the getTime function's duration branch to return an empty string in the event that item.totalTime is NaN or undefined. r?jdescottes
Attachment #9475201 - Attachment description: Bug 1953387 - update the getTime function's duration branch to return an empty string in the event that item.totalTime is NaN or undefined. r?jdescottes → Bug 1953387 - update RequestListColumnTime's render method to bypass getFormattedTime if time is NaN or undefined and associated test browser_net_duration. r?jdescottes
Attachment #9475201 - Attachment description: Bug 1953387 - update RequestListColumnTime's render method to bypass getFormattedTime if time is NaN or undefined and associated test browser_net_duration. r?jdescottes → Bug 1953387 - [devtools] Display empty string for undefined /NaN in netmonitor time columns. r?jdescottes
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3b61b6a86a3e [devtools] Display empty string for undefined /NaN in netmonitor time columns. r=jdescottes,devtools-reviewers

Backed out for causing dt failures @ browser_net_block-csp.js

Flags: needinfo?(joel.mozillaosi)
Flags: needinfo?(joel.mozillaosi)
Blocks: 1959359
Attachment #9475201 - Attachment description: Bug 1953387 - [devtools] Display empty string for undefined /NaN in netmonitor time columns. r?jdescottes → Bug 1953387 - [devtools] Display empty string for undefined/NaN in netmonitor time columns. r?jdescottes
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ff50bc28b0d7 [devtools] Display empty string for undefined/NaN in netmonitor time columns. r=jdescottes,devtools-reviewers
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch
QA Whiteboard: [qa-triage-done-c140/b139]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: