<!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>[202542] 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/202542">202542</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-06-27 23:09:05 -0700 (Mon, 27 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove didFailAccessControlCheck ThreadableLoaderClient callback
https://bugs.webkit.org/show_bug.cgi?id=159149

Patch by Youenn Fablet &lt;youenn@apple.com&gt; on 2016-06-27
Reviewed by Daniel Bates.

LayoutTests/imported/w3c:

* web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt:

Source/WebCore:

Adding an AccessControl ResourceError type.
Replacing didFailAccessControlCheck callback by a direct call to didFail with an error of type AccessControl.

Making CrossOriginPreflightChecker always return an AccessControl error. Previously some errors created below
were passed directly to threadable loader clients.

When doing preflight on unauthorized web sites, WTR/DRT will trigger a cancellation error which was translating into an abort event in XMLHttpRequest.
This patch is changing the error type to AccessControl, which translates into an error event in XMLHttpReauest.

This change of behavior is seen in imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred.htm.
No other observable change of behavior should be expected.

* inspector/InspectorNetworkAgent.cpp: Computing error message in didFail according the error type.
* loader/CrossOriginPreflightChecker.cpp:
(WebCore::CrossOriginPreflightChecker::validatePreflightResponse): Setting preflightFailure error type to AccessControl.
(WebCore::CrossOriginPreflightChecker::notifyFinished): Ditto.
(WebCore::CrossOriginPreflightChecker::doPreflight): Ditto.
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Replacing didFailAccessControlCheck
callback by a direct call to didFail with an error of type AccessControl.
(WebCore::reportContentSecurityPolicyError): Ditto.
(WebCore::reportCrossOriginResourceSharingError): Ditto.
(WebCore::DocumentThreadableLoader::didReceiveResponse): Ditto.
(WebCore::DocumentThreadableLoader::preflightFailure): Calling didFail directly.
* loader/ThreadableLoaderClient.h: Removing didFailAccessControlCheck.
* loader/ThreadableLoaderClientWrapper.h: Ditto.
* loader/WorkerThreadableLoader.cpp: Ditto.
* loader/WorkerThreadableLoader.h: Ditto.
* page/EventSource.cpp:
(WebCore::EventSource::didFail): Removing didFailAccessControlCheck and putting handling code in didFail.
* page/EventSource.h:
* platform/network/ResourceErrorBase.cpp:
(WebCore::ResourceErrorBase::setType): Softening the assertion to cover the case of migration to AccessControl.
* platform/network/ResourceErrorBase.h: Adding AccessControl error type.
(WebCore::ResourceErrorBase::isAccessControl):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestsendauthenticationcorssetrequestheadernocredexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorNetworkAgentcpp">trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderCrossOriginPreflightCheckercpp">trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentThreadableLoadercpp">trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderThreadableLoaderClienth">trunk/Source/WebCore/loader/ThreadableLoaderClient.h</a></li>
<li><a href="#trunkSourceWebCoreloaderThreadableLoaderClientWrapperh">trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h</a></li>
<li><a href="#trunkSourceWebCoreloaderWorkerThreadableLoadercpp">trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderWorkerThreadableLoaderh">trunk/Source/WebCore/loader/WorkerThreadableLoader.h</a></li>
<li><a href="#trunkSourceWebCorepageEventSourcecpp">trunk/Source/WebCore/page/EventSource.cpp</a></li>
<li><a href="#trunkSourceWebCorepageEventSourceh">trunk/Source/WebCore/page/EventSource.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceErrorBasecpp">trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkResourceErrorBaseh">trunk/Source/WebCore/platform/network/ResourceErrorBase.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-06-27  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+        Remove didFailAccessControlCheck ThreadableLoaderClient callback
+        https://bugs.webkit.org/show_bug.cgi?id=159149
+
+        Reviewed by Daniel Bates.
+
+        * web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt:
+
</ins><span class="cx"> 2016-06-27  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         HTMLElement / SVGElement should implement GlobalEventHandlers, not Element
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsXMLHttpRequestsendauthenticationcorssetrequestheadernocredexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred-expected.txt        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -2,5 +2,5 @@
</span><span class="cx"> Blocked access to external URL http://www1.localhost:8800/XMLHttpRequest/resources/auth8/corsenabled-no-authorize.py
</span><span class="cx"> 
</span><span class="cx"> FAIL CORS request with setRequestHeader auth to URL accepting Authorization header assert_true: responseText should contain the right user and password expected true got false
</span><del>-FAIL CORS request with setRequestHeader auth to URL NOT accepting Authorization header assert_true: The error event should fire expected true got false
</del><ins>+PASS CORS request with setRequestHeader auth to URL NOT accepting Authorization header 
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/ChangeLog        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2016-06-27  Youenn Fablet  &lt;youenn@apple.com&gt;
+
+        Remove didFailAccessControlCheck ThreadableLoaderClient callback
+        https://bugs.webkit.org/show_bug.cgi?id=159149
+
+        Reviewed by Daniel Bates.
+
+        Adding an AccessControl ResourceError type.
+        Replacing didFailAccessControlCheck callback by a direct call to didFail with an error of type AccessControl.
+
+        Making CrossOriginPreflightChecker always return an AccessControl error. Previously some errors created below
+        were passed directly to threadable loader clients.
+
+        When doing preflight on unauthorized web sites, WTR/DRT will trigger a cancellation error which was translating into an abort event in XMLHttpRequest.
+        This patch is changing the error type to AccessControl, which translates into an error event in XMLHttpReauest.
+
+        This change of behavior is seen in imported/w3c/web-platform-tests/XMLHttpRequest/send-authentication-cors-setrequestheader-no-cred.htm.
+        No other observable change of behavior should be expected.
+
+        * inspector/InspectorNetworkAgent.cpp: Computing error message in didFail according the error type.
+        * loader/CrossOriginPreflightChecker.cpp:
+        (WebCore::CrossOriginPreflightChecker::validatePreflightResponse): Setting preflightFailure error type to AccessControl.
+        (WebCore::CrossOriginPreflightChecker::notifyFinished): Ditto.
+        (WebCore::CrossOriginPreflightChecker::doPreflight): Ditto.
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Replacing didFailAccessControlCheck
+        callback by a direct call to didFail with an error of type AccessControl.
+        (WebCore::reportContentSecurityPolicyError): Ditto.
+        (WebCore::reportCrossOriginResourceSharingError): Ditto.
+        (WebCore::DocumentThreadableLoader::didReceiveResponse): Ditto.
+        (WebCore::DocumentThreadableLoader::preflightFailure): Calling didFail directly.
+        * loader/ThreadableLoaderClient.h: Removing didFailAccessControlCheck.
+        * loader/ThreadableLoaderClientWrapper.h: Ditto.
+        * loader/WorkerThreadableLoader.cpp: Ditto.
+        * loader/WorkerThreadableLoader.h: Ditto.
+        * page/EventSource.cpp:
+        (WebCore::EventSource::didFail): Removing didFailAccessControlCheck and putting handling code in didFail.
+        * page/EventSource.h:
+        * platform/network/ResourceErrorBase.cpp:
+        (WebCore::ResourceErrorBase::setType): Softening the assertion to cover the case of migration to AccessControl.
+        * platform/network/ResourceErrorBase.h: Adding AccessControl error type.
+        (WebCore::ResourceErrorBase::isAccessControl):
+
</ins><span class="cx"> 2016-06-27  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         HTMLElement / SVGElement should implement GlobalEventHandlers, not Element
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorNetworkAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/inspector/InspectorNetworkAgent.cpp        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -122,18 +122,12 @@
</span><span class="cx">         dispose();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void didFail(const ResourceError&amp;) override
</del><ins>+    void didFail(const ResourceError&amp; error) override
</ins><span class="cx">     {
</span><del>-        m_callback-&gt;sendFailure(ASCIILiteral(&quot;Loading resource for inspector failed&quot;));
</del><ins>+        m_callback-&gt;sendFailure(error.isAccessControl() ? ASCIILiteral(&quot;Loading resource for inspector failed access control check&quot;) : ASCIILiteral(&quot;Loading resource for inspector failed&quot;));
</ins><span class="cx">         dispose();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void didFailAccessControlCheck(const ResourceError&amp;) final
-    {
-        m_callback-&gt;sendFailure(ASCIILiteral(&quot;Loading resource for inspector failed access control check&quot;));
-        dispose();
-    }
-
</del><span class="cx">     void didFailLoaderCreation()
</span><span class="cx">     {
</span><span class="cx">         m_callback-&gt;sendFailure(ASCIILiteral(&quot;Could not create a loader&quot;));
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderCrossOriginPreflightCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/loader/CrossOriginPreflightChecker.cpp        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -64,13 +64,13 @@
</span><span class="cx">     InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, frame-&gt;loader().documentLoader(), response, 0);
</span><span class="cx"> 
</span><span class="cx">     if (!response.isSuccessful()) {
</span><del>-        loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), ASCIILiteral(&quot;Preflight response is not successful&quot;)));
</del><ins>+        loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), ASCIILiteral(&quot;Preflight response is not successful&quot;), ResourceError::Type::AccessControl));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     String description;
</span><span class="cx">     if (!passesAccessControlCheck(response, loader.options().allowCredentials(), loader.securityOrigin(), description)) {
</span><del>-        loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), description));
</del><ins>+        loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), description, ResourceError::Type::AccessControl));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">     if (!result-&gt;parse(response, description)
</span><span class="cx">         || !result-&gt;allowsCrossOriginMethod(request.httpMethod(), description)
</span><span class="cx">         || !result-&gt;allowsCrossOriginHeaders(request.httpHeaderFields(), description)) {
</span><del>-        loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), description));
</del><ins>+        loader.preflightFailure(identifier, ResourceError(errorDomainWebKitInternal, 0, request.url(), description, ResourceError::Type::AccessControl));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -90,7 +90,9 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(resource, resource == m_resource);
</span><span class="cx">     if (m_resource-&gt;loadFailedOrCanceled()) {
</span><del>-        m_loader.preflightFailure(m_resource-&gt;identifier(), m_resource-&gt;resourceError());
</del><ins>+        ResourceError preflightError = m_resource-&gt;resourceError();
+        preflightError.setType(ResourceError::Type::AccessControl);
+        m_loader.preflightFailure(m_resource-&gt;identifier(), preflightError);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     validatePreflightResponse(m_loader, WTFMove(m_request), m_resource-&gt;identifier(), m_resource-&gt;response());
</span><span class="lines">@@ -131,6 +133,7 @@
</span><span class="cx">     unsigned identifier = loader.document().frame()-&gt;loader().loadResourceSynchronously(preflightRequest, loader.options().allowCredentials(), loader.options().clientCredentialPolicy(), error, response, data);
</span><span class="cx"> 
</span><span class="cx">     if (!error.isNull() &amp;&amp; response.httpStatusCode() &lt;= 0) {
</span><ins>+        error.setType(ResourceError::Type::AccessControl);
</ins><span class="cx">         loader.preflightFailure(identifier, error);
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -133,7 +133,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Cross-origin requests are only allowed for HTTP and registered schemes. We would catch this when checking response headers later, but there is no reason to send a request that's guaranteed to be denied.
</span><span class="cx">     if (!SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(request.url().protocol())) {
</span><del>-        m_client-&gt;didFailAccessControlCheck(ResourceError(errorDomainWebKitInternal, 0, request.url(), &quot;Cross origin requests are only supported for HTTP.&quot;));
</del><ins>+        m_client-&gt;didFail(ResourceError(errorDomainWebKitInternal, 0, request.url(), &quot;Cross origin requests are only supported for HTTP.&quot;, ResourceError::Type::AccessControl));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -194,12 +194,12 @@
</span><span class="cx"> 
</span><span class="cx"> static inline void reportContentSecurityPolicyError(ThreadableLoaderClient&amp; client, const URL&amp; url)
</span><span class="cx"> {
</span><del>-    client.didFailAccessControlCheck(ResourceError(errorDomainWebKitInternal, 0, url, &quot;Cross-origin redirection denied by Content Security Policy.&quot;));
</del><ins>+    client.didFail(ResourceError(errorDomainWebKitInternal, 0, url, &quot;Cross-origin redirection denied by Content Security Policy.&quot;, ResourceError::Type::AccessControl));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline void reportCrossOriginResourceSharingError(ThreadableLoaderClient&amp; client, const URL&amp; url)
</span><span class="cx"> {
</span><del>-    client.didFailAccessControlCheck(ResourceError(errorDomainWebKitInternal, 0, url, &quot;Cross-origin redirection denied by Cross-Origin Resource Sharing policy.&quot;));
</del><ins>+    client.didFail(ResourceError(errorDomainWebKitInternal, 0, url, &quot;Cross-origin redirection denied by Cross-Origin Resource Sharing policy.&quot;, ResourceError::Type::AccessControl));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DocumentThreadableLoader::redirectReceived(CachedResource* resource, ResourceRequest&amp; request, const ResourceResponse&amp; redirectResponse)
</span><span class="lines">@@ -279,7 +279,7 @@
</span><span class="cx">     String accessControlErrorDescription;
</span><span class="cx">     if (!m_sameOriginRequest &amp;&amp; m_options.crossOriginRequestPolicy == UseAccessControl) {
</span><span class="cx">         if (!passesAccessControlCheck(response, m_options.allowCredentials(), securityOrigin(), accessControlErrorDescription)) {
</span><del>-            m_client-&gt;didFailAccessControlCheck(ResourceError(errorDomainWebKitInternal, 0, response.url(), accessControlErrorDescription));
</del><ins>+            m_client-&gt;didFail(ResourceError(errorDomainWebKitInternal, 0, response.url(), accessControlErrorDescription, ResourceError::Type::AccessControl));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -336,12 +336,13 @@
</span><span class="cx"> 
</span><span class="cx"> void DocumentThreadableLoader::preflightFailure(unsigned long identifier, const ResourceError&amp; error)
</span><span class="cx"> {
</span><ins>+    ASSERT(error.isAccessControl());
</ins><span class="cx">     m_preflightChecker = Nullopt;
</span><span class="cx"> 
</span><span class="cx">     InspectorInstrumentation::didFailLoading(m_document.frame(), m_document.frame()-&gt;loader().documentLoader(), identifier, error);
</span><span class="cx"> 
</span><span class="cx">     ASSERT(m_client);
</span><del>-    m_client-&gt;didFailAccessControlCheck(error);
</del><ins>+    m_client-&gt;didFail(error);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DocumentThreadableLoader::loadRequest(const ResourceRequest&amp; request, SecurityCheckPolicy securityCheck)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderThreadableLoaderClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ThreadableLoaderClient.h (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ThreadableLoaderClient.h        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/loader/ThreadableLoaderClient.h        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -46,7 +46,6 @@
</span><span class="cx">         virtual void didReceiveData(const char*, int /*dataLength*/) { }
</span><span class="cx">         virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) { }
</span><span class="cx">         virtual void didFail(const ResourceError&amp;) { }
</span><del>-        virtual void didFailAccessControlCheck(const ResourceError&amp; error) { didFail(error); }
</del><span class="cx"> 
</span><span class="cx">     protected:
</span><span class="cx">         ThreadableLoaderClient() { }
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderThreadableLoaderClientWrapperh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -88,13 +88,6 @@
</span><span class="cx">             m_client-&gt;didFail(error);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void didFailAccessControlCheck(const ResourceError&amp; error)
-    {
-        m_done = true;
-        if (m_client)
-            m_client-&gt;didFailAccessControlCheck(error);
-    }
-
</del><span class="cx">     void didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse&amp; response)
</span><span class="cx">     {
</span><span class="cx">         if (m_client)
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderWorkerThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -197,13 +197,4 @@
</span><span class="cx">     }, m_taskMode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WorkerThreadableLoader::MainThreadBridge::didFailAccessControlCheck(const ResourceError&amp; error)
-{
-    m_loadingFinished = true;
-    m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper = Ref&lt;ThreadableLoaderClientWrapper&gt;(*m_workerClientWrapper), error = error.isolatedCopy()] (ScriptExecutionContext&amp; context) mutable {
-        ASSERT_UNUSED(context, context.isWorkerGlobalScope());
-        workerClientWrapper-&gt;didFailAccessControlCheck(error);
-    }, m_taskMode);
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderWorkerThreadableLoaderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.h (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/WorkerThreadableLoader.h        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.h        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -104,7 +104,6 @@
</span><span class="cx">             void didReceiveData(const char*, int dataLength) override;
</span><span class="cx">             void didFinishLoading(unsigned long identifier, double finishTime) override;
</span><span class="cx">             void didFail(const ResourceError&amp;) override;
</span><del>-            void didFailAccessControlCheck(const ResourceError&amp;) override;
</del><span class="cx"> 
</span><span class="cx">             // Only to be used on the main thread.
</span><span class="cx">             RefPtr&lt;ThreadableLoader&gt; m_mainThreadLoader;
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventSource.cpp (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventSource.cpp        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/page/EventSource.cpp        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -243,6 +243,15 @@
</span><span class="cx"> void EventSource::didFail(const ResourceError&amp; error)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_state != CLOSED);
</span><ins>+
+    if (error.isAccessControl()) {
+        String message = makeString(&quot;EventSource cannot load &quot;, error.failingURL().string(), &quot;. &quot;, error.localizedDescription());
+        scriptExecutionContext()-&gt;addConsoleMessage(MessageSource::JS, MessageLevel::Error, message);
+
+        abortConnectionAttempt();
+        return;
+    }
+
</ins><span class="cx">     ASSERT(m_requestInFlight);
</span><span class="cx"> 
</span><span class="cx">     if (error.isCancellation())
</span><span class="lines">@@ -253,14 +262,6 @@
</span><span class="cx">     networkRequestEnded();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void EventSource::didFailAccessControlCheck(const ResourceError&amp; error)
-{
-    String message = makeString(&quot;EventSource cannot load &quot;, error.failingURL().string(), &quot;. &quot;, error.localizedDescription());
-    scriptExecutionContext()-&gt;addConsoleMessage(MessageSource::JS, MessageLevel::Error, message);
-
-    abortConnectionAttempt();
-}
-
</del><span class="cx"> void EventSource::abortConnectionAttempt()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_state == CONNECTING);
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventSource.h (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventSource.h        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/page/EventSource.h        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -81,7 +81,6 @@
</span><span class="cx">     void didReceiveData(const char*, int) final;
</span><span class="cx">     void didFinishLoading(unsigned long, double) final;
</span><span class="cx">     void didFail(const ResourceError&amp;) final;
</span><del>-    void didFailAccessControlCheck(const ResourceError&amp;) final;
</del><span class="cx"> 
</span><span class="cx">     void stop() final;
</span><span class="cx">     const char* activeDOMObjectName() const final;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceErrorBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -59,7 +59,8 @@
</span><span class="cx"> 
</span><span class="cx"> void ResourceErrorBase::setType(Type type)
</span><span class="cx"> {
</span><del>-    ASSERT(m_type == Type::General || m_type == Type::Null);
</del><ins>+    // setType should only be used to specialize the error type.
+    ASSERT(m_type == Type::General || m_type == Type::Null || (m_type == Type::Cancellation &amp;&amp; type == Type::AccessControl));
</ins><span class="cx">     m_type = type;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceErrorBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceErrorBase.h (202541 => 202542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceErrorBase.h        2016-06-28 06:07:58 UTC (rev 202541)
+++ trunk/Source/WebCore/platform/network/ResourceErrorBase.h        2016-06-28 06:09:05 UTC (rev 202542)
</span><span class="lines">@@ -47,11 +47,13 @@
</span><span class="cx">     enum class Type {
</span><span class="cx">         Null,
</span><span class="cx">         General,
</span><ins>+        AccessControl,
</ins><span class="cx">         Cancellation,
</span><span class="cx">         Timeout
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     bool isNull() const { return m_type == Type::Null; }
</span><ins>+    bool isAccessControl() const { return m_type == Type::AccessControl; }
</ins><span class="cx">     bool isCancellation() const { return m_type == Type::Cancellation; }
</span><span class="cx">     bool isTimeout() const { return m_type == Type::Timeout; }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>