<!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>[189373] 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/189373">189373</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-09-04 12:53:59 -0700 (Fri, 04 Sep 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Expand Console domain test coverage
https://bugs.webkit.org/show_bug.cgi?id=148740
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-09-04
Reviewed by Brian Burg.
Source/JavaScriptCore:
* inspector/protocol/Console.json:
Update the description of this command now that it only
manipulates $0, and not $1, $2, .. $n.
Source/WebInspectorUI:
* UserInterface/Protocol/RemoteObject.js:
Add a few helpers for checking the RemoteObject type.
LayoutTests:
Test more Console domain commands and events.
* inspector/console/addInspectedNode-expected.txt: Added.
* inspector/console/addInspectedNode.html: Added.
* inspector/console/clearMessages-expected.txt: Added.
* inspector/console/clearMessages.html: Added.
* inspector/console/messageRepeatCountUpdated-expected.txt: Added.
* inspector/console/messageRepeatCountUpdated.html: Added.
* inspector/console/messagesCleared-expected.txt: Added.
* inspector/console/messagesCleared.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolConsolejson">trunk/Source/JavaScriptCore/inspector/protocol/Console.json</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolRemoteObjectjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorconsoleaddInspectedNodeexpectedtxt">trunk/LayoutTests/inspector/console/addInspectedNode-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorconsoleaddInspectedNodehtml">trunk/LayoutTests/inspector/console/addInspectedNode.html</a></li>
<li><a href="#trunkLayoutTestsinspectorconsoleclearMessagesexpectedtxt">trunk/LayoutTests/inspector/console/clearMessages-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorconsoleclearMessageshtml">trunk/LayoutTests/inspector/console/clearMessages.html</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolemessageRepeatCountUpdatedexpectedtxt">trunk/LayoutTests/inspector/console/messageRepeatCountUpdated-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolemessageRepeatCountUpdatedhtml">trunk/LayoutTests/inspector/console/messageRepeatCountUpdated.html</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolemessagesClearedexpectedtxt">trunk/LayoutTests/inspector/console/messagesCleared-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorconsolemessagesClearedhtml">trunk/LayoutTests/inspector/console/messagesCleared.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (189372 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-04 19:52:15 UTC (rev 189372)
+++ trunk/LayoutTests/ChangeLog        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-09-04 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Expand Console domain test coverage
+ https://bugs.webkit.org/show_bug.cgi?id=148740
+
+ Reviewed by Brian Burg.
+
+ Test more Console domain commands and events.
+
+ * inspector/console/addInspectedNode-expected.txt: Added.
+ * inspector/console/addInspectedNode.html: Added.
+ * inspector/console/clearMessages-expected.txt: Added.
+ * inspector/console/clearMessages.html: Added.
+ * inspector/console/messageRepeatCountUpdated-expected.txt: Added.
+ * inspector/console/messageRepeatCountUpdated.html: Added.
+ * inspector/console/messagesCleared-expected.txt: Added.
+ * inspector/console/messagesCleared.html: Added.
+
</ins><span class="cx"> 2015-09-04 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed gardening; enabling media/ and http/tests/media/ tests (with expected failures) on ios-simulator
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsoleaddInspectedNodeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/addInspectedNode-expected.txt (0 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/addInspectedNode-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector/console/addInspectedNode-expected.txt        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+Test for the Console.addInspectedNode command.
+
+
+== Running test suite: Console.addInspectedNode
+-- Running test case: Check$0IsUndefined
+PASS: $0 should be undefined.
+
+-- Running test case: SetAndCheckNodeA
+PASS: $0 should be a node.
+PASS: $0 should be Node A.
+
+-- Running test case: SetBadNodeId
+PASS: Should be an error
+PASS: $0 should be a node.
+PASS: $0 should be Node A.
+
+-- Running test case: SetAndCheckNodeB
+PASS: $0 should be a node.
+PASS: $0 should not be Node A.
+PASS: $0 should be Node B.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorconsoleaddInspectedNodehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/addInspectedNode.html (0 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/addInspectedNode.html         (rev 0)
+++ trunk/LayoutTests/inspector/console/addInspectedNode.html        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script>
+function test()
+{
+ function evaluate$0(callback) {
+ const objectGroup = "test";
+ const includeCommandLineAPI = true;
+ const ignorePauseOnExceptionsAndMute = false;
+ const shouldReturnByValue = false;
+ const shouldGeneratePreview = false;
+ const shouldSaveResult = false;
+ WebInspector.runtimeManager.evaluateInInspectedWindow("$0", objectGroup, includeCommandLineAPI, ignorePauseOnExceptionsAndMute, shouldReturnByValue, shouldGeneratePreview, shouldSaveResult, callback);
+ }
+
+ let nodeA, nodeB;
+
+ let suite = InspectorTest.createAsyncSuite("Console.addInspectedNode");
+
+ suite.addTestCase({
+ name: "Check$0IsUndefined",
+ description: "No inspected node yet, $0 should be undefined.",
+ test: (resolve, reject) => {
+ evaluate$0((remoteObject) => {
+ InspectorTest.expectThat(remoteObject.isUndefined(), "$0 should be undefined.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "SetAndCheckNodeA",
+ description: "Set the inspected node to be Node A and check that $0 is Node A.",
+ test: (resolve, reject) => {
+ ConsoleAgent.addInspectedNode(nodeA.id);
+ evaluate$0((remoteObject) => {
+ remoteObject.pushNodeToFrontend((nodeId) => {
+ InspectorTest.expectThat(remoteObject.isNode(), "$0 should be a node.");
+ InspectorTest.expectThat(nodeId === nodeA.id, "$0 should be Node A.");
+ resolve();
+ });
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "SetBadNodeId",
+ description: "If an invalid inspected node is set, it should not be bound to $0.",
+ test: (resolve, reject) => {
+ ConsoleAgent.addInspectedNode(999999, (error) => {
+ InspectorTest.expectThat(error, "Should be an error");
+ });
+ evaluate$0((remoteObject) => {
+ remoteObject.pushNodeToFrontend((nodeId) => {
+ InspectorTest.expectThat(remoteObject.isNode(), "$0 should be a node.");
+ InspectorTest.expectThat(nodeId === nodeA.id, "$0 should be Node A.");
+ resolve();
+ });
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "SetAndCheckNodeB",
+ description: "Set the inspected node to be Node B and check that $0 is Node B.",
+ test: (resolve, reject) => {
+ ConsoleAgent.addInspectedNode(nodeB.id);
+ evaluate$0((remoteObject) => {
+ remoteObject.pushNodeToFrontend((nodeId) => {
+ InspectorTest.expectThat(remoteObject.isNode(), "$0 should be a node.");
+ InspectorTest.expectThat(nodeId !== nodeA.id, "$0 should not be Node A.");
+ InspectorTest.expectThat(nodeId === nodeB.id, "$0 should be Node B.");
+ resolve();
+ });
+ });
+ }
+ });
+
+ // FIXME: What should $0 be after reloading / navigating the page. Should it be cleared?
+
+ WebInspector.domTreeManager.requestDocument((documentNode) => {
+ WebInspector.domTreeManager.querySelector(documentNode.id, "#a", (contentNodeId) => {
+ InspectorTest.assert(contentNodeId, "#a node should exist.");
+ nodeA = WebInspector.domTreeManager.nodeForId(contentNodeId);
+ });
+ WebInspector.domTreeManager.querySelector(documentNode.id, "#b", (contentNodeId) => {
+ InspectorTest.assert(contentNodeId, "#b node should exist.");
+ nodeB = WebInspector.domTreeManager.nodeForId(contentNodeId);
+ suite.runTestCasesAndFinish();
+ });
+ });
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Test for the Console.addInspectedNode command.</p>
+<div style="display:none">
+ <p id="a">Node A</p>
+ <p id="b">Node B</p>
+</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorconsoleclearMessagesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/clearMessages-expected.txt (0 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/clearMessages-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector/console/clearMessages-expected.txt        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+Test for the Console.clearMessages command.
+
+
+== Running test suite: Console.clearMessages
+-- Running test case: CallClearMessages
+PASS: Cleared event should fire.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorconsoleclearMessageshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/clearMessages.html (0 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/clearMessages.html         (rev 0)
+++ trunk/LayoutTests/inspector/console/clearMessages.html        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script>
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("Console.clearMessages");
+
+ suite.addTestCase({
+ name: "CallClearMessages",
+ description: "Calling the Console.clearMessages command should trigger Console.messagesCleared.",
+ test: (resolve, reject) => {
+ ConsoleAgent.clearMessages();
+
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+ InspectorTest.assert(false, "MessageAdded event should not fire.");
+ reject();
+ });
+
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.Cleared, (event) => {
+ InspectorTest.expectThat(event, "Cleared event should fire.");
+ resolve();
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Test for the Console.clearMessages command.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolemessageRepeatCountUpdatedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/messageRepeatCountUpdated-expected.txt (0 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/messageRepeatCountUpdated-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector/console/messageRepeatCountUpdated-expected.txt        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+CONSOLE MESSAGE: line 1: test message
+CONSOLE MESSAGE: line 1: test message
+CONSOLE MESSAGE: line 1: test message
+CONSOLE MESSAGE: line 1: test message
+CONSOLE MESSAGE: line 1: test message
+CONSOLE MESSAGE: line 1: test message
+CONSOLE MESSAGE: line 1: different message
+CONSOLE MESSAGE: line 1: different message
+CONSOLE MESSAGE: line 1: test message
+CONSOLE MESSAGE: line 1: equal parameter values
+CONSOLE MESSAGE: line 1: equal parameter values
+CONSOLE MESSAGE: line 1: object
+CONSOLE MESSAGE: line 1: object
+CONSOLE MESSAGE: line 1: level
+CONSOLE MESSAGE: line 1: level
+Test for the Console.messageRepeatCountUpdated event.
+
+
+== Running test suite: Console.messageRepeatCountUpdated
+-- Running test case: AddTestMessage
+PASS: MessageAdded event should fire.
+PASS: ConsoleMessage repeatCount is 1.
+
+-- Running test case: RepeatTestMessage1
+PASS: PreviousMessageRepeatCountUpdated should fire.
+PASS: Count should be 2.
+
+-- Running test case: RepeatTestMessage2
+PASS: PreviousMessageRepeatCountUpdated should fire.
+PASS: Count should be 3.
+
+-- Running test case: RepeatTestMessage3
+PASS: PreviousMessageRepeatCountUpdated should fire.
+PASS: Count should be 4.
+
+-- Running test case: RepeatTestMessage4
+PASS: PreviousMessageRepeatCountUpdated should fire.
+PASS: Count should be 5.
+
+-- Running test case: RepeatTestMessage5
+PASS: PreviousMessageRepeatCountUpdated should fire.
+PASS: Count should be 6.
+
+-- Running test case: AddDifferentMessage
+PASS: MessageAdded event should fire.
+PASS: ConsoleMessage repeatCount is 1.
+
+-- Running test case: RepeatDifferentMessage
+PASS: PreviousMessageRepeatCountUpdated should fire.
+PASS: Count should be 2.
+
+-- Running test case: AddTestMessageAgain
+PASS: MessageAdded event should fire.
+PASS: ConsoleMessage repeatCount is 1.
+
+-- Running test case: MessagesWithEqualValuesRepeats
+PASS: PreviousMessageRepeatCountUpdated should fire for repeat messages with equal values.
+
+-- Running test case: MessagesWithObjectsDoNotRepeat
+PASS: MessageAdded event should fire.
+PASS: MessageAdded event should fire.
+
+-- Running test case: MessagesWithDifferentLevelsDoNotRepeat
+PASS: MessageAdded event should fire.
+PASS: MessageAdded event should fire.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolemessageRepeatCountUpdatedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/messageRepeatCountUpdated.html (0 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/messageRepeatCountUpdated.html         (rev 0)
+++ trunk/LayoutTests/inspector/console/messageRepeatCountUpdated.html        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -0,0 +1,190 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script>
+function test()
+{
+ const testMessage = "console.log('test message')";
+ const differentMessage = "console.log('different message')";
+
+ let suite = InspectorTest.createAsyncSuite("Console.messageRepeatCountUpdated");
+
+ suite.addTestCase({
+ name: "AddTestMessage",
+ description: "Add a new message, it should have a single repeat count.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage(testMessage);
+
+ let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+ InspectorTest.assert(false, "Should not fire PreviousMessageRepeatCountUpdated yet.");
+ reject();
+ });
+
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+ InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+ InspectorTest.expectThat(event.data.message.repeatCount === 1, "ConsoleMessage repeatCount is 1.");
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
+ resolve();
+ });
+ }
+ });
+
+ for (let i = 1; i <= 5; ++i) {
+ suite.addTestCase({
+ name: `RepeatTestMessage${i}`,
+ description: "Repeat the last message, it should trigger messageRepeatCountUpdated.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage(testMessage);
+
+ let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+ InspectorTest.assert(false, "Should not fire MessageAdded, this should be a repeat.");
+ reject();
+ });
+
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+ InspectorTest.expectThat(event, "PreviousMessageRepeatCountUpdated should fire.");
+ InspectorTest.expectThat(event.data.count === (i + 1), `Count should be ${i + 1}.`);
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, listener, null);
+ resolve();
+ });
+ }
+ });
+ }
+
+ suite.addTestCase({
+ name: "AddDifferentMessage",
+ description: "Add a different message, it should reset the repeat count.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage(differentMessage);
+
+ let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+ InspectorTest.assert(false, "Should not fire PreviousMessageRepeatCountUpdated, this message is different.");
+ reject();
+ });
+
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+ InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+ InspectorTest.expectThat(event.data.message.repeatCount === 1, "ConsoleMessage repeatCount is 1.");
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "RepeatDifferentMessage",
+ description: "Repeat this different message, it should increment the repeat count.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage(differentMessage);
+
+ let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+ InspectorTest.assert(false, "Should not fire MessageAdded, this should be a repeat.");
+ reject();
+ });
+
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+ InspectorTest.expectThat(event, "PreviousMessageRepeatCountUpdated should fire.");
+ InspectorTest.expectThat(event.data.count === 2, "Count should be 2.");
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, listener, null);
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "AddTestMessageAgain",
+ description: "Add the original message again, it should have a single repeat count.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage(testMessage);
+
+ let listener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+ InspectorTest.assert(false, "Should not fire PreviousMessageRepeatCountUpdated yet.");
+ reject();
+ });
+
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.MessageAdded, (event) => {
+ InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+ InspectorTest.expectThat(event.data.message.repeatCount === 1, "ConsoleMessage repeatCount is 1.");
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, listener, null);
+ resolve();
+ });
+ }
+ });
+
+ // --------
+
+ suite.addTestCase({
+ name: "MessagesWithEqualValuesRepeats",
+ description: "Repeat messages with equal values should trigger messageRepeatCountUpdated.",
+ test: (resolve, reject) => {
+ const messageWithValues = "console.log('equal parameter values', 1, 2)";
+ InspectorTest.evaluateInPage(messageWithValues);
+ InspectorTest.evaluateInPage(messageWithValues);
+
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+ InspectorTest.expectThat(event, "PreviousMessageRepeatCountUpdated should fire for repeat messages with equal values.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "MessagesWithObjectsDoNotRepeat",
+ description: "Repeat messages with objects should not trigger messageRepeatCountUpdated.",
+ test: (resolve, reject) => {
+ const messageWithObject = "console.log('object', window)";
+ InspectorTest.evaluateInPage(messageWithObject);
+ InspectorTest.evaluateInPage(messageWithObject);
+
+ let repeatListener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+ InspectorTest.assert(false, "PreviousMessageRepeatCountUpdated should not fire for repeat messages with object arguments.");
+ reject();
+ });
+
+ let remaining = 2;
+ WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function addListener(event) {
+ InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+ remaining--;
+ if (!remaining) {
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, repeatListener, null);
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, addListener, null);
+ resolve();
+ }
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "MessagesWithDifferentLevelsDoNotRepeat",
+ description: "Repeat messages with different levels should not trigger messageRepeatCountUpdated.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("console.warn('level')");
+ InspectorTest.evaluateInPage("console.error('level')");
+
+ let repeatListener = WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, (event) => {
+ InspectorTest.assert(false, "PreviousMessageRepeatCountUpdated should not fire for repeat messages with different levels.");
+ reject();
+ });
+
+ let remaining = 2;
+ WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function addListener(event) {
+ InspectorTest.expectThat(event.data.message instanceof WebInspector.ConsoleMessage, "MessageAdded event should fire.");
+ remaining--;
+ if (!remaining) {
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated, repeatListener, null);
+ WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.MessageAdded, addListener, null);
+ resolve();
+ }
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Test for the Console.messageRepeatCountUpdated event.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolemessagesClearedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/messagesCleared-expected.txt (0 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/messagesCleared-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector/console/messagesCleared-expected.txt        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Test for the Console.messagesCleared event.
+
+
+== Running test suite: Console.messagesCleared
+-- Running test case: ClearViaConsoleClearMessagesAPI
+PASS: Cleared event should fire.
+
+-- Running test case: ClearViaConsoleAPI
+PASS: Cleared event should fire.
+
+-- Running test case: ClearViaCommandLineAPI
+PASS: Cleared event should fire.
+
+-- Running test case: ClearViaPageReload
+PASS: Cleared event should fire.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorconsolemessagesClearedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/messagesCleared.html (0 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/messagesCleared.html         (rev 0)
+++ trunk/LayoutTests/inspector/console/messagesCleared.html        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script>
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("Console.messagesCleared");
+
+ suite.addTestCase({
+ name: "ClearViaConsoleClearMessagesAPI",
+ description: "Calling Console.clearMessages should trigger Console.messagesCleared.",
+ test: (resolve, reject) => {
+ ConsoleAgent.clearMessages();
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.Cleared, (event) => {
+ InspectorTest.expectThat(event, "Cleared event should fire.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "ClearViaConsoleAPI",
+ description: "Calling console.clear() should trigger Console.messagesCleared.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("console.clear()");
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.Cleared, (event) => {
+ InspectorTest.expectThat(event, "Cleared event should fire.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "ClearViaCommandLineAPI",
+ description: "Calling `clear()` in the command line API should trigger Console.messagesCleared.",
+ test: (resolve, reject) => {
+ const objectGroup = "test";
+ const includeCommandLineAPI = true;
+ const ignorePauseOnExceptionsAndMute = false;
+ const shouldReturnByValue = false;
+ const shouldGeneratePreview = false;
+ const shouldSaveResult = false;
+ WebInspector.runtimeManager.evaluateInInspectedWindow("clear()", objectGroup, includeCommandLineAPI, ignorePauseOnExceptionsAndMute, shouldReturnByValue, shouldGeneratePreview, shouldSaveResult, function(){});
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.Cleared, (event) => {
+ InspectorTest.expectThat(event, "Cleared event should fire.");
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "ClearViaPageReload",
+ description: "Reloading the page should trigger Console.messagesCleared.",
+ test: (resolve, reject) => {
+ InspectorTest.reloadPage();
+ WebInspector.logManager.singleFireEventListener(WebInspector.LogManager.Event.Cleared, (event) => {
+ InspectorTest.expectThat(event, "Cleared event should fire.");
+ resolve();
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Test for the Console.messagesCleared event.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (189372 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-09-04 19:52:15 UTC (rev 189372)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -1,5 +1,16 @@
</span><span class="cx"> 2015-09-04 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><ins>+ Web Inspector: Expand Console domain test coverage
+ https://bugs.webkit.org/show_bug.cgi?id=148740
+
+ Reviewed by Brian Burg.
+
+ * inspector/protocol/Console.json:
+ Update the description of this command now that it only
+ manipulates $0, and not $1, $2, .. $n.
+
+2015-09-04 Joseph Pecoraro <pecoraro@apple.com>
+
</ins><span class="cx"> Web Inspector: Test RuntimeAgent.parse, detecting if a script parse error is recoverable
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=148790
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolConsolejson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Console.json (189372 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Console.json        2015-09-04 19:52:15 UTC (rev 189372)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Console.json        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -61,9 +61,9 @@
</span><span class="cx"> {
</span><span class="cx"> "name": "addInspectedNode",
</span><span class="cx"> "parameters": [
</span><del>- { "name": "nodeId", "$ref": "DOM.NodeId", "description": "DOM node id to be accessible by means of $x command line API." }
</del><ins>+ { "name": "nodeId", "$ref": "DOM.NodeId", "description": "DOM node id to be accessible by means of $0 command line API." }
</ins><span class="cx"> ],
</span><del>- "description": "Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions)."
</del><ins>+ "description": "Enables console to refer to the node with given id via $0 (see Command Line API for more details)."
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "events": [
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (189372 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-09-04 19:52:15 UTC (rev 189372)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-09-04 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Expand Console domain test coverage
+ https://bugs.webkit.org/show_bug.cgi?id=148740
+
+ Reviewed by Brian Burg.
+
+ * UserInterface/Protocol/RemoteObject.js:
+ Add a few helpers for checking the RemoteObject type.
+
</ins><span class="cx"> 2015-09-02 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r189241.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolRemoteObjectjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (189372 => 189373)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js        2015-09-04 19:52:15 UTC (rev 189372)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js        2015-09-04 19:53:59 UTC (rev 189373)
</span><span class="lines">@@ -345,6 +345,16 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ isUndefined()
+ {
+ return this._type === "undefined";
+ }
+
+ isNode()
+ {
+ return this._subtype === "node";
+ }
+
</ins><span class="cx"> isArray()
</span><span class="cx"> {
</span><span class="cx"> return this._subtype === "array";
</span></span></pre>
</div>
</div>
</body>
</html>