Title: [201856] trunk/Source
Revision
201856
Author
[email protected]
Date
2016-06-08 23:55:26 -0700 (Wed, 08 Jun 2016)

Log Message

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<ResourceError>::encodePlatformData):
(IPC::ArgumentCoder<ResourceError>::decodePlatformData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201855 => 201856)


--- 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)
@@ -1,3 +1,62 @@
+2016-06-08  Youenn Fablet  <[email protected]>
+
+        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):
+
 2016-06-08  Frederic Wang  <[email protected]>
 
         Move selection and drawing of stretchy operators into a separate MathOperator class

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (201855 => 201856)


--- 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)
@@ -842,7 +842,7 @@
 void DocumentLoader::stopLoadingForPolicyChange()
 {
     ResourceError error = interruptedForPolicyChangeError();
-    error.setIsCancellation(true);
+    error.setType(ResourceError::Type::Cancellation);
     cancelMainResourceLoad(error);
 }
 

Modified: trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp (201855 => 201856)


--- 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)
@@ -160,8 +160,7 @@
     // Cancel can re-enter and m_resource might be null here as a result.
     if (m_client && m_resource) {
         // FIXME: This error is sent to the client in didFail(), so it should not be an internal one. Use FrameLoaderClient::cancelledError() instead.
-        ResourceError error(errorDomainWebKitInternal, 0, m_resource->url(), "Load cancelled");
-        error.setIsCancellation(true);
+        ResourceError error(errorDomainWebKitInternal, 0, m_resource->url(), "Load cancelled", ResourceError::Type::Cancellation);
         didFail(m_resource->identifier(), error);
     }
     clearResource();

Modified: trunk/Source/WebCore/loader/EmptyClients.h (201855 => 201856)


--- 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)
@@ -330,15 +330,15 @@
     void committedLoad(DocumentLoader*, const char*, int) override { }
     void finishedLoading(DocumentLoader*) override { }
 
-    ResourceError cancelledError(const ResourceRequest&) override { ResourceError error("", 0, URL(), ""); error.setIsCancellation(true); return error; }
-    ResourceError blockedError(const ResourceRequest&) override { return ResourceError("", 0, URL(), ""); }
-    ResourceError blockedByContentBlockerError(const ResourceRequest&) override { return ResourceError("", 0, URL(), ""); }
-    ResourceError cannotShowURLError(const ResourceRequest&) override { return ResourceError("", 0, URL(), ""); }
-    ResourceError interruptedForPolicyChangeError(const ResourceRequest&) override { return ResourceError("", 0, URL(), ""); }
+    ResourceError cancelledError(const ResourceRequest&) override { return ResourceError(ResourceError::Type::Cancellation); }
+    ResourceError blockedError(const ResourceRequest&) override { return { }; }
+    ResourceError blockedByContentBlockerError(const ResourceRequest&) override { return { }; }
+    ResourceError cannotShowURLError(const ResourceRequest&) override { return { }; }
+    ResourceError interruptedForPolicyChangeError(const ResourceRequest&) override { return { }; }
 
-    ResourceError cannotShowMIMETypeError(const ResourceResponse&) override { return ResourceError("", 0, URL(), ""); }
-    ResourceError fileDoesNotExistError(const ResourceResponse&) override { return ResourceError("", 0, URL(), ""); }
-    ResourceError pluginWillHandleLoadError(const ResourceResponse&) override { return ResourceError("", 0, URL(), ""); }
+    ResourceError cannotShowMIMETypeError(const ResourceResponse&) override { return { }; }
+    ResourceError fileDoesNotExistError(const ResourceResponse&) override { return { }; }
+    ResourceError pluginWillHandleLoadError(const ResourceResponse&) override { return { }; }
 
     bool shouldFallBack(const ResourceError&) override { return false; }
 

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (201855 => 201856)


--- 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)
@@ -3423,7 +3423,7 @@
 ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
 {
     ResourceError error = m_client.cancelledError(request);
-    error.setIsCancellation(true);
+    error.setType(ResourceError::Type::Cancellation);
     return error;
 }
 
@@ -3435,7 +3435,7 @@
 ResourceError FrameLoader::blockedError(const ResourceRequest& request) const
 {
     ResourceError error = m_client.blockedError(request);
-    error.setIsCancellation(true);
+    error.setType(ResourceError::Type::Cancellation);
     return error;
 }
 

Modified: trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp (201855 => 201856)


