| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | |
| 4 <script src="../../../http/tests/inspector/console-test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function jumpToMe() | |
| 8 { | |
| 9 var result = 12345; | |
| 10 return window.foo || result; | |
| 11 } | |
| 12 | |
| 13 function test() | |
| 14 { | |
| 15 var panel = WebInspector.panels.sources; | |
| 16 | |
| 17 InspectorTest.runTestSuite([ | |
| 18 function testRevealFunctionDefinition(next) | |
| 19 { | |
| 20 InspectorTest.addSniffer(panel, "showUISourceCode", showUISourceCode
Hook); | |
| 21 WebInspector.context.flavor(WebInspector.ExecutionContext).evaluate(
"jumpToMe", "", false, true, false, false, didGetFunction); | |
| 22 | |
| 23 function didGetFunction(funcObject, wasThrown) | |
| 24 { | |
| 25 var error = !funcObject || wasThrown; | |
| 26 InspectorTest.assertTrue(!error); | |
| 27 panel._showFunctionDefinition(funcObject); | |
| 28 } | |
| 29 | |
| 30 function showUISourceCodeHook(uiSourceCode, lineNumber, columnNumber
, forceShowInPanel) | |
| 31 { | |
| 32 // lineNumber and columnNumber are 0-based | |
| 33 ++lineNumber; | |
| 34 ++columnNumber; | |
| 35 InspectorTest.addResult("Function location revealed: [" + lineNu
mber + ":" + columnNumber + "]"); | |
| 36 next(); | |
| 37 } | |
| 38 }, | |
| 39 | |
| 40 function testDumpFunctionDefinition(next) | |
| 41 { | |
| 42 InspectorTest.addSniffer(WebInspector.ObjectPropertiesSection, "form
atObjectAsFunction", onConsoleMessagesReceived); | |
| 43 WebInspector.ConsoleModel.evaluateCommandInConsole(WebInspector.cont
ext.flavor(WebInspector.ExecutionContext), "jumpToMe"); | |
| 44 | |
| 45 function onConsoleMessagesReceived() | |
| 46 { | |
| 47 InspectorTest.runAfterPendingDispatches(function() { | |
| 48 var messages = []; | |
| 49 InspectorTest.disableConsoleViewport(); | |
| 50 var viewMessages = WebInspector.ConsolePanel._view()._visibl
eViewMessages; | |
| 51 for (var i = 0; i < viewMessages.length; ++i) { | |
| 52 var uiMessage = viewMessages[i]; | |
| 53 var element = uiMessage.contentElement(); | |
| 54 messages.push(element.deepTextContent()); | |
| 55 } | |
| 56 InspectorTest.addResult(messages.join("\n")); | |
| 57 next(); | |
| 58 }); | |
| 59 } | |
| 60 } | |
| 61 ]); | |
| 62 } | |
| 63 | |
| 64 </script> | |
| 65 </head> | |
| 66 | |
| 67 <body onload="runTest()"> | |
| 68 <p> | |
| 69 Tests that "Show Function Definition" jumps to the correct location. | |
| 70 </p> | |
| 71 | |
| 72 </body> | |
| 73 </html> | |
| OLD | NEW |