Move WebErrors from WebProcess to Shared and get rid of ErrorsGtk in WebCore
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Apr 2017 07:41:53 +0000 (07:41 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Apr 2017 07:41:53 +0000 (07:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156974

Reviewed by Sam Weinig.

Source/WebCore:

Remove ErrorsGtk.

* PlatformGTK.cmake:
* platform/gtk/ErrorsGtk.cpp: Removed.
* platform/gtk/ErrorsGtk.h: Removed.

Source/WebCore/platform/gtk/po:

* POTFILES.in: Add new paths with translatable strings.

Source/WebKit2:

WebErrors are not only used by the frame loader client in the web process, but also by the network process. So,
move them to Shared make most of the implementation cross-platform.

* CMakeLists.txt: Add new files to compilation.
* NetworkProcess/soup/NetworkDataTaskSoup.cpp:
(WebKit::NetworkDataTaskSoup::download): Use WebErrors directly instead of platform methods that are no longer needed.
(WebKit::NetworkDataTaskSoup::writeDownloadCallback): Ditto.
(WebKit::NetworkDataTaskSoup::didFinishDownload): Ditto.
(WebKit::NetworkDataTaskSoup::didFail): Ditto.
* PlatformGTK.cmake: Add new files to compilation and remove DownloadSoupErrorsGtk.cpp
* PlatformMac.cmake:
* Shared/API/APIError.cpp: Add error domains used by glib based ports.
(API::Error::webKitNetworkErrorDomain):
(API::Error::webKitPolicyErrorDomain):
(API::Error::webKitPluginErrorDomain):
(API::Error::webKitDownloadErrorDomain):
(API::Error::webKitPrintErrorDomain):
* Shared/API/APIError.h:
* Shared/Cocoa/WebErrorsCocoa.mm: Copied from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
(WebKit::createNSError):
(WebKit::cancelledError):
(WebKit::fileDoesNotExistError):
* Shared/WebErrors.cpp: Copied from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
(WebKit::blockedError):
(WebKit::blockedByContentBlockerError):
(WebKit::cannotShowURLError):
(WebKit::interruptedForPolicyChangeError):
(WebKit::blockedByContentFilterError):
(WebKit::cannotShowMIMETypeError):
(WebKit::pluginWillHandleLoadError):
(WebKit::internalError):
* Shared/WebErrors.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
* Shared/glib/WebErrorsGlib.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
(WebKit::cancelledError):
(WebKit::fileDoesNotExistError):
* Shared/gtk/WebErrorsGtk.cpp: Copied from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
(WebKit::printError):
(WebKit::printerNotFoundError):
(WebKit::invalidPageRangeToPrint):
* Shared/soup/WebErrorsSoup.cpp: Renamed from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
(WebKit::downloadNetworkError):
(WebKit::downloadCancelledByUserError):
(WebKit::downloadDestinationError):
* UIProcess/API/gtk/WebKitDownload.cpp:
* UIProcess/API/gtk/WebKitError.cpp:
(webkit_network_error_quark):
(webkit_policy_error_quark):
(webkit_plugin_error_quark):
(webkit_download_error_quark):
(webkit_print_error_quark):
* UIProcess/API/gtk/WebKitPrivate.cpp:
(toWebKitError):
(toWebCoreError):
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: Removed.
* WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214934 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake
Source/WebCore/platform/gtk/ErrorsGtk.cpp [deleted file]
Source/WebCore/platform/gtk/ErrorsGtk.h [deleted file]
Source/WebCore/platform/gtk/po/ChangeLog
Source/WebCore/platform/gtk/po/POTFILES.in
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/PlatformMac.cmake
Source/WebKit2/Shared/API/APIError.cpp
Source/WebKit2/Shared/API/APIError.h
Source/WebKit2/Shared/Cocoa/WebErrorsCocoa.mm [new file with mode: 0644]
Source/WebKit2/Shared/WebErrors.cpp [new file with mode: 0644]
Source/WebKit2/Shared/WebErrors.h [moved from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h with 77% similarity]
Source/WebKit2/Shared/glib/WebErrorsGlib.cpp [moved from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp with 61% similarity]
Source/WebKit2/Shared/gtk/WebErrorsGtk.cpp [moved from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp with 65% similarity]
Source/WebKit2/Shared/soup/WebErrorsSoup.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp
Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm [deleted file]
Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp

index 46e545e..7ab279d 100644 (file)
@@ -1,3 +1,16 @@
+2017-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Move WebErrors from WebProcess to Shared and get rid of ErrorsGtk in WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=156974
+
+        Reviewed by Sam Weinig.
+
+        Remove ErrorsGtk.
+
+        * PlatformGTK.cmake:
+        * platform/gtk/ErrorsGtk.cpp: Removed.
+        * platform/gtk/ErrorsGtk.h: Removed.
+
 2017-04-05  Andy Estes  <aestes@apple.com>
 
         [ios-simulator] API test WebKit2.DataDetectionReferenceDate timing out
index cc1147c..c6df5d7 100644 (file)
@@ -139,7 +139,6 @@ list(APPEND WebCore_SOURCES
     platform/graphics/x11/XUniqueResource.cpp
 
     platform/gtk/DragDataGtk.cpp
-    platform/gtk/ErrorsGtk.cpp
     platform/gtk/LocalizedStringsGtk.cpp
     platform/gtk/PasteboardGtk.cpp
     platform/gtk/ScrollAnimatorGtk.cpp
diff --git a/Source/WebCore/platform/gtk/ErrorsGtk.cpp b/Source/WebCore/platform/gtk/ErrorsGtk.cpp
deleted file mode 100644 (file)
index 8dfd158..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2011 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "ErrorsGtk.h"
-
-#include "ResourceError.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
-#include <glib/gi18n-lib.h>
-
-namespace WebCore {
-
-ResourceError cancelledError(const ResourceRequest& request)
-{
-    return ResourceError(errorDomainNetwork, NetworkErrorCancelled, request.url(), _("Load request cancelled"));
-}
-
-ResourceError blockedError(const ResourceRequest& request)
-{
-    return ResourceError(errorDomainPolicy, PolicyErrorCannotUseRestrictedPort, request.url(), _("Not allowed to use restricted network port"));
-}
-
-ResourceError blockedByContentBlockerError(const ResourceRequest& request)
-{
-    return ResourceError(errorDomainPolicy, PolicyErrorBlockedByContentBlocker, request.url(), _("Blocked by content blocker"));
-}
-
-ResourceError cannotShowURLError(const ResourceRequest& request)
-{
-    return ResourceError(errorDomainPolicy, PolicyErrorCannotShowURL, request.url(), _("URL cannot be shown"));
-}
-
-ResourceError interruptedForPolicyChangeError(const ResourceRequest& request)
-{
-    return ResourceError(errorDomainPolicy, PolicyErrorFrameLoadInterruptedByPolicyChange, request.url(), _("Frame load was interrupted"));
-}
-
-ResourceError cannotShowMIMETypeError(const ResourceResponse& response)
-{
-    return ResourceError(errorDomainPolicy, PolicyErrorCannotShowMimeType, response.url(), _("Content with the specified MIME type cannot be shown"));
-}
-
-ResourceError fileDoesNotExistError(const ResourceResponse& response)
-{
-    return ResourceError(errorDomainNetwork, NetworkErrorFileDoesNotExist, response.url(), _("File does not exist"));
-}
-
-ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
-{
-    return ResourceError(errorDomainPlugin, PluginErrorWillHandleLoad, response.url(), _("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(), _("User cancelled the download"));
-}
-
-ResourceError downloadDestinationError(const ResourceResponse& response, const String& errorMessage)
-{
-    return ResourceError(errorDomainDownload, DownloadErrorDestination, response.url(), errorMessage);
-}
-
-ResourceError printError(const URL& failingURL, const String& errorMessage)
-{
-    return ResourceError(errorDomainPrint, PrintErrorGeneral, failingURL, errorMessage);
-}
-
-ResourceError printerNotFoundError(const URL& failingURL)
-{
-    return ResourceError(errorDomainPrint, PrintErrorPrinterNotFound, failingURL, _("Printer not found"));
-}
-
-ResourceError invalidPageRangeToPrint(const URL& failingURL)
-{
-    return ResourceError(errorDomainPrint, PrintErrorInvalidPageRange, failingURL, _("Invalid page range"));
-}
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/gtk/ErrorsGtk.h b/Source/WebCore/platform/gtk/ErrorsGtk.h
deleted file mode 100644 (file)
index 761dccb..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2011 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef ErrorsGtk_h
-#define ErrorsGtk_h
-
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class ResourceError;
-class ResourceRequest;
-class ResourceResponse;
-class URL;
-
-const char* const errorDomainNetwork = "WebKitNetworkError";
-const char* const errorDomainPolicy = "WebKitPolicyError";
-const char* const errorDomainPlugin = "WebKitPluginError";
-const char* const errorDomainDownload = "WebKitDownloadError";
-const char* const errorDomainPrint = "WebKitPrintError";
-
-enum NetworkError {
-    NetworkErrorFailed = 399,
-    NetworkErrorTransport = 300,
-    NetworkErrorUnknownProtocol = 301,
-    NetworkErrorCancelled = 302,
-    NetworkErrorFileDoesNotExist = 303
-};
-
-// Sync'd with Mac's WebKit Errors.
-enum PolicyError {
-    PolicyErrorFailed = 199,
-    PolicyErrorCannotShowMimeType = 100,
-    PolicyErrorCannotShowURL = 101,
-    PolicyErrorFrameLoadInterruptedByPolicyChange = 102,
-    PolicyErrorCannotUseRestrictedPort = 103,
-    PolicyErrorBlockedByContentBlocker = 104,
-};
-
-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 blockedByContentBlockerError(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 URL& failingURL, const String& errorMessage);
-ResourceError printerNotFoundError(const URL& failingURL);
-ResourceError invalidPageRangeToPrint(const URL& failingURL);
-
-}
-
-#endif
index 7a9f53f..e3703eb 100644 (file)
@@ -1,3 +1,12 @@
+2017-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Move WebErrors from WebProcess to Shared and get rid of ErrorsGtk in WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=156974
+
+        Reviewed by Sam Weinig.
+
+        * POTFILES.in: Add new paths with translatable strings.
+
 2017-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Make it possible to use WEB_UI_STRING macros to mark translatable strings in glib based ports
index 8710120..44f9067 100644 (file)
@@ -1,7 +1,10 @@
 # List of source files which contain translatable strings.
-ErrorsGtk.cpp
 LocalizedStringsGtk.cpp
 ../LocalizedStrings.cpp
+../../../WebKit2/Shared/WebErrors.cpp
+../../../WebKit2/Shared/glib/WebErrorsGlib.cpp
+../../../WebKit2/Shared/gtk/WebErrorsGtk.cpp
+../../../WebKit2/Shared/soup/WebErrorsSoup.cpp
 ../../../WebKit2/UIProcess/API/gtk/WebKitAuthenticationDialog.cpp
 ../../../WebKit2/UIProcess/API/gtk/WebKitDownload.cpp
 ../../../WebKit2/UIProcess/API/gtk/WebKitFaviconDatabase.cpp
index aba8031..174307a 100644 (file)
@@ -189,6 +189,7 @@ set(WebKit2_SOURCES
     Shared/WebContextMenuItem.cpp
     Shared/WebContextMenuItemData.cpp
     Shared/WebCoreArgumentCoders.cpp
+    Shared/WebErrors.cpp
     Shared/WebEvent.cpp
     Shared/WebEventConversion.cpp
     Shared/WebGeolocationPosition.cpp
index c14268b..206914b 100644 (file)
@@ -1,3 +1,67 @@
+2017-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Move WebErrors from WebProcess to Shared and get rid of ErrorsGtk in WebCore
+        https://bugs.webkit.org/show_bug.cgi?id=156974
+
+        Reviewed by Sam Weinig.
+
+        WebErrors are not only used by the frame loader client in the web process, but also by the network process. So,
+        move them to Shared make most of the implementation cross-platform.
+
+        * CMakeLists.txt: Add new files to compilation.
+        * NetworkProcess/soup/NetworkDataTaskSoup.cpp:
+        (WebKit::NetworkDataTaskSoup::download): Use WebErrors directly instead of platform methods that are no longer needed.
+        (WebKit::NetworkDataTaskSoup::writeDownloadCallback): Ditto.
+        (WebKit::NetworkDataTaskSoup::didFinishDownload): Ditto.
+        (WebKit::NetworkDataTaskSoup::didFail): Ditto.
+        * PlatformGTK.cmake: Add new files to compilation and remove DownloadSoupErrorsGtk.cpp
+        * PlatformMac.cmake:
+        * Shared/API/APIError.cpp: Add error domains used by glib based ports.
+        (API::Error::webKitNetworkErrorDomain):
+        (API::Error::webKitPolicyErrorDomain):
+        (API::Error::webKitPluginErrorDomain):
+        (API::Error::webKitDownloadErrorDomain):
+        (API::Error::webKitPrintErrorDomain):
+        * Shared/API/APIError.h:
+        * Shared/Cocoa/WebErrorsCocoa.mm: Copied from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
+        (WebKit::createNSError):
+        (WebKit::cancelledError):
+        (WebKit::fileDoesNotExistError):
+        * Shared/WebErrors.cpp: Copied from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
+        (WebKit::blockedError):
+        (WebKit::blockedByContentBlockerError):
+        (WebKit::cannotShowURLError):
+        (WebKit::interruptedForPolicyChangeError):
+        (WebKit::blockedByContentFilterError):
+        (WebKit::cannotShowMIMETypeError):
+        (WebKit::pluginWillHandleLoadError):
+        (WebKit::internalError):
+        * Shared/WebErrors.h: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h.
+        * Shared/glib/WebErrorsGlib.cpp: Renamed from Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp.
+        (WebKit::cancelledError):
+        (WebKit::fileDoesNotExistError):
+        * Shared/gtk/WebErrorsGtk.cpp: Copied from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
+        (WebKit::printError):
+        (WebKit::printerNotFoundError):
+        (WebKit::invalidPageRangeToPrint):
+        * Shared/soup/WebErrorsSoup.cpp: Renamed from Source/WebKit2/NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp.
+        (WebKit::downloadNetworkError):
+        (WebKit::downloadCancelledByUserError):
+        (WebKit::downloadDestinationError):
+        * UIProcess/API/gtk/WebKitDownload.cpp:
+        * UIProcess/API/gtk/WebKitError.cpp:
+        (webkit_network_error_quark):
+        (webkit_policy_error_quark):
+        (webkit_plugin_error_quark):
+        (webkit_download_error_quark):
+        (webkit_print_error_quark):
+        * UIProcess/API/gtk/WebKitPrivate.cpp:
+        (toWebKitError):
+        (toWebCoreError):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/mac/WebErrorsMac.mm: Removed.
+        * WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:
+
 2017-04-04  Youenn Fablet  <youenn@apple.com>
 
         [Mac] Add back web audio support for getUserMedia MediaStreamTrack
index 817b8ee..5ff9b78 100644 (file)
@@ -869,7 +869,7 @@ void NetworkDataTaskSoup::download()
     ASSERT(!m_response.isNull());
 
     if (m_response.httpStatusCode() >= 400) {
-        didFailDownload(platformDownloadNetworkError(m_response.httpStatusCode(), m_response.url(), m_response.httpStatusText()));
+        didFailDownload(downloadNetworkError(m_response.url(), m_response.httpStatusText()));
         return;
     }
 
@@ -884,7 +884,7 @@ void NetworkDataTaskSoup::download()
     else
         outputStream = adoptGRef(g_file_create(m_downloadDestinationFile.get(), G_FILE_CREATE_NONE, nullptr, &error.outPtr()));
     if (!outputStream) {
-        didFailDownload(platformDownloadDestinationError(m_response, error->message));
+        didFailDownload(downloadDestinationError(m_response, error->message));
         return;
     }
 
@@ -893,7 +893,7 @@ void NetworkDataTaskSoup::download()
     m_downloadIntermediateFile = adoptGRef(g_file_new_for_uri(intermediateURI.get()));
     outputStream = adoptGRef(g_file_replace(m_downloadIntermediateFile.get(), 0, TRUE, G_FILE_CREATE_NONE, 0, &error.outPtr()));
     if (!outputStream) {
-        didFailDownload(platformDownloadDestinationError(m_response, error->message));
+        didFailDownload(downloadDestinationError(m_response, error->message));
         return;
     }
     m_downloadOutputStream = adoptGRef(G_OUTPUT_STREAM(outputStream.leakRef()));
@@ -927,7 +927,7 @@ void NetworkDataTaskSoup::writeDownloadCallback(GOutputStream* outputStream, GAs
         bytesWritten = writeTaskResult;
 #endif
     if (error)
-        task->didFailDownload(platformDownloadDestinationError(task->m_response, error->message));
+        task->didFailDownload(downloadDestinationError(task->m_response, error->message));
     else
         task->didWriteDownload(bytesWritten);
 }
@@ -982,7 +982,7 @@ void NetworkDataTaskSoup::didFinishDownload()
     ASSERT(m_downloadIntermediateFile);
     GUniqueOutPtr<GError> error;
     if (!g_file_move(m_downloadIntermediateFile.get(), m_downloadDestinationFile.get(), G_FILE_COPY_OVERWRITE, m_cancellable.get(), nullptr, nullptr, &error.outPtr())) {
-        didFailDownload(platformDownloadDestinationError(m_response, error->message));
+        didFailDownload(downloadDestinationError(m_response, error->message));
         return;
     }
 
@@ -1026,7 +1026,7 @@ void NetworkDataTaskSoup::cleanDownloadFiles()
 void NetworkDataTaskSoup::didFail(const ResourceError& error)
 {
     if (isDownload()) {
-        didFailDownload(platformDownloadNetworkError(error.errorCode(), error.failingURL(), error.localizedDescription()));
+        didFailDownload(downloadNetworkError(error.failingURL(), error.localizedDescription()));
         return;
     }
 
index c29a9f3..4aa206a 100644 (file)
@@ -30,8 +30,6 @@ list(APPEND WebKit2_SOURCES
 
     NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
 
-    NetworkProcess/Downloads/gtk/DownloadSoupErrorsGtk.cpp
-
     NetworkProcess/cache/NetworkCacheCodersSoup.cpp
     NetworkProcess/cache/NetworkCacheDataSoup.cpp
     NetworkProcess/cache/NetworkCacheIOChannelSoup.cpp
@@ -75,6 +73,8 @@ list(APPEND WebKit2_SOURCES
 
     Shared/cairo/ShareableBitmapCairo.cpp
 
+    Shared/glib/WebErrorsGlib.cpp
+
     Shared/gtk/ArgumentCodersGtk.cpp
     Shared/gtk/NativeWebKeyboardEventGtk.cpp
     Shared/gtk/NativeWebMouseEventGtk.cpp
@@ -83,12 +83,14 @@ list(APPEND WebKit2_SOURCES
     Shared/gtk/PrintInfoGtk.cpp
     Shared/gtk/ProcessExecutablePathGtk.cpp
     Shared/gtk/WebContextMenuItemGtk.cpp
+    Shared/gtk/WebErrorsGtk.cpp
     Shared/gtk/WebEventFactory.cpp
     Shared/gtk/WebSelectionData.cpp
 
     Shared/linux/WebMemorySamplerLinux.cpp
 
     Shared/soup/WebCoreArgumentCodersSoup.cpp
+    Shared/soup/WebErrorsSoup.cpp
 
     Shared/unix/ChildProcessMain.cpp
 
@@ -475,7 +477,6 @@ list(APPEND WebKit2_SOURCES
     WebProcess/WebCoreSupport/gtk/WebContextMenuClientGtk.cpp
     WebProcess/WebCoreSupport/gtk/WebDragClientGtk.cpp
     WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp
-    WebProcess/WebCoreSupport/gtk/WebErrorsGtk.cpp
     WebProcess/WebCoreSupport/gtk/WebPopupMenuGtk.cpp
 
     WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
index 925f408..ca8a749 100644 (file)
@@ -116,6 +116,7 @@ list(APPEND WebKit2_SOURCES
     Shared/Cocoa/WKNSURLExtras.mm
     Shared/Cocoa/WKNSURLRequest.mm
     Shared/Cocoa/WKObject.mm
+    Shared/Cocoa/WebErrorsCocoa.mm
 
     Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
     Shared/Plugins/Netscape/mac/PluginInformationMac.mm
@@ -355,7 +356,6 @@ list(APPEND WebKit2_SOURCES
     WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm
     WebProcess/WebCoreSupport/mac/WebDragClientMac.mm
     WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
-    WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
     WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
     WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
     WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
index 839fb0f..b73c212 100644 (file)
@@ -38,6 +38,52 @@ const WTF::String& Error::webKitErrorDomain()
     return webKitErrorDomainString;
 }
 
+const WTF::String& Error::webKitNetworkErrorDomain()
+{
+#if USE(GLIB)
+    static NeverDestroyed<WTF::String> webKitErrorDomainString(ASCIILiteral("WebKitNetworkError"));
+    return webKitErrorDomainString;
+#else
+    return webKitErrorDomain();
+#endif
+}
+
+const WTF::String& Error::webKitPolicyErrorDomain()
+{
+#if USE(GLIB)
+    static NeverDestroyed<WTF::String> webKitErrorDomainString(ASCIILiteral("WebKitPolicyError"));
+    return webKitErrorDomainString;
+#else
+    return webKitErrorDomain();
+#endif
+}
+
+const WTF::String& Error::webKitPluginErrorDomain()
+{
+#if USE(GLIB)
+    static NeverDestroyed<WTF::String> webKitErrorDomainString(ASCIILiteral("WebKitPluginError"));
+    return webKitErrorDomainString;
+#else
+    return webKitErrorDomain();
+#endif
+}
+
+#if USE(SOUP)
+const WTF::String& Error::webKitDownloadErrorDomain()
+{
+    static NeverDestroyed<WTF::String> webKitErrorDomainString(ASCIILiteral("WebKitDownloadError"));
+    return webKitErrorDomainString;
+}
+#endif
+
+#if PLATFORM(GTK)
+const WTF::String& Error::webKitPrintErrorDomain()
+{
+    static NeverDestroyed<WTF::String> webKitErrorDomainString(ASCIILiteral("WebKitPrintError"));
+    return webKitErrorDomainString;
+}
+#endif
+
 void Error::encode(IPC::Encoder& encoder) const
 {
     encoder << platformError();
index 8c36027..75751da 100644 (file)
@@ -49,6 +49,19 @@ public:
     }
 
     static const WTF::String& webKitErrorDomain();
+    enum Network { Cancelled = 302, FileDoesNotExist = 303 };
+    static const WTF::String& webKitNetworkErrorDomain();
+    static const WTF::String& webKitPolicyErrorDomain();
+    static const WTF::String& webKitPluginErrorDomain();
+#if USE(SOUP)
+    enum Download { Transport = 499, CancelledByUser = 400, Destination = 401 };
+    static const WTF::String& webKitDownloadErrorDomain();
+#endif
+#if PLATFORM(GTK)
+    enum Print { General = 599, PrinterNotFound = 500, InvalidPageRange = 501 };
+    static const WTF::String& webKitPrintErrorDomain();
+#endif
+
 
     const WTF::String& domain() const { return m_platformError.domain(); }
     int errorCode() const { return m_platformError.errorCode(); }
diff --git a/Source/WebKit2/Shared/Cocoa/WebErrorsCocoa.mm b/Source/WebKit2/Shared/Cocoa/WebErrorsCocoa.mm
new file mode 100644 (file)
index 0000000..5bfe8bc
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010-2016 Apple Inc. 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.
+ */
+
+#import "config.h"
+#import "WebErrors.h"
+
+#import "APIError.h"
+#import "WKErrorRef.h"
+#import <WebCore/LocalizedStrings.h>
+#import <WebCore/ResourceRequest.h>
+#import <WebCore/ResourceResponse.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+namespace WebKit {
+
+static RetainPtr<NSError> createNSError(NSString* domain, int code, NSURL *URL)
+{
+    NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
+        URL, @"NSErrorFailingURLKey",
+        [URL absoluteString], @"NSErrorFailingURLStringKey",
+        nil];
+
+    return adoptNS([[NSError alloc] initWithDomain:domain code:code userInfo:userInfo]);
+}
+
+ResourceError cancelledError(const ResourceRequest& request)
+{
+    return ResourceError(createNSError(NSURLErrorDomain, NSURLErrorCancelled, request.url()).get());
+}
+
+ResourceError fileDoesNotExistError(const ResourceResponse& response)
+{
+    return ResourceError(createNSError(NSURLErrorDomain, NSURLErrorFileDoesNotExist, response.url()).get());
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/WebErrors.cpp b/Source/WebKit2/Shared/WebErrors.cpp
new file mode 100644 (file)
index 0000000..8eed296
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010-2016 Apple Inc. 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 "WebErrors.h"
+
+#include "APIError.h"
+#include "WKErrorRef.h"
+#include <WebCore/LocalizedStrings.h>
+#include <WebCore/ResourceRequest.h>
+#include <WebCore/ResourceResponse.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+ResourceError blockedError(const ResourceRequest& request)
+{
+    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url(), WEB_UI_STRING("Not allowed to use restricted network port", "WebKitErrorCannotUseRestrictedPort description"));
+}
+
+ResourceError blockedByContentBlockerError(const ResourceRequest& request)
+{
+    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentBlocker, request.url(), WEB_UI_STRING("The URL was blocked by a content blocker", "WebKitErrorBlockedByContentBlocker description"));
+}
+
+ResourceError cannotShowURLError(const ResourceRequest& request)
+{
+    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeCannotShowURL, request.url(), WEB_UI_STRING("The URL can’t be shown", "WebKitErrorCannotShowURL description"));
+}
+
+ResourceError interruptedForPolicyChangeError(const ResourceRequest& request)
+{
+    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url(), WEB_UI_STRING("Frame load interrupted", "WebKitErrorFrameLoadInterruptedByPolicyChange description"));
+}
+
+#if ENABLE(CONTENT_FILTERING)
+ResourceError blockedByContentFilterError(const ResourceRequest& request)
+{
+    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentFilter, request.url(), WEB_UI_STRING("The URL was blocked by a content filter", "WebKitErrorFrameLoadBlockedByContentFilter description"));
+}
+#endif
+
+ResourceError cannotShowMIMETypeError(const ResourceResponse& response)
+{
+    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeCannotShowMIMEType, response.url(), WEB_UI_STRING("Content with specified MIME type can’t be shown", "WebKitErrorCannotShowMIMEType description"));
+}
+
+ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
+{
+    return ResourceError(API::Error::webKitPluginErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url(), WEB_UI_STRING("Plug-in handled load", "WebKitErrorPlugInWillHandleLoad description"));
+}
+
+ResourceError internalError(const URL& url)
+{
+    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorInternal, url, WEB_UI_STRING("WebKit encountered an internal error", "WebKitErrorInternal description"));
+}
+
+} // namespace WebKit
similarity index 77%
rename from Source/WebKit2/WebProcess/WebCoreSupport/WebErrors.h
rename to Source/WebKit2/Shared/WebErrors.h
index 84dd73e..593ea88 100644 (file)
 
 #pragma once
 
+#include <wtf/Forward.h>
+
 namespace WebCore {
-    class URL;
-    class ResourceError;
-    class ResourceRequest;
-    class ResourceResponse;
+class URL;
+class ResourceError;
+class ResourceRequest;
+class ResourceResponse;
 }
 
 namespace WebKit {
@@ -47,4 +49,16 @@ WebCore::ResourceError fileDoesNotExistError(const WebCore::ResourceResponse&);
 WebCore::ResourceError pluginWillHandleLoadError(const WebCore::ResourceResponse&);
 WebCore::ResourceError internalError(const WebCore::URL&);
 
+#if USE(SOUP)
+WebCore::ResourceError downloadNetworkError(const WebCore::URL&, const WTF::String&);
+WebCore::ResourceError downloadCancelledByUserError(const WebCore::ResourceResponse&);
+WebCore::ResourceError downloadDestinationError(const WebCore::ResourceResponse&, const WTF::String&);
+#endif
+
+#if PLATFORM(GTK)
+WebCore::ResourceError printError(const WebCore::URL&, const WTF::String&);
+WebCore::ResourceError printerNotFoundError(const WebCore::URL&);
+WebCore::ResourceError invalidPageRangeToPrint(const WebCore::URL&);
+#endif
+
 } // namespace WebKit
 #include "WebErrors.h"
 
 #include "APIError.h"
-#include <WebCore/ErrorsGtk.h>
+#include <WebCore/LocalizedStrings.h>
 #include <WebCore/ResourceError.h>
 #include <WebCore/ResourceRequest.h>
 #include <WebCore/ResourceResponse.h>
-#include <WebKit/WKErrorRef.h>
-#include <glib/gi18n-lib.h>
 
 using namespace WebCore;
 
@@ -42,47 +40,12 @@ namespace WebKit {
 
 ResourceError cancelledError(const ResourceRequest& request)
 {
-    return WebCore::cancelledError(request);
-}
-
-ResourceError blockedError(const ResourceRequest& request)
-{
-    return WebCore::blockedError(request);
-}
-
-ResourceError blockedByContentBlockerError(const ResourceRequest& request)
-{
-    return WebCore::blockedByContentBlockerError(request);
-}
-
-ResourceError cannotShowURLError(const ResourceRequest& request)
-{
-    return WebCore::cannotShowURLError(request);
-}
-
-ResourceError interruptedForPolicyChangeError(const ResourceRequest& request)
-{
-    return WebCore::interruptedForPolicyChangeError(request);
-}
-
-ResourceError cannotShowMIMETypeError(const ResourceResponse& response)
-{
-    return WebCore::cannotShowMIMETypeError(response);
+    return ResourceError(API::Error::webKitNetworkErrorDomain(), API::Error::Network::Cancelled, request.url(), WEB_UI_STRING("Load request cancelled", "Load request cancelled"));
 }
 
 ResourceError fileDoesNotExistError(const ResourceResponse& response)
 {
-    return WebCore::fileDoesNotExistError(response);
-}
-
-ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
-{
-    return WebCore::pluginWillHandleLoadError(response);
-}
-
-WebCore::ResourceError internalError(const WebCore::URL& url)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorInternal, url, _("Internal error"));
+    return ResourceError(API::Error::webKitNetworkErrorDomain(), API::Error::Network::FileDoesNotExist, response.url(), WEB_UI_STRING("File does not exist", "The requested file doesn't exist"));
 }
 
 } // namespace WebKit
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ * Copyright (C) 2017 Igalia S.L.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  */
 
 #include "config.h"
-#include "DownloadSoupErrors.h"
+#include "WebErrors.h"
 
-#include <WebCore/ErrorsGtk.h>
-#include <WebCore/ResourceError.h>
+#include "APIError.h"
+#include <WebCore/URL.h>
+#include <glib/gi18n-lib.h>
 
 using namespace WebCore;
 
 namespace WebKit {
 
-ResourceError platformDownloadNetworkError(int errorCode, const URL& failingURL, const String& localizedDescription)
+ResourceError printError(const URL& failingURL, const String& localizedDescription)
 {
-    return downloadNetworkError(ResourceError(errorDomainDownload, errorCode, failingURL, localizedDescription));
+    return ResourceError(API::Error::webKitPrintErrorDomain(), API::Error::Print::General, failingURL, localizedDescription);
 }
 
-ResourceError platformDownloadDestinationError(const ResourceResponse& response, const String& message)
+ResourceError printerNotFoundError(const URL& failingURL)
 {
-    return downloadDestinationError(response, message);
+    return ResourceError(API::Error::webKitPrintErrorDomain(), API::Error::Print::PrinterNotFound, failingURL, _("Printer not found"));
+}
+
+ResourceError invalidPageRangeToPrint(const URL& failingURL)
+{
+    return ResourceError(API::Error::webKitPrintErrorDomain(), API::Error::Print::InvalidPageRange, failingURL, _("Invalid page range"));
 }
 
 } // namespace WebKit
diff --git a/Source/WebKit2/Shared/soup/WebErrorsSoup.cpp b/Source/WebKit2/Shared/soup/WebErrorsSoup.cpp
new file mode 100644 (file)
index 0000000..d31bda2
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * 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 "WebErrors.h"
+
+#include "APIError.h"
+#include <WebCore/LocalizedStrings.h>
+#include <WebCore/ResourceError.h>
+#include <WebCore/ResourceResponse.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+ResourceError downloadNetworkError(const URL& failingURL, const String& localizedDescription)
+{
+    return ResourceError(API::Error::webKitDownloadErrorDomain(), API::Error::Download::Transport, failingURL, localizedDescription);
+}
+
+ResourceError downloadCancelledByUserError(const ResourceResponse& response)
+{
+    return ResourceError(API::Error::webKitDownloadErrorDomain(), API::Error::Download::CancelledByUser, response.url(), WEB_UI_STRING("User cancelled the download", "The download was cancelled by the user"));
+}
+
+ResourceError downloadDestinationError(const ResourceResponse& response, const String& localizedDescription)
+{
+    return ResourceError(API::Error::webKitDownloadErrorDomain(), API::Error::Download::Destination, response.url(), localizedDescription);
+}
+
+} // namespace WebKit
index d1833dd..1c45e7a 100644 (file)
 #include "WebKitDownload.h"
 
 #include "DownloadProxy.h"
+#include "WebErrors.h"
 #include "WebKitDownloadPrivate.h"
 #include "WebKitMarshal.h"
 #include "WebKitPrivate.h"
 #include "WebKitURIRequestPrivate.h"
 #include "WebKitURIResponsePrivate.h"
-#include <WebCore/ErrorsGtk.h>
 #include <WebCore/ResourceResponse.h>
 #include <glib/gi18n-lib.h>
 #include <wtf/glib/GRefPtr.h>
index 7419ee7..4426d4f 100644 (file)
@@ -22,7 +22,6 @@
 #include "WebKitError.h"
 
 #include "WebKitPrivate.h"
-#include <WebCore/ErrorsGtk.h>
 
 using namespace WebCore;
 
@@ -37,27 +36,27 @@ using namespace WebCore;
 
 GQuark webkit_network_error_quark()
 {
-    return g_quark_from_static_string(WebCore::errorDomainNetwork);
+    return g_quark_from_static_string(reinterpret_cast<const char*>(API::Error::webKitNetworkErrorDomain().characters8()));
 }
 
 GQuark webkit_policy_error_quark()
 {
-    return g_quark_from_static_string(WebCore::errorDomainPolicy);
+    return g_quark_from_static_string(reinterpret_cast<const char*>(API::Error::webKitPolicyErrorDomain().characters8()));
 }
 
 GQuark webkit_plugin_error_quark()
 {
-    return g_quark_from_static_string(WebCore::errorDomainPlugin);
+    return g_quark_from_static_string(reinterpret_cast<const char*>(API::Error::webKitPluginErrorDomain().characters8()));
 }
 
 GQuark webkit_download_error_quark()
 {
-    return g_quark_from_static_string(WebCore::errorDomainDownload);
+    return g_quark_from_static_string(reinterpret_cast<const char*>(API::Error::webKitDownloadErrorDomain().characters8()));
 }
 
 GQuark webkit_print_error_quark()
 {
-    return g_quark_from_static_string(WebCore::errorDomainPrint);
+    return g_quark_from_static_string(reinterpret_cast<const char*>(API::Error::webKitPrintErrorDomain().characters8()));
 }
 
 GQuark webkit_javascript_error_quark()
index 2c971c2..c6bcfe3 100644 (file)
@@ -20,7 +20,8 @@
 #include "config.h"
 #include "WebKitPrivate.h"
 
-#include "ErrorsGtk.h"
+#include "APIError.h"
+#include "WKErrorRef.h"
 #include "WebEvent.h"
 #include "WebKitError.h"
 #include <gdk/gdk.h>
@@ -113,49 +114,39 @@ unsigned wkEventMouseButtonToWebKitMouseButton(WKEventMouseButton wkButton)
 unsigned toWebKitError(unsigned webCoreError)
 {
     switch (webCoreError) {
-    case WebCore::NetworkErrorFailed:
-        return WEBKIT_NETWORK_ERROR_FAILED;
-    case WebCore::NetworkErrorTransport:
-        return WEBKIT_NETWORK_ERROR_TRANSPORT;
-    case WebCore::NetworkErrorUnknownProtocol:
-        return WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL;
-    case WebCore::NetworkErrorCancelled:
+    case API::Error::Network::Cancelled:
         return WEBKIT_NETWORK_ERROR_CANCELLED;
-    case WebCore::NetworkErrorFileDoesNotExist:
+    case API::Error::Network::FileDoesNotExist:
         return WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST;
-    case WebCore::PolicyErrorFailed:
-        return WEBKIT_POLICY_ERROR_FAILED;
-    case WebCore::PolicyErrorCannotShowMimeType:
+    case kWKErrorCodeCannotShowMIMEType:
         return WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE;
-    case WebCore::PolicyErrorCannotShowURL:
+    case kWKErrorCodeCannotShowURL:
         return WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI;
-    case WebCore::PolicyErrorFrameLoadInterruptedByPolicyChange:
+    case kWKErrorCodeFrameLoadInterruptedByPolicyChange:
         return WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE;
-    case WebCore::PolicyErrorCannotUseRestrictedPort:
+    case kWKErrorCodeCannotUseRestrictedPort:
         return WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT;
-    case WebCore::PluginErrorFailed:
-        return WEBKIT_PLUGIN_ERROR_FAILED;
-    case WebCore::PluginErrorCannotFindPlugin:
+    case kWKErrorCodeCannotFindPlugIn:
         return WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN;
-    case WebCore::PluginErrorCannotLoadPlugin:
+    case kWKErrorCodeCannotLoadPlugIn:
         return WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN;
-    case WebCore::PluginErrorJavaUnavailable:
+    case kWKErrorCodeJavaUnavailable:
         return WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE;
-    case WebCore::PluginErrorConnectionCancelled:
+    case kWKErrorCodePlugInCancelledConnection:
         return WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED;
-    case WebCore::PluginErrorWillHandleLoad:
+    case kWKErrorCodePlugInWillHandleLoad:
         return WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD;
-    case WebCore::DownloadErrorNetwork:
+    case API::Error::Download::Transport:
         return WEBKIT_DOWNLOAD_ERROR_NETWORK;
-    case WebCore::DownloadErrorCancelledByUser:
+    case API::Error::Download::CancelledByUser:
         return WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER;
-    case WebCore::DownloadErrorDestination:
+    case API::Error::Download::Destination:
         return WEBKIT_DOWNLOAD_ERROR_DESTINATION;
-    case WebCore::PrintErrorGeneral:
+    case API::Error::Print::General:
         return WEBKIT_PRINT_ERROR_GENERAL;
-    case WebCore::PrintErrorPrinterNotFound:
+    case API::Error::Print::PrinterNotFound:
         return WEBKIT_PRINT_ERROR_PRINTER_NOT_FOUND;
-    case WebCore::PrintErrorInvalidPageRange:
+    case API::Error::Print::InvalidPageRange:
         return WEBKIT_PRINT_ERROR_INVALID_PAGE_RANGE;
     default:
         // This may be a user app defined error, which needs to be passed as-is.
@@ -166,50 +157,40 @@ unsigned toWebKitError(unsigned webCoreError)
 unsigned toWebCoreError(unsigned webKitError)
 {
     switch (webKitError) {
-    case WEBKIT_NETWORK_ERROR_FAILED:
-        return WebCore::NetworkErrorFailed;
-    case WEBKIT_NETWORK_ERROR_TRANSPORT:
-        return WebCore::NetworkErrorTransport;
-    case WEBKIT_NETWORK_ERROR_UNKNOWN_PROTOCOL:
-        return WebCore::NetworkErrorUnknownProtocol;
     case WEBKIT_NETWORK_ERROR_CANCELLED:
-        return WebCore::NetworkErrorCancelled;
+        return API::Error::Network::Cancelled;
     case WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST:
-        return WebCore::NetworkErrorFileDoesNotExist;
-    case WEBKIT_POLICY_ERROR_FAILED:
-        return WebCore::PolicyErrorFailed;
+        return API::Error::Network::FileDoesNotExist;
     case WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE:
-        return WebCore::PolicyErrorCannotShowMimeType;
+        return kWKErrorCodeCannotShowMIMEType;
     case WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI:
-        return WebCore::PolicyErrorCannotShowURL;
+        return kWKErrorCodeCannotShowURL;
     case WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
-        return WebCore::PolicyErrorFrameLoadInterruptedByPolicyChange;
+        return kWKErrorCodeFrameLoadInterruptedByPolicyChange;
     case WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT:
-        return WebCore::PolicyErrorCannotUseRestrictedPort;
-    case WEBKIT_PLUGIN_ERROR_FAILED:
-        return WebCore::PluginErrorFailed;
+        return kWKErrorCodeCannotUseRestrictedPort;
     case WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN:
-        return WebCore::PluginErrorCannotFindPlugin;
+        return kWKErrorCodeCannotFindPlugIn;
     case WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN:
-        return WebCore::PluginErrorCannotLoadPlugin;
+        return kWKErrorCodeCannotLoadPlugIn;
     case WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE:
-        return WebCore::PluginErrorJavaUnavailable;
+        return kWKErrorCodeJavaUnavailable;
     case WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED:
-        return WebCore::PluginErrorConnectionCancelled;
+        return kWKErrorCodePlugInCancelledConnection;
     case WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD:
-        return WebCore::PluginErrorWillHandleLoad;
+        return kWKErrorCodePlugInWillHandleLoad;
     case WEBKIT_DOWNLOAD_ERROR_NETWORK:
-        return WebCore::DownloadErrorNetwork;
+        return API::Error::Download::Transport;
     case WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER:
-        return WebCore::DownloadErrorCancelledByUser;
+        return API::Error::Download::CancelledByUser;
     case WEBKIT_DOWNLOAD_ERROR_DESTINATION:
-        return WebCore::DownloadErrorDestination;
+        return API::Error::Download::Destination;
     case WEBKIT_PRINT_ERROR_GENERAL:
-        return WebCore::PrintErrorGeneral;
+        return API::Error::Print::General;
     case WEBKIT_PRINT_ERROR_PRINTER_NOT_FOUND:
-        return WebCore::PrintErrorPrinterNotFound;
+        return API::Error::Print::PrinterNotFound;
     case WEBKIT_PRINT_ERROR_INVALID_PAGE_RANGE:
-        return WebCore::PrintErrorInvalidPageRange;
+        return API::Error::Print::InvalidPageRange;
     default:
         // This may be a user app defined error, which needs to be passed as-is.
         return webKitError;
index 8dd9e76..7f31f80 100644 (file)
                1A3EED0F161A535400AEB4F5 /* MessageReceiverMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */; };
                1A3EED12161A53D600AEB4F5 /* MessageReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A3EED11161A53D600AEB4F5 /* MessageReceiver.h */; };
                1A422F8B18B29B5400D8CD96 /* WKHistoryDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A422F8A18B29B5400D8CD96 /* WKHistoryDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               1A433F0D113C53DD00FACDE9 /* WebErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A433F0C113C53DD00FACDE9 /* WebErrors.h */; };
                1A43E829188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A43E827188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm */; };
                1A43E82A188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A43E828188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1A445B9F184D5FB5004B3414 /* WKContextInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A445B9E184D5FB5004B3414 /* WKContextInjectedBundleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7A821F4C1E2F673900604577 /* LegacyCustomProtocolManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A821F4B1E2F664800604577 /* LegacyCustomProtocolManagerClient.h */; };
                7A821F4E1E2F67A800604577 /* LegacyCustomProtocolManagerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7A821F4D1E2F679E00604577 /* LegacyCustomProtocolManagerClient.mm */; };
                7A821F501E2F7A7500604577 /* APICustomProtocolManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */; };
