Module scope variables are "optimizing out"
Categories
(DevTools :: Debugger, defect, P2)
Tracking
(firefox-esr68 wontfix, firefox67 unaffected, firefox68 wontfix, firefox69 wontfix, firefox70 wontfix, firefox71 fixed, firefox72 fixed)
People
(Reporter: ismith, Assigned: bhackett1024)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(2 files)
59.64 KB,
image/png
|
Details | |
47 bytes,
text/x-phabricator-request
|
pascalc
:
approval-mozilla-beta+
|
Details | Review |
What were you doing?
I'm trying to debug a small piece of code that has a single global variable. When I pause on a breakpoint, the debugger says that the value was "optimized out"
I expected that I would be able to examine the values in the array but even though it is a global constant, the values are not available.
I get the same error in Fx 69.0.1, 70.0b9 (Developer), and 71.0a1 (Nightly) but if I load the page in Chrome (77.0.3865.90), the value is available as it is in Edge and Opera (63.0.3368.94).
The code actually works and does what it is supposed to do even though I can't examine the values in the array in the debugger.
I don't think this is Windows specific because I had the same results on Ubuntu.
Comment 1•5 years ago
|
||
Thanks for sharing. Could you share a link where I can look at this?
If not, maybe we can make a small example here.
Comment 3•5 years ago
|
||
Thanks Irene, this looks like an issue with modules because this example works:
https://royal-mortarboard.glitch.me/
Brian, what do you think?
Updated•5 years ago
|
Reporter | ||
Comment 4•5 years ago
•
|
||
I tried removing type="module" from my script tag and it works. Never thought that might be the reason. I had it defined as module because I wanted to store the contents of the array separately and import it into the script. If it isn't defined as a module, I get this error message:
SyntaxError: import declarations may only appear at top level of a module
and the script doesn't load.
Updated•5 years ago
|
Assignee | ||
Comment 5•5 years ago
|
||
This is a regression from bug 1518308. After a module's main script executes, it is cleared from the internal module object, and if the debugger tries to access variables on the module later on they will be marked as optimized out. This is premature, as if the variable is aliased it can still be accessed.
Assignee | ||
Comment 6•5 years ago
|
||
Updated•5 years ago
|
Comment 8•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Comment 9•5 years ago
|
||
Is this something we should consider for Beta uplift or can this ride Fx72 to release?
Assignee | ||
Comment 10•5 years ago
|
||
Comment on attachment 9104527 [details]
Bug 1584538 - Allow debug environment proxy to access aliased module variables after the module script executes, r=jonco.
Beta/Release Uplift Approval Request
- User impact if declined: Debugger might not be able to inspect variables in certain cases.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): This patch restores the behavior we had before bug 1518308.
- String changes made/needed:
Comment 11•5 years ago
|
||
Comment on attachment 9104527 [details]
Bug 1584538 - Allow debug environment proxy to access aliased module variables after the module script executes, r=jonco.
P2 regression in devtools, minimal patch with tests, uplift approved for 71 beta 6, thanks.
Comment 12•5 years ago
|
||
bugherder uplift |
Updated•3 years ago
|
Description
•