Closed Bug 1263945 Opened 8 years ago Closed 8 years ago

Tell the exact number of bytes if below 1Kb

Categories

(DevTools :: Netmonitor, defect)

46 Branch
defect
Not set
normal

Tracking

(firefox49 fixed)

RESOLVED FIXED
Firefox 49
Tracking Status
firefox49 --- fixed

People

(Reporter: bruant.d, Assigned: gregtatum)

Details

Attachments

(2 files, 1 obsolete file)

The network monitor always provides the size of HTTP requests in Kb, but sometimes, the body is a few chars  (for instance 2 chars for an empty JSON array "[]"). The network monitor then reports "0,00Kb". It's a correct approximation, but a useless information; much less useful than the actual number of byte to figure out whether the body actually has 0 chars or just a few of them.

If the body is less than 1Kb, maybe the actual byte count would be more useful.
Assignee: nobody → gtatum
This adds the functionality to both the size and transfer column.
Attached image Screenshot of panel
Attachment #8745037 - Flags: review?(odvarko)
Comment on attachment 8745037 [details] [diff] [review]
Tell the exact number of bytes in network monitor if below 1Kb

Review of attachment 8745037 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me!

At some point we could also support MB and perhaps have a helper function
like e.g. this one [1], but it's outside of scope of this bug.

I am r- because there are test failures in the try push, for example: 
INFO TEST-UNEXPECTED-FAIL | devtools/client/netmonitor/test/browser_net_content-type.js | The displayed size is correct. - Got 42 B, expected 0.04 KB

Theses need to be fixed.

Honza


[1] https://github.com/firebug/firebug/blob/master/extension/content/firebug/lib/string.js#L683
Attachment #8745037 - Flags: review?(odvarko) → review-
Ok, I'll get this fixed. The memory tool also has a similar function. I wonder if we should put it in a shared folder.

https://dxr.mozilla.org/mozilla-central/source/devtools/client/memory/utils.js#513-529
(In reply to Greg Tatum [:gregtatum] [@gregtatum] from comment #5)
> The memory tool also has a similar function. I
> wonder if we should put it in a shared folder.
Yes, I support the idea (and it's ok for me if it's done as part of this bug).

Honza
Ok, I changed up this patch a little bit. I was looking into creating a
generalized formatting function, but the memory tool does things a bit
differently, so I didn't go that route. I went ahead and added support for some
of the higher sizes. Now we have B, KB, MB, and GB. I also made the call to
switch between them once numbers got to three digits. For instance instead of
showing 1010.00 KB, I have it showing 0.98 MB instead, so that the formatting
is a bit nicer in the columns.

Also in that try run I have a broken eslint whitespace rule which I have fixed in
this patch.
Attachment #8749651 - Flags: review?(odvarko)
Attachment #8745037 - Attachment is obsolete: true
Comment on attachment 8749651 [details] [diff] [review]
Tell the exact number of bytes in network monitor if below 1Kb

Review of attachment 8749651 [details] [diff] [review]:
-----------------------------------------------------------------

Nice, looks good to me!

One possible follow up could be improvement of the tooltip. It could show precise number of bytes (kbytes?) for those users who are interested in exact size.
It currently shows the same number as displayed in the column and so, not that useful.

Honza
Attachment #8749651 - Flags: review?(odvarko) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/39fd1cdc461c
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 49
I have reproduced this bug with Nightly 48.0a1 (2016-04-12) on Windows 7 , 64 Bit !

This bug's fix is verified with latest Beta !

Build   ID  20160912134115
User Agent  Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0

[bugday-20160914]
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: