Closed
Bug 786069
Opened 12 years ago
Closed 4 years ago
Opening a JS function in the variables view should include a link to its source
Categories
(DevTools :: Storage Inspector, enhancement, P3)
DevTools
Storage Inspector
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: billm, Unassigned)
References
(Blocks 1 open bug)
Details
Pretty self-explanatory.
Comment 1•12 years ago
|
||
By link you mean "Jump to definition"?
We could also show the function source in the variables view, but my concern is that it clutters up the tree and may take too much space.
Reporter | ||
Comment 2•12 years ago
|
||
Yes, I mean "Jump to definition". As far as I could see, this isn't available now.
Comment 3•12 years ago
|
||
Indeed. I think we could do this with the parser API, although we'd need to parse all the sources first, since a function could be defined in a different script. Probably not that big'a'deal since the stuff in reflect.jsm is magical.
I see this as a shortcut for bug 762160.
Depends on: 762160
Comment 5•12 years ago
|
||
Relying on the parser API isn't a failproof method. Functions with the same name may be defined anywhere, and inferring which is the right one proved incredibly hard. This isn't a problem for bug 762160, since a list is acceptable in that case, but it's probably an issue for this bug, since I'd expect accurate results from the variables view.
AFAIK, the protocol doesn't carry location information (nor the source text) for functions, not as part of their environment, and also not when getting their prototype and properties. I can't see how we can make this more accurate than providing a list of functions as in bug 762160.
Flags: needinfo?(past)
Comment 6•12 years ago
|
||
Debugger.Objects that are functions have a |script| property in their prototype pointing to their Debugger.Script. Jim, can we add the script URL in a |script| property to function grips, in order to implement this feature? Or even better, since we'll get bug 795368 soon, maybe add a |source| property with a SourceForm to it?
Flags: needinfo?(past) → needinfo?(jimb)
Comment 7•12 years ago
|
||
(In reply to Panos Astithas [:past] from comment #6)
That would be exceptional from my perspective.
Comment 8•12 years ago
|
||
The protocol should *definitely* provide a way to follow that link. Certainly Debugger has all the data needed to do so.
Flags: needinfo?(jimb)
Comment 9•12 years ago
|
||
(In reply to Panos Astithas [:past] from comment #6)
> Debugger.Objects that are functions have a |script| property in their
> prototype pointing to their Debugger.Script. Jim, can we add the script URL
> in a |script| property to function grips, in order to implement this
> feature? Or even better, since we'll get bug 795368 soon, maybe add a
> |source| property with a SourceForm to it?
In the protocol's terminology, function grips should have a "location" property whose value is the source location of the start of the function. The protocol defines what "source location" forms look like. This information is easy to produce.
What would the UI be? Could we make function names look clickable somehow? Or what?
Comment 10•12 years ago
|
||
(In reply to Jim Blandy :jimb from comment #9)
> What would the UI be? Could we make function names look clickable somehow?
> Or what?
That would conflict with the current click-to-expand functionality (although the treetwisty serves the same role, it's generally best to have a wider clickable area for expansion). Accel+click could work, but I worry it's not discoverable enough.
Inspector solves this problem pretty gracefully in the Rule view by providing a link to the selector's location in the css via a clickable url aligned on the right, on the same line with the selector itself.
Updated•12 years ago
|
Assignee: nobody → vporof
Status: NEW → ASSIGNED
Comment 11•11 years ago
|
||
I won't be able to look at this very soon, sorry!
Assignee: vporof → nobody
Status: ASSIGNED → NEW
Updated•11 years ago
|
Comment 12•11 years ago
|
||
Moving stuff to the Object Inspector component.
Filter on COSMICMIGRAINE.
Component: Developer Tools: Debugger → Developer Tools: Object Inspector
OS: Linux → All
Hardware: x86_64 → All
Updated•11 years ago
|
Priority: P3 → P2
Updated•7 years ago
|
Severity: normal → enhancement
Comment 15•7 years ago
|
||
Created https://github.com/devtools-html/devtools-core/issues/802 to consume a given "jumpLocation" by Reps / ObjectInspector.
Jim, do you know if we have access to the definition location for non-function objects ?
If not, maybe we can re-purpose this bug to do this work (or at least to expose it in the grip).
Flags: needinfo?(jimb)
Comment 16•7 years ago
|
||
Including the allocation site in the grip would be really cool.
Without setting some sort of flag, we don't collect the allocation location for arbitrary objects.
Promises save the stack at the point of their allocation; this is available via the `promiseAllocationSite` property of the Debugger.Object. This data is collected if the page was a debuggee when the Promise was created, or if the `asyncStack` option is set on the JSContext (dom.workers.options.asyncstack, for workers; javascript.options.asyncstack for other code):
Here's the function that decides whether to save a new Promise's creation site:
https://searchfox.org/mozilla-central/rev/f0ab0b072ae090f11d6b02b7cf1e0829b4f08882/js/src/builtin/Promise.cpp#165-169
If a Debugger's allocation site tracking is enabled (by setting dbg.memory.trackingAllocationSites and dbg.memory.allocationSamplingProbability appropriately), then a Debugger.Object's allocationSite property holds a stack captured when the object was created.
Full rules for allocation site tracking: https://developer.mozilla.org/en-US/docs/Tools/Debugger-API/Debugger.Memory#Allocation_Site_Tracking
Flags: needinfo?(jimb)
Updated•6 years ago
|
Product: Firefox → DevTools
Comment 17•5 years ago
|
||
Moving to the DOM panel as it's VariableView related and only the DOM panel uses the VariableView now
Component: Object Inspector → DOM
Comment 18•5 years ago
|
||
erratum: this should have been moved to the storage inspector, which is the last consumer of the variable view
Component: DOM → Storage Inspector
Updated•4 years ago
|
Priority: P2 → P3
Comment 19•4 years ago
|
||
Since the Storage panel is the last consumer of the Variables view and this panel is not dealing with functions.
Let's close it.
Honza
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•