Open Bug 1733077 Opened 4 years ago Updated 4 years ago

Add the ability to evaluate expression in console with original variable name when paused at an original location in debugger (retrieving sourcemap information)

Categories

(DevTools :: Console, enhancement, P3)

Firefox 90
enhancement

Tracking

(Not tracked)

People

(Reporter: kes-kes, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached image _.jpg

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0

Steps to reproduce:

I import FormDataJson into module and try to use it

import FormDataJson from './form-data-json.cjs'

window.addEventListener( ' "DOMContentLoaded", (event) => {
debugger;
FormDataJson.toJson( $('#form') )
});

Actual results:

At break point I try to call FormDataJson at console and get FormDataJson is not defined. Still when I run script then no error happened

Expected results:

FormDataJson is scoped to module, but console, I suppose, work at global contex.

local/scoped FormDataJson should be visible to console

The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Debugger
Product: Firefox → DevTools

Hello Eugen,

I guess your project is using sourcemaps, can you confirm?
In such case, there's a mismatch between what the debugger shows (the original variable names) and what the JS engine knows about (the generated variable names, which usually don't match).

Bug 1658238 might make the mapping available for autocomplete, which I guess can be re-used for plain evaluation.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(kes-kes)
Priority: -- → P3
Summary: Variable is not seen from debugger → Evaluating expression in console with original variable name when paused at an original location in debugger throws

@nicolas: yes

Flags: needinfo?(kes-kes)
Type: defect → enhancement
Component: Debugger → Console
Depends on: 1658238
Summary: Evaluating expression in console with original variable name when paused at an original location in debugger throws → Add the ability to evaluate expression in console with original variable name when paused at an original location in debugger (retrieving sourcemap information)

Odd, this should already work. Autocomplete mapping builds on the existing expression mapping support.
However, it requires Map Scopes to be enabled and that the source map has detailed column information - in webpack.config.js, is devtool set to either eval-source-map or source-map?

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: