Closed Bug 1835985 Opened 2 years ago Closed 2 years ago

Stop cloning frame objects -- Unify all frame objects

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(firefox116 fixed)

RESOLVED FIXED
116 Branch
Tracking Status
firefox116 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(3 files)

The Call Stack panel currently uses different types of frame objects where we augment the common one with library attribute.

This is done from a selector and so we:

  • duplicate the frame objects (many times!)
  • we recompute these objects on many state change instead of computing this additional attribute once per frame object

This also doesn't help understanding our codebase as a frame list or a frame object in our codebase may refer to distinct object, with different attributes and be distinct object instances.

This is now redundant with frame.location.source.

Also clarify the integration of SmartTrace with Frames component.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED

And more importantly, stop cloning all frame objects!

Also ensure that this attribute is set the earliest possible,
so that any code using frame objects could use this attribute and not only the callstack.

One side effect of this changeset is that frame grouping per library now work
both with original and generated stack frames.
This is because we only lookup for source url via frame.location.source.url,
so that we always use the original source URL for all library checks.
The library checks are not working on the bundle URL... and for now the frames
are having their location attribute hacked to be set to the generated location
when we are showing generated location.

Because the React component were always reading frame.location,
the selector had to clone all frame objects in order to sometimes
store the generated location in frame.location.

Instead the React component can read the shouldDisplayOriginalLocation state
and either use frame.location -or- frame.generatedLocation.
Similarly to what we do in most places for breakpoints.

Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bb685d419898 [devtools] Stop adding "source" attribute on all callstack frames. r=devtools-reviewers,bomsy https://hg.mozilla.org/integration/autoland/rev/2dc6e26a72e9 [devtools] Annotate frame with library attribute just after mapping them. r=devtools-reviewers,bomsy https://hg.mozilla.org/integration/autoland/rev/e3c29fe798a7 [devtools] Avoid duplicating frame objects because of original vs generated contexts. r=devtools-reviewers,bomsy
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 116 Branch
No longer blocks: 1822310
Blocks: 1839839
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: