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

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

Issue 2749383005: [Devtools] Add stacktrace for Page.frameAttached event (Closed)
Patch Set: changes 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/page/frameAttachedStacktrace-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698