Last Comment Bug 725092 - remove cx argument from principals-related callbacks
: remove cx argument from principals-related callbacks
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Igor Bukanov
:
Mentors:
Depends on: 730221
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-07 14:20 PST by Igor Bukanov
Modified: 2012-04-04 12:38 PDT (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
v1 (60.33 KB, patch)
2012-02-07 14:25 PST, Igor Bukanov
no flags Details | Diff | Review

Description Igor Bukanov 2012-02-07 14:20:31 PST
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.
Comment 1 Igor Bukanov 2012-02-07 14:25:32 PST
Created attachment 595181 [details] [diff] [review]
v1

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.
Comment 2 Boris Zbarsky [:bz] (Out June 25-July 6) 2012-02-07 17:26:24 PST
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?
Comment 3 Igor Bukanov 2012-02-08 02:28:59 PST
(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.
Comment 4 Igor Bukanov 2012-04-04 12:38:48 PDT
This was addressed in the bug 730221.

Note You need to log in before you can comment on or make changes to this bug.