<!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>[195273] releases/WebKitGTK/webkit-2.10</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/195273">195273</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-19 01:36:10 -0800 (Tue, 19 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/195100">r195100</a> - CORS: Fix the handling of redirected request containing Origin null.
https://bugs.webkit.org/show_bug.cgi?id=128816

Reviewed by Brent Fulgham.

Source/WebCore:

Merging Blink patch from George Ancil (https://chromiumcodereview.appspot.com/20735002).

This patch removes the check for securityOrigin-&gt;isUnique() in passesAccessControlCheck().
This check prevented a redirected request with &quot;Origin: null&quot; from being
successful even when the response contains &quot;Access-Control-Allow-Origin: null&quot;

Tests: http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null.html
       http/tests/xmlhttprequest/redirect-cors-origin-null.html

* loader/CrossOriginAccessControl.cpp:
(WebCore::passesAccessControlCheck):

LayoutTests:

Merging Blink patch from George Ancil (https://chromiumcodereview.appspot.com/20735002)

Added two tests to check CORS with Origin null in HTTP redirect and iframe cases.
Updated two test sandboxed iframes test expectations (requests are still denied but error messages are different).

* http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null-expected.txt: Added.
* http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null.html: Added.
* http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-expected.txt:
* http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt:
* http/tests/xmlhttprequest/redirect-cors-origin-null-expected.txt: Added.
* http/tests/xmlhttprequest/redirect-cors-origin-null.html: Added.
* http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null-iframe.html: Added.
* http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null.cgi: Added.
* http/tests/xmlhttprequest/resources/redirect-cors-origin-null-pass.php: Added.
* http/tests/xmlhttprequest/resources/redirect-cors-origin-null.php: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestsChangeLog">releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestaccesscontrolsandboxediframedeniedexpectedtxt">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestaccesscontrolsandboxediframedeniedwithoutwildcardexpectedtxt">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit210SourceWebCoreloaderCrossOriginAccessControlcpp">releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/CrossOriginAccessControl.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestaccesscontrolsandboxediframealloworiginnullexpectedtxt">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestaccesscontrolsandboxediframealloworiginnullhtml">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null.html</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestredirectcorsoriginnullexpectedtxt">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null-expected.txt</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestredirectcorsoriginnullhtml">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null.html</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestresourcesaccesscontrolsandboxediframealloworiginnulliframehtml">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null-iframe.html</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestresourcesaccesscontrolsandboxediframealloworiginnullcgi">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null.cgi</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestresourcesredirectcorsoriginnullpassphp">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null-pass.php</a></li>
<li><a href="#releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestresourcesredirectcorsoriginnullphp">releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit210LayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog (195272 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog        2016-01-19 09:33:57 UTC (rev 195272)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/ChangeLog        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-01-15  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        CORS: Fix the handling of redirected request containing Origin null.
+        https://bugs.webkit.org/show_bug.cgi?id=128816
+
+        Reviewed by Brent Fulgham.
+
+        Merging Blink patch from George Ancil (https://chromiumcodereview.appspot.com/20735002)
+
+        Added two tests to check CORS with Origin null in HTTP redirect and iframe cases.
+        Updated two test sandboxed iframes test expectations (requests are still denied but error messages are different).
+
+        * http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null-expected.txt: Added.
+        * http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null.html: Added.
+        * http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-expected.txt:
+        * http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt:
+        * http/tests/xmlhttprequest/redirect-cors-origin-null-expected.txt: Added.
+        * http/tests/xmlhttprequest/redirect-cors-origin-null.html: Added.
+        * http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null-iframe.html: Added.
+        * http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null.cgi: Added.
+        * http/tests/xmlhttprequest/resources/redirect-cors-origin-null-pass.php: Added.
+        * http/tests/xmlhttprequest/resources/redirect-cors-origin-null.php: Added.
+
</ins><span class="cx"> 2016-01-14  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Disallow use of Geolocation service from unique origins
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestaccesscontrolsandboxediframealloworiginnullexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null-expected.txt (0 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null-expected.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null-expected.txt        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+This test verifies that sandboxed iframe has XmlHttpRequest access to the server that accepts all domains. It will print &quot;PASS&quot; on success.
+
+
+
+--------
+Frame: '&lt;!--framePath //&lt;!--frame0--&gt;--&gt;'
+--------
+PASS: Sandboxed iframe XHR access allowed.
+
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestaccesscontrolsandboxediframealloworiginnullhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null.html (0 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null.html        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+&lt;html&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+}
+
+&lt;/script&gt;
+&lt;body&gt;
+    &lt;p&gt;This test verifies that sandboxed iframe has XmlHttpRequest access
+    to the server that accepts all domains. It will print &amp;quot;PASS&amp;quot; on success.&lt;/p&gt;
+
+    &lt;iframe sandbox=&quot;allow-scripts&quot; src=&quot;http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null-iframe.html&quot; style=&quot;width: 500px;&quot;&gt;
+    &lt;/iframe&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestaccesscontrolsandboxediframedeniedexpectedtxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-expected.txt (195272 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-expected.txt        2016-01-19 09:33:57 UTC (rev 195272)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-expected.txt        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-CONSOLE MESSAGE: line 17: XMLHttpRequest cannot load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-denied.cgi. Cannot make any requests from null.
</del><ins>+CONSOLE MESSAGE: line 17: XMLHttpRequest cannot load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-denied.cgi. Origin null is not allowed by Access-Control-Allow-Origin.
</ins><span class="cx"> This test verifies that sandboxed iframe does not have XmlHttpRequest access to its server. It will print &quot;PASS&quot; on success.
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestaccesscontrolsandboxediframedeniedwithoutwildcardexpectedtxt"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt (195272 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt        2016-01-19 09:33:57 UTC (rev 195272)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/access-control-sandboxed-iframe-denied-without-wildcard-expected.txt        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-CONSOLE MESSAGE: line 16: XMLHttpRequest cannot load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard.cgi. Cannot make any requests from null.
</del><ins>+CONSOLE MESSAGE: line 16: XMLHttpRequest cannot load http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-denied-without-wildcard.cgi. Origin null is not allowed by Access-Control-Allow-Origin.
</ins><span class="cx"> This test verifies that sandboxed iframe does not have XmlHttpRequest access to its server with &quot;Access-Control-Allow-Origin&quot; set to its own origin (127.0.0.1).
</span><span class="cx"> 
</span><span class="cx"> This test will print &quot;PASS&quot; on success.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestredirectcorsoriginnullexpectedtxt"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null-expected.txt (0 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null-expected.txt                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null-expected.txt        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+Test opera W3C test suite(http://w3c-test.org/webappsec/tests/cors/submitted/opera/staging/redirect-origin.htm) test case 13 for redirection.
+Request URL origin is not same origin with the original URL origin. Final response contains &quot;Access-Control-Allow-Origin: null&quot;. Should print PASS.
+
+PASS
+
</ins><span class="cx">Property changes on: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestredirectcorsoriginnullhtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null.html (0 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null.html        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;p&gt;Test opera W3C test suite(http://w3c-test.org/webappsec/tests/cors/submitted/opera/staging/redirect-origin.htm) test case 13 for redirection.&lt;br&gt;
+Request URL origin is not same origin with the original URL origin. Final response contains &quot;Access-Control-Allow-Origin: null&quot;. Should print PASS.&lt;/p&gt;
+&lt;div id=&quot;log&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+function log(message) {
+    document.getElementById(&quot;log&quot;).innerHTML += message + &quot;&lt;br&gt;&quot;;
+}
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+var xhr = new XMLHttpRequest();
+xhr.open(&quot;GET&quot;, &quot;http://localhost:8080/xmlhttprequest/resources/redirect-cors-origin-null.php&quot;);
+xhr.onerror = function () {
+    log(&quot;FAIL&quot;);
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+};
+xhr.onreadystatechange = function () {
+    if (xhr.readyState == 4) {
+        log(xhr.responseText);
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+};
+xhr.send();
+
+&lt;/script&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/redirect-cors-origin-null.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestresourcesaccesscontrolsandboxediframealloworiginnulliframehtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null-iframe.html (0 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null-iframe.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null-iframe.html        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+&lt;pre id='console'&gt;&lt;/pre&gt;
+&lt;script type=&quot;text/javascript&quot;&gt;
+
+document.getElementById('console').innerHTML = (function() {
+    var xhr = new XMLHttpRequest;
+
+    try {
+        xhr.open(&quot;GET&quot;, &quot;http://127.0.0.1:8000/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null.cgi&quot;, false);
+    } catch(e) {
+        return &quot;FAIL: Exception thrown. Sandboxed iframe XHR access is not allowed in 'open'. [&quot; + e.message + &quot;].&quot;;
+    }
+
+    try {
+        xhr.send();
+    } catch(e) {
+        return &quot;FAIL: Exception thrown. Sandboxed iframe XHR access is not allowed in 'send'. [&quot; + e.message + &quot;].&quot;;
+    }
+
+    return xhr.responseText;
+})();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestresourcesaccesscontrolsandboxediframealloworiginnullcgi"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null.cgi (0 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null.cgi                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null.cgi        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+#!/usr/bin/perl -wT
+use strict;
+
+print &quot;Content-Type: text/plain\n&quot;;
+print &quot;Access-Control-Allow-Credentials: true\n&quot;;
+print &quot;Access-Control-Allow-Origin: null\n\n&quot;;
+
+print &quot;PASS: Sandboxed iframe XHR access allowed.\n&quot;;
</ins><span class="cx">Property changes on: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/access-control-sandboxed-iframe-allow-origin-null.cgi
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestresourcesredirectcorsoriginnullpassphp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null-pass.php (0 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null-pass.php                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null-pass.php        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+&lt;?php
+ $request_origin_value = $_SERVER[&quot;HTTP_ORIGIN&quot;];
+ if (!is_null($request_origin_value)) {
+     header(&quot;Access-Control-Allow-Origin: null&quot;);
+     echo &quot;PASS&quot;;
+ }
+?&gt;
</ins><span class="cx">Property changes on: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null-pass.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="releasesWebKitGTKwebkit210LayoutTestshttptestsxmlhttprequestresourcesredirectcorsoriginnullphp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null.php (0 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null.php                                (rev 0)
+++ releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null.php        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+&lt;?php
+    $request_origin_value = $_SERVER[&quot;HTTP_ORIGIN&quot;];
+
+    if ($_SERVER['REQUEST_METHOD'] == &quot;GET&quot;) {
+     header(&quot;HTTP/1.1 302&quot;);
+     header(&quot;Location: http://localhost:8000/xmlhttprequest/resources/redirect-cors-origin-null-pass.php&quot;);
+    }
+    if (!is_null($request_origin_value)) {
+        header(&quot;Access-Control-Allow-Origin: $request_origin_value&quot;);
+    }
+?&gt;
</ins><span class="cx">Property changes on: releases/WebKitGTK/webkit-2.10/LayoutTests/http/tests/xmlhttprequest/resources/redirect-cors-origin-null.php
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnexecutable"></a>
<div class="addfile"><h4>Added: svn:executable</h4></div>
<a id="releasesWebKitGTKwebkit210SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog (195272 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2016-01-19 09:33:57 UTC (rev 195272)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/ChangeLog        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-01-15  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        CORS: Fix the handling of redirected request containing Origin null.
+        https://bugs.webkit.org/show_bug.cgi?id=128816
+
+        Reviewed by Brent Fulgham.
+
+        Merging Blink patch from George Ancil (https://chromiumcodereview.appspot.com/20735002).
+
+        This patch removes the check for securityOrigin-&gt;isUnique() in passesAccessControlCheck().
+        This check prevented a redirected request with &quot;Origin: null&quot; from being
+        successful even when the response contains &quot;Access-Control-Allow-Origin: null&quot;
+
+        Tests: http/tests/xmlhttprequest/access-control-sandboxed-iframe-allow-origin-null.html
+               http/tests/xmlhttprequest/redirect-cors-origin-null.html
+
+        * loader/CrossOriginAccessControl.cpp:
+        (WebCore::passesAccessControlCheck):
+
</ins><span class="cx"> 2016-01-14  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Disallow use of Geolocation service from unique origins
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit210SourceWebCoreloaderCrossOriginAccessControlcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/CrossOriginAccessControl.cpp (195272 => 195273)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/CrossOriginAccessControl.cpp        2016-01-19 09:33:57 UTC (rev 195272)
+++ releases/WebKitGTK/webkit-2.10/Source/WebCore/loader/CrossOriginAccessControl.cpp        2016-01-19 09:36:10 UTC (rev 195273)
</span><span class="lines">@@ -141,11 +141,6 @@
</span><span class="cx">     if (accessControlOriginString == &quot;*&quot; &amp;&amp; includeCredentials == DoNotAllowStoredCredentials)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    if (securityOrigin-&gt;isUnique()) {
-        errorDescription = &quot;Cannot make any requests from &quot; + securityOrigin-&gt;toString() + &quot;.&quot;;
-        return false;
-    }
-
</del><span class="cx">     // FIXME: Access-Control-Allow-Origin can contain a list of origins.
</span><span class="cx">     if (accessControlOriginString != securityOrigin-&gt;toString()) {
</span><span class="cx">         if (accessControlOriginString == &quot;*&quot;)
</span></span></pre>
</div>
</div>

</body>
</html>