| OLD | NEW |
| (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>%0A" + | |
| 10 "var innerFrame = document.createElement('iframe');%0A" + | |
| 11 "innerFrame.src = 'about:blank';%0A" + | |
| 12 "document.body.appendChild(innerFrame);%0A" + | |
| 13 "<" + "/script></body></html>"; | |
| 14 document.body.appendChild(frame); | |
| 15 } | |
| 16 | |
| 17 function test() | |
| 18 { | |
| 19 const expectedNumberOfFrames = 3; | |
| 20 var currentFrameCount = 0; | |
| 21 InspectorTest.sendCommand("Page.enable", {}); | |
| 22 InspectorTest.evaluateInInspectedPage("prepareForReload()", reloadPage) | |
| 23 | |
| 24 function reloadPage() | |
| 25 { | |
| 26 InspectorTest.eventHandler["Page.loadEventFired"] = contentLoaded; | |
| 27 InspectorTest.eventHandler["Page.frameAttached"] = onAttached; | |
| 28 // It's worth noting that because the way the testrunner works nothing w
ill be logged | |
| 29 // until after this command executes and not log anything in the callbac
k of this function. | |
| 30 InspectorTest.sendCommand("Page.reload", { "ignoreCache": false }); | |
| 31 } | |
| 32 | |
| 33 function contentLoaded() { | |
| 34 delete InspectorTest.eventHandler["Page.loadEventFired"]; | |
| 35 InspectorTest.evaluateInInspectedPage("createFrame()"); | |
| 36 } | |
| 37 | |
| 38 function onAttached(data) | |
| 39 { | |
| 40 currentFrameCount++; | |
| 41 InspectorTest.log("Frame Attached"); | |
| 42 var stack = data.params.stack; | |
| 43 if (stack) { | |
| 44 logCallframes(stack.callFrames); | |
| 45 } else { | |
| 46 InspectorTest.log("Stack is empty"); | |
| 47 InspectorTest.log(""); | |
| 48 } | |
| 49 if (currentFrameCount >= expectedNumberOfFrames) { | |
| 50 InspectorTest.completeTest(); | |
| 51 } | |
| 52 } | |
| 53 | |
| 54 // showUrl left in for debugging reasons. | |
| 55 function logCallframes(frames) { | |
| 56 InspectorTest.log("Call Frames :"); | |
| 57 if (!frames) { | |
| 58 InspectorTest.log("No callframes"); | |
| 59 InspectorTest.log(""); | |
| 60 return; | |
| 61 } | |
| 62 InspectorTest.log("["); | |
| 63 for (var i = 0; i < frames.length; i++) { | |
| 64 var frame = frames[i]; | |
| 65 InspectorTest.log(" [" + i + "] : {"); | |
| 66 if (!frame) { | |
| 67 InspectorTest.log(" No Frame"); | |
| 68 continue; | |
| 69 } | |
| 70 var url = frame.url || ''; | |
| 71 if (url.indexOf('data:') !== 0 && url.indexOf('/') !== -1) { | |
| 72 var urlParts = url.split('/'); | |
| 73 url = "<only showing file name>/" + urlParts[urlParts.length - 1
]; | |
| 74 } | |
| 75 InspectorTest.log(" columnNumber : " + frame.columnNumber); | |
| 76 InspectorTest.log(" functionName : " + frame.functionName); | |
| 77 InspectorTest.log(" lineNumber : " + frame.lineNumber); | |
| 78 InspectorTest.log(" scriptId : " + (frame.scriptId ? "<scriptId>"
: null)); | |
| 79 InspectorTest.log(" lineNumber : " + frame.lineNumber); | |
| 80 InspectorTest.log(" url : " + url); | |
| 81 InspectorTest.log(" }"); | |
| 82 } | |
| 83 InspectorTest.log("]"); | |
| 84 InspectorTest.log(""); | |
| 85 } | |
| 86 } | |
| 87 </script> | |
| 88 </head> | |
| 89 <body onload="runTest()"> | |
| 90 <iframe src="about:blank" /> | |
| 91 </body> | |
| 92 </html> | |
| OLD | NEW |