Bug 19879

Summary: Inspector should support monitorEvents/un monitorEvents() in the command line
Product: WebKit Reporter: Keishi Hattori <keishi>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Enhancement CC: aroben, commit-queue, rik, timothy
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 30324    
Bug Blocks: 14355    
Attachments:
Description Flags
proposed patch
pfeldman: review-
proposed patch 2 none

Description Keishi Hattori 2008-07-03 06:58:29 PDT
Inspector should support monitorEvents/un monitorEvents() in the command line for Firebug parity.
Comment 1 Adam Roben (:aroben) 2008-07-11 14:08:51 PDT
<rdar://problem/6070235>
Comment 2 Keishi Hattori 2009-10-12 23:55:02 PDT
Created attachment 41089 [details]
proposed patch

Consecutive events are not shown because of bug #30324
https://bugs.webkit.org/show_bug.cgi?id=30324

Usage:
monitorEvent(el) will log all events to el
monitorEvent(el, "click") will log "click" events
monitorEvent(el, ["keydown", "keyup"]) will log "keyup" and "keydown" events
monitorEvent(el, "mouse") will log all mouse related events
monitorEvent(el, "key") will log all key related events
unmonitorEvent(el) will turn off logging for all events
Comment 3 Pavel Feldman 2009-10-20 15:39:18 PDT
Comment on attachment 41089 [details]
proposed patch

> +                if (t[i] == \"mouse\") \

Use ===


> +                    te = te.concat([\"mousedown\", \"mouseup\", \"click\", \"dblclick\", \

Use splice instead in order not to create new array instances.

> +                if (t[i] == \"key\") \

Use ===


> +                o.removeEventListener

Should you test for addEventListener / removeEvent listener on an object?
Does monitorEvent(null) provide meaningful feedback well?

Other than that r+.
Comment 4 Keishi Hattori 2009-10-20 20:30:07 PDT
Created attachment 41545 [details]
proposed patch 2

(In reply to comment #3)
> > +                if (t[i] == \"mouse\") \
Fixed.
> > +                    te = te.concat([\"mousedown\", \"mouseup\", \"click\", \"dblclick\", \
Fixed.
> > +                if (t[i] == \"key\") \
Fixed.
> Should you test for addEventListener / removeEvent listener on an object?
Added tests.
> Does monitorEvent(null) provide meaningful feedback well?
I wasn't sure what to do. Should it print usage help or an error?
Comment 5 Pavel Feldman 2009-10-22 07:29:18 PDT
Comment on attachment 41545 [details]
proposed patch 2

FYI: we are currently working on TimelineAgent that is getting information from the instrumentation all over WebCore. Including the events. So it is already getting all the data you are collecting here. It is not bound to any particular object though, so it is a bit different, but still close!
Comment 6 WebKit Commit Bot 2009-10-22 08:45:55 PDT
Comment on attachment 41545 [details]
proposed patch 2

Clearing flags on attachment: 41545

Committed r49940: <http://trac.webkit.org/changeset/49940>
Comment 7 WebKit Commit Bot 2009-10-22 08:45:58 PDT
All reviewed patches have been landed.  Closing bug.