Diff
Modified: trunk/LayoutTests/ChangeLog (242939 => 242940)
--- trunk/LayoutTests/ChangeLog 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/LayoutTests/ChangeLog 2019-03-14 09:46:01 UTC (rev 242940)
@@ -1,5 +1,15 @@
2019-03-14 Devin Rousso <[email protected]>
+ Web Inspector: Console: getEventListeners should work for any EventTarget
+ https://bugs.webkit.org/show_bug.cgi?id=195713
+
+ Reviewed by Joseph Pecoraro.
+
+ * inspector/console/command-line-api-getEventListeners.html:
+ * inspector/console/command-line-api-getEventListeners-expected.txt:
+
+2019-03-14 Devin Rousso <[email protected]>
+
Web Inspector: Styles: `::-webkit-scrollbar*` rules aren't shown
https://bugs.webkit.org/show_bug.cgi?id=195123
<rdar://problem/48450148>
Modified: trunk/LayoutTests/inspector/console/command-line-api-getEventListeners-expected.txt (242939 => 242940)
--- trunk/LayoutTests/inspector/console/command-line-api-getEventListeners-expected.txt 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/LayoutTests/inspector/console/command-line-api-getEventListeners-expected.txt 2019-03-14 09:46:01 UTC (rev 242940)
@@ -2,15 +2,38 @@
== Running test suite: Console.CommandLineAPI.getEventListeners
+-- Running test case: Console.CommandLineAPI.getEventListeners.NoArguments
+TypeError: Argument 1 ('target') to CommandLineAPIHost.getEventListeners must be an instance of EventTarget
+
-- Running test case: Console.CommandLineAPI.getEventListeners.Undefined
-{}
+TypeError: Argument 1 ('target') to CommandLineAPIHost.getEventListeners must be an instance of EventTarget
-- Running test case: Console.CommandLineAPI.getEventListeners.Null
-{}
+TypeError: Argument 1 ('target') to CommandLineAPIHost.getEventListeners must be an instance of EventTarget
-- Running test case: Console.CommandLineAPI.getEventListeners.String
-TypeError: Argument 1 ('node') to CommandLineAPIHost.getEventListeners must be an instance of Node
+TypeError: Argument 1 ('target') to CommandLineAPIHost.getEventListeners must be an instance of EventTarget
+-- Running test case: Console.CommandLineAPI.getEventListeners.window
+{
+ "error": [
+ {
+ "listener": "<function bound >",
+ "once": false,
+ "passive": false,
+ "useCapture": false
+ }
+ ],
+ "load": [
+ {
+ "listener": "<function onload>",
+ "once": false,
+ "passive": false,
+ "useCapture": false
+ }
+ ]
+}
+
-- Running test case: Console.CommandLineAPI.getEventListeners.NodeNoListeners
{}
Modified: trunk/LayoutTests/inspector/console/command-line-api-getEventListeners.html (242939 => 242940)
--- trunk/LayoutTests/inspector/console/command-line-api-getEventListeners.html 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/LayoutTests/inspector/console/command-line-api-getEventListeners.html 2019-03-14 09:46:01 UTC (rev 242940)
@@ -43,6 +43,11 @@
}
addTestCase({
+ name: "Console.CommandLineAPI.getEventListeners.NoArguments",
+ _expression_: ``,
+ });
+
+ addTestCase({
name: "Console.CommandLineAPI.getEventListeners.Undefined",
_expression_: `undefined`,
});
@@ -58,6 +63,11 @@
});
addTestCase({
+ name: "Console.CommandLineAPI.getEventListeners.window",
+ _expression_: `window`,
+ });
+
+ addTestCase({
name: "Console.CommandLineAPI.getEventListeners.NodeNoListeners",
_expression_: `document.createElement("p")`,
});
Modified: trunk/Source/WebCore/ChangeLog (242939 => 242940)
--- trunk/Source/WebCore/ChangeLog 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/ChangeLog 2019-03-14 09:46:01 UTC (rev 242940)
@@ -1,5 +1,34 @@
2019-03-14 Devin Rousso <[email protected]>
+ Web Inspector: Console: getEventListeners should work for any EventTarget
+ https://bugs.webkit.org/show_bug.cgi?id=195713
+
+ Reviewed by Joseph Pecoraro.
+
+ Test: inspector/console/command-line-api-getEventListeners.html
+
+ * dom/EventTarget.h:
+ * dom/EventTarget.cpp:
+ (WebCore::EventTarget::eventTypes): Added.
+
+ * inspector/CommandLineAPIHost.idl:
+ * inspector/CommandLineAPIHost.h:
+ (WebCore::CommandLineAPIHost::init):
+ * inspector/CommandLineAPIHost.cpp:
+ (WebCore::CommandLineAPIHost::disconnect):
+ (WebCore::CommandLineAPIHost::getEventListeners):
+ (WebCore::listenerEntriesFromListenerInfo): Deleted.
+
+ * inspector/CommandLineAPIModuleSource.js:
+ (CommandLineAPIImpl.prototype.getEventListeners):
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ * inspector/WorkerInspectorController.cpp:
+ (WebCore::WorkerInspectorController::WorkerInspectorController):
+
+2019-03-14 Devin Rousso <[email protected]>
+
Web Inspector: Styles: `::-webkit-scrollbar*` rules aren't shown
https://bugs.webkit.org/show_bug.cgi?id=195123
<rdar://problem/48450148>
Modified: trunk/Source/WebCore/dom/EventTarget.cpp (242939 => 242940)
--- trunk/Source/WebCore/dom/EventTarget.cpp 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/dom/EventTarget.cpp 2019-03-14 09:46:01 UTC (rev 242940)
@@ -319,6 +319,13 @@
InspectorInstrumentation::didDispatchEvent(willDispatchEventCookie);
}
+Vector<AtomicString> EventTarget::eventTypes()
+{
+ if (auto* data = ""
+ return data->eventListenerMap.eventTypes();
+ return { };
+}
+
const EventListenerVector& EventTarget::eventListeners(const AtomicString& eventType)
{
auto* data = ""
Modified: trunk/Source/WebCore/dom/EventTarget.h (242939 => 242940)
--- trunk/Source/WebCore/dom/EventTarget.h 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/dom/EventTarget.h 2019-03-14 09:46:01 UTC (rev 242940)
@@ -101,6 +101,8 @@
bool hasEventListeners(const AtomicString& eventType) const;
bool hasCapturingEventListeners(const AtomicString& eventType);
bool hasActiveEventListeners(const AtomicString& eventType) const;
+
+ Vector<AtomicString> eventTypes();
const EventListenerVector& eventListeners(const AtomicString& eventType);
enum class EventInvokePhase { Capturing, Bubbling };
Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp (242939 => 242940)
--- trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.cpp 2019-03-14 09:46:01 UTC (rev 242940)
@@ -33,7 +33,7 @@
#include "Database.h"
#include "Document.h"
-#include "InspectorDOMAgent.h"
+#include "EventTarget.h"
#include "InspectorDOMStorageAgent.h"
#include "InspectorDatabaseAgent.h"
#include "JSCommandLineAPIHost.h"
@@ -71,7 +71,6 @@
{
m_inspectorAgent = nullptr;
m_consoleAgent = nullptr;
- m_domAgent = nullptr;
m_domStorageAgent = nullptr;
m_databaseAgent = nullptr;
}
@@ -89,51 +88,38 @@
m_inspectorAgent->inspect(WTFMove(remoteObject), WTFMove(hintsObject));
}
-static Vector<CommandLineAPIHost::ListenerEntry> listenerEntriesFromListenerInfo(ExecState& state, Document& document, const EventListenerInfo& listenerInfo)
+CommandLineAPIHost::EventListenersRecord CommandLineAPIHost::getEventListeners(ExecState& state, EventTarget& target)
{
- VM& vm = state.vm();
+ auto* scriptExecutionContext = target.scriptExecutionContext();
+ if (!scriptExecutionContext)
+ return { };
- Vector<CommandLineAPIHost::ListenerEntry> entries;
- for (auto& eventListener : listenerInfo.eventListenerVector) {
- if (!is<JSEventListener>(eventListener->callback())) {
- ASSERT_NOT_REACHED();
- continue;
- }
+ EventListenersRecord result;
- auto& jsListener = downcast<JSEventListener>(eventListener->callback());
+ VM& vm = state.vm();
- // Hide listeners from other contexts.
- if (&jsListener.isolatedWorld() != ¤tWorld(state))
- continue;
+ for (auto& eventType : target.eventTypes()) {
+ Vector<CommandLineAPIHost::ListenerEntry> entries;
- auto function = jsListener.jsFunction(document);
- if (!function)
- continue;
+ for (auto& eventListener : target.eventListeners(eventType)) {
+ if (!is<JSEventListener>(eventListener->callback()))
+ continue;
- entries.append({ JSC::Strong<JSC::JSObject>(vm, function), eventListener->useCapture(), eventListener->isPassive(), eventListener->isOnce() });
- }
+ auto& jsListener = downcast<JSEventListener>(eventListener->callback());
- return entries;
-}
+ // Hide listeners from other contexts.
+ if (&jsListener.isolatedWorld() != ¤tWorld(state))
+ continue;
-auto CommandLineAPIHost::getEventListeners(JSC::ExecState& state, Node* node) -> EventListenersRecord
-{
- if (!m_domAgent)
- return { };
+ auto* function = jsListener.jsFunction(*scriptExecutionContext);
+ if (!function)
+ continue;
- if (!node)
- return { };
+ entries.append({ Strong<JSObject>(vm, function), eventListener->useCapture(), eventListener->isPassive(), eventListener->isOnce() });
+ }
- Vector<EventListenerInfo> listenerInfoArray;
- m_domAgent->getEventListeners(node, listenerInfoArray, false);
-
- EventListenersRecord result;
-
- for (auto& listenerInfo : listenerInfoArray) {
- auto entries = listenerEntriesFromListenerInfo(state, node->document(), listenerInfo);
- if (entries.isEmpty())
- continue;
- result.append({ listenerInfo.eventType, WTFMove(entries) });
+ if (!entries.isEmpty())
+ result.append({ eventType, WTFMove(entries) });
}
return result;
Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.h (242939 => 242940)
--- trunk/Source/WebCore/inspector/CommandLineAPIHost.h 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.h 2019-03-14 09:46:01 UTC (rev 242940)
@@ -46,11 +46,10 @@
namespace WebCore {
class Database;
-class InspectorDOMAgent;
+class EventTarget;
class InspectorDOMStorageAgent;
class InspectorDatabaseAgent;
class JSDOMGlobalObject;
-class Node;
class Storage;
struct EventListenerInfo;
@@ -62,7 +61,6 @@
void init(Inspector::InspectorAgent* inspectorAgent
, Inspector::InspectorConsoleAgent* consoleAgent
- , InspectorDOMAgent* domAgent
, InspectorDOMStorageAgent* domStorageAgent
, InspectorDatabaseAgent* databaseAgent
)
@@ -69,7 +67,6 @@
{
m_inspectorAgent = inspectorAgent;
m_consoleAgent = consoleAgent;
- m_domAgent = domAgent;
m_domStorageAgent = domStorageAgent;
m_databaseAgent = databaseAgent;
}
@@ -97,7 +94,7 @@
};
using EventListenersRecord = Vector<WTF::KeyValuePair<String, Vector<ListenerEntry>>>;
- EventListenersRecord getEventListeners(JSC::ExecState&, Node*);
+ EventListenersRecord getEventListeners(JSC::ExecState&, EventTarget&);
String databaseId(Database&);
String storageId(Storage&);
@@ -110,7 +107,6 @@
Inspector::InspectorAgent* m_inspectorAgent { nullptr };
Inspector::InspectorConsoleAgent* m_consoleAgent { nullptr };
- InspectorDOMAgent* m_domAgent { nullptr };
InspectorDOMStorageAgent* m_domStorageAgent { nullptr };
InspectorDatabaseAgent* m_databaseAgent { nullptr };
Modified: trunk/Source/WebCore/inspector/CommandLineAPIHost.idl (242939 => 242940)
--- trunk/Source/WebCore/inspector/CommandLineAPIHost.idl 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/inspector/CommandLineAPIHost.idl 2019-03-14 09:46:01 UTC (rev 242940)
@@ -40,7 +40,7 @@
[CallWith=ExecState] void inspect(any objectToInspect, any hints);
[CallWith=ExecState] any inspectedObject();
- [CallWith=ExecState] record<DOMString, sequence<ListenerEntry>> getEventListeners(Node? node);
+ [CallWith=ExecState] record<DOMString, sequence<ListenerEntry>> getEventListeners(EventTarget target);
DOMString databaseId(Database database);
DOMString storageId(Storage storage);
Modified: trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js (242939 => 242940)
--- trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js 2019-03-14 09:46:01 UTC (rev 242940)
@@ -272,12 +272,9 @@
CommandLineAPIHost.clearConsoleMessages();
},
- /**
- * @param {Node} node
- */
- getEventListeners: function(node)
+ getEventListeners: function(target)
{
- return CommandLineAPIHost.getEventListeners(node);
+ return CommandLineAPIHost.getEventListeners(target);
},
_inspectedObject: function()
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (242939 => 242940)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2019-03-14 09:46:01 UTC (rev 242940)
@@ -148,7 +148,7 @@
ASSERT(m_injectedScriptManager->commandLineAPIHost());
if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
- commandLineAPIHost->init(m_inspectorAgent, consoleAgent, m_domAgent, domStorageAgent, databaseAgent);
+ commandLineAPIHost->init(m_inspectorAgent, consoleAgent, domStorageAgent, databaseAgent);
}
InspectorController::~InspectorController()
Modified: trunk/Source/WebCore/inspector/WorkerInspectorController.cpp (242939 => 242940)
--- trunk/Source/WebCore/inspector/WorkerInspectorController.cpp 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebCore/inspector/WorkerInspectorController.cpp 2019-03-14 09:46:01 UTC (rev 242940)
@@ -80,7 +80,7 @@
m_agents.append(WTFMove(heapAgent));
if (CommandLineAPIHost* commandLineAPIHost = m_injectedScriptManager->commandLineAPIHost())
- commandLineAPIHost->init(nullptr, m_instrumentingAgents->webConsoleAgent(), nullptr, nullptr, nullptr);
+ commandLineAPIHost->init(nullptr, m_instrumentingAgents->webConsoleAgent(), nullptr, nullptr);
}
WorkerInspectorController::~WorkerInspectorController()
Modified: trunk/Source/WebInspectorUI/ChangeLog (242939 => 242940)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-03-14 09:46:01 UTC (rev 242940)
@@ -1,5 +1,14 @@
2019-03-14 Devin Rousso <[email protected]>
+ Web Inspector: Console: getEventListeners should work for any EventTarget
+ https://bugs.webkit.org/show_bug.cgi?id=195713
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Models/NativeFunctionParameters.js:
+
+2019-03-14 Devin Rousso <[email protected]>
+
Web Inspector: Styles: `::-webkit-scrollbar*` rules aren't shown
https://bugs.webkit.org/show_bug.cgi?id=195123
<rdar://problem/48450148>
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js (242939 => 242940)
--- trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js 2019-03-14 09:33:24 UTC (rev 242939)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js 2019-03-14 09:46:01 UTC (rev 242940)
@@ -695,7 +695,7 @@
CommandLineAPIHost: {
copyText: "text",
databaseId: "database",
- getEventListeners: "node",
+ getEventListeners: "target",
inspect: "objectId, hints",
storageId: "storage",
__proto__: null,