Closed
Bug 232854
Opened 21 years ago
Closed 21 years ago
XULDocument.RemoveBroadcastListenerFor does not remove the observer
Categories
(Core :: XUL, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: phnixwxz1, Assigned: tingley)
Details
Attachments
(1 file)
774 bytes,
patch
|
janv
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent:
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.4) Gecko/20030624
Whenver XULDocument.RemoveBroadcastListenerFor is called with correct arguments,
it will return NS_OK, but the observer is not removed.
964 for (PRInt32 i = entry->mListeners.Count() - 1; i >= 0; --i) {
965 BroadcastListener* bl =
966 NS_STATIC_CAST(BroadcastListener*, entry->mListeners[i]);
967
968 if ((bl->mListener == aListener) && (bl->mAttribute == attr)) {
969 entry->mListeners.RemoveElement(aListener);
970
971 if (entry->mListeners.Count() == 0)
972 PL_DHashTableOperate(mBroadcasterMap, aBroadcaster,
973 PL_DHASH_REMOVE);
974
975 SynchronizeBroadcastListener(aBroadcaster, aListener, aAttr);
976
977 break;
978 }
979 }
The problem is caused by line 969, because the entries in entry->mListeners are
of type BroadcastListener. '...RemoveElement(aListener)' does nothing.
This may cause crash if the listener element is removed from the document, and
GC'ed by Javascript.
Reproducible: Always
Steps to Reproduce:
Updated•21 years ago
|
Summary: XULDocument.RemoveBroadcastListenerFor doesnot remove the observer → XULDocument.RemoveBroadcastListenerFor does not remove the observer
Assignee | ||
Comment 1•21 years ago
|
||
Yup, this should be |RemoveElement(bl)|
-> XUL
Assignee: general → hyatt
Status: UNCONFIRMED → NEW
Component: DOM: Mozilla Extensions → XP Toolkit/Widgets: XUL
Ever confirmed: true
QA Contact: ian → shrir
Comment 2•21 years ago
|
||
Post a patch? hyatt is not likely to....
Assignee | ||
Comment 3•21 years ago
|
||
Actually, RemoveElement(i) would be even better...
Assignee: hyatt → tingley
Status: NEW → ASSIGNED
Assignee | ||
Updated•21 years ago
|
Attachment #140475 -
Flags: review?(varga)
Comment 4•21 years ago
|
||
Comment on attachment 140475 [details] [diff] [review]
patch
r=varga
Attachment #140475 -
Flags: review?(varga) → review+
Comment 5•21 years ago
|
||
Comment on attachment 140475 [details] [diff] [review]
patch
sr=bzbarsky
Attachment #140475 -
Flags: superreview+
Assignee | ||
Comment 6•21 years ago
|
||
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in
before you can comment on or make changes to this bug.
Description
•