Bug 29920

Summary: Make a copy of listeners array before dispatching an event
Product: WebKit Reporter: Yury Semikhatsky <yurys>
Component: Web Inspector (Deprecated)Assignee: Yury Semikhatsky <yurys>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, pmuellr, timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
patch none

Yury Semikhatsky
Reported 2009-09-30 05:56:19 PDT
Make a copy of listeners array before dispatching an event in WebInspector.Object.prototype.dispatchEventToListeners. Otherwise if current listener removes itself from the array next listener will be skipped.
Attachments
patch (1.60 KB, patch)
2009-09-30 06:05 PDT, Yury Semikhatsky
no flags
Yury Semikhatsky
Comment 1 2009-09-30 06:05:24 PDT
Timothy Hatcher
Comment 2 2009-09-30 09:18:45 PDT
Comment on attachment 40366 [details] patch Why did you remove the bind calls? Those are needed to pass the event as the this object.
Patrick Mueller
Comment 3 2009-09-30 11:43:23 PDT
Looks like the bind() should be on preventDefault, but not on stopPropagation. Not harmful on stopPropagation, but it's not needed, and otherwise creates a new function closure for no good reason.
Yury Semikhatsky
Comment 4 2009-09-30 23:48:07 PDT
(In reply to comment #2) > (From update of attachment 40366 [details]) > Why did you remove the bind calls? > > Those are needed to pass the event as the this object. There is no need to bind the functions to event since 'this' variable will be resolved dynamically and as long as preventDefault and stopPropagation are invoked on 'event' 'this' object will be === 'event'. Please tell me if you still want me to revert the changes.
WebKit Commit Bot
Comment 5 2009-10-01 06:17:12 PDT
Comment on attachment 40366 [details] patch Clearing flags on attachment: 40366 Committed r48970: <http://trac.webkit.org/changeset/48970>
WebKit Commit Bot
Comment 6 2009-10-01 06:17:16 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.