<!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>[201324] 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/201324">201324</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-05-24 00:35:09 -0700 (Tue, 24 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Fetch API] Implement Fetch redirect mode
https://bugs.webkit.org/show_bug.cgi?id=157837

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/fetch/api/redirect/redirect-location-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-location.js:
* web-platform-tests/fetch/api/redirect/redirect-method.js:
* web-platform-tests/fetch/api/redirect/redirect-method-expected.txt:
* web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt:

Source/WebCore:

Implementing step 5 of https://fetch.spec.whatwg.org/#http-fetch.
Making ResourceLoaderOptions include FetchOptions.
This allows SubresourceLoader to follow or not redirections based on that option.
CachedResource is made responsible to handle the type of the response (opaqueredirect, opaque, cors, basic...).
If redirection is not to be followed, either an error is returned or an empty response is returned.

Moved Response type and redirected flag from FetchResponse to ResourceResponse.
This allows CachedResource to easily communicate that information to FetchResponse.

Made some clean-up refactoring in ThreadableLoaderOptions.

http/tests/fetch/caching-with-different-options.html ensures that
caching at CachedResourceLoader will not have bad effects on fetch.
Covered by updated and rebased tests.

* Modules/fetch/FetchLoader.cpp:
(WebCore::FetchLoader::start):
* Modules/fetch/FetchResponse.cpp:
(WebCore::FetchResponse::error):
(WebCore::FetchResponse::redirect):
(WebCore::FetchResponse::FetchResponse):
(WebCore::FetchResponse::clone):
(WebCore::FetchResponse::startFetching):
* Modules/fetch/FetchResponse.h:
* WebCore.xcodeproj/project.pbxproj:
* loader/FetchOptions.h: Moved from Source/WebCore/Modules/fetch/FetchOptions.h.
* loader/ResourceLoaderOptions.h:
(WebCore::ResourceLoaderOptions::fetchOptions):
(WebCore::ResourceLoaderOptions::setFetchOptions):
* loader/SubresourceLoader.cpp:
(WebCore::SubresourceLoader::willSendRequestInternal):
* loader/ThreadableLoader.cpp:
* loader/ThreadableLoader.h:
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::setResponse):
* loader/cache/CachedResource.h:
(WebCore::CachedResource::setOpaqueRedirect):
* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::adopt):
(WebCore::ResourceResponseBase::copyData):
* platform/network/ResourceResponseBase.h:
(WebCore::ResourceResponseBase::type):
(WebCore::ResourceResponseBase::setType):
(WebCore::ResourceResponseBase::encode):
(WebCore::ResourceResponseBase::decode):

LayoutTests:

