Closed
Bug 862077
Opened 11 years ago
Closed 11 years ago
XPCWrappedNative::GetNewOrUsed shouldn't trust wrapper caches so much
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla23
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(2 files)
If an inner window gets into GetNewOrUsed and the cache in the helper is non-null (e.g. it came through new-binding parent-wrapping as an EventTarget), we will do bad things, since cache and !cache->GetWrapperPreserveColor() will be true, but we will in fact have an XPCWrappedNative already. Since most things whose wrapping performance we care about aren't coming through here nowadays, and since fewer and fewer will in the future, we should just treat this case the same as the !cache case and look for an already-existing wrapper.
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #737690 -
Flags: review?(peterv)
Assignee | ||
Comment 2•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Whiteboard: [need review]
Comment 3•11 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #0) > If an inner window gets into GetNewOrUsed and the cache in the helper is > non-null (e.g. it came through new-binding parent-wrapping as an > EventTarget) Can you explain this part a little bit more? IIRC only outer windows use the wrapper cache, right? So what currently causes us to do the right thing when we pass an inner to GetNewOrUsed? Or is the point that we don't, but somehow we've never hit that before? > // Some things are nsWrapperCache subclasses but never use the cach Per the above - does this apply to anything but inner windows? If not, maybe be more specific in the comment?
Assignee | ||
Comment 4•11 years ago
|
||
> So what currently causes us to do the right thing when we pass an inner to GetNewOrUsed?
The fact that xpcObjectHelper has a null wrapper cache pointer, because inner windows don't QI to nsWrapperCache.
But the webidl binding code basically uses cast-by-inheritance, rather than QI, to get the nsWrapperCache, and EventTarget inherits from nsWrapperCache.
Comment 5•11 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #4) > But the webidl binding code basically uses cast-by-inheritance, rather than > QI, to get the nsWrapperCache, and EventTarget inherits from nsWrapperCache. Yikes. Maybe we should make inner windows wrapper cache as well? IIRC mrbkap said there was never an actual reason not to, he was just trying to avoid breaking things when he was implementing some of this stuff. It seems like that would be much better than this fix, which seems kinda whack-a-mole.
Assignee | ||
Comment 6•11 years ago
|
||
> Maybe we should make inner windows wrapper cache as well?
Yes, but that might be a more involved project... I'd like to get us to a correct behavior in the safest and quickest way possible, before people add code that triggers this as part of WebIDL conversions...
Comment 7•11 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #6) > > Maybe we should make inner windows wrapper cache as well? > > Yes, but that might be a more involved project... I'd like to get us to a > correct behavior in the safest and quickest way possible, before people add > code that triggers this as part of WebIDL conversions... Yeah that sounds fine. File a bug though?
Assignee | ||
Comment 8•11 years ago
|
||
Filed bug 862145.
Updated•11 years ago
|
Attachment #737690 -
Flags: review?(peterv) → review+
Assignee | ||
Comment 9•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/eb589744522d
Flags: in-testsuite-
Whiteboard: [need review]
Target Milestone: --- → mozilla23
Comment 10•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/eb589744522d
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•