Closed Bug 613315 Opened 10 years ago Closed 8 years ago
.get Global For Object should unwrap wrappers
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. :)
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.
This is mostly guesswork :)
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+
I'm pretty sure I fixed this over in bug 736316.
sure looks like it!
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 736316
You need to log in before you can comment on or make changes to this bug.