<!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>[186476] 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/186476">186476</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-07-07 14:13:31 -0700 (Tue, 07 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>HTTP Auth cached after disabling private browsing/reset.
&lt;rdar://problem/8293055&gt; and https://bugs.webkit.org/show_bug.cgi?id=146654

Reviewed by Tim Horton.

Source/WebCore:

Test: http/tests/security/private-browsing-http-auth.html

- Change most static CredentialStorage methods to be instance methods instead.
- Make a CredentialStorage objects be per-NetworkStorageSession.

* Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::WebSocketChannel):
(WebCore::WebSocketChannel::connect): Only start the web socket load if a networking
  context is available.

* platform/network/CredentialStorage.cpp:
(WebCore::CredentialStorage::defaultCredentialStorage): Returns the credential storage
  from the default NetworkStorageSession.
(WebCore::CredentialStorage::set):
(WebCore::CredentialStorage::get):
(WebCore::CredentialStorage::remove):
(WebCore::CredentialStorage::findDefaultProtectionSpaceForURL):
(WebCore::CredentialStorage::clearCredentials):
(WebCore::protectionSpaceToCredentialMap): Deleted.
(WebCore::originsWithCredentials): Deleted.
(WebCore::pathToDefaultProtectionSpaceMap): Deleted.
(WebCore::findDefaultProtectionSpaceForURL): Deleted.
(WebCore::CredentialStorage::setPrivateMode): Deleted. Was a no-op anyways.
* platform/network/CredentialStorage.h:

* platform/network/NetworkStorageSession.h:
(WebCore::NetworkStorageSession::credentialStorage):

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::createCFURLConnection):
(WebCore::ResourceHandle::willSendRequest):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):

* platform/network/cf/SocketStreamHandle.h:
(WebCore::SocketStreamHandle::create):
* platform/network/cf/SocketStreamHandleCFNet.cpp:
(WebCore::SocketStreamHandle::SocketStreamHandle):
(WebCore::SocketStreamHandle::getStoredCONNECTProxyCredentials):
(WebCore::getStoredCONNECTProxyCredentials): Deleted.

* platform/network/curl/ResourceHandleCurl.cpp:
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::ResourceHandleManager::applyAuthenticationToRequest):

* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::createNSURLConnection):
(WebCore::ResourceHandle::willSendRequest):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::applyAuthenticationToRequest):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::receivedCredential):

Source/WebKit/mac:

* Misc/WebCache.h:
* Misc/WebCache.mm:
(+[WebCache clearCachedCredentials]): Clear the global CredentialStorage as well as the
  storages belonging to each main frame of each WebView. This method is for DRT.

* Misc/WebDownload.mm:
(-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]):

* Plugins/WebBaseNetscapePluginView.mm:
(WebKit::getAuthenticationInfo):

* WebView/WebView.mm:
(-[WebView _clearCredentials]): Clear the storage belonging to the current networking session
  of the main frame of this WebView.
* WebView/WebViewInternal.h:

Source/WebKit/win:

* WebDownloadCFNet.cpp:
(WebDownload::didReceiveAuthenticationChallenge):

Source/WebKit2:

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::getAuthenticationInfo):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting): Clear in-memory credentials in between test runs.

LayoutTests:

