Closed Bug 613315 Opened 14 years ago Closed 12 years ago

Cu.getGlobalForObject should unwrap wrappers

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 736316

People

(Reporter: Gavin, Unassigned)

References

Details

Attachments

(1 file, 2 obsolete files)

Using Cu.getGlobalForObject on wrappers seems to produce very strange results, e.g. returning the current global (of the wrapper?) rather than the global of the underlying object.

mrbkap suggests that nsXPCComponents_Utils::GetGlobalForObject() needs to do some unwrapping magic before just calling into JS_GetGlobalForObject.
...And then re-wrapping afterwards, of course.

Cc-ing Waldo since this is his baby. Also I want to ask him to consider the ramifications for removing JSObject::parent when fixing this. :)
Attached patch strawman (obsolete) — Splinter Review
This seems to get me the behavior that I want. I don't understand the security implications of this, or what the "re-wrapping" from comment 1 would entail, though.
Attached patch strawman, v2 (obsolete) — Splinter Review
This is mostly guesswork :)
Attachment #492173 - Attachment is obsolete: true
Attachment #492281 - Flags: feedback?(jwalden+bmo)
Attachment #492281 - Flags: feedback?(mrbkap)
Comment on attachment 492281 [details] [diff] [review]
strawman, v2

Seems reasonable.  I assume none of the methods here are fallible so as to need testing for null return or something?  (I didn't look.)
Attachment #492281 - Flags: feedback?(jwalden+bmo) → feedback+
Attachment #492281 - Flags: feedback?(mrbkap) → review?(mrbkap)
Comment on attachment 492281 [details] [diff] [review]
strawman, v2

Looks good, thanks.
Attachment #492281 - Flags: review?(mrbkap) → review+
Attached patch updated patchSplinter Review
Attachment #492281 - Attachment is obsolete: true
Blocks: 664426
I'm pretty sure I fixed this over in bug 736316.
sure looks like it!
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: