- Revision
- 178232
- Author
- msab...@apple.com
- Date
- 2015-01-09 18:44:56 -0800 (Fri, 09 Jan 2015)
Log Message
Breakpoint doesn't fire in this HTML5 game
https://bugs.webkit.org/show_bug.cgi?id=140269
Reviewed by Mark Lam.
Source/_javascript_Core:
When parsing a single line cached function, use the lineStartOffset of the
location where we found the cached function instead of the cached lineStartOffset.
The cache location's lineStartOffset has not been adjusted for any possible
containing functions.
This change is not needed for multi-line cached functions. Consider the
single line source:
function outer(){function inner1(){doStuff();}; (function inner2() {doMoreStuff()})()}
The first parser pass, we parse and cache inner1() and inner2() with a lineStartOffset
of 0. Later when we parse outer() and find inner1() in the cache, SourceCode start
character is at outer()'s outermost open brace. That is what we should use for
lineStartOffset for inner1(). When done parsing inner1() we set the parsing token
to the saved location for inner1(), including the lineStartOffset of 0. We need
to use the value of lineStartOffset before we started parsing inner1(). That is
what the fix does. When we parse inner2() the lineStartOffset will be correct.
For a multi-line function, the close brace is guaranteed to be on a different line
than the open brace. Hence, its lineStartOffset will not change with the change of
the SourceCode start character
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseFunctionInfo):
LayoutTests:
New tests that set breakpoints in functions with various line split
combinations.
* inspector/debugger/breakpoint-columns-expected.txt: Added.
* inspector/debugger/breakpoint-columns.html: Added.
* inspector/debugger/resources/column-breakpoints-1.js: Added.
(columnTest1.x):
(columnTest1):
(columnTest2.x):
(columnTest2.f):
(columnTest3.x):
(columnTest3.f):
(runColumnTest1):
(runColumnTest2):
(runColumnTest3):
* inspector/debugger/resources/column-breakpoints-2.js: Added.
(columnTest4.x):
(columnTest4.f):
(columnTest5.x):
(columnTest5):
(runColumnTest4):
(runColumnTest5):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (178231 => 178232)
--- trunk/LayoutTests/ChangeLog 2015-01-10 02:12:01 UTC (rev 178231)
+++ trunk/LayoutTests/ChangeLog 2015-01-10 02:44:56 UTC (rev 178232)
@@ -1,3 +1,33 @@
+2015-01-09 Michael Saboff <msab...@apple.com>
+
+ Breakpoint doesn't fire in this HTML5 game
+ https://bugs.webkit.org/show_bug.cgi?id=140269
+
+ Reviewed by Mark Lam.
+
+ New tests that set breakpoints in functions with various line split
+ combinations.
+
+ * inspector/debugger/breakpoint-columns-expected.txt: Added.
+ * inspector/debugger/breakpoint-columns.html: Added.
+ * inspector/debugger/resources/column-breakpoints-1.js: Added.
+ (columnTest1.x):
+ (columnTest1):
+ (columnTest2.x):
+ (columnTest2.f):
+ (columnTest3.x):
+ (columnTest3.f):
+ (runColumnTest1):
+ (runColumnTest2):
+ (runColumnTest3):
+ * inspector/debugger/resources/column-breakpoints-2.js: Added.
+ (columnTest4.x):
+ (columnTest4.f):
+ (columnTest5.x):
+ (columnTest5):
+ (runColumnTest4):
+ (runColumnTest5):
+
2015-01-09 Zalan Bujtas <za...@apple.com>
Calling clearSelection on a detached RenderObject leads to segfault.
Added: trunk/LayoutTests/inspector/debugger/breakpoint-columns-expected.txt (0 => 178232)
--- trunk/LayoutTests/inspector/debugger/breakpoint-columns-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-columns-expected.txt 2015-01-10 02:44:56 UTC (rev 178232)
@@ -0,0 +1,19 @@
+CONSOLE MESSAGE: line 1: Paused at line: 0, column: 79
+CONSOLE MESSAGE: line 1: column test 1
+CONSOLE MESSAGE: line 1: Paused at line: 6, column: 21
+CONSOLE MESSAGE: line 7: column test 2
+CONSOLE MESSAGE: line 1: Paused at line: 15, column: 8
+CONSOLE MESSAGE: line 16: column test 3
+CONSOLE MESSAGE: line 1: Paused at line: 5, column: 8
+CONSOLE MESSAGE: line 6: column test 4
+CONSOLE MESSAGE: line 1: Paused at line: 11, column: 79
+CONSOLE MESSAGE: line 12: column test 5
+Testing that breakpoints can be set at various line / column combinations.
+
+Hit breakpoint at line: 0, column: 79
+Hit breakpoint at line: 6, column: 21
+Hit breakpoint at line: 15, column: 8
+Hit breakpoint at line: 5, column: 8
+Hit breakpoint at line: 11, column: 79
+Tests done
+
Added: trunk/LayoutTests/inspector/debugger/breakpoint-columns.html (0 => 178232)
--- trunk/LayoutTests/inspector/debugger/breakpoint-columns.html (rev 0)
+++ trunk/LayoutTests/inspector/debugger/breakpoint-columns.html 2015-01-10 02:44:56 UTC (rev 178232)
@@ -0,0 +1,91 @@
+<!doctype html>
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<script type="text/_javascript_" src=""
+<script type="text/_javascript_" src=""
+<script type="text/_javascript_" src=""
+<script>
+
+function test()
+{
+ var testInfoList = [
+ { scriptIndex : 0, line : 0, column : 79, startFunc : "runColumnTest1()" },
+ { scriptIndex : 0, line : 6, column : 21, startFunc : "runColumnTest2()" },
+ { scriptIndex : 0, line : 15, column : 8, startFunc : "runColumnTest3()" },
+ { scriptIndex : 1, line : 5, column : 8, startFunc : "runColumnTest4()" },
+ { scriptIndex : 1, line : 11, column : 79, startFunc : "runColumnTest5()" }
+ ]
+
+ var currentTestIndex = 0;
+ var scriptObject1, scriptObject2;
+ var currentScripts = [];
+
+ function runNextTestIfAllScriptsLoaded() {
+ if (scriptObject1 && scriptObject2) {
+ currentScripts = [scriptObject1, scriptObject2];
+ runNextTest();
+ }
+ }
+
+ function runNextTest() {
+ if (currentTestIndex >= testInfoList.length) {
+ InspectorTest.log("Tests done");
+ InspectorTest.completeTest();
+ return;
+ }
+
+ var testInfo = testInfoList[currentTestIndex];
+
+ var location = currentScripts[testInfo.scriptIndex].createSourceCodeLocation(testInfo.line, testInfo.column);
+ var breakpoint = new WebInspector.Breakpoint(location);
+
+ WebInspector.debuggerManager.addBreakpoint(breakpoint);
+
+ InspectorTest.evaluateInPage(testInfo.startFunc);
+
+ currentTestIndex++;
+ }
+
+ WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
+ var activeCallFrame = WebInspector.debuggerManager.activeCallFrame;
+
+ if (!activeCallFrame)
+ return;
+
+ var stopLocation = "line: " + activeCallFrame.sourceCodeLocation.lineNumber + ", column: " + activeCallFrame.sourceCodeLocation.columnNumber;
+
+ InspectorTest.log("Hit breakpoint at " + stopLocation);
+ InspectorTest.evaluateInPage("console.log('Paused at " + stopLocation + "')");
+
+ WebInspector.debuggerManager.resume();
+ });
+
+ WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
+ runNextTest();
+ });
+
+ WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
+ var scriptObject = event.data.script;
+
+ if (/column-breakpoints-1\.js$/.test(scriptObject.url)) {
+ scriptObject1 = scriptObject;
+ runNextTestIfAllScriptsLoaded();
+ return;
+ }
+
+ if (/column-breakpoints-2\.js$/.test(scriptObject.url)) {
+ scriptObject2 = scriptObject;
+ runNextTestIfAllScriptsLoaded();
+ return;
+ }
+ });
+
+ InspectorTest.reloadPage();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+ <p>Testing that breakpoints can be set at various line / column combinations.</p>
+</body>
+</html>
Added: trunk/LayoutTests/inspector/debugger/resources/column-breakpoints-1.js (0 => 178232)
--- trunk/LayoutTests/inspector/debugger/resources/column-breakpoints-1.js (rev 0)
+++ trunk/LayoutTests/inspector/debugger/resources/column-breakpoints-1.js 2015-01-10 02:44:56 UTC (rev 178232)
@@ -0,0 +1,27 @@
+function columnTest1(){var x=function(){setInterval(function(){})};(function(){console.log("column test 1")})()}
+// breakpoint set here ^ (0, 79)
+
+function columnTest2()
+{
+ var x=function(){setInterval(function(){})};
+ f = function() { console.log("column test 2"); }();
+// ^ breakpoint set here (6, 21)
+}
+
+function columnTest3()
+{
+ var x=function(){setInterval(function(){})};
+ f = function()
+ {
+ console.log("column test 3");
+// ^ breakpoint set here (15, 8)
+ }
+ f();
+}
+
+// Any edits of this file will necessitate a change to the breakpoint (line, column) coordinates
+// used in breakpoint-columns.html.
+
+function runColumnTest1() { setTimeout(columnTest1, 0); }
+function runColumnTest2() { setTimeout(columnTest2, 0); }
+function runColumnTest3() { setTimeout(columnTest3, 0); }
Added: trunk/LayoutTests/inspector/debugger/resources/column-breakpoints-2.js (0 => 178232)
--- trunk/LayoutTests/inspector/debugger/resources/column-breakpoints-2.js (rev 0)
+++ trunk/LayoutTests/inspector/debugger/resources/column-breakpoints-2.js 2015-01-10 02:44:56 UTC (rev 178232)
@@ -0,0 +1,20 @@
+function columnTest4()
+{
+ var x=function(){setInterval(function(){})};
+ f = function()
+ {
+ console.log("column test 4");
+// ^ breakpoint set here (5, 8)
+ }
+ f();
+}
+
+function columnTest5(){var x=function(){setInterval(function(){})};(function(){console.log("column test 5")})()}
+// breakpoint set here ^ (11, 79)
+
+
+// Any edits of this file will necessitate a change to the breakpoint (line, column) coordinates
+// used in breakpoint-columns.html.
+
+function runColumnTest4() { setTimeout(columnTest4, 0); }
+function runColumnTest5() { setTimeout(columnTest5, 0); }
Modified: trunk/Source/_javascript_Core/ChangeLog (178231 => 178232)
--- trunk/Source/_javascript_Core/ChangeLog 2015-01-10 02:12:01 UTC (rev 178231)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-01-10 02:44:56 UTC (rev 178232)
@@ -1,3 +1,35 @@
+2015-01-09 Michael Saboff <msab...@apple.com>
+
+ Breakpoint doesn't fire in this HTML5 game
+ https://bugs.webkit.org/show_bug.cgi?id=140269
+
+ Reviewed by Mark Lam.
+
+ When parsing a single line cached function, use the lineStartOffset of the
+ location where we found the cached function instead of the cached lineStartOffset.
+ The cache location's lineStartOffset has not been adjusted for any possible
+ containing functions.
+
+ This change is not needed for multi-line cached functions. Consider the
+ single line source:
+
+ function outer(){function inner1(){doStuff();}; (function inner2() {doMoreStuff()})()}
+
+ The first parser pass, we parse and cache inner1() and inner2() with a lineStartOffset
+ of 0. Later when we parse outer() and find inner1() in the cache, SourceCode start
+ character is at outer()'s outermost open brace. That is what we should use for
+ lineStartOffset for inner1(). When done parsing inner1() we set the parsing token
+ to the saved location for inner1(), including the lineStartOffset of 0. We need
+ to use the value of lineStartOffset before we started parsing inner1(). That is
+ what the fix does. When we parse inner2() the lineStartOffset will be correct.
+
+ For a multi-line function, the close brace is guaranteed to be on a different line
+ than the open brace. Hence, its lineStartOffset will not change with the change of
+ the SourceCode start character
+
+ * parser/Parser.cpp:
+ (JSC::Parser<LexerType>::parseFunctionInfo):
+
2015-01-09 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Uncaught Exception in ProbeManager deleting breakpoint
Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (178231 => 178232)
--- trunk/Source/_javascript_Core/parser/Parser.cpp 2015-01-10 02:12:01 UTC (rev 178231)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp 2015-01-10 02:44:56 UTC (rev 178232)
@@ -1324,6 +1324,7 @@
unsigned bodyEndColumn = endColumnIsOnStartLine ?
endLocation.startOffset - m_token.m_data.lineStartOffset :
endLocation.startOffset - endLocation.lineStartOffset;
+ unsigned currentLineStartOffset = m_token.m_location.lineStartOffset;
body = context.createFunctionBody(startLocation, endLocation, bodyStartColumn, bodyEndColumn, cachedInfo->strictMode);
@@ -1334,6 +1335,8 @@
context.setFunctionNameStart(body, functionNameStart);
m_token = cachedInfo->closeBraceToken();
+ if (endColumnIsOnStartLine)
+ m_token.m_location.lineStartOffset = currentLineStartOffset;
m_lexer->setOffset(m_token.m_location.endOffset, m_token.m_location.lineStartOffset);
m_lexer->setLineNumber(m_token.m_location.line);