Closed Bug 1790102 Opened 2 years ago Closed 2 years ago

Make nsXPCWrappedJS into a regular script holder class

Categories

(Core :: XPConnect, task, P3)

task

Tracking

()

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(1 file)

I looked into this, and despite the weirdness of nsXPCWrappedJS, it doesn't look hard to turn this into a regular script holder class. This also lets me get rid of XPCRootSetElem.

The existing code changes whether the object is in the root set when IsSubjectToFinalization() changes due to the refcount. I think it makes more sense to just make it always be in the root set (via HoldJSObjects) and then instead conditionally trace the JS object if !IsSubjectToFinalization() holds. This means the root set is bigger because it includes WJS subject to finalization, but that seems trivial.

The main difference here is that WJS now are in the root set (as JS holders) for
their entire lifetime, instead of being added or removed as their refcount
changes. Instead, the trace method simply doesn't trace the JS object if
it is subject to finalization.

This lets me get rid of XPCRootSetElem, which now has no users.

Blocks: 1543537
Pushed by amccreight@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f26ff6e0f48c Make nsXPCWrappedJS into a regular script holder class. r=smaug
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: