Closed Bug 786509 Opened 13 years ago Closed 13 years ago

Remove broken, unused wildcard support from dbg-client.jsm's eventSource mixin

Categories

(DevTools :: Debugger, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 18

People

(Reporter: jimb, Assigned: jimb)

Details

Attachments

(1 file, 1 obsolete file)

The support for wildcard event listeners is unused, and has never worked. The code to fire wildcard event listeners reads: if (this._listeners['*']) { listeners.concat(this._listeners['*']); } However, Array.prototype.concat does not mutate 'this'; it returns a fresh array. So the wildcard listeners have never been called. The code has always read this way. Since it's unused, I suggest we just take it out. It's easy enough to add back if we need it.
Attachment #656276 - Flags: review?(past)
The patch also removes code to make addListener return without doing anything if the handler given is not a function. Since it's simply not correct to pass a non-function as the second argument, it seems to me this should either throw immediately, or at least let an error occur when we try to dispatch the event.
Throw immediately given a non-function listener. Fix the other comment suggesting that a null event name is meaningful.
Assignee: nobody → jimb
Attachment #656276 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #656276 - Flags: review?(past)
Attachment #656279 - Flags: review?(past)
Comment on attachment 656279 [details] [diff] [review] Remove support for wildcard event listeners from dbg-client.jsm's eventSource. Review of attachment 656279 [details] [diff] [review]: ----------------------------------------------------------------- Yes, agreed on all counts.
Attachment #656279 - Flags: review?(past) → review+
Flags: in-testsuite-
Target Milestone: --- → Firefox 18
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: