Web Inspector: capture async stack trace when workers/main context posts a message
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 22:12:40 +0000 (22:12 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Aug 2017 22:12:40 +0000 (22:12 +0000)
commit3a2fca169ad31e50bc9bc78c1ce19e85063996b2
treeee592b94f97b891b3d764fc34848c7a0bdd35c16
parent0390957e622a167c20273db9ed3c4a7b7f3d5d34
Web Inspector: capture async stack trace when workers/main context posts a message
https://bugs.webkit.org/show_bug.cgi?id=167084
<rdar://problem/30033673>

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/agents/InspectorDebuggerAgent.h:
Add `PostMessage` async call type.

Source/WebCore:

Add instrumentation to DOMWindow to support showing asynchronous
stack traces when the debugger pauses in a MessageEvent handler.

Test: inspector/debugger/async-stack-trace.html

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didPostMessageImpl):
(WebCore::InspectorInstrumentation::didFailPostMessageImpl):
(WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
(WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):

* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didPostMessage):
(WebCore::InspectorInstrumentation::didFailPostMessage):
(WebCore::InspectorInstrumentation::willDispatchPostMessage):
(WebCore::InspectorInstrumentation::didDispatchPostMessage):

* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
(WebCore::PageDebuggerAgent::didPostMessage):
(WebCore::PageDebuggerAgent::didFailPostMessage):
(WebCore::PageDebuggerAgent::willDispatchPostMessage):
(WebCore::PageDebuggerAgent::didDispatchPostMessage):
* inspector/PageDebuggerAgent.h:

* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
(WebCore::DOMWindow::postMessageTimerFired):

LayoutTests:

Add a test to check for asynchronous stack trace data when the debugger
pauses inside a MessageEvent handler.

* inspector/debugger/async-stack-trace-expected.txt:
* inspector/debugger/async-stack-trace.html:
* inspector/debugger/resources/postMessage-echo.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/debugger/async-stack-trace-expected.txt
LayoutTests/inspector/debugger/async-stack-trace.html
LayoutTests/inspector/debugger/resources/postMessage-echo.html [new file with mode: 0644]
LayoutTests/inspector/dom-debugger/dom-breakpoints.html
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/PageDebuggerAgent.cpp
Source/WebCore/inspector/PageDebuggerAgent.h
Source/WebCore/page/DOMWindow.cpp