+               7AF236201E79A3E400438A05 /* WebErrors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF2361E1E79A3B400438A05 /* WebErrors.cpp */; };
+               7AF236211E79A40800438A05 /* WebErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF2361F1E79A3D800438A05 /* WebErrors.h */; };
+               7AF236231E79A44400438A05 /* WebErrorsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7AF236221E79A43100438A05 /* WebErrorsCocoa.mm */; };
                7C065F2B1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C065F291C8CD95F00C2D950 /* WebUserContentControllerDataTypes.cpp */; };
                7C065F2C1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C065F2A1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h */; };
                7C135AA8173B0BCA00586AE2 /* WKPluginInformation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C135AA6173B0BCA00586AE2 /* WKPluginInformation.cpp */; };
                BC111A5F112F4FBB00337BAB /* WebFrameLoaderClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111A58112F4FBB00337BAB /* WebFrameLoaderClient.cpp */; };
                BC111A60112F4FBB00337BAB /* WebInspectorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111A59112F4FBB00337BAB /* WebInspectorClient.cpp */; };
                BC111ADD112F5B9300337BAB /* WebFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111ADC112F5B9300337BAB /* WebFrame.cpp */; };
-               BC111AE0112F5BC200337BAB /* WebErrorsMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */; };
                BC111AE4112F5C2600337BAB /* WebProcess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111AE3112F5C2600337BAB /* WebProcess.cpp */; };
                BC111B09112F5E3C00337BAB /* ResponsivenessTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */; };
                BC111B0E112F5E4F00337BAB /* WebFrameProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC111B0A112F5E4F00337BAB /* WebFrameProxy.cpp */; };
                1A3EED0D161A535300AEB4F5 /* MessageReceiverMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageReceiverMap.h; sourceTree = "<group>"; };
                1A3EED11161A53D600AEB4F5 /* MessageReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageReceiver.h; sourceTree = "<group>"; };
                1A422F8A18B29B5400D8CD96 /* WKHistoryDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKHistoryDelegatePrivate.h; sourceTree = "<group>"; };
-               1A433F0C113C53DD00FACDE9 /* WebErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebErrors.h; sourceTree = "<group>"; };
                1A43E827188F3CDC009E4D30 /* _WKProcessPoolConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKProcessPoolConfiguration.mm; sourceTree = "<group>"; };
                1A43E828188F3CDC009E4D30 /* _WKProcessPoolConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKProcessPoolConfiguration.h; sourceTree = "<group>"; };
                1A445B9E184D5FB5004B3414 /* WKContextInjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextInjectedBundleClient.h; sourceTree = "<group>"; };
                7A9CD8C01C77984900D9F6C7 /* WebResourceLoadStatisticsStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadStatisticsStore.cpp; sourceTree = "<group>"; };
                7A9CD8C11C77984900D9F6C7 /* WebResourceLoadStatisticsStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsStore.h; sourceTree = "<group>"; };
                7A9CD8C21C779AD600D9F6C7 /* WebResourceLoadStatisticsStore.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebResourceLoadStatisticsStore.messages.in; sourceTree = "<group>"; };
+               7AF2361E1E79A3B400438A05 /* WebErrors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebErrors.cpp; sourceTree = "<group>"; };
+               7AF2361F1E79A3D800438A05 /* WebErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebErrors.h; sourceTree = "<group>"; };
+               7AF236221E79A43100438A05 /* WebErrorsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebErrorsCocoa.mm; sourceTree = "<group>"; };
                7C065F291C8CD95F00C2D950 /* WebUserContentControllerDataTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUserContentControllerDataTypes.cpp; sourceTree = "<group>"; };
                7C065F2A1C8CD95F00C2D950 /* WebUserContentControllerDataTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUserContentControllerDataTypes.h; sourceTree = "<group>"; };
                7C0BB9A818DCDE890006C086 /* WebContent-iOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "WebContent-iOS.entitlements"; sourceTree = "<group>"; };
                BC111A58112F4FBB00337BAB /* WebFrameLoaderClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameLoaderClient.cpp; sourceTree = "<group>"; wrapsLines = 0; };
                BC111A59112F4FBB00337BAB /* WebInspectorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebInspectorClient.cpp; sourceTree = "<group>"; };
                BC111ADC112F5B9300337BAB /* WebFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrame.cpp; sourceTree = "<group>"; };
-               BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebErrorsMac.mm; sourceTree = "<group>"; };
                BC111AE3112F5C2600337BAB /* WebProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcess.cpp; sourceTree = "<group>"; };
                BC111B08112F5E3C00337BAB /* ResponsivenessTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimer.cpp; sourceTree = "<group>"; };
                BC111B0A112F5E4F00337BAB /* WebFrameProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameProxy.cpp; sourceTree = "<group>"; };
                                510FBB991288C95E00AFFDF4 /* WebContextMenuItemData.h */,
                                939AE7651316E99C00AE06A6 /* WebCoreArgumentCoders.cpp */,
                                BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */,
+                               7AF2361E1E79A3B400438A05 /* WebErrors.cpp */,
+                               7AF2361F1E79A3D800438A05 /* WebErrors.h */,
                                C0337DAD127A24FE008FF4F4 /* WebEvent.cpp */,
                                BC032DAF10F4380F0058C15A /* WebEvent.h */,
                                BC032DB010F4380F0058C15A /* WebEventConversion.cpp */,
                                37BF2F051947DEB400723C48 /* WKNSURLRequest.mm */,
                                378E1A3F181EDA010031007A /* WKObject.h */,
                                374436871820E7240049579F /* WKObject.mm */,
+                               7AF236221E79A43100438A05 /* WebErrorsCocoa.mm */,
                        );
                        name = cocoa;
                        path = Cocoa;
                                BC032D6610F4378D0058C15A /* WebDragClient.h */,
                                BC111A57112F4FBB00337BAB /* WebEditorClient.cpp */,
                                BC032D6810F4378D0058C15A /* WebEditorClient.h */,
-                               1A433F0C113C53DD00FACDE9 /* WebErrors.h */,
                                BC111A58112F4FBB00337BAB /* WebFrameLoaderClient.cpp */,
                                BC032D6A10F4378D0058C15A /* WebFrameLoaderClient.h */,
                                BC1BE1DF12D54A410004A228 /* WebGeolocationClient.cpp */,
                                51021E9B12B16788005C033C /* WebContextMenuClientMac.mm */,
                                C554FFA212E4E8EA002F22C0 /* WebDragClientMac.mm */,
                                C5237F5F12441CA300780472 /* WebEditorClientMac.mm */,
-                               BC111ADF112F5BC200337BAB /* WebErrorsMac.mm */,
                                9391F283121B38F500EBF7E8 /* WebFrameNetworkingContext.h */,
                                9391F284121B38F500EBF7E8 /* WebFrameNetworkingContext.mm */,
                                BCC43AC6127B99DE00317F16 /* WebPopupMenuMac.mm */,
                                BC032D7B10F4378D0058C15A /* WebDragClient.h in Headers */,
                                BCA0EF9F12332642007D3CFB /* WebEditCommandProxy.h in Headers */,
                                BC032D7D10F4378D0058C15A /* WebEditorClient.h in Headers */,
-                               1A433F0D113C53DD00FACDE9 /* WebErrors.h in Headers */,
                                BC032DB910F4380F0058C15A /* WebEvent.h in Headers */,
                                BC032DBB10F4380F0058C15A /* WebEventConversion.h in Headers */,
                                BC111B5D112F629800337BAB /* WebEventFactory.h in Headers */,
                                7C2413091AACFCB400A58C15 /* WKUserContentExtensionStoreRef.h in Headers */,
                                377EAD4817E2C77B002D193D /* WKUserContentInjectedFrames.h in Headers */,
                                F6113E29126CE19B0057D0A7 /* WKUserContentURLPattern.h in Headers */,
+                               7AF236211E79A40800438A05 /* WebErrors.h in Headers */,
                                07297FA31C186ADB003F0735 /* WKUserMediaPermissionCheck.h in Headers */,
                                4A3CC18F19B07B8A00D14AEF /* WKUserMediaPermissionRequest.h in Headers */,
                                1AAF089B19267EE500B6390C /* WKUserScript.h in Headers */,
                                BC111A5E112F4FBB00337BAB /* WebEditorClient.cpp in Sources */,
                                2D28F3E61885CCC1004B9EAE /* WebEditorClientIOS.mm in Sources */,
                                C5237F6012441CA300780472 /* WebEditorClientMac.mm in Sources */,
-                               BC111AE0112F5BC200337BAB /* WebErrorsMac.mm in Sources */,
                                C0337DAE127A24FE008FF4F4 /* WebEvent.cpp in Sources */,
                                BC032DBA10F4380F0058C15A /* WebEventConversion.cpp in Sources */,
                                BC111B5E112F629800337BAB /* WebEventFactory.mm in Sources */,
                                CD73BA4E131ACDB700EEDED2 /* WebFullScreenManagerMessageReceiver.cpp in Sources */,
                                CD6F75F4131B66D000D6B21E /* WebFullScreenManagerProxy.cpp in Sources */,
                                CD73BA47131ACC9A00EEDED2 /* WebFullScreenManagerProxyMessageReceiver.cpp in Sources */,
