| 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..05d3f8b2de20b305ce54e06caf4ad589bb582f92
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.html
|
| @@ -0,0 +1,92 @@
|
| +<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>%0A" +
|
| + "var innerFrame = document.createElement('iframe');%0A" +
|
| + "innerFrame.src = 'about:blank';%0A" +
|
| + "document.body.appendChild(innerFrame);%0A" +
|
| + "<" + "/script></body></html>";
|
| + document.body.appendChild(frame);
|
| +}
|
| +
|
| +function test()
|
| +{
|
| + const expectedNumberOfFrames = 3;
|
| + var currentFrameCount = 0;
|
| + InspectorTest.sendCommand("Page.enable", {});
|
| + InspectorTest.evaluateInInspectedPage("prepareForReload()", reloadPage)
|
| +
|
| + function reloadPage()
|
| + {
|
| + InspectorTest.eventHandler["Page.loadEventFired"] = contentLoaded;
|
| + InspectorTest.eventHandler["Page.frameAttached"] = onAttached;
|
| + // It's worth noting that because the way the testrunner works nothing will be logged
|
| + // until after this command executes and not log anything in the callback of this function.
|
| + InspectorTest.sendCommand("Page.reload", { "ignoreCache": false });
|
| + }
|
| +
|
| + function contentLoaded() {
|
| + delete InspectorTest.eventHandler["Page.loadEventFired"];
|
| + InspectorTest.evaluateInInspectedPage("createFrame()");
|
| + }
|
| +
|
| + function onAttached(data)
|
| + {
|
| + currentFrameCount++;
|
| + InspectorTest.log("Frame Attached");
|
| + var stack = data.params.stack;
|
| + if (stack) {
|
| + logCallframes(stack.callFrames);
|
| + } else {
|
| + InspectorTest.log("Stack is empty");
|
| + InspectorTest.log("");
|
| + }
|
| + if (currentFrameCount >= expectedNumberOfFrames) {
|
| + InspectorTest.completeTest();
|
| + }
|
| + }
|
| +
|
| + // showUrl left in for debugging reasons.
|
| + function logCallframes(frames) {
|
| + 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;
|
| + }
|
| + var url = frame.url || '';
|
| + if (url.indexOf('data:') !== 0 && url.indexOf('/') !== -1) {
|
| + var urlParts = url.split('/');
|
| + url = "<only showing file name>/" + urlParts[urlParts.length - 1];
|
| + }
|
| + 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 : " + url);
|
| + InspectorTest.log(" }");
|
| + }
|
| + InspectorTest.log("]");
|
| + InspectorTest.log("");
|
| + }
|
| +}
|
| +</script>
|
| +</head>
|
| +<body onload="runTest()">
|
| + <iframe src="about:blank" />
|
| +</body>
|
| +</html>
|
|
|