--- 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)
@@ -138,8 +138,7 @@
     if (!clientWrapper->done()) {
         // If the client hasn't reached a termination state, then transition it by sending a cancellation error.
         // Note: no more client callbacks will be done after this method -- the clearClientWrapper() call ensures that.
-        ResourceError error(String(), 0, URL(), String());
-        error.setIsCancellation(true);
+        ResourceError error(ResourceError::Type::Cancellation);
         clientWrapper->didFail(error);
     }
     clearClientWrapper();

Modified: trunk/Source/WebCore/platform/network/ResourceErrorBase.cpp (201855 => 201856)


--- 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)
@@ -45,9 +45,7 @@
     errorCopy.m_errorCode = m_errorCode;
     errorCopy.m_failingURL = m_failingURL.isolatedCopy();
     errorCopy.m_localizedDescription = m_localizedDescription.isolatedCopy();
-    errorCopy.m_isNull = m_isNull;
-    errorCopy.m_isCancellation = m_isCancellation;
-    errorCopy.m_isTimeout = m_isTimeout;
+    errorCopy.m_type = m_type;
 
     errorCopy.doPlatformIsolatedCopy(asResourceError());
 
@@ -59,12 +57,18 @@
     const_cast<ResourceError*>(static_cast<const ResourceError*>(this))->platformLazyInit();
 }
 
+void ResourceErrorBase::setType(Type type)
+{
+    ASSERT(m_type == Type::General || m_type == Type::Null);
+    m_type = type;
+}
+
 bool ResourceErrorBase::compare(const ResourceError& a, const ResourceError& b)
 {
     if (a.isNull() && b.isNull())
         return true;
 
-    if (a.isNull() || b.isNull())
+    if (a.type() != b.type())
         return false;
 
     if (a.domain() != b.domain())
@@ -79,12 +83,6 @@
     if (a.localizedDescription() != b.localizedDescription())
         return false;
 
-    if (a.isCancellation() != b.isCancellation())
-        return false;
-
-    if (a.isTimeout() != b.isTimeout())
-        return false;
-
     return ResourceError::platformCompare(a, b);
 }
 

Modified: trunk/Source/WebCore/platform/network/ResourceErrorBase.h (201855 => 201856)


--- 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)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Inc.  All rights reserved.
+ * Copyright (C) 2016 Canon Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -20,7 +21,7 @@
  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #pragma once
@@ -38,38 +39,36 @@
 public:
     ResourceError isolatedCopy() const;
 
-    bool isNull() const { return m_isNull; }
-
     const String& domain() const { lazyInit(); return m_domain; }
     int errorCode() const { lazyInit(); return m_errorCode; }
     const URL& failingURL() const { lazyInit(); return m_failingURL; }
     const String& localizedDescription() const { lazyInit(); return m_localizedDescription; }
 
-    void setIsCancellation(bool isCancellation) { m_isCancellation = isCancellation; }
-    bool isCancellation() const { return m_isCancellation; }
+    enum class Type {
+        Null,
+        General,
+        Cancellation,
+        Timeout
+    };
 
-    void setIsTimeout(bool isTimeout) { m_isTimeout = isTimeout; }
-    bool isTimeout() const { return m_isTimeout; }
+    bool isNull() const { return m_type == Type::Null; }
+    bool isCancellation() const { return m_type == Type::Cancellation; }
+    bool isTimeout() const { return m_type == Type::Timeout; }
 
     static bool compare(const ResourceError&, const ResourceError&);
 
+    void setType(Type);
+    Type type() const { return m_type; }
+
 protected:
-    ResourceErrorBase()
-        : m_errorCode(0)
-        , m_isNull(true)
-        , m_isCancellation(false)
-        , m_isTimeout(false)
-    {
-    }
+    ResourceErrorBase(Type type) : m_type(type) { }
 
-    ResourceErrorBase(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription)
+    ResourceErrorBase(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type)
         : m_domain(domain)
         , m_failingURL(failingURL)
         , m_localizedDescription(localizedDescription)
         , m_errorCode(errorCode)
-        , m_isNull(false)
-        , m_isCancellation(false)
-        , m_isTimeout(false)
+        , m_type(type)
     {
     }
 
@@ -84,10 +83,8 @@
     String m_domain;
     URL m_failingURL;
     String m_localizedDescription;
-    int m_errorCode;
-    bool m_isNull : 1;
-    bool m_isCancellation : 1;
-    bool m_isTimeout : 1;
+    int m_errorCode { 0 };
+    Type m_type { Type::General };
 
 private:
     const ResourceError& asResourceError() const;

Modified: trunk/Source/WebCore/platform/network/cf/ResourceError.h (201855 => 201856)


--- 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)
@@ -44,13 +44,14 @@
 
 class ResourceError : public ResourceErrorBase {
 public:
-    ResourceError()
-        : m_dataIsUpToDate(true)
+    ResourceError(Type type = Type::Null)
+        : ResourceErrorBase(type)
+        , m_dataIsUpToDate(true)
     {
     }
 
-    ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription)
-        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
+    ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type = Type::General)
+        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type)
         , m_dataIsUpToDate(true)
     {
     }

Modified: trunk/Source/WebCore/platform/network/cf/ResourceErrorCF.cpp (201855 => 201856)


--- 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)
@@ -40,17 +40,17 @@
 namespace WebCore {
 
 ResourceError::ResourceError(CFErrorRef cfError)
-    : m_dataIsUpToDate(false)
+    : ResourceErrorBase(Type::Null)
+    , m_dataIsUpToDate(false)
     , m_platformError(cfError)
 {
-    m_isNull = !cfError;
-    if (!m_isNull)
-        m_isTimeout = CFErrorGetCode(m_platformError.get()) == kCFURLErrorTimedOut;
+    if (cfError)
+        setType((CFErrorGetCode(m_platformError.get()) == kCFURLErrorTimedOut) ? Type::Timeout : Type::General);
 }
 
 #if PLATFORM(WIN)
 ResourceError::ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, CFDataRef certificate)
-    : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
+    : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, Type::General)
     , m_dataIsUpToDate(true)
     , m_certificate(certificate)
 {
@@ -136,7 +136,7 @@
 
 CFErrorRef ResourceError::cfError() const
 {
-    if (m_isNull) {
+    if (isNull()) {
         ASSERT(!m_platformError);
         return 0;
     }
@@ -172,9 +172,9 @@
 
 // FIXME: Once <rdar://problem/5050841> is fixed we can remove this constructor.
 ResourceError::ResourceError(CFStreamError error)
-    : m_dataIsUpToDate(true)
+    : ResourceErrorBase(Type::General)
+    , m_dataIsUpToDate(true)
 {
-    m_isNull = false;
     m_errorCode = error.error;
 
     switch(error.domain) {

Modified: trunk/Source/WebCore/platform/network/curl/ResourceError.h (201855 => 201856)


--- 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)
@@ -40,12 +40,15 @@
 class ResourceError : public ResourceErrorBase
 {
 public:
-    ResourceError() : m_sslErrors(0)
+    ResourceError(Type type = Type::Null)
+        : ResourceErrorBase(type)
+        , m_sslErrors(0)
     {
     }
 
-    ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription)
-        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription), m_sslErrors(0)
+    ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type = Type::Null)
+        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type)
+        , m_sslErrors(0)
     {
     }
 

Modified: trunk/Source/WebCore/platform/network/mac/ResourceErrorMac.mm (201855 => 201856)


--- 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)
@@ -193,17 +193,16 @@
 #if USE(CFNETWORK)
 
 ResourceError::ResourceError(NSError *error)
-    : m_dataIsUpToDate(false)
+    , m_dataIsUpToDate(false)
     , m_platformError(reinterpret_cast<CFErrorRef>(error))
 {
-    m_isNull = !error;
-    if (!m_isNull)
-        m_isTimeout = [error code] == NSURLErrorTimedOut;
+    if (error)
+        setType(([error code] == NSURLErrorTimedOut) ? Type::Timeout : Type::General);
 }
 
 NSError *ResourceError::nsError() const
 {
-    if (m_isNull) {
+    if (isNull()) {
         ASSERT(!m_platformError);
         return nil;
     }
@@ -238,21 +237,17 @@
 #else
 
 ResourceError::ResourceError(NSError *nsError)
-    : m_dataIsUpToDate(false)
+    : ResourceErrorBase(Type::Null)
+    , m_dataIsUpToDate(false)
     , m_platformError(nsError)
 {
-    m_isNull = !nsError;
-    if (!m_isNull)
-        m_isTimeout = [m_platformError.get() code] == NSURLErrorTimedOut;
+    if (nsError)
+        setType(([m_platformError.get() code] == NSURLErrorTimedOut) ? Type::Timeout : Type::General);
 }
 
 ResourceError::ResourceError(CFErrorRef cfError)
-    : m_dataIsUpToDate(false)
-    , m_platformError((NSError *)cfError)
+    : ResourceError((NSError *)cfError)
 {
-    m_isNull = !cfError;
-    if (!m_isNull)
-        m_isTimeout = [m_platformError.get() code] == NSURLErrorTimedOut;
 }
 
 void ResourceError::platformLazyInit()
@@ -287,7 +282,7 @@
 
 NSError *ResourceError::nsError() const
 {
-    if (m_isNull) {
+    if (isNull()) {
         ASSERT(!m_platformError);
         return nil;
     }

Modified: trunk/Source/WebCore/platform/network/soup/ResourceError.h (201855 => 201856)


--- 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)
@@ -41,14 +41,15 @@
 class ResourceError : public ResourceErrorBase
 {
 public:
-    ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription)
-        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription)
+    ResourceError(Type type = Type::Null)
+        : ResourceErrorBase(type)
         , m_tlsErrors(0)
     {
     }
 
-    ResourceError()
-        : m_tlsErrors(0)
+    ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, Type type = Type::General)
+        : ResourceErrorBase(domain, errorCode, failingURL, localizedDescription, type)
+        , m_tlsErrors(0)
     {
     }
 

Modified: trunk/Source/WebCore/platform/network/soup/ResourceErrorSoup.cpp (201855 => 201856)


--- 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)
@@ -92,9 +92,7 @@
     // Use the same value as in NSURLError.h
     static const int timeoutError = -1001;
     static const char* const  errorDomain = "WebKitNetworkError";
