<!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>[201404] 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/201404">201404</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2016-05-25 14:58:08 -0700 (Wed, 25 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebSockets] No infrastructure for testing secure web sockets (wss)
https://bugs.webkit.org/show_bug.cgi?id=157884
&lt;rdar://problem/26477197&gt;

Reviewed by Andy Estes.

Source/WebCore:

Add a new test-only flag used to tell CFNetwork that we do not wish to
validate the SLL certificate chain. This allows us to use self-signed
certificates in test cases.

Tests: http/tests/websocket/tests/hybi/simple-wss.html

* page/Settings.cpp:
(WebCore::Settings::setAllowsAnySSLCertificate): Added.
(WebCore::Settings::allowsAnySSLCertificate): Added. This defaults
to False.
* page/Settings.h:
* platform/network/cf/SocketStreamHandleCFNet.cpp:
(WebCore::SocketStreamHandle::createStreams): When running under our
testing infrastructure, do not require full certificate validation.
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::setAllowsAnySSLCertificate): Added.
* testing/js/WebCoreTestSupport.h:
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setAllowsAnySSLCertificate): Added.
* testing/InternalSettings.h:

Tools:

Add support to webkitpy to start and stop a secure Web Socket server running on port 9323
using the certificate, private-key from file LayoutTests/http/conf/webkit-httpd.pem. Also
teaches run-webkit-httpd to start and stop the Web Socket servers.

Modify DumpRenderTree and WebKitTestRunner to understand a new testRunner method,
'setAllowsAnySSLCertificate', which allows us to use the same self-signed test certificate
we do for our HTTPS tests.
        
* DumpRenderTree/TestRunner.cpp:
(setAllowsAnySSLCertificateCallback):
(TestRunner::setAllowsAnySSLCertificate):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting): Make sure we turn off the new flag between tests.
* Scripts/run-webkit-httpd:
(main): Start the websocket server at launch.
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.__init__): Remove dead code.
* Scripts/webkitpy/layout_tests/servers/websocket_server.py:
(PyWebSocket.__init__): Cleanup code.
(PyWebSocket): Pass '--tls-client-ca' to start command.
(PyWebSocket._prepare_config): Cleanups.
* Scripts/webkitpy/port/base.py:
(Port.to.start_http_server):
(Port.to):
(Port.to._extract_certificate_from_pem): Added.
(Port.to._extract_private_key_from_pem): Added.
(Port.to.start_websocket_server): Start secure socket server.
(Port.to.stop_websocket_server): Stop secure socket server.
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Add new API.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::setAllowsAnySSLCertificate): Added.
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setAllowsAnySSLCertificate): Added.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

LayoutTests:

* http/tests/websocket/tests/hybi/simple-wss-expected.txt: Added.
* http/tests/websocket/tests/hybi/simple-wss.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageSettingscpp">trunk/Source/WebCore/page/Settings.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSettingsh">trunk/Source/WebCore/page/Settings.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSocketStreamHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingscpp">trunk/Source/WebCore/testing/InternalSettings.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingsh">trunk/Source/WebCore/testing/InternalSettings.h</a></li>
<li><a href="#trunkSourceWebCoretestingjsWebCoreTestSupportcpp">trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingjsWebCoreTestSupporth">trunk/Source/WebCore/testing/js/WebCoreTestSupport.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestRunnercpp">trunk/Tools/DumpRenderTree/TestRunner.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="#trunkToolsScriptsrunwebkithttpd">trunk/Tools/Scripts/run-webkit-httpd</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testscontrollersmanagerpy">trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py</a></li>
<li><a href="#trunkToolsScriptswebkitpylayout_testsserverswebsocket_serverpy">trunk/Tools/Scripts/webkitpy/layout_tests/servers/websocket_server.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportbasepy">trunk/Tools/Scripts/webkitpy/port/base.py</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl</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="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestswebsockettestshybisimplewssexpectedtxt">trunk/LayoutTests/http/tests/websocket/tests/hybi/simple-wss-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestswebsockettestshybisimplewsshtml">trunk/LayoutTests/http/tests/websocket/tests/hybi/simple-wss.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/LayoutTests/ChangeLog        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-05-25  Daniel Bates  &lt;dabates@apple.com&gt; and Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        [WebSockets] No infrastructure for testing secure web sockets (wss)
+        https://bugs.webkit.org/show_bug.cgi?id=157884
+        &lt;rdar://problem/26477197&gt;
+
+        Reviewed by Andy Estes.
+
+        * http/tests/websocket/tests/hybi/simple-wss-expected.txt: Added.
+        * http/tests/websocket/tests/hybi/simple-wss.html: Added.
+
</ins><span class="cx"> 2016-05-25  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Marking http/tests/css/shared-stylesheet-mutation.html as flaky
</span></span></pre></div>
<a id="trunkLayoutTestshttptestswebsockettestshybisimplewssexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/simple-wss-expected.txt (0 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/websocket/tests/hybi/simple-wss-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/simple-wss-expected.txt        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Simple secure Web Socket test
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+Created a socket to 'wss://127.0.0.1:9323/websocket/tests/hybi/simple'; readyState 0.
+Connected; readyState 1
+Received: 'Hello from Simple WSH.'; readyState 1
+Closed; readyState 3.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestswebsockettestshybisimplewsshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/websocket/tests/hybi/simple-wss.html (0 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/websocket/tests/hybi/simple-wss.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/websocket/tests/hybi/simple-wss.html        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../../../js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div id=&quot;description&quot;&gt;&lt;/div&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+description(&quot;Simple secure Web Socket test&quot;);
+
+window.jsTestIsAsync = true;
+
+if (window.testRunner)
+    testRunner.setAllowsAnySSLCertificate(true);
+
+function endTest()
+{
+    clearTimeout(timeoutID);
+    finishJSTest();
+}
+
+var ws = new WebSocket(&quot;wss://127.0.0.1:9323/websocket/tests/hybi/simple&quot;);
+debug(&quot;Created a socket to '&quot; + ws.URL + &quot;'; readyState &quot; + ws.readyState + &quot;.&quot;);
+
+ws.onopen = function()
+{
+    debug(&quot;Connected; readyState &quot; + ws.readyState);
+};
+
+ws.onmessage = function(messageEvent)
+{
+    debug(&quot;Received: '&quot; + messageEvent.data + &quot;'; readyState &quot; + ws.readyState);
+};
+
+ws.onclose = function()
+{
+    debug(&quot;Closed; readyState &quot; + ws.readyState + &quot;.&quot;);
+    endTest();
+};
+
+function timeOutCallback()
+{
+    debug(&quot;Timed out in state: &quot; + ws.readyState);
+    endTest();
+}
+
+var timeoutID = setTimeout(timeOutCallback, 3000);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../../js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Source/WebCore/ChangeLog        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-05-25  Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        [WebSockets] No infrastructure for testing secure web sockets (wss)
+        https://bugs.webkit.org/show_bug.cgi?id=157884
+        &lt;rdar://problem/26477197&gt;
+
+        Reviewed by Andy Estes.
+
+        Add a new test-only flag used to tell CFNetwork that we do not wish to
+        validate the SLL certificate chain. This allows us to use self-signed
+        certificates in test cases.
+
+        Tests: http/tests/websocket/tests/hybi/simple-wss.html
+
+        * page/Settings.cpp:
+        (WebCore::Settings::setAllowsAnySSLCertificate): Added.
+        (WebCore::Settings::allowsAnySSLCertificate): Added. This defaults
+        to False.
+        * page/Settings.h:
+        * platform/network/cf/SocketStreamHandleCFNet.cpp:
+        (WebCore::SocketStreamHandle::createStreams): When running under our
+        testing infrastructure, do not require full certificate validation.
+        * testing/js/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::setAllowsAnySSLCertificate): Added.
+        * testing/js/WebCoreTestSupport.h:
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::setAllowsAnySSLCertificate): Added.
+        * testing/InternalSettings.h:
+
</ins><span class="cx"> 2016-05-25  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         CRASH at WebCore::WebPlaybackSessionModelMediaElement::selectAudioMediaOption() + 104
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.cpp (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.cpp        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Source/WebCore/page/Settings.cpp        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -101,6 +101,7 @@
</span><span class="cx"> bool Settings::gShouldRespectPriorityInCSSAttributeSetters = false;
</span><span class="cx"> bool Settings::gLowPowerVideoAudioBufferSizeEnabled = false;
</span><span class="cx"> bool Settings::gResourceLoadStatisticsEnabledEnabled = false;
</span><ins>+bool Settings::gAllowsAnySSLCertificate = false;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> bool Settings::gNetworkDataUsageTrackingEnabled = false;
</span><span class="lines">@@ -754,4 +755,14 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Settings::setAllowsAnySSLCertificate(bool allowAnySSLCertificate)
+{
+    gAllowsAnySSLCertificate = allowAnySSLCertificate;
+}
+
+bool Settings::allowsAnySSLCertificate()
+{
+    return gAllowsAnySSLCertificate;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.h (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.h        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Source/WebCore/page/Settings.h        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2011, 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2003-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -285,7 +285,10 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void setForcePendingWebGLPolicy(bool);
</span><span class="cx">     bool isForcePendingWebGLPolicy() const { return m_forcePendingWebGLPolicy; }
</span><del>-    
</del><ins>+
+    WEBCORE_EXPORT static void setAllowsAnySSLCertificate(bool);
+    static bool allowsAnySSLCertificate();
+
</ins><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> #import &lt;WebKitAdditions/SettingsGettersAndSetters.h&gt;
</span><span class="cx"> #endif
</span><span class="lines">@@ -381,6 +384,7 @@
</span><span class="cx"> 
</span><span class="cx">     static bool gLowPowerVideoAudioBufferSizeEnabled;
</span><span class="cx">     static bool gResourceLoadStatisticsEnabledEnabled;
</span><ins>+    static bool gAllowsAnySSLCertificate;
</ins><span class="cx"> 
</span><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> #import &lt;WebKitAdditions/SettingsMembers.h&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSocketStreamHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2009 Apple Inc.  All rights reserved.
</del><ins>+ * Copyright (C) 2009-2016 Apple Inc.  All rights reserved.
</ins><span class="cx">  * Copyright (C) 2009 Google Inc.  All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;NetworkingContext.h&quot;
</span><span class="cx"> #include &quot;ProtectionSpace.h&quot;
</span><ins>+#include &quot;Settings.h&quot;
</ins><span class="cx"> #include &quot;SocketStreamError.h&quot;
</span><span class="cx"> #include &quot;SocketStreamHandleClient.h&quot;
</span><span class="cx"> #include &lt;wtf/Condition.h&gt;
</span><span class="lines">@@ -340,8 +341,9 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (shouldUseSSL()) {
</span><del>-        const void* keys[] = { kCFStreamSSLPeerName, kCFStreamSSLLevel };
-        const void* values[] = { host.get(), kCFStreamSocketSecurityLevelNegotiatedSSL };
</del><ins>+        CFBooleanRef validateCertificateChain = Settings::allowsAnySSLCertificate() ? kCFBooleanFalse : kCFBooleanTrue;
+        const void* keys[] = { kCFStreamSSLPeerName, kCFStreamSSLLevel, kCFStreamSSLValidatesCertificateChain };
+        const void* values[] = { host.get(), kCFStreamSocketSecurityLevelNegotiatedSSL, validateCertificateChain };
</ins><span class="cx">         RetainPtr&lt;CFDictionaryRef&gt; settings = adoptCF(CFDictionaryCreate(0, keys, values, WTF_ARRAY_LENGTH(keys), &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks));
</span><span class="cx">         CFReadStreamSetProperty(m_readStream.get(), kCFStreamPropertySSLSettings, settings.get());
</span><span class="cx">         CFWriteStreamSetProperty(m_writeStream.get(), kCFStreamPropertySSLSettings, settings.get());
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.cpp        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -184,6 +184,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     settings.setUserInterfaceDirectionPolicy(m_userInterfaceDirectionPolicy);
</span><span class="cx">     settings.setSystemLayoutDirection(m_systemLayoutDirection);
</span><ins>+    Settings::setAllowsAnySSLCertificate(false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class InternalSettingsWrapper : public Supplement&lt;Page&gt; {
</span><span class="lines">@@ -618,6 +619,11 @@
</span><span class="cx">     ec = INVALID_ACCESS_ERR;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InternalSettings::setAllowsAnySSLCertificate(bool allowsAnyCertificate)
+{
+    Settings::setAllowsAnySSLCertificate(allowsAnyCertificate);
+}
+
</ins><span class="cx"> // If you add to this list, make sure that you update the Backup class for test reproducability!
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.h (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.h        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Source/WebCore/testing/InternalSettings.h        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2012 Google Inc. All rights reserved.
</span><del>- * Copyright (C) 2013, 2014, 2015, 2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -163,6 +163,8 @@
</span><span class="cx">     String systemLayoutDirection(ExceptionCode&amp;);
</span><span class="cx">     void setSystemLayoutDirection(const String&amp; direction, ExceptionCode&amp;);
</span><span class="cx"> 
</span><ins>+    static void setAllowsAnySSLCertificate(bool);
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit InternalSettings(Page*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoretestingjsWebCoreTestSupportcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011, 2015 Google Inc. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -113,4 +114,9 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void setAllowsAnySSLCertificate(bool allowAnySSLCertificate)
+{
+    InternalSettings::setAllowsAnySSLCertificate(allowAnySSLCertificate);
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingjsWebCoreTestSupporth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/js/WebCoreTestSupport.h (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/js/WebCoreTestSupport.h        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Source/WebCore/testing/js/WebCoreTestSupport.h        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2011, 2015 Google Inc. All rights reserved.
</span><ins>+ * Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -53,6 +54,7 @@
</span><span class="cx"> 
</span><span class="cx"> void setLogChannelToAccumulate(const WTF::String&amp; name) TEST_SUPPORT_EXPORT;
</span><span class="cx"> void initializeLoggingChannelsIfNecessary() TEST_SUPPORT_EXPORT;
</span><ins>+void setAllowsAnySSLCertificate(bool) TEST_SUPPORT_EXPORT;
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/ChangeLog        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2016-05-25  Daniel Bates  &lt;dabates@apple.com&gt; and Brent Fulgham  &lt;bfulgham@apple.com&gt;
+
+        [WebSockets] No infrastructure for testing secure web sockets (wss)
+        https://bugs.webkit.org/show_bug.cgi?id=157884
+        &lt;rdar://problem/26477197&gt;
+
+        Reviewed by Andy Estes.
+
+        Add support to webkitpy to start and stop a secure Web Socket server running on port 9323
+        using the certificate, private-key from file LayoutTests/http/conf/webkit-httpd.pem. Also
+        teaches run-webkit-httpd to start and stop the Web Socket servers.
+
+        Modify DumpRenderTree and WebKitTestRunner to understand a new testRunner method,
+        'setAllowsAnySSLCertificate', which allows us to use the same self-signed test certificate
+        we do for our HTTPS tests.
+        
+        * DumpRenderTree/TestRunner.cpp:
+        (setAllowsAnySSLCertificateCallback):
+        (TestRunner::setAllowsAnySSLCertificate):
+        * DumpRenderTree/TestRunner.h:
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebViewToConsistentStateBeforeTesting): Make sure we turn off the new flag between tests.
+        * Scripts/run-webkit-httpd:
+        (main): Start the websocket server at launch.
+        * Scripts/webkitpy/layout_tests/controllers/manager.py:
+        (Manager.__init__): Remove dead code.
+        * Scripts/webkitpy/layout_tests/servers/websocket_server.py:
+        (PyWebSocket.__init__): Cleanup code.
+        (PyWebSocket): Pass '--tls-client-ca' to start command.
+        (PyWebSocket._prepare_config): Cleanups.
+        * Scripts/webkitpy/port/base.py:
+        (Port.to.start_http_server):
+        (Port.to):
+        (Port.to._extract_certificate_from_pem): Added.
+        (Port.to._extract_private_key_from_pem): Added.
+        (Port.to.start_websocket_server): Start secure socket server.
+        (Port.to.stop_websocket_server): Stop secure socket server.
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Add new API.
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::setAllowsAnySSLCertificate): Added.
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setAllowsAnySSLCertificate): Added.
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
</ins><span class="cx"> 2016-05-25  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         run-jsc-benchmarks should use the new JSBench rather than look for it in the config file.
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.cpp        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1183,6 +1183,15 @@
</span><span class="cx">     return JSValueMakeUndefined(context);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static JSValueRef setAllowsAnySSLCertificateCallback(JSContextRef context, JSObjectRef, JSObjectRef, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    bool allowAnyCertificate = false;
+    if (argumentCount == 1)
+        allowAnyCertificate = JSValueToBoolean(context, arguments[0]);
+    
+    TestRunner::setAllowsAnySSLCertificate(allowAnyCertificate);
+    return JSValueMakeUndefined(context);
+}
</ins><span class="cx"> 
</span><span class="cx"> static JSValueRef setAllowUniversalAccessFromFileURLsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</span><span class="cx"> {
</span><span class="lines">@@ -2101,6 +2110,7 @@
</span><span class="cx">         { &quot;setAcceptsEditing&quot;, setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;setAllowUniversalAccessFromFileURLs&quot;, setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;setAllowFileAccessFromFileURLs&quot;, setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><ins>+        { &quot;setAllowsAnySSLCertificate&quot;, setAllowsAnySSLCertificateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</ins><span class="cx">         { &quot;setAlwaysAcceptCookies&quot;, setAlwaysAcceptCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;setAppCacheMaximumSize&quot;, setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx">         { &quot;setAudioResult&quot;, setAudioResultCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="lines">@@ -2280,3 +2290,8 @@
</span><span class="cx"> 
</span><span class="cx">     WebCoreTestSupport::setLogChannelToAccumulate({ buffer.get() });
</span><span class="cx"> }
</span><ins>+
+void TestRunner::setAllowsAnySSLCertificate(bool allowsAnySSLCertificate)
+{
+    WebCoreTestSupport::setAllowsAnySSLCertificate(allowsAnySSLCertificate);
+}
</ins></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.h (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.h        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/DumpRenderTree/TestRunner.h        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -127,6 +127,8 @@
</span><span class="cx">     void setPageVisibility(const char*);
</span><span class="cx">     void resetPageVisibility();
</span><span class="cx"> 
</span><ins>+    static void setAllowsAnySSLCertificate(bool);
+
</ins><span class="cx">     void waitForPolicyDelegate();
</span><span class="cx">     size_t webHistoryItemCount();
</span><span class="cx">     int windowCount();
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1846,6 +1846,7 @@
</span><span class="cx">     resetWebPreferencesToConsistentValues();
</span><span class="cx"> 
</span><span class="cx">     TestRunner::setSerializeHTTPLoads(false);
</span><ins>+    TestRunner::setAllowsAnySSLCertificate(false);
</ins><span class="cx"> 
</span><span class="cx">     setlocale(LC_ALL, &quot;&quot;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsScriptsrunwebkithttpd"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/run-webkit-httpd (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-webkit-httpd        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/Scripts/run-webkit-httpd        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -66,12 +66,14 @@
</span><span class="cx">         print &quot;Starting httpd on &lt;http://127.0.0.1:%s&gt;&quot; % http_port
</span><span class="cx"> 
</span><span class="cx">     port.start_http_server()
</span><ins>+    port.start_websocket_server()
</ins><span class="cx"> 
</span><span class="cx">     try:
</span><span class="cx">         tail = subprocess.Popen(['tail', '-F', log_file.name], stdout=subprocess.PIPE)
</span><span class="cx">         while True:
</span><span class="cx">             sys.stdout.write(tail.stdout.readline())
</span><span class="cx">     except KeyboardInterrupt:
</span><ins>+        port.stop_websocket_server()
</ins><span class="cx">         port.stop_http_server()
</span><span class="cx"> 
</span><span class="cx"> if __name__ == '__main__':
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testscontrollersmanagerpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -78,16 +78,10 @@
</span><span class="cx">         self._options = options
</span><span class="cx">         self._printer = printer
</span><span class="cx">         self._expectations = None
</span><del>-
</del><span class="cx">         self.HTTP_SUBDIR = 'http' + port.TEST_PATH_SEPARATOR
</span><span class="cx">         self.WEBSOCKET_SUBDIR = 'websocket' + port.TEST_PATH_SEPARATOR
</span><span class="cx">         self.web_platform_test_subdir = self._port.web_platform_test_server_doc_root()
</span><span class="cx">         self.LAYOUT_TESTS_DIRECTORY = 'LayoutTests'
</span><del>-
-        # disable wss server. need to install pyOpenSSL on buildbots.
-        # self._websocket_secure_server = websocket_server.PyWebSocket(
-        #        options.results_directory, use_tls=True, port=9323)
-
</del><span class="cx">         self._results_directory = self._port.results_directory()
</span><span class="cx">         self._finder = LayoutTestFinder(self._port, self._options)
</span><span class="cx">         self._runner = LayoutTestRunner(self._options, self._port, self._printer, self._results_directory, self._test_is_slow)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpylayout_testsserverswebsocket_serverpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/layout_tests/servers/websocket_server.py (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/layout_tests/servers/websocket_server.py        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/servers/websocket_server.py        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> # Copyright (C) 2011 Google Inc. All rights reserved.
</span><ins>+# Copyright (C) 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -39,8 +40,8 @@
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-_WS_LOG_PREFIX = 'pywebsocket.ws.log-'
-_WSS_LOG_PREFIX = 'pywebsocket.wss.log-'
</del><ins>+_WS_LOG_NAME = 'pywebsocket.ws.log'
+_WSS_LOG_NAME = 'pywebsocket.wss.log'
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> _DEFAULT_WS_PORT = 8880
</span><span class="lines">@@ -102,13 +103,12 @@
</span><span class="cx">                 self._web_socket_tests = None
</span><span class="cx"> 
</span><span class="cx">         if self._use_tls:
</span><del>-            self._log_prefix = _WSS_LOG_PREFIX
</del><ins>+            self._log_prefix = _WSS_LOG_NAME
</ins><span class="cx">         else:
</span><del>-            self._log_prefix = _WS_LOG_PREFIX
</del><ins>+            self._log_prefix = _WS_LOG_NAME
</ins><span class="cx"> 
</span><span class="cx">     def _prepare_config(self):
</span><del>-        time_str = time.strftime('%d%b%Y-%H%M%S')
-        log_file_name = self._log_prefix + time_str
</del><ins>+        log_file_name = self._log_prefix
</ins><span class="cx">         # FIXME: Doesn't Executive have a devnull, so that we don't have to use os.devnull directly?
</span><span class="cx">         self._wsin = open(os.devnull, 'r')
</span><span class="cx"> 
</span><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx">             start_cmd.extend(['-t', '-k', self._private_key,
</span><span class="cx">                               '-c', self._certificate])
</span><span class="cx">             if self._ca_certificate:
</span><del>-                start_cmd.append('--ca-certificate')
</del><ins>+                start_cmd.append('--tls-client-ca')
</ins><span class="cx">                 start_cmd.append(self._ca_certificate)
</span><span class="cx"> 
</span><span class="cx">         self._start_cmd = start_cmd
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportbasepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/base.py (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/base.py        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/Scripts/webkitpy/port/base.py        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -918,6 +918,12 @@
</span><span class="cx">         server.start()
</span><span class="cx">         self._http_server = server
</span><span class="cx"> 
</span><ins>+    def _extract_certificate_from_pem(self, pem_file, destination_certificate_file):
+        return self._executive.run_command(['openssl', 'x509', '-outform', 'pem', '-in', pem_file, '-out', destination_certificate_file], return_exit_code=True) == 0
+
+    def _extract_private_key_from_pem(self, pem_file, destination_private_key_file):
+        return self._executive.run_command(['openssl', 'rsa', '-in', pem_file, '-out', destination_private_key_file], return_exit_code=True) == 0
+
</ins><span class="cx">     def start_websocket_server(self):
</span><span class="cx">         &quot;&quot;&quot;Start a web server. Raise an error if it can't start or is already running.
</span><span class="cx"> 
</span><span class="lines">@@ -928,6 +934,17 @@
</span><span class="cx">         server.start()
</span><span class="cx">         self._websocket_server = server
</span><span class="cx"> 
</span><ins>+        pem_file = self._filesystem.join(self.layout_tests_dir(), &quot;http&quot;, &quot;conf&quot;, &quot;webkit-httpd.pem&quot;)
+        websocket_server_temporary_directory = self._filesystem.mkdtemp(prefix='webkitpy-websocket-server')
+        certificate_file = self._filesystem.join(str(websocket_server_temporary_directory), 'webkit-httpd.crt')
+        private_key_file = self._filesystem.join(str(websocket_server_temporary_directory), 'webkit-httpd.key')
+        self._websocket_server_temporary_directory = websocket_server_temporary_directory
+        if self._extract_certificate_from_pem(pem_file, certificate_file) and self._extract_private_key_from_pem(pem_file, private_key_file):
+            secure_server = self._websocket_secure_server = websocket_server.PyWebSocket(self, self.results_directory(),
+                                use_tls=True, port=9323, private_key=private_key_file, certificate=certificate_file)
+            secure_server.start()
+            self._websocket_secure_server = secure_server
+
</ins><span class="cx">     def start_web_platform_test_server(self, additional_dirs=None, number_of_servers=None):
</span><span class="cx">         assert not self._web_platform_test_server, 'Already running a Web Platform Test server.'
</span><span class="cx"> 
</span><span class="lines">@@ -964,6 +981,11 @@
</span><span class="cx">         if self._websocket_server:
</span><span class="cx">             self._websocket_server.stop()
</span><span class="cx">             self._websocket_server = None
</span><ins>+        if self._websocket_secure_server:
+            self._websocket_secure_server.stop()
+            self._websocket_secure_server = None
+        if self._websocket_server_temporary_directory:
+            self._filesystem.rmtree(str(self._websocket_server_temporary_directory))
</ins><span class="cx"> 
</span><span class="cx">     def stop_web_platform_test_server(self):
</span><span class="cx">         if self._web_platform_test_server:
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsTestRunneridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -202,6 +202,8 @@
</span><span class="cx">     void setAuthenticationUsername(DOMString username);
</span><span class="cx">     void setAuthenticationPassword(DOMString password);
</span><span class="cx"> 
</span><ins>+    void setAllowsAnySSLCertificate(boolean value);
+
</ins><span class="cx">     // Secure text input mode (Mac only)
</span><span class="cx">     readonly attribute boolean secureEventInputIsEnabled;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundlecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;ActivateFonts.h&quot;
</span><span class="cx"> #include &quot;InjectedBundlePage.h&quot;
</span><span class="cx"> #include &quot;StringFunctions.h&quot;
</span><ins>+#include &quot;WebCoreTestSupport.h&quot;
</ins><span class="cx"> #include &lt;WebKit/WKBundle.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKBundlePage.h&gt;
</span><span class="cx"> #include &lt;WebKit/WKBundlePagePrivate.h&gt;
</span><span class="lines">@@ -736,4 +737,9 @@
</span><span class="cx">     return m_allowedHosts.contains(toWTFString(host));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InjectedBundle::setAllowsAnySSLCertificate(bool allowsAnySSLCertificate)
+{
+    WebCoreTestSupport::setAllowsAnySSLCertificate(allowsAnySSLCertificate);
+}
+
</ins><span class="cx"> } // namespace WTR
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleInjectedBundleh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -123,6 +123,8 @@
</span><span class="cx"> 
</span><span class="cx">     unsigned imageCountInGeneralPasteboard() const;
</span><span class="cx"> 
</span><ins>+    void setAllowsAnySSLCertificate(bool);
+    
</ins><span class="cx"> private:
</span><span class="cx">     InjectedBundle();
</span><span class="cx">     ~InjectedBundle();
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -369,6 +369,11 @@
</span><span class="cx">     WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TestRunner::setAllowsAnySSLCertificate(bool enabled)
+{
+    InjectedBundle::singleton().setAllowsAnySSLCertificate(enabled);
+}
+
</ins><span class="cx"> void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled)
</span><span class="cx"> {
</span><span class="cx">     auto&amp; injectedBundle = InjectedBundle::singleton();
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (201403 => 201404)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2016-05-25 21:57:03 UTC (rev 201403)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2016-05-25 21:58:08 UTC (rev 201404)
</span><span class="lines">@@ -123,6 +123,7 @@
</span><span class="cx">     void setCacheModel(int);
</span><span class="cx">     void setAsynchronousSpellCheckingEnabled(bool);
</span><span class="cx">     void setDownloadAttributeEnabled(bool);
</span><ins>+    void setAllowsAnySSLCertificate(bool);
</ins><span class="cx"> 
</span><span class="cx">     // Special DOM functions.
</span><span class="cx">     void clearBackForwardList();
</span></span></pre>
</div>
</div>

</body>
</html>