Debugger's pretty print shows old script
Categories
(DevTools :: Debugger, defect, P1)
Tracking
(firefox-esr60 wontfix, firefox-esr68 wontfix, firefox69 wontfix, firefox70 wontfix, firefox71 verified)
People
(Reporter: Oriol, Assigned: arosenfeld2003)
References
Details
(Whiteboard: [debugger-reserve])
Attachments
(1 file)
- Open web console
- Run
"foo"; debugger;
- The debugger shows a
SOURCEsource77
script with"foo"; debugger;
- Click 'Pretty print source'. The debugger shows a
{} SOURCEsource77
script with'foo'; debugger;
- Resume the debugger, go back to the console.
- Run
"bar"; debugger;
- The debugger shows a
SOURCEsource91
script with"bar"; debugger;
- Click 'Pretty print source'.
Expected result: the debugger shows a {} SOURCEsource91
script with
'bar';
debugger;
Actual result: the debugger shows the previous {} SOURCEsource77
script with
'foo';
debugger;
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
It looks like the url for both sources created in the console is null
, even though they have different source.id
values.
In prettyPrint.js
( togglePrettyPrint
method), we have:
const url = getPrettySourceURL(source.url);
const prettySource = getSourceByURL(getState(), url);
if (prettySource) {
return dispatch(selectPrettyLocation(cx, prettySource));
}
getSourceByURL
returns :formatted
for both sources with null
URL.
The pretty printed source is created when the first source is passed in, but getSourceByURL
returns the same prettySource when we prettyPrint the second source.
Are there other instances (besides creating sources in the console) where we would have two different sources with the same url? Does it make sense to create a unique URL for every source created in the console?
Comment 2•4 years ago
|
||
nice find! is there any way we can use source id here?
Yeah - I think I found a straightforward solution using the source id to create a URL if the URL is null, which seems to solve the issue.
Later today I'll go ahead and submit a patch for you to check out.
use the source id to create a url when pretty printing if the url is null.
Updated•4 years ago
|
Updated•4 years ago
|
Reporter | ||
Comment 5•4 years ago
|
||
(In reply to Alex R. from comment #1)
Are there other instances (besides creating sources in the console) where we would have two different sources with the same url? Does it make sense to create a unique URL for every source created in the console?
Maybe you can have 2 <script>
pointing to the same url without caching, and the server response is different each time?
Without knowing much about the debugger, would it be a problem to always use the source id, even if there is an url? Seems more robust
Pushed by dwalsh@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cb54e53665de Handle null source value in prettyPrint r=davidwalsh
Comment 7•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Comment 8•4 years ago
|
||
Confirmed issue with 70.0 on Windows 10.
Fix verified with 71.0b5 on Windows 10, macOS 10.13, Ubuntu 18.04.
Description
•