| OLD | NEW |
| (Empty) |
| 1 function endTest() { | |
| 2 console.profileEnd(); | |
| 3 printProfilesDataWithoutTime(); | |
| 4 | |
| 5 if (window.testRunner) | |
| 6 testRunner.notifyDone(); | |
| 7 } | |
| 8 | |
| 9 function insertGivenText(text) { | |
| 10 var paragraph = document.createElement("p"); | |
| 11 paragraph.appendChild(document.createTextNode(text)); | |
| 12 paragraph.style.display = "none"; // Hidden since this isn't important in th
e test results. | |
| 13 | |
| 14 document.getElementById("output").appendChild(paragraph); | |
| 15 } | |
| 16 | |
| 17 function insertNewText() { | |
| 18 var paragraph = document.createElement("p"); | |
| 19 paragraph.appendChild(document.createTextNode("This is inserted Text")); | |
| 20 paragraph.style.display = "none"; // Hidden since this isn't important in th
e test results. | |
| 21 | |
| 22 document.getElementById("output").appendChild(paragraph); | |
| 23 } | |
| 24 | |
| 25 function arrayOperatorFunction(arrayElement) { | |
| 26 return arrayElement + 5; | |
| 27 } | |
| 28 | |
| 29 var anonymousFunction = function () { insertNewText(); }; | |
| 30 var anotherAnonymousFunction = function () { insertGivenText("Another anonymous
function was called.") }; | |
| 31 | |
| 32 function intermediaryFunction() | |
| 33 { | |
| 34 anonymousFunction(); | |
| 35 } | |
| 36 | |
| 37 function isEqualToFive(input) | |
| 38 { | |
| 39 return input === 5; | |
| 40 } | |
| 41 | |
| 42 function startProfile(title) | |
| 43 { | |
| 44 console.profile(title); | |
| 45 } | |
| 46 | |
| 47 function printHeavyProfilesDataWithoutTime() | |
| 48 { | |
| 49 var preElement = document.createElement("pre"); | |
| 50 preElement.appendChild(document.createTextNode("\n")); | |
| 51 | |
| 52 var profiles = console.profiles; | |
| 53 for (var i = 0; i < profiles.length; ++i) { | |
| 54 preElement.appendChild(document.createTextNode("Profile title: " + profi
les[i].title + "\n")); | |
| 55 printProfileNodeWithoutTime(preElement, profiles[i].heavyProfile.head, 0
); | |
| 56 preElement.appendChild(document.createTextNode("\n")); | |
| 57 } | |
| 58 | |
| 59 document.getElementById("output").appendChild(preElement); | |
| 60 } | |
| 61 | |
| 62 function printProfilesDataWithoutTime() | |
| 63 { | |
| 64 var preElement = document.createElement("pre"); | |
| 65 preElement.appendChild(document.createTextNode("\n")); | |
| 66 | |
| 67 var profiles = console.profiles; | |
| 68 for (var i = 0; i < profiles.length; ++i) { | |
| 69 preElement.appendChild(document.createTextNode("Profile title: " + profi
les[i].title + "\n")); | |
| 70 printProfileNodeWithoutTime(preElement, profiles[i].head, 0); | |
| 71 preElement.appendChild(document.createTextNode("\n")); | |
| 72 } | |
| 73 | |
| 74 document.getElementById("output").appendChild(preElement); | |
| 75 } | |
| 76 | |
| 77 function printProfileNodeWithoutTime(preElement, node, indentLevel) | |
| 78 { | |
| 79 if (node.functionName == "(idle)") | |
| 80 return; | |
| 81 | |
| 82 if (!node.visible) | |
| 83 return; | |
| 84 | |
| 85 var space = ""; | |
| 86 for (var i = 0; i < indentLevel; ++i) | |
| 87 space += " " | |
| 88 | |
| 89 ++indentLevel; | |
| 90 | |
| 91 var strippedURL = node.url.replace(/.*\//, ""); | |
| 92 if (!strippedURL) | |
| 93 strippedURL = "(no file)"; | |
| 94 | |
| 95 var line = space + node.functionName + " " + strippedURL + " (line " + node.
lineNumber + ")\n"; | |
| 96 preElement.appendChild(document.createTextNode(line)); | |
| 97 | |
| 98 var children = node.children(); | |
| 99 for (var i = 0; i < children.length; ++i) | |
| 100 printProfileNodeWithoutTime(preElement, children[i], indentLevel); | |
| 101 } | |
| OLD | NEW |