Pretty print icon is not available
Categories
(DevTools :: Debugger, defect, P3)
Tracking
(Not tracked)
People
(Reporter: Honza, Unassigned)
References
(Blocks 1 open bug)
Details
STR:
- Load https://www.tcmeble.pl/produkty/giotto/
- Open DevTools & Debugger
- Select this file: wp-content/themes/szablon/js/scripts.min.js
- Try to pretty print it, there is no pretty print icon -> BUG
ER: there is pretty print icon at the bottom of the source view.
Honza
Updated•6 years ago
|
Comment 1•5 years ago
|
||
This seems separate from bug 1224654, as mimetype and extension are correct.
Updated•5 years ago
|
Comment 2•5 years ago
|
||
The pretty print icon is hidden due to the following check in devtools/client/debugger/src/reducers/sources.js
:
(prefs.clientSourceMapsEnabled && isSourceWithMap(state, id))
The context menu on the source's tab does show the "Pretty print" item.
Comment 3•5 years ago
|
||
This is still a problem.
Comment 4•5 years ago
|
||
The reason the "Pretty print" button does not appear in the Footer even though the "Pretty print source" option is not disabled in the Context Menu is because the check performed when displaying the "Pretty print" button in the Footer is more rigorous than the check performed when disabling the "Pretty print source" option in Context Menu.
In the Context Menu the "Pretty print source" option is not enabled if:
source.url
ends with":formatted"
.
In the Footer the "Pretty print" button is not displayed if:
source
does not exist.source.url
ends with":formatted"
.source.isOriginal
is set totrue
.- The "Enable Source Maps" setting in the Debugger is checked and a
sourceMapURL
has been provided.
Therefore whenever a user has the "Enable Source Maps" setting checked and a sourceMapURL
is provided, the pretty print button will not display. This is what is happening in the case described by this Bug. You can also find the relative url for the source map in the //# sourceMappingURL
comment located at the end of the minified file that the user was trying to pretty print. This behavior is also visible if you use the STR to create the issue reported by Bug 1617531 which may be a duplicate of this bug.
A simple fix for this issue would be to match the condition used to display the "Pretty print" button to that of the "Pretty print source" option in the context menu. However, the appropriateness of that solution depends on whether or not there needs to be a more rigorous check before allowing users to pretty print a file. This is also what the conditions that are verified before displaying the "Pretty print" button in the Footer would suggest. Because I am not an expert as to when a file should or should not be printed, it is possible that @Logan Smyth, the original author of the canPrettyPrintSource()
function that is run before displaying the "Pretty print" button in the Footer may be able to shine more light on this issue.
Updated•5 years ago
|
Comment 6•4 years ago
|
||
The logic "hide pretty print button if the source has a source map" was introduced in https://github.com/firefox-devtools/debugger/pull/959 to address https://github.com/firefox-devtools/debugger/issues/949 .
The button is hidden because offering pretty printing resulted in broken mapping between breakpoints/call stacks and source files.
In my opinion, it would be preferable to offer an option to temporarily disable source maps for a specific file (or if possible, support pretty printing despite the pre-existing source map).
Comment 7•4 years ago
|
||
In my opinion, it would be preferable to offer an option to temporarily disable source maps for a specific file (or if possible, support pretty printing despite the pre-existing source map).
Afaik, this maps to what I proposed in https://bugzilla.mozilla.org/show_bug.cgi?id=1224654#c6 . We need a follow-up bug to fix the source-map breakage after pretty-printing.
Comment 8•4 years ago
|
||
I don't think I have a ton to add here. From what I understand, we don't want to show the button because we legitimately don't support pretty-printing original files or files that already have a sourcemap, but we still show the option in the context menu as a weird hack for people that still want to I guess give pretty-printing a shot anyway? IDK.
Comment 9•4 years ago
|
||
Where is this context menu? I'm not seeing anything in Release 77 and Nightly 79.
Comment 10•4 years ago
|
||
When you right-click on a debugger source file's tab.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 11•2 years ago
|
||
Source from comment 0 is not available anymore. I tried all the file under wp-content and they all had the icon enabled.
Since we made some work around this lately (showing the icon, but disabled, fixing the case with sourcemap file referenced but not served, …), I'm going to close this
Description
•