<!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>[209798] 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/209798">209798</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-12-14 04:22:47 -0800 (Wed, 14 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Test infrastructure should allow to filter out text output before doing a comparison with the baseline
https://bugs.webkit.org/show_bug.cgi?id=161310

Patch by Youenn Fablet &lt;youenn@apple.com&gt; on 2016-12-14
Reviewed by Ryosuke Niwa.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/cors/cors-preflight.html: Adding a console log line to ensure the DumpJSConsoleLogInStdErr modifier works.

Tools:

Adding --dump-jsconsolelog-in-stderr test option for DRT and WTR.
When set, WTR and DRT output JS console log in the stderr and not the test output.
This allows removing potentially flaky information while still being able to read it for investigation.

Updated webkitpy infrastructure to use this test option in case of DumpJSConsoleLogInStdErr modifier.

Changes are covered by updating a fetch test to output console log and set its option to --dump-jsconsolelog-in-stderr in TestExpectations.
This test should have this option when fetch API will start logging resource loader errors.

* DumpRenderTree/DumpRenderTree.h:
(TestCommand::TestCommand): Deleted.
* DumpRenderTree/DumpRenderTreeCommon.cpp:
(parseInputLine):
* DumpRenderTree/TestRunner.h:
(TestRunner::setDumpJSConsoleLogInStdErr):
(TestRunner::dumpJSConsoleLogInStdErr):
* DumpRenderTree/mac/DumpRenderTree.mm:
(runTest):
* DumpRenderTree/mac/UIDelegate.mm:
(-[UIDelegate webView:addMessageToConsole:withSource:]):
* DumpRenderTree/win/DumpRenderTree.cpp:
(runTest):
* DumpRenderTree/win/UIDelegate.cpp:
(UIDelegate::webViewAddMessageToConsole):
* Scripts/webkitpy/layout_tests/models/test_expectations.py:
(TestExpectationParser._tokenize_line):
* Scripts/webkitpy/port/driver.py:
(Driver._command_from_driver_input):
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didReceiveMessageToPage):
(WTR::InjectedBundle::dumpToStdErr):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(WTR::InjectedBundle::dumpJSConsoleLogInStdErr):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::willAddMessageToConsole):
* WebKitTestRunner/TestController.cpp:
(WTR::parseInputLine):
(WTR::TestController::runTest):
(WTR::TestCommand::TestCommand): Deleted.
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::invoke):
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
* WebKitTestRunner/TestInvocation.h:
(WTR::TestInvocation::setDumpJSConsoleLogInStdErr):

LayoutTests:

