Closed Bug 1567313 Opened 1 year ago Closed 1 year ago

[jsdbg2] Debugger reflection classes' trace methods are more dynamically typed than necessary

Categories

(Core :: JavaScript Engine, task, P2, minor)

task

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: jimb, Assigned: jimb)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [debugger-mvp])

Attachments

(1 file)

The C++ classes representing Debugger API objects, like js::DebuggerFrame and js::DebuggerScript, all have static trace member functions that take a JSObject* and downcast it, as required by ClassOps. But with the changes in bug 1567245, there are other tracing paths in Debugger that actually know the most derived type of the objects they're tracing, and are forced to upcast the pointer in order to pass it to trace, which will immediately downcast it. This is not a serious problem, but it is a bit silly.

Replace the loosely-typed 'trace' static member functions with well-typed
non-static trace methods. These can be used by
DebuggerWeakMap::traceCrossCompartmentEdges, called from
Debugger::traceCrossCompartmentEdges.

Since we still need a (JSTracer*, JSObject*) function for use in ClassOps, add
new static member 'trace' functions that do the downcast to the most derived
type, and then defer to the well-typed methods.

Assignee: nobody → jimb
Blocks: dbg-70
Status: NEW → ASSIGNED
Whiteboard: [debugger-mvp]
Priority: -- → P2
Pushed by jblandy@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9de6cb3d8fa1
Give Debugger reflection objects a non-static trace method. r=jorendorff
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.