Closed Bug 1083232 Opened 10 years ago Closed 10 years ago

Does FrameState really need to refcount the principals?

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Seems to me like the FrameState has C-stack-lifetime and during its lifetime the principals are kept alive by the JS callstack that we're walking....  So we shouldn't need to hold/drop them in FrameState() and ~FrameState().
+1 let's drop the drops.
Blocks: 885333
No longer blocks: 85333
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment on attachment 8505957 [details] [diff] [review]
Don't refcount the principals in FrameState, since it has stack lifetime and the principals will be kept alive by the JS stack while he FrameState is alive

Review of attachment 8505957 [details] [diff] [review]:
-----------------------------------------------------------------

Might be worth a short comment blurb explaining why we don't need to hold principals, for the inquisitive reader of the future.

Again, note that I'm not a SpiderMonkey peer.
Attachment #8505957 - Flags: review?(nfitzgerald) → review+
Added a note in the header:

        // Note: we don't have to hold/drop principals, because we're
        // only alive while the stack is being walked and during this
        // time the principals are kept alive by the stack itself.

As far as peerness, I think we're OK; jimb was ok with this as well, for example.  And you're the domain expert on this code anyway.
https://hg.mozilla.org/mozilla-central/rev/01d25edea2bc
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: