Closed Bug 1983207 Opened 1 year ago Closed 11 months ago

Unnecessary fields in CallSetup

Categories

(Core :: DOM: Bindings (WebIDL), enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
145 Branch
Tracking Status
firefox145 --- fixed

People

(Reporter: arai, Assigned: mgaudet)

References

Details

Attachments

(2 files)

CallSetup class has some maybe-rooted fields for GC things, but they're not actually used anywhere outside of the constructor, or never read.
These fields should be removed.

https://searchfox.org/mozilla-central/rev/ce0d41b6033e2a104904327a43edf730245f5241/dom/bindings/CallbackObject.h#70,240,284-289

class CallbackObjectBase {
...
  class MOZ_STACK_CLASS CallSetup {
...
    Maybe<JS::Rooted<JSObject*>> mRootedCallable;
    // The global of mRootedCallable.
    Maybe<JS::Rooted<JSObject*>> mRootedCallableGlobal;

    // Members which are used to set the async stack.
    Maybe<JS::Rooted<JSObject*>> mAsyncStack;

Thank you for opening this bug: I've been looking at these members as Chesterton's Fence but have been unable thus far to particularly make heads or tails as to why they were added -- though I've not done a historical deep dive to look into the state of CallSetup when they were added.

(mRootedCallableGlobal was added by bug 1477923 and it was also only being used in the constructor.)

Assignee: nobody → mgaudet
Status: NEW → ASSIGNED
  1. We don't need to root the stack -- fixed AutoSetAsyncStack in previous patch
  2. We don't need to root the callable global -- it will be kept alive by the callable being rooted.

We -do- however still need to have the callable itself be rooted

(For example /test262/built-ins/Proxy/preventExtensions/trap-is-undefined-target-is-proxy.js crashes
if it's not rooted, as we end up trying to AutoRealm into a CCW.)

Attachment #9512950 - Attachment description: Bug 1983207 - Make parameter to AutoSetAsyncStackForNewCalls a handle r?arai → Bug 1983207 - Make parameter to AutoSetAsyncStackForNewCalls a bare object pointer r?arai
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 145 Branch
QA Whiteboard: [qa-triage-done-c146/b145]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: