Closed Bug 1536336 Opened 8 months ago Closed 8 months ago

Consider allowing const RefPtr members in MOZ_CAN_RUN_SCRIPT analysis.

Categories

(Firefox Build System :: Source Code Analysis, enhancement)

enhancement
Not set

Tracking

(firefox68 fixed)

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

In a MOZ_CAN_RUN_SCRIPT function, we know "this" is alive. So if "this" has a member which is of type "const RefPtr<T>" (or const nsCOMPtr, etc), then we know that member will also be alive. We should consider allowing that in the analysis instead of having people manually MOZ_KnownLive annotate them (which is more fragile, if the member stops being const).

I'll try giving this a shot.

Assignee: nobody → bzbarsky

"this" is guaranteed to stay alive as long as other MOZ_CAN_RUN_SCRIPT
conditions hold, and its const members can't change value and drop
their refs.

Blocks: 1536485
Blocks: 1536719
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fd59264c47c1
Change MOZ_CAN_RUN_SCRIPT analysis to allow const members of "this" in addition to stack refptrs.  r=andi
Flags: needinfo?(bzbarsky)
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.