-    ResourceError error = ResourceError(errorDomain, timeoutError, failingURL, "Request timed out");
-    error.setIsTimeout(true);
-    return error;
+    return ResourceError(errorDomain, timeoutError, failingURL, "Request timed out", ResourceError::Type::Timeout);
 }
 
 void ResourceError::doPlatformIsolatedCopy(const ResourceError& other)

Modified: trunk/Source/WebKit2/ChangeLog (201855 => 201856)


--- 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)
@@ -1,3 +1,14 @@
+2016-06-08  Youenn Fablet  <[email protected]>
+
+        Introduce ResourceErrorBase::type
+        https://bugs.webkit.org/show_bug.cgi?id=158299
+
+        Reviewed by Alex Christensen.
+
+        * Shared/soup/WebCoreArgumentCodersSoup.cpp:
+        (IPC::ArgumentCoder<ResourceError>::encodePlatformData):
+        (IPC::ArgumentCoder<ResourceError>::decodePlatformData):
+
 2016-06-08  Beth Dakin  <[email protected]>
 
         _web_didAddMediaControlsManager should take a controlsManager as a parameter 

Modified: trunk/Source/WebKit2/Shared/soup/WebCoreArgumentCodersSoup.cpp (201855 => 201856)


--- 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)
@@ -186,28 +186,25 @@
 
 void ArgumentCoder<ResourceError>::encodePlatformData(ArgumentEncoder& encoder, const ResourceError& resourceError)
 {
-    bool errorIsNull = resourceError.isNull();
-    encoder << errorIsNull;
-    if (errorIsNull)
+    encoder.encodeEnum(resourceError.type());
+    if (resourceError.isNull())
         return;
 
     encoder << resourceError.domain();
     encoder << resourceError.errorCode();
     encoder << resourceError.failingURL().string();
     encoder << resourceError.localizedDescription();
-    encoder << resourceError.isCancellation();
-    encoder << resourceError.isTimeout();
 
     encoder << CertificateInfo(resourceError);
 }
 
 bool ArgumentCoder<ResourceError>::decodePlatformData(ArgumentDecoder& decoder, ResourceError& resourceError)
 {
-    bool errorIsNull;
-    if (!decoder.decode(errorIsNull))
+    ResourceErrorBase::Type errorType;
+    if (!decoder.decodeEnum(errorType))
         return false;
-    if (errorIsNull) {
-        resourceError = ResourceError();
+    if (errorType == ResourceErrorBase::Type::Null) {
+        resourceError = { };
         return true;
     }
 
@@ -227,17 +224,8 @@
     if (!decoder.decode(localizedDescription))
         return false;
 
-    bool isCancellation;
-    if (!decoder.decode(isCancellation))
-        return false;
-
-    bool isTimeout;
-    if (!decoder.decode(isTimeout))
-        return false;
-
     resourceError = ResourceError(domain, errorCode, URL(URL(), failingURL), localizedDescription);
-    resourceError.setIsCancellation(isCancellation);
-    resourceError.setIsTimeout(isTimeout);
+    resourceError.setType(errorType);
 
     CertificateInfo certificateInfo;
     if (!decoder.decode(certificateInfo))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to