* TestExpectations: Adding DumpJSConsoleLogInStdErr to the fetch modified test to ensure this modifier works as expected.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapicorscorspreflighthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.html</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeDumpRenderTreeh">trunk/Tools/DumpRenderTree/DumpRenderTree.h</a></li>
<li><a href="#trunkToolsDumpRenderTreeDumpRenderTreeCommoncpp">trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestRunnerh">trunk/Tools/DumpRenderTree/TestRunner.h</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreemm">trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacUIDelegatemm">trunk/Tools/DumpRenderTree/mac/UIDelegate.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreewinDumpRenderTreecpp">trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreewinUIDelegatecpp">trunk/Tools/DumpRenderTree/win/UIDelegate.cpp</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testscontrollersmanagerpy">trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testscontrollerssingle_test_runnerpy">trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsmodelstest_expectationspy">trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsmodelstest_inputpy">trunk/Tools/Scripts/webkitpy/layout_tests/models/test_input.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdriverpy">trunk/Tools/Scripts/webkitpy/port/driver.py</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundleh">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp">trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationcpp">trunk/Tools/WebKitTestRunner/TestInvocation.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestInvocationh">trunk/Tools/WebKitTestRunner/TestInvocation.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/LayoutTests/ChangeLog        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-12-14  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+        Test infrastructure should allow to filter out text output before doing a comparison with the baseline
+        https://bugs.webkit.org/show_bug.cgi?id=161310
+
+        Reviewed by Ryosuke Niwa.
+
+        * TestExpectations: Adding DumpJSConsoleLogInStdErr to the fetch modified test to ensure this modifier works as expected.
+
</ins><span class="cx"> 2016-12-14  Enrique Ocaña González  &lt;eocanha@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/LayoutTests/TestExpectations        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -298,6 +298,8 @@
</span><span class="cx"> webkit.org/b/157145 imported/w3c/web-platform-tests/fetch/nosniff/stylesheet.html [ Failure Pass ]
</span><span class="cx"> webkit.org/b/161312 imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/document-without-browsing-context.html [ Failure Pass ]
</span><span class="cx"> 
</span><ins>+imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.html [ DumpJSConsoleLogInStdErr ]
+
</ins><span class="cx"> webkit.org/b/159724 imported/w3c/web-platform-tests/XMLHttpRequest/send-redirect-post-upload.htm [ Failure Pass ]
</span><span class="cx"> 
</span><span class="cx"> # New W3C ref tests that are failing.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-12-14  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+        Test infrastructure should allow to filter out text output before doing a comparison with the baseline
+        https://bugs.webkit.org/show_bug.cgi?id=161310
+
+        Reviewed by Ryosuke Niwa.
+
+        * web-platform-tests/fetch/api/cors/cors-preflight.html: Adding a console log line to ensure the DumpJSConsoleLogInStdErr modifier works.
+
</ins><span class="cx"> 2016-12-12  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove bindings generation support for legacy WebCore::Dictionary
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapicorscorspreflighthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.html (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.html        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight.html        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -16,6 +16,11 @@
</span><span class="cx">     &lt;script src=&quot;../resources/utils.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;/common/get-host-info.sub.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;/common/utils.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script&gt;
+// To be removed, see https://bugs.webkit.org/show_bug.cgi?id=161310
+console.log(&quot;Doing some logging once&quot;)
+console.log(&quot;Doing some logging again&quot;)
+    &lt;/script&gt;
</ins><span class="cx">     &lt;script src=&quot;cors-preflight.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">   &lt;/body&gt;
</span><span class="cx"> &lt;/html&gt;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/ChangeLog        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2016-12-14  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+        Test infrastructure should allow to filter out text output before doing a comparison with the baseline
+        https://bugs.webkit.org/show_bug.cgi?id=161310
+
+        Reviewed by Ryosuke Niwa.
+
+        Adding --dump-jsconsolelog-in-stderr test option for DRT and WTR.
+        When set, WTR and DRT output JS console log in the stderr and not the test output.
+        This allows removing potentially flaky information while still being able to read it for investigation.
+
+        Updated webkitpy infrastructure to use this test option in case of DumpJSConsoleLogInStdErr modifier.
+
+        Changes are covered by updating a fetch test to output console log and set its option to --dump-jsconsolelog-in-stderr in TestExpectations.
+        This test should have this option when fetch API will start logging resource loader errors.
+
+        * DumpRenderTree/DumpRenderTree.h:
+        (TestCommand::TestCommand): Deleted.
+        * DumpRenderTree/DumpRenderTreeCommon.cpp:
+        (parseInputLine):
+        * DumpRenderTree/TestRunner.h:
+        (TestRunner::setDumpJSConsoleLogInStdErr):
+        (TestRunner::dumpJSConsoleLogInStdErr):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (runTest):
+        * DumpRenderTree/mac/UIDelegate.mm:
+        (-[UIDelegate webView:addMessageToConsole:withSource:]):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (runTest):
+        * DumpRenderTree/win/UIDelegate.cpp:
+        (UIDelegate::webViewAddMessageToConsole):
+        * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+        (TestExpectationParser._tokenize_line):
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._command_from_driver_input):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessageToPage):
+        (WTR::InjectedBundle::dumpToStdErr):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        (WTR::InjectedBundle::dumpJSConsoleLogInStdErr):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::willAddMessageToConsole):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::parseInputLine):
+        (WTR::TestController::runTest):
+        (WTR::TestCommand::TestCommand): Deleted.
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::invoke):
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+        * WebKitTestRunner/TestInvocation.h:
+        (WTR::TestInvocation::setDumpJSConsoleLogInStdErr):
+
+
</ins><span class="cx"> 2016-12-14  Enrique Ocaña González  &lt;eocanha@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r207879-207891): [GStreamer] Introduced many layout test failures and crashes, bots exiting early
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeDumpRenderTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.h (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/DumpRenderTree.h        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.h        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -57,12 +57,11 @@
</span><span class="cx"> void displayWebView();
</span><span class="cx"> 
</span><span class="cx"> struct TestCommand {
</span><del>-    TestCommand() : shouldDumpPixels(false), timeout(30000) { }
-
</del><span class="cx">     std::string pathOrURL;
</span><del>-    bool shouldDumpPixels;
</del><ins>+    bool shouldDumpPixels { false };
</ins><span class="cx">     std::string expectedPixelHash;
</span><del>-    int timeout; // in ms
</del><ins>+    int timeout { 30000 }; // in ms
+    bool dumpJSConsoleLogInStdErr { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> TestCommand parseInputLine(const std::string&amp;);
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeDumpRenderTreeCommoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/DumpRenderTree/DumpRenderTreeCommon.cpp        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
</ins><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;DumpRenderTree.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -70,14 +95,16 @@
</span><span class="cx">     result.pathOrURL = arg;
</span><span class="cx">     while (tokenizer.hasNext()) {
</span><span class="cx">         arg = tokenizer.next();
</span><del>-        if (arg == std::string(&quot;--timeout&quot;)) {
</del><ins>+        if (arg == &quot;--timeout&quot;) {
</ins><span class="cx">             std::string timeoutToken = tokenizer.next();
</span><span class="cx">             result.timeout = atoi(timeoutToken.c_str());
</span><del>-        } else if (arg == std::string(&quot;-p&quot;) || arg == std::string(&quot;--pixel-test&quot;)) {
</del><ins>+        } else if (arg == &quot;-p&quot; || arg == &quot;--pixel-test&quot;) {
</ins><span class="cx">             result.shouldDumpPixels = true;
</span><span class="cx">             if (tokenizer.hasNext())
</span><span class="cx">                 result.expectedPixelHash = tokenizer.next();
</span><del>-        } else
</del><ins>+        } else if (arg == &quot;--dump-jsconsolelog-in-stderr&quot;)
+            result.dumpJSConsoleLogInStdErr = true;
+        else
</ins><span class="cx">             die(inputLine);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.h (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.h        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/DumpRenderTree/TestRunner.h        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -367,9 +367,12 @@
</span><span class="cx">     double timeout() { return m_timeout; }
</span><span class="cx"> 
</span><span class="cx">     unsigned imageCountInGeneralPasteboard() const;
</span><del>-    
</del><ins>+
</ins><span class="cx">     void callUIScriptCallback(unsigned callbackID, JSStringRef result);
</span><span class="cx"> 
</span><ins>+    void setDumpJSConsoleLogInStdErr(bool inStdErr) { m_dumpJSConsoleLogInStdErr = inStdErr; }
+    bool dumpJSConsoleLogInStdErr() const { return m_dumpJSConsoleLogInStdErr; }
+
</ins><span class="cx"> private:
</span><span class="cx">     TestRunner(const std::string&amp; testURL, const std::string&amp; expectedPixelHash);
</span><span class="cx"> 
</span><span class="lines">@@ -434,6 +437,7 @@
</span><span class="cx">     bool m_areLegacyWebNotificationPermissionRequestsIgnored;
</span><span class="cx">     bool m_customFullScreenBehavior;
</span><span class="cx">     bool m_hasPendingWebNotificationClick;
</span><ins>+    bool m_dumpJSConsoleLogInStdErr { false };
</ins><span class="cx"> 
</span><span class="cx">     double m_databaseDefaultQuota;
</span><span class="cx">     double m_databaseMaxQuota;
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -2001,6 +2001,7 @@
</span><span class="cx">     gTestRunner = TestRunner::create(testURL, command.expectedPixelHash);
</span><span class="cx">     gTestRunner-&gt;setAllowedHosts(allowedHosts);
</span><span class="cx">     gTestRunner-&gt;setCustomTimeout(command.timeout);
</span><ins>+    gTestRunner-&gt;setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr);
</ins><span class="cx">     topLoadingFrame = nil;
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">     ASSERT(!draggingInfo); // the previous test should have called eventSender.mouseUp to drop!
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacUIDelegatemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/UIDelegate.mm (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/UIDelegate.mm        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/DumpRenderTree/mac/UIDelegate.mm        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -82,10 +82,11 @@
</span><span class="cx">     if (range.location != NSNotFound)
</span><span class="cx">         message = [[message substringToIndex:range.location] stringByAppendingString:[[message substringFromIndex:NSMaxRange(range)] lastPathComponent]];
</span><span class="cx"> 
</span><del>-    printf (&quot;CONSOLE MESSAGE: &quot;);
</del><ins>+    auto out = gTestRunner-&gt;dumpJSConsoleLogInStdErr() ? stderr : stdout;
+    fprintf(out, &quot;CONSOLE MESSAGE: &quot;);
</ins><span class="cx">     if ([lineNumber intValue])
</span><del>-        printf (&quot;line %d: &quot;, [lineNumber intValue]);
-    printf (&quot;%s\n&quot;, [message UTF8String]);
</del><ins>+        fprintf(out, &quot;line %d: &quot;, [lineNumber intValue]);
+    fprintf(out, &quot;%s\n&quot;, [message UTF8String]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)modalWindowWillClose:(NSNotification *)notification
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinDumpRenderTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -1121,6 +1121,8 @@
</span><span class="cx"> 
</span><span class="cx">     ::gTestRunner = TestRunner::create(testURL.data(), command.expectedPixelHash);
</span><span class="cx">     ::gTestRunner-&gt;setCustomTimeout(command.timeout);
</span><ins>+    ::gTestRunner-&gt;setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr);
+
</ins><span class="cx">     topLoadingFrame = nullptr;
</span><span class="cx">     done = false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinUIDelegatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/UIDelegate.cpp (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/UIDelegate.cpp        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/DumpRenderTree/win/UIDelegate.cpp        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -507,10 +507,11 @@
</span><span class="cx">             newMessage = newMessage.substr(0, fileProtocol) + lastPathComponent(newMessage.substr(fileProtocol + fileURL.size()));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    printf(&quot;CONSOLE MESSAGE: &quot;);
</del><ins>+    auto out = gTestRunner-&gt;dumpJSConsoleLogInStdErr() ? stderr : stdout;
+    fprintf(out, &quot;CONSOLE MESSAGE: &quot;);
</ins><span class="cx">     if (lineNumber)
</span><del>-        printf(&quot;line %d: &quot;, lineNumber);
-    printf(&quot;%s\n&quot;, toUTF8(newMessage).c_str());
</del><ins>+        fprintf(out, &quot;line %d: &quot;, lineNumber);
+    fprintf(out, &quot;%s\n&quot;, toUTF8(newMessage).c_str());
</ins><span class="cx">     return S_OK;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testscontrollersmanagerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -131,7 +131,8 @@
</span><span class="cx">     def _test_input_for_file(self, test_file):
</span><span class="cx">         return TestInput(test_file,
</span><span class="cx">             self._options.slow_time_out_ms if self._test_is_slow(test_file) else self._options.time_out_ms,
</span><del>-            self._is_http_test(test_file))
</del><ins>+            self._is_http_test(test_file),
+            should_dump_jsconsolelog_in_stderr=self._test_should_dump_jsconsolelog_in_stderr(test_file))
</ins><span class="cx"> 
</span><span class="cx">     def _test_is_slow(self, test_file):
</span><span class="cx">         if self._expectations.model().has_modifier(test_file, test_expectations.SLOW):
</span><span class="lines">@@ -138,6 +139,9 @@
</span><span class="cx">             return True
</span><span class="cx">         return &quot;slow&quot; in self._tests_options.get(test_file, [])
</span><span class="cx"> 
</span><ins>+    def _test_should_dump_jsconsolelog_in_stderr(self, test_file):
+        return self._expectations.model().has_modifier(test_file, test_expectations.DUMPJSCONSOLELOGINSTDERR)
+
</ins><span class="cx">     def needs_servers(self, test_names):
</span><span class="cx">         return any(self._is_http_test(test_name) for test_name in test_names) and self._options.http
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testscontrollerssingle_test_runnerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx">         self._worker_name = worker_name
</span><span class="cx">         self._test_name = test_input.test_name
</span><span class="cx">         self._should_run_pixel_test = test_input.should_run_pixel_test
</span><ins>+        self._should_dump_jsconsolelog_in_stderr = test_input.should_dump_jsconsolelog_in_stderr
</ins><span class="cx">         self._reference_files = test_input.reference_files
</span><span class="cx">         self._stop_when_done = stop_when_done
</span><span class="cx">         self._timeout = test_input.timeout
</span><span class="lines">@@ -89,7 +90,7 @@
</span><span class="cx">         image_hash = None
</span><span class="cx">         if self._should_fetch_expected_checksum():
</span><span class="cx">             image_hash = self._port.expected_checksum(self._test_name)
</span><del>-        return DriverInput(self._test_name, self._timeout, image_hash, self._should_run_pixel_test)
</del><ins>+        return DriverInput(self._test_name, self._timeout, image_hash, self._should_run_pixel_test, self._should_dump_jsconsolelog_in_stderr)
</ins><span class="cx"> 
</span><span class="cx">     def run(self):
</span><span class="cx">         if self._reference_files:
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsmodelstest_expectationspy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> # FIXME: range() starts with 0 which makes if expectation checks harder
</span><span class="cx"> # as PASS is 0.
</span><span class="cx"> (PASS, FAIL, TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO, TIMEOUT, CRASH, SKIP, WONTFIX,
</span><del>- SLOW, REBASELINE, MISSING, FLAKY, NOW, NONE) = range(16)
</del><ins>+ SLOW, DUMPJSCONSOLELOGINSTDERR, REBASELINE, MISSING, FLAKY, NOW, NONE) = range(17)
</ins><span class="cx"> 
</span><span class="cx"> # FIXME: Perhas these two routines should be part of the Port instead?
</span><span class="cx"> BASELINE_SUFFIX_LIST = ('png', 'wav', 'txt')
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx">     PASS_EXPECTATION = 'pass'
</span><span class="cx">     SKIP_MODIFIER = 'skip'
</span><span class="cx">     SLOW_MODIFIER = 'slow'
</span><ins>+    DUMPJSCONSOLELOGINSTDERR_MODIFIER = 'dumpjsconsoleloginstderr'
</ins><span class="cx">     WONTFIX_MODIFIER = 'wontfix'
</span><span class="cx"> 
</span><span class="cx">     TIMEOUT_EXPECTATION = 'timeout'
</span><span class="lines">@@ -319,7 +320,7 @@
</span><span class="cx">             elif state == 'configuration':
</span><span class="cx">                 modifiers.append(cls._configuration_tokens.get(token, token))
</span><span class="cx">             elif state == 'expectations':
</span><del>-                if token in ('Rebaseline', 'Skip', 'Slow', 'WontFix'):
</del><ins>+                if token in ('Rebaseline', 'Skip', 'Slow', 'WontFix', 'DumpJSConsoleLogInStdErr'):
</ins><span class="cx">                     modifiers.append(token.upper())
</span><span class="cx">                 elif token not in cls._expectation_tokens:
</span><span class="cx">                     warnings.append('Unrecognized expectation &quot;%s&quot;' % token)
</span><span class="lines">@@ -345,7 +346,8 @@
</span><span class="cx">             # FIXME: This is really a semantic warning and shouldn't be here. Remove when we drop the old syntax.
</span><span class="cx">             warnings.append('A test marked Skip must not have other expectations.')
</span><span class="cx">         elif not expectations:
</span><del>-            if 'SKIP' not in modifiers and 'REBASELINE' not in modifiers and 'SLOW' not in modifiers:
</del><ins>+            # FIXME: We can probably simplify this adding 'SKIP' if modifiers is empty
+            if 'SKIP' not in modifiers and 'REBASELINE' not in modifiers and 'SLOW' not in modifiers and 'DUMPJSCONSOLELOGINSTDERR' not in modifiers:
</ins><span class="cx">                 modifiers.append('SKIP')
</span><span class="cx">             expectations = ['PASS']
</span><span class="cx"> 
</span><span class="lines">@@ -467,7 +469,7 @@
</span><span class="cx">             elif modifier.startswith('BUG'):
</span><span class="cx">                 # FIXME: we should preserve case once we can drop the old syntax.
</span><span class="cx">                 bugs.append('Bug(' + modifier[3:].lower() + ')')
</span><del>-            elif modifier in ('SLOW', 'SKIP', 'REBASELINE', 'WONTFIX'):
</del><ins>+            elif modifier in ('SLOW', 'SKIP', 'REBASELINE', 'WONTFIX', 'DUMPJSCONSOLELOGINSTDERR'):
</ins><span class="cx">                 new_expectations.append(TestExpectationParser._inverted_expectation_tokens.get(modifier))
</span><span class="cx">             else:
</span><span class="cx">                 new_modifiers.append(TestExpectationParser._inverted_configuration_tokens.get(modifier, modifier))
</span><span class="lines">@@ -786,6 +788,7 @@
</span><span class="cx">     MODIFIERS = {TestExpectationParser.SKIP_MODIFIER: SKIP,
</span><span class="cx">                  TestExpectationParser.WONTFIX_MODIFIER: WONTFIX,
</span><span class="cx">                  TestExpectationParser.SLOW_MODIFIER: SLOW,
</span><ins>+                 TestExpectationParser.DUMPJSCONSOLELOGINSTDERR_MODIFIER: DUMPJSCONSOLELOGINSTDERR,
</ins><span class="cx">                  TestExpectationParser.REBASELINE_MODIFIER: REBASELINE,
</span><span class="cx">                  'none': NONE}
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsmodelstest_inputpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_input.py (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_input.py        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_input.py        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx"> class TestInput(object):
</span><span class="cx">     &quot;&quot;&quot;Groups information about a test for easy passing of data.&quot;&quot;&quot;
</span><span class="cx"> 
</span><del>-    def __init__(self, test_name, timeout=None, needs_servers=None, reference_files=None, should_run_pixel_tests=None):
</del><ins>+    def __init__(self, test_name, timeout=None, needs_servers=None, reference_files=None, should_run_pixel_tests=None, should_dump_jsconsolelog_in_stderr=None):
</ins><span class="cx">         # TestInput objects are normally constructed by the manager and passed
</span><span class="cx">         # to the workers, but these some fields are set lazily in the workers where possible
</span><span class="cx">         # because they require us to look at the filesystem and we want to be able to do that in parallel.
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx">         self.needs_servers = needs_servers
</span><span class="cx">         self.reference_files = reference_files
</span><span class="cx">         self.should_run_pixel_tests = should_run_pixel_tests
</span><ins>+        self.should_dump_jsconsolelog_in_stderr = should_dump_jsconsolelog_in_stderr
</ins><span class="cx"> 
</span><span class="cx">     def __repr__(self):
</span><del>-        return &quot;TestInput('%s', timeout=%s, needs_servers=%s, reference_files=%s, should_run_pixel_tests=%s)&quot; % (self.test_name, self.timeout, self.needs_servers, self.reference_files, self.should_run_pixel_tests)
</del><ins>+        return &quot;TestInput('%s', timeout=%s, needs_servers=%s, reference_files=%s, should_run_pixel_tests=%s, should_dump_jsconsolelog_in_stderr=%s)&quot; % (self.test_name, self.timeout, self.needs_servers, self.reference_files, self.should_run_pixel_tests, self.should_dump_jsconsolelog_in_stderr)
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdriverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/driver.py        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> 
</span><span class="cx"> import base64
</span><del>-import copy
</del><span class="cx"> import logging
</span><span class="cx"> import re
</span><span class="cx"> import shlex
</span><span class="lines">@@ -38,7 +37,6 @@
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.common.system import path
</span><span class="cx"> from webkitpy.common.system.profiler import ProfilerFactory
</span><del>-from webkitpy.layout_tests.servers.web_platform_test_server import WebPlatformTestServer
</del><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="lines">@@ -45,15 +43,16 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class DriverInput(object):
</span><del>-    def __init__(self, test_name, timeout, image_hash, should_run_pixel_test, args=None):
</del><ins>+    def __init__(self, test_name, timeout, image_hash, should_run_pixel_test, should_dump_jsconsolelog_in_stderr=None, args=None):
</ins><span class="cx">         self.test_name = test_name
</span><span class="cx">         self.timeout = timeout  # in ms
</span><span class="cx">         self.image_hash = image_hash
</span><span class="cx">         self.should_run_pixel_test = should_run_pixel_test
</span><ins>+        self.should_dump_jsconsolelog_in_stderr = should_dump_jsconsolelog_in_stderr
</ins><span class="cx">         self.args = args or []
</span><span class="cx"> 
</span><span class="cx">     def __repr__(self):
</span><del>-        return &quot;DriverInput(test_name='{}', timeout={}, image_hash={}, should_run_pixel_test={}'&quot;.format(self.test_name, self.timeout, self.image_hash, self.should_run_pixel_test)
</del><ins>+        return &quot;DriverInput(test_name='{}', timeout={}, image_hash={}, should_run_pixel_test={}, should_dump_jsconsolelog_in_stderr={}'&quot;.format(self.test_name, self.timeout, self.image_hash, self.should_run_pixel_test, self.should_dump_jsconsolelog_in_stderr)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> class DriverOutput(object):
</span><span class="lines">@@ -487,6 +486,8 @@
</span><span class="cx">             command += &quot;'--timeout'%s&quot; % driver_input.timeout
</span><span class="cx">         if driver_input.should_run_pixel_test:
</span><span class="cx">             command += &quot;'--pixel-test&quot;
</span><ins>+        if driver_input.should_dump_jsconsolelog_in_stderr:
+            command += &quot;'--dump-jsconsolelog-in-stderr&quot;
</ins><span class="cx">         if driver_input.image_hash:
</span><span class="cx">             command += &quot;'&quot; + driver_input.image_hash
</span><span class="cx">         return command + &quot;\n&quot;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -155,6 +155,9 @@
</span><span class="cx">         WKRetainPtr&lt;WKStringRef&gt; timeoutKey(AdoptWK, WKStringCreateWithUTF8CString(&quot;Timeout&quot;));
</span><span class="cx">         m_timeout = (int)WKUInt64GetValue(static_cast&lt;WKUInt64Ref&gt;(WKDictionaryGetItemForKey(messageBodyDictionary, timeoutKey.get())));
</span><span class="cx"> 
</span><ins>+        WKRetainPtr&lt;WKStringRef&gt; dumpJSConsoleLogInStdErrKey(AdoptWK, WKStringCreateWithUTF8CString(&quot;DumpJSConsoleLogInStdErr&quot;));
+        m_dumpJSConsoleLogInStdErr = WKBooleanGetValue(static_cast&lt;WKBooleanRef&gt;(WKDictionaryGetItemForKey(messageBodyDictionary, dumpJSConsoleLogInStdErrKey.get())));
+
</ins><span class="cx">         WKRetainPtr&lt;WKStringRef&gt; ackMessageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;Ack&quot;));
</span><span class="cx">         WKRetainPtr&lt;WKStringRef&gt; ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString(&quot;BeginTest&quot;));
</span><span class="cx">         WKBundlePagePostMessage(page, ackMessageName.get(), ackMessageBody.get());
</span><span class="lines">@@ -411,6 +414,17 @@
</span><span class="cx">         m_pages[i]-&gt;dumpBackForwardList(stringBuilder);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InjectedBundle::dumpToStdErr(const String&amp; output)
+{
+    if (m_state != Testing)
+        return;
+    if (output.isEmpty())
+        return;
+    WKRetainPtr&lt;WKStringRef&gt; messageName(AdoptWK, WKStringCreateWithUTF8CString(&quot;DumpToStdErr&quot;));
+    WKRetainPtr&lt;WKStringRef&gt; messageBody(AdoptWK, WKStringCreateWithUTF8CString(output.utf8().data()));
+    WKBundlePagePostMessage(page()-&gt;page(), messageName.get(), messageBody.get());
+}
+
</ins><span class="cx"> void InjectedBundle::outputText(const String&amp; output)
</span><span class="cx"> {
</span><span class="cx">     if (m_state != Testing)
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundleh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -81,8 +81,10 @@
</span><span class="cx"> 
</span><span class="cx">     bool shouldDumpPixels() const { return m_dumpPixels; }
</span><span class="cx">     bool useWaitToDumpWatchdogTimer() const { return m_useWaitToDumpWatchdogTimer; }
</span><del>-    
</del><ins>+    bool dumpJSConsoleLogInStdErr() const { return m_dumpJSConsoleLogInStdErr; };
+
</ins><span class="cx">     void outputText(const String&amp;);
</span><ins>+    void dumpToStdErr(const String&amp;);
</ins><span class="cx">     void postNewBeforeUnloadReturnValue(bool);
</span><span class="cx">     void postAddChromeInputField();
</span><span class="cx">     void postRemoveChromeInputField();
</span><span class="lines">@@ -180,6 +182,7 @@
</span><span class="cx">     bool m_useWorkQueue;
</span><span class="cx">     int m_timeout;
</span><span class="cx">     bool m_pixelResultIsPending { false };
</span><ins>+    bool m_dumpJSConsoleLogInStdErr { false };
</ins><span class="cx"> 
</span><span class="cx">     WKRetainPtr&lt;WKDataRef&gt; m_audioResult;
</span><span class="cx">     WKRetainPtr&lt;WKImageRef&gt; m_pixelResult;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -1461,7 +1461,11 @@
</span><span class="cx">     }
</span><span class="cx">     stringBuilder.append(messageString);
</span><span class="cx">     stringBuilder.append('\n');
</span><del>-    injectedBundle.outputText(stringBuilder.toString());
</del><ins>+
+    if (injectedBundle.dumpJSConsoleLogInStdErr())
+        injectedBundle.dumpToStdErr(stringBuilder.toString());
+    else
+        injectedBundle.outputText(stringBuilder.toString());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InjectedBundlePage::willSetStatusbarText(WKStringRef statusbarText)
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -1022,12 +1022,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> struct TestCommand {
</span><del>-    TestCommand() : shouldDumpPixels(false), timeout(0) { }
-
</del><span class="cx">     std::string pathOrURL;
</span><del>-    bool shouldDumpPixels;
</del><ins>+    bool shouldDumpPixels { false };
</ins><span class="cx">     std::string expectedPixelHash;
</span><del>-    int timeout;
</del><ins>+    int timeout { 0 };
+    bool dumpJSConsoleLogInStdErr { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class CommandTokenizer {
</span><span class="lines">@@ -1100,7 +1099,9 @@
</span><span class="cx">             result.shouldDumpPixels = true;
</span><span class="cx">             if (tokenizer.hasNext())
</span><span class="cx">                 result.expectedPixelHash = tokenizer.next();
</span><del>-        } else
</del><ins>+        } else if (arg == std::string(&quot;--dump-jsconsolelog-in-stderr&quot;))
+            result.dumpJSConsoleLogInStdErr = true;
+        else
</ins><span class="cx">             die(inputLine);
</span><span class="cx">     }
</span><span class="cx">     return result;
</span><span class="lines">@@ -1122,6 +1123,7 @@
</span><span class="cx">         m_currentInvocation-&gt;setIsPixelTest(command.expectedPixelHash);
</span><span class="cx">     if (command.timeout &gt; 0)
</span><span class="cx">         m_currentInvocation-&gt;setCustomTimeout(command.timeout);
</span><ins>+    m_currentInvocation-&gt;setDumpJSConsoleLogInStdErr(command.dumpJSConsoleLogInStdErr);
</ins><span class="cx"> 
</span><span class="cx">     platformWillRunTest(*m_currentInvocation);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -159,6 +159,10 @@
</span><span class="cx">     WKRetainPtr&lt;WKUInt64Ref&gt; timeoutValue = adoptWK(WKUInt64Create(m_timeout));
</span><span class="cx">     WKDictionarySetItem(beginTestMessageBody.get(), timeoutKey.get(), timeoutValue.get());
</span><span class="cx"> 
</span><ins>+    WKRetainPtr&lt;WKStringRef&gt; dumpJSConsoleLogInStdErrKey = adoptWK(WKStringCreateWithUTF8CString(&quot;DumpJSConsoleLogInStdErr&quot;));
+    WKRetainPtr&lt;WKBooleanRef&gt; dumpJSConsoleLogInStdErrValue = adoptWK(WKBooleanCreate(m_dumpJSConsoleLogInStdErr));
+    WKDictionarySetItem(beginTestMessageBody.get(), dumpJSConsoleLogInStdErrKey.get(), dumpJSConsoleLogInStdErrValue.get());
+
</ins><span class="cx">     WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()-&gt;page(), messageName.get(), beginTestMessageBody.get());
</span><span class="cx"> 
</span><span class="cx">     bool shouldOpenExternalURLs = false;
</span><span class="lines">@@ -371,6 +375,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (WKStringIsEqualToUTF8CString(messageName, &quot;DumpToStdErr&quot;)) {
+        ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+        WKStringRef textOutput = static_cast&lt;WKStringRef&gt;(messageBody);
+        fprintf(stderr, &quot;%s&quot;, toWTFString(textOutput).utf8().data());
+        return;
+    }
+
</ins><span class="cx">     if (WKStringIsEqualToUTF8CString(messageName, &quot;BeforeUnloadReturnValue&quot;)) {
</span><span class="cx">         ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
</span><span class="cx">         WKBooleanRef beforeUnloadReturnValue = static_cast&lt;WKBooleanRef&gt;(messageBody);
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestInvocationh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (209797 => 209798)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestInvocation.h        2016-12-14 11:16:23 UTC (rev 209797)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h        2016-12-14 12:22:47 UTC (rev 209798)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Milliseconds
</span><span class="cx">     void setCustomTimeout(int duration) { m_timeout = duration; }
</span><ins>+    void setDumpJSConsoleLogInStdErr(bool value) { m_dumpJSConsoleLogInStdErr = value; }
</ins><span class="cx"> 
</span><span class="cx">     // Seconds
</span><span class="cx">     double shortTimeout() const;
</span><span class="lines">@@ -102,6 +103,7 @@
</span><span class="cx">     std::string m_expectedPixelHash;
</span><span class="cx"> 
</span><span class="cx">     int m_timeout { 0 };
</span><ins>+    bool m_dumpJSConsoleLogInStdErr { false };
</ins><span class="cx"> 
</span><span class="cx">     // Invocation state
</span><span class="cx">     bool m_gotInitialResponse { false };
</span></span></pre>
</div>
</div>

</body>
</html>