Closed
Bug 869526
Opened 12 years ago
Closed 12 years ago
GC: Fix more rooting hazards in xpconnect
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: jonco, Assigned: jonco)
References
Details
Attachments
(1 file, 1 obsolete file)
19.44 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
Here's a patch to fix some more rooting hazards in XPConnect.
A couple of them need a little explanation:
The changes to XPCVariant::VariantDataToJS() are to fix a false positive because the rooting analysis doesn't understand that the jsval in the union can never be a hazard in this case. I don't think it's feasible to fix the analysis for this one case, so I changed the code to use a new union that doesn't contain a jsval. You might object to the code churn however, it's kind of an unfortunate case.
I also changed nsXPConnect::GetCurrentJSContext() and nsXPConnect::GetSafeJSContext() to use GetRuntime() rather than XPCJSRuntime::Get() as the latter can in theory case a GC since it ends up lazily initializing XPConnect if necessary, even though this is probably not going to happen in practice.
Attachment #746483 -
Flags: review?(bobbyholley+bmo)
Comment 1•12 years ago
|
||
Comment on attachment 746483 [details] [diff] [review]
Proposed changes
Review of attachment 746483 [details] [diff] [review]:
-----------------------------------------------------------------
I think I would prefer to scope each case: block and then just locally declare whichever temporary is needed in each instance. Unless I'm misreading, the only point of the variant here is effectively just to have a typed memory buffer to use as temporary storage for each of the conversion calls, right? If so, I think locals are the way to go.
Attachment #746483 -
Flags: review?(bobbyholley+bmo) → review-
Assignee | ||
Comment 2•12 years ago
|
||
Here's an updated patch with the use of the union removed and local variables used instead.
Attachment #746483 -
Attachment is obsolete: true
Attachment #746986 -
Flags: review?(bobbyholley+bmo)
Comment 3•12 years ago
|
||
Comment on attachment 746986 [details] [diff] [review]
Patch v2
Review of attachment 746986 [details] [diff] [review]:
-----------------------------------------------------------------
r=bholley with comment addressed.
::: js/xpconnect/src/XPCVariant.cpp
@@ +468,4 @@
> if (NS_FAILED(variant->GetAsID(&iid)))
> return false;
> + nsID *v = &iid;
> + return XPCConvert::NativeData2JS(lccx, pJSVal, (const void*)&v, TD_WCHAR, &iid, pErr);
This should be TD_PNSIID, no?
Attachment #746986 -
Flags: review?(bobbyholley+bmo) → review+
Assignee | ||
Comment 4•12 years ago
|
||
(In reply to Bobby Holley (:bholley) from comment #3)
Yes indeed, fixed.
Assignee | ||
Comment 5•12 years ago
|
||
Comment 6•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in
before you can comment on or make changes to this bug.
Description
•