Changeset 243161 in webkit
- Timestamp:
- Mar 19, 2019, 12:31:31 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 14 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/inspector/InjectedScript.cpp (modified) (1 diff)
-
JavaScriptCore/inspector/InjectedScript.h (modified) (1 diff)
-
JavaScriptCore/inspector/InjectedScriptManager.cpp (modified) (1 diff)
-
JavaScriptCore/inspector/InjectedScriptManager.h (modified) (1 diff)
-
JavaScriptCore/inspector/InjectedScriptSource.js (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/inspector/CommandLineAPIModuleSource.js (modified) (1 diff)
-
WebCore/inspector/InspectorInstrumentation.cpp (modified) (2 diffs)
-
WebCore/inspector/InspectorInstrumentation.h (modified) (3 diffs)
-
WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp (modified) (4 diffs)
-
WebCore/inspector/agents/InspectorDOMDebuggerAgent.h (modified) (3 diffs)
-
WebInspectorUI/ChangeLog (modified) (1 diff)
-
WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r243160 r243161 1 2019-03-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Provide $event in the console when paused on an event listener 4 https://bugs.webkit.org/show_bug.cgi?id=188672 5 6 Reviewed by Timothy Hatcher. 7 8 * inspector/InjectedScript.h: 9 * inspector/InjectedScript.cpp: 10 (Inspector::InjectedScript::setEventValue): Added. 11 (Inspector::InjectedScript::clearEventValue): Added. 12 13 * inspector/InjectedScriptManager.h: 14 * inspector/InjectedScriptManager.cpp: 15 (Inspector::InjectedScriptManager::clearEventValue): Added. 16 17 * inspector/InjectedScriptSource.js: 18 (WI.InjectedScript.prototype.setEventValue): Added. 19 (WI.InjectedScript.prototype.clearEventValue): Added. 20 (BasicCommandLineAPI): 21 1 22 2019-03-19 Devin Rousso <drousso@apple.com> 2 23 -
trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp
r239976 r243161 348 348 } 349 349 350 void InjectedScript::setEventValue(JSC::JSValue value) 351 { 352 ASSERT(!hasNoValue()); 353 Deprecated::ScriptFunctionCall function(injectedScriptObject(), "setEventValue"_s, inspectorEnvironment()->functionCallHandler()); 354 function.appendArgument(value); 355 makeCall(function); 356 } 357 358 void InjectedScript::clearEventValue() 359 { 360 ASSERT(!hasNoValue()); 361 Deprecated::ScriptFunctionCall function(injectedScriptObject(), "clearEventValue"_s, inspectorEnvironment()->functionCallHandler()); 362 makeCall(function); 363 } 364 350 365 void InjectedScript::setExceptionValue(JSC::JSValue value) 351 366 { -
trunk/Source/JavaScriptCore/inspector/InjectedScript.h
r239976 r243161 81 81 RefPtr<Protocol::Runtime::ObjectPreview> previewValue(JSC::JSValue) const; 82 82 83 void setEventValue(JSC::JSValue); 84 void clearEventValue(); 85 83 86 void setExceptionValue(JSC::JSValue); 84 87 void clearExceptionValue(); -
trunk/Source/JavaScriptCore/inspector/InjectedScriptManager.cpp
r233122 r243161 123 123 } 124 124 125 void InjectedScriptManager::clearEventValue() 126 { 127 for (auto& injectedScript : m_idToInjectedScript.values()) 128 injectedScript.clearEventValue(); 129 } 130 125 131 void InjectedScriptManager::clearExceptionValue() 126 132 { -
trunk/Source/JavaScriptCore/inspector/InjectedScriptManager.h
r225263 r243161 61 61 InjectedScript injectedScriptForObjectId(const String& objectId); 62 62 void releaseObjectGroup(const String& objectGroup); 63 void clearEventValue(); 63 64 void clearExceptionValue(); 64 65 -
trunk/Source/JavaScriptCore/inspector/InjectedScriptSource.js
r239976 r243161 354 354 } 355 355 356 setEventValue(value) 357 { 358 this._eventValue = value; 359 } 360 361 clearEventValue() 362 { 363 delete this._eventValue; 364 } 365 356 366 setExceptionValue(value) 357 367 { … … 1447 1457 this.$exception = injectedScript._exceptionValue; 1448 1458 1459 if ("_eventValue" in injectedScript) 1460 this.$event = injectedScript._eventValue; 1461 else if ("$event" in this) 1462 delete this.$event; 1463 1449 1464 // $1-$99 1450 1465 for (let i = 1; i <= injectedScript._savedResults.length; ++i) -
trunk/Source/WebCore/ChangeLog
r243160 r243161 1 2019-03-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Provide $event in the console when paused on an event listener 4 https://bugs.webkit.org/show_bug.cgi?id=188672 5 6 Reviewed by Timothy Hatcher. 7 8 Implement similiar methods/logic as to the way that `$exception` is set. 9 10 * inspector/CommandLineAPIModuleSource.js: 11 (CommandLineAPI): 12 13 * inspector/InspectorInstrumentation.h: 14 (WebCore::InspectorInstrumentation::willHandleEvent): 15 * inspector/InspectorInstrumentation.cpp: 16 (WebCore::InspectorInstrumentation::willHandleEventImpl): 17 (WebCore::InspectorInstrumentation::didHandleEventImpl): 18 19 * inspector/agents/InspectorDOMDebuggerAgent.cpp: 20 * inspector/agents/InspectorDOMDebuggerAgent.h: 21 (WebCore::InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent): 22 (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): 23 (WebCore::InspectorDOMDebuggerAgent::didHandleEvent): Added. 24 1 25 2019-03-19 Devin Rousso <drousso@apple.com> 2 26 -
trunk/Source/WebCore/inspector/CommandLineAPIModuleSource.js
r242992 r243161 48 48 { 49 49 this.$_ = injectedScript._lastResult; 50 this.$event = injectedScript._eventValue; 50 51 this.$exception = injectedScript._exceptionValue; 51 52 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r240549 r243161 397 397 } 398 398 399 void InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents& instrumentingAgents, constEvent& event, const RegisteredEventListener& listener)399 void InspectorInstrumentation::willHandleEventImpl(InstrumentingAgents& instrumentingAgents, Event& event, const RegisteredEventListener& listener) 400 400 { 401 401 if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent()) … … 410 410 if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents.inspectorDebuggerAgent()) 411 411 debuggerAgent->didDispatchAsyncCall(); 412 413 if (InspectorDOMDebuggerAgent* domDebuggerAgent = instrumentingAgents.inspectorDOMDebuggerAgent()) 414 domDebuggerAgent->didHandleEvent(); 412 415 } 413 416 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r243119 r243161 154 154 static InspectorInstrumentationCookie willDispatchEvent(Document&, const Event&, bool hasEventListeners); 155 155 static void didDispatchEvent(const InspectorInstrumentationCookie&); 156 static void willHandleEvent(ScriptExecutionContext&, constEvent&, const RegisteredEventListener&);156 static void willHandleEvent(ScriptExecutionContext&, Event&, const RegisteredEventListener&); 157 157 static void didHandleEvent(ScriptExecutionContext&); 158 158 static InspectorInstrumentationCookie willDispatchEventOnWindow(Frame*, const Event&, DOMWindow&); … … 346 346 static bool isEventListenerDisabledImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture); 347 347 static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners); 348 static void willHandleEventImpl(InstrumentingAgents&, constEvent&, const RegisteredEventListener&);348 static void willHandleEventImpl(InstrumentingAgents&, Event&, const RegisteredEventListener&); 349 349 static void didHandleEventImpl(InstrumentingAgents&); 350 350 static void didDispatchEventImpl(const InspectorInstrumentationCookie&); … … 801 801 } 802 802 803 inline void InspectorInstrumentation::willHandleEvent(ScriptExecutionContext& context, constEvent& event, const RegisteredEventListener& listener)803 inline void InspectorInstrumentation::willHandleEvent(ScriptExecutionContext& context, Event& event, const RegisteredEventListener& listener) 804 804 { 805 805 FAST_RETURN_IF_NO_FRONTENDS(void()); -
trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp
r242588 r243161 38 38 #include "InspectorDOMAgent.h" 39 39 #include "InstrumentingAgents.h" 40 #include "JSEvent.h" 40 41 #include "RegisteredEventListener.h" 41 42 #include <JavaScriptCore/ContentSearchUtilities.h> 43 #include <JavaScriptCore/InjectedScript.h> 44 #include <JavaScriptCore/InjectedScriptManager.h> 42 45 #include <JavaScriptCore/InspectorFrontendDispatchers.h> 43 46 #include <JavaScriptCore/RegularExpression.h> … … 66 69 : InspectorAgentBase("DOMDebugger"_s, context) 67 70 , m_backendDispatcher(Inspector::DOMDebuggerBackendDispatcher::create(context.backendDispatcher, this)) 71 , m_injectedScriptManager(context.injectedScriptManager) 68 72 , m_domAgent(domAgent) 69 73 , m_debuggerAgent(debuggerAgent) … … 366 370 } 367 371 368 void InspectorDOMDebuggerAgent::willHandleEvent(const Event& event, const RegisteredEventListener& registeredEventListener) 369 { 370 if (!m_debuggerAgent->breakpointsActive()) 371 return; 372 void InspectorDOMDebuggerAgent::willHandleEvent(Event& event, const RegisteredEventListener& registeredEventListener) 373 { 374 if (!m_debuggerAgent->breakpointsActive()) 375 return; 376 377 auto state = event.target()->scriptExecutionContext()->execState(); 378 auto injectedScript = m_injectedScriptManager.injectedScriptFor(state); 379 ASSERT(!injectedScript.hasNoValue()); 380 { 381 JSC::JSLockHolder lock(state); 382 383 injectedScript.setEventValue(toJS(state, deprecatedGlobalObjectForPrototype(state), event)); 384 } 372 385 373 386 bool shouldPause = m_debuggerAgent->pauseOnNextStatementEnabled() || m_eventBreakpoints.contains(std::make_pair(Inspector::Protocol::DOMDebugger::EventBreakpointType::Listener, event.type())); … … 388 401 389 402 m_debuggerAgent->schedulePauseOnNextStatement(Inspector::DebuggerFrontendDispatcher::Reason::EventListener, WTFMove(eventData)); 403 } 404 405 void InspectorDOMDebuggerAgent::didHandleEvent() 406 { 407 m_injectedScriptManager.clearEventValue(); 390 408 } 391 409 -
trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h
r239703 r243161 39 39 #include <wtf/text/WTFString.h> 40 40 41 namespace Inspector { 42 class InjectedScriptManager; 43 } 44 41 45 namespace WebCore { 42 46 … … 75 79 void willFetch(const String& url); 76 80 void frameDocumentUpdated(Frame&); 77 void willHandleEvent(const Event&, const RegisteredEventListener&); 81 void willHandleEvent(Event&, const RegisteredEventListener&); 82 void didHandleEvent(); 78 83 void willFireTimer(bool oneShot); 79 84 void willFireAnimationFrame(); … … 99 104 100 105 RefPtr<Inspector::DOMDebuggerBackendDispatcher> m_backendDispatcher; 106 Inspector::InjectedScriptManager& m_injectedScriptManager; 101 107 InspectorDOMAgent* m_domAgent { nullptr }; 102 108 Inspector::InspectorDebuggerAgent* m_debuggerAgent { nullptr }; -
trunk/Source/WebInspectorUI/ChangeLog
r243152 r243161 1 2019-03-19 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Provide $event in the console when paused on an event listener 4 https://bugs.webkit.org/show_bug.cgi?id=188672 5 6 Reviewed by Timothy Hatcher. 7 8 * UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js: 9 (WI.JavaScriptRuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.receivedPropertyNames): 10 1 11 2019-03-19 Devin Rousso <drousso@apple.com> 2 12 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js
r242992 r243161 222 222 if (WI.debuggerManager.paused) { 223 223 let targetData = WI.debuggerManager.dataForTarget(WI.runtimeManager.activeExecutionContext.target); 224 if (targetData.pauseReason === WI.DebuggerManager.PauseReason.Exception) 224 if (targetData.pauseReason === WI.DebuggerManager.PauseReason.EventListener) 225 commandLineAPI.push("$event"); 226 else if (targetData.pauseReason === WI.DebuggerManager.PauseReason.Exception) 225 227 commandLineAPI.push("$exception"); 226 228 }
Note:
See TracChangeset
for help on using the changeset viewer.