Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Web Inspector: debugger reports wrong sources when paused in inline s…
…cript on page reload https://bugs.webkit.org/show_bug.cgi?id=77548 Source/WebCore: V8 returns treats each script source as ending with \n, now we take this into account when reporting script line count to the inspector front-end. Reviewed by Vsevolod Vlasov. Test: inspector/debugger/pause-in-inline-script.html * bindings/js/ScriptDebugServer.cpp: (WebCore::ScriptDebugServer::dispatchDidParseSource): * bindings/v8/DebuggerScript.js: LayoutTests: Reviewed by Vsevolod Vlasov. * inspector/debugger/debugger-scripts-expected.txt: * inspector/debugger/pause-in-inline-script-expected.txt: Added. * inspector/debugger/pause-in-inline-script.html: Added. * platform/chromium/inspector/debugger/debugger-scripts-expected.txt: Canonical link: https://commits.webkit.org/94422@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106468 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
8 changed files
with
156 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,19 @@ | ||
Tests that main resource script text is correct when paused in inline script on reload. Bug 77548. | ||
|
||
Debugger was enabled. | ||
Did load front-end | ||
Paused: false | ||
didPauseAfterReload | ||
Script execution paused. | ||
didShowScript | ||
Source strings corresponding to the call stack: | ||
Frame 0) line 6, content: </script><script>function f1() { debugger; }</script> (must be part of function 'f1') | ||
Frame 1) line 8, content: function f2() { return f1(); } (must be part of function 'f2') | ||
Frame 2) line 14, content: return f2(); (must be part of function 'f3') | ||
Frame 3) line 16, content: f3(); (must be part of function '') | ||
Script execution resumed. | ||
didResume | ||
Page reloaded. | ||
didReload | ||
Debugger was disabled. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,89 @@ | ||
<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.showScriptSource(testName, didShowScript.bind(this)); | ||
} | ||
|
||
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters