| Index: third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.js
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.js b/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..12006d873be9771963912a5634ed75da22b752eb
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.js
|
| @@ -0,0 +1,59 @@
|
| +(async function() {
|
| + let {page, session, Protocol} = await InspectorTest.startURL('../resources/frame-attached-stacktrace-page.html', '');
|
| +
|
| + const expectedNumberOfFrames = 3;
|
| + var currentFrameCount = 0;
|
| +
|
| + Protocol.Page.onFrameAttached(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();
|
| + }
|
| + });
|
| +
|
| + Protocol.Page.enable();
|
| + Protocol.Page.reload({ "ignoreCache": false });
|
| + await Protocol.Page.onceLoadEventFired();
|
| + session.evaluate('createFrame()');
|
| +
|
| + // 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("");
|
| + }
|
| +})();
|
|
|