Closed Bug 885800 Opened 11 years ago Closed 11 years ago

Cu.isDeadWrapper() should unwrap CCWs

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: msucan, Unassigned)

Details

Attachments

(1 file)

Given compartments A, B and C, object O which lives in B, and a variable V in A that points to object O. B is nuked at some later point but V is still there, as a DeadObject. If you get V from C and you call Cu.isDeadWrapper(V) you get |false|. You only get |true| if you call Cu.isDeadWrapper(V) from A. We would need this to work from other compartments as well.

Bobby Holley said the following in bug 883649 comment #14:

> Once a wrapper is nuked, it ceases to become a wrapper at all. This means
> that passing the nuked wrapper across compartment boundaries will end up
> with a CCW to a DeadObjectProxy, rather than another DeadObjectProxy.
> 
> If it would be helpful, we could make Cu.IsDeadWrapper unwrap CCWs, so if
> would give the right answer here. If it would, please file a bug and CC me.

... in reply to bug 883649 comment 13.
Attachment #766106 - Flags: review?(gkrizsanits)
Comment on attachment 766106 [details] [diff] [review]
Unwrap CCWs in Cu.isDeadWrapper. v1

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

I don't really see why do you not just use the unchecked unwrap here, but since it's a Cu method, probably does not matter.
Attachment #766106 - Flags: review?(gkrizsanits) → review+
(In reply to Gabor Krizsanits [:krizsa :gabor] (sick) from comment #2)
> Comment on attachment 766106 [details] [diff] [review]
> Unwrap CCWs in Cu.isDeadWrapper. v1
> 
> Review of attachment 766106 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I don't really see why do you not just use the unchecked unwrap here, but
> since it's a Cu method, probably does not matter.

We should always use CheckedUnwrap unless we have an explicit need for UncheckedUnwrap, since the latter is a a potential security risk. I'd like to minimize the MXR results for UncheckedUnwrap.
https://hg.mozilla.org/mozilla-central/rev/ab82dbf50dd2
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: