<!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>[198450] 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/198450">198450</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-03-18 16:23:09 -0700 (Fri, 18 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Speculative revalidation requests do not have their HTTP user-agent set
https://bugs.webkit.org/show_bug.cgi?id=155620
&lt;rdar://problem/24657567&gt;

Reviewed by Brady Eidson.

Source/WebCore:

Export a couple of symbols so they can be used from WebKit2.

Test: http/tests/cache/disk-cache/speculative-validation/validation-request.html

* platform/network/ResourceRequestBase.h:

Source/WebKit2:

Speculative revalidation requests do not have their HTTP user-agent set
which could lead to different content getting returned by the server.

To address the problem, we save the original request's 'user-agent' in
the disk cache and re-use it later on for speculative validation
requests.

* NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
(WebKit::NetworkCache::constructRevalidationRequest):
(WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
(WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
(WebKit::NetworkCache::SubresourceInfo::encode):
(WebKit::NetworkCache::SubresourceInfo::decode):
(WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
(WebKit::NetworkCache::SubresourceInfo::operator=):
(WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
(WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
(WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord): Deleted.
* NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
(WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):

LayoutTests:

Add layout test coverage.

* http/tests/cache/disk-cache/speculative-validation/resources/request-headers-script.php: Added.
* http/tests/cache/disk-cache/speculative-validation/resources/validation-request-frame.php: Added.
* http/tests/cache/disk-cache/speculative-validation/validation-request-expected.txt: Added.
* http/tests/cache/disk-cache/speculative-validation/validation-request.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="#trunkSourceWebCoreplatformnetworkResourceRequestBaseh">trunk/Source/WebCore/platform/network/ResourceRequestBase.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheSpeculativeLoadManagercpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheSubresourcesEntrycpp">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscacheNetworkCacheSubresourcesEntryh">trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/</li>
<li>trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/</li>
<li><a href="#trunkLayoutTestshttptestscachediskcachespeculativevalidationresourcesrequestheadersscriptphp">trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/request-headers-script.php</a></li>
<li><a href="#trunkLayoutTestshttptestscachediskcachespeculativevalidationresourcesvalidationrequestframephp">trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/validation-request-frame.php</a></li>
<li><a href="#trunkLayoutTestshttptestscachediskcachespeculativevalidationvalidationrequestexpectedtxt">trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/validation-request-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestscachediskcachespeculativevalidationvalidationrequesthtml">trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/validation-request.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198449 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-18 23:22:52 UTC (rev 198449)
+++ trunk/LayoutTests/ChangeLog        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-03-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Speculative revalidation requests do not have their HTTP user-agent set
+        https://bugs.webkit.org/show_bug.cgi?id=155620
+        &lt;rdar://problem/24657567&gt;
+
+        Reviewed by Brady Eidson.
+
+        Add layout test coverage.
+
+        * http/tests/cache/disk-cache/speculative-validation/resources/request-headers-script.php: Added.
+        * http/tests/cache/disk-cache/speculative-validation/resources/validation-request-frame.php: Added.
+        * http/tests/cache/disk-cache/speculative-validation/validation-request-expected.txt: Added.
+        * http/tests/cache/disk-cache/speculative-validation/validation-request.html: Added.
+
</ins><span class="cx"> 2016-03-18  Mark Lam  &lt;mark.lam@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ES6 spec requires that RegExpPrototype not be a RegExp object.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestscachediskcachespeculativevalidationresourcesrequestheadersscriptphp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/request-headers-script.php (0 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/request-headers-script.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/request-headers-script.php        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;?php
+header('Content-Type: text/javascript');
+header('Cache-Control: max-age=0');
+header('Etag: 123456789');
+
+?&gt;
+allRequestHeaders = [];
+&lt;?php
+foreach (getallheaders() as $name =&gt; $value) {
+    echo &quot;allRequestHeaders['&quot; . $name . &quot;'] = '&quot; . $value . &quot;';&quot;;
+}
+?&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscachediskcachespeculativevalidationresourcesvalidationrequestframephp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/validation-request-frame.php (0 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/validation-request-frame.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/resources/validation-request-frame.php        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;?php
+header('Content-Type: text/html');
+header('Cache-Control: max-age=0');
+header('Etag: 123456789');
+
+?&gt;
+&lt;!DOCTYPE html&gt;
+&lt;body&gt;
+&lt;script src=&quot;request-headers-script.php&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscachediskcachespeculativevalidationvalidationrequestexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/validation-request-expected.txt (0 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/validation-request-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/validation-request-expected.txt        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Validates HTTP headers of speculative validation requests.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS validationRequestHeader('If-None-Match') is &quot;123456789&quot;
+PASS validationRequestHeader('User-Agent') is initialUserAgent
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestscachediskcachespeculativevalidationvalidationrequesthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/validation-request.html (0 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/validation-request.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/cache/disk-cache/speculative-validation/validation-request.html        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;script src=&quot;/js-test-resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+description(&quot;Validates HTTP headers of speculative validation requests.&quot;);
+jsTestIsAsync = true;
+
+state = &quot;warmup&quot;;
+
+function validationRequestHeader(headerName)
+{
+    return frames[0].allRequestHeaders[headerName];
+    
+}
+
+function frameLoaded()
+{
+    if (state == &quot;warmup&quot;) {
+        initialUserAgent = validationRequestHeader('User-Agent');
+        // Navigate frame to 'about:blank' to flush to subresource loads metadata to disk.
+        state = &quot;flushingMetadata&quot;;
+        document.getElementById(&quot;testFrame&quot;).src = &quot;about:blank&quot;;
+        return;
+    }
+    if (state == &quot;flushingMetadata&quot;) {
+        // Navigate frame to its original location again. This time it should speculatively
+        // validate subresources as we have subresource loads metadata in the disk cache.
+        state = &quot;speculativeRevalidation&quot;;
+        document.getElementById(&quot;testFrame&quot;).src = &quot;resources/validation-request-frame.php&quot;;
+        return;
+    }
+    if (state == &quot;speculativeRevalidation&quot;) {
+        // Validate the HTTP headers of the speculative validation request.
+        shouldBeEqualToString(&quot;validationRequestHeader('If-None-Match')&quot;, &quot;123456789&quot;);
+        shouldBe(&quot;validationRequestHeader('User-Agent')&quot;, &quot;initialUserAgent&quot;);
+        finishJSTest();
+        return;
+    }
+}
+
+&lt;/script&gt;
+&lt;iframe id=&quot;testFrame&quot; src=&quot;resources/validation-request-frame.php&quot; onload=&quot;frameLoaded()&quot;&gt;&lt;/iframe&gt;
+&lt;script src=&quot;/js-test-resources/js-test-post.js&quot;&gt;&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198449 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-18 23:22:52 UTC (rev 198449)
+++ trunk/Source/WebCore/ChangeLog        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-03-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Speculative revalidation requests do not have their HTTP user-agent set
+        https://bugs.webkit.org/show_bug.cgi?id=155620
+        &lt;rdar://problem/24657567&gt;
+
+        Reviewed by Brady Eidson.
+
+        Export a couple of symbols so they can be used from WebKit2.
+
+        Test: http/tests/cache/disk-cache/speculative-validation/validation-request.html
+
+        * platform/network/ResourceRequestBase.h:
+
</ins><span class="cx"> 2016-03-18  Zhuo Li  &lt;zachli@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Need to forward declare NSScrollerImpSPI::scrollerLayoutDirection.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceRequestBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.h (198449 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceRequestBase.h        2016-03-18 23:22:52 UTC (rev 198449)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.h        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -107,8 +107,8 @@
</span><span class="cx">         void setHTTPOrigin(const String&amp;);
</span><span class="cx">         WEBCORE_EXPORT void clearHTTPOrigin();
</span><span class="cx"> 
</span><del>-        String httpUserAgent() const;
-        void setHTTPUserAgent(const String&amp;);
</del><ins>+        WEBCORE_EXPORT String httpUserAgent() const;
+        WEBCORE_EXPORT void setHTTPUserAgent(const String&amp;);
</ins><span class="cx">         void clearHTTPUserAgent();
</span><span class="cx"> 
</span><span class="cx">         String httpAccept() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (198449 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-18 23:22:52 UTC (rev 198449)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2016-03-18  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Speculative revalidation requests do not have their HTTP user-agent set
+        https://bugs.webkit.org/show_bug.cgi?id=155620
+        &lt;rdar://problem/24657567&gt;
+
+        Reviewed by Brady Eidson.
+
+        Speculative revalidation requests do not have their HTTP user-agent set
+        which could lead to different content getting returned by the server.
+
+        To address the problem, we save the original request's 'user-agent' in
+        the disk cache and re-use it later on for speculative validation
+        requests.
+
+        * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:
+        (WebKit::NetworkCache::constructRevalidationRequest):
+        (WebKit::NetworkCache::SpeculativeLoadManager::revalidateEntry):
+        (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry):
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:
+        (WebKit::NetworkCache::SubresourceInfo::encode):
+        (WebKit::NetworkCache::SubresourceInfo::decode):
+        (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
+        (WebKit::NetworkCache::SubresourceInfo::operator=):
+        (WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):
+        (WebKit::NetworkCache::SubresourcesEntry::updateSubresourceLoads):
+        (WebKit::NetworkCache::SubresourcesEntry::decodeStorageRecord): Deleted.
+        * NetworkProcess/cache/NetworkCacheSubresourcesEntry.h:
+        (WebKit::NetworkCache::SubresourceInfo::SubresourceInfo):
+
</ins><span class="cx"> 2016-03-18  Enrica Casucci  &lt;enrica@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add id attribute to _WKActivatedElementInfo.
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheSpeculativeLoadManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp (198449 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp        2016-03-18 23:22:52 UTC (rev 198449)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -84,10 +84,11 @@
</span><span class="cx">     return Key(resourceKey.partition(), subresourcesType(), resourceKey.range(), resourceKey.identifier());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline ResourceRequest constructRevalidationRequest(const Entry&amp; entry, const URL&amp; firstPartyForCookies)
</del><ins>+static inline ResourceRequest constructRevalidationRequest(const Entry&amp; entry, const SubresourceInfo&amp; subResourceInfo)
</ins><span class="cx"> {
</span><span class="cx">     ResourceRequest revalidationRequest(entry.key().identifier());
</span><del>-    revalidationRequest.setFirstPartyForCookies(firstPartyForCookies);
</del><ins>+    revalidationRequest.setHTTPUserAgent(subResourceInfo.httpUserAgent);
+    revalidationRequest.setFirstPartyForCookies(subResourceInfo.firstPartyForCookies);
</ins><span class="cx"> #if ENABLE(CACHE_PARTITIONING)
</span><span class="cx">     if (entry.key().hasPartition())
</span><span class="cx">         revalidationRequest.setCachePartition(entry.key().partition());
</span><span class="lines">@@ -380,7 +381,7 @@
</span><span class="cx">     if (!key.range().isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    ResourceRequest revalidationRequest = constructRevalidationRequest(*entry, subresourceInfo.firstPartyForCookies);
</del><ins>+    ResourceRequest revalidationRequest = constructRevalidationRequest(*entry, subresourceInfo);
</ins><span class="cx"> 
</span><span class="cx">     LOG(NetworkCacheSpeculativePreloading, &quot;(NetworkProcess) Speculatively revalidating '%s':&quot;, key.identifier().utf8().data());
</span><span class="cx">     auto revalidator = std::make_unique&lt;SpeculativeLoad&gt;(frameID, revalidationRequest, WTFMove(entry), [this, key, frameID](std::unique_ptr&lt;Entry&gt; revalidatedEntry) {
</span><span class="lines">@@ -405,8 +406,7 @@
</span><span class="cx"> void SpeculativeLoadManager::preloadEntry(const Key&amp; key, const SubresourceInfo&amp; subResourceInfo, const GlobalFrameID&amp; frameID)
</span><span class="cx"> {
</span><span class="cx">     m_pendingPreloads.add(key, nullptr);
</span><del>-    URLCapture firstPartyForCookies(subResourceInfo.firstPartyForCookies);
-    retrieveEntryFromStorage(key, [this, key, firstPartyForCookies, frameID](std::unique_ptr&lt;Entry&gt; entry) {
</del><ins>+    retrieveEntryFromStorage(key, [this, key, subResourceInfo, frameID](std::unique_ptr&lt;Entry&gt; entry) {
</ins><span class="cx">         m_pendingPreloads.remove(key);
</span><span class="cx"> 
</span><span class="cx">         if (satisfyPendingRequests(key, entry.get())) {
</span><span class="lines">@@ -419,7 +419,7 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         if (entry-&gt;needsValidation())
</span><del>-            revalidateEntry(WTFMove(entry), firstPartyForCookies.url(), frameID);
</del><ins>+            revalidateEntry(WTFMove(entry), subResourceInfo, frameID);
</ins><span class="cx">         else
</span><span class="cx">             addPreloadedEntry(WTFMove(entry), frameID, WasRevalidated::No);
</span><span class="cx">     });
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheSubresourcesEntrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp (198449 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp        2016-03-18 23:22:52 UTC (rev 198449)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> {
</span><span class="cx">     encoder &lt;&lt; firstPartyForCookies;
</span><span class="cx">     encoder &lt;&lt; isTransient;
</span><ins>+    encoder &lt;&lt; httpUserAgent;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool SubresourceInfo::decode(Decoder&amp; decoder, SubresourceInfo&amp; info)
</span><span class="lines">@@ -48,9 +49,26 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(info.isTransient))
</span><span class="cx">         return false;
</span><ins>+    if (!decoder.decode(info.httpUserAgent))
+        return false;
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+SubresourceInfo::SubresourceInfo(const SubresourceInfo&amp; subresourceInfo)
+    : firstPartyForCookies(subresourceInfo.firstPartyForCookies.isolatedCopy())
+    , httpUserAgent(subresourceInfo.httpUserAgent.isolatedCopy())
+    , isTransient(subresourceInfo.isTransient)
+{
+}
+
+SubresourceInfo&amp; SubresourceInfo::operator=(const SubresourceInfo&amp; other)
+{
+    firstPartyForCookies = other.firstPartyForCookies.isolatedCopy();
+    httpUserAgent = other.httpUserAgent.isolatedCopy();
+    isTransient = other.isTransient;
+    return *this;
+}
+
</ins><span class="cx"> Storage::Record SubresourcesEntry::encodeAsStorageRecord() const
</span><span class="cx"> {
</span><span class="cx">     Encoder encoder;
</span><span class="lines">@@ -90,7 +108,7 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_key.type() == &quot;subresources&quot;);
</span><span class="cx">     for (auto&amp; subresourceLoad : subresourceLoads)
</span><del>-        m_subresources.add(subresourceLoad-&gt;key, SubresourceInfo(subresourceLoad-&gt;request.firstPartyForCookies()));
</del><ins>+        m_subresources.add(subresourceLoad-&gt;key, SubresourceInfo(subresourceLoad-&gt;request));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void SubresourcesEntry::updateSubresourceLoads(const Vector&lt;std::unique_ptr&lt;SubresourceLoad&gt;&gt;&amp; subresourceLoads)
</span><span class="lines">@@ -100,7 +118,7 @@
</span><span class="cx">     // Mark keys that are common with last load as non-Transient.
</span><span class="cx">     for (auto&amp; subresourceLoad : subresourceLoads) {
</span><span class="cx">         bool isTransient = !oldSubresources.contains(subresourceLoad-&gt;key);
</span><del>-        m_subresources.add(subresourceLoad-&gt;key, SubresourceInfo(subresourceLoad-&gt;request.firstPartyForCookies(), isTransient));
</del><ins>+        m_subresources.add(subresourceLoad-&gt;key, SubresourceInfo(subresourceLoad-&gt;request, isTransient));
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscacheNetworkCacheSubresourcesEntryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h (198449 => 198450)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h        2016-03-18 23:22:52 UTC (rev 198449)
+++ trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheSubresourcesEntry.h        2016-03-18 23:23:09 UTC (rev 198450)
</span><span class="lines">@@ -43,12 +43,19 @@
</span><span class="cx">     static bool decode(Decoder&amp;, SubresourceInfo&amp;);
</span><span class="cx"> 
</span><span class="cx">     SubresourceInfo() = default;
</span><del>-    SubresourceInfo(const WebCore::URL&amp; firstPartyForCookies, bool isTransient = false)
-        : firstPartyForCookies(firstPartyForCookies)
</del><ins>+    SubresourceInfo(const WebCore::ResourceRequest&amp; request, bool isTransient = false)
+        : firstPartyForCookies(request.firstPartyForCookies())
+        , httpUserAgent(request.httpUserAgent())
</ins><span class="cx">         , isTransient(isTransient)
</span><span class="cx">     { }
</span><span class="cx"> 
</span><ins>+    SubresourceInfo(const SubresourceInfo&amp;);
+    SubresourceInfo(SubresourceInfo&amp;&amp;) = default;
+    SubresourceInfo&amp; operator=(const SubresourceInfo&amp;);
+    SubresourceInfo&amp; operator=(SubresourceInfo&amp;&amp;) = default;
+
</ins><span class="cx">     WebCore::URL firstPartyForCookies;
</span><ins>+    String httpUserAgent;
</ins><span class="cx">     bool isTransient { false };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>