blob: 777489e10941ff489ef8f1cc09abc71368e0e0b6 [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");
for (var scriptId in WebInspector.debuggerModel.scripts) {
var script = WebInspector.debuggerModel.scripts[scriptId];
if (script.sourceURL && script.sourceURL.indexOf(testName) !== -1 && script.lineOffset == 6) {
var location = new WebInspector.DebuggerModel.Location(script.scriptId, 6, 0);
var uiLocation = WebInspector.debuggerModel.rawLocationToUILocation(location);
WebInspector.panels.scripts.showUISourceCode(uiLocation.uiSourceCode);
var sourceFrame = WebInspector.panels.scripts.visibleView;
if (sourceFrame.loaded)
didShowScript(sourceFrame);
else
InspectorTest.addSniffer(sourceFrame, "onTextEditorContentLoaded", didShowScript.bind(null, sourceFrame));
return;
}
}
}
function didShowScript(sourceFrame)
{
InspectorTest.addResult("didShowScript");
var resourceText = sourceFrame._textModel.text;
var lines = resourceText.split("\n");
var callFrames = WebInspector.debuggerModel.callFrames;
InspectorTest.addResult("Source strings corresponding to the call stack:");
for (var i = 0; i < callFrames.length; i++) {
var frame = callFrames[i];
var lineNumber = frame.location.lineNumber;
InspectorTest.addResult("Frame " + i + ") line " + lineNumber + ", content: " + lines[lineNumber] + " (must be part of function '" + frame.functionName + "')");
}
InspectorTest.resumeExecution(didResume);
}
function uiSourceCodeAdded(uiSourceCode)
{
InspectorTest.addResult("uiSourceCodeAdded");
}
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>