Closed
Bug 53929
Opened 24 years ago
Closed 24 years ago
console service fails to UnregisterListener
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
People
(Reporter: jband_mozilla, Assigned: mike+mozilla)
Details
Attachments
(2 files)
3.58 KB,
patch
|
Details | Diff | Splinter Review | |
3.77 KB,
patch
|
Details | Diff | Splinter Review |
nsConsoleService::RegisterListener builds a proxy around the listener and saves
a pointer to that proxy. nsConsoleService::UnregisterListener tries to find and
remove the *raw* listener. Since the raw listener is never saved it is never
found and removed. It is thus leaked (along with its window) and later attempts
to call it fail. The fix is to use the proxy service to get the proxy in
UnregisterListener just like in RegisterListener. Since the proxy service caches
live proxies it will do the right lookup and find the same proxy for the same
listener.
This bug is a real annoying impedement to using the JS console in a debug build.
If one opens and then *ever* closes the console then you will hit an assert in
xpconnect for each and every JS error or warning (and we now have lots of JS
warnings). The assert fires because the (leaked!) listener holds a reference to
the (leaked!) console window global object. But that global object has had its
properties cleared so has no 'Components' object. The call to the observer via
xpconnect needs to be able to find the Components object in order to build a
wrapper for the param of the observer. When it fails to find that Components
object it asserts.
This is ugly and is easily fixed with the patch I will attach. I've tested the
patch and no xpconnect objects are leaked and no asserts are fired.
Reporter | ||
Comment 1•24 years ago
|
||
Assignee | ||
Comment 2•24 years ago
|
||
Thanks for finding this! It's been bugging me for a long time now... of course
the fix had to be obvious and simple.
r=mccabe, with one change. The entire UnregisterListener function is currently
nsAutoLock'ed, but I think that only the RemoveElement call needs to be. I'd
put the lock and the RemoveElement call in a block.
Also, a style question - GetProxyForListener is implemented as a private member
function. Is there a reason to prefer a member function over a static function?
Is this worth fixing in the release?
Reporter | ||
Comment 3•24 years ago
|
||
I agree on the lock.
On file static vs. private member... I don't think it matters much. Especially
when no instance data is used. Choose whatever you like.
I'm sure jar would say this is not critical. On the other hand, it is a real
pain for those people building the product and trying to see JS errors. Still,
the "don't close the console" workaround is obvious. I'd say get it on the trunk
as soon as that becomes possible again. The branch is probably off limits
forever for stuff like this.
Please make this your own. I'll be happy to review any tweaks.
Assignee | ||
Comment 4•24 years ago
|
||
Reporter | ||
Comment 5•24 years ago
|
||
r=jband
Reporter | ||
Comment 6•24 years ago
|
||
hey, let's get this checked into the trunk.
Assignee | ||
Comment 7•24 years ago
|
||
Fix checked in to trunk.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•