Open Bug 1094732 Opened 10 years ago Updated 2 years ago

Beautify jsonp response

Categories

(DevTools :: Netmonitor, defect)

36 Branch
x86
macOS
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: m+mozilla, Unassigned)

References

Details

Attachments

(1 file)

Attached image screenshot
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:36.0) Gecko/20100101 Firefox/36.0
Build ID: 20141105030203




Expected results:

jsonp response should be beautified for better reading. cf screenshot.
Component: Untriaged → Developer Tools: Netmonitor
We do try to do this, I think there is an issue in how we detect the jsonp request. For example, I get a parsed response inspecting requests with this app:

http://canuckistani.github.io/st-beer/

cc'ing Victor, also adding it to the netmonitor papercuts tracking bug so it gets tracked.
Blocks: 1037489
Flags: needinfo?(vporof)
I don't know why your jsonp request isn't formatted. It should. It'd be helpful to provide a minimal test case that we can reproduce to fix the issue.
Flags: needinfo?(vporof)
A test case:

jsonp_1kircpdb2k0e2bo({"progress":74.537037037037,"startAt":"17:00","endAt":"17:18","title":"Latest Bulletin"});
JSONP gets formatted when the Content-Type of the response is "application/json". However, "application/javascript" is untouched. You will find many jsonp calls return the type "application/javascript". I guess it would be nice to have Javascript formatted as an option, that way it would cover both jsonp and compressed javascript.

So, I guess the question to be asked is should application/json be used as the Content-Type for jsonp calls? That doesn't seem to be the standard I have seen.
Oh it's probably that so.
This still is a problem.

What would be ideal is that within 
-> Firefox's Open Web Developer Tools 
-> Network tab (very top) 
-> when you click on a network transaction (a file)
In addition to the "Header", "Cookies", "Params", "Response", and "Timings", I could also see a "Formatted" tab. The "Formatted" tab would be next to the "Response" and show a formatted response based on Content-Type. You would then associate formatters with the Content-Type. Basically, it would be a plug and play proposition. It may be close to that already given the way the response gets reformatted on JSON objects. However, in the preferences, there could be a list of associations that are customizable showing Content-Type and the formatter that would be used. Why customizable? So I can add Content-Types like "text/javascript" to the mix when they are currently not being considered.

If you do look at the bottom of the Network screen, you do see filters. Seems to me, if you already have filters that know what the content of a transaction is you should be able to apply the appropriate formatter to it. That means HTML, CSS, JS, XHR could all have formatters/beautifiers to show content.

Better still? With an preference setting, reformat the content before it is parsed by the browser and then we have an easy way of following stack traces.
Product: Firefox → DevTools
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: