Automatic prettyprinting should not set the editor source twice

ASSIGNED
Assigned to

Status

()

Firefox
Developer Tools: Debugger
P3
normal
ASSIGNED
4 years ago
3 years ago

People

(Reporter: gl, Assigned: Hubert B Manilla)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
When a source is selected, we call 
> DebuggerView.setEditorLocation(sourceItem.value); [1]
which sets the editor source initially. It is followed by a check to see if the source should be autopretty printed, which overwrites the source if toggled.

We should ensure the source is only set once - whether or not it should be pretty printed or as is.

[1] https://mxr.mozilla.org/mozilla-central/source/browser/devtools/debugger/debugger-panes.js#789
(Reporter)

Comment 1

4 years ago
cc'd interested parties
(Assignee)

Comment 3

4 years ago
I left it in, cos i thought it was better for the user to get some content immediately after it comes in, rather than wait each time for a minified check before display.

Pls could this be assigned this to me, So it comes on my bugmotodo list to quickly fix? thanks
(In reply to Hubert B Manilla from comment #3)
> I left it in, cos i thought it was better for the user to get some content
> immediately after it comes in, rather than wait each time for a minified
> check before display.
> 
> Pls could this be assigned this to me, So it comes on my bugmotodo list to
> quickly fix? thanks

why dont send a boolean along with the request to fetch a source. that boolean can indicate that the user would like to get non-monified version of js if possible, then directly fetch non minified.

I think it might take half a second extra, but it will be much better than current solution where it taked 2-3 seconds extra. (2-3 seconds as in the time user clicked on the source to the time non-minified version of source was shown)
Assignee: nobody → b4bomsy
Status: NEW → ASSIGNED
I'm unconvinced that there is a large slowdown from auto pretty printing in the frontend versus the server. Requests over the RDP aren't as heavy as they feel because 99% of the time they are local and even when remote, they are over usb. Point being there isn't a large amount of latency or extra work in requests. It isn't a silver bullet.

However, I think it could make sense to move it to the server side. The boolean indicating whether we want auto pretty printed sources would belong in the (re)configuration packet(s)[0][1]. The source forms[2] in the "sources" response would just have "isPrettyPrinted: true" if we automatically pretty printed them.

[0] http://mxr.mozilla.org/mozilla-central/source/browser/devtools/debugger/debugger-controller.js#425
[1] http://mxr.mozilla.org/mozilla-central/source/browser/devtools/debugger/debugger-controller.js#347
[2] http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/script.js#2429
Priority: -- → P3

Updated

3 years ago
Summary: Autopretty print can result in setting the editor source twice → Automatic prettyprinting should not set the editor source twice
You need to log in before you can comment on or make changes to this bug.