Closed Bug 1839839 Opened 3 months ago Closed 3 months ago

Avoid cloning the frames objects unless it is strictly necessary


(DevTools :: Debugger, enhancement)



(firefox117 fixed)

117 Branch
Tracking Status
firefox117 --- fixed


(Reporter: ochameau, Assigned: ochameau)




(3 files)

Bug 1835985 removed some unecessary cloning of the frame objects.
But I missed that there were at least 3 other cases of such cloning.

One related to mapping frames to original locations:
Here we could avoid cloning the frame object if the location isn't mapped to an original source.

One related to WASM sources (there is nothing making it clear this code relates to WASM!):

And one last related to the computation of originalDisplayName, which could probably be computed while mapping the frames:

This isn't mentioned anywhere, but "expandFrames" is specific to WASM.
I've added some comments and renames, while highlighting the difference between the two possible types of frame objects.
At the end, frame objects for non-WASM orignal sources aren't special, they only have distinct location vs generatedLocation attributes.

Only try to compute frame's originalDisplayName for frame relating to a non-WASM original source.
For WASM frames, it is already computed.
For generated frames, it isn't useful as frame.displayName is correct and provided by the server.
Also acknowledge why we are only computing original display from the select action.

This computation was only done from selectLocation action,
after the completion of the SET_SYMBOLS action. That, only if the current thread was paused.

Doing this right from the reducer helps avoiding thread's frames array duplication
unless this is strictly necessary.
It is probably also a clearer way to say this work should be done only after symbols are fetched.

Pushed by
[devtools] Clarify expandFrames code being specific to WASM sources. r=bomsy,devtools-reviewers
[devtools] Clarify the computation of frame's originalDisplayName. r=devtools-reviewers,bomsy
[devtools] Move the computation of frame's originalDisplayFrame to the reducer. r=devtools-reviewers,bomsy
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch
You need to log in before you can comment on or make changes to this bug.