<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[202784] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/202784">202784</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-07-02 20:33:34 -0700 (Sat, 02 Jul 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>inspector/debugger/command-line-api-exception.html flakily times out on mac
https://bugs.webkit.org/show_bug.cgi?id=152029
<rdar://problem/23813812>
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-07-02
Reviewed by Timothy Hatcher.
Source/WebInspectorUI:
* UserInterface/Base/Object.js:
(WebInspector.Object.addEventListener):
Return the listener, this makes it cleaner to write tests.
LayoutTests:
* inspector/debugger/command-line-api-exception-expected.txt:
* inspector/debugger/command-line-api-exception-nested-catch-expected.txt:
* inspector/debugger/command-line-api-exception-nested-catch.html:
* inspector/debugger/command-line-api-exception.html:
* platform/mac/TestExpectations:
Rewrite these tests to use the new test harness.
This also is more careful about Pause/Resume timing differences
between Release and Debug builds.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggercommandlineapiexceptionexpectedtxt">trunk/LayoutTests/inspector/debugger/command-line-api-exception-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggercommandlineapiexceptionnestedcatchexpectedtxt">trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggercommandlineapiexceptionnestedcatchhtml">trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html</a></li>
<li><a href="#trunkLayoutTestsinspectordebuggercommandlineapiexceptionhtml">trunk/LayoutTests/inspector/debugger/command-line-api-exception.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseObjectjs">trunk/Source/WebInspectorUI/UserInterface/Base/Object.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (202783 => 202784)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/LayoutTests/ChangeLog        2016-07-03 03:33:34 UTC (rev 202784)
</span><span class="lines">@@ -1,5 +1,22 @@
</span><span class="cx"> 2016-07-02 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><ins>+ inspector/debugger/command-line-api-exception.html flakily times out on mac
+ https://bugs.webkit.org/show_bug.cgi?id=152029
+ <rdar://problem/23813812>
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector/debugger/command-line-api-exception-expected.txt:
+ * inspector/debugger/command-line-api-exception-nested-catch-expected.txt:
+ * inspector/debugger/command-line-api-exception-nested-catch.html:
+ * inspector/debugger/command-line-api-exception.html:
+ * platform/mac/TestExpectations:
+ Rewrite these tests to use the new test harness.
+ This also is more careful about Pause/Resume timing differences
+ between Release and Debug builds.
+
+2016-07-02 Joseph Pecoraro <pecoraro@apple.com>
+
</ins><span class="cx"> Web Inspector: Fix inspector/debugger/pause-reason.html
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=159325
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggercommandlineapiexceptionexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-expected.txt (202783 => 202784)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/command-line-api-exception-expected.txt        2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception-expected.txt        2016-07-03 03:33:34 UTC (rev 202784)
</span><span class="lines">@@ -12,21 +12,53 @@
</span><span class="cx"> CONSOLE MESSAGE: line 55: CATCHER: [object Object]
</span><span class="cx"> Checks that $exception is available and accurate in evaluations when paused on an exception.
</span><span class="cx">
</span><del>-BEFORE: $exception => undefined
-PAUSE #1: $exception => TypeError: undefined is not an object (evaluating '[].x.x')
-PAUSE #2: $exception => ReferenceError: Can't find variable: variableThatDoesNotExist
-PAUSE #3: $exception => SyntaxError: Unexpected token ')'
-PAUSE #4: $exception => Error: IndexSizeError: DOM Exception 1
-PAUSE #5: $exception => thrown string
-PAUSE #6: $exception => 123.456
-PAUSE #7: $exception => null
-PAUSE #8: $exception => Object
-PAUSE #9: $exception => <body>
-PAUSE #10: $exception => TypeError: undefined is not an object (evaluating '[].x.x')
-STEPPED OUT TO CATCH BLOCK: $exception === e ? true
-PAUSE #11: $exception => thrown string
-STEPPED OUT TO CATCH BLOCK: $exception === e ? true
-PAUSE #12: $exception => Object
-STEPPED OUT TO CATCH BLOCK: $exception === e ? true
-AFTER: $exception => undefined
</del><span class="cx">
</span><ins>+== Running test suite: CommandLineAPI.$exception
+-- Running test case: BeforeExceptions
+PASS: $exception should be undefined if there is no exception.
+
+-- Running test case: UncaughtTypeException
+$exception => TypeError: undefined is not an object (evaluating '[].x.x')
+
+-- Running test case: UncaughtReferenceException
+$exception => ReferenceError: Can't find variable: variableThatDoesNotExist
+
+-- Running test case: UncaughtSyntaxException
+$exception => SyntaxError: Unexpected token ')'
+
+-- Running test case: UncaughtDOMException
+$exception => Error: IndexSizeError: DOM Exception 1
+
+-- Running test case: UncaughtString
+$exception => thrown string
+
+-- Running test case: UncaughtNumber
+$exception => 123.456
+
+-- Running test case: UncaughtNull
+$exception => null
+
+-- Running test case: UncaughtObject
+$exception => Object
+
+-- Running test case: UncaughtNode
+$exception => <body>
+
+-- Running test case: CatchTypeException
+PASS: Paused, stepping out to catch block...
+PASS: `$exception` should be equal to `e`.
+$exception => TypeError: undefined is not an object (evaluating '[].x.x')
+
+-- Running test case: CatchThrownString
+PASS: Paused, stepping out to catch block...
+PASS: `$exception` should be equal to `e`.
+$exception => thrown string
+
+-- Running test case: CatchThrownObject
+PASS: Paused, stepping out to catch block...
+PASS: `$exception` should be equal to `e`.
+$exception => Object
+
+-- Running test case: AfterExceptions
+PASS: $exception should be undefined if there is no exception.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggercommandlineapiexceptionnestedcatchexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch-expected.txt (202783 => 202784)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch-expected.txt        2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch-expected.txt        2016-07-03 03:33:34 UTC (rev 202784)
</span><span class="lines">@@ -2,7 +2,12 @@
</span><span class="cx"> CONSOLE MESSAGE: line 69: outer exception
</span><span class="cx"> Checks that $exception is the value of the current exception, even in nested catch blocks.
</span><span class="cx">
</span><del>-BEFORE : $exception => undefined
</del><ins>+
+== Running test suite: CommandLineAPI.$exception
+-- Running test case: EmptyBefore
+PASS: $exception should be undefined if there is no exception.
+
+-- Running test case: CheckExceptionInsideNestedCatchBlocks
</ins><span class="cx"> OUTER 1: $exception => outer exception
</span><span class="cx"> INNER 1: $exception => inner exception
</span><span class="cx"> INNER 2: $exception => inner exception
</span><span class="lines">@@ -9,5 +14,7 @@
</span><span class="cx"> CATCH: $exception === e2 ? true
</span><span class="cx"> OUTER 2: $exception => outer exception
</span><span class="cx"> CATCH: $exception === e1 ? true
</span><del>-AFTER : $exception => undefined
</del><span class="cx">
</span><ins>+-- Running test case: EmptyAfter
+PASS: $exception should be undefined if there is no exception.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggercommandlineapiexceptionnestedcatchhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html (202783 => 202784)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html        2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html        2016-07-03 03:33:34 UTC (rev 202784)
</span><span class="lines">@@ -1,15 +1,10 @@
</span><del>-<!doctype html>
</del><ins>+<!DOCTYPE html>
</ins><span class="cx"> <html>
</span><span class="cx"> <head>
</span><del>-<script type="text/javascript" src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script type="text/javascript" src="./resources/exceptions.js"></script>
</del><ins>+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script src="resources/exceptions.js"></script>
</ins><span class="cx"> <script>
</span><del>-function triggerException()
-{
- // We expect uncaught exceptions, so avoid logs for them.
- window.onerror = function(){};
- setTimeout(nestedCatchBlocks, 0);
-}
</del><ins>+window.onerror = function(){};
</ins><span class="cx">
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="lines">@@ -27,58 +22,85 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>- var done = false;
- var phase = 0;
</del><span class="cx">
</span><del>- WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
- if (done)
- return;
</del><ins>+ let suite = InspectorTest.createAsyncSuite("CommandLineAPI.$exception");
</ins><span class="cx">
</span><del>- phase++;
-
- // Skip past the first pause to the second pause.
- if (phase === 1) {
- dumpCommandLineAPIValue("OUTER 1");
- WebInspector.debuggerManager.resume();
- return;
</del><ins>+ suite.addTestCase({
+ name: "EmptyBefore",
+ description: "Without exceptions, $exception should be undefined",
+ test: (resolve, reject) => {
+ WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+ InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
+ resolve();
+ });
</ins><span class="cx"> }
</span><ins>+ });
</ins><span class="cx">
</span><del>- // Paused on the exception in the inner try, step over to get into the inner catch.
- if (phase === 2) {
- dumpCommandLineAPIValue("INNER 1");
- WebInspector.debuggerManager.stepOver();
- return;
- }
</del><ins>+ suite.addTestCase({
+ name: "CheckExceptionInsideNestedCatchBlocks",
+ description: "Check $exception is always the current exception object when stepping through catch blocks.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("setTimeout(nestedCatchBlocks, 0)");
</ins><span class="cx">
</span><del>- // Paused in the inner catch, verify $exception is "inner exception".
- if (phase === 3) {
- dumpCommandLineAPIValue("INNER 2");
- checkIfExceptionValueMatchesVariable("e2");
- WebInspector.debuggerManager.stepOver();
- return;
- }
</del><ins>+ let phase = 0;
+ let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
+ if (!WebInspector.debuggerManager.activeCallFrame)
+ return;
+
+ phase++;
+
+ // Skip past the first pause to the second pause.
+ if (phase === 1) {
+ dumpCommandLineAPIValue("OUTER 1");
+ WebInspector.debuggerManager.resume();
+ return;
+ }
+
+ // Paused on the exception in the inner try, step over to get into the inner catch.
+ if (phase === 2) {
+ dumpCommandLineAPIValue("INNER 1");
+ WebInspector.debuggerManager.stepOver();
+ return;
+ }
+
+ // Paused in the inner catch, verify $exception is "inner exception".
+ if (phase === 3) {
+ dumpCommandLineAPIValue("INNER 2");
+ checkIfExceptionValueMatchesVariable("e2");
+ WebInspector.debuggerManager.stepOver();
+ return;
+ }
</ins><span class="cx">
</span><del>- // Stepped into the outer catch, verify $exception is "outer exception".
- if (phase === 4) {
- dumpCommandLineAPIValue("OUTER 2");
- checkIfExceptionValueMatchesVariable("e1");
- WebInspector.debuggerManager.resume();
- return;
</del><ins>+ // Stepped into the outer catch, verify $exception is "outer exception".
+ if (phase === 4) {
+ dumpCommandLineAPIValue("OUTER 2");
+ checkIfExceptionValueMatchesVariable("e1");
+ WebInspector.debuggerManager.resume().then(() => {
+ WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, listener);
+ resolve();
+ }, reject);
+ return;
+ }
+ });
</ins><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
- done = true;
- dumpCommandLineAPIValue("AFTER ");
- InspectorTest.completeTest();
</del><ins>+ suite.addTestCase({
+ name: "EmptyAfter",
+ description: "Without exceptions, $exception should be undefined",
+ test: (resolve, reject) => {
+ WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+ InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
+ resolve();
+ });
+ }
</ins><span class="cx"> });
</span><span class="cx">
</span><del>- dumpCommandLineAPIValue("BEFORE ");
- InspectorTest.evaluateInPage("triggerException()");
</del><ins>+ suite.runTestCasesAndFinish();
</ins><span class="cx"> }
</span><span class="cx"> </script>
</span><span class="cx"> </head>
</span><span class="cx"> <body onload="runTest()">
</span><del>- <p>Checks that <code>$exception</code> is the value of the current exception, even in nested catch blocks.</p>
</del><ins>+<p>Checks that <code>$exception</code> is the value of the current exception, even in nested catch blocks.</p>
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span></span></pre></div>
<a id="trunkLayoutTestsinspectordebuggercommandlineapiexceptionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception.html (202783 => 202784)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/debugger/command-line-api-exception.html        2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/LayoutTests/inspector/debugger/command-line-api-exception.html        2016-07-03 03:33:34 UTC (rev 202784)
</span><span class="lines">@@ -1,98 +1,107 @@
</span><del>-<!doctype html>
</del><ins>+<!DOCTYPE html>
</ins><span class="cx"> <html>
</span><span class="cx"> <head>
</span><del>-<script type="text/javascript" src="../../http/tests/inspector/resources/inspector-test.js"></script>
-<script type="text/javascript" src="./resources/exceptions.js"></script>
</del><ins>+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script src="./resources/exceptions.js"></script>
</ins><span class="cx"> <script>
</span><del>-var exceptionIndex = 0;
-var exceptionCausers = [
- triggerUncaughtTypeException,
- triggerUncaughtReferenceException,
- triggerUncaughtSyntaxException,
- triggerUncaughtDOMException,
- throwString,
- throwNumber,
- throwNull,
- throwObject,
- throwNode,
- function() { catcher(triggerUncaughtTypeException); },
- function() { catcher(throwString); },
- function() { catcher(throwObject); },
-];
</del><ins>+// We expect uncaught exceptions, so avoid logs for them.
+window.onerror = function(){};
</ins><span class="cx">
</span><del>-
-function triggerNextException()
-{
- // We expect uncaught exceptions, so avoid logs for them.
- window.onerror = function(){};
-
- setTimeout(function() {
- exceptionCausers[exceptionIndex++]();
- }, 0);
-}
-
</del><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="cx"> WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
</span><span class="cx">
</span><del>- function triggerNextException() {
- InspectorTest.evaluateInPage("triggerNextException()");
- }
</del><ins>+ let suite = InspectorTest.createAsyncSuite("CommandLineAPI.$exception");
</ins><span class="cx">
</span><del>- function dumpCommandLineAPIValue(prefix) {
- WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
- InspectorTest.log(prefix + ": $exception => " + result.description);
</del><ins>+ function addNoExceptionTest(name) {
+ suite.addTestCase({
+ name, description: "Without exceptions, $exception should be undefined",
+ test: (resolve, reject) => {
+ WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+ InspectorTest.expectThat(result.description === "undefined", "$exception should be undefined if there is no exception.");
+ resolve();
+ });
+ }
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>- function checkIfExceptionValueMatchesCatchVariable() {
- WebInspector.runtimeManager.evaluateInInspectedWindow("$exception === e", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
- InspectorTest.log("STEPPED OUT TO CATCH BLOCK: $exception === e ? " + result.description);
</del><ins>+ function addUncaughtExceptionTest(name, testFunction) {
+ suite.addTestCase({
+ name, description: "Trigger an uncaught exception and check $exception.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage(`setTimeout(${testFunction})`);
+ WebInspector.debuggerManager.singleFireEventListener(WebInspector.DebuggerManager.Event.Paused, (event) => {
+ WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+ InspectorTest.log("$exception => " + result.description);
+ WebInspector.debuggerManager.resume().then(resolve, reject);
+ });
+ });
+ }
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>- var pauses = 0;
- var stepping = false;
- var done = false;
- const pointWhereExpectionsAreBeingCaught = 9;
- const expectedPauses = 12;
</del><ins>+ function addCaughtExceptionTest(name, expression) {
+ suite.addTestCase({
+ name, description: "Trigger a caught exception and check $exception.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage(expression);
</ins><span class="cx">
</span><del>- WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
- if (done)
- return;
</del><ins>+ let didStep = false;
+ let didEvaluate = false;
</ins><span class="cx">
</span><del>- if (!stepping) {
- dumpCommandLineAPIValue("PAUSE #" + (++pauses));
- if (pauses > pointWhereExpectionsAreBeingCaught) {
- WebInspector.debuggerManager.stepOut();
- stepping = true;
- return;
</del><ins>+ let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, (event) => {
+ if (!WebInspector.debuggerManager.activeCallFrame)
+ return;
+
+ if (!didStep) {
+ didStep = true;
+ InspectorTest.pass("Paused, stepping out to catch block...");
+ WebInspector.debuggerManager.stepOut();
+ return;
+ }
+
+ if (!didEvaluate) {
+ didEvaluate = true;
+ WebInspector.runtimeManager.evaluateInInspectedWindow("$exception === e", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+ InspectorTest.expectThat(result.description === "true", "`$exception` should be equal to `e`.");
+ });
+ WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, (result, wasThrown) => {
+ InspectorTest.log("$exception => " + result.description);
+ WebInspector.debuggerManager.resume().then(() => {
+ WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, listener);
+ resolve();
+ }, reject);
+ });
+ return;
+ }
+ });
</ins><span class="cx"> }
</span><del>- } else {
- checkIfExceptionValueMatchesCatchVariable();
- stepping = false;
- }
</del><ins>+ });
+ }
</ins><span class="cx">
</span><del>- WebInspector.debuggerManager.resume();
</del><ins>+ addNoExceptionTest("BeforeExceptions");
</ins><span class="cx">
</span><del>- if (pauses !== expectedPauses) {
- triggerNextException();
- return;
- }
- });
</del><ins>+ addUncaughtExceptionTest("UncaughtTypeException", "triggerUncaughtTypeException");
+ addUncaughtExceptionTest("UncaughtReferenceException", "triggerUncaughtReferenceException");
+ addUncaughtExceptionTest("UncaughtSyntaxException", "triggerUncaughtSyntaxException");
+ addUncaughtExceptionTest("UncaughtDOMException", "triggerUncaughtDOMException");
+ addUncaughtExceptionTest("UncaughtString", "throwString");
+ addUncaughtExceptionTest("UncaughtNumber", "throwNumber");
+ addUncaughtExceptionTest("UncaughtNull", "throwNull");
+ addUncaughtExceptionTest("UncaughtObject", "throwObject");
+ addUncaughtExceptionTest("UncaughtNode", "throwNode");
</ins><span class="cx">
</span><del>- WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
- done = true;
- dumpCommandLineAPIValue("AFTER");
- InspectorTest.completeTest();
- });
</del><ins>+ addCaughtExceptionTest("CatchTypeException", "setTimeout(function() { catcher(triggerUncaughtTypeException); })");
+ addCaughtExceptionTest("CatchThrownString", "setTimeout(function() { catcher(throwString); })");
+ addCaughtExceptionTest("CatchThrownObject", "setTimeout(function() { catcher(throwObject); })");
</ins><span class="cx">
</span><del>- dumpCommandLineAPIValue("BEFORE");
- triggerNextException();
</del><ins>+ addNoExceptionTest("AfterExceptions");
+
+ suite.runTestCasesAndFinish();
</ins><span class="cx"> }
</span><span class="cx"> </script>
</span><span class="cx"> </head>
</span><span class="cx"> <body onload="runTest()">
</span><del>- <p>Checks that <code>$exception</code> is available and accurate in evaluations when paused on an exception.</p>
</del><ins>+<p>Checks that <code>$exception</code> is available and accurate in evaluations when paused on an exception.</p>
</ins><span class="cx"> </body>
</span><span class="cx"> </html>
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (202783 => 202784)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations        2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/LayoutTests/platform/mac/TestExpectations        2016-07-03 03:33:34 UTC (rev 202784)
</span><span class="lines">@@ -1210,8 +1210,6 @@
</span><span class="cx"> webkit.org/b/148636 inspector/css/selector-specificity.html [ Pass Timeout ]
</span><span class="cx"> webkit.org/b/153460 [ Debug ] inspector/codemirror/prettyprinting-css-rules.html [ Pass Timeout ]
</span><span class="cx"> webkit.org/b/158742 [ Debug ] inspector/debugger/break-in-constructor-before-super.html [ Pass Timeout ]
</span><del>-webkit.org/b/152029 inspector/debugger/command-line-api-exception.html [ Pass Timeout ]
-webkit.org/b/152487 inspector/debugger/command-line-api-exception-nested-catch.html [ Pass Timeout ]
</del><span class="cx"> webkit.org/b/148636 inspector/dom/content-flow-content-nodes.html [ Pass Timeout ]
</span><span class="cx"> webkit.org/b/148636 inspector/dom/content-flow-content-removal.html [ Pass Timeout ]
</span><span class="cx"> webkit.org/b/148636 inspector/dom/content-flow-list.html [ Pass Timeout ]
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (202783 => 202784)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-07-03 03:33:34 UTC (rev 202784)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-07-02 Joseph Pecoraro <pecoraro@apple.com>
+
+ inspector/debugger/command-line-api-exception.html flakily times out on mac
+ https://bugs.webkit.org/show_bug.cgi?id=152029
+ <rdar://problem/23813812>
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Object.js:
+ (WebInspector.Object.addEventListener):
+ Return the listener, this makes it cleaner to write tests.
+
</ins><span class="cx"> 2016-07-01 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Make enabling protocol logging in inspector tests easy to remember
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseObjectjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Object.js (202783 => 202784)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Object.js        2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Object.js        2016-07-03 03:33:34 UTC (rev 202784)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> listenersTable.add(thisObject, listener);
</span><ins>+ return listener;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static singleFireEventListener(eventType, listener, thisObject)
</span></span></pre>
</div>
</div>
</body>
</html>