Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1073)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace.html

Issue 2749383005: [Devtools] Add stacktrace for Page.frameAttached event (Closed)
Patch Set: added test Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto r-protocol-test.js"></script>
4 <script>
5
6 function createFrame()
7 {
8 var frame = document.createElement("iframe");
9 frame.src = "data:text/html,<html><body><script>" +
10 "var innerFrame = document.createElement('iframe');" +
11 "innerFrame.src = 'about:blank';" +
12 "document.body.appendChild(innerFrame);" +
13 "<" + "/script></body></html>";
14 document.body.appendChild(frame);
15 }
16
17 function test()
18 {
19 const expectedNumberOfFrames = 2;
20 var currentFrameCount = 0;
21 InspectorTest.eventHandler["Page.frameAttached"] = onAttached;
22 InspectorTest.sendCommand("Page.enable", {});
23 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "createFrame() " });
24
25 function onAttached(data)
26 {
27 currentFrameCount++;
28 InspectorTest.log("Frame Attached");
29 var stack = data.params.stack;
30 if (stack && stack.callFrames) {
31 logCallframes(stack.callFrames, false);
32 } else {
33 InspectorTest.log("Callframes are empty");
34 }
35 if (currentFrameCount >= expectedNumberOfFrames) {
36 InspectorTest.completeTest();
37 }
38 }
39
40 function logCallframes(frames, showUrl) {
41 InspectorTest.log("Call Frames :");
42 if (!frames) {
43 InspectorTest.log("No callframes");
44 InspectorTest.log("");
45 return;
46 }
47 InspectorTest.log("[");
48 for (var i = 0; i < frames.length; i++) {
49 var frame = frames[i];
50 InspectorTest.log(" [" + i + "] : {");
51 if (!frame) {
52 InspectorTest.log(" No Frame");
53 continue;
54 }
55 InspectorTest.log(" columnNumber : " + frame.columnNumber);
56 InspectorTest.log(" functionName : " + frame.functionName);
57 InspectorTest.log(" lineNumber : " + frame.lineNumber);
58 InspectorTest.log(" scriptId : " + (frame.scriptId ? "<scriptId>" : null));
59 InspectorTest.log(" lineNumber : " + frame.lineNumber);
60 InspectorTest.log(" url : " + (showUrl ? frame.url : "<url not sh own>"));
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
61 InspectorTest.log(" }");
62 }
63 InspectorTest.log("]");
64 InspectorTest.log("");
65 }
66 }
67 </script>
68 </head>
69 <body onload="runTest()">
70 </body>
71 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698