Diff
Modified: trunk/LayoutTests/ChangeLog (202783 => 202784)
--- trunk/LayoutTests/ChangeLog 2016-07-03 03:32:18 UTC (rev 202783)
+++ trunk/LayoutTests/ChangeLog 2016-07-03 03:33:34 UTC (rev 202784)
@@ -1,5 +1,22 @@
2016-07-02 Joseph Pecoraro <[email protected]>
+ 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 <[email protected]>
+
Web Inspector: Fix inspector/debugger/pause-reason.html
https://bugs.webkit.org/show_bug.cgi?id=159325
Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-expected.txt (202783 => 202784)
--- 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)
@@ -12,21 +12,53 @@
CONSOLE MESSAGE: line 55: CATCHER: [object Object]
Checks that $exception is available and accurate in evaluations when paused on an exception.
-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
+== 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.
+
Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch-expected.txt (202783 => 202784)
--- 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)
@@ -2,7 +2,12 @@
CONSOLE MESSAGE: line 69: outer exception
Checks that $exception is the value of the current exception, even in nested catch blocks.
-BEFORE : $exception => undefined
+
+== Running test suite: CommandLineAPI.$exception
+-- Running test case: EmptyBefore
+PASS: $exception should be undefined if there is no exception.
+
+-- Running test case: CheckExceptionInsideNestedCatchBlocks
OUTER 1: $exception => outer exception
INNER 1: $exception => inner exception
INNER 2: $exception => inner exception
@@ -9,5 +14,7 @@
CATCH: $exception === e2 ? true
OUTER 2: $exception => outer exception
CATCH: $exception === e1 ? true
-AFTER : $exception => undefined
+-- Running test case: EmptyAfter
+PASS: $exception should be undefined if there is no exception.
+
Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception-nested-catch.html (202783 => 202784)
--- 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)
@@ -1,15 +1,10 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
<head>
-<script type="text/_javascript_" src=""
-<script type="text/_javascript_" src=""
+<script src=""
+<script src=""
<script>
-function triggerException()
-{
- // We expect uncaught exceptions, so avoid logs for them.
- window._onerror_ = function(){};
- setTimeout(nestedCatchBlocks, 0);
-}
+window._onerror_ = function(){};
function test()
{
@@ -27,58 +22,85 @@
});
}
- var done = false;
- var phase = 0;
- WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
- if (done)
- return;
+ let suite = InspectorTest.createAsyncSuite("CommandLineAPI.$exception");
- phase++;
-
- // Skip past the first pause to the second pause.
- if (phase === 1) {
- dumpCommandLineAPIValue("OUTER 1");
- WebInspector.debuggerManager.resume();
- return;
+ 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();
+ });
}
+ });
- // 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;
- }
+ 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)");
- // Paused in the inner catch, verify $exception is "inner exception".
- if (phase === 3) {
- dumpCommandLineAPIValue("INNER 2");
- checkIfExceptionValueMatchesVariable("e2");
- WebInspector.debuggerManager.stepOver();
- return;
- }
+ 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;
+ }
- // Stepped into the outer catch, verify $exception is "outer exception".
- if (phase === 4) {
- dumpCommandLineAPIValue("OUTER 2");
- checkIfExceptionValueMatchesVariable("e1");
- WebInspector.debuggerManager.resume();
- return;
+ // 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;
+ }
+ });
}
});
- WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
- done = true;
- dumpCommandLineAPIValue("AFTER ");
- InspectorTest.completeTest();
+ 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();
+ });
+ }
});
- dumpCommandLineAPIValue("BEFORE ");
- InspectorTest.evaluateInPage("triggerException()");
+ suite.runTestCasesAndFinish();
}
</script>
</head>
<body _onload_="runTest()">
- <p>Checks that <code>$exception</code> is the value of the current exception, even in nested catch blocks.</p>
+<p>Checks that <code>$exception</code> is the value of the current exception, even in nested catch blocks.</p>
</body>
</html>
Modified: trunk/LayoutTests/inspector/debugger/command-line-api-exception.html (202783 => 202784)
--- 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)
@@ -1,98 +1,107 @@
-<!doctype html>
+<!DOCTYPE html>
<html>
<head>
-<script type="text/_javascript_" src=""
-<script type="text/_javascript_" src=""
+<script src=""
+<script src=""
<script>
-var exceptionIndex = 0;
-var exceptionCausers = [
- triggerUncaughtTypeException,
- triggerUncaughtReferenceException,
- triggerUncaughtSyntaxException,
- triggerUncaughtDOMException,
- throwString,
- throwNumber,
- throwNull,
- throwObject,
- throwNode,
- function() { catcher(triggerUncaughtTypeException); },
- function() { catcher(throwString); },
- function() { catcher(throwObject); },
-];
+// We expect uncaught exceptions, so avoid logs for them.
+window._onerror_ = function(){};
-
-function triggerNextException()
-{
- // We expect uncaught exceptions, so avoid logs for them.
- window._onerror_ = function(){};
-
- setTimeout(function() {
- exceptionCausers[exceptionIndex++]();
- }, 0);
-}
-
function test()
{
WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
- function triggerNextException() {
- InspectorTest.evaluateInPage("triggerNextException()");
- }
+ let suite = InspectorTest.createAsyncSuite("CommandLineAPI.$exception");
- function dumpCommandLineAPIValue(prefix) {
- WebInspector.runtimeManager.evaluateInInspectedWindow("$exception", {objectGroup: "test", includeCommandLineAPI: true, doNotPauseOnExceptionsAndMuteConsole: true}, function(result, wasThrown) {
- InspectorTest.log(prefix + ": $exception => " + result.description);
+ 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();
+ });
+ }
});
}
- 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);
+ 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);
+ });
+ });
+ }
});
}
- var pauses = 0;
- var stepping = false;
- var done = false;
- const pointWhereExpectionsAreBeingCaught = 9;
- const expectedPauses = 12;
+ function addCaughtExceptionTest(name, _expression_) {
+ suite.addTestCase({
+ name, description: "Trigger a caught exception and check $exception.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage(_expression_);
- WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
- if (done)
- return;
+ let didStep = false;
+ let didEvaluate = false;
- if (!stepping) {
- dumpCommandLineAPIValue("PAUSE #" + (++pauses));
- if (pauses > pointWhereExpectionsAreBeingCaught) {
- WebInspector.debuggerManager.stepOut();
- stepping = true;
- return;
+ 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;
+ }
+ });
}
- } else {
- checkIfExceptionValueMatchesCatchVariable();
- stepping = false;
- }
+ });
+ }
- WebInspector.debuggerManager.resume();
+ addNoExceptionTest("BeforeExceptions");
- if (pauses !== expectedPauses) {
- triggerNextException();
- return;
- }
- });
+ 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");
- WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, function(event) {
- done = true;
- dumpCommandLineAPIValue("AFTER");
- InspectorTest.completeTest();
- });
+ addCaughtExceptionTest("CatchTypeException", "setTimeout(function() { catcher(triggerUncaughtTypeException); })");
+ addCaughtExceptionTest("CatchThrownString", "setTimeout(function() { catcher(throwString); })");
+ addCaughtExceptionTest("CatchThrownObject", "setTimeout(function() { catcher(throwObject); })");
- dumpCommandLineAPIValue("BEFORE");
- triggerNextException();
+ addNoExceptionTest("AfterExceptions");
+
+ suite.runTestCasesAndFinish();
}
</script>
</head>
<body _onload_="runTest()">
- <p>Checks that <code>$exception</code> is available and accurate in evaluations when paused on an exception.</p>
+<p>Checks that <code>$exception</code> is available and accurate in evaluations when paused on an exception.</p>
</body>
</html>
Modified: trunk/LayoutTests/platform/mac/TestExpectations (202783 => 202784)
--- 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)
@@ -1210,8 +1210,6 @@
webkit.org/b/148636 inspector/css/selector-specificity.html [ Pass Timeout ]
webkit.org/b/153460 [ Debug ] inspector/codemirror/prettyprinting-css-rules.html [ Pass Timeout ]
webkit.org/b/158742 [ Debug ] inspector/debugger/break-in-constructor-before-super.html [ Pass Timeout ]
-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 ]
webkit.org/b/148636 inspector/dom/content-flow-content-nodes.html [ Pass Timeout ]
webkit.org/b/148636 inspector/dom/content-flow-content-removal.html [ Pass Timeout ]
webkit.org/b/148636 inspector/dom/content-flow-list.html [ Pass Timeout ]
Modified: trunk/Source/WebInspectorUI/ChangeLog (202783 => 202784)
--- 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)
@@ -1,3 +1,15 @@
+2016-07-02 Joseph Pecoraro <[email protected]>
+
+ 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.
+
2016-07-01 Joseph Pecoraro <[email protected]>
Web Inspector: Make enabling protocol logging in inspector tests easy to remember
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Object.js (202783 => 202784)
--- 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)
@@ -54,6 +54,7 @@
}
listenersTable.add(thisObject, listener);
+ return listener;
}
static singleFireEventListener(eventType, listener, thisObject)