| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="resources/profiler-test-JS-resources.js"></script> | |
| 4 <script> | |
| 5 if (window.testRunner) | |
| 6 testRunner.dumpAsText(); | |
| 7 if (window.internals) | |
| 8 internals.setJavaScriptProfilingEnabled(true); | |
| 9 | |
| 10 function anonymousFunctionGenerator(iterations) | |
| 11 { | |
| 12 var variableThatPointsToAnAnonymousFunction = function() | |
| 13 { | |
| 14 for (var i = 0; i < iterations; ++i) ; | |
| 15 } | |
| 16 | |
| 17 variableThatPointsToAnAnonymousFunction.displayName = iterations + " iterati
ons function"; | |
| 18 | |
| 19 return variableThatPointsToAnAnonymousFunction; | |
| 20 } | |
| 21 | |
| 22 function startTest() | |
| 23 { | |
| 24 console.profile("Anonymous functions with display names"); | |
| 25 | |
| 26 anonymousFunctionGenerator(0)(); | |
| 27 anonymousFunctionGenerator(1)(); | |
| 28 anonymousFunctionGenerator(2)(); | |
| 29 anonymousFunctionGenerator(20)(); | |
| 30 anonymousFunctionGenerator(1000)(); | |
| 31 | |
| 32 endTest(); | |
| 33 } | |
| 34 </script> | |
| 35 </head> | |
| 36 | |
| 37 <body onload="startTest()"> | |
| 38 This page's JavaScript calls anonymous functions with display names. | |
| 39 <br> | |
| 40 <br> | |
| 41 To run this test manually, load it in the browser then load the WebInspector and
look at | |
| 42 the profile. You should see functions named "[x] iterations function", and no a
nonymous functions. | |
| 43 <div id="output"></div> | |
| 44 </body> | |
| 45 </html> | |
| OLD | NEW |