Title: [158117] branches/safari-537.73-branch
Revision
158117
Author
[email protected]
Date
2013-10-28 11:31:16 -0700 (Mon, 28 Oct 2013)

Log Message

Merge r155471.
https://bugs.webkit.org/show_bug.cgi?id=123409.

Reviewed by Geoffrey Garen.

Source/_javascript_Core: 

Re-implemented fix based on the frame iteration mechanhism before the
StackVisitor was available.

    2013-09-10  Joseph Pecoraro  <[email protected]>

    Web Inspector: [JSC] Caught exception is treated as uncaught
    https://bugs.webkit.org/show_bug.cgi?id=93607

    Reviewed by Geoff Garen.

    Check up the entire call stack to see if there is an exception handler.

    * interpreter/Interpreter.cpp:
    (JSC::GetExceptionHandlerFunctor::GetExceptionHandlerFunctor):
    (JSC::GetExceptionHandlerFunctor::handler):
    (JSC::GetExceptionHandlerFunctor::operator()):

LayoutTests: 

Re-based test results from merge.

* http/tests/inspector-protocol/resources/InspectorTest.js:
(InspectorTest.checkForError): This is needed for the merged tests.

    2013-09-10  Joseph Pecoraro  <[email protected]>

    Web Inspector: [JSC] Caught exception is treated as uncaught
    https://bugs.webkit.org/show_bug.cgi?id=93607

    Reviewed by Geoff Garen.

    Add tests for different inspector pause on exceptions states.

    * inspector-protocol/debugger/resources/exception.js: Added.
    * inspector-protocol/debugger/setPauseOnExceptions-all-expected.txt: Added.
    * inspector-protocol/debugger/setPauseOnExceptions-all.html: Added.
    * inspector-protocol/debugger/setPauseOnExceptions-none-expected.txt: Added.
    * inspector-protocol/debugger/setPauseOnExceptions-none.html: Added.
    * inspector-protocol/debugger/setPauseOnExceptions-uncaught-expected.txt: Added.
    * inspector-protocol/debugger/setPauseOnExceptions-uncaught.html: Added.

Modified Paths

Added Paths

Property Changed

Diff

Property changes: branches/safari-537.73-branch


Modified: svn:mergeinfo

+ /trunk:53455,153629,155471

Modified: branches/safari-537.73-branch/LayoutTests/ChangeLog (158116 => 158117)


--- branches/safari-537.73-branch/LayoutTests/ChangeLog	2013-10-28 18:03:38 UTC (rev 158116)
+++ branches/safari-537.73-branch/LayoutTests/ChangeLog	2013-10-28 18:31:16 UTC (rev 158117)
@@ -1,3 +1,32 @@
+2013-10-28  Mark Lam  <[email protected]>
+
+        Merge r155471.
+        https://bugs.webkit.org/show_bug.cgi?id=123409.
+
+        Reviewed by Geoffrey Garen.
+
+        Re-based test results from merge.
+
+        * http/tests/inspector-protocol/resources/InspectorTest.js:
+        (InspectorTest.checkForError): This is needed for the merged tests.
+
+    2013-09-10  Joseph Pecoraro  <[email protected]>
+
+            Web Inspector: [JSC] Caught exception is treated as uncaught
+            https://bugs.webkit.org/show_bug.cgi?id=93607
+
+            Reviewed by Geoff Garen.
+
+            Add tests for different inspector pause on exceptions states.
+
+            * inspector-protocol/debugger/resources/exception.js: Added.
+            * inspector-protocol/debugger/setPauseOnExceptions-all-expected.txt: Added.
+            * inspector-protocol/debugger/setPauseOnExceptions-all.html: Added.
+            * inspector-protocol/debugger/setPauseOnExceptions-none-expected.txt: Added.
+            * inspector-protocol/debugger/setPauseOnExceptions-none.html: Added.
+            * inspector-protocol/debugger/setPauseOnExceptions-uncaught-expected.txt: Added.
+            * inspector-protocol/debugger/setPauseOnExceptions-uncaught.html: Added.
+
 2013-10-25  Lucas Forschler  <[email protected]>
 
         Merge r156214