* http/tests/fetch/caching-with-different-options-expected.txt: Added.
* http/tests/fetch/caching-with-different-options.html: Added.
* http/tests/fetch/resources/redirect-with-cache.php: Added.
* platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt:
* platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectlocationexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectlocationjs">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectmethodexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectmethodjs">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectmodeexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkimportedw3cwebplatformtestsfetchapiredirectredirectlocationexpectedtxt">trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkimportedw3cwebplatformtestsfetchapiredirectredirectmethodexpectedtxt">trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchLoadercpp">trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponsecpp">trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesfetchFetchResponseh">trunk/Source/WebCore/Modules/fetch/FetchResponse.h</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreloaderResourceLoaderOptionsh">trunk/Source/WebCore/loader/ResourceLoaderOptions.h</a></li>
<li><a href="#trunkSourceWebCoreloaderSubresourceLoadercpp">trunk/Source/WebCore/loader/SubresourceLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderThreadableLoadercpp">trunk/Source/WebCore/loader/ThreadableLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderThreadableLoaderh">trunk/Source/WebCore/loader/ThreadableLoader.h</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourcecpp">trunk/Source/WebCore/loader/cache/CachedResource.cpp</a></li>
<li><a href="#trunkSourceWebCoreloadercacheCachedResourceh">trunk/Source/WebCore/loader/cache/CachedResource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBasecpp">trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceResponseBaseh">trunk/Source/WebCore/platform/network/ResourceResponseBase.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestshttptestsfetchcachingwithdifferentoptionsexpectedtxt">trunk/LayoutTests/http/tests/fetch/caching-with-different-options-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsfetchcachingwithdifferentoptionshtml">trunk/LayoutTests/http/tests/fetch/caching-with-different-options.html</a></li>
<li>trunk/LayoutTests/http/tests/fetch/resources/</li>
<li><a href="#trunkLayoutTestshttptestsfetchresourcesredirectwithcachephp">trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.php</a></li>
<li><a href="#trunkSourceWebCoreloaderFetchOptionsh">trunk/Source/WebCore/loader/FetchOptions.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreModulesfetchFetchOptionsh">trunk/Source/WebCore/Modules/fetch/FetchOptions.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/ChangeLog        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-05-24  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        [Fetch API] Implement Fetch redirect mode
+        https://bugs.webkit.org/show_bug.cgi?id=157837
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/fetch/caching-with-different-options-expected.txt: Added.
+        * http/tests/fetch/caching-with-different-options.html: Added.
+        * http/tests/fetch/resources/redirect-with-cache.php: Added.
+        * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt:
+        * platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt:
+
</ins><span class="cx"> 2016-05-23  Yoav Weiss  &lt;yoav@yoav.ws&gt;
</span><span class="cx"> 
</span><span class="cx">         Add a few initiator tests to resource timing.
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsfetchcachingwithdifferentoptionsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/fetch/caching-with-different-options-expected.txt (0 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/fetch/caching-with-different-options-expected.txt                                (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/caching-with-different-options-expected.txt        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Manual redirect fetch should not disrupt follow redirect fetch of the same resource 
+PASS Follow redirect fetch should not disrupt manual redirect fetch of the same resource 
+PASS Being loaded resources with different redirect mode should not break each other 
+
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsfetchcachingwithdifferentoptionshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/fetch/caching-with-different-options.html (0 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/fetch/caching-with-different-options.html                                (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/caching-with-different-options.html        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;meta charset=&quot;utf-8&quot;&gt;
+    &lt;title&gt;Fetch: retrieve response's body progressively&lt;/title&gt;
+    &lt;meta name=&quot;help&quot; href=&quot;https://fetch.spec.whatwg.org/#main-fetch&quot;&gt;
+    &lt;meta name=&quot;help&quot; href=&quot;https://fetch.spec.whatwg.org/#http-fetch&quot;&gt;
+    &lt;meta name=&quot;author&quot; title=&quot;Canon Research France&quot; href=&quot;https://www.crf.canon.fr&quot;&gt;
+    &lt;script src=&quot;/js-test-resources/testharness.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;/js-test-resources/testharnessreport.js&quot;&gt;&lt;/script&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+    &lt;div id=&quot;test&quot;&gt;&lt;/div&gt;
+    &lt;script&gt;
+
+var redirectUrl = &quot;./resources/redirect-with-cache.php?url=/js-test-resources/testharness.js&amp;&quot;;
+function redirectMode(test, redirect, urlSuffix) {
+  var requestInit = {&quot;redirect&quot;: redirect};
+  requestInit.headers = [[&quot;enablecaching&quot;, &quot;true&quot;]];
+  if (redirect === &quot;manual&quot;) {
+    return fetch(redirectUrl + urlSuffix, requestInit).then(function(response) {
+      assert_equals(response.type, &quot;opaqueredirect&quot;, &quot;Response type is opaqueredirect&quot;);
+      assert_equals(response.status, 0, &quot;Response status is 0&quot;);
+    });
+  }
+  else {
+    return fetch(redirectUrl + urlSuffix, requestInit).then(function(response) {
+      assert_equals(response.type, &quot;basic&quot;, &quot;Response type is basic&quot;);
+      assert_equals(response.status, 200, &quot;Response status is 200&quot;);
+    });
+  }
+}
+
+promise_test(function(test) {
+  return redirectMode(test, &quot;manual&quot;, &quot;test1&quot;).then(() =&gt; {
+    return redirectMode(test, &quot;follow&quot;, &quot;test1&quot;);
+  });
+}, &quot;Manual redirect fetch should not disrupt follow redirect fetch of the same resource&quot;);
+
+promise_test(function(test) {
+  return redirectMode(test, &quot;follow&quot;, &quot;test2&quot;).then(() =&gt; {
+    return redirectMode(test, &quot;manual&quot;, &quot;test2&quot;);
+  });
+}, &quot;Follow redirect fetch should not disrupt manual redirect fetch of the same resource&quot;);
+
+promise_test(function(test) {
+  return Promise.all([
+    redirectMode(test, &quot;follow&quot;, &quot;test3&quot;),
+    redirectMode(test, &quot;manual&quot;, &quot;test3&quot;)
+  ]);
+}, &quot;Being loaded resources with different redirect mode should not break each other&quot;);
+
+    &lt;/script&gt;
+  &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestshttptestsfetchresourcesredirectwithcachephp"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.php (0 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.php                                (rev 0)
+++ trunk/LayoutTests/http/tests/fetch/resources/redirect-with-cache.php        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+&lt;?php
+    $url = $_GET[&quot;url&quot;];
+
+    $enableCaching = isset($_SERVER[&quot;ENABLECACHING&quot;]) ? true : false;
+    $code = isset($_GET[&quot;code&quot;]) ? $_GET[&quot;code&quot;] : 302;
+
+    header(&quot;HTTP/1.1 $code&quot;);
+    header(&quot;Location: $url&quot;);
+
+    if ($enableCaching)
+        header(&quot;Cache-Control: max-age=31536000&quot;);
+    else
+        header(&quot;Cache-Control: no-store&quot;);
+?&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-05-24  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        [Fetch API] Implement Fetch redirect mode
+        https://bugs.webkit.org/show_bug.cgi?id=157837
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/fetch/api/redirect/redirect-location-expected.txt:
+        * web-platform-tests/fetch/api/redirect/redirect-location.js:
+        * web-platform-tests/fetch/api/redirect/redirect-method.js:
+        * web-platform-tests/fetch/api/redirect/redirect-method-expected.txt:
+        * web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt:
+
</ins><span class="cx"> 2016-05-18  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Cascading order for !important properties in ::slotted and ::host rules is incorrect
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectlocationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -4,29 +4,29 @@
</span><span class="cx"> PASS Redirect 301 in &quot;follow&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 301 in &quot;manual&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 301 in &quot;follow&quot; mode with data location 
</span><del>-FAIL Redirect 301 in &quot;manual&quot; mode with data location promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+PASS Redirect 301 in &quot;manual&quot; mode with data location 
</ins><span class="cx"> PASS Redirect 302 in &quot;follow&quot; mode without location 
</span><span class="cx"> PASS Redirect 302 in &quot;manual&quot; mode without location 
</span><span class="cx"> PASS Redirect 302 in &quot;follow&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 302 in &quot;manual&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 302 in &quot;follow&quot; mode with data location 
</span><del>-FAIL Redirect 302 in &quot;manual&quot; mode with data location promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+PASS Redirect 302 in &quot;manual&quot; mode with data location 
</ins><span class="cx"> PASS Redirect 303 in &quot;follow&quot; mode without location 
</span><span class="cx"> PASS Redirect 303 in &quot;manual&quot; mode without location 
</span><span class="cx"> PASS Redirect 303 in &quot;follow&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 303 in &quot;manual&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 303 in &quot;follow&quot; mode with data location 
</span><del>-FAIL Redirect 303 in &quot;manual&quot; mode with data location promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+PASS Redirect 303 in &quot;manual&quot; mode with data location 
</ins><span class="cx"> PASS Redirect 307 in &quot;follow&quot; mode without location 
</span><span class="cx"> PASS Redirect 307 in &quot;manual&quot; mode without location 
</span><span class="cx"> PASS Redirect 307 in &quot;follow&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 307 in &quot;manual&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 307 in &quot;follow&quot; mode with data location 
</span><del>-FAIL Redirect 307 in &quot;manual&quot; mode with data location promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+PASS Redirect 307 in &quot;manual&quot; mode with data location 
</ins><span class="cx"> PASS Redirect 308 in &quot;follow&quot; mode without location 
</span><span class="cx"> PASS Redirect 308 in &quot;manual&quot; mode without location 
</span><span class="cx"> PASS Redirect 308 in &quot;follow&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 308 in &quot;manual&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 308 in &quot;follow&quot; mode with data location 
</span><del>-FAIL Redirect 308 in &quot;manual&quot; mode with data location promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+PASS Redirect 308 in &quot;manual&quot; mode with data location 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectlocationjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location.js        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx">   redirectLocation(&quot;Redirect &quot; + statusCode + &quot; in \&quot;manual\&quot; mode without location&quot;, redirUrl, undefined, statusCode, &quot;manual&quot;, true);
</span><span class="cx"> 
</span><span class="cx">   redirectLocation(&quot;Redirect &quot; + statusCode + &quot; in \&quot;follow\&quot; mode with invalid location&quot;, redirUrl, invalidLocationUrl, statusCode, &quot;follow&quot;, false);
</span><del>-  redirectLocation(&quot;Redirect &quot; + statusCode + &quot; in \&quot;manual\&quot; mode with invalid location&quot;, redirUrl, invalidLocationUrl, statusCode, &quot;manual&quot;, false);
</del><ins>+  redirectLocation(&quot;Redirect &quot; + statusCode + &quot; in \&quot;manual\&quot; mode with invalid location&quot;, redirUrl, invalidLocationUrl, statusCode, &quot;manual&quot;, true);
</ins><span class="cx"> 
</span><span class="cx">   redirectLocation(&quot;Redirect &quot; + statusCode + &quot; in \&quot;follow\&quot; mode with data location&quot;, redirUrl, dataLocationUrl, statusCode, &quot;follow&quot;, false);
</span><span class="cx">   redirectLocation(&quot;Redirect &quot; + statusCode + &quot; in \&quot;manual\&quot; mode with data location&quot;, redirUrl, dataLocationUrl, statusCode, &quot;manual&quot;, true);
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectmethodexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> 
</span><ins>+PASS Response.redirected should be false on not-redirected responses 
</ins><span class="cx"> PASS Redirect 301 with GET 
</span><span class="cx"> PASS Redirect 301 with POST 
</span><span class="cx"> PASS Redirect 301 with HEAD 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectmethodjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method.js        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -17,6 +17,7 @@
</span><span class="cx">       assert_equals(resp.status, 200, &quot;Response's status is 200&quot;);
</span><span class="cx">       assert_equals(resp.type, &quot;basic&quot;, &quot;Response's type basic&quot;);
</span><span class="cx">       assert_equals(resp.headers.get(&quot;x-request-method&quot;), expectedMethod, &quot;Request method after redirection is &quot; + expectedMethod);
</span><ins>+      assert_true(resp.redirected);
</ins><span class="cx">       return resp.text().then(function(text) {
</span><span class="cx">         assert_equals(text, expectedMethod == &quot;POST&quot; ? requestInit.body : &quot;&quot;);
</span><span class="cx">       });
</span><span class="lines">@@ -24,6 +25,14 @@
</span><span class="cx">   }, desc);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+promise_test(function(test) {
+    assert_false(new Response().redirected);
+    return fetch(RESOURCES_DIR + &quot;method.py&quot;).then(function(resp) {
+      assert_equals(resp.status, 200, &quot;Response's status is 200&quot;);
+      assert_false(resp.redirected);
+    });
+}, &quot;Response.redirected should be false on not-redirected responses&quot;);
+
</ins><span class="cx"> var redirUrl = RESOURCES_DIR + &quot;redirect.py&quot;;
</span><span class="cx"> var locationUrl = &quot;method.py&quot;;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsfetchapiredirectredirectmodeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-mode-expected.txt        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -1,17 +1,17 @@
</span><span class="cx"> 
</span><del>-FAIL Redirect 301 in &quot;error&quot; mode  assert_unreached: Should have rejected. Reached unreachable code
</del><ins>+PASS Redirect 301 in &quot;error&quot; mode  
</ins><span class="cx"> PASS Redirect 301 in &quot;follow&quot; mode  
</span><del>-FAIL Redirect 301 in &quot;manual&quot; mode  assert_equals: Response's status is 0 expected 0 but got 200
-FAIL Redirect 302 in &quot;error&quot; mode  assert_unreached: Should have rejected. Reached unreachable code
</del><ins>+PASS Redirect 301 in &quot;manual&quot; mode  
+PASS Redirect 302 in &quot;error&quot; mode  
</ins><span class="cx"> PASS Redirect 302 in &quot;follow&quot; mode  
</span><del>-FAIL Redirect 302 in &quot;manual&quot; mode  assert_equals: Response's status is 0 expected 0 but got 200
-FAIL Redirect 303 in &quot;error&quot; mode  assert_unreached: Should have rejected. Reached unreachable code
</del><ins>+PASS Redirect 302 in &quot;manual&quot; mode  
+PASS Redirect 303 in &quot;error&quot; mode  
</ins><span class="cx"> PASS Redirect 303 in &quot;follow&quot; mode  
</span><del>-FAIL Redirect 303 in &quot;manual&quot; mode  assert_equals: Response's status is 0 expected 0 but got 200
-FAIL Redirect 307 in &quot;error&quot; mode  assert_unreached: Should have rejected. Reached unreachable code
</del><ins>+PASS Redirect 303 in &quot;manual&quot; mode  
+PASS Redirect 307 in &quot;error&quot; mode  
</ins><span class="cx"> PASS Redirect 307 in &quot;follow&quot; mode  
</span><del>-FAIL Redirect 307 in &quot;manual&quot; mode  assert_equals: Response's status is 0 expected 0 but got 200
-FAIL Redirect 308 in &quot;error&quot; mode  assert_unreached: Should have rejected. Reached unreachable code
</del><ins>+PASS Redirect 307 in &quot;manual&quot; mode  
+PASS Redirect 308 in &quot;error&quot; mode  
</ins><span class="cx"> PASS Redirect 308 in &quot;follow&quot; mode  
</span><del>-FAIL Redirect 308 in &quot;manual&quot; mode  assert_equals: Response's status is 0 expected 0 but got 200
</del><ins>+PASS Redirect 308 in &quot;manual&quot; mode  
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkimportedw3cwebplatformtestsfetchapiredirectredirectlocationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-location-expected.txt        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -6,27 +6,27 @@
</span><span class="cx"> PASS Redirect 301 in &quot;follow&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 301 in &quot;manual&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 301 in &quot;follow&quot; mode with data location 
</span><del>-FAIL Redirect 301 in &quot;manual&quot; mode with data location promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+PASS Redirect 301 in &quot;manual&quot; mode with data location 
</ins><span class="cx"> PASS Redirect 302 in &quot;follow&quot; mode without location 
</span><span class="cx"> PASS Redirect 302 in &quot;manual&quot; mode without location 
</span><span class="cx"> PASS Redirect 302 in &quot;follow&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 302 in &quot;manual&quot; mode with invalid location 
</span><span class="cx"> PASS Redirect 302 in &quot;follow&quot; mode with data location 
</span><del>-FAIL Redirect 302 in &quot;manual&quot; mode with data location promise_test: Unhandled rejection with value: object &quot;TypeError: Type error&quot;
</del><ins>+PASS Redirect 302 in &quot;manual&quot; mode with data location 
</ins><span class="cx"> PASS Redirect 303 in &quot;follow&quot; mode without location 
</span><span class="cx"> PASS Redirect 303 in &quot;manual&quot; mode without location 
</span><span class="cx"> PASS Redirect 303 in &quot;follow&quot; mode with invalid location 
</span><del>-TIMEOUT Redirect 303 in &quot;manual&quot; mode with invalid location Test timed out
-TIMEOUT Redirect 303 in &quot;follow&quot; mode with data location Test timed out
-TIMEOUT Redirect 303 in &quot;manual&quot; mode with data location Test timed out
-TIMEOUT Redirect 307 in &quot;follow&quot; mode without location Test timed out
-TIMEOUT Redirect 307 in &quot;manual&quot; mode without location Test timed out
-TIMEOUT Redirect 307 in &quot;follow&quot; mode with invalid location Test timed out
-TIMEOUT Redirect 307 in &quot;manual&quot; mode with invalid location Test timed out
-TIMEOUT Redirect 307 in &quot;follow&quot; mode with data location Test timed out
-TIMEOUT Redirect 307 in &quot;manual&quot; mode with data location Test timed out
-TIMEOUT Redirect 308 in &quot;follow&quot; mode without location Test timed out
-TIMEOUT Redirect 308 in &quot;manual&quot; mode without location Test timed out
</del><ins>+PASS Redirect 303 in &quot;manual&quot; mode with invalid location 
+PASS Redirect 303 in &quot;follow&quot; mode with data location 
+PASS Redirect 303 in &quot;manual&quot; mode with data location 
+PASS Redirect 307 in &quot;follow&quot; mode without location 
+PASS Redirect 307 in &quot;manual&quot; mode without location 
+PASS Redirect 307 in &quot;follow&quot; mode with invalid location 
+PASS Redirect 307 in &quot;manual&quot; mode with invalid location 
+PASS Redirect 307 in &quot;follow&quot; mode with data location 
+PASS Redirect 307 in &quot;manual&quot; mode with data location 
+PASS Redirect 308 in &quot;follow&quot; mode without location 
+PASS Redirect 308 in &quot;manual&quot; mode without location 
</ins><span class="cx"> TIMEOUT Redirect 308 in &quot;follow&quot; mode with invalid location Test timed out
</span><span class="cx"> TIMEOUT Redirect 308 in &quot;manual&quot; mode with invalid location Test timed out
</span><span class="cx"> TIMEOUT Redirect 308 in &quot;follow&quot; mode with data location Test timed out
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkimportedw3cwebplatformtestsfetchapiredirectredirectmethodexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/fetch/api/redirect/redirect-method-expected.txt        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> 
</span><ins>+PASS Response.redirected should be false on not-redirected responses 
</ins><span class="cx"> PASS Redirect 301 with GET 
</span><span class="cx"> PASS Redirect 301 with POST 
</span><span class="cx"> PASS Redirect 301 with HEAD 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/ChangeLog        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2016-05-24  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        [Fetch API] Implement Fetch redirect mode
+        https://bugs.webkit.org/show_bug.cgi?id=157837
+
+        Reviewed by Alex Christensen.
+
+        Implementing step 5 of https://fetch.spec.whatwg.org/#http-fetch.
+        Making ResourceLoaderOptions include FetchOptions.
+        This allows SubresourceLoader to follow or not redirections based on that option.
+        CachedResource is made responsible to handle the type of the response (opaqueredirect, opaque, cors, basic...).
+        If redirection is not to be followed, either an error is returned or an empty response is returned.
+
+        Moved Response type and redirected flag from FetchResponse to ResourceResponse.
+        This allows CachedResource to easily communicate that information to FetchResponse.
+
+        Made some clean-up refactoring in ThreadableLoaderOptions.
+
+        http/tests/fetch/caching-with-different-options.html ensures that
+        caching at CachedResourceLoader will not have bad effects on fetch.
+        Covered by updated and rebased tests.
+
+        * Modules/fetch/FetchLoader.cpp:
+        (WebCore::FetchLoader::start):
+        * Modules/fetch/FetchResponse.cpp:
+        (WebCore::FetchResponse::error):
+        (WebCore::FetchResponse::redirect):
+        (WebCore::FetchResponse::FetchResponse):
+        (WebCore::FetchResponse::clone):
+        (WebCore::FetchResponse::startFetching):
+        * Modules/fetch/FetchResponse.h:
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/FetchOptions.h: Moved from Source/WebCore/Modules/fetch/FetchOptions.h.
+        * loader/ResourceLoaderOptions.h:
+        (WebCore::ResourceLoaderOptions::fetchOptions):
+        (WebCore::ResourceLoaderOptions::setFetchOptions):
+        * loader/SubresourceLoader.cpp:
+        (WebCore::SubresourceLoader::willSendRequestInternal):
+        * loader/ThreadableLoader.cpp:
+        * loader/ThreadableLoader.h:
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::setResponse):
+        * loader/cache/CachedResource.h:
+        (WebCore::CachedResource::setOpaqueRedirect):
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::adopt):
+        (WebCore::ResourceResponseBase::copyData):
+        * platform/network/ResourceResponseBase.h:
+        (WebCore::ResourceResponseBase::type):
+        (WebCore::ResourceResponseBase::setType):
+        (WebCore::ResourceResponseBase::encode):
+        (WebCore::ResourceResponseBase::decode):
+
</ins><span class="cx"> 2016-05-23  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Assertion failure for Reflect.get with Proxy and primitive value as explicit receiver
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/Modules/fetch/FetchLoader.cpp        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     options.contentSecurityPolicyEnforcement = ContentSecurityPolicyEnforcement::DoNotEnforce;
</span><span class="cx"> 
</span><span class="cx">     m_loader = ThreadableLoader::create(&amp;context, this, request, options);
</span><del>-    m_isStarted = true;
</del><ins>+    m_isStarted = m_loader;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FetchLoader::start(ScriptExecutionContext&amp; context, const FetchRequest&amp; request)
</span><span class="lines">@@ -82,9 +82,10 @@
</span><span class="cx">     options.setAllowCredentials(AllowStoredCredentials);
</span><span class="cx">     options.crossOriginRequestPolicy = DenyCrossOriginRequests;
</span><span class="cx">     options.contentSecurityPolicyEnforcement = ContentSecurityPolicyEnforcement::DoNotEnforce;
</span><ins>+    options.setFetchOptions(request.fetchOptions());
</ins><span class="cx"> 
</span><span class="cx">     m_loader = ThreadableLoader::create(&amp;context, this, request.internalRequest(), options);
</span><del>-    m_isStarted = true;
</del><ins>+    m_isStarted = m_loader;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FetchLoader::FetchLoader(Type type, FetchLoaderClient&amp; client)
</span><span class="lines">@@ -96,10 +97,8 @@
</span><span class="cx"> void FetchLoader::stop()
</span><span class="cx"> {
</span><span class="cx">     m_data = nullptr;
</span><del>-    if (m_loader) {
-        RefPtr&lt;ThreadableLoader&gt; loader = WTFMove(m_loader);
-        loader-&gt;cancel();
-    }
</del><ins>+    if (m_loader)
+        m_loader-&gt;cancel();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;SharedBuffer&gt; FetchLoader::startStreaming()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchOptionsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/fetch/FetchOptions.h (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchOptions.h        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/Modules/fetch/FetchOptions.h        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -1,60 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 Canon Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted, provided that the following conditions
- * are required to be met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Canon Inc. nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(FETCH_API)
-
-namespace WebCore {
-
-struct FetchOptions {
-    enum class Type { EmptyString, Audio, Font, Image, Script, Style, Track, Video };
-    Type type { Type::EmptyString };
-
-    enum class Destination { EmptyString, Document, Sharedworker, Subresource, Unknown, Worker };
-    Destination destination { Destination::EmptyString };
-
-    enum class Mode { Navigate, SameOrigin, NoCors, Cors };
-    Mode mode { Mode::NoCors };
-
-    enum class Credentials { Omit, SameOrigin, Include };
-    Credentials credentials { Credentials::Omit };
-
-    enum class Cache { Default, NoStore, Reload, NoCache, ForceCache };
-    Cache cache { Cache::Default };
-
-    enum class Redirect { Follow, Error, Manual };
-    Redirect redirect { Redirect::Follow };
-
-    enum class ReferrerPolicy { EmptyString, NoReferrer, NoReferrerWhenDowngrade, OriginOnly, OriginWhenCrossOrigin, UnsafeUrl };
-    ReferrerPolicy referrerPolicy { ReferrerPolicy::EmptyString };
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(FETCH_API)
</del></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponsecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.cpp        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -51,7 +51,9 @@
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;FetchResponse&gt; FetchResponse::error(ScriptExecutionContext&amp; context)
</span><span class="cx"> {
</span><del>-    return adoptRef(*new FetchResponse(context, Type::Error, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
</del><ins>+    auto response = adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
+    response-&gt;m_response.setType(Type::Error);
+    return response;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;FetchResponse&gt; FetchResponse::redirect(ScriptExecutionContext&amp; context, const String&amp; url, int status, ExceptionCode&amp; ec)
</span><span class="lines">@@ -66,7 +68,7 @@
</span><span class="cx">         ec = TypeError;
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><del>-    auto redirectResponse = adoptRef(*new FetchResponse(context, Type::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
</del><ins>+    auto redirectResponse = adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
</ins><span class="cx">     redirectResponse-&gt;m_response.setHTTPStatusCode(status);
</span><span class="cx">     redirectResponse-&gt;m_headers-&gt;fastSet(HTTPHeaderName::Location, requestURL.string());
</span><span class="cx">     return WTFMove(redirectResponse);
</span><span class="lines">@@ -109,9 +111,8 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FetchResponse::FetchResponse(ScriptExecutionContext&amp; context, Type type, FetchBody&amp;&amp; body, Ref&lt;FetchHeaders&gt;&amp;&amp; headers, ResourceResponse&amp;&amp; response)
</del><ins>+FetchResponse::FetchResponse(ScriptExecutionContext&amp; context, FetchBody&amp;&amp; body, Ref&lt;FetchHeaders&gt;&amp;&amp; headers, ResourceResponse&amp;&amp; response)
</ins><span class="cx">     : FetchBodyOwner(context, WTFMove(body))
</span><del>-    , m_type(type)
</del><span class="cx">     , m_response(WTFMove(response))
</span><span class="cx">     , m_headers(WTFMove(headers))
</span><span class="cx"> {
</span><span class="lines">@@ -123,14 +124,12 @@
</span><span class="cx">         ec = TypeError;
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><del>-    auto cloned = adoptRef(*new FetchResponse(context, m_type, FetchBody(m_body), FetchHeaders::create(headers()), ResourceResponse(m_response)));
-    cloned-&gt;m_isRedirected = m_isRedirected;
-    return WTFMove(cloned);
</del><ins>+    return adoptRef(*new FetchResponse(context, FetchBody(m_body), FetchHeaders::create(headers()), ResourceResponse(m_response)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FetchResponse::startFetching(ScriptExecutionContext&amp; context, const FetchRequest&amp; request, FetchPromise&amp;&amp; promise)
</span><span class="cx"> {
</span><del>-    auto response = adoptRef(*new FetchResponse(context, Type::Basic, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), ResourceResponse()));
</del><ins>+    auto response = adoptRef(*new FetchResponse(context, FetchBody::loadingBody(), FetchHeaders::create(FetchHeaders::Guard::Immutable), { }));
</ins><span class="cx"> 
</span><span class="cx">     // Setting pending activity until BodyLoader didFail or didSucceed callback is called.
</span><span class="cx">     response-&gt;setPendingActivity(response.ptr());
</span><span class="lines">@@ -173,7 +172,8 @@
</span><span class="cx">         m_response.m_readableStreamSource = nullptr;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><del>-    m_response.m_bodyLoader = Nullopt;
</del><ins>+    if (m_loader-&gt;isStarted())
+        m_response.m_bodyLoader = Nullopt;
</ins><span class="cx">     m_response.unsetPendingActivity(&amp;m_response);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesfetchFetchResponseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.h (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/fetch/FetchResponse.h        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.h        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx"> 
</span><span class="cx"> class FetchResponse final : public FetchBodyOwner {
</span><span class="cx"> public:
</span><del>-    enum class Type { Basic, Cors, Default, Error, Opaque, Opaqueredirect };
</del><ins>+    using Type = ResourceResponse::Type;
</ins><span class="cx"> 
</span><del>-    static Ref&lt;FetchResponse&gt; create(ScriptExecutionContext&amp; context) { return adoptRef(*new FetchResponse(context, Type::Default, { }, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }
</del><ins>+    static Ref&lt;FetchResponse&gt; create(ScriptExecutionContext&amp; context) { return adoptRef(*new FetchResponse(context, { }, FetchHeaders::create(FetchHeaders::Guard::Response), ResourceResponse())); }
</ins><span class="cx">     static Ref&lt;FetchResponse&gt; error(ScriptExecutionContext&amp;);
</span><span class="cx">     static RefPtr&lt;FetchResponse&gt; redirect(ScriptExecutionContext&amp;, const String&amp;, int, ExceptionCode&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -60,9 +60,9 @@
</span><span class="cx"> 
</span><span class="cx">     void initializeWith(const Dictionary&amp;, ExceptionCode&amp;);
</span><span class="cx"> 
</span><del>-    Type type() const;
</del><ins>+    Type type() const { return m_response.type(); }
</ins><span class="cx">     const String&amp; url() const { return m_response.url().string(); }
</span><del>-    bool redirected() const { return m_isRedirected; }
</del><ins>+    bool redirected() const { return m_response.isRedirected(); }
</ins><span class="cx">     int status() const { return m_response.httpStatusCode(); }
</span><span class="cx">     bool ok() const { return status() &gt;= 200 &amp;&amp; status() &lt;= 299; }
</span><span class="cx">     const String&amp; statusText() const { return m_response.httpStatusText(); }
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    FetchResponse(ScriptExecutionContext&amp;, Type, FetchBody&amp;&amp;, Ref&lt;FetchHeaders&gt;&amp;&amp;, ResourceResponse&amp;&amp;);
</del><ins>+    FetchResponse(ScriptExecutionContext&amp;, FetchBody&amp;&amp;, Ref&lt;FetchHeaders&gt;&amp;&amp;, ResourceResponse&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     static void startFetching(ScriptExecutionContext&amp;, const FetchRequest&amp;, FetchPromise&amp;&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx">         // FetchLoaderClient API
</span><span class="cx">         void didSucceed() final;
</span><span class="cx">         void didFail() final;
</span><del>-        void didReceiveResponse(const ResourceResponse&amp;);
</del><ins>+        void didReceiveResponse(const ResourceResponse&amp;) final;
</ins><span class="cx">         void didReceiveData(const char*, size_t) final;
</span><span class="cx">         void didFinishLoadingAsArrayBuffer(RefPtr&lt;ArrayBuffer&gt;&amp;&amp;) final;
</span><span class="cx"> 
</span><span class="lines">@@ -109,18 +109,11 @@
</span><span class="cx">         std::unique_ptr&lt;FetchLoader&gt; m_loader;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    Type m_type;
</del><span class="cx">     ResourceResponse m_response;
</span><span class="cx">     Ref&lt;FetchHeaders&gt; m_headers;
</span><del>-    bool m_isRedirected = false;
</del><span class="cx">     Optional&lt;BodyLoader&gt; m_bodyLoader;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline auto FetchResponse::type() const -&gt; Type
-{
-    return m_type;
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(FETCH_API)
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -1571,6 +1571,7 @@
</span><span class="cx">                 419BE7591BC7F42B00E1C85B /* WebCoreBuiltinNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 419BE7521BC7F3DB00E1C85B /* WebCoreBuiltinNames.h */; };
</span><span class="cx">                 41A3D58E101C152D00316D07 /* DedicatedWorkerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */; };
</span><span class="cx">                 41A3D58F101C152D00316D07 /* DedicatedWorkerThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */; };
</span><ins>+                41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 41AD75391CEF6BCE00A31486 /* FetchOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 41BF700C0FE86F49005E8DEC /* MessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 41BF700F0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41BF700D0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp */; };
</span><span class="cx">                 41BF70100FE86F61005E8DEC /* PlatformMessagePortChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 41BF700E0FE86F61005E8DEC /* PlatformMessagePortChannel.h */; };
</span><span class="lines">@@ -9069,6 +9070,7 @@
</span><span class="cx">                 41A023ED1A39DB7900F722DF /* WritableStream.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WritableStream.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41A3D58C101C152D00316D07 /* DedicatedWorkerThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DedicatedWorkerThread.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41A3D58D101C152D00316D07 /* DedicatedWorkerThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DedicatedWorkerThread.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                41AD75391CEF6BCE00A31486 /* FetchOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchOptions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 41BF700A0FE86F49005E8DEC /* MessagePortChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagePortChannel.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41BF700D0FE86F61005E8DEC /* PlatformMessagePortChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PlatformMessagePortChannel.cpp; path = default/PlatformMessagePortChannel.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41BF700E0FE86F61005E8DEC /* PlatformMessagePortChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatformMessagePortChannel.h; path = default/PlatformMessagePortChannel.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -9091,7 +9093,6 @@
</span><span class="cx">                 41F54F831C50C4F600338488 /* FetchHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchHeaders.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41F54F841C50C4F600338488 /* FetchHeaders.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchHeaders.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41F54F851C50C4F600338488 /* FetchHeaders.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = FetchHeaders.js; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                41F54F861C50C4F600338488 /* FetchOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchOptions.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 41F54F871C50C4F600338488 /* FetchRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchRequest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41F54F881C50C4F600338488 /* FetchRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchRequest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 41F54F891C50C4F600338488 /* FetchRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchRequest.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16837,7 +16838,6 @@
</span><span class="cx">                                 4147E2B41C89912600A7E715 /* FetchLoader.cpp */,
</span><span class="cx">                                 4147E2B51C89912600A7E715 /* FetchLoader.h */,
</span><span class="cx">                                 4147E2B61C89912600A7E715 /* FetchLoaderClient.h */,
</span><del>-                                41F54F861C50C4F600338488 /* FetchOptions.h */,
</del><span class="cx">                                 41F54F871C50C4F600338488 /* FetchRequest.cpp */,
</span><span class="cx">                                 41F54F881C50C4F600338488 /* FetchRequest.h */,
</span><span class="cx">                                 41F54F891C50C4F600338488 /* FetchRequest.idl */,
</span><span class="lines">@@ -22726,6 +22726,7 @@
</span><span class="cx">                                 9738899F116EA9DC00ADF313 /* DocumentWriter.h */,
</span><span class="cx">                                 F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */,
</span><span class="cx">                                 B255990D0D00D8B900BB825C /* EmptyClients.h */,
</span><ins>+                                41AD75391CEF6BCE00A31486 /* FetchOptions.h */,
</ins><span class="cx">                                 656D37230ADBA5DE00A4554D /* FormState.cpp */,
</span><span class="cx">                                 656D37220ADBA5DE00A4554D /* FormState.h */,
</span><span class="cx">                                 41885B9211B6FDA6003383BB /* FormSubmission.cpp */,
</span><span class="lines">@@ -28246,6 +28247,7 @@
</span><span class="cx">                                 E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */,
</span><span class="cx">                                 0880F70E1282B46D00948505 /* SVGStaticListPropertyTearOff.h in Headers */,
</span><span class="cx">                                 0813A4EA1284132600992511 /* SVGStaticPropertyTearOff.h in Headers */,
</span><ins>+                                41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */,
</ins><span class="cx">                                 B2227AA90D00BF220071B782 /* SVGStopElement.h in Headers */,
</span><span class="cx">                                 B2227AAC0D00BF220071B782 /* SVGStringList.h in Headers */,
</span><span class="cx">                                 B2227AB80D00BF220071B782 /* SVGStyleElement.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFetchOptionshfromrev201323trunkSourceWebCoreModulesfetchFetchOptionsh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/loader/FetchOptions.h (from rev 201323, trunk/Source/WebCore/Modules/fetch/FetchOptions.h) (0 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FetchOptions.h                                (rev 0)
+++ trunk/Source/WebCore/loader/FetchOptions.h        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2016 Canon Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted, provided that the following conditions
+ * are required to be met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Canon Inc. nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+struct FetchOptions {
+    enum class Type { EmptyString, Audio, Font, Image, Script, Style, Track, Video };
+    Type type { Type::EmptyString };
+
+    enum class Destination { EmptyString, Document, Sharedworker, Subresource, Unknown, Worker };
+    Destination destination { Destination::EmptyString };
+
+    enum class Mode { Navigate, SameOrigin, NoCors, Cors };
+    Mode mode { Mode::NoCors };
+
+    enum class Credentials { Omit, SameOrigin, Include };
+    Credentials credentials { Credentials::Omit };
+
+    enum class Cache { Default, NoStore, Reload, NoCache, ForceCache };
+    Cache cache { Cache::Default };
+
+    enum class Redirect { Follow, Error, Manual };
+    Redirect redirect { Redirect::Follow };
+
+    enum class ReferrerPolicy { EmptyString, NoReferrer, NoReferrerWhenDowngrade, OriginOnly, OriginWhenCrossOrigin, UnsafeUrl };
+    ReferrerPolicy referrerPolicy { ReferrerPolicy::EmptyString };
+};
+
+} // namespace WebCore
</ins></span></pre></div>
<a id="trunkSourceWebCoreloaderResourceLoaderOptionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ResourceLoaderOptions.h (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ResourceLoaderOptions.h        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/loader/ResourceLoaderOptions.h        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #ifndef ResourceLoaderOptions_h
</span><span class="cx"> #define ResourceLoaderOptions_h
</span><span class="cx"> 
</span><ins>+#include &quot;FetchOptions.h&quot;
</ins><span class="cx"> #include &quot;ResourceHandleTypes.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -135,6 +136,8 @@
</span><span class="cx">     void setDefersLoadingPolicy(DefersLoadingPolicy defersLoadingPolicy) { m_defersLoadingPolicy = defersLoadingPolicy; }
</span><span class="cx">     CachingPolicy cachingPolicy() const { return m_cachingPolicy; }
</span><span class="cx">     void setCachingPolicy(CachingPolicy cachingPolicy) { m_cachingPolicy = cachingPolicy; }
</span><ins>+    FetchOptions fetchOptions() const { return m_fetchOptions; }
+    void setFetchOptions(FetchOptions fetchOptions) { m_fetchOptions = fetchOptions; }
</ins><span class="cx"> 
</span><span class="cx">     unsigned m_sendLoadCallbacks : 1;
</span><span class="cx">     unsigned m_sniffContent : 1;
</span><span class="lines">@@ -148,6 +151,7 @@
</span><span class="cx">     ContentSecurityPolicyImposition m_contentSecurityPolicyImposition { ContentSecurityPolicyImposition::DoPolicyCheck };
</span><span class="cx">     DefersLoadingPolicy m_defersLoadingPolicy { DefersLoadingPolicy::AllowDefersLoading };
</span><span class="cx">     CachingPolicy m_cachingPolicy { CachingPolicy::AllowCaching };
</span><ins>+    FetchOptions m_fetchOptions;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore    
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderSubresourceLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/SubresourceLoader.cpp        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -175,6 +175,17 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!newRequest.isNull());
</span><span class="cx">     if (!redirectResponse.isNull()) {
</span><ins>+        if (options().fetchOptions().redirect != FetchOptions::Redirect::Follow) {
+            if (options().fetchOptions().redirect == FetchOptions::Redirect::Error) {
+                cancel();
+                return;
+            }
+            m_resource-&gt;setOpaqueRedirect();
+            m_resource-&gt;responseReceived({ });
+            didFinishLoading(currentTime());
+            return;
+        }
+
</ins><span class="cx">         // CachedResources are keyed off their original request URL.
</span><span class="cx">         // Requesting the same original URL a second time can redirect to a unique second resource.
</span><span class="cx">         // Therefore, if a redirect to a different destination URL occurs, we should no longer consider this a revalidation of the first resource.
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ThreadableLoader.cpp (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ThreadableLoader.cpp        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/loader/ThreadableLoader.cpp        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -42,8 +42,6 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> ThreadableLoaderOptions::ThreadableLoaderOptions()
</span><del>-    : preflightPolicy(ConsiderPreflight)
-    , crossOriginRequestPolicy(DenyCrossOriginRequests)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderThreadableLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ThreadableLoader.h (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ThreadableLoader.h        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/loader/ThreadableLoader.h        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -72,8 +72,8 @@
</span><span class="cx"> 
</span><span class="cx">         std::unique_ptr&lt;ThreadableLoaderOptions&gt; isolatedCopy() const;
</span><span class="cx"> 
</span><del>-        PreflightPolicy preflightPolicy; // If AccessControl is used, how to determine if a preflight is needed.
-        CrossOriginRequestPolicy crossOriginRequestPolicy;
</del><ins>+        PreflightPolicy preflightPolicy { ConsiderPreflight };
+        CrossOriginRequestPolicy crossOriginRequestPolicy { DenyCrossOriginRequests };
</ins><span class="cx">         ContentSecurityPolicyEnforcement contentSecurityPolicyEnforcement { ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective };
</span><span class="cx">         RefPtr&lt;SecurityOrigin&gt; securityOrigin;
</span><span class="cx">         String initiator; // This cannot be an AtomicString, as isolatedCopy() wouldn't create an object that's safe for passing to another thread.
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.cpp        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -411,6 +411,13 @@
</span><span class="cx">     return m_redirectResponseForSameOriginPolicyChecks.isNull() ? m_response : m_redirectResponseForSameOriginPolicyChecks;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CachedResource::setResponse(const ResourceResponse&amp; response)
+{
+    m_response = response;
+    m_response.setType(m_responseType);
+    m_response.setRedirected(m_redirectChainCacheStatus.status != RedirectChainCacheStatus::NoRedirection);
+}
+
</ins><span class="cx"> void CachedResource::responseReceived(const ResourceResponse&amp; response)
</span><span class="cx"> {
</span><span class="cx">     setResponse(response);
</span></span></pre></div>
<a id="trunkSourceWebCoreloadercacheCachedResourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/cache/CachedResource.h (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/cache/CachedResource.h        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/loader/cache/CachedResource.h        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -199,7 +199,8 @@
</span><span class="cx">     virtual void redirectReceived(ResourceRequest&amp;, const ResourceResponse&amp;);
</span><span class="cx">     virtual void responseReceived(const ResourceResponse&amp;);
</span><span class="cx">     virtual bool shouldCacheResponse(const ResourceResponse&amp;) { return true; }
</span><del>-    void setResponse(const ResourceResponse&amp; response) { m_response = response; }
</del><ins>+    void setResponse(const ResourceResponse&amp;);
+    void setOpaqueRedirect() { m_responseType = ResourceResponseBase::Type::Opaqueredirect; }
</ins><span class="cx">     const ResourceResponse&amp; response() const { return m_response; }
</span><span class="cx">     // This is the same as response() except after HTTP redirect to data: URL.
</span><span class="cx">     const ResourceResponse&amp; responseForSameOriginPolicyChecks() const;
</span><span class="lines">@@ -281,6 +282,7 @@
</span><span class="cx">     RefPtr&lt;SubresourceLoader&gt; m_loader;
</span><span class="cx">     ResourceLoaderOptions m_options;
</span><span class="cx">     ResourceResponse m_response;
</span><ins>+    ResourceResponseBase::Type m_responseType { ResourceResponseBase::Type::Basic };
</ins><span class="cx">     ResourceResponse m_redirectResponseForSameOriginPolicyChecks;
</span><span class="cx">     RefPtr&lt;SharedBuffer&gt; m_data;
</span><span class="cx">     DeferrableOneShotTimer m_decodedDataDeletionTimer;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx">     response-&gt;lazyInit(AllFields);
</span><span class="cx">     response-&gt;m_httpHeaderFields.adopt(WTFMove(data-&gt;m_httpHeaders));
</span><span class="cx">     response-&gt;m_resourceLoadTiming = data-&gt;m_resourceLoadTiming;
</span><ins>+    response-&gt;m_type = data-&gt;m_type;
</ins><span class="cx">     response-&gt;doPlatformAdopt(WTFMove(data));
</span><span class="cx">     return response;
</span><span class="cx"> }
</span><span class="lines">@@ -94,6 +95,7 @@
</span><span class="cx">     data-&gt;m_httpVersion = httpVersion().isolatedCopy();
</span><span class="cx">     data-&gt;m_httpHeaders = httpHeaderFields().copyData();
</span><span class="cx">     data-&gt;m_resourceLoadTiming = m_resourceLoadTiming;
</span><ins>+    data-&gt;m_type = m_type;
</ins><span class="cx">     return asResourceResponse().doPlatformCopyData(WTFMove(data));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceResponseBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceResponseBase.h (201323 => 201324)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2016-05-24 06:29:58 UTC (rev 201323)
+++ trunk/Source/WebCore/platform/network/ResourceResponseBase.h        2016-05-24 07:35:09 UTC (rev 201324)
</span><span class="lines">@@ -128,6 +128,12 @@
</span><span class="cx">         return 1280;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    enum class Type { Basic, Cors, Default, Error, Opaque, Opaqueredirect };
+    Type type() const { return m_type; }
+    void setType(Type type) { m_type = type; }
+    bool isRedirected() const { return m_isRedirected; }
+    void setRedirected(bool isRedirected) { m_isRedirected = isRedirected; }
+
</ins><span class="cx">     static bool compare(const ResourceResponse&amp;, const ResourceResponse&amp;);
</span><span class="cx"> 
</span><span class="cx">     template&lt;class Encoder&gt; void encode(Encoder&amp;) const;
</span><span class="lines">@@ -189,6 +195,9 @@
</span><span class="cx">     mutable bool m_haveParsedContentRangeHeader { false };
</span><span class="cx"> 
</span><span class="cx">     Source m_source { Source::Unknown };
</span><ins>+
+    Type m_type { Type::Default };
+    bool m_isRedirected { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> inline bool operator==(const ResourceResponse&amp; a, const ResourceResponse&amp; b) { return ResourceResponseBase::compare(a, b); }
</span><span class="lines">@@ -215,6 +224,8 @@
</span><span class="cx">     if (m_includesCertificateInfo)
</span><span class="cx">         encoder &lt;&lt; m_certificateInfo;
</span><span class="cx">     encoder.encodeEnum(m_source);
</span><ins>+    encoder.encodeEnum(m_type);
+    encoder &lt;&lt; m_isRedirected;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> template&lt;class Decoder&gt;
</span><span class="lines">@@ -255,6 +266,10 @@
</span><span class="cx">     }
</span><span class="cx">     if (!decoder.decodeEnum(response.m_source))
</span><span class="cx">         return false;
</span><ins>+    if (!decoder.decodeEnum(response.m_type))
+        return false;
+    if (!decoder.decode(response.m_isRedirected))
+        return false;
</ins><span class="cx">     response.m_isNull = false;
</span><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="lines">@@ -273,6 +288,8 @@
</span><span class="cx">     String m_httpVersion;
</span><span class="cx">     std::unique_ptr&lt;CrossThreadHTTPHeaderMapData&gt; m_httpHeaders;
</span><span class="cx">     ResourceLoadTiming m_resourceLoadTiming;
</span><ins>+    ResourceResponseBase::Type m_type;
+    bool m_isRedirected;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>