WebKit Bugzilla
Attachment 346664 Details for
Bug 185398
: Web Inspector: split-up async stack trace test suite to improve clarity and maintainability
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-185398-20180806161250.patch (text/plain), 37.51 KB, created by
Matt Baker
on 2018-08-06 16:12:51 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Matt Baker
Created:
2018-08-06 16:12:51 PDT
Size:
37.51 KB
patch
obsolete
>Subversion Revision: 234606 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 3d372c4573d4b096dd0b182de0a8b2bac6413537..6ad127f01ce7f5e7ecae96ab19efbbf895c13dd8 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,43 @@ >+2018-08-06 Matt Baker <mattbaker@apple.com> >+ >+ Web Inspector: split-up async stack trace test suite to improve clarity and maintainability >+ https://bugs.webkit.org/show_bug.cgi?id=185398 >+ <rdar://problem/40040289> >+ >+ Reviewed by Joseph Pecoraro. >+ >+ * 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-expected.txt: Removed. >+ >+ * 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.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 >+ inline in async-stack-trace-basic.html. >+ >+ * platform/mac/TestExpectations: >+ > 2018-08-06 Truitt Savell <tsavell@apple.com> > > storage/indexeddb/modern/opendatabase-after-storage-crash.html is causing tests in directory svg/ to timeout at random >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..3742fec41d44d8d6ddcf39550de6e2b7b23e528b >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-event-listener-expected.txt >@@ -0,0 +1,33 @@ >+Tests for event listener async stack traces. >+ >+ >+== Running test suite: AsyncStackTrace.EventListener >+-- Running test case: AsyncStackTrace.EventListener.AddEventListener >+PAUSED >+CALL STACK: >+0: [F] handleClick >+1: [F] triggerEventListener >+2: [P] Global Code >+ASYNC CALL STACK: >+3: --- addEventListener --- >+4: [F] triggerEventListener >+5: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.EventListener.AddAttributeEventListener >+PAUSED >+CALL STACK: >+0: [F] handleClick >+1: [F] triggerAttributeEventListener >+2: [P] Global Code >+3: [F] triggerAttributeEventListener >+4: [P] Global Code >+ >+-- Running test case: AsyncStackTrace.EventListener.ReplaceAttributeEventListener >+PAUSED >+CALL STACK: >+0: [F] handleClick2 >+1: [F] replaceAttributeEventListener >+2: [P] Global Code >+3: [F] replaceAttributeEventListener >+4: [P] Global Code >+ >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..18244c04a8f799a0a28b2bf5992246e775c88f1e >--- /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"); >+ >+ addAsyncStackTraceTestCase(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. >+ addAsyncStackTraceTestCase(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. >+ addAsyncStackTraceTestCase(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 f7b83e9b6db2bd5f981d2adca5d0e12be1fe6058..0000000000000000000000000000000000000000 >--- a/LayoutTests/inspector/debugger/async-stack-trace-expected.txt >+++ /dev/null >@@ -1,167 +0,0 @@ >-CONSOLE MESSAGE: line 83: 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.AddAttributeEventListener >-PAUSE #1 >-CALL STACK: >-0: [F] pauseThenFinishTest >-1: [F] handleClick >-2: [F] testAttributeEventListener >-3: [P] Global Code >-4: [F] testAttributeEventListener >-5: [P] Global Code >- >--- Running test case: CheckAsyncStackTrace.ReplaceAttributeEventListener >-PAUSE #1 >-CALL STACK: >-0: [F] pauseThenFinishTest >-1: [F] handleClick2 >-2: [F] testReplaceAttributeEventListener >-3: [P] Global Code >-4: [F] testReplaceAttributeEventListener >-5: [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..771c8b8ee3b27a5316b8844bb795140ac8d0785c >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-truncate-expected.txt >@@ -0,0 +1,47 @@ >+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. >+ >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..418cf42cd8fcead214b592e4052df82d70f22663 >--- /dev/null >+++ b/LayoutTests/inspector/debugger/async-stack-trace-truncate.html >@@ -0,0 +1,87 @@ >+<!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."); >+ } >+ }); >+ >+ 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 0dea141f8072cc833383f3b98989f3a871a2f516..0000000000000000000000000000000000000000 >--- a/LayoutTests/inspector/debugger/async-stack-trace.html >+++ /dev/null >@@ -1,269 +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 testAttributeEventListener() { >- let previousListener = document.body.onclick; >- >- function handleClick() { >- document.body.onclick = previousListener; >- pauseThenFinishTest(); >- } >- >- document.body.onclick = handleClick; >- document.body.click(); >-} >- >-function testReplaceAttributeEventListener() { >- let previousListener = document.body.onclick; >- >- function handleClick1() {} >- >- function handleClick2() { >- document.body.onclick = previousListener; >- pauseThenFinishTest(); >- } >- >- document.body.onclick = handleClick1; >- document.body.addEventListener("click", handleClick1, {once: true}); >- document.body.onclick = handleClick2; >- 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()"); >- // 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. >- addSimpleTestCase("AddAttributeEventListener", "testAttributeEventListener()"); >- // Test for <https://webkit.org/b/181580> Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener. >- addSimpleTestCase("ReplaceAttributeEventListener", "testReplaceAttributeEventListener()"); >- 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..757154843bb990e0f2ab142eb7e1a588ea06227f >--- /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 c804667072ed7177e464eaf0d99e9a3bfda1b28a..b018542bb5a1c10aa31d16f08697c237b84c3266 100644 >--- a/LayoutTests/platform/mac/TestExpectations >+++ b/LayoutTests/platform/mac/TestExpectations >@@ -1073,7 +1073,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 185398
:
339762
|
339772
|
339773
|
339776
|
339789
|
340227
|
346215
|
346271
| 346664