Title: [123004] trunk
Revision
123004
Author
[email protected]
Date
2012-07-18 13:01:46 -0700 (Wed, 18 Jul 2012)

Log Message

[EFL] Add central error management to EFL port
https://bugs.webkit.org/show_bug.cgi?id=91598

Patch by Christophe Dumez <[email protected]> on 2012-07-18
Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Define possible error types in ErrorsEfl so
that we can reuse the header in both WebKit1
and WebKit2. This is inspired from the GTK
port.

No new tests, no behavior change.

* PlatformEfl.cmake:
* platform/efl/ErrorsEfl.cpp: Added.
(WebCore):
(WebCore::cancelledError):
(WebCore::blockedError):
(WebCore::cannotShowURLError):
(WebCore::interruptedForPolicyChangeError):
(WebCore::cannotShowMIMETypeError):
(WebCore::fileDoesNotExistError):
(WebCore::pluginWillHandleLoadError):
(WebCore::downloadNetworkError):
(WebCore::downloadCancelledByUserError):
(WebCore::downloadDestinationError):
(WebCore::printError):
(WebCore::printerNotFoundError):
(WebCore::invalidPageRangeToPrint):
* platform/efl/ErrorsEfl.h: Added.
(WebCore):

Source/WebKit/efl:

Make use of ErrorsEfl header from WebCore in
EFL's FrameLoaderClient now that we have
a central place for errors.

* WebCoreSupport/FrameLoaderClientEfl.cpp:
(WebCore::FrameLoaderClientEfl::cancelledError):
(WebCore::FrameLoaderClientEfl::blockedError):
(WebCore::FrameLoaderClientEfl::cannotShowURLError):
(WebCore::FrameLoaderClientEfl::interruptedForPolicyChangeError):
(WebCore::FrameLoaderClientEfl::cannotShowMIMETypeError):
(WebCore::FrameLoaderClientEfl::fileDoesNotExistError):
(WebCore::FrameLoaderClientEfl::pluginWillHandleLoadError):
(WebCore::FrameLoaderClientEfl::shouldFallBack):

Source/WebKit2:

Make use of ErrorsEfl header from WebCore in
WebKit2, for Ewk_Web_Error and WebErrorsEfl.

* UIProcess/API/efl/ewk_web_error.cpp:
(ewk_web_error_type_get):
* UIProcess/API/efl/ewk_web_error.h:
* WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp:
(WebKit::cancelledError):
(WebKit::blockedError):
(WebKit::cannotShowURLError):
(WebKit::interruptedForPolicyChangeError):
(WebKit::cannotShowMIMETypeError):
(WebKit::fileDoesNotExistError):
(WebKit::pluginWillHandleLoadError):

Tools:

Map WebKitNetworkError to NSURLErrorDomain when
printing in DumpRenderTree so that the output
matches the expected one.

* DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
(descriptionSuitableForTestResult):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123003 => 123004)


--- trunk/Source/WebCore/ChangeLog	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Source/WebCore/ChangeLog	2012-07-18 20:01:46 UTC (rev 123004)
@@ -1,3 +1,36 @@
+2012-07-18  Christophe Dumez  <[email protected]>
+
+        [EFL] Add central error management to EFL port
+        https://bugs.webkit.org/show_bug.cgi?id=91598
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Define possible error types in ErrorsEfl so
+        that we can reuse the header in both WebKit1
+        and WebKit2. This is inspired from the GTK
+        port.
+
+        No new tests, no behavior change.
+
+        * PlatformEfl.cmake:
+        * platform/efl/ErrorsEfl.cpp: Added.
+        (WebCore):
+        (WebCore::cancelledError):
+        (WebCore::blockedError):
+        (WebCore::cannotShowURLError):
+        (WebCore::interruptedForPolicyChangeError):
+        (WebCore::cannotShowMIMETypeError):
+        (WebCore::fileDoesNotExistError):
+        (WebCore::pluginWillHandleLoadError):
+        (WebCore::downloadNetworkError):
+        (WebCore::downloadCancelledByUserError):
+        (WebCore::downloadDestinationError):
+        (WebCore::printError):
+        (WebCore::printerNotFoundError):
+        (WebCore::invalidPageRangeToPrint):
+        * platform/efl/ErrorsEfl.h: Added.
+        (WebCore):
+
 2012-07-18  Varun Jain  <[email protected]>
 
         [chromium] Fix crash in DragImageTest caused by r122996

Modified: trunk/Source/WebCore/PlatformEfl.cmake (123003 => 123004)


--- trunk/Source/WebCore/PlatformEfl.cmake	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Source/WebCore/PlatformEfl.cmake	2012-07-18 20:01:46 UTC (rev 123004)
@@ -33,6 +33,7 @@
   platform/efl/DragImageEfl.cpp
   platform/efl/EflKeyboardUtilities.cpp
   platform/efl/EflScreenUtilities.cpp
+  platform/efl/ErrorsEfl.cpp
   platform/efl/EventLoopEfl.cpp
   platform/efl/FileSystemEfl.cpp
   platform/efl/GamepadsEfl.cpp

Added: trunk/Source/WebCore/platform/efl/ErrorsEfl.cpp (0 => 123004)


--- trunk/Source/WebCore/platform/efl/ErrorsEfl.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/efl/ErrorsEfl.cpp	2012-07-18 20:01:46 UTC (rev 123004)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ErrorsEfl.h"
+
+#include "DocumentLoader.h"
+#include "Frame.h"
+#include "PrintContext.h"
+#include "ResourceError.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+
+namespace WebCore {
+
+ResourceError cancelledError(const ResourceRequest& request)
+{
+    return ResourceError(errorDomainNetwork, NetworkErrorCancelled, request.url().string(), "Load request cancelled");
+}
+
+ResourceError blockedError(const ResourceRequest& request)
+{
+    return ResourceError(errorDomainPolicy, PolicyErrorCannotUseRestrictedPort, request.url().string(), "Not allowed to use restricted network port");
+}
+
+ResourceError cannotShowURLError(const ResourceRequest& request)
+{
+    return ResourceError(errorDomainPolicy, PolicyErrorCannotShowURL, request.url().string(), "URL cannot be shown");
+}
+
+ResourceError interruptedForPolicyChangeError(const ResourceRequest& request)
+{
+    return ResourceError(errorDomainPolicy, PolicyErrorFrameLoadInterruptedByPolicyChange, request.url().string(), "Frame load was interrupted");
+}
+
+ResourceError cannotShowMIMETypeError(const ResourceResponse& response)
+{
+    return ResourceError(errorDomainPolicy, PolicyErrorCannotShowMimeType, response.url().string(), "Content with the specified MIME type cannot be shown");
+}
+
+ResourceError fileDoesNotExistError(const ResourceResponse& response)
+{
+    return ResourceError(errorDomainNetwork, NetworkErrorFileDoesNotExist, response.url().string(), "File does not exist");
+}
+
+ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
+{
+    return ResourceError(errorDomainPlugin, PluginErrorWillHandleLoad, response.url().string(), "Plugin will handle load");
+}
+
+ResourceError downloadNetworkError(const ResourceError& networkError)
+{
+    return ResourceError(errorDomainDownload, DownloadErrorNetwork, networkError.failingURL(), networkError.localizedDescription());
+}
+
+ResourceError downloadCancelledByUserError(const ResourceResponse& response)
+{
+    return ResourceError(errorDomainDownload, DownloadErrorCancelledByUser, response.url().string(), "User cancelled the download");
+}
+
+ResourceError downloadDestinationError(const ResourceResponse& response, const String& errorMessage)
+{
+    return ResourceError(errorDomainDownload, DownloadErrorDestination, response.url().string(), errorMessage);
+}
+
+ResourceError printError(const PrintContext* printContext, const String& errorMessage)
+{
+    DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader();
+
+    return ResourceError(errorDomainPrint, PrintErrorGeneral, documentLoader ? documentLoader->url() : KURL(), errorMessage);
+}
+
+ResourceError printerNotFoundError(const PrintContext* printContext)
+{
+    DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader();
+
+    return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, documentLoader ? documentLoader->url() : KURL(), "Printer not found");
+}
+
+ResourceError invalidPageRangeToPrint(const PrintContext* printContext)
+{
+    DocumentLoader* documentLoader = printContext->frame()->loader()->documentLoader();
+
+    return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, documentLoader ? documentLoader->url() : KURL(), "Invalid page range");
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/platform/efl/ErrorsEfl.h (0 => 123004)


--- trunk/Source/WebCore/platform/efl/ErrorsEfl.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/efl/ErrorsEfl.h	2012-07-18 20:01:46 UTC (rev 123004)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ErrorsEfl_h
+#define ErrorsEfl_h
+
+#include "PlatformString.h"
+
+namespace WebCore {
+
+class PrintContext;
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
+
+static const char errorDomainNetwork[] = "WebKitNetworkError";
+static const char errorDomainPolicy[] = "WebKitPolicyError";
+static const char errorDomainPlugin[] = "WebKitPluginError";
+static const char errorDomainDownload[] = "WebKitDownloadError";
+static const char errorDomainPrint[] = "WebKitPrintError";
+
+enum NetworkError {
+    NetworkErrorFailed = 399,
+    NetworkErrorTransport = 300,
+    NetworkErrorUnknownProtocol = 301,
+    NetworkErrorCancelled = 302,
+    NetworkErrorFileDoesNotExist = 303
+};
+
+// Sync'd with Mac's WebKit Errors at:
+// Source/WebKit/mac/Misc/WebKitErrors[Private].h
+enum PolicyError {
+    PolicyErrorFailed = 199,
+    PolicyErrorCannotShowMimeType = 100,
+    PolicyErrorCannotShowURL = 101,
+    PolicyErrorFrameLoadInterruptedByPolicyChange = 102,
+    PolicyErrorCannotUseRestrictedPort = 103
+};
+
+enum PluginError {
+    PluginErrorFailed = 299,
+    PluginErrorCannotFindPlugin = 200,
+    PluginErrorCannotLoadPlugin = 201,
+    PluginErrorJavaUnavailable = 202,
+    PluginErrorConnectionCancelled = 203,
+    PluginErrorWillHandleLoad = 204
+};
+
+enum DownloadError {
+    DownloadErrorNetwork = 499,
+    DownloadErrorCancelledByUser = 400,
+    DownloadErrorDestination = 401
+};
+
+enum PrintError {
+    PrintErrorGeneral = 599,
+    PrintErrorPrinterNotFound = 500,
+    PrintErrorInvalidPageRange = 501
+};
+
+ResourceError cancelledError(const ResourceRequest&);
+ResourceError blockedError(const ResourceRequest&);
+ResourceError cannotShowURLError(const ResourceRequest&);
+ResourceError interruptedForPolicyChangeError(const ResourceRequest&);
+ResourceError cannotShowMIMETypeError(const ResourceResponse&);
+ResourceError fileDoesNotExistError(const ResourceResponse&);
+ResourceError pluginWillHandleLoadError(const ResourceResponse&);
+ResourceError downloadNetworkError(const ResourceError&);
+ResourceError downloadCancelledByUserError(const ResourceResponse&);
+ResourceError downloadDestinationError(const ResourceResponse&, const String& errorMessage);
+ResourceError printError(const PrintContext*, const String& errorMessage);
+ResourceError printerNotFoundError(const PrintContext*);
+ResourceError invalidPageRangeToPrint(const PrintContext*);
+
+}
+
+#endif // ErrorsEfl_h

Modified: trunk/Source/WebKit/efl/ChangeLog (123003 => 123004)


--- trunk/Source/WebKit/efl/ChangeLog	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-07-18 20:01:46 UTC (rev 123004)
@@ -1,3 +1,24 @@
+2012-07-18  Christophe Dumez  <[email protected]>
+
+        [EFL] Add central error management to EFL port
+        https://bugs.webkit.org/show_bug.cgi?id=91598
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Make use of ErrorsEfl header from WebCore in
+        EFL's FrameLoaderClient now that we have
+        a central place for errors.
+
+        * WebCoreSupport/FrameLoaderClientEfl.cpp:
+        (WebCore::FrameLoaderClientEfl::cancelledError):
+        (WebCore::FrameLoaderClientEfl::blockedError):
+        (WebCore::FrameLoaderClientEfl::cannotShowURLError):
+        (WebCore::FrameLoaderClientEfl::interruptedForPolicyChangeError):
+        (WebCore::FrameLoaderClientEfl::cannotShowMIMETypeError):
+        (WebCore::FrameLoaderClientEfl::fileDoesNotExistError):
+        (WebCore::FrameLoaderClientEfl::pluginWillHandleLoadError):
+        (WebCore::FrameLoaderClientEfl::shouldFallBack):
+
 2012-07-18  Seokju Kwon  <[email protected]>
 
         [EFL][DRT] Add support for Web Inspector in WebKit-EFL DRT

Modified: trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp (123003 => 123004)


--- trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp	2012-07-18 20:01:46 UTC (rev 123004)
@@ -38,6 +38,7 @@
 
 #include "APICast.h"
 #include "DocumentLoader.h"
+#include "ErrorsEfl.h"
 #include "FormState.h"
 #include "FrameLoader.h"
 #include "FrameNetworkingContextEfl.h"
@@ -867,69 +868,44 @@
     ewk_view_download_request(m_view, &download);
 }
 
-// copied from WebKit/Misc/WebKitErrors[Private].h
-enum {
-    WebKitErrorCannotShowMIMEType = 100,
-    WebKitErrorCannotShowURL = 101,
-    WebKitErrorFrameLoadInterruptedByPolicyChange = 102,
-    WebKitErrorCannotUseRestrictedPort = 103,
-    WebKitErrorCannotFindPlugIn = 200,
-    WebKitErrorCannotLoadPlugIn = 201,
-    WebKitErrorJavaUnavailable = 202,
-    WebKitErrorPluginWillHandleLoad = 204
-};
-
-// Domains used for ResourceError
-const char* const NSURLErrorDomain = "NSURLErrorDomain";
-const char* const WebKitErrorDomain = "WebKitErrorDomain";
-
 ResourceError FrameLoaderClientEfl::cancelledError(const ResourceRequest& request)
 {
-    ResourceError error(NSURLErrorDomain, -999, request.url().string(),
-                        "Request cancelled");
-    error.setIsCancellation(true);
-    return error;
+    return WebCore::cancelledError(request);
 }
 
 ResourceError FrameLoaderClientEfl::blockedError(const ResourceRequest& request)
 {
-    return ResourceError(WebKitErrorDomain, WebKitErrorCannotUseRestrictedPort, request.url().string(),
-                         "Request blocked");
+    return WebCore::blockedError(request);
 }
 
 ResourceError FrameLoaderClientEfl::cannotShowURLError(const ResourceRequest& request)
 {
-    return ResourceError(WebKitErrorDomain, WebKitErrorCannotShowURL, request.url().string(),
-                         "Cannot show URL");
+    return WebCore::cannotShowURLError(request);
 }
 
 ResourceError FrameLoaderClientEfl::interruptedForPolicyChangeError(const ResourceRequest& request)
 {
-    return ResourceError(WebKitErrorDomain, WebKitErrorFrameLoadInterruptedByPolicyChange,
-                         request.url().string(), "Frame load interrupted by policy change");
+    return WebCore::interruptedForPolicyChangeError(request);
 }
 
 ResourceError FrameLoaderClientEfl::cannotShowMIMETypeError(const ResourceResponse& response)
 {
-    return ResourceError(NSURLErrorDomain, WebKitErrorCannotShowMIMEType, response.url().string(),
-                         "Cannot show mimetype");
+    return WebCore::cannotShowMIMETypeError(response);
 }
 
 ResourceError FrameLoaderClientEfl::fileDoesNotExistError(const ResourceResponse& response)
 {
-    return ResourceError(NSURLErrorDomain, -998 /* ### */, response.url().string(),
-                         "File does not exist");
+    return WebCore::fileDoesNotExistError(response);
 }
 
 ResourceError FrameLoaderClientEfl::pluginWillHandleLoadError(const ResourceResponse& response)
 {
-    return ResourceError(WebKitErrorDomain, WebKitErrorPluginWillHandleLoad, response.url().string(),
-                         "Plugin will handle load");
+    return WebCore::pluginWillHandleLoadError(response);
 }
 
 bool FrameLoaderClientEfl::shouldFallBack(const ResourceError& error)
 {
-    return !(error.isCancellation() || error.errorCode() == WebKitErrorFrameLoadInterruptedByPolicyChange || error.errorCode() == WebKitErrorPluginWillHandleLoad);
+    return !(error.isCancellation() || error.errorCode() == PolicyErrorFrameLoadInterruptedByPolicyChange || error.errorCode() == PluginErrorWillHandleLoad);
 }
 
 bool FrameLoaderClientEfl::canCachePage() const

Modified: trunk/Source/WebKit2/ChangeLog (123003 => 123004)


--- trunk/Source/WebKit2/ChangeLog	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-18 20:01:46 UTC (rev 123004)
@@ -1,3 +1,25 @@
+2012-07-18  Christophe Dumez  <[email protected]>
+
+        [EFL] Add central error management to EFL port
+        https://bugs.webkit.org/show_bug.cgi?id=91598
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Make use of ErrorsEfl header from WebCore in
+        WebKit2, for Ewk_Web_Error and WebErrorsEfl.
+
+        * UIProcess/API/efl/ewk_web_error.cpp:
+        (ewk_web_error_type_get):
+        * UIProcess/API/efl/ewk_web_error.h:
+        * WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp:
+        (WebKit::cancelledError):
+        (WebKit::blockedError):
+        (WebKit::cannotShowURLError):
+        (WebKit::interruptedForPolicyChangeError):
+        (WebKit::cannotShowMIMETypeError):
+        (WebKit::fileDoesNotExistError):
+        (WebKit::pluginWillHandleLoadError):
+
 2012-07-18  Thiago Marcos P. Santos  <[email protected]>
 
         [EFL] Set a theme for EFL WebKit2 unit test fixture

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp (123003 => 123004)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.cpp	2012-07-18 20:01:46 UTC (rev 123004)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "ewk_web_error.h"
 
+#include "ErrorsEfl.h"
 #include "WKString.h"
 #include "WKURL.h"
 #include "ewk_web_error_private.h"
@@ -34,11 +35,9 @@
 #include <WKRetainPtr.h>
 #include <wtf/text/CString.h>
 
+using namespace WebCore;
 using namespace WebKit;
 