* http/tests/security/private-browsing-http-auth-expected.txt: Added.
* http/tests/security/private-browsing-http-auth.html: Added.
* http/tests/security/resources/auth-echo.php: Added.
* http/tests/security/resources/basic-auth.php: Added.
* platform/wk2/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformwk2TestExpectations">trunk/LayoutTests/platform/wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebsocketsWebSocketChannelcpp">trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkCredentialStoragecpp">trunk/Source/WebCore/platform/network/CredentialStorage.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkCredentialStorageh">trunk/Source/WebCore/platform/network/CredentialStorage.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkNetworkStorageSessionh">trunk/Source/WebCore/platform/network/NetworkStorageSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSocketStreamHandleh">trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfSocketStreamHandleCFNetcpp">trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlResourceHandleCurlcpp">trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlResourceHandleManagercpp">trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm">trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp">trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebCacheh">trunk/Source/WebKit/mac/Misc/WebCache.h</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebCachemm">trunk/Source/WebKit/mac/Misc/WebCache.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebDownloadmm">trunk/Source/WebKit/mac/Misc/WebDownload.mm</a></li>
<li><a href="#trunkSourceWebKitmacPluginsWebBaseNetscapePluginViewmm">trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewInternalh">trunk/Source/WebKit/mac/WebView/WebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinWebDownloadCFNetcpp">trunk/Source/WebKit/win/WebDownloadCFNet.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessPluginsPluginViewcpp">trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreemm">trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestssecurityprivatebrowsinghttpauthexpectedtxt">trunk/LayoutTests/http/tests/security/private-browsing-http-auth-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityprivatebrowsinghttpauthhtml">trunk/LayoutTests/http/tests/security/private-browsing-http-auth.html</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcesauthechophp">trunk/LayoutTests/http/tests/security/resources/auth-echo.php</a></li>
<li><a href="#trunkLayoutTestshttptestssecurityresourcesbasicauthphp">trunk/LayoutTests/http/tests/security/resources/basic-auth.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/LayoutTests/ChangeLog        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-07-07  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        HTTP Auth cached after disabling private browsing/reset.
+        &lt;rdar://problem/8293055&gt; and https://bugs.webkit.org/show_bug.cgi?id=146654
+
+        Reviewed by Tim Horton.
+
+        * http/tests/security/private-browsing-http-auth-expected.txt: Added.
+        * http/tests/security/private-browsing-http-auth.html: Added.
+        * http/tests/security/resources/auth-echo.php: Added.
+        * http/tests/security/resources/basic-auth.php: Added.
+        * platform/wk2/TestExpectations:
+
</ins><span class="cx"> 2015-07-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(169105): CSS Regions: renderer returns wrong selection root when it is inside a column flow.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityprivatebrowsinghttpauthexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/private-browsing-http-auth-expected.txt (0 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/private-browsing-http-auth-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/private-browsing-http-auth-expected.txt        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+http://127.0.0.1:8000/security/resources/basic-auth.php?username=webkit&amp;password=rocks - didReceiveAuthenticationChallenge - Responding with webkit:rocks
+This test makes sure that auth credentials cached during a private browsing session do not leak out after private browsing is disabled.   
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+Authenticated as user: webkit password: rocks
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame1--&gt;--&gt;'
+--------
+Resource loaded with HTTP authentication username '' and password ''
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityprivatebrowsinghttpauthhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/private-browsing-http-auth.html (0 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/private-browsing-http-auth.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/private-browsing-http-auth.html        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+    testRunner.setHandlesAuthenticationChallenges(true);
+    testRunner.setAuthenticationUsername(&quot;webkit&quot;);
+    testRunner.setAuthenticationPassword(&quot;rocks&quot;);
+    testRunner.setPrivateBrowsingEnabled(true);
+    testRunner.waitUntilDone();
+}
+
+function firstFrameLoaded() {
+    if (window.testRunner) {
+        testRunner.setHandlesAuthenticationChallenges(false);
+            testRunner.setPrivateBrowsingEnabled(false);
+    }
+
+    // If the username and password were in the WebCore CredentialStorage, WebKit would automatically send them out for this resource.
+    // The credentials would be wrong, but it would send them out.
+    // Since the credentails that were cached from the first iframe load should have been forgotten after private browsing was disabled,
+    // no credentials should be sent out automatically this time.
+    
+    var frame = document.createElement(&quot;iframe&quot;);
+    frame.setAttribute(&quot;src&quot;, &quot;resources/auth-echo.php&quot;);
+    frame.setAttribute(&quot;onload&quot;, &quot;secondFrameLoaded()&quot;);
+    document.body.appendChild(frame);
+}
+
+function secondFrameLoaded() {
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+&lt;/script&gt;
+&lt;body&gt;
+This test makes sure that auth credentials cached during a private browsing session do not leak out after private browsing is disabled.
+&lt;iframe src=&quot;resources/basic-auth.php?username=webkit&amp;password=rocks&quot; onload=&quot;firstFrameLoaded();&quot;&gt;&lt;/iframe&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcesauthechophp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/resources/auth-echo.php (0 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/auth-echo.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/auth-echo.php        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+&lt;?php
+echo &quot;Resource loaded with HTTP authentication username '&quot;, $_SERVER[&quot;PHP_AUTH_USER&quot;], &quot;' and password '&quot;, $_SERVER[&quot;PHP_AUTH_PW&quot;], &quot;'\n&quot;;
+?&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestssecurityresourcesbasicauthphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/security/resources/basic-auth.php (0 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/security/resources/basic-auth.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/basic-auth.php        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;?php
+$expectedUsername = isset($_GET['username']) ? $_GET['username'] : 'username';
+$expectedPassword = isset($_GET['password']) ? $_GET['password'] : 'password';
+$realm = isset($_GET['realm']) ? $_GET['realm'] : $_SERVER['REQUEST_URI'];
+
+header(&quot;Cache-Control: no-store&quot;);
+header(&quot;Connection: close&quot;);
+if (!isset($_SERVER['PHP_AUTH_USER']) || $_SERVER['PHP_AUTH_USER'] != $expectedUsername ||  
+    !isset($_SERVER['PHP_AUTH_PW']) || $_SERVER['PHP_AUTH_PW'] != $expectedPassword) {
+    header(&quot;WWW-Authenticate: Basic realm=\&quot;&quot; . $realm . &quot;\&quot;&quot;);
+    header('HTTP/1.0 401 Unauthorized');
+    print 'Sent username:password of (' . $_SERVER['PHP_AUTH_USER'] . ':' . $_SERVER['PHP_AUTH_PW'] . ') which is not what was expected';
+    exit;
+}
+?&gt;
+Authenticated as user: &lt;?php print (string)$_SERVER['PHP_AUTH_USER']?&gt; password: &lt;?php print (string)$_SERVER['PHP_AUTH_PW']?&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wk2/TestExpectations (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wk2/TestExpectations        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/LayoutTests/platform/wk2/TestExpectations        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -421,6 +421,9 @@
</span><span class="cx"> # This test is not the cause of the problem, just the one that happens to currently be the victim.
</span><span class="cx"> svg/filters/filter-hidden-content.svg [ Pass Failure ]
</span><span class="cx"> 
</span><ins>+# No good way to test private browsing in WKTR right now
+http/tests/security/private-browsing-http-auth.html
+
</ins><span class="cx"> ### END OF (2) Classified failures without bug reports (yet)
</span><span class="cx"> ########################################
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/ChangeLog        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -1,3 +1,68 @@
</span><ins>+2015-07-07  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        HTTP Auth cached after disabling private browsing/reset.
+        &lt;rdar://problem/8293055&gt; and https://bugs.webkit.org/show_bug.cgi?id=146654
+
+        Reviewed by Tim Horton.
+
+        Test: http/tests/security/private-browsing-http-auth.html
+
+        - Change most static CredentialStorage methods to be instance methods instead.
+        - Make a CredentialStorage objects be per-NetworkStorageSession.
+
+        * Modules/websockets/WebSocketChannel.cpp:
+        (WebCore::WebSocketChannel::WebSocketChannel):
+        (WebCore::WebSocketChannel::connect): Only start the web socket load if a networking
+          context is available.
+
+        * platform/network/CredentialStorage.cpp:
+        (WebCore::CredentialStorage::defaultCredentialStorage): Returns the credential storage
+          from the default NetworkStorageSession.
+        (WebCore::CredentialStorage::set):
+        (WebCore::CredentialStorage::get):
+        (WebCore::CredentialStorage::remove):
+        (WebCore::CredentialStorage::findDefaultProtectionSpaceForURL):
+        (WebCore::CredentialStorage::clearCredentials):
+        (WebCore::protectionSpaceToCredentialMap): Deleted.
+        (WebCore::originsWithCredentials): Deleted.
+        (WebCore::pathToDefaultProtectionSpaceMap): Deleted.
+        (WebCore::findDefaultProtectionSpaceForURL): Deleted.
+        (WebCore::CredentialStorage::setPrivateMode): Deleted. Was a no-op anyways.
+        * platform/network/CredentialStorage.h:
+        
+        * platform/network/NetworkStorageSession.h:
+        (WebCore::NetworkStorageSession::credentialStorage):
+        
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::createCFURLConnection):
+        (WebCore::ResourceHandle::willSendRequest):
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceHandle::receivedCredential):
+        
+        * platform/network/cf/SocketStreamHandle.h:
+        (WebCore::SocketStreamHandle::create):
+        * platform/network/cf/SocketStreamHandleCFNet.cpp:
+        (WebCore::SocketStreamHandle::SocketStreamHandle):
+        (WebCore::SocketStreamHandle::getStoredCONNECTProxyCredentials):
+        (WebCore::getStoredCONNECTProxyCredentials): Deleted.
+        
+        * platform/network/curl/ResourceHandleCurl.cpp:
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceHandle::receivedCredential):
+        * platform/network/curl/ResourceHandleManager.cpp:
+        (WebCore::ResourceHandleManager::applyAuthenticationToRequest):
+        
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::createNSURLConnection):
+        (WebCore::ResourceHandle::willSendRequest):
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceHandle::receivedCredential):
+        
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::applyAuthenticationToRequest):
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceHandle::receivedCredential):
+        
</ins><span class="cx"> 2015-07-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(169105): CSS Regions: renderer returns wrong selection root when it is inside a column flow.
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebsocketsWebSocketChannelcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -81,6 +81,8 @@
</span><span class="cx">     , m_outgoingFrameQueueStatus(OutgoingFrameQueueOpen)
</span><span class="cx">     , m_blobLoaderStatus(BlobLoaderNotStarted)
</span><span class="cx"> {
</span><ins>+    ASSERT(m_document);
+
</ins><span class="cx">     if (Page* page = m_document-&gt;page())
</span><span class="cx">         m_identifier = page-&gt;progress().createUniqueIdentifier();
</span><span class="cx"> 
</span><span class="lines">@@ -103,8 +105,13 @@
</span><span class="cx">         m_handshake-&gt;addExtensionProcessor(m_deflateFramer.createExtensionProcessor());
</span><span class="cx">     if (m_identifier)
</span><span class="cx">         InspectorInstrumentation::didCreateWebSocket(m_document, m_identifier, url, m_document-&gt;url(), protocol);
</span><del>-    ref();
-    m_handle = SocketStreamHandle::create(m_handshake-&gt;url(), this);
</del><ins>+
+    if (Frame* frame = m_document-&gt;frame()) {
+        if (NetworkingContext* networkingContext = frame-&gt;loader().networkingContext()) {
+            ref();
+            m_handle = SocketStreamHandle::create(m_handshake-&gt;url(), this, *networkingContext);
+        }
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String WebSocketChannel::subprotocol()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkCredentialStoragecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/CredentialStorage.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/CredentialStorage.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/CredentialStorage.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -26,15 +26,9 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;CredentialStorage.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Credential.h&quot;
</del><ins>+#include &quot;NetworkStorageSession.h&quot;
</ins><span class="cx"> #include &quot;URL.h&quot;
</span><del>-#include &quot;ProtectionSpaceHash.h&quot;
-#include &lt;wtf/text/WTFString.h&gt;
-#include &lt;wtf/text/StringHash.h&gt;
-#include &lt;wtf/HashMap.h&gt;
-#include &lt;wtf/HashSet.h&gt;
-#include &lt;wtf/MainThread.h&gt;
-#include &lt;wtf/StdLibExtras.h&gt;
</del><ins>+#include &lt;wtf/NeverDestroyed.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #include &quot;WebCoreThread.h&quot;
</span><span class="lines">@@ -42,29 +36,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-typedef HashMap&lt;ProtectionSpace, Credential&gt; ProtectionSpaceToCredentialMap;
-static ProtectionSpaceToCredentialMap&amp; protectionSpaceToCredentialMap()
</del><ins>+CredentialStorage&amp; CredentialStorage::defaultCredentialStorage()
</ins><span class="cx"> {
</span><del>-    ASSERT(isMainThread());
-    DEPRECATED_DEFINE_STATIC_LOCAL(ProtectionSpaceToCredentialMap, map, ());
-    return map;
</del><ins>+    return NetworkStorageSession::defaultStorageSession().credentialStorage();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static HashSet&lt;String&gt;&amp; originsWithCredentials()
-{
-    ASSERT(isMainThread());
-    DEPRECATED_DEFINE_STATIC_LOCAL(HashSet&lt;String&gt;, set, ());
-    return set;
-}
-
-typedef HashMap&lt;String, ProtectionSpace&gt; PathToDefaultProtectionSpaceMap;
-static PathToDefaultProtectionSpaceMap&amp; pathToDefaultProtectionSpaceMap()
-{
-    ASSERT(isMainThread());
-    DEPRECATED_DEFINE_STATIC_LOCAL(PathToDefaultProtectionSpaceMap, map, ());
-    return map;
-}
-
</del><span class="cx"> static String originStringFromURL(const URL&amp; url)
</span><span class="cx"> {
</span><span class="cx">     if (url.port())
</span><span class="lines">@@ -96,7 +72,7 @@
</span><span class="cx">     ASSERT(protectionSpace.isProxy() || protectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested || url.protocolIsInHTTPFamily());
</span><span class="cx">     ASSERT(protectionSpace.isProxy() || protectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeClientCertificateRequested || url.isValid());
</span><span class="cx"> 
</span><del>-    protectionSpaceToCredentialMap().set(protectionSpace, credential);
</del><ins>+    m_protectionSpaceToCredentialMap.set(protectionSpace, credential);
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     if (protectionSpace.authenticationScheme() != ProtectionSpaceAuthenticationSchemeClientCertificateRequested)
</span><span class="lines">@@ -104,46 +80,44 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (!protectionSpace.isProxy() &amp;&amp; protectionSpace.authenticationScheme() != ProtectionSpaceAuthenticationSchemeClientCertificateRequested) {
</span><del>-        originsWithCredentials().add(originStringFromURL(url));
</del><ins>+        m_originsWithCredentials.add(originStringFromURL(url));
</ins><span class="cx"> 
</span><span class="cx">         ProtectionSpaceAuthenticationScheme scheme = protectionSpace.authenticationScheme();
</span><span class="cx">         if (scheme == ProtectionSpaceAuthenticationSchemeHTTPBasic || scheme == ProtectionSpaceAuthenticationSchemeDefault) {
</span><span class="cx">             // The map can contain both a path and its subpath - while redundant, this makes lookups faster.
</span><del>-            pathToDefaultProtectionSpaceMap().set(protectionSpaceMapKeyFromURL(url), protectionSpace);
</del><ins>+            m_pathToDefaultProtectionSpaceMap.set(protectionSpaceMapKeyFromURL(url), protectionSpace);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Credential CredentialStorage::get(const ProtectionSpace&amp; protectionSpace)
</span><span class="cx"> {
</span><del>-    return protectionSpaceToCredentialMap().get(protectionSpace);
</del><ins>+    return m_protectionSpaceToCredentialMap.get(protectionSpace);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CredentialStorage::remove(const ProtectionSpace&amp; protectionSpace)
</span><span class="cx"> {
</span><del>-    protectionSpaceToCredentialMap().remove(protectionSpace);
</del><ins>+    m_protectionSpaceToCredentialMap.remove(protectionSpace);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static PathToDefaultProtectionSpaceMap::iterator findDefaultProtectionSpaceForURL(const URL&amp; url)
</del><ins>+HashMap&lt;String, ProtectionSpace&gt;::iterator CredentialStorage::findDefaultProtectionSpaceForURL(const URL&amp; url)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(url.protocolIsInHTTPFamily());
</span><span class="cx">     ASSERT(url.isValid());
</span><span class="cx"> 
</span><del>-    PathToDefaultProtectionSpaceMap&amp; map = pathToDefaultProtectionSpaceMap();
-
</del><span class="cx">     // Don't spend time iterating the path for origins that don't have any credentials.
</span><del>-    if (!originsWithCredentials().contains(originStringFromURL(url)))
-        return map.end();
</del><ins>+    if (!m_originsWithCredentials.contains(originStringFromURL(url)))
+        return m_pathToDefaultProtectionSpaceMap.end();
</ins><span class="cx"> 
</span><span class="cx">     String directoryURL = protectionSpaceMapKeyFromURL(url);
</span><span class="cx">     unsigned directoryURLPathStart = url.pathStart();
</span><span class="cx">     while (true) {
</span><del>-        PathToDefaultProtectionSpaceMap::iterator iter = map.find(directoryURL);
-        if (iter != map.end())
</del><ins>+        PathToDefaultProtectionSpaceMap::iterator iter = m_pathToDefaultProtectionSpaceMap.find(directoryURL);
+        if (iter != m_pathToDefaultProtectionSpaceMap.end())
</ins><span class="cx">             return iter;
</span><span class="cx"> 
</span><span class="cx">         if (directoryURL.length() == directoryURLPathStart + 1)  // path is &quot;/&quot; already, cannot shorten it any more
</span><del>-            return map.end();
</del><ins>+            return m_pathToDefaultProtectionSpaceMap.end();
</ins><span class="cx"> 
</span><span class="cx">         size_t index = directoryURL.reverseFind('/', directoryURL.length() - 2);
</span><span class="cx">         ASSERT(index != notFound);
</span><span class="lines">@@ -158,34 +132,26 @@
</span><span class="cx">     ASSERT(url.protocolIsInHTTPFamily());
</span><span class="cx">     ASSERT(url.isValid());
</span><span class="cx">     PathToDefaultProtectionSpaceMap::iterator iter = findDefaultProtectionSpaceForURL(url);
</span><del>-    if (iter == pathToDefaultProtectionSpaceMap().end())
</del><ins>+    if (iter == m_pathToDefaultProtectionSpaceMap.end())
</ins><span class="cx">         return false;
</span><del>-    ASSERT(originsWithCredentials().contains(originStringFromURL(url)));
-    protectionSpaceToCredentialMap().set(iter-&gt;value, credential);
</del><ins>+    ASSERT(m_originsWithCredentials.contains(originStringFromURL(url)));
+    m_protectionSpaceToCredentialMap.set(iter-&gt;value, credential);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Credential CredentialStorage::get(const URL&amp; url)
</span><span class="cx"> {
</span><span class="cx">     PathToDefaultProtectionSpaceMap::iterator iter = findDefaultProtectionSpaceForURL(url);
</span><del>-    if (iter == pathToDefaultProtectionSpaceMap().end())
</del><ins>+    if (iter == m_pathToDefaultProtectionSpaceMap.end())
</ins><span class="cx">         return Credential();
</span><del>-    return protectionSpaceToCredentialMap().get(iter-&gt;value);
</del><ins>+    return m_protectionSpaceToCredentialMap.get(iter-&gt;value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
</del><span class="cx"> void CredentialStorage::clearCredentials()
</span><span class="cx"> {
</span><del>-    pathToDefaultProtectionSpaceMap().clear();
-    originsWithCredentials().clear();
-    protectionSpaceToCredentialMap().clear();
</del><ins>+    m_protectionSpaceToCredentialMap.clear();
+    m_originsWithCredentials.clear();
+    m_pathToDefaultProtectionSpaceMap.clear();
</ins><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><del>-void CredentialStorage::setPrivateMode(bool mode)
-{
-    if (!mode)
-        protectionSpaceToCredentialMap().clear();
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkCredentialStorageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/CredentialStorage.h (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/CredentialStorage.h        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/CredentialStorage.h        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -26,33 +26,49 @@
</span><span class="cx"> #ifndef CredentialStorage_h
</span><span class="cx"> #define CredentialStorage_h
</span><span class="cx"> 
</span><ins>+#include &quot;Credential.h&quot;
+#include &quot;ProtectionSpaceHash.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+#include &lt;wtf/text/StringHash.h&gt;
+#include &lt;wtf/text/WTFString.h&gt;
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class Credential;
</del><span class="cx"> class URL;
</span><span class="cx"> class ProtectionSpace;
</span><span class="cx"> 
</span><span class="cx"> class CredentialStorage {
</span><span class="cx"> public:
</span><ins>+    WEBCORE_EXPORT static CredentialStorage&amp; defaultCredentialStorage();
+
</ins><span class="cx">     // WebCore session credential storage.
</span><del>-    static void set(const Credential&amp;, const ProtectionSpace&amp;, const URL&amp;);
-    WEBCORE_EXPORT static Credential get(const ProtectionSpace&amp;);
-    static void remove(const ProtectionSpace&amp;);
</del><ins>+    void set(const Credential&amp;, const ProtectionSpace&amp;, const URL&amp;);
+    WEBCORE_EXPORT Credential get(const ProtectionSpace&amp;);
+    void remove(const ProtectionSpace&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // OS persistent storage.
</span><del>-    WEBCORE_EXPORT static Credential getFromPersistentStorage(const ProtectionSpace&amp;);
</del><ins>+    WEBCORE_EXPORT Credential getFromPersistentStorage(const ProtectionSpace&amp;);
</ins><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT void clearCredentials();
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>-    static void saveToPersistentStorage(const ProtectionSpace&amp;, const Credential&amp;);
-    WEBCORE_EXPORT static void clearCredentials();
</del><ins>+    void saveToPersistentStorage(const ProtectionSpace&amp;, const Credential&amp;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // These methods work for authentication schemes that support sending credentials without waiting for a request. E.g., for HTTP Basic authentication scheme
</span><span class="cx">     // a client should assume that all paths at or deeper than the depth of a known protected resource share are within the same protection space.
</span><del>-    static bool set(const Credential&amp;, const URL&amp;); // Returns true if the URL corresponds to a known protection space, so credentials could be updated.
-    WEBCORE_EXPORT static Credential get(const URL&amp;);
</del><ins>+    bool set(const Credential&amp;, const URL&amp;); // Returns true if the URL corresponds to a known protection space, so credentials could be updated.
+    WEBCORE_EXPORT Credential get(const URL&amp;);
</ins><span class="cx"> 
</span><del>-    static void setPrivateMode(bool);
</del><ins>+private:
+    HashMap&lt;ProtectionSpace, Credential&gt; m_protectionSpaceToCredentialMap;
+    HashSet&lt;String&gt; m_originsWithCredentials;
+
+    typedef HashMap&lt;String, ProtectionSpace&gt; PathToDefaultProtectionSpaceMap;
+    PathToDefaultProtectionSpaceMap m_pathToDefaultProtectionSpaceMap;
+
+    PathToDefaultProtectionSpaceMap::iterator findDefaultProtectionSpaceForURL(const URL&amp;);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkStorageSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -26,6 +26,8 @@
</span><span class="cx"> #ifndef NetworkStorageSession_h
</span><span class="cx"> #define NetworkStorageSession_h
</span><span class="cx"> 
</span><ins>+#include &quot;CredentialStorage.h&quot;
+
</ins><span class="cx"> #include &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -47,6 +49,8 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static void switchToNewTestingSession();
</span><span class="cx"> 
</span><ins>+    CredentialStorage&amp; credentialStorage() { return m_credentialStorage; }
+
</ins><span class="cx"> #if PLATFORM(COCOA) || USE(CFNETWORK)
</span><span class="cx">     NetworkStorageSession(RetainPtr&lt;CFURLStorageSessionRef&gt;);
</span><span class="cx">     // May be null, in which case a Foundation default should be used.
</span><span class="lines">@@ -72,6 +76,8 @@
</span><span class="cx"> #else
</span><span class="cx">     RefPtr&lt;NetworkingContext&gt; m_context;
</span><span class="cx"> #endif
</span><ins>+
+    CredentialStorage m_credentialStorage;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -132,12 +132,12 @@
</span><span class="cx">         if (d-&gt;m_user.isEmpty() &amp;&amp; d-&gt;m_pass.isEmpty()) {
</span><span class="cx">             // &lt;rdar://problem/7174050&gt; - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
</span><span class="cx">             // try and reuse the credential preemptively, as allowed by RFC 2617.
</span><del>-            d-&gt;m_initialCredential = CredentialStorage::get(firstRequest().url());
</del><ins>+            d-&gt;m_initialCredential = d-&gt;m_context-&gt;storageSession().credentialStorage().get(firstRequest().url());
</ins><span class="cx">         } else {
</span><span class="cx">             // If there is already a protection space known for the URL, update stored credentials before sending a request.
</span><span class="cx">             // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
</span><span class="cx">             // (so that an authentication dialog doesn't pop up).
</span><del>-            CredentialStorage::set(Credential(d-&gt;m_user, d-&gt;m_pass, CredentialPersistenceNone), firstRequest().url());
</del><ins>+            d-&gt;m_context-&gt;storageSession().credentialStorage().set(Credential(d-&gt;m_user, d-&gt;m_pass, CredentialPersistenceNone), firstRequest().url());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">         
</span><span class="lines">@@ -293,7 +293,7 @@
</span><span class="cx">         // Only consider applying authentication credentials if this is actually a redirect and the redirect
</span><span class="cx">         // URL didn't include credentials of its own.
</span><span class="cx">         if (d-&gt;m_user.isEmpty() &amp;&amp; d-&gt;m_pass.isEmpty() &amp;&amp; !redirectResponse.isNull()) {
</span><del>-            Credential credential = CredentialStorage::get(request.url());
</del><ins>+            Credential credential = d-&gt;m_context-&gt;storageSession().credentialStorage().get(request.url());
</ins><span class="cx">             if (!credential.isEmpty()) {
</span><span class="cx">                 d-&gt;m_initialCredential = credential;
</span><span class="cx">                 
</span><span class="lines">@@ -358,7 +358,7 @@
</span><span class="cx">         URL urlToStore;
</span><span class="cx">         if (challenge.failureResponse().httpStatusCode() == 401)
</span><span class="cx">             urlToStore = challenge.failureResponse().url();
</span><del>-        CredentialStorage::set(credential, challenge.protectionSpace(), urlToStore);
</del><ins>+        d-&gt;m_context-&gt;storageSession().credentialStorage().set(credential, challenge.protectionSpace(), urlToStore);
</ins><span class="cx">         
</span><span class="cx">         CFURLConnectionUseCredential(d-&gt;m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
</span><span class="cx">         d-&gt;m_user = String();
</span><span class="lines">@@ -372,16 +372,16 @@
</span><span class="cx">             // The stored credential wasn't accepted, stop using it.
</span><span class="cx">             // There is a race condition here, since a different credential might have already been stored by another ResourceHandle,
</span><span class="cx">             // but the observable effect should be very minor, if any.
</span><del>-            CredentialStorage::remove(challenge.protectionSpace());
</del><ins>+            d-&gt;m_context-&gt;storageSession().credentialStorage().remove(challenge.protectionSpace());
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (!challenge.previousFailureCount()) {
</span><del>-            Credential credential = CredentialStorage::get(challenge.protectionSpace());
</del><ins>+            Credential credential = d-&gt;m_context-&gt;storageSession().credentialStorage().get(challenge.protectionSpace());
</ins><span class="cx">             if (!credential.isEmpty() &amp;&amp; credential != d-&gt;m_initialCredential) {
</span><span class="cx">                 ASSERT(credential.persistence() == CredentialPersistenceNone);
</span><span class="cx">                 if (challenge.failureResponse().httpStatusCode() == 401) {
</span><span class="cx">                     // Store the credential back, possibly adding it as a default for this directory.
</span><del>-                    CredentialStorage::set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</del><ins>+                    d-&gt;m_context-&gt;storageSession().credentialStorage().set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</ins><span class="cx">                 }
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">                 CFURLConnectionUseCredential(d-&gt;m_connection.get(), credential.cfCredential(), challenge.cfURLAuthChallengeRef());
</span><span class="lines">@@ -435,7 +435,7 @@
</span><span class="cx">         URL urlToStore;
</span><span class="cx">         if (challenge.failureResponse().httpStatusCode() == 401)
</span><span class="cx">             urlToStore = challenge.failureResponse().url();      
</span><del>-        CredentialStorage::set(webCredential, challenge.protectionSpace(), urlToStore);
</del><ins>+        d-&gt;m_context-&gt;storageSession().credentialStorage().set(webCredential, challenge.protectionSpace(), urlToStore);
</ins><span class="cx"> 
</span><span class="cx">         if (d-&gt;m_connection) {
</span><span class="cx"> #if PLATFORM(COCOA)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSocketStreamHandleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandle.h        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -43,11 +43,13 @@
</span><span class="cx"> 
</span><span class="cx"> class AuthenticationChallenge;
</span><span class="cx"> class Credential;
</span><ins>+class NetworkingContext;
+class ProtectionSpace;
</ins><span class="cx"> class SocketStreamHandleClient;
</span><span class="cx"> 
</span><span class="cx"> class SocketStreamHandle : public ThreadSafeRefCounted&lt;SocketStreamHandle&gt;, public SocketStreamHandleBase, public AuthenticationClient {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;SocketStreamHandle&gt; create(const URL&amp; url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); }
</del><ins>+    static PassRefPtr&lt;SocketStreamHandle&gt; create(const URL&amp; url, SocketStreamHandleClient* client, NetworkingContext&amp; networkingContext) { return adoptRef(new SocketStreamHandle(url, client, networkingContext)); }
</ins><span class="cx"> 
</span><span class="cx">     virtual ~SocketStreamHandle();
</span><span class="cx"> 
</span><span class="lines">@@ -58,7 +60,7 @@
</span><span class="cx">     virtual int platformSend(const char* data, int length);
</span><span class="cx">     virtual void platformClose();
</span><span class="cx"> 
</span><del>-    SocketStreamHandle(const URL&amp;, SocketStreamHandleClient*);
</del><ins>+    SocketStreamHandle(const URL&amp;, SocketStreamHandleClient*, NetworkingContext&amp;);
</ins><span class="cx">     void createStreams();
</span><span class="cx">     void scheduleStreams();
</span><span class="cx">     void chooseProxy();
</span><span class="lines">@@ -84,6 +86,8 @@
</span><span class="cx"> 
</span><span class="cx">     void reportErrorToClient(CFErrorRef);
</span><span class="cx"> 
</span><ins>+    bool getStoredCONNECTProxyCredentials(const ProtectionSpace&amp;, String&amp; login, String&amp; password);
+
</ins><span class="cx">     // No authentication for streams per se, but proxy may ask for credentials.
</span><span class="cx">     virtual void receivedCredential(const AuthenticationChallenge&amp;, const Credential&amp;);
</span><span class="cx">     virtual void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&amp;);
</span><span class="lines">@@ -108,6 +112,8 @@
</span><span class="cx">     RetainPtr&lt;CFWriteStreamRef&gt; m_writeStream;
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;CFURLRef&gt; m_httpsURL; // ws(s): replaced with https:
</span><ins>+
+    Ref&lt;NetworkingContext&gt; m_networkingContext;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }  // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfSocketStreamHandleCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include &quot;Credential.h&quot;
</span><span class="cx"> #include &quot;CredentialStorage.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><ins>+#include &quot;NetworkingContext.h&quot;
</ins><span class="cx"> #include &quot;ProtectionSpace.h&quot;
</span><span class="cx"> #include &quot;SocketStreamError.h&quot;
</span><span class="cx"> #include &quot;SocketStreamHandleClient.h&quot;
</span><span class="lines">@@ -61,11 +62,12 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-SocketStreamHandle::SocketStreamHandle(const URL&amp; url, SocketStreamHandleClient* client)
</del><ins>+SocketStreamHandle::SocketStreamHandle(const URL&amp; url, SocketStreamHandleClient* client, NetworkingContext&amp; networkingContext)
</ins><span class="cx">     : SocketStreamHandleBase(url, client)
</span><span class="cx">     , m_connectingSubstate(New)
</span><span class="cx">     , m_connectionType(Unknown)
</span><span class="cx">     , m_sentStoredCredentials(false)
</span><ins>+    , m_networkingContext(networkingContext)
</ins><span class="cx"> {
</span><span class="cx">     LOG(Network, &quot;SocketStreamHandle %p new client %p&quot;, this, m_client);
</span><span class="cx"> 
</span><span class="lines">@@ -331,14 +333,14 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool getStoredCONNECTProxyCredentials(const ProtectionSpace&amp; protectionSpace, String&amp; login, String&amp; password)
</del><ins>+bool SocketStreamHandle::getStoredCONNECTProxyCredentials(const ProtectionSpace&amp; protectionSpace, String&amp; login, String&amp; password)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME (&lt;rdar://problem/10416495&gt;): Proxy credentials should be retrieved from AuthBrokerAgent.
</span><span class="cx"> 
</span><span class="cx">     // Try system credential storage first, matching HTTP behavior (CFNetwork only asks the client for password if it couldn't find it in Keychain).
</span><del>-    Credential storedCredential = CredentialStorage::getFromPersistentStorage(protectionSpace);
</del><ins>+    Credential storedCredential = m_networkingContext-&gt;storageSession().credentialStorage().getFromPersistentStorage(protectionSpace);
</ins><span class="cx">     if (storedCredential.isEmpty())
</span><del>-        storedCredential = CredentialStorage::get(protectionSpace);
</del><ins>+        storedCredential = m_networkingContext-&gt;storageSession().credentialStorage().get(protectionSpace);
</ins><span class="cx"> 
</span><span class="cx">     if (storedCredential.isEmpty())
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlResourceHandleCurlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleCurl.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -193,7 +193,7 @@
</span><span class="cx">         URL urlToStore;
</span><span class="cx">         if (challenge.failureResponse().httpStatusCode() == 401)
</span><span class="cx">             urlToStore = challenge.failureResponse().url();
</span><del>-        CredentialStorage::set(credential, challenge.protectionSpace(), urlToStore);
</del><ins>+        CredentialStorage::defaultCredentialStorage().set(credential, challenge.protectionSpace(), urlToStore);
</ins><span class="cx">         
</span><span class="cx">         String userpass = credential.user() + &quot;:&quot; + credential.password();
</span><span class="cx">         curl_easy_setopt(d-&gt;m_handle, CURLOPT_USERPWD, userpass.utf8().data());
</span><span class="lines">@@ -209,16 +209,16 @@
</span><span class="cx">             // The stored credential wasn't accepted, stop using it.
</span><span class="cx">             // There is a race condition here, since a different credential might have already been stored by another ResourceHandle,
</span><span class="cx">             // but the observable effect should be very minor, if any.
</span><del>-            CredentialStorage::remove(challenge.protectionSpace());
</del><ins>+            CredentialStorage::defaultCredentialStorage().remove(challenge.protectionSpace());
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (!challenge.previousFailureCount()) {
</span><del>-            Credential credential = CredentialStorage::get(challenge.protectionSpace());
</del><ins>+            Credential credential = CredentialStorage::defaultCredentialStorage().get(challenge.protectionSpace());
</ins><span class="cx">             if (!credential.isEmpty() &amp;&amp; credential != d-&gt;m_initialCredential) {
</span><span class="cx">                 ASSERT(credential.persistence() == CredentialPersistenceNone);
</span><span class="cx">                 if (challenge.failureResponse().httpStatusCode() == 401) {
</span><span class="cx">                     // Store the credential back, possibly adding it as a default for this directory.
</span><del>-                    CredentialStorage::set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</del><ins>+                    CredentialStorage::defaultCredentialStorage().set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</ins><span class="cx">                 }
</span><span class="cx">                 String userpass = credential.user() + &quot;:&quot; + credential.password();
</span><span class="cx">                 curl_easy_setopt(d-&gt;m_handle, CURLOPT_USERPWD, userpass.utf8().data());
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">     if (shouldUseCredentialStorage()) {
</span><span class="cx">         if (challenge.failureResponse().httpStatusCode() == 401) {
</span><span class="cx">             URL urlToStore = challenge.failureResponse().url();
</span><del>-            CredentialStorage::set(credential, challenge.protectionSpace(), urlToStore);
</del><ins>+            CredentialStorage::defaultCredentialStorage().set(credential, challenge.protectionSpace(), urlToStore);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlResourceHandleManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/curl/ResourceHandleManager.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -967,13 +967,13 @@
</span><span class="cx">         if (d-&gt;m_user.isEmpty() &amp;&amp; d-&gt;m_pass.isEmpty()) {
</span><span class="cx">             // &lt;rdar://problem/7174050&gt; - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
</span><span class="cx">             // try and reuse the credential preemptively, as allowed by RFC 2617.
</span><del>-            d-&gt;m_initialCredential = CredentialStorage::get(request.url());
</del><ins>+            d-&gt;m_initialCredential = CredentialStorage::defaultCredentialStorage().get(request.url());
</ins><span class="cx">         } else {
</span><span class="cx">             // If there is already a protection space known for the URL, update stored credentials
</span><span class="cx">             // before sending a request. This makes it possible to implement logout by sending an
</span><span class="cx">             // XMLHttpRequest with known incorrect credentials, and aborting it immediately (so that
</span><span class="cx">             // an authentication dialog doesn't pop up).
</span><del>-            CredentialStorage::set(Credential(d-&gt;m_user, d-&gt;m_pass, CredentialPersistenceNone), request.url());
</del><ins>+            CredentialStorage::defaultCredentialStorage().set(Credential(d-&gt;m_user, d-&gt;m_pass, CredentialPersistenceNone), request.url());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceHandleMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/mac/ResourceHandleMac.mm        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -160,12 +160,12 @@
</span><span class="cx">         if (d-&gt;m_user.isEmpty() &amp;&amp; d-&gt;m_pass.isEmpty()) {
</span><span class="cx">             // &lt;rdar://problem/7174050&gt; - For URLs that match the paths of those previously challenged for HTTP Basic authentication, 
</span><span class="cx">             // try and reuse the credential preemptively, as allowed by RFC 2617.
</span><del>-            d-&gt;m_initialCredential = CredentialStorage::get(firstRequest().url());
</del><ins>+            d-&gt;m_initialCredential = d-&gt;m_context-&gt;storageSession().credentialStorage().get(firstRequest().url());
</ins><span class="cx">         } else {
</span><span class="cx">             // If there is already a protection space known for the URL, update stored credentials before sending a request.
</span><span class="cx">             // This makes it possible to implement logout by sending an XMLHttpRequest with known incorrect credentials, and aborting it immediately
</span><span class="cx">             // (so that an authentication dialog doesn't pop up).
</span><del>-            CredentialStorage::set(Credential(d-&gt;m_user, d-&gt;m_pass, CredentialPersistenceNone), firstRequest().url());
</del><ins>+            d-&gt;m_context-&gt;storageSession().credentialStorage().set(Credential(d-&gt;m_user, d-&gt;m_pass, CredentialPersistenceNone), firstRequest().url());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">         
</span><span class="lines">@@ -478,7 +478,7 @@
</span><span class="cx">         // Only consider applying authentication credentials if this is actually a redirect and the redirect
</span><span class="cx">         // URL didn't include credentials of its own.
</span><span class="cx">         if (d-&gt;m_user.isEmpty() &amp;&amp; d-&gt;m_pass.isEmpty() &amp;&amp; !redirectResponse.isNull()) {
</span><del>-            Credential credential = CredentialStorage::get(request.url());
</del><ins>+            Credential credential = d-&gt;m_context-&gt;storageSession().credentialStorage().get(request.url());
</ins><span class="cx">             if (!credential.isEmpty()) {
</span><span class="cx">                 d-&gt;m_initialCredential = credential;
</span><span class="cx">                 
</span><span class="lines">@@ -562,16 +562,16 @@
</span><span class="cx">             // The stored credential wasn't accepted, stop using it.
</span><span class="cx">             // There is a race condition here, since a different credential might have already been stored by another ResourceHandle,
</span><span class="cx">             // but the observable effect should be very minor, if any.
</span><del>-            CredentialStorage::remove(challenge.protectionSpace());
</del><ins>+            d-&gt;m_context-&gt;storageSession().credentialStorage().remove(challenge.protectionSpace());
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (!challenge.previousFailureCount()) {
</span><del>-            Credential credential = CredentialStorage::get(challenge.protectionSpace());
</del><ins>+            Credential credential = d-&gt;m_context-&gt;storageSession().credentialStorage().get(challenge.protectionSpace());
</ins><span class="cx">             if (!credential.isEmpty() &amp;&amp; credential != d-&gt;m_initialCredential) {
</span><span class="cx">                 ASSERT(credential.persistence() == CredentialPersistenceNone);
</span><span class="cx">                 if (challenge.failureResponse().httpStatusCode() == 401) {
</span><span class="cx">                     // Store the credential back, possibly adding it as a default for this directory.
</span><del>-                    CredentialStorage::set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</del><ins>+                    d-&gt;m_context-&gt;storageSession().credentialStorage().set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</ins><span class="cx">                 }
</span><span class="cx">                 [challenge.sender() useCredential:credential.nsCredential() forAuthenticationChallenge:mac(challenge)];
</span><span class="cx">                 return;
</span><span class="lines">@@ -656,7 +656,7 @@
</span><span class="cx">         URL urlToStore;
</span><span class="cx">         if (challenge.failureResponse().httpStatusCode() == 401)
</span><span class="cx">             urlToStore = challenge.failureResponse().url();
</span><del>-        CredentialStorage::set(webCredential, ProtectionSpace([d-&gt;m_currentMacChallenge protectionSpace]), urlToStore);
</del><ins>+        d-&gt;m_context-&gt;storageSession().credentialStorage().set(webCredential, ProtectionSpace([d-&gt;m_currentMacChallenge protectionSpace]), urlToStore);
</ins><span class="cx">         [[d-&gt;m_currentMacChallenge sender] useCredential:webCredential.nsCredential() forAuthenticationChallenge:d-&gt;m_currentMacChallenge];
</span><span class="cx">     } else
</span><span class="cx">         [[d-&gt;m_currentMacChallenge sender] useCredential:credential.nsCredential() forAuthenticationChallenge:d-&gt;m_currentMacChallenge];
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceHandleSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -378,13 +378,13 @@
</span><span class="cx"> 
</span><span class="cx">     if (handle-&gt;shouldUseCredentialStorage()) {
</span><span class="cx">         if (d-&gt;m_user.isEmpty() &amp;&amp; d-&gt;m_pass.isEmpty())
</span><del>-            d-&gt;m_initialCredential = CredentialStorage::get(request.url());
</del><ins>+            d-&gt;m_initialCredential = CredentialStorage::defaultCredentialStorage().get(request.url());
</ins><span class="cx">         else if (!redirect) {
</span><span class="cx">             // If there is already a protection space known for the URL, update stored credentials
</span><span class="cx">             // before sending a request. This makes it possible to implement logout by sending an
</span><span class="cx">             // XMLHttpRequest with known incorrect credentials, and aborting it immediately (so that
</span><span class="cx">             // an authentication dialog doesn't pop up).
</span><del>-            CredentialStorage::set(Credential(d-&gt;m_user, d-&gt;m_pass, CredentialPersistenceNone), request.url());
</del><ins>+            CredentialStorage::defaultCredentialStorage().set(Credential(d-&gt;m_user, d-&gt;m_pass, CredentialPersistenceNone), request.url());
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1137,17 +1137,17 @@
</span><span class="cx">             // The stored credential wasn't accepted, stop using it. There is a race condition
</span><span class="cx">             // here, since a different credential might have already been stored by another
</span><span class="cx">             // ResourceHandle, but the observable effect should be very minor, if any.
</span><del>-            CredentialStorage::remove(challenge.protectionSpace());
</del><ins>+            CredentialStorage::defaultCredentialStorage().remove(challenge.protectionSpace());
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (!challenge.previousFailureCount()) {
</span><del>-            Credential credential = CredentialStorage::get(challenge.protectionSpace());
</del><ins>+            Credential credential = CredentialStorage::defaultCredentialStorage().get(challenge.protectionSpace());
</ins><span class="cx">             if (!credential.isEmpty() &amp;&amp; credential != d-&gt;m_initialCredential) {
</span><span class="cx">                 ASSERT(credential.persistence() == CredentialPersistenceNone);
</span><span class="cx"> 
</span><span class="cx">                 // Store the credential back, possibly adding it as a default for this directory.
</span><span class="cx">                 if (isAuthenticationFailureStatusCode(challenge.failureResponse().httpStatusCode()))
</span><del>-                    CredentialStorage::set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</del><ins>+                    CredentialStorage::defaultCredentialStorage().set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</ins><span class="cx"> 
</span><span class="cx">                 soup_auth_authenticate(challenge.soupAuth(), credential.user().utf8().data(), credential.password().utf8().data());
</span><span class="cx">                 return;
</span><span class="lines">@@ -1200,7 +1200,7 @@
</span><span class="cx">         // we place the credentials in the store even though libsoup will never fire the authenticate signal again for
</span><span class="cx">         // this protection space.
</span><span class="cx">         if (credential.persistence() == CredentialPersistenceForSession || credential.persistence() == CredentialPersistencePermanent)
</span><del>-            CredentialStorage::set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</del><ins>+            CredentialStorage::defaultCredentialStorage().set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">         if (credential.persistence() == CredentialPersistencePermanent) {
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2015-07-07  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        HTTP Auth cached after disabling private browsing/reset.
+        &lt;rdar://problem/8293055&gt; and https://bugs.webkit.org/show_bug.cgi?id=146654
+
+        Reviewed by Tim Horton.
+
+        * Misc/WebCache.h:
+        * Misc/WebCache.mm:
+        (+[WebCache clearCachedCredentials]): Clear the global CredentialStorage as well as the
+          storages belonging to each main frame of each WebView. This method is for DRT.
+        
+        * Misc/WebDownload.mm:
+        (-[WebDownloadInternal download:didReceiveAuthenticationChallenge:]):
+        
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (WebKit::getAuthenticationInfo):
+        
+        * WebView/WebView.mm:
+        (-[WebView _clearCredentials]): Clear the storage belonging to the current networking session
+          of the main frame of this WebView.
+        * WebView/WebViewInternal.h:
+
</ins><span class="cx"> 2015-07-04  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Drop RefPtr::clear() method
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebCache.h (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebCache.h        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/mac/Misc/WebCache.h        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx"> #if TARGET_OS_IPHONE
</span><span class="cx"> + (void)emptyInMemoryResources;
</span><span class="cx"> + (void)sizeOfDeadResources:(int *)resources;
</span><del>-+ (void)clearCachedCredentials;
</del><span class="cx"> // SPI to add a CGImageRef directly to the WebCore cache.
</span><span class="cx"> + (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url;
</span><span class="cx"> + (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url forFrame:(WebFrame *)frame;
</span><span class="lines">@@ -46,5 +45,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> + (void)setDisabled:(BOOL)disabled;
</span><span class="cx"> + (BOOL)isDisabled;
</span><ins>++ (void)clearCachedCredentials;
</ins><span class="cx"> 
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebCachemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebCache.mm (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebCache.mm        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/mac/Misc/WebCache.mm        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #import &quot;WebView.h&quot;
</span><span class="cx"> #import &quot;WebViewInternal.h&quot;
</span><span class="cx"> #import &lt;WebCore/ApplicationCacheStorage.h&gt;
</span><ins>+#import &lt;WebCore/CredentialStorage.h&gt;
</ins><span class="cx"> #import &lt;WebCore/CrossOriginPreflightResultCache.h&gt;
</span><span class="cx"> #import &lt;WebCore/MemoryCache.h&gt;
</span><span class="cx"> #import &lt;runtime/InitializeThreading.h&gt;
</span><span class="lines">@@ -42,7 +43,6 @@
</span><span class="cx"> #import &quot;MemoryMeasure.h&quot;
</span><span class="cx"> #import &quot;WebFrameInternal.h&quot;
</span><span class="cx"> #import &lt;WebCore/CachedImage.h&gt;
</span><del>-#import &lt;WebCore/CredentialStorage.h&gt;
</del><span class="cx"> #import &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #import &lt;WebCore/PageCache.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreThreadRun.h&gt;
</span><span class="lines">@@ -158,11 +158,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-+ (void)clearCachedCredentials
-{
-    WebCore::CredentialStorage::clearCredentials();
-}
-
</del><span class="cx"> + (bool)addImageToCache:(CGImageRef)image forURL:(NSURL *)url
</span><span class="cx"> {
</span><span class="cx">     return [WebCache addImageToCache:image forURL:url forFrame:nil];
</span><span class="lines">@@ -227,4 +222,10 @@
</span><span class="cx">     return WebCore::MemoryCache::singleton().disabled();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>++ (void)clearCachedCredentials
+{
+    [WebView _makeAllWebViewsPerformSelector:@selector(_clearCredentials)];
+    WebCore::CredentialStorage::defaultCredentialStorage().clearCredentials();
+}
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebDownloadmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebDownload.mm (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebDownload.mm        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/mac/Misc/WebDownload.mm        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">     // Try previously stored credential first.
</span><span class="cx">     if (![challenge previousFailureCount]) {
</span><del>-        NSURLCredential *credential = CredentialStorage::get(ProtectionSpace([challenge protectionSpace])).nsCredential();
</del><ins>+        NSURLCredential *credential = CredentialStorage::defaultCredentialStorage().get(ProtectionSpace([challenge protectionSpace])).nsCredential();
</ins><span class="cx">         if (credential) {
</span><span class="cx">             [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebKitmacPluginsWebBaseNetscapePluginViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -927,7 +927,7 @@
</span><span class="cx">     
</span><span class="cx">     RetainPtr&lt;NSURLProtectionSpace&gt; protectionSpace = adoptNS([[NSURLProtectionSpace alloc] initWithHost:host port:port protocol:protocol realm:realm authenticationMethod:authenticationMethod]);
</span><span class="cx">     
</span><del>-    NSURLCredential *credential = CredentialStorage::get(ProtectionSpace(protectionSpace.get())).nsCredential();
</del><ins>+    NSURLCredential *credential = CredentialStorage::defaultCredentialStorage().get(ProtectionSpace(protectionSpace.get())).nsCredential();
</ins><span class="cx">     if (!credential)
</span><span class="cx">         credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()];
</span><span class="cx">     if (!credential)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -8275,6 +8275,19 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_clearCredentials
+{
+    Frame* frame = [self _mainCoreFrame];
+    if (!frame)
+        return;
+
+    NetworkingContext* networkingContext = frame-&gt;loader().networkingContext();
+    if (!networkingContext)
+        return;
+
+    networkingContext-&gt;storageSession().credentialStorage().clearCredentials();
+}
+
</ins><span class="cx"> - (BOOL)_needsOneShotDrawingSynchronization
</span><span class="cx"> {
</span><span class="cx">     return _private-&gt;needsOneShotDrawingSynchronization;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -103,6 +103,8 @@
</span><span class="cx"> - (WebCore::Frame*)_mainCoreFrame;
</span><span class="cx"> - (WebFrame *)_selectedOrMainFrame;
</span><span class="cx"> 
</span><ins>+- (void)_clearCredentials;
+
</ins><span class="cx"> - (WebCore::KeyboardUIMode)_keyboardUIMode;
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)_becomingFirstResponderFromOutside;
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/win/ChangeLog        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-07-07  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        HTTP Auth cached after disabling private browsing/reset.
+        &lt;rdar://problem/8293055&gt; and https://bugs.webkit.org/show_bug.cgi?id=146654
+
+        Reviewed by Tim Horton.
+
+        * WebDownloadCFNet.cpp:
+        (WebDownload::didReceiveAuthenticationChallenge):
+
</ins><span class="cx"> 2015-07-04  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Drop RefPtr::clear() method
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebDownloadCFNetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebDownloadCFNet.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebDownloadCFNet.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit/win/WebDownloadCFNet.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -386,7 +386,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Try previously stored credential first.
</span><span class="cx">     if (!CFURLAuthChallengeGetPreviousFailureCount(challenge)) {
</span><del>-        Credential credential = CredentialStorage::get(core(CFURLAuthChallengeGetProtectionSpace(challenge)));
</del><ins>+        Credential credential = CredentialStorage::defaultCredentialStorage().get(core(CFURLAuthChallengeGetProtectionSpace(challenge)));
</ins><span class="cx">         if (!credential.isEmpty()) {
</span><span class="cx">             RetainPtr&lt;CFURLCredentialRef&gt; cfCredential = adoptCF(createCF(credential));
</span><span class="cx">             CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), challenge);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit2/ChangeLog        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-07-07  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        HTTP Auth cached after disabling private browsing/reset.
+        &lt;rdar://problem/8293055&gt; and https://bugs.webkit.org/show_bug.cgi?id=146654
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::getAuthenticationInfo):
+
</ins><span class="cx"> 2015-07-07  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Make sure to remove the download message receiver before freeing it
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessPluginsPluginViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -1572,9 +1572,9 @@
</span><span class="cx"> 
</span><span class="cx"> bool PluginView::getAuthenticationInfo(const ProtectionSpace&amp; protectionSpace, String&amp; username, String&amp; password)
</span><span class="cx"> {
</span><del>-    Credential credential = CredentialStorage::get(protectionSpace);
</del><ins>+    Credential credential = CredentialStorage::defaultCredentialStorage().get(protectionSpace);
</ins><span class="cx">     if (credential.isEmpty())
</span><del>-        credential = CredentialStorage::getFromPersistentStorage(protectionSpace);
</del><ins>+        credential = CredentialStorage::defaultCredentialStorage().getFromPersistentStorage(protectionSpace);
</ins><span class="cx"> 
</span><span class="cx">     if (!credential.hasPassword())
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Tools/ChangeLog        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-07-07  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        HTTP Auth cached after disabling private browsing/reset.
+        &lt;rdar://problem/8293055&gt; and https://bugs.webkit.org/show_bug.cgi?id=146654
+
+        Reviewed by Tim Horton.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebViewToConsistentStateBeforeTesting): Clear in-memory credentials in between test runs.
+
</ins><span class="cx"> 2015-07-06  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [Content Extensions] Remove memory page reporting
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (186475 => 186476)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2015-07-07 20:16:41 UTC (rev 186475)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2015-07-07 21:13:31 UTC (rev 186476)
</span><span class="lines">@@ -1823,6 +1823,8 @@
</span><span class="cx">     [[webView window] setAutodisplay:NO];
</span><span class="cx"> #endif
</span><span class="cx">     [webView setTracksRepaints:NO];
</span><ins>+
+    [WebCache clearCachedCredentials];
</ins><span class="cx">     
</span><span class="cx">     resetWebPreferencesToConsistentValues();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>