+                               7AF236231E79A44400438A05 /* WebErrorsCocoa.mm in Sources */,
                                515BE1AA1D555A9B00DD7C68 /* WebGamepad.cpp in Sources */,
                                515BE1771D53FE8700DD7C68 /* WebGamepadProvider.cpp in Sources */,
                                BC1BE1E112D54A410004A228 /* WebGeolocationClient.cpp in Sources */,
                                BC407609124FF0270068F20A /* WKURL.cpp in Sources */,
                                BC40761B124FF0370068F20A /* WKURLCF.mm in Sources */,
                                BC40760B124FF0270068F20A /* WKURLRequest.cpp in Sources */,
+                               7AF236201E79A3E400438A05 /* WebErrors.cpp in Sources */,
                                BC40762A124FF0400068F20A /* WKURLRequestNS.mm in Sources */,
                                BC40760D124FF0270068F20A /* WKURLResponse.cpp in Sources */,
                                BC40762C124FF0400068F20A /* WKURLResponseNS.mm in Sources */,
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm
deleted file mode 100644 (file)
index 1f171e8..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2010-2016 Apple Inc. 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.
- */
-
-#import "config.h"
-#import "WebErrors.h"
-
-#import "APIError.h"
-#import "WKErrorRef.h"
-#import <WebCore/LocalizedStrings.h>
-#import <WebCore/ResourceRequest.h>
-#import <WebCore/ResourceResponse.h>
-
-using namespace WebCore;
-using namespace WebKit;
-
-namespace WebKit {
-
-static RetainPtr<NSError> createNSError(NSString* domain, int code, NSURL *URL)
-{
-    NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
-        URL, @"NSErrorFailingURLKey",
-        [URL absoluteString], @"NSErrorFailingURLStringKey",
-        nil];
-
-    return adoptNS([[NSError alloc] initWithDomain:domain code:code userInfo:userInfo]);
-}
-
-// Use NSError's if available.
-
-ResourceError cancelledError(const ResourceRequest& request)
-{
-    return ResourceError(createNSError(NSURLErrorDomain, NSURLErrorCancelled, request.url()).get());
-}
-
-ResourceError fileDoesNotExistError(const ResourceResponse& response)
-{
-    return ResourceError(createNSError(NSURLErrorDomain, NSURLErrorFileDoesNotExist, response.url()).get());
-}
-
-
-// Otherwise, fallback to our own errors.
-
-ResourceError blockedError(const ResourceRequest& request)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url(), WEB_UI_STRING("Not allowed to use restricted network port", "WebKitErrorCannotUseRestrictedPort description"));
-}
-
-ResourceError blockedByContentBlockerError(const ResourceRequest& request)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentBlocker, request.url(), WEB_UI_STRING("The URL was blocked by a content blocker", "WebKitErrorBlockedByContentBlocker description"));
-}
-
-ResourceError cannotShowURLError(const ResourceRequest& request)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeCannotShowURL, request.url(), WEB_UI_STRING("The URL can’t be shown", "WebKitErrorCannotShowURL description"));
-}
-
-ResourceError interruptedForPolicyChangeError(const ResourceRequest& request)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url(), WEB_UI_STRING("Frame load interrupted", "WebKitErrorFrameLoadInterruptedByPolicyChange description"));
-}
-
-#if ENABLE(CONTENT_FILTERING)
-ResourceError blockedByContentFilterError(const ResourceRequest& request)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentFilter, request.url(), WEB_UI_STRING("The URL was blocked by a content filter", "WebKitErrorFrameLoadBlockedByContentFilter description"));
-}
-#endif
-
-ResourceError cannotShowMIMETypeError(const ResourceResponse& response)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodeCannotShowMIMEType, response.url(), WEB_UI_STRING("Content with specified MIME type can’t be shown", "WebKitErrorCannotShowMIMEType description"));
-}
-
-ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url(), WEB_UI_STRING("Plug-in handled load", "WebKitErrorPlugInWillHandleLoad description"));
-}
-
-ResourceError internalError(const URL& url)
-{
-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorInternal, url, WEB_UI_STRING("WebKit encountered an internal error", "WebKitErrorInternal description"));
-}
-
-} // namespace WebKit
index fdd4193..1a5e102 100644 (file)
 #include "WebPrintOperationGtk.h"
 
 #include "WebCoreArgumentCoders.h"
+#include "WebErrors.h"
 #include "WebPage.h"
 #include "WebPageProxyMessages.h"
 #include "WebProcess.h"
 #include <WebCore/DocumentLoader.h>
-#include <WebCore/ErrorsGtk.h>
 #include <WebCore/Frame.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/NotImplemented.h>