This is similar to the Console's `getEventListeners` or `DOM.getEventListenersForNode`, except that it returns true/false.
<rdar://problem/46800005>
Created attachment 358566 [details] Patch
Created attachment 358849 [details] Patch Throw an error when called outside of a test
Comment on attachment 358849 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=358849&action=review r=me > LayoutTests/inspector/audit/run-dom.html:13 > + function evaluateStringForTest(func, target, args) { > + return `DOM.${func}(document.querySelector("#${target}")${args ? ", " + JSON.stringify(args) : ""})`; > + } This kind of code generation makes the test compact but hurts readability and comprehension. If this test ever fails someone has to wade through this to figure out whats going on, when instead there could have been a straightforward test with a little duplication but much clearer execution. You don't have to change the test, but this is something to consider in the future. > LayoutTests/inspector/audit/run-dom.html:53 > + let functions = new Map; > + for (let test of tests) > + functions.set(test.func, test); So this only performs the last `hasEventListeners` test. > Source/WebCore/inspector/InspectorAuditDOMUtilities.cpp:38 > +#define ERROR_IF_NO_ACTIVE_AUDIT() if (!m_auditAgent.hasActiveAudit()) return Exception { NotAllowedError, "Unable to run outside of an Inspector Audit"_s }; Style: Make this multiple lines to improve readability.
Comment on attachment 358849 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=358849&action=review >> LayoutTests/inspector/audit/run-dom.html:53 >> + functions.set(test.func, test); > > So this only performs the last `hasEventListeners` test. The point of this isn't really to test every case from above, more-so to just check that calling the function at all outside of a test will throw an error. The arguments are irrelevant.
Created attachment 359145 [details] Patch
Created attachment 359146 [details] Patch AUDIT => WebInspectorAudit
Comment on attachment 359146 [details] Patch Attachment 359146 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: https://webkit-queues.webkit.org/results/10756832 New failing tests: imported/w3c/web-platform-tests/webrtc/simplecall-no-ssrcs.https.html
Created attachment 359150 [details] Archive of layout-test-results from ews121 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews121 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Comment on attachment 359146 [details] Patch Clearing flags on attachment: 359146 Committed r239987: <https://trac.webkit.org/changeset/239987>
All reviewed patches have been landed. Closing bug.