blob: 71af5380f7d98e1707b5732d46966e74f69410fe [file] [log] [blame]
<html>
<head>
<script>function foo() { };
</script>
<script>
function bar() { };
</script><script>function f1() { debugger; }</script>
<script>
function f2() { return f1(); }
</script>
<script>
function f3()
{
return f2();
}
f3();
</script>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/debugger-test.js"></script>
<script>
var test = function()
{
var testName = WebInspector.inspectedPageURL;
testName = testName.substring(testName.lastIndexOf('/') + 1);
InspectorTest.startDebuggerTest(step1);
function step1()
{
InspectorTest.addResult("Did load front-end");
InspectorTest.addResult("Paused: " + !!WebInspector.debuggerModel.debuggerPausedDetails());
InspectorTest.reloadPage(didReload.bind(this));
WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, didPauseAfterReload, this);
}
function didReload()
{
InspectorTest.addResult("didReload");
InspectorTest.completeDebuggerTest();
}
function didPauseAfterReload(details)
{
InspectorTest.addResult("didPauseAfterReload");
InspectorTest.addResult("Source strings corresponding to the call stack:");
dumpNextCallFrame(didDump);
}
var callFrameIndex = 0;
function dumpNextCallFrame(next)
{
var callFrames = WebInspector.debuggerModel.callFrames;
if (callFrameIndex === callFrames.length) {
next();
return;
}
var frame = callFrames[callFrameIndex];
var uiLocation = WebInspector.debuggerModel.rawLocationToUILocation(frame.location);
InspectorTest.showUISourceCode(uiLocation.uiSourceCode, dumpCallFrameLine);
function dumpCallFrameLine(sourceFrame)
{
var resourceText = sourceFrame._textEditor.text();
var lines = resourceText.split("\n");
var lineNumber = uiLocation.lineNumber;
InspectorTest.addResult("Frame " + callFrameIndex + ") line " + lineNumber + ", content: " + lines[lineNumber] + " (must be part of function '" + frame.functionName + "')");
callFrameIndex++
dumpNextCallFrame(next);
}
}
function uiSourceCodeAdded(uiSourceCode)
{
InspectorTest.addResult("uiSourceCodeAdded");
}
function didDump()
{
InspectorTest.resumeExecution(didResume);
}
function didResume()
{
InspectorTest.addResult("didResume");
}
};
</script>
</head>
<body onload="runTest()">
<p>
Tests that main resource script text is correct when paused in inline script on reload.
<a href="https://bugs.webkit.org/show_bug.cgi?id=77548">Bug 77548.</a>
</p>
</body>
</html>