-// Copied from ErrorsGtk.h which is used by DownloadSoup.cpp.
-static const char errorDomainDownload[] = "WebKitDownloadError";
-
 struct _Ewk_Web_Error {
     WKRetainPtr<WKErrorRef> wkError;
 
@@ -83,12 +82,16 @@
     WKRetainPtr<WKStringRef> wkDomain(AdoptWK, WKErrorCopyDomain(wkError));
     WTF::String errorDomain = toWTFString(wkDomain.get());
 
-    if (errorDomain == String(g_quark_to_string(SOUP_HTTP_ERROR)))
-        return EWK_WEB_ERROR_TYPE_HTTP;
-    if (errorDomain == String(g_quark_to_string(G_IO_ERROR)))
-        return EWK_WEB_ERROR_TYPE_IO;
+    if (errorDomain == errorDomainNetwork)
+        return EWK_WEB_ERROR_TYPE_NETWORK;
+    if (errorDomain == errorDomainPolicy)
+        return EWK_WEB_ERROR_TYPE_POLICY;
+    if (errorDomain == errorDomainPlugin)
+        return EWK_WEB_ERROR_TYPE_PLUGIN;
     if (errorDomain == errorDomainDownload)
         return EWK_WEB_ERROR_TYPE_DOWNLOAD;
+    if (errorDomain == errorDomainPrint)
+        return EWK_WEB_ERROR_TYPE_PRINT;
     return EWK_WEB_ERROR_TYPE_INTERNAL;
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h (123003 => 123004)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_web_error.h	2012-07-18 20:01:46 UTC (rev 123004)
@@ -44,9 +44,11 @@
 typedef enum {
     EWK_WEB_ERROR_TYPE_NONE,
     EWK_WEB_ERROR_TYPE_INTERNAL,
-    EWK_WEB_ERROR_TYPE_HTTP,
-    EWK_WEB_ERROR_TYPE_IO,
-    EWK_WEB_ERROR_TYPE_DOWNLOAD
+    EWK_WEB_ERROR_TYPE_NETWORK,
+    EWK_WEB_ERROR_TYPE_POLICY,
+    EWK_WEB_ERROR_TYPE_PLUGIN,
+    EWK_WEB_ERROR_TYPE_DOWNLOAD,
+    EWK_WEB_ERROR_TYPE_PRINT
 } Ewk_Web_Error_Type;
 
 /**

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp (123003 => 123004)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebErrorsEfl.cpp	2012-07-18 20:01:46 UTC (rev 123004)
@@ -26,8 +26,7 @@
 #include "config.h"
 #include "WebErrors.h"
 
-#include "WKError.h"
-#include "WebError.h"
+#include <WebCore/ErrorsEfl.h>
 #include <WebCore/ResourceError.h>
 #include <WebCore/ResourceRequest.h>
 #include <WebCore/ResourceResponse.h>
@@ -36,47 +35,39 @@
 
 namespace WebKit {
 
-// FIXME: Export following error codes so that application can understand.
-// We should establish Efl port's error system because application cannot understand those local define.
-// See https://bugs.webkit.org/show_bug.cgi?id=90783 for detail.
-enum {
-    kWKErrorCodeCancelled =                             300,
-    kWKErrorCodeFileDoesNotExist =                      301,
-};
-
 ResourceError cancelledError(const ResourceRequest& request)
 {
-    return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCancelled, request.url().string(), "Request cancelled");
+    return WebCore::cancelledError(request);
 }
 
 ResourceError blockedError(const ResourceRequest& request)
 {
-    return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url().string(), "Request blocked");
+    return WebCore::blockedError(request);
 }
 
 ResourceError cannotShowURLError(const ResourceRequest& request)
 {
-    return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowURL, request.url().string(), "Cannot show URL");
+    return WebCore::cannotShowURLError(request);
 }
 
 ResourceError interruptedForPolicyChangeError(const ResourceRequest& request)
 {
-    return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url().string(), "Frame load interrupted by policy change");
+    return WebCore::interruptedForPolicyChangeError(request);
 }
 
 ResourceError cannotShowMIMETypeError(const ResourceResponse& response)
 {
-    return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeCannotShowMIMEType, response.url().string(), "Cannot show mimetype");
+    return WebCore::cannotShowMIMETypeError(response);
 }
 
 ResourceError fileDoesNotExistError(const ResourceResponse& response)
 {
-    return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodeFileDoesNotExist, response.url().string(), "File does not exist");
+    return WebCore::fileDoesNotExistError(response);
 }
 
 ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
 {
-    return ResourceError(WebError::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url().string(), "Plugin will handle load");
+    return WebCore::pluginWillHandleLoadError(response);
 }
 
 } // namespace WebKit

Modified: trunk/Tools/ChangeLog (123003 => 123004)


--- trunk/Tools/ChangeLog	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Tools/ChangeLog	2012-07-18 20:01:46 UTC (rev 123004)
@@ -1,3 +1,17 @@
+2012-07-18  Christophe Dumez  <[email protected]>
+
+        [EFL] Add central error management to EFL port
+        https://bugs.webkit.org/show_bug.cgi?id=91598
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Map WebKitNetworkError to NSURLErrorDomain when
+        printing in DumpRenderTree so that the output
+        matches the expected one.
+
+        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
+        (descriptionSuitableForTestResult):
+
 2012-07-18  Dirk Pranke  <[email protected]>
 
         nrwt: start merging port/webkit.py into port/base.py

Modified: trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp (123003 => 123004)


--- trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2012-07-18 19:59:24 UTC (rev 123003)
+++ trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp	2012-07-18 20:01:46 UTC (rev 123004)
@@ -401,17 +401,24 @@
 
 static CString descriptionSuitableForTestResult(Ewk_Frame_Load_Error* error)
 {
-    String ret = "<NSError domain ";
-    ret += error->domain;
-    ret += ", code ";
-    ret += String::number(error->code);
-    if (error->failing_url && *error->failing_url != '\0') {
-        ret += ", failing URL \"";
-        ret += error->failing_url;
-        ret += "\"";
+    const char* errorDomain = error->domain;
+    int errorCode = error->code;
+
+    // We need to do some error mapping here to match
+    // the test expectations.
+    if (!strcmp(error->domain, "WebKitNetworkError")) {
+        errorDomain = "NSURLErrorDomain";
+        errorCode = -999;
     }
-    ret += ">";
 
+    if (!strcmp(errorDomain, "WebKitPolicyError"))
+        errorDomain = "WebKitErrorDomain";
+
+    String ret = makeString("<NSError domain ", errorDomain, ", code ", String::number(errorCode));
+    if (error->failing_url && *error->failing_url != '\0')
+        ret = makeString(ret, ", failing URL \"", error->failing_url, "\"");
+    ret = makeString(ret, ">");
+
     return ret.utf8();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to