Emit the WillExecuteStatement debugger hook before the "else" body when there is...
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Oct 2008 15:02:31 +0000 (15:02 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Oct 2008 15:02:31 +0000 (15:02 +0000)
JavaScriptCore:

2008-10-28  Timothy Hatcher  <timothy@apple.com>

        Emit the WillExecuteStatement debugger hook before the "else" body
        when there is no block for the "else" body. This allows breakpoints
        on those statements in the Web Inspector.

        https://bugs.webkit.org/show_bug.cgi?id=21944

        Reviewed by Maciej Stachowiak.

        * kjs/nodes.cpp:
        (JSC::IfElseNode::emitCode): Emit the WillExecuteStatement
        debugger hook before the else node if isn't a block.

WebCore:

2008-10-28  Timothy Hatcher  <timothy@apple.com>

        Add a manual test that checks breakpoints on a blockless body of
        an "else" statement.

        https://bugs.webkit.org/show_bug.cgi?id=21944

        Reviewed by Maciej Stachowiak.

        * manual-tests/inspector/debugger-pause-on-else-statements.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@37972 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/nodes.cpp
WebCore/ChangeLog
WebCore/manual-tests/inspector/debugger-pause-on-else-statements.html [new file with mode: 0644]

index f8109d6..473f90f 100644 (file)
@@ -1,3 +1,17 @@
+2008-10-29  Timothy Hatcher  <timothy@apple.com>
+
+        Emit the WillExecuteStatement debugger hook before the "else" body
+        when there is no block for the "else" body. This allows breakpoints
+        on those statements in the Web Inspector.
+
+        https://bugs.webkit.org/show_bug.cgi?id=21944
+
+        Reviewed by Maciej Stachowiak.
+
+        * kjs/nodes.cpp:
+        (JSC::IfElseNode::emitCode): Emit the WillExecuteStatement
+        debugger hook before the else node if isn't a block.
+
 2008-10-29  Alexey Proskuryakov  <ap@webkit.org>
 
         Build fix.
index db8bd5f..a5757aa 100644 (file)
@@ -1158,6 +1158,10 @@ RegisterID* IfElseNode::emitCode(CodeGenerator& generator, RegisterID* dst)
     generator.emitJump(afterElse.get());
 
     generator.emitLabel(beforeElse.get());
+
+    if (!m_elseBlock->isBlock())
+        generator.emitDebugHook(WillExecuteStatement, m_elseBlock->firstLine(), m_elseBlock->lastLine());
+
     generator.emitNode(dst, m_elseBlock.get());
 
     generator.emitLabel(afterElse.get());
index 2481ac9..3c488fe 100644 (file)
@@ -1,3 +1,14 @@
+2008-10-29  Timothy Hatcher  <timothy@apple.com>
+
+        Add a manual test that checks breakpoints on a blockless body of
+        an "else" statement.
+
+        https://bugs.webkit.org/show_bug.cgi?id=21944
+
+        Reviewed by Maciej Stachowiak.
+
+        * manual-tests/inspector/debugger-pause-on-else-statements.html: Added.
+
 2008-10-29  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/manual-tests/inspector/debugger-pause-on-else-statements.html b/WebCore/manual-tests/inspector/debugger-pause-on-else-statements.html
new file mode 100644 (file)
index 0000000..424fb7e
--- /dev/null
@@ -0,0 +1,18 @@
+<script>
+function test()
+{
+    debugger;
+}
+
+if (false)
+    debugger; // This should not be hit.
+else
+    test();
+</script>
+
+Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=21944">Bug 21944: Can't set a breakpoint on the statement after a single line "else"</a>.
+<br><br>
+Start a debugging session in the Web Inspector and open this file. When the debugger breaks, select the (program) node
+in the call stack, you should see the execution line on the call to test().
+<br><br>
+Also set a breakpoint on the call to test(), and reload. It should break before the test() function is called.