WebKit Bugzilla
Attachment 338813 Details for
Bug 181580
: Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-181580-20180425155945.patch (text/plain), 48.03 KB, created by
Matt Baker
on 2018-04-25 15:59:46 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Matt Baker
Created:
2018-04-25 15:59:46 PDT
Size:
48.03 KB
patch
obsolete
>Subversion Revision: 231008 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ae2c3bb4251c27c2e60f5d70f94edd9353eb662d..267c67a6b56695c7aef2a7c236ff8e6b271a2696 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,34 @@ >+2018-04-25 Matt Baker <mattbaker@apple.com> >+ >+ Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener >+ https://bugs.webkit.org/show_bug.cgi?id=181580 >+ <rdar://problem/36461309> >+ >+ Reviewed by Brian Burg and Timothy Hatcher. >+ >+ EventTarget should pass newly added EventListeners to InspectorInstrumentation, >+ instead of PageDebuggerAgent assuming that the last item in the EventListenerVector >+ was the most recently added listener. This assumption is not always correct, when >+ adding an attribute event listener replaces an existing listener. >+ >+ Tests: inspector/debugger/async-stack-trace-basic.html >+ inspector/debugger/async-stack-trace-event-listener.html >+ inspector/debugger/async-stack-trace-truncate.html >+ >+ * dom/EventTarget.cpp: >+ (WebCore::EventTarget::addEventListener): >+ (WebCore::EventTarget::setAttributeEventListener): >+ >+ * inspector/InspectorInstrumentation.cpp: >+ (WebCore::InspectorInstrumentation::didAddEventListenerImpl): >+ >+ * inspector/InspectorInstrumentation.h: >+ (WebCore::InspectorInstrumentation::didAddEventListener): >+ >+ * inspector/agents/page/PageDebuggerAgent.cpp: >+ (WebCore::PageDebuggerAgent::didAddEventListener): >+ * inspector/agents/page/PageDebuggerAgent.h: >+ > 2018-04-25 Brent Fulgham <bfulgham@apple.com> > > Don't Block First Party Cookies on Redirects >diff --git a/Source/WebCore/dom/EventTarget.cpp b/Source/WebCore/dom/EventTarget.cpp >index 2f60c319298ed25e2ce893e67670d97c5207e765..c9cccda90a7098eafaecc5786bcfde922427672b 100644 >--- a/Source/WebCore/dom/EventTarget.cpp >+++ b/Source/WebCore/dom/EventTarget.cpp >@@ -75,12 +75,13 @@ bool EventTarget::addEventListener(const AtomicString& eventType, Ref<EventListe > } > > bool listenerCreatedFromScript = listener->type() == EventListener::JSEventListenerType && !listener->wasCreatedFromMarkup(); >+ auto* listenerPointer = listener.ptr(); > > if (!ensureEventTargetData().eventListenerMap.add(eventType, WTFMove(listener), { options.capture, passive.value_or(false), options.once })) > return false; > > if (listenerCreatedFromScript) >- InspectorInstrumentation::didAddEventListener(*this, eventType); >+ InspectorInstrumentation::didAddEventListener(*this, eventType, *listenerPointer, options.capture); > > return true; > } >@@ -137,7 +138,7 @@ bool EventTarget::setAttributeEventListener(const AtomicString& eventType, RefPt > > eventTargetData()->eventListenerMap.replace(eventType, *existingListener, listener.releaseNonNull(), { }); > >- InspectorInstrumentation::didAddEventListener(*this, eventType); >+ InspectorInstrumentation::didAddEventListener(*this, eventType, *attributeEventListener(eventType, isolatedWorld), false); > > return true; > } >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp >index 3bd4bc0a48fa8b6f75f29a10de457ed0e19689cc..5d3488c9feadf70a00e800e0e394e49d2880a750 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.cpp >+++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp >@@ -313,10 +313,10 @@ void InspectorInstrumentation::didRemoveTimerImpl(InstrumentingAgents& instrumen > timelineAgent->didRemoveTimer(timerId, frameForScriptExecutionContext(context)); > } > >-void InspectorInstrumentation::didAddEventListenerImpl(InstrumentingAgents& instrumentingAgents, EventTarget& target, const AtomicString& eventType) >+void InspectorInstrumentation::didAddEventListenerImpl(InstrumentingAgents& instrumentingAgents, EventTarget& target, const AtomicString& eventType, EventListener& listener, bool capture) > { > if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent()) >- pageDebuggerAgent->didAddEventListener(target, eventType); >+ pageDebuggerAgent->didAddEventListener(target, eventType, listener, capture); > if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent()) > domAgent->didAddEventListener(target); > } >diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h >index 8f93f4537fc2150ea7d80cf4df83a51ee3c186aa..6774fe0b72bb0b9d31d9e059d20055fd4e9f3653 100644 >--- a/Source/WebCore/inspector/InspectorInstrumentation.h >+++ b/Source/WebCore/inspector/InspectorInstrumentation.h >@@ -146,7 +146,7 @@ public: > > static InspectorInstrumentationCookie willCallFunction(ScriptExecutionContext*, const String& scriptName, int scriptLine); > static void didCallFunction(const InspectorInstrumentationCookie&, ScriptExecutionContext*); >- static void didAddEventListener(EventTarget&, const AtomicString& eventType); >+ static void didAddEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); > static void willRemoveEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); > static bool isEventListenerDisabled(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); > static InspectorInstrumentationCookie willDispatchEvent(Document&, const Event&, bool hasEventListeners); >@@ -330,7 +330,7 @@ private: > > static InspectorInstrumentationCookie willCallFunctionImpl(InstrumentingAgents&, const String& scriptName, int scriptLine, ScriptExecutionContext*); > static void didCallFunctionImpl(const InspectorInstrumentationCookie&, ScriptExecutionContext*); >- static void didAddEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType); >+ static void didAddEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture); > static void willRemoveEventListenerImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture); > static bool isEventListenerDisabledImpl(InstrumentingAgents&, EventTarget&, const AtomicString& eventType, EventListener&, bool capture); > static InspectorInstrumentationCookie willDispatchEventImpl(InstrumentingAgents&, Document&, const Event&, bool hasEventListeners); >@@ -683,11 +683,11 @@ inline void InspectorInstrumentation::didRemoveTimer(ScriptExecutionContext& con > didRemoveTimerImpl(*instrumentingAgents, timerId, context); > } > >-inline void InspectorInstrumentation::didAddEventListener(EventTarget& target, const AtomicString& eventType) >+inline void InspectorInstrumentation::didAddEventListener(EventTarget& target, const AtomicString& eventType, EventListener& listener, bool capture) > { > FAST_RETURN_IF_NO_FRONTENDS(void()); > if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(target.scriptExecutionContext())) >- didAddEventListenerImpl(*instrumentingAgents, target, eventType); >+ didAddEventListenerImpl(*instrumentingAgents, target, eventType, listener, capture); > } > > inline void InspectorInstrumentation::willRemoveEventListener(EventTarget& target, const AtomicString& eventType, EventListener& listener, bool capture) >diff --git a/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp b/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp >index 29cdda29ee4c0d4f9cb07a4085d2b1add56b628e..75508e5ebbc0f62b0691d5815d0386e95775202b 100644 >--- a/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp >+++ b/Source/WebCore/inspector/agents/page/PageDebuggerAgent.cpp >@@ -164,14 +164,20 @@ void PageDebuggerAgent::mainFrameNavigated() > setSuppressAllPauses(false); > } > >-void PageDebuggerAgent::didAddEventListener(EventTarget& target, const AtomicString& eventType) >+void PageDebuggerAgent::didAddEventListener(EventTarget& target, const AtomicString& eventType, EventListener& listener, bool capture) > { > if (!breakpointsActive()) > return; > > auto& eventListeners = target.eventListeners(eventType); >- const RefPtr<RegisteredEventListener>& listener = eventListeners.last(); >- if (m_registeredEventListeners.contains(listener.get())) { >+ auto position = eventListeners.findMatching([&](auto& registeredListener) { >+ return ®isteredListener->callback() == &listener && registeredListener->useCapture() == capture; >+ }); >+ if (position == notFound) >+ return; >+ >+ auto& registeredListener = eventListeners.at(position); >+ if (m_registeredEventListeners.contains(registeredListener.get())) { > ASSERT_NOT_REACHED(); > return; > } >@@ -181,9 +187,9 @@ void PageDebuggerAgent::didAddEventListener(EventTarget& target, const AtomicStr > return; > > int identifier = m_nextEventListenerIdentifier++; >- m_registeredEventListeners.set(listener.get(), identifier); >+ m_registeredEventListeners.set(registeredListener.get(), identifier); > >- didScheduleAsyncCall(scriptState, InspectorDebuggerAgent::AsyncCallType::EventListener, identifier, listener->isOnce()); >+ didScheduleAsyncCall(scriptState, InspectorDebuggerAgent::AsyncCallType::EventListener, identifier, registeredListener->isOnce()); > } > > void PageDebuggerAgent::willRemoveEventListener(EventTarget& target, const AtomicString& eventType, EventListener& listener, bool capture) >diff --git a/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h b/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h >index d2b8b89a4afc239177f8a3af86a9d9bdc6a882f0..8943d9ad5cb9b85c9e766da6b4340018b1189388 100644 >--- a/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h >+++ b/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h >@@ -61,7 +61,7 @@ public: > void willFireAnimationFrame(int callbackId); > void didCancelAnimationFrame(int callbackId); > >- void didAddEventListener(EventTarget&, const AtomicString& eventType); >+ void didAddEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); > void willRemoveEventListener(EventTarget&, const AtomicString& eventType, EventListener&, bool capture); > void willHandleEvent(const RegisteredEventListener&); > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a5f264c1b805ecc9b2a02e749839fbeb1d51500e..ce83a03738e74d0976a9bdecff8265090a4ac189 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,49 @@ >+2018-04-25 Matt Baker <mattbaker@apple.com> >+ >+ Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener >+ https://bugs.webkit.org/show_bug.cgi?id=181580 >+ <rdar://problem/36461309> >+ >+ Reviewed by Brian Burg and Timothy Hatcher. >+ >+ Added a new test covering the case where an attribute event listener >+ is replaced after calling addEventListener. >+ >+ Additionally, tests for async stack traces have been split up into multiple >+ files and rewritten to improve clarity and maintainability. >+ >+ * inspector/debugger/async-stack-trace-basic-expected.txt: Added. >+ * inspector/debugger/async-stack-trace-basic.html: Added. >+ Basic tests that check for the existence of an asynchronous stack trace >+ when pausing inside an asynchronous callback function. >+ >+ * inspector/debugger/async-stack-trace-event-listener-expected.txt: Added. >+ * inspector/debugger/async-stack-trace-event-listener.html: Added. >+ >+ * inspector/debugger/async-stack-trace-truncate-expected.txt: Added. >+ * inspector/debugger/async-stack-trace-truncate.html: Added. >+ Test scenarios where the number of call frames in the async stack trace >+ exceeds the maximum depth and is truncated. >+ >+ * inspector/debugger/async-stack-trace-expected.txt: Removed. >+ * inspector/debugger/async-stack-trace.html: Removed. >+ >+ * inspector/debugger/resources/async-stack-trace-test.js: Added. >+ (TestPage.registerInitializer.window.getAsyncStackTrace): >+ (TestPage.registerInitializer.logCallFrame): >+ (TestPage.registerInitializer.window.logAsyncStackTrace): >+ (TestPage.registerInitializer.window.addAsyncStackTraceTestCase): >+ (TestPage.registerInitializer): >+ Utility functions used across tests. >+ >+ * inspector/debugger/resources/postMessage-echo.html: Removed. >+ This was unnecessary. To check that an async stack trace exists when >+ pausing in a postMessage handler, all we need is an iframe that posts a >+ message to its parent as soon as it is created. The iframe is now created >+ in script, in async-stack-trace-basic.html. >+ >+ * platform/mac/TestExpectations: >+ > 2018-04-25 Brent Fulgham <bfulgham@apple.com> > > Don't Block First Party Cookies on Redirects >diff --git a/LayoutTests/inspector/debugger/async-stack-trace-basic-expected.txt b/LayoutTests/inspector/debugger/async-stack-trace-basic-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a3c3a8e21bb1c10d6670d1ec7dd6710e23b24cbc >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-basic-expected.txt >@@ -0,0 +1,83 @@ >+Tests for checking that async stack traces exist when pausing in asynchronous callbacks: requestAnimationFrame, setTimeout, setInterval, and postMessage. >+ >+ >+== Running test suite: AsyncStackTrace.Basic >+-- Running test case: AsyncStackTrace.Basic.RequestAnimationFrame >+PAUSED >+CALL STACK: >+0: [F] handleAnimationFrame >+ASYNC CALL STACK: >+1: --- requestAnimationFrame --- >+2: [F] triggerRequestAnimationFrame >+3: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.Basic.NestedRequestAnimationFrame >+PAUSED >+CALL STACK: >+0: [F] handleAnimationFrame2 >+ASYNC CALL STACK: >+1: --- requestAnimationFrame --- >+2: [F] handleAnimationFrame1 >+3: --- requestAnimationFrame --- >+4: [F] triggerNestedRequestAnimationFrame >+5: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.Basic.SetTimeout >+PAUSED >+CALL STACK: >+0: [F] handleTimeout >+ASYNC CALL STACK: >+1: --- setTimeout --- >+2: [F] triggerSetTimeout >+3: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.Basic.NestedSetTimeout >+PAUSED >+CALL STACK: >+0: [F] handleTimeout2 >+ASYNC CALL STACK: >+1: --- setTimeout --- >+2: [F] handleTimeout1 >+3: --- setTimeout --- >+4: [F] triggerNestedSetTimeout >+5: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.Basic.SetInterval >+PAUSED >+CALL STACK: >+0: [F] handleInterval >+ASYNC CALL STACK: >+1: --- setInterval --- >+2: [F] triggerSetInterval >+3: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.Basic.NestedSetInterval >+PAUSED >+CALL STACK: >+0: [F] handleInterval2 >+ASYNC CALL STACK: >+1: --- setInterval --- >+2: [F] handleInterval1 >+3: --- setInterval --- >+4: [F] triggerNestedSetInterval >+5: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.Basic.NestedSetInterval >+PAUSED >+CALL STACK: >+0: [F] handleInterval2 >+ASYNC CALL STACK: >+1: --- setInterval --- >+2: [F] handleInterval1 >+3: --- setInterval --- >+4: [F] triggerNestedSetInterval >+5: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.Basic.PostMessage >+PAUSED >+CALL STACK: >+0: [F] handleMessage >+ASYNC CALL STACK: >+1: --- postMessage --- >+2: [P] Global Code >+ >diff --git a/LayoutTests/inspector/debugger/async-stack-trace-basic.html b/LayoutTests/inspector/debugger/async-stack-trace-basic.html >new file mode 100644 >index 0000000000000000000000000000000000000000..6e49d767469184fd7e8abc5084a1a7cc4e5ae3c4 >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-basic.html >@@ -0,0 +1,115 @@ >+<!doctype html> >+<html> >+<head> >+<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >+<script src="resources/async-stack-trace-test.js"></script> >+<script> >+ >+function triggerRequestAnimationFrame() { >+ requestAnimationFrame(function handleAnimationFrame() { >+ debugger; >+ }); >+} >+ >+function triggerNestedRequestAnimationFrame() { >+ requestAnimationFrame(function handleAnimationFrame1() { >+ requestAnimationFrame(function handleAnimationFrame2() { >+ debugger; >+ }); >+ }); >+} >+ >+function triggerSetTimeout() { >+ setTimeout(function handleTimeout() { >+ debugger; >+ }); >+} >+ >+function triggerNestedSetTimeout() { >+ setTimeout(function handleTimeout1() { >+ setTimeout(function handleTimeout2() { >+ debugger; >+ }); >+ }); >+} >+ >+function triggerSetInterval() { >+ let timer = setInterval(function handleInterval() { >+ clearInterval(timer); >+ debugger; >+ }); >+} >+ >+function triggerNestedSetInterval() { >+ let outerTimer = setInterval(function handleInterval1() { >+ clearInterval(outerTimer); >+ let innerTimer = setInterval(function handleInterval2() { >+ clearInterval(innerTimer); >+ debugger; >+ }); >+ }); >+} >+ >+function triggerPostMessage() { >+ let frame = document.createElement("iframe"); >+ frame.srcdoc = `<script>window.parent.postMessage(42, "*");<\/script>`; >+ document.body.appendChild(frame); >+ >+ window.addEventListener("message", function handleMessage() { >+ window.removeEventListener("message", handleMessage); >+ debugger; >+ }); >+} >+ >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("AsyncStackTrace.Basic"); >+ >+ addAsyncStackTraceTestCase(suite, { >+ name: "AsyncStackTrace.Basic.RequestAnimationFrame", >+ expression: "triggerRequestAnimationFrame()", >+ }); >+ >+ addAsyncStackTraceTestCase(suite, { >+ name: "AsyncStackTrace.Basic.NestedRequestAnimationFrame", >+ expression: "triggerNestedRequestAnimationFrame()", >+ }); >+ >+ addAsyncStackTraceTestCase(suite, { >+ name: "AsyncStackTrace.Basic.SetTimeout", >+ expression: "triggerSetTimeout()", >+ }); >+ >+ addAsyncStackTraceTestCase(suite, { >+ name: "AsyncStackTrace.Basic.NestedSetTimeout", >+ expression: "triggerNestedSetTimeout()", >+ }); >+ >+ addAsyncStackTraceTestCase(suite, { >+ name: "AsyncStackTrace.Basic.SetInterval", >+ expression: "triggerSetInterval()", >+ }); >+ >+ addAsyncStackTraceTestCase(suite, { >+ name: "AsyncStackTrace.Basic.NestedSetInterval", >+ expression: "triggerNestedSetInterval()", >+ }); >+ >+ addAsyncStackTraceTestCase(suite, { >+ name: "AsyncStackTrace.Basic.NestedSetInterval", >+ expression: "triggerNestedSetInterval()", >+ }); >+ >+ addAsyncStackTraceTestCase(suite, { >+ name: "AsyncStackTrace.Basic.PostMessage", >+ expression: "triggerPostMessage()", >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+<p>Tests for checking that async stack traces exist when pausing in asynchronous callbacks: requestAnimationFrame, setTimeout, setInterval, and postMessage.</p> >+</body> >+</html> >diff --git a/LayoutTests/inspector/debugger/async-stack-trace-event-listener-expected.txt b/LayoutTests/inspector/debugger/async-stack-trace-event-listener-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..51c1aa465af6f670068a0f00eca1e44c0cf5bbf9 >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-event-listener-expected.txt >@@ -0,0 +1,45 @@ >+Tests for event listener async stack traces. >+ >+Uncaught exception in Inspector page: undefined is not an object (evaluating 'InspectorTest.AsyncStackTrace.addSimpleTestCase') >+ >+Stack Trace: >+#0: (anonymous) (test) >+#1: (anonymous) (runTestMethodInFrontend) >+#2: (anonymous) (eval code) >+#3: eval [native code] >+#4: (anonymous) (TestCombined.js:6499:24) >+#5: _flushPendingScripts (TestCombined.js:5880:24) >+#6: _dispatchResponse (TestCombined.js:5741:38) >+#7: dispatch (TestCombined.js:5678:35) >+#8: dispatch (TestCombined.js:5323:49) >+#9: dispatchNextQueuedMessageFromBackend (TestCombined.js:6171:34) >+ >+Evaluated Code: >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("AsyncStackTrace.EventListener"); >+ >+ InspectorTest.AsyncStackTrace.addSimpleTestCase(suite, { >+ name: "AsyncStackTrace.EventListener.AddEventListener", >+ description: "Pause in an event listener handler.", >+ expression: "triggerEventListener()" >+ }); >+ >+ // FIXME: <https://webkit.org/b/183236> Web Inspector: Async stack trace for an on-event handler doesn't include a boundary frame. >+ // Update test results once this has been addressed. >+ InspectorTest.AsyncStackTrace.addSimpleTestCase(suite, { >+ name: "AsyncStackTrace.EventListener.AddAttributeEventListener", >+ description: "Pause in an attribute event listener handler.", >+ expression: "triggerAttributeEventListener()" >+ }); >+ >+ // Test for <https://webkit.org/b/181580> Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener. >+ InspectorTest.AsyncStackTrace.addSimpleTestCase(suite, { >+ name: "AsyncStackTrace.EventListener.ReplaceAttributeEventListener", >+ description: "Replace an attribute event listener after calling addEventListener on the same target.", >+ expression: "replaceAttributeEventListener()" >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+ >diff --git a/LayoutTests/inspector/debugger/async-stack-trace-event-listener.html b/LayoutTests/inspector/debugger/async-stack-trace-event-listener.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c247070823652827e44b84a237e837d5e798b34d >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-event-listener.html >@@ -0,0 +1,76 @@ >+<!doctype html> >+<html> >+<head> >+<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >+<script src="resources/async-stack-trace-test.js"></script> >+<script> >+function triggerEventListener() { >+ document.body.addEventListener("click", function handleClick() { >+ document.body.removeEventListener("click", handleClick); >+ debugger; >+ }); >+ >+ document.body.click(); >+} >+ >+function triggerAttributeEventListener() { >+ let previousListener = document.body.onclick; >+ >+ function handleClick() { >+ document.body.onclick = previousListener; >+ debugger; >+ } >+ >+ document.body.onclick = handleClick; >+ document.body.click(); >+} >+ >+function replaceAttributeEventListener() { >+ let previousListener = document.body.onclick; >+ >+ function handleClick1() {} >+ >+ function handleClick2() { >+ document.body.onclick = previousListener; >+ debugger; >+ } >+ >+ document.body.onclick = handleClick1; >+ document.body.addEventListener("click", handleClick1, {once: true}); >+ document.body.onclick = handleClick2; >+ document.body.click(); >+} >+ >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("AsyncStackTrace.EventListener"); >+ >+ InspectorTest.AsyncStackTrace.addSimpleTestCase(suite, { >+ name: "AsyncStackTrace.EventListener.AddEventListener", >+ description: "Pause in an event listener handler.", >+ expression: "triggerEventListener()" >+ }); >+ >+ // FIXME: <https://webkit.org/b/183236> Web Inspector: Async stack trace for an on-event handler doesn't include a boundary frame. >+ // Update test results once this has been addressed. >+ InspectorTest.AsyncStackTrace.addSimpleTestCase(suite, { >+ name: "AsyncStackTrace.EventListener.AddAttributeEventListener", >+ description: "Pause in an attribute event listener handler.", >+ expression: "triggerAttributeEventListener()" >+ }); >+ >+ // Test for <https://webkit.org/b/181580> Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener. >+ InspectorTest.AsyncStackTrace.addSimpleTestCase(suite, { >+ name: "AsyncStackTrace.EventListener.ReplaceAttributeEventListener", >+ description: "Replace an attribute event listener after calling addEventListener on the same target.", >+ expression: "replaceAttributeEventListener()" >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+<p>Tests for event listener async stack traces.</p> >+</body> >+</html> >diff --git a/LayoutTests/inspector/debugger/async-stack-trace-expected.txt b/LayoutTests/inspector/debugger/async-stack-trace-expected.txt >deleted file mode 100644 >index 003fbf462620adb857d6aeb7641a8967fcdf5657..0000000000000000000000000000000000000000 >--- a/LayoutTests/inspector/debugger/async-stack-trace-expected.txt >+++ /dev/null >@@ -1,147 +0,0 @@ >-CONSOLE MESSAGE: line 55: Unable to post message to http://example.com. Recipient has origin . >- >-Tests for async stack traces. >- >- >- >-== Running test suite: AsyncStackTrace >--- Running test case: CheckAsyncStackTrace.RequestAnimationFrame >-PAUSE #1 >-CALL STACK: >-0: [F] pauseThenFinishTest >-ASYNC CALL STACK: >-1: --- requestAnimationFrame --- >-2: [F] testRequestAnimationFrame >-3: [P] Global Code >- >--- Running test case: CheckAsyncStackTrace.SetTimeout >-PAUSE #1 >-CALL STACK: >-0: [F] pauseThenFinishTest >-ASYNC CALL STACK: >-1: --- setTimeout --- >-2: [F] testSetTimeout >-3: [P] Global Code >- >--- Running test case: CheckAsyncStackTrace.SetInterval >-PAUSE #1 >-CALL STACK: >-0: [F] intervalFired >-ASYNC CALL STACK: >-1: --- setInterval --- >-2: [F] testSetInterval >-3: [P] Global Code >-PAUSE #2 >-CALL STACK: >-0: [F] intervalFired >-ASYNC CALL STACK: >-1: --- setInterval --- >-2: [F] testSetInterval >-3: [P] Global Code >-PAUSE #3 >-CALL STACK: >-0: [F] intervalFired >-ASYNC CALL STACK: >-1: --- setInterval --- >-2: [F] testSetInterval >-3: [P] Global Code >- >--- Running test case: CheckAsyncStackTrace.ChainedRequestAnimationFrame >-PAUSE #1 >-CALL STACK: >-0: [F] pauseThenFinishTest >-ASYNC CALL STACK: >-1: --- requestAnimationFrame --- >-2: [F] testRequestAnimationFrame >-3: --- requestAnimationFrame --- >-4: [F] testChainedRequestAnimationFrame >-5: [P] Global Code >- >--- Running test case: CheckAsyncStackTrace.ReferenceCounting >-PAUSE #1 >-CALL STACK: >-0: [F] pauseThenFinishTest >-ASYNC CALL STACK: >-1: --- setTimeout --- >-2: [F] intervalFired >-3: --- setInterval --- >-4: [F] testReferenceCounting >-5: [P] Global Code >- >--- Running test case: CheckAsyncStackTrace.AddEventListener >-PAUSE #1 >-CALL STACK: >-0: [F] pauseThenFinishTest >-1: [F] clickFired >-2: [F] testAddEventListener >-3: [P] Global Code >-ASYNC CALL STACK: >-4: --- addEventListener --- >-5: [F] testAddEventListener >-6: [P] Global Code >- >--- Running test case: CheckAsyncStackTrace.PostMessage >-PAUSE #1 >-CALL STACK: >-0: [F] pauseThenFinishTest >-1: [F] postMessageFired >-ASYNC CALL STACK: >-2: --- postMessage --- >-3: [F] messageReceived >-4: --- postMessage --- >-5: [F] testPostMessage >-6: [P] Global Code >- >--- Running test case: ShouldNotPauseForFailedPostMessage >-PASS: Should not pause for failed post message. >--- Running test setup. >-Save DebuggerManager.asyncStackTraceDepth >- >--- Running test case: AsyncStackTrace.DisableStackTrace >-PASS: Async stack trace should be null. >--- Running test teardown. >-Restore DebuggerManager.asyncStackTraceDepth >--- Running test setup. >-Save DebuggerManager.asyncStackTraceDepth >- >--- Running test case: AsyncStackTrace.ForceTruncationOnCallStackBoundary >-Set Debugger.asyncStackTraceDepth equal to 4 >-PASS: Non-root StackTrace should not be truncated. >-PASS: Non-root StackTrace should not be truncated. >-PASS: StackTrace root should be truncated. >-PASS: StackTrace should be truncated to the nearest call stack. >-CALL STACK: >-0: [F] pauseThenFinishTest >-1: [F] repeat >-ASYNC CALL STACK: >-2: --- requestAnimationFrame --- >-3: [F] repeat >-4: --- requestAnimationFrame --- >-5: [F] repeat >-(remaining call frames truncated) >--- Running test teardown. >-Restore DebuggerManager.asyncStackTraceDepth >--- Running test setup. >-Save DebuggerManager.asyncStackTraceDepth >- >--- Running test case: AsyncStackTrace.ForceTruncationWithinCallStack >-Set Debugger.asyncStackTraceDepth equal to 5 >-PASS: Non-root StackTrace should not be truncated. >-PASS: Non-root StackTrace should not be truncated. >-PASS: Non-root StackTrace should not be truncated. >-PASS: StackTrace root should be truncated. >-PASS: StackTrace should be truncated to the nearest call stack. >-CALL STACK: >-0: [F] pauseThenFinishTest >-1: [F] repeat >-ASYNC CALL STACK: >-2: --- requestAnimationFrame --- >-3: [F] repeat >-4: --- requestAnimationFrame --- >-5: [F] repeat >-6: --- requestAnimationFrame --- >-7: [F] repeat >-(remaining call frames truncated) >--- Running test teardown. >-Restore DebuggerManager.asyncStackTraceDepth >- >diff --git a/LayoutTests/inspector/debugger/async-stack-trace-truncate-expected.txt b/LayoutTests/inspector/debugger/async-stack-trace-truncate-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..365c5f00fb336b758eee1beb0dd031cfe6d2b8b3 >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-truncate-expected.txt >@@ -0,0 +1,60 @@ >+Tests for truncating async stack traces that exceed the maximum async stack trace depth. >+ >+ >+== Running test suite: AsyncStackTrace.Truncate >+-- Running test setup. >+Set maximum stack trace depth = 0. >+-- Running test case: AsyncStackTrace.DisableAsyncStackTrace >+PAUSED >+CALL STACK: >+0: [F] handleAnimationFrame >+PASS: Async stack trace should be null. >+-- Running test teardown. >+-- Running test setup. >+Set maximum stack trace depth = 10. >+ >+-- Running test case: AsyncStackTrace.CheckTruncated >+PAUSED >+CALL STACK: >+0: [F] handleAnimationFrame >+ASYNC CALL STACK: >+1: --- requestAnimationFrame --- >+2: [F] handleAnimationFrame >+3: --- requestAnimationFrame --- >+4: [F] handleAnimationFrame >+5: --- requestAnimationFrame --- >+6: [F] handleAnimationFrame >+7: --- requestAnimationFrame --- >+8: [F] handleAnimationFrame >+9: --- requestAnimationFrame --- >+10: [F] handleAnimationFrame >+(remaining call frames truncated) >+PASS: Async stack trace should be truncated. >+-- Running test teardown. >+-- Running test setup. >+Set maximum stack trace depth = 10. >+ >+-- Running test case: AsyncStackTrace.CheckNotTruncated >+PAUSED >+CALL STACK: >+0: [F] handleAnimationFrame >+ASYNC CALL STACK: >+1: --- requestAnimationFrame --- >+2: [F] triggerChainedRequestAnimationFrame >+3: [P] Global Code >+PASS: Async stack trace should not be truncated. >+-- Running test teardown. >+-- Running test setup. >+Set maximum stack trace depth = 10. >+ >+-- Running test case: AsyncStackTrace. >+PAUSED >+CALL STACK: >+0: [F] handleAnimationFrame >+ASYNC CALL STACK: >+1: --- requestAnimationFrame --- >+2: [F] triggerChainedRequestAnimationFrame >+3: [P] Global Code >+PASS: Async stack trace should not be truncated. >+-- Running test teardown. >+ >diff --git a/LayoutTests/inspector/debugger/async-stack-trace-truncate.html b/LayoutTests/inspector/debugger/async-stack-trace-truncate.html >new file mode 100644 >index 0000000000000000000000000000000000000000..aeeab4d8b9c45dbb8a2dbff2bf9cfd568d1ca334 >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-truncate.html >@@ -0,0 +1,97 @@ >+<!doctype html> >+<html> >+<head> >+<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >+<script src="resources/async-stack-trace-test.js"></script> >+<script> >+ >+function triggerChainedRequestAnimationFrame(count) { >+ if (count <= 0) >+ return; >+ >+ function handleAnimationFrame() { >+ if (!--count) { >+ debugger; >+ return; >+ } >+ requestAnimationFrame(handleAnimationFrame); >+ } >+ >+ requestAnimationFrame(handleAnimationFrame); >+} >+ >+function test() >+{ >+ let suite = InspectorTest.createAsyncSuite("AsyncStackTrace.Truncate"); >+ >+ function addTruncateTestCase(suite, args) { >+ function setup(resolve) { >+ this.savedStackTraceDepth = WI.debuggerManager.asyncStackTraceDepth; >+ InspectorTest.log(`Set maximum stack trace depth = ${args.maximumStackTraceSize}.`); >+ WI.debuggerManager.asyncStackTraceDepth = args.maximumStackTraceSize; >+ resolve(); >+ } >+ function teardown(resolve) { >+ WI.debuggerManager.asyncStackTraceDepth = this.savedStackTraceDepth; >+ resolve(); >+ } >+ addAsyncStackTraceTestCase(suite, {...args, setup, teardown}); >+ } >+ >+ function isTruncated(stackTrace) { >+ while (stackTrace) { >+ if (stackTrace.truncated) >+ return true; >+ stackTrace = stackTrace.parentStackTrace; >+ } >+ return false; >+ } >+ >+ addTruncateTestCase(suite, { >+ name: "AsyncStackTrace.DisableAsyncStackTrace", >+ description: "Check that no async stack trace is present when the maximum depth is set to zero.", >+ expression: "triggerChainedRequestAnimationFrame(1)", >+ maximumStackTraceSize: 0, >+ pausedHandler(stackTrace) { >+ InspectorTest.expectNull(stackTrace.parentStackTrace, "Async stack trace should be null."); >+ } >+ }); >+ >+ addTruncateTestCase(suite, { >+ name: "AsyncStackTrace.CheckTruncated", >+ description: "Check that an async stack trace that exceeds the maximum depth is truncated.", >+ expression: "triggerChainedRequestAnimationFrame(20)", >+ maximumStackTraceSize: 10, >+ pausedHandler(stackTrace) { >+ InspectorTest.expectThat(isTruncated(stackTrace), "Async stack trace should be truncated."); >+ } >+ }); >+ >+ addTruncateTestCase(suite, { >+ name: "AsyncStackTrace.CheckNotTruncated", >+ description: "Check that an async stack trace is not truncated when below the maximum depth.", >+ expression: "triggerChainedRequestAnimationFrame(1)", >+ maximumStackTraceSize: 10, >+ pausedHandler(stackTrace) { >+ InspectorTest.expectFalse(isTruncated(stackTrace), "Async stack trace should not be truncated."); >+ } >+ }); >+ >+ addTruncateTestCase(suite, { >+ name: "AsyncStackTrace.", >+ description: "", >+ expression: "triggerChainedRequestAnimationFrame(1)", >+ maximumStackTraceSize: 10, >+ pausedHandler(stackTrace) { >+ InspectorTest.expectFalse(isTruncated(stackTrace), "Async stack trace should not be truncated."); >+ } >+ }); >+ >+ suite.runTestCasesAndFinish(); >+} >+</script> >+</head> >+<body onload="runTest()"> >+<p>Tests for truncating async stack traces that exceed the maximum async stack trace depth.</p> >+</body> >+</html> >diff --git a/LayoutTests/inspector/debugger/async-stack-trace.html b/LayoutTests/inspector/debugger/async-stack-trace.html >deleted file mode 100644 >index 13d83a1b01dc6fd477403d3b9767941704222095..0000000000000000000000000000000000000000 >--- a/LayoutTests/inspector/debugger/async-stack-trace.html >+++ /dev/null >@@ -1,236 +0,0 @@ >-<!doctype html> >-<html> >-<head> >-<script src="../../http/tests/inspector/resources/inspector-test.js"></script> >-<script src="resources/log-active-stack-trace.js"></script> >-<script> >-const timerDelay = 20; >- >-function pauseThenFinishTest() { >- debugger; >- TestPage.dispatchEventToFrontend("AfterTestFunction"); >-} >- >-function testRequestAnimationFrame() { >- requestAnimationFrame(pauseThenFinishTest); >-} >- >-function testSetTimeout() { >- setTimeout(pauseThenFinishTest, timerDelay); >-} >- >-function testChainedRequestAnimationFrame() { >- requestAnimationFrame(testRequestAnimationFrame); >-} >- >-function testSetInterval(repeatCount) { >- let pauses = 0; >- let timerIdentifier = setInterval(function intervalFired() { >- debugger; >- if (++pauses === repeatCount) { >- clearInterval(timerIdentifier); >- TestPage.dispatchEventToFrontend("AfterTestFunction"); >- } >- }, timerDelay); >-} >- >-function testReferenceCounting() { >- let interval = setInterval(function intervalFired() { >- clearInterval(interval); >- setTimeout(pauseThenFinishTest, timerDelay * 2); >- }, timerDelay); >-} >- >-function testAddEventListener() { >- document.body.addEventListener("click", function clickFired() { >- document.body.removeEventListener("click", clickFired); >- pauseThenFinishTest(); >- }); >- >- document.body.click(); >-} >- >-function testPostMessage(targetOrigin = "*") { >- let childFrame = document.getElementById("postMessageTestFrame"); >- childFrame.contentWindow.postMessage("<message>", targetOrigin); >- >- window.addEventListener("message", function postMessageFired() { >- window.removeEventListener("message", postMessageFired); >- pauseThenFinishTest(); >- }); >-} >- >-function testFailPostMessage() { >- testPostMessage("http://example.com"); >- setTimeout(() => { >- TestPage.dispatchEventToFrontend("AfterTestFunction"); >- }, 0); >-} >- >-function recursiveCallThenTest(testFunction, depth) { >- if (depth) { >- recursiveCallThenTest(testFunction, depth - 1); >- return; >- } >- testFunction(); >-} >- >-function repeatingRequestAnimationFrame(repeatCount) { >- let count = 0; >- function repeat() { >- if (count++ === repeatCount) { >- pauseThenFinishTest(); >- return; >- } >- requestAnimationFrame(repeat); >- } >- requestAnimationFrame(repeat); >-} >- >-function test() >-{ >- let suite = InspectorTest.createAsyncSuite("AsyncStackTrace"); >- >- function addSimpleTestCase(name, expression) { >- suite.addTestCase({ >- name: `CheckAsyncStackTrace.${name}`, >- test(resolve, reject) { >- let pauseCount = 0; >- function debuggerPaused() { >- InspectorTest.log(`PAUSE #${++pauseCount}`); >- logActiveStackTrace(); >- WI.debuggerManager.resume(); >- } >- >- WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, debuggerPaused); >- >- InspectorTest.awaitEvent("AfterTestFunction") >- .then(() => { >- WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, debuggerPaused); >- resolve(); >- }); >- >- InspectorTest.evaluateInPage(expression); >- } >- }); >- } >- >- addSimpleTestCase("RequestAnimationFrame", "testRequestAnimationFrame()"); >- addSimpleTestCase("SetTimeout", "testSetTimeout()"); >- addSimpleTestCase("SetInterval", "testSetInterval(3)"); >- addSimpleTestCase("ChainedRequestAnimationFrame", "testChainedRequestAnimationFrame()"); >- addSimpleTestCase("ReferenceCounting", "testReferenceCounting()"); >- addSimpleTestCase("AddEventListener", "testAddEventListener()"); >- addSimpleTestCase("PostMessage", "testPostMessage()"); >- >- suite.addTestCase({ >- name: "ShouldNotPauseForFailedPostMessage", >- test(resolve, reject) { >- function debuggerPaused() { >- WI.debuggerManager.resume(); >- InspectorTest.fail("Should not pause."); >- reject(); >- } >- >- WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Paused, debuggerPaused); >- >- InspectorTest.awaitEvent("AfterTestFunction") >- .then(() => { >- WI.debuggerManager.removeEventListener(WI.DebuggerManager.Event.Paused, debuggerPaused); >- InspectorTest.pass("Should not pause for failed post message."); >- resolve(); >- }); >- >- InspectorTest.evaluateInPage("testFailPostMessage()"); >- } >- }); >- >- function setup(resolve) { >- InspectorTest.log("Save DebuggerManager.asyncStackTraceDepth"); >- this.savedCallStackDepth = WI.debuggerManager.asyncStackTraceDepth; >- resolve(); >- } >- >- function teardown(resolve) { >- InspectorTest.log("Restore DebuggerManager.asyncStackTraceDepth"); >- WI.debuggerManager.asyncStackTraceDepth = this.savedCallStackDepth; >- resolve(); >- } >- >- suite.addTestCase({ >- name: "AsyncStackTrace.DisableStackTrace", >- setup, >- teardown, >- test(resolve, reject) { >- WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused) >- .then((event) => { >- let stackTrace = getActiveStackTrace(); >- let asyncStackTrace = stackTrace.parentStackTrace; >- InspectorTest.expectNull(asyncStackTrace, "Async stack trace should be null."); >- WI.debuggerManager.resume().then(resolve, reject); >- }); >- >- WI.debuggerManager.asyncStackTraceDepth = 0; >- InspectorTest.evaluateInPage("testRequestAnimationFrame()"); >- } >- }); >- >- function addTruncateTestCase(name, asyncStackTraceDepth) { >- suite.addTestCase({ >- name: `AsyncStackTrace.${name}`, >- setup, >- teardown, >- test(resolve, reject) { >- // When repeatingRequestAnimationFrame calls rAF, the backend will store a call stack with length 2: >- // one frame for the caller and one for the asynchronous boundary. As a result, the parity of >- // Debugger.asyncStackTraceDepth determines whether the trace is truncated on a call stack boundary >- // (even) or call frame boundary (odd). Since truncation doesn't remove individual call frames, >- // the depth of the resulting stack trace may exceed the depth setting: >- // S = { sð¶, sð·, â¦, sð } >- // T = truncate(S) >- // depth(T) ⤠d + depth(tð) >- const framesPerCallStack = 2; >- const expectedStackTraceDepth = asyncStackTraceDepth + (asyncStackTraceDepth % framesPerCallStack); >- >- WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused) >- .then((event) => { >- let stackTrace = getActiveStackTrace(); >- InspectorTest.assert(stackTrace && stackTrace.callFrames); >- if (!stackTrace || !stackTrace.callFrames) >- reject(); >- >- let stackTraceDepth = 0; >- while (stackTrace.parentStackTrace) { >- InspectorTest.expectFalse(stackTrace.truncated, "Non-root StackTrace should not be truncated."); >- stackTrace = stackTrace.parentStackTrace; >- stackTraceDepth += stackTrace.callFrames.length; >- } >- >- InspectorTest.expectThat(stackTrace.truncated, "StackTrace root should be truncated."); >- InspectorTest.expectEqual(stackTraceDepth, expectedStackTraceDepth, "StackTrace should be truncated to the nearest call stack."); >- >- logActiveStackTrace(); >- WI.debuggerManager.resume().then(resolve, reject); >- }); >- >- InspectorTest.log(`Set Debugger.asyncStackTraceDepth equal to ${asyncStackTraceDepth}`); >- WI.debuggerManager.asyncStackTraceDepth = asyncStackTraceDepth; >- >- let repeatCount = Math.floor(asyncStackTraceDepth / framesPerCallStack) + 1; >- InspectorTest.evaluateInPage(`repeatingRequestAnimationFrame(${repeatCount})`); >- } >- }); >- } >- >- addTruncateTestCase("ForceTruncationOnCallStackBoundary", 4); >- addTruncateTestCase("ForceTruncationWithinCallStack", 5); >- >- suite.runTestCasesAndFinish(); >-} >-</script> >-</head> >-<body onload="runTest()"> >-<p>Tests for async stack traces.</p> >-<iframe id="postMessageTestFrame" src="resources/postMessage-echo.html"></iframe> >-</body> >-</html> >diff --git a/LayoutTests/inspector/debugger/resources/async-stack-trace-test.js b/LayoutTests/inspector/debugger/resources/async-stack-trace-test.js >new file mode 100644 >index 0000000000000000000000000000000000000000..c23bff9f584e70bd2b79fc5afa22341779b92a24 >--- /dev/null >+++ b/LayoutTests/inspector/debugger/resources/async-stack-trace-test.js >@@ -0,0 +1,89 @@ >+TestPage.registerInitializer(() => { >+ window.getAsyncStackTrace = function() { >+ InspectorTest.assert(WI.debuggerManager.activeCallFrame, "Active call frame should exist."); >+ if (!WI.debuggerManager.activeCallFrame) >+ return null; >+ >+ let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target); >+ InspectorTest.assert(targetData, "Data for active call frame target should exist."); >+ if (!targetData) >+ return null; >+ >+ const topCallFrameIsBoundary = false; >+ const truncated = false; >+ return new WI.StackTrace(targetData.callFrames, topCallFrameIsBoundary, truncated, targetData.asyncStackTrace); >+ }; >+ >+ window.logAsyncStackTrace = function() { >+ let foundAsyncBoundary = false; >+ let callFrameIndex = 0; >+ >+ function logCallFrame(callFrame, isAsyncBoundary) { >+ let label = callFrame.functionName; >+ if (isAsyncBoundary) >+ InspectorTest.log(`${callFrameIndex}: --- ${label} ---`); >+ else { >+ let code = callFrame.nativeCode ? "N" : (callFrame.programCode ? "P" : "F"); >+ InspectorTest.log(`${callFrameIndex}: [${code}] ${label}`); >+ } >+ callFrameIndex++; >+ } >+ >+ InspectorTest.log("CALL STACK:"); >+ >+ let stackTrace = getAsyncStackTrace(); >+ while (stackTrace) { >+ let callFrames = stackTrace.callFrames; >+ let topCallFrameIsBoundary = stackTrace.topCallFrameIsBoundary; >+ let truncated = stackTrace.truncated; >+ stackTrace = stackTrace.parentStackTrace; >+ if (!callFrames || !callFrames.length) >+ continue; >+ >+ if (topCallFrameIsBoundary) { >+ if (!foundAsyncBoundary) { >+ InspectorTest.log("ASYNC CALL STACK:"); >+ foundAsyncBoundary = true; >+ } >+ logCallFrame(callFrames[0], true); >+ } >+ >+ for (let i = topCallFrameIsBoundary ? 1 : 0; i < callFrames.length; ++i) { >+ let callFrame = callFrames[i]; >+ logCallFrame(callFrame); >+ >+ // Skip call frames after the test harness entry point. >+ if (callFrame.programCode) >+ break; >+ } >+ >+ if (truncated) >+ InspectorTest.log("(remaining call frames truncated)"); >+ } >+ }; >+ >+ window.addAsyncStackTraceTestCase = function(suite, {name, description, expression, pausedHandler, setup, teardown}) { >+ suite.addTestCase({ >+ name, >+ description, >+ setup, >+ teardown, >+ async test(resolve, reject) { >+ let result = WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Paused) >+ .then(() => { >+ InspectorTest.log("PAUSED"); >+ logAsyncStackTrace(); >+ >+ if (pausedHandler) >+ pausedHandler(getAsyncStackTrace()); >+ >+ WI.debuggerManager.resume(); >+ }) >+ .then(() => WI.debuggerManager.awaitEvent(WI.DebuggerManager.Event.Resumed)); >+ >+ InspectorTest.evaluateInPage(expression); >+ await result; >+ } >+ }); >+ }; >+}); >diff --git a/LayoutTests/inspector/debugger/resources/postMessage-echo.html b/LayoutTests/inspector/debugger/resources/postMessage-echo.html >deleted file mode 100644 >index 2982c86c1286de380898e1f0f372b04cd63ae588..0000000000000000000000000000000000000000 >--- a/LayoutTests/inspector/debugger/resources/postMessage-echo.html >+++ /dev/null >@@ -1,6 +0,0 @@ >-<script> >-window.addEventListener("message", function messageReceived(event) { >- let echo = `iFrame postMessage echo: ${event.data}`; >- parent.postMessage(echo, "*"); >-}); >-</script> >diff --git a/LayoutTests/platform/mac/TestExpectations b/LayoutTests/platform/mac/TestExpectations >index 5ed9d00ee47d063fca0c2f351a50f2e17e4384ad..c58c284c194607b9a2dfe3eec124f7d7e5cccd7f 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -1066,7 +1066,6 @@ webkit.org/b/148636 inspector/css/modify-rule-selector.html [ Pass Timeout ] > webkit.org/b/148636 inspector/css/pseudo-element-matches-for-pseudo-element-node.html [ Pass Timeout ] > webkit.org/b/148636 inspector/css/selector-dynamic-specificity.html [ Pass Timeout ] > webkit.org/b/148636 inspector/css/selector-specificity.html [ Pass Timeout ] >-webkit.org/b/165584 inspector/debugger/async-stack-trace.html [ Pass Timeout ] > webkit.org/b/158742 [ Debug ] inspector/debugger/break-in-constructor-before-super.html [ Pass Timeout ] > webkit.org/b/163604 inspector/debugger/breakpoint-action-eval.html [ Pass Timeout ] > webkit.org/b/168338 [ Sierra ] inspector/debugger/breakpoint-action-detach.html [ Pass Timeout ]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 181580
:
334793
|
335204
|
335212
|
335213
|
335217
|
335219
|
338813
|
338829
|
338843
|
338848
|
339265
|
339266
|
339480
|
339761