Display a useful message when a response body is truncated
Categories
(DevTools :: Netmonitor, defect)
Tracking
(firefox67 verified)
Tracking | Status | |
---|---|---|
firefox67 | --- | verified |
People
(Reporter: khuey, Assigned: koroknay)
References
(Blocks 1 open bug, )
Details
Attachments
(3 files)
Comment 1•10 years ago
|
||
Updated•7 years ago
|
Comment 2•7 years ago
|
||
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
str |
Assignee | ||
Comment 5•7 years ago
|
||
Hi, I'd be happy to take this on as long as I could get some pointers please. The code the original reporter is referencing is no longer applicable, so it would be great to know where the code responsible for limiting response logging to 1MB lives.
Comment 6•7 years ago
•
|
||
I am not the best person to ask about the related code, as I am currently not much involved in DevTools development, but as far as I can see the limitation of the code is happening in /devtools/server/actors/network-monitor/network-response-listener.js controlled by the devtools.netmonitor.responseBodyLimit
preference and the preparation of the data and its display is done in /devtools/client/netmonitor/src/components/ResponsePanel.js. I redirected your request to Honza for further information on what exactly needs to be done, as he's the "master of the Network Monitor". :-)
Sebastian
Comment 7•7 years ago
|
||
@Martin: assigned to you.
@Sebastian: thanks for the pointers.
Some more info:
-
Sebastian's links are correct
-
Here is the place where the current error message is rendered
https://searchfox.org/mozilla-central/rev/e00ea598e52bbb35f8c45abf9c2eade17962bb5e/devtools/client/netmonitor/src/components/ResponsePanel.js#236 -
I think we could display an error message (instead of the current error) saying e.g. "Response has been truncated" (any other better suggestions for the message?)
-
The code can use the following condition to figure out whether the response has been truncated.
// In the render method
const limit = Services.prefs.getIntPref("devtools.netmonitor.responseBodyLimit");
if (limit <= request.responseContent.content.size) { ... }
Honza
Assignee | ||
Comment 8•7 years ago
|
||
Previously when a JSON response's size was over the limit specified in pref devtools.netmonitor.responseBodyLimit, when inspecting this response in the Network Monitor one simply saw a JSON parse error message. This was due to the fact that the response was truncated in this view and thus no longer a valid JSON, even if the actual response was a valid JSON. Of course the actual response could have been invalid in the first place -- there was no way to know.
This patch will ensure that in such cases a truncation warning message is displayed instead of a parse error message, thus avoiding a likely misleading parse error message.
Assignee | ||
Comment 9•7 years ago
|
||
Thanks for the pointers Sebastian & Honza. I have submitted my patch for review, for now with the text "Response has been truncated." displaying.
Comment 10•6 years ago
|
||
@Martin: please look at my comments in Phabricator
Thanks,
Honza
Assignee | ||
Comment 11•6 years ago
|
||
Hi Honza, I have updated the diff in Phabricator.
Comment 12•6 years ago
|
||
Comment 13•6 years ago
|
||
bugherder |
Updated•6 years ago
|
Comment 15•6 years ago
|
||
I reproduced this issue with Fx 66.0a1 (2018-12-17) on Windows 10 x64.
The desired message ( "Response has been truncated") is displayed with Fx 67.0b8 on Windows 10 x64, Ubuntu 18.04 x64 and macOS 10.13.
Description
•