Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.html |
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.html b/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e5a77cee3683f172b8d279631da312307f7a44f6 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.html |
| @@ -0,0 +1,71 @@ |
| +<html> |
| +<head> |
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script> |
| +<script> |
| + |
| +function createFrame() |
| +{ |
| + var frame = document.createElement("iframe"); |
| + frame.src = "data:text/html,<html><body><script>" + |
| + "var innerFrame = document.createElement('iframe');" + |
| + "innerFrame.src = 'about:blank';" + |
| + "document.body.appendChild(innerFrame);" + |
| + "<" + "/script></body></html>"; |
| + document.body.appendChild(frame); |
| +} |
| + |
| +function test() |
| +{ |
| + const expectedNumberOfFrames = 2; |
| + var currentFrameCount = 0; |
| + InspectorTest.eventHandler["Page.frameAttached"] = onAttached; |
| + InspectorTest.sendCommand("Page.enable", {}); |
| + InspectorTest.sendCommand("Runtime.evaluate", { "expression": "createFrame()" }); |
| + |
| + function onAttached(data) |
| + { |
| + currentFrameCount++; |
| + InspectorTest.log("Frame Attached"); |
| + var stack = data.params.stack; |
| + if (stack && stack.callFrames) { |
| + logCallframes(stack.callFrames, false); |
| + } else { |
| + InspectorTest.log("Callframes are empty"); |
| + } |
| + if (currentFrameCount >= expectedNumberOfFrames) { |
| + InspectorTest.completeTest(); |
| + } |
| + } |
| + |
| + function logCallframes(frames, showUrl) { |
| + InspectorTest.log("Call Frames :"); |
| + if (!frames) { |
| + InspectorTest.log("No callframes"); |
| + InspectorTest.log(""); |
| + return; |
| + } |
| + InspectorTest.log("["); |
| + for (var i = 0; i < frames.length; i++) { |
| + var frame = frames[i]; |
| + InspectorTest.log(" [" + i + "] : {"); |
| + if (!frame) { |
| + InspectorTest.log(" No Frame"); |
| + continue; |
| + } |
| + InspectorTest.log(" columnNumber : " + frame.columnNumber); |
| + InspectorTest.log(" functionName : " + frame.functionName); |
| + InspectorTest.log(" lineNumber : " + frame.lineNumber); |
| + InspectorTest.log(" scriptId : " + (frame.scriptId ? "<scriptId>" : null)); |
| + InspectorTest.log(" lineNumber : " + frame.lineNumber); |
| + InspectorTest.log(" url : " + (showUrl ? frame.url : "<url not shown>")); |
|
dgozman
2017/03/20 17:53:37
Why not show the url?
allada
2017/03/21 00:19:20
url may be a file location, which can change from
|
| + InspectorTest.log(" }"); |
| + } |
| + InspectorTest.log("]"); |
| + InspectorTest.log(""); |
| + } |
| +} |
| +</script> |
| +</head> |
| +<body onload="runTest()"> |
| +</body> |
| +</html> |