Modified: branches/safari-537.73-branch/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js (158116 => 158117)


--- branches/safari-537.73-branch/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js	2013-10-28 18:03:38 UTC (rev 158116)
+++ branches/safari-537.73-branch/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js	2013-10-28 18:31:16 UTC (rev 158117)
@@ -89,6 +89,14 @@
     this.sendCommand("Runtime.evaluate", { "_expression_": "closeTest();"} );
 }
 
+InspectorTest.checkForError = function(responseObject)
+{
+    if (responseObject.error) {
+        InspectorTest.log("PROTOCOL ERROR: " + responseObject.error.message);
+        InspectorTest.completeTest();
+        throw "PROTOCOL ERROR";
+    }
+}
 
 /**
  * @param {string} scriptName

Copied: branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all-expected.txt (from rev 155471, trunk/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all-expected.txt) (0 => 158117)


--- branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all-expected.txt	                        (rev 0)
+++ branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all-expected.txt	2013-10-28 18:31:16 UTC (rev 158117)
@@ -0,0 +1,52 @@
+CONSOLE MESSAGE: line 1: caught inline: {"stack":"","line":1}
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"stack":"[email protected]"}
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"code":8,"message":"NotFoundError: DOM Exception 8","name":"NotFoundError","stack":"appendChild@[native code]\[email protected]"}
+CONSOLE MESSAGE: line 38: catchNested caught exception: "exception in host function"
+CONSOLE MESSAGE: line 38: catchNested caught exception: "exception string"
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"line":18,"sourceURL":"exception.js:33:26\n"}
+CONSOLE MESSAGE: line 1: TypeError: 'undefined' is not an object (evaluating '({}).a.b')
+CONSOLE MESSAGE: line 3: TypeError: 'undefined' is not an object (evaluating '({}).a.b')
+CONSOLE MESSAGE: line 8: NotFoundError: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist.
+CONSOLE MESSAGE: exception in host function
+CONSOLE MESSAGE: exception string
+CONSOLE MESSAGE: line 18: [object Object]
+CONSOLE MESSAGE: line 18: Error: error message
+Debugger.setPauseOnExceptions all
+
+Breakpoints Enabled
+Debugger.setPauseOnExceptions - all
+PASS - did not pause on non-exception statements
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+PASS - paused for each caught exception
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+PASS - paused for each uncaught exception
+PASS - did not pause on non-exception statements
+

Copied: branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all.html (from rev 155471, trunk/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all.html) (0 => 158117)


--- branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all.html	                        (rev 0)
+++ branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-all.html	2013-10-28 18:31:16 UTC (rev 158117)
@@ -0,0 +1,141 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function test()
+{
+    var expectPause = true;
+
+    var statementsWithoutExceptions = [
+        "1+1;",
+        "noException();",
+        "catchNested(noException, 7);"
+    ];
+
+    var currentCaughtExceptionStatement = 0;
+    var statementsWithCaughtExceptions = [
+        "try{ ({}).a.b.c.d } catch (e) { console.log('caught inline: ' + JSON.stringify(e)); }",
+        "catchNested(exceptionBasic, 1);",
+        "catchNested(exceptionDOM, 2);",
+        "catchNested(exceptionInHostFunction, 3);",
+        "catchNested(throwString, 10);",
+        "catchNested(throwParam, 5, new Error('error message'));"
+    ];
+
+    var currentUncaughtExceptionStatement = 0;
+    var statementsWithUncaughtExceptions = [
+        "({}).a.b.c.d;",
+        "exceptionBasic();",
+        "exceptionDOM();",
+        "exceptionInHostFunction();",
+        "throwString();",
+        "throwParam({x:1});",
+        "throwParam(new Error('error message'));"
+    ];
+
+    // FIXME: <https://webkit.org/b/121108> Web Inspector gets paused twice when there is an exception in host function
+    var extraCaughtExceptionPauses = 1;
+    var extraUncaughtExceptionPauses = 1;
+
+    function evaluateStatements(list, callback)
+    {
+        for (var i = 0; i < list.length; ++i) {
+            var statement = list[i];
+            var last = i === list.length - 1;
+            var responseCallback = last ? function() { setTimeout(callback, 10); } : function(){};
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { " + statement + " }, 0);"}, responseCallback);
+        }
+    }
+
+    function evaluateExpectedNoPauses(callback)
+    {
+        var statements = statementsWithoutExceptions;
+        evaluateStatements(statements, function() {
+            InspectorTest.log("PASS - did not pause on non-exception statements");
+            callback();
+        });
+    }
+
+
+    var triggerNext = triggerNextCaughtException;
+
+    function triggerNextCaughtException()
+    {
+        // Evaluate statement and expect to pause.
+        if (currentCaughtExceptionStatement < statementsWithCaughtExceptions.length) {
+            var statement = statementsWithCaughtExceptions[currentCaughtExceptionStatement++];
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { " + statement + " }, 0);"});
+            return;
+        }
+
+        // FIXME: <https://webkit.org/b/121108> Web Inspector gets paused twice when there is an exception in host function
+        if (extraCaughtExceptionPauses-- > 0)
+            return;
+
+        // Done evaluating caught exceptions statements. Move on to uncaught exceptions.
+        InspectorTest.log("PASS - paused for each caught exception");
+        triggerNext = triggerNextUncaughtException;
+        triggerNext();
+    }
+
+    function triggerNextUncaughtException()
+    {
+        // Evaluate statement and expect to pause.
+        if (currentUncaughtExceptionStatement < statementsWithUncaughtExceptions.length) {
+            var statement = statementsWithUncaughtExceptions[currentUncaughtExceptionStatement++];
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { " + statement + " }, 0);"});
+            return;
+        }
+
+        // FIXME: <https://webkit.org/b/121108> Web Inspector gets paused twice when there is an exception in host function
+        if (extraUncaughtExceptionPauses-- > 0)
+            return;
+
+        // Done evaluating statements to pause. Evaluate some more we do not expect to pause.
+        InspectorTest.log("PASS - paused for each uncaught exception");
+        expectPause = false;
+        evaluateExpectedNoPauses(function() {
+            InspectorTest.completeTest();
+        });
+    }
+
+
+    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorTest.sendCommand("Debugger.setBreakpointsActive", {active: true}, function() {
+        InspectorTest.log("Breakpoints Enabled");
+        InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, function(responseObject) {
+            InspectorTest.checkForError(responseObject);
+            InspectorTest.log("Debugger.setPauseOnExceptions - all");
+            evaluateExpectedNoPauses(function() {
+                expectPause = true;
+                triggerNext();
+            });
+        });
+    });
+
+    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    {
+        InspectorTest.log("Paused!");
+
+        if (!expectPause) {
+            InspectorTest.log("FAIL - debugger paused when we did not expect to");
+            InspectorTest.completeTest();
+            return;
+        }
+
+        InspectorTest.sendCommand("Debugger.resume", {});
+    }
+
+    InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+    {
+        InspectorTest.log("Resumed");
+        triggerNext();
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Debugger.setPauseOnExceptions all</p>
+</body>
+</html>

Copied: branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-none-expected.txt (from rev 155471, trunk/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-none-expected.txt) (0 => 158117)


--- branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-none-expected.txt	                        (rev 0)
+++ branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-none-expected.txt	2013-10-28 18:31:16 UTC (rev 158117)
@@ -0,0 +1,18 @@
+CONSOLE MESSAGE: line 1: caught inline: {"stack":"","line":1}
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"stack":"[email protected]"}
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"code":8,"message":"NotFoundError: DOM Exception 8","name":"NotFoundError","stack":"appendChild@[native code]\[email protected]"}
+CONSOLE MESSAGE: line 38: catchNested caught exception: "exception in host function"
+CONSOLE MESSAGE: line 38: catchNested caught exception: "exception string"
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"line":18,"sourceURL":"exception.js:33:26\n"}
+CONSOLE MESSAGE: line 3: TypeError: 'undefined' is not an object (evaluating '({}).a.b')
+CONSOLE MESSAGE: line 9: NotFoundError: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist.
+CONSOLE MESSAGE: line 24: exception in host function
+CONSOLE MESSAGE: line 13: exception string
+CONSOLE MESSAGE: line 18: [object Object]
+CONSOLE MESSAGE: line 18: Error: error message
+Debugger.setPauseOnExceptions none
+
+Breakpoints Enabled
+Debugger.setPauseOnExceptions - none
+PASS: No pauses
+

Copied: branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-none.html (from rev 155471, trunk/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-none.html) (0 => 158117)


--- branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-none.html	                        (rev 0)
+++ branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-none.html	2013-10-28 18:31:16 UTC (rev 158117)
@@ -0,0 +1,50 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function test()
+{
+    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorTest.sendCommand("Debugger.setBreakpointsActive", {active: true}, function() {
+        InspectorTest.log("Breakpoints Enabled");
+        InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "none"}, function(responseObject) {
+            InspectorTest.checkForError(responseObject);
+            InspectorTest.log("Debugger.setPauseOnExceptions - none");
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { 1+1; }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { noException(); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { catchNested(noException, 7); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { try{ ({}).a.b.c.d } catch (e) { console.log('caught inline: ' + JSON.stringify(e)); } }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { catchNested(exceptionBasic, 1); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { catchNested(exceptionDOM, 2); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { catchNested(exceptionInHostFunction, 3); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { catchNested(throwString, 10); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { catchNested(throwParam, 5, new Error('error message')); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { {}.a.b.c.d; }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { exceptionBasic(); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { exceptionDOM(); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { exceptionInHostFunction(); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { throwString(); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { throwParam({x:1}); }, 0);"});
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { throwParam(new Error('error message')); }, 0);"}, function() {
+                setTimeout(function() {
+                    InspectorTest.log("PASS: No pauses");
+                    InspectorTest.completeTest();
+                }, 10);
+            });
+        });
+    });
+
+    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    {
+        InspectorTest.log("Paused!");
+        InspectorTest.log("FAIL");
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Debugger.setPauseOnExceptions none</p>
+</body>
+</html>

Copied: branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught-expected.txt (from rev 155471, trunk/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught-expected.txt) (0 => 158117)


--- branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught-expected.txt	                        (rev 0)
+++ branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught-expected.txt	2013-10-28 18:31:16 UTC (rev 158117)
@@ -0,0 +1,44 @@
+CONSOLE MESSAGE: line 1: caught inline: {"stack":"","line":1}
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"stack":"[email protected]"}
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"code":8,"message":"NotFoundError: DOM Exception 8","name":"NotFoundError","stack":"appendChild@[native code]\[email protected]"}
+CONSOLE MESSAGE: line 38: catchNested caught exception: "exception in host function"
+CONSOLE MESSAGE: line 38: catchNested caught exception: "exception string"
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"line":18,"sourceURL":"exception.js:33:26\n"}
+CONSOLE MESSAGE: line 1: TypeError: 'undefined' is not an object (evaluating '({}).a.b')
+CONSOLE MESSAGE: line 3: TypeError: 'undefined' is not an object (evaluating '({}).a.b')
+CONSOLE MESSAGE: line 8: NotFoundError: DOM Exception 8: An attempt was made to reference a Node in a context where it does not exist.
+CONSOLE MESSAGE: exception in host function
+CONSOLE MESSAGE: exception string
+CONSOLE MESSAGE: line 18: [object Object]
+CONSOLE MESSAGE: line 18: Error: error message
+CONSOLE MESSAGE: line 1: caught inline: {"stack":"","line":1}
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"stack":"[email protected]"}
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"code":8,"message":"NotFoundError: DOM Exception 8","name":"NotFoundError","stack":"appendChild@[native code]\[email protected]"}
+CONSOLE MESSAGE: line 38: catchNested caught exception: "exception in host function"
+CONSOLE MESSAGE: line 38: catchNested caught exception: "exception string"
+CONSOLE MESSAGE: line 38: catchNested caught exception: {"line":18,"sourceURL":"exception.js:33:26\n"}
+Debugger.setPauseOnExceptions uncaught
+
+Breakpoints Enabled
+Debugger.setPauseOnExceptions - uncaught
+PASS - did not pause on non-exception statements or caught exception statements
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+Paused!
+Resumed
+PASS - paused for each uncaught exception
+PASS - did not pause on non-exception statements or caught exception statements
+PASS
+

Copied: branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught.html (from rev 155471, trunk/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught.html) (0 => 158117)


--- branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught.html	                        (rev 0)
+++ branches/safari-537.73-branch/LayoutTests/inspector-protocol/debugger/setPauseOnExceptions-uncaught.html	2013-10-28 18:31:16 UTC (rev 158117)
@@ -0,0 +1,118 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function test()
+{
+    var expectPause = false;
+
+    var statementsWithoutExceptions = [
+        "1+1;",
+        "noException();",
+        "catchNested(noException, 7);"
+    ];
+
+    var statementsWithCaughtExceptions = [
+        "try{ ({}).a.b.c.d } catch (e) { console.log('caught inline: ' + JSON.stringify(e)); }",
+        "catchNested(exceptionBasic, 1);",
+        "catchNested(exceptionDOM, 2);",
+        "catchNested(exceptionInHostFunction, 3);",
+        "catchNested(throwString, 10);",
+        "catchNested(throwParam, 5, new Error('error message'));"
+    ];
+
+    var currentUncaughtExceptionStatement = 0;
+    var statementsWithUncaughtExceptions = [
+        "({}).a.b.c.d;",
+        "exceptionBasic();",
+        "exceptionDOM();",
+        "exceptionInHostFunction();",
+        "throwString();",
+        "throwParam({x:1});",
+        "throwParam(new Error('error message'));"
+    ];
+
+    // FIXME: <https://webkit.org/b/121108> Web Inspector gets paused twice when there is an exception in host function
+    var extraPauses = 1;
+
+    function evaluateStatements(list, callback)
+    {
+        for (var i = 0; i < list.length; ++i) {
+            var statement = list[i];
+            var last = i === list.length - 1;
+            var responseCallback = last ? function() { setTimeout(callback, 10); } : function(){};
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { " + statement + " }, 0);"}, responseCallback);
+        }
+    }
+
+    function evaluateExpectedNoPauses(callback)
+    {
+        var statements = statementsWithoutExceptions.concat(statementsWithCaughtExceptions);
+        evaluateStatements(statements, function() {
+            InspectorTest.log("PASS - did not pause on non-exception statements or caught exception statements");
+            callback();
+        });
+    }
+
+    function triggerNextUncaughtException()
+    {
+        // Evaluate statement and expect to pause.
+        if (currentUncaughtExceptionStatement < statementsWithUncaughtExceptions.length) {
+            var statement = statementsWithUncaughtExceptions[currentUncaughtExceptionStatement++];
+            InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "setTimeout(function() { " + statement + " }, 0);"});
+            return;
+        }
+
+        // FIXME: <https://webkit.org/b/121108> Web Inspector gets paused twice when there is an exception in host function
+        if (extraPauses-- > 0)
+            return;
+
+        // Done evaluating statements to pause. Evaluate some more we do not expect to pause.
+        InspectorTest.log("PASS - paused for each uncaught exception");
+        expectPause = false;
+        evaluateExpectedNoPauses(function() {
+            InspectorTest.log("PASS");
+            InspectorTest.completeTest();
+        });
+    }
+
+
+    InspectorTest.sendCommand("Debugger.enable", {});
+    InspectorTest.sendCommand("Debugger.setBreakpointsActive", {active: true}, function() {
+        InspectorTest.log("Breakpoints Enabled");
+        InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "uncaught"}, function(responseObject) {
+            InspectorTest.checkForError(responseObject);
+            InspectorTest.log("Debugger.setPauseOnExceptions - uncaught");
+            evaluateExpectedNoPauses(function() {
+                expectPause = true;
+                triggerNextUncaughtException();
+            });
+        });
+    });
+
+    InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
+    {
+        InspectorTest.log("Paused!");
+
+        if (!expectPause) {
+            InspectorTest.log("FAIL - debugger paused when we did not expect to");
+            InspectorTest.completeTest();
+            return;
+        }
+
+        InspectorTest.sendCommand("Debugger.resume", {});
+    }
+
+    InspectorTest.eventHandler["Debugger.resumed"] = function(messageObject)
+    {
+        InspectorTest.log("Resumed");
+        triggerNextUncaughtException();
+    }
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Debugger.setPauseOnExceptions uncaught</p>
+</body>
+</html>

Modified: branches/safari-537.73-branch/Source/_javascript_Core/ChangeLog (158116 => 158117)


--- branches/safari-537.73-branch/Source/_javascript_Core/ChangeLog	2013-10-28 18:03:38 UTC (rev 158116)
+++ branches/safari-537.73-branch/Source/_javascript_Core/ChangeLog	2013-10-28 18:31:16 UTC (rev 158117)
@@ -1,3 +1,27 @@
+2013-10-28  Mark Lam  <[email protected]>
+
+        Merge r155471.
+        https://bugs.webkit.org/show_bug.cgi?id=123409.
+
+        Reviewed by Geoffrey Garen.
+
+        Re-implemented fix based on the frame iteration mechanhism before the
+        StackVisitor was available.
+
+    2013-09-10  Joseph Pecoraro  <[email protected]>
+
+            Web Inspector: [JSC] Caught exception is treated as uncaught
+            https://bugs.webkit.org/show_bug.cgi?id=93607
+
+            Reviewed by Geoff Garen.
+
+            Check up the entire call stack to see if there is an exception handler.
+
+            * interpreter/Interpreter.cpp:
+            (JSC::GetExceptionHandlerFunctor::GetExceptionHandlerFunctor):
+            (JSC::GetExceptionHandlerFunctor::handler):
+            (JSC::GetExceptionHandlerFunctor::operator()):
+
 2013-10-25  Lucas Forschler  <[email protected]>
 
         Merge r156214

Modified: branches/safari-537.73-branch/Source/_javascript_Core/interpreter/Interpreter.cpp (158116 => 158117)


--- branches/safari-537.73-branch/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-10-28 18:03:38 UTC (rev 158116)
+++ branches/safari-537.73-branch/Source/_javascript_Core/interpreter/Interpreter.cpp	2013-10-28 18:31:16 UTC (rev 158117)
@@ -765,7 +765,20 @@
 
     if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) {
         DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue);
-        bool hasHandler = codeBlock->handlerForBytecodeOffset(bytecodeOffset);
+        bool hasHandler = false;
+        if (!isTermination) {
+            VM* vm = &callFrame->vm();
+            CallFrame* currentFrame = callFrame;
+            CodeBlock* currentCB = codeBlock;
+            unsigned currentOffset = bytecodeOffset;
+            while (currentFrame) {
+                if (currentCB && currentCB->handlerForBytecodeOffset(currentOffset)) {
+                    hasHandler = true;
+                    break;
+                }
+                currentFrame = getCallerInfo(vm, currentFrame, currentOffset, currentCB);
+            }
+        }
         debugger->exception(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->lineNumberForBytecodeOffset(bytecodeOffset), 0, hasHandler);
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to