<!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>[201856] trunk/Source</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/201856">201856</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2016-06-08 23:55:26 -0700 (Wed, 08 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Introduce ResourceErrorBase::type
https://bugs.webkit.org/show_bug.cgi?id=158299

Reviewed by Alex Christensen.

Source/WebCore:

Introducing an enum type for ResourceErrorBase.
In most cases, the type is set at construction time.
By default, constructor with no parameters will set type to Null.
Constructor with parameters will set type to General.

Removed boolean state error fields.

Introduced a type setter. It should only be used to  make the type
more precise (when type is Null or General).

Updating related calling code.

No change of behavior.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::stopLoadingForPolicyChange):
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::cancel):
* loader/EmptyClients.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::cancelledError):
(WebCore::FrameLoader::blockedError):
* loader/WorkerThreadableLoader.cpp:
(WebCore::WorkerThreadableLoader::MainThreadBridge::cancel):
* platform/network/ResourceErrorBase.cpp:
(WebCore::ResourceErrorBase::isolatedCopy):
(WebCore::ResourceErrorBase::setType):
(WebCore::ResourceErrorBase::compare):
* platform/network/ResourceErrorBase.h:
(WebCore::ResourceErrorBase::isNull):
(WebCore::ResourceErrorBase::isCancellation):
(WebCore::ResourceErrorBase::isTimeout):
(WebCore::ResourceErrorBase::type):
(WebCore::ResourceErrorBase::ResourceErrorBase):
(WebCore::ResourceErrorBase::domain):
* platform/network/cf/ResourceError.h:
(WebCore::ResourceError::ResourceError):
* platform/network/cf/ResourceErrorCF.cpp:
(WebCore::ResourceError::ResourceError):
(WebCore::ResourceError::cfError):
* platform/network/curl/ResourceError.h:
(WebCore::ResourceError::ResourceError):
* platform/network/mac/ResourceErrorMac.mm:
(WebCore::m_platformError):
(WebCore::ResourceError::nsError):
(WebCore::ResourceError::ResourceError):
(WebCore::ResourceError::platformLazyInit):
* platform/network/soup/ResourceError.h:
(WebCore::ResourceError::ResourceError):
* platform/network/soup/ResourceErrorSoup.cpp:
(WebCore::ResourceError::timeoutError):

Source/WebKit2:

* Shared/soup/WebCoreArgumentCodersSoup.cpp:
(IPC::ArgumentCoder&lt;ResourceError&gt;::encodePlatformData):
(IPC::ArgumentCoder&lt;ResourceError&gt;::decodePlatformData):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoadercpp">trunk/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentThreadableLoadercpp">trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientsh">trunk/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderWorkerThreadableLoadercpp">trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp</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>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceErrorh">trunk/Source/WebCore/platform/network/cf/ResourceError.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcfResourceErrorCFcpp">trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlResourceErrorh">trunk/Source/WebCore/platform/network/curl/ResourceError.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacResourceErrorMacmm">trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceErrorh">trunk/Source/WebCore/platform/network/soup/ResourceError.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupResourceErrorSoupcpp">trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedsoupWebCoreArgumentCodersSoupcpp">trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/ChangeLog        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -1,3 +1,62 @@
</span><ins>+2016-06-08  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        Introduce ResourceErrorBase::type
+        https://bugs.webkit.org/show_bug.cgi?id=158299
+
+        Reviewed by Alex Christensen.
+
+        Introducing an enum type for ResourceErrorBase.
+        In most cases, the type is set at construction time.
+        By default, constructor with no parameters will set type to Null.
+        Constructor with parameters will set type to General.
+
+        Removed boolean state error fields.
+
+        Introduced a type setter. It should only be used to  make the type
+        more precise (when type is Null or General).
+
+        Updating related calling code.
+
+        No change of behavior.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::stopLoadingForPolicyChange):
+        * loader/DocumentThreadableLoader.cpp:
+        (WebCore::DocumentThreadableLoader::cancel):
+        * loader/EmptyClients.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::cancelledError):
+        (WebCore::FrameLoader::blockedError):
+        * loader/WorkerThreadableLoader.cpp:
+        (WebCore::WorkerThreadableLoader::MainThreadBridge::cancel):
+        * platform/network/ResourceErrorBase.cpp:
+        (WebCore::ResourceErrorBase::isolatedCopy):
+        (WebCore::ResourceErrorBase::setType):
+        (WebCore::ResourceErrorBase::compare):
+        * platform/network/ResourceErrorBase.h:
+        (WebCore::ResourceErrorBase::isNull):
+        (WebCore::ResourceErrorBase::isCancellation):
+        (WebCore::ResourceErrorBase::isTimeout):
+        (WebCore::ResourceErrorBase::type):
+        (WebCore::ResourceErrorBase::ResourceErrorBase):
+        (WebCore::ResourceErrorBase::domain):
+        * platform/network/cf/ResourceError.h:
+        (WebCore::ResourceError::ResourceError):
+        * platform/network/cf/ResourceErrorCF.cpp:
+        (WebCore::ResourceError::ResourceError):
+        (WebCore::ResourceError::cfError):
+        * platform/network/curl/ResourceError.h:
+        (WebCore::ResourceError::ResourceError):
+        * platform/network/mac/ResourceErrorMac.mm:
+        (WebCore::m_platformError):
+        (WebCore::ResourceError::nsError):
+        (WebCore::ResourceError::ResourceError):
+        (WebCore::ResourceError::platformLazyInit):
+        * platform/network/soup/ResourceError.h:
+        (WebCore::ResourceError::ResourceError):
+        * platform/network/soup/ResourceErrorSoup.cpp:
+        (WebCore::ResourceError::timeoutError):
+
</ins><span class="cx"> 2016-06-08  Frederic Wang  &lt;fwang@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move selection and drawing of stretchy operators into a separate MathOperator class
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.cpp        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -842,7 +842,7 @@
</span><span class="cx"> void DocumentLoader::stopLoadingForPolicyChange()
</span><span class="cx"> {
</span><span class="cx">     ResourceError error = interruptedForPolicyChangeError();
</span><del>-    error.setIsCancellation(true);
</del><ins>+    error.setType(ResourceError::Type::Cancellation);
</ins><span class="cx">     cancelMainResourceLoad(error);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -160,8 +160,7 @@
</span><span class="cx">     // Cancel can re-enter and m_resource might be null here as a result.
</span><span class="cx">     if (m_client &amp;&amp; m_resource) {
</span><span class="cx">         // FIXME: This error is sent to the client in didFail(), so it should not be an internal one. Use FrameLoaderClient::cancelledError() instead.
</span><del>-        ResourceError error(errorDomainWebKitInternal, 0, m_resource-&gt;url(), &quot;Load cancelled&quot;);
-        error.setIsCancellation(true);
</del><ins>+        ResourceError error(errorDomainWebKitInternal, 0, m_resource-&gt;url(), &quot;Load cancelled&quot;, ResourceError::Type::Cancellation);
</ins><span class="cx">         didFail(m_resource-&gt;identifier(), error);
</span><span class="cx">     }
</span><span class="cx">     clearResource();
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.h (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.h        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/loader/EmptyClients.h        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -330,15 +330,15 @@
</span><span class="cx">     void committedLoad(DocumentLoader*, const char*, int) override { }
</span><span class="cx">     void finishedLoading(DocumentLoader*) override { }
</span><span class="cx"> 
</span><del>-    ResourceError cancelledError(const ResourceRequest&amp;) override { ResourceError error(&quot;&quot;, 0, URL(), &quot;&quot;); error.setIsCancellation(true); return error; }
-    ResourceError blockedError(const ResourceRequest&amp;) override { return ResourceError(&quot;&quot;, 0, URL(), &quot;&quot;); }
-    ResourceError blockedByContentBlockerError(const ResourceRequest&amp;) override { return ResourceError(&quot;&quot;, 0, URL(), &quot;&quot;); }
-    ResourceError cannotShowURLError(const ResourceRequest&amp;) override { return ResourceError(&quot;&quot;, 0, URL(), &quot;&quot;); }
-    ResourceError interruptedForPolicyChangeError(const ResourceRequest&amp;) override { return ResourceError(&quot;&quot;, 0, URL(), &quot;&quot;); }
</del><ins>+    ResourceError cancelledError(const ResourceRequest&amp;) override { return ResourceError(ResourceError::Type::Cancellation); }
+    ResourceError blockedError(const ResourceRequest&amp;) override { return { }; }
+    ResourceError blockedByContentBlockerError(const ResourceRequest&amp;) override { return { }; }
+    ResourceError cannotShowURLError(const ResourceRequest&amp;) override { return { }; }
+    ResourceError interruptedForPolicyChangeError(const ResourceRequest&amp;) override { return { }; }
</ins><span class="cx"> 
</span><del>-    ResourceError cannotShowMIMETypeError(const ResourceResponse&amp;) override { return ResourceError(&quot;&quot;, 0, URL(), &quot;&quot;); }
-    ResourceError fileDoesNotExistError(const ResourceResponse&amp;) override { return ResourceError(&quot;&quot;, 0, URL(), &quot;&quot;); }
-    ResourceError pluginWillHandleLoadError(const ResourceResponse&amp;) override { return ResourceError(&quot;&quot;, 0, URL(), &quot;&quot;); }
</del><ins>+    ResourceError cannotShowMIMETypeError(const ResourceResponse&amp;) override { return { }; }
+    ResourceError fileDoesNotExistError(const ResourceResponse&amp;) override { return { }; }
+    ResourceError pluginWillHandleLoadError(const ResourceResponse&amp;) override { return { }; }
</ins><span class="cx"> 
</span><span class="cx">     bool shouldFallBack(const ResourceError&amp;) override { return false; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -3423,7 +3423,7 @@
</span><span class="cx"> ResourceError FrameLoader::cancelledError(const ResourceRequest&amp; request) const
</span><span class="cx"> {
</span><span class="cx">     ResourceError error = m_client.cancelledError(request);
</span><del>-    error.setIsCancellation(true);
</del><ins>+    error.setType(ResourceError::Type::Cancellation);
</ins><span class="cx">     return error;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -3435,7 +3435,7 @@
</span><span class="cx"> ResourceError FrameLoader::blockedError(const ResourceRequest&amp; request) const
</span><span class="cx"> {
</span><span class="cx">     ResourceError error = m_client.blockedError(request);
</span><del>-    error.setIsCancellation(true);
</del><ins>+    error.setType(ResourceError::Type::Cancellation);
</ins><span class="cx">     return error;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderWorkerThreadableLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -138,8 +138,7 @@
</span><span class="cx">     if (!clientWrapper-&gt;done()) {
</span><span class="cx">         // If the client hasn't reached a termination state, then transition it by sending a cancellation error.
</span><span class="cx">         // Note: no more client callbacks will be done after this method -- the clearClientWrapper() call ensures that.
</span><del>-        ResourceError error(String(), 0, URL(), String());
-        error.setIsCancellation(true);
</del><ins>+        ResourceError error(ResourceError::Type::Cancellation);
</ins><span class="cx">         clientWrapper-&gt;didFail(error);
</span><span class="cx">     }
</span><span class="cx">     clearClientWrapper();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkResourceErrorBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -45,9 +45,7 @@
</span><span class="cx">     errorCopy.m_errorCode = m_errorCode;
</span><span class="cx">     errorCopy.m_failingURL = m_failingURL.isolatedCopy();
</span><span class="cx">     errorCopy.m_localizedDescription = m_localizedDescription.isolatedCopy();
</span><del>-    errorCopy.m_isNull = m_isNull;
-    errorCopy.m_isCancellation = m_isCancellation;
-    errorCopy.m_isTimeout = m_isTimeout;
</del><ins>+    errorCopy.m_type = m_type;
</ins><span class="cx"> 
</span><span class="cx">     errorCopy.doPlatformIsolatedCopy(asResourceError());
</span><span class="cx"> 
</span><span class="lines">@@ -59,12 +57,18 @@
</span><span class="cx">     const_cast&lt;ResourceError*&gt;(static_cast&lt;const ResourceError*&gt;(this))-&gt;platformLazyInit();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ResourceErrorBase::setType(Type type)
+{
+    ASSERT(m_type == Type::General || m_type == Type::Null);
+    m_type = type;
+}
+
</ins><span class="cx"> bool ResourceErrorBase::compare(const ResourceError&amp; a, const ResourceError&amp; b)
</span><span class="cx"> {
</span><span class="cx">     if (a.isNull() &amp;&amp; b.isNull())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    if (a.isNull() || b.isNull())
</del><ins>+    if (a.type() != b.type())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (a.domain() != b.domain())
</span><span class="lines">@@ -79,12 +83,6 @@
</span><span class="cx">     if (a.localizedDescription() != b.localizedDescription())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (a.isCancellation() != b.isCancellation())
-        return false;
-
-    if (a.isTimeout() != b.isTimeout())
-        return false;
-
</del><span class="cx">     return ResourceError::platformCompare(a, b);
</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 (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/ResourceErrorBase.h        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/platform/network/ResourceErrorBase.h        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2006 Apple Inc.  All rights reserved.
</span><ins>+ * Copyright (C) 2016 Canon Inc.  All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -20,7 +21,7 @@
</span><span class="cx">  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
</span><span class="cx">  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
</span><span class="cx">  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><del>- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</del><ins>+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="lines">@@ -38,38 +39,36 @@
</span><span class="cx"> public:
</span><span class="cx">     ResourceError isolatedCopy() const;
</span><span class="cx"> 
</span><del>-    bool isNull() const { return m_isNull; }
-
</del><span class="cx">     const String&amp; domain() const { lazyInit(); return m_domain; }
</span><span class="cx">     int errorCode() const { lazyInit(); return m_errorCode; }
</span><span class="cx">     const URL&amp; failingURL() const { lazyInit(); return m_failingURL; }
</span><span class="cx">     const String&amp; localizedDescription() const { lazyInit(); return m_localizedDescription; }
</span><span class="cx"> 
</span><del>-    void setIsCancellation(bool isCancellation) { m_isCancellation = isCancellation; }
-    bool isCancellation() const { return m_isCancellation; }
</del><ins>+    enum class Type {
+        Null,
+        General,
+        Cancellation,
+        Timeout
+    };
</ins><span class="cx"> 
</span><del>-    void setIsTimeout(bool isTimeout) { m_isTimeout = isTimeout; }
-    bool isTimeout() const { return m_isTimeout; }
</del><ins>+    bool isNull() const { return m_type == Type::Null; }
+    bool isCancellation() const { return m_type == Type::Cancellation; }
+    bool isTimeout() const { return m_type == Type::Timeout; }
</ins><span class="cx"> 
</span><span class="cx">     static bool compare(const ResourceError&amp;, const ResourceError&amp;);
</span><span class="cx"> 
</span><ins>+    void setType(Type);
+    Type type() const { return m_type; }
+
</ins><span class="cx"> protected:
</span><del>-    ResourceErrorBase()
-        : m_errorCode(0)
-        , m_isNull(true)
-        , m_isCancellation(false)
-        , m_isTimeout(false)
-    {
-    }
</del><ins>+    ResourceErrorBase(Type type) : m_type(type) { }
</ins><span class="cx"> 
</span><del>-    ResourceErrorBase(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription)
</del><ins>+    ResourceErrorBase(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription, Type type)
</ins><span class="cx">         : m_domain(domain)
</span><span class="cx">         , m_failingURL(failingURL)
</span><span class="cx">         , m_localizedDescription(localizedDescription)
</span><span class="cx">         , m_errorCode(errorCode)
</span><del>-        , m_isNull(false)
-        , m_isCancellation(false)
-        , m_isTimeout(false)
</del><ins>+        , m_type(type)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -84,10 +83,8 @@
</span><span class="cx">     String m_domain;
</span><span class="cx">     URL m_failingURL;
</span><span class="cx">     String m_localizedDescription;
</span><del>-    int m_errorCode;
-    bool m_isNull : 1;
-    bool m_isCancellation : 1;
-    bool m_isTimeout : 1;
</del><ins>+    int m_errorCode { 0 };
+    Type m_type { Type::General };
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     const ResourceError&amp; asResourceError() const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceError.h (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceError.h        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/platform/network/cf/ResourceError.h        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -44,13 +44,14 @@
</span><span class="cx"> 
</span><span class="cx"> class ResourceError : public ResourceErrorBase {
</span><span class="cx"> public:
</span><del>-    ResourceError()
-        : m_dataIsUpToDate(true)
</del><ins>+    ResourceError(Type type = Type::Null)
+        : ResourceErrorBase(type)
+        , m_dataIsUpToDate(true)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ResourceError(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription)
-        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
</del><ins>+    ResourceError(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription, Type type = Type::General)
+        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type)
</ins><span class="cx">         , m_dataIsUpToDate(true)
</span><span class="cx">     {
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcfResourceErrorCFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -40,17 +40,17 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> ResourceError::ResourceError(CFErrorRef cfError)
</span><del>-    : m_dataIsUpToDate(false)
</del><ins>+    : ResourceErrorBase(Type::Null)
+    , m_dataIsUpToDate(false)
</ins><span class="cx">     , m_platformError(cfError)
</span><span class="cx"> {
</span><del>-    m_isNull = !cfError;
-    if (!m_isNull)
-        m_isTimeout = CFErrorGetCode(m_platformError.get()) == kCFURLErrorTimedOut;
</del><ins>+    if (cfError)
+        setType((CFErrorGetCode(m_platformError.get()) == kCFURLErrorTimedOut) ? Type::Timeout : Type::General);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx"> ResourceError::ResourceError(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription, CFDataRef certificate)
</span><del>-    : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
</del><ins>+    : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, Type::General)
</ins><span class="cx">     , m_dataIsUpToDate(true)
</span><span class="cx">     , m_certificate(certificate)
</span><span class="cx"> {
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx"> 
</span><span class="cx"> CFErrorRef ResourceError::cfError() const
</span><span class="cx"> {
</span><del>-    if (m_isNull) {
</del><ins>+    if (isNull()) {
</ins><span class="cx">         ASSERT(!m_platformError);
</span><span class="cx">         return 0;
</span><span class="cx">     }
</span><span class="lines">@@ -172,9 +172,9 @@
</span><span class="cx"> 
</span><span class="cx"> // FIXME: Once &lt;rdar://problem/5050841&gt; is fixed we can remove this constructor.
</span><span class="cx"> ResourceError::ResourceError(CFStreamError error)
</span><del>-    : m_dataIsUpToDate(true)
</del><ins>+    : ResourceErrorBase(Type::General)
+    , m_dataIsUpToDate(true)
</ins><span class="cx"> {
</span><del>-    m_isNull = false;
</del><span class="cx">     m_errorCode = error.error;
</span><span class="cx"> 
</span><span class="cx">     switch(error.domain) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlResourceErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/ResourceError.h (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/ResourceError.h        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/platform/network/curl/ResourceError.h        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -40,12 +40,15 @@
</span><span class="cx"> class ResourceError : public ResourceErrorBase
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>-    ResourceError() : m_sslErrors(0)
</del><ins>+    ResourceError(Type type = Type::Null)
+        : ResourceErrorBase(type)
+        , m_sslErrors(0)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ResourceError(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription)
-        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription), m_sslErrors(0)
</del><ins>+    ResourceError(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription, Type type = Type::Null)
+        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type)
+        , m_sslErrors(0)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacResourceErrorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -193,17 +193,16 @@
</span><span class="cx"> #if USE(CFNETWORK)
</span><span class="cx"> 
</span><span class="cx"> ResourceError::ResourceError(NSError *error)
</span><del>-    : m_dataIsUpToDate(false)
</del><ins>+    , m_dataIsUpToDate(false)
</ins><span class="cx">     , m_platformError(reinterpret_cast&lt;CFErrorRef&gt;(error))
</span><span class="cx"> {
</span><del>-    m_isNull = !error;
-    if (!m_isNull)
-        m_isTimeout = [error code] == NSURLErrorTimedOut;
</del><ins>+    if (error)
+        setType(([error code] == NSURLErrorTimedOut) ? Type::Timeout : Type::General);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> NSError *ResourceError::nsError() const
</span><span class="cx"> {
</span><del>-    if (m_isNull) {
</del><ins>+    if (isNull()) {
</ins><span class="cx">         ASSERT(!m_platformError);
</span><span class="cx">         return nil;
</span><span class="cx">     }
</span><span class="lines">@@ -238,21 +237,17 @@
</span><span class="cx"> #else
</span><span class="cx"> 
</span><span class="cx"> ResourceError::ResourceError(NSError *nsError)
</span><del>-    : m_dataIsUpToDate(false)
</del><ins>+    : ResourceErrorBase(Type::Null)
+    , m_dataIsUpToDate(false)
</ins><span class="cx">     , m_platformError(nsError)
</span><span class="cx"> {
</span><del>-    m_isNull = !nsError;
-    if (!m_isNull)
-        m_isTimeout = [m_platformError.get() code] == NSURLErrorTimedOut;
</del><ins>+    if (nsError)
+        setType(([m_platformError.get() code] == NSURLErrorTimedOut) ? Type::Timeout : Type::General);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ResourceError::ResourceError(CFErrorRef cfError)
</span><del>-    : m_dataIsUpToDate(false)
-    , m_platformError((NSError *)cfError)
</del><ins>+    : ResourceError((NSError *)cfError)
</ins><span class="cx"> {
</span><del>-    m_isNull = !cfError;
-    if (!m_isNull)
-        m_isTimeout = [m_platformError.get() code] == NSURLErrorTimedOut;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceError::platformLazyInit()
</span><span class="lines">@@ -287,7 +282,7 @@
</span><span class="cx"> 
</span><span class="cx"> NSError *ResourceError::nsError() const
</span><span class="cx"> {
</span><del>-    if (m_isNull) {
</del><ins>+    if (isNull()) {
</ins><span class="cx">         ASSERT(!m_platformError);
</span><span class="cx">         return nil;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceError.h (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceError.h        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/platform/network/soup/ResourceError.h        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -41,14 +41,15 @@
</span><span class="cx"> class ResourceError : public ResourceErrorBase
</span><span class="cx"> {
</span><span class="cx"> public:
</span><del>-    ResourceError(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription)
-        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
</del><ins>+    ResourceError(Type type = Type::Null)
+        : ResourceErrorBase(type)
</ins><span class="cx">         , m_tlsErrors(0)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    ResourceError()
-        : m_tlsErrors(0)
</del><ins>+    ResourceError(const String&amp; domain, int errorCode, const URL&amp; failingURL, const String&amp; localizedDescription, Type type = Type::General)
+        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type)
+        , m_tlsErrors(0)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupResourceErrorSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -92,9 +92,7 @@
</span><span class="cx">     // Use the same value as in NSURLError.h
</span><span class="cx">     static const int timeoutError = -1001;
</span><span class="cx">     static const char* const  errorDomain = &quot;WebKitNetworkError&quot;;
</span><del>-    ResourceError error = ResourceError(errorDomain, timeoutError, failingURL, &quot;Request timed out&quot;);
-    error.setIsTimeout(true);
-    return error;
</del><ins>+    return ResourceError(errorDomain, timeoutError, failingURL, &quot;Request timed out&quot;, ResourceError::Type::Timeout);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ResourceError::doPlatformIsolatedCopy(const ResourceError&amp; other)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebKit2/ChangeLog        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-06-08  Youenn Fablet  &lt;youenn.fablet@crf.canon.fr&gt;
+
+        Introduce ResourceErrorBase::type
+        https://bugs.webkit.org/show_bug.cgi?id=158299
+
+        Reviewed by Alex Christensen.
+
+        * Shared/soup/WebCoreArgumentCodersSoup.cpp:
+        (IPC::ArgumentCoder&lt;ResourceError&gt;::encodePlatformData):
+        (IPC::ArgumentCoder&lt;ResourceError&gt;::decodePlatformData):
+
</ins><span class="cx"> 2016-06-08  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         _web_didAddMediaControlsManager should take a controlsManager as a parameter 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedsoupWebCoreArgumentCodersSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp (201855 => 201856)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp        2016-06-09 06:20:55 UTC (rev 201855)
+++ trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp        2016-06-09 06:55:26 UTC (rev 201856)
</span><span class="lines">@@ -186,28 +186,25 @@
</span><span class="cx"> 
</span><span class="cx"> void ArgumentCoder&lt;ResourceError&gt;::encodePlatformData(ArgumentEncoder&amp; encoder, const ResourceError&amp; resourceError)
</span><span class="cx"> {
</span><del>-    bool errorIsNull = resourceError.isNull();
-    encoder &lt;&lt; errorIsNull;
-    if (errorIsNull)
</del><ins>+    encoder.encodeEnum(resourceError.type());
+    if (resourceError.isNull())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     encoder &lt;&lt; resourceError.domain();
</span><span class="cx">     encoder &lt;&lt; resourceError.errorCode();
</span><span class="cx">     encoder &lt;&lt; resourceError.failingURL().string();
</span><span class="cx">     encoder &lt;&lt; resourceError.localizedDescription();
</span><del>-    encoder &lt;&lt; resourceError.isCancellation();
-    encoder &lt;&lt; resourceError.isTimeout();
</del><span class="cx"> 
</span><span class="cx">     encoder &lt;&lt; CertificateInfo(resourceError);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ArgumentCoder&lt;ResourceError&gt;::decodePlatformData(ArgumentDecoder&amp; decoder, ResourceError&amp; resourceError)
</span><span class="cx"> {
</span><del>-    bool errorIsNull;
-    if (!decoder.decode(errorIsNull))
</del><ins>+    ResourceErrorBase::Type errorType;
+    if (!decoder.decodeEnum(errorType))
</ins><span class="cx">         return false;
</span><del>-    if (errorIsNull) {
-        resourceError = ResourceError();
</del><ins>+    if (errorType == ResourceErrorBase::Type::Null) {
+        resourceError = { };
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -227,17 +224,8 @@
</span><span class="cx">     if (!decoder.decode(localizedDescription))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    bool isCancellation;
-    if (!decoder.decode(isCancellation))
-        return false;
-
-    bool isTimeout;
-    if (!decoder.decode(isTimeout))
-        return false;
-
</del><span class="cx">     resourceError = ResourceError(domain, errorCode, URL(URL(), failingURL), localizedDescription);
</span><del>-    resourceError.setIsCancellation(isCancellation);
-    resourceError.setIsTimeout(isTimeout);
</del><ins>+    resourceError.setType(errorType);
</ins><span class="cx"> 
</span><span class="cx">     CertificateInfo certificateInfo;
</span><span class="cx">     if (!decoder.decode(certificateInfo))
</span></span></pre>
</div>
</div>

</body>
</html>