WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
81658
Web Inspector: expose queryEventListeners() to console command line API
https://bugs.webkit.org/show_bug.cgi?id=81658
Summary
Web Inspector: expose queryEventListeners() to console command line API
Andrey Kosyakov
Reported
2012-03-20 06:41:01 PDT
This adds queryEventListeners() call to command line API in the inspector console. Only the JS listeners in current world are returned. We primarily want this to be accessible to Web Inspector extensions, although this might be handy for having a closer look at the listeners to the interactive users as well.
Attachments
Patch
(23.48 KB, patch)
2012-03-20 06:44 PDT
,
Andrey Kosyakov
no flags
Details
Formatted Diff
Diff
Patch
(25.75 KB, patch)
2012-03-20 07:38 PDT
,
Andrey Kosyakov
no flags
Details
Formatted Diff
Diff
Patch
(24.35 KB, patch)
2012-03-20 08:39 PDT
,
Andrey Kosyakov
yurys
: review+
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Andrey Kosyakov
Comment 1
2012-03-20 06:44:16 PDT
Created
attachment 132815
[details]
Patch
Yury Semikhatsky
Comment 2
2012-03-20 07:12:19 PDT
Comment on
attachment 132815
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=132815&action=review
> Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp:231 > + eventListeners->putDirect(exec->globalData(), Identifier(exec, "node"), toJS(exec, globalObject, listenersArray[i].node));
Do we really want to return event listeners for ancestors?
> Source/WebCore/inspector/InjectedScriptHost.h:95 > + void queryEventListenersImpl(Node*, Vector<EventListenerInfo>& listenersArray);
Why is this Impl suffix?
Build Bot
Comment 3
2012-03-20 07:13:39 PDT
Comment on
attachment 132815
[details]
Patch
Attachment 132815
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/12005268
Yury Semikhatsky
Comment 4
2012-03-20 07:17:19 PDT
Comment on
attachment 132815
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=132815&action=review
> LayoutTests/inspector/console/command-line-api-queryEventListeners.html:20 > +<div id="inner">
Please add a few attribute handlers as they will also be listed as the listeners.
Andrey Kosyakov
Comment 5
2012-03-20 07:36:36 PDT
(In reply to
comment #2
)
> (From update of
attachment 132815
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=132815&action=review
> > > Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp:231 > > + eventListeners->putDirect(exec->globalData(), Identifier(exec, "node"), toJS(exec, globalObject, listenersArray[i].node)); > > Do we really want to return event listeners for ancestors?
This is for consistency with what we do in the DOM agent/elements panel -- presumably, caller would be interested in the ancestors, given these may have interceptors or handlers for bubbling event. This could go under a boolean flag, perhaps.
> > Source/WebCore/inspector/InjectedScriptHost.h:95 > > + void queryEventListenersImpl(Node*, Vector<EventListenerInfo>& listenersArray); > > Why is this Impl suffix?
Just for consistency with inspectImpl(). I'm not particularly attached to it, though, so will gladly drop.
> Please add a few attribute handlers as they will also be listed as the listeners.
Fixed.
Andrey Kosyakov
Comment 6
2012-03-20 07:38:51 PDT
Created
attachment 132824
[details]
Patch
Build Bot
Comment 7
2012-03-20 08:04:54 PDT
Comment on
attachment 132824
[details]
Patch
Attachment 132824
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/11994322
Andrey Kosyakov
Comment 8
2012-03-20 08:37:47 PDT
(In reply to
comment #2
)
> (From update of
attachment 132815
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=132815&action=review
> > > Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp:231 > > + eventListeners->putDirect(exec->globalData(), Identifier(exec, "node"), toJS(exec, globalObject, listenersArray[i].node)); > > Do we really want to return event listeners for ancestors?
On a second thought, I'd let the caller do the work of traversing the ancestry -- this will make the interface simpler.
Andrey Kosyakov
Comment 9
2012-03-20 08:39:12 PDT
Created
attachment 132833
[details]
Patch
Build Bot
Comment 10
2012-03-20 09:08:52 PDT
Comment on
attachment 132833
[details]
Patch
Attachment 132833
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/12001335
Yury Semikhatsky
Comment 11
2012-03-20 09:32:41 PDT
> > > Source/WebCore/inspector/InjectedScriptHost.h:95 > > > + void queryEventListenersImpl(Node*, Vector<EventListenerInfo>& listenersArray); > > > > Why is this Impl suffix? > > Just for consistency with inspectImpl(). I'm not particularly attached to it, though, so will gladly drop. >
Can we remove it from inspectImpl instead. Other methods seem not to use such suffix.
Pavel Feldman
Comment 12
2012-03-20 09:59:33 PDT
(In reply to
comment #11
)
> > > > Source/WebCore/inspector/InjectedScriptHost.h:95 > > > > + void queryEventListenersImpl(Node*, Vector<EventListenerInfo>& listenersArray); > > > > > > Why is this Impl suffix? > > > > Just for consistency with inspectImpl(). I'm not particularly attached to it, though, so will gladly drop. > > > Can we remove it from inspectImpl instead. Other methods seem not to use such suffix.
If we drop Impl suffix, there will be no way to tell whether InjectedScriptHost::inspect is custom or not. We used this pattern for all the base implementations of custom members. I think it is useful.
Pavel Feldman
Comment 13
2012-03-20 17:15:19 PDT
Comment on
attachment 132833
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=132833&action=review
> Source/WebCore/inspector/InjectedScriptSource.js:580 > + "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "queryEventListeners"
I'd call it getEventListeners, there is no query per se.
> Source/WebCore/inspector/InjectedScriptSource.js:690 > + return InjectedScriptHost.queryEventListeners(node);
I'd add a request parameter determining whether caller is interested in self node's listeners or hierarchy ones as well.
Andrey Kosyakov
Comment 14
2012-03-21 06:22:34 PDT
Committed
r111529
: <
http://trac.webkit.org/changeset/111529
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug