Closed Bug 725092 Opened 10 years ago Closed 9 years ago

remove cx argument from principals-related callbacks

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

Attachments

(1 obsolete file)

As a leftover from the multithreaded runtime era JSPRINCIPALS_(HOLD|DROP) still use atomic operations when updating JSPrincipals::refcount. We should remove that. Also it would be nice to remove the unused JSContext *cx parameter that often requires to pass that cx through many layers of API.
Attached patch v1 (obsolete) — Splinter Review
The patch drops atomic operations around JSPrincipals::refcount and removes the cx parameter from  JSPRINCIPALS_(HOLD|DROP). That removal is propagated to the callers when possible.
Assignee: general → igor
Attachment #595181 - Flags: review?(mrbkap)
Is this safe given the comments near the end of bug 143559?  nsPrincipal uses atomic increment/decrement on the JSPrincipals, and could race with main-thread code per that bug, right?
(In reply to Boris Zbarsky (:bz) from comment #2)
> Is this safe given the comments near the end of bug 143559?  nsPrincipal
> uses atomic increment/decrement on the JSPrincipals, and could race with
> main-thread code per that bug, right?

You are absolutely right - the principals must continue to use atomic refcounter mutators. So I mutate the bug to be about eliminating unnecessary cx parameter from principals-related methods. That allows to eliminate few useless compartment enter() calls.
Summary: remove multithreaded support from JSPrincipals → remove cx argument from principals-related callbacks
Attachment #595181 - Attachment is obsolete: true
Attachment #595181 - Flags: review?(mrbkap)
This was addressed in the bug 730221.
Status: NEW → RESOLVED
Closed: 9 years ago
Depends on: 730221
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.