3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/console-test.js"></script>
10 return window
.foo
|| result
;
15 var panel
= WebInspector
.panels
.sources
;
17 InspectorTest
.runTestSuite([
18 function testRevealFunctionDefinition(next
)
20 InspectorTest
.addSniffer(panel
, "showUISourceCode", showUISourceCodeHook
);
21 WebInspector
.context
.flavor(WebInspector
.ExecutionContext
).evaluate("jumpToMe", "", false, true, false, false, didGetFunction
);
23 function didGetFunction(funcObject
, wasThrown
)
25 var error
= !funcObject
|| wasThrown
;
26 InspectorTest
.assertTrue(!error
);
27 panel
._showFunctionDefinition(funcObject
);
30 function showUISourceCodeHook(uiSourceCode
, lineNumber
, columnNumber
, forceShowInPanel
)
32 // lineNumber and columnNumber are 0-based
35 InspectorTest
.addResult("Function location revealed: [" + lineNumber
+ ":" + columnNumber
+ "]");
40 function testDumpFunctionDefinition(next
)
42 InspectorTest
.addSniffer(WebInspector
.ObjectPropertiesSection
, "formatObjectAsFunction", onConsoleMessagesReceived
);
43 WebInspector
.ConsoleModel
.evaluateCommandInConsole(WebInspector
.context
.flavor(WebInspector
.ExecutionContext
), "jumpToMe");
45 function onConsoleMessagesReceived()
47 InspectorTest
.runAfterPendingDispatches(function() {
49 InspectorTest
.disableConsoleViewport();
50 var viewMessages
= WebInspector
.ConsolePanel
._view()._visibleViewMessages
;
51 for (var i
= 0; i
< viewMessages
.length
; ++i
) {
52 var uiMessage
= viewMessages
[i
];
53 var element
= uiMessage
.contentElement();
54 messages
.push(element
.deepTextContent());
56 InspectorTest
.addResult(messages
.join("\n"));
67 <body onload=
"runTest()">
69 Tests that
"Show Function Definition" jumps to the correct location.