Debugger pretty print can fail on files using windows line breaks
Categories
(DevTools :: Debugger, defect, P2)
Tracking
(firefox136 verified)
Tracking | Status | |
---|---|---|
firefox136 | --- | verified |
People
(Reporter: jrmuizel, Assigned: jdescottes)
References
(Blocks 2 open bugs, Regressed 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
STR:
- Load https://unsplash.com/s/photos/renaissance
- Navigate to
s/photos/renaissance
in the debugger - Try to unminify it
I get:
Error loading this URI: Unterminated string constant (1:25)
Stack in the worker:requireAcorn/</pp$4.raise@resource://devtools/client/debugger/dist/pretty-print-worker.js:7206:21
requireAcorn/</pp.readString@resource://devtools/client/debugger/dist/pretty-print-worker.js:9042:55
requireAcorn/</pp.getTokenFromCode@resource://devtools/client/debugger/dist/pretty-print-worker.js:8837:25
requireAcorn/</pp.readToken@resource://devtools/client/debugger/dist/pretty-print-worker.js:8561:23
requireAcorn/</pp.nextToken@resource://devtools/client/debugger/dist/pretty-print-worker.js:8552:23
requireAcorn/</pp.next@resource://devtools/client/debugger/dist/pretty-print-worker.js:8513:16
requireAcorn/</pp.getToken@resource://devtools/client/debugger/dist/pretty-print-worker.js:8517:16
#getTokens@resource://devtools/client/debugger/dist/pretty-print-worker.js:9752:29
getPrettifiedCodeAndSourceMap@resource://devtools/client/debugger/dist/pretty-print-worker.js:9580:43
prettyFast@resource://devtools/client/debugger/dist/pretty-print-worker.js:9366:38
prettyPrintInlineScript@resource://devtools/client/debugger/dist/pretty-print-worker.js:10617:34
requireWorkerUtils/workerHandler/</<@resource://devtools/client/debugger/dist/pretty-print-worker.js:3691:58
requireWorkerUtils/workerHandler/<@resource://devtools/client/debugger/dist/pretty-print-worker.js:3689:19
Reporter | ||
Updated•4 months ago
|
Comment 2•2 months ago
|
||
Another occurence on https://rosasthai.com/locations against locations
HTML file, which seems to reproduce more consistantly.
Assignee | ||
Comment 3•2 months ago
•
|
||
(In reply to Alexandre Poirot [:ochameau] from comment #2)
Another occurence on https://rosasthai.com/locations against
locations
HTML file, which seems to reproduce more consistantly.
Looks like the index contains several scripts, and for the second one we get the wrong indices and try to prettify the following string:
>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-P4ML2
Edit: Interestingly this doesn't reproduce by simply reusing the exact same HTML
Assignee | ||
Comment 4•2 months ago
|
||
I think it's because some line breaks are \r\n
instead of \n
Assignee | ||
Updated•2 months ago
|
Assignee | ||
Comment 5•2 months ago
|
||
Assignee | ||
Updated•2 months ago
|
Assignee | ||
Comment 6•2 months ago
|
||
(not getting the issue anymore for https://unsplash.com/s/photos/renaissance)
Assignee | ||
Comment 7•2 months ago
|
||
Depends on D234020
In case of pretty printing error, we display the error from the worker, from the action dispatcher.
We could log the source which failed to be pretty printed, especially for html inline scripts where
several small scripts will be prettified independantly.
Comment 8•2 months ago
|
||
Comment on attachment 9459386 [details]
Bug 1932023 - [devtools] Log error message when pretty print fails to handle a script
Revision D234172 was moved to bug 1942009. Setting attachment 9459386 [details] to obsolete.
Comment 10•2 months ago
|
||
bugherder |
Updated•1 month ago
|
Comment 11•24 days ago
|
||
I can reproduce this issue before the fix in Nightly v136.0a1 (2025-01-15) and unfortunately, I can still reproduce it after the fix in Nightly v136.0a1 (2025-01-17) (64-bit) and Nightly v137.0a1 (2025-02-12), however, this issue is not reproducible in the latest Beta v136.0b5 or Release v135.0.
In conclusion, this issue only reproduces in Nightly channel and the fix does not resolve the original issue.
Julian, can you take a look? Do you know what's wrong?
Assignee | ||
Comment 12•24 days ago
|
||
(In reply to Daniel Bodea [:danibodea] from comment #11)
I can reproduce this issue before the fix in Nightly v136.0a1 (2025-01-15) and unfortunately, I can still reproduce it after the fix in Nightly v136.0a1 (2025-01-17) (64-bit) and Nightly v137.0a1 (2025-02-12), however, this issue is not reproducible in the latest Beta v136.0b5 or Release v135.0.
In conclusion, this issue only reproduces in Nightly channel and the fix does not resolve the original issue.Julian, can you take a look? Do you know what's wrong?
Thanks for the ping!
Looks like a slightly different bug, which only occurs when devtools.debugger.features.codemirror-next is true (which is Nightly only).
I was probably testing with devtools.debugger.features.codemirror-next set to false? Or something changed on the website. Will take a look!
Assignee | ||
Comment 13•24 days ago
|
||
So the patch actually fixes the following STRs, normally consistently regardless of codemirror versions:
- open https://rosasthai.com/locations
- open debugger, open https://rosasthai.com/locations in the debugger
- prettify
ER: should work
AR (before patch): breaks with Unterminated string constant (5:40)
For the initial test page ( https://unsplash.com/s/photos/renaissance), I don't actually think it's purely related to the codemirror version.
When testing I get a very inconsistent behavior, sometimes it fails, sometimes it succeeds and I haven't exactly pinned down consistent STRs. But I get the error in all versions of Firefox available at the moment (135 to 137)
So I would suggest we close this, as the patch still fixes the alternative STRs, and I will file another bug for https://unsplash.com/s/photos/renaissance.
Comment 14•24 days ago
|
||
I managed to reproduce the issue using the steps in comment 13 in Windows 10, MacOS 11 and MacOS 14 aarch64 with Nightly v136.0a1 from 2024-01-15. The issue is more likely to reproduce in low-end machines, but closing the tab and reloading the page, causes the issue to reproduce with a higher repro rate. I can confirm the fix in Nightly v136.0a1 from 2025-01-17 and Nightly v136.0a1 from 2025-02-13.
Description
•