<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[218244] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/218244">218244</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2017-06-13 23:31:11 -0700 (Tue, 13 Jun 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Do not mix C and C++ API error constants
https://bugs.webkit.org/show_bug.cgi?id=173311

Reviewed by Alex Christensen.

In <a href="http://trac.webkit.org/projects/webkit/changeset/214934">r214934</a> I added error constants to API::Error, but not for all errors exposed in the C API. Because of this
we are mixing both constants in WebErrors and in GTk+ WebKitPrivate.

* Shared/API/APIError.h:
* Shared/WebErrors.cpp:
(WebKit::blockedError):
(WebKit::blockedByContentBlockerError):
(WebKit::cannotShowURLError):
(WebKit::interruptedForPolicyChangeError):
(WebKit::blockedByContentFilterError):
(WebKit::cannotShowMIMETypeError):
(WebKit::pluginWillHandleLoadError):
(WebKit::internalError):
* UIProcess/API/gtk/WebKitPrivate.cpp:
(toWebKitError):
(toWebCoreError):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIAPIErrorh">trunk/Source/WebKit2/Shared/API/APIError.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebErrorscpp">trunk/Source/WebKit2/Shared/WebErrors.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitPrivatecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (218243 => 218244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog   2017-06-14 04:55:04 UTC (rev 218243)
+++ trunk/Source/WebKit2/ChangeLog      2017-06-14 06:31:11 UTC (rev 218244)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2017-06-13  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Do not mix C and C++ API error constants
+        https://bugs.webkit.org/show_bug.cgi?id=173311
+
+        Reviewed by Alex Christensen.
+
+        In r214934 I added error constants to API::Error, but not for all errors exposed in the C API. Because of this
+        we are mixing both constants in WebErrors and in GTk+ WebKitPrivate.
+
+        * Shared/API/APIError.h:
+        * Shared/WebErrors.cpp:
+        (WebKit::blockedError):
+        (WebKit::blockedByContentBlockerError):
+        (WebKit::cannotShowURLError):
+        (WebKit::interruptedForPolicyChangeError):
+        (WebKit::blockedByContentFilterError):
+        (WebKit::cannotShowMIMETypeError):
+        (WebKit::pluginWillHandleLoadError):
+        (WebKit::internalError):
+        * UIProcess/API/gtk/WebKitPrivate.cpp:
+        (toWebKitError):
+        (toWebCoreError):
+
</ins><span class="cx"> 2017-06-13  Matt Rajca  <mrajca@apple.com>
</span><span class="cx"> 
</span><span class="cx">         WebsitePolicies: let clients select specific autoplay quirks
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIAPIErrorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/APIError.h (218243 => 218244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/APIError.h       2017-06-14 04:55:04 UTC (rev 218243)
+++ trunk/Source/WebKit2/Shared/API/APIError.h  2017-06-14 06:31:11 UTC (rev 218244)
</span><span class="lines">@@ -48,21 +48,55 @@
</span><span class="cx">         return adoptRef(*new Error(error));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    enum General {
+        Internal = 300
+    };
</ins><span class="cx">     static const WTF::String& webKitErrorDomain();
</span><del>-    enum Network { Cancelled = 302, FileDoesNotExist = 303 };
</del><ins>+
+    enum Network {
+        Cancelled = 302,
+        FileDoesNotExist = 303
+    };
</ins><span class="cx">     static const WTF::String& webKitNetworkErrorDomain();
</span><ins>+
+    enum Policy {
+        CannotShowMIMEType = 100,
+        CannotShowURL = 101,
+        FrameLoadInterruptedByPolicyChange = 102,
+        CannotUseRestrictedPort = 103,
+        FrameLoadBlockedByContentBlocker = 104,
+        FrameLoadBlockedByContentFilter = 105
+    };
</ins><span class="cx">     static const WTF::String& webKitPolicyErrorDomain();
</span><ins>+
+    enum Plugin {
+        CannotFindPlugIn = 200,
+        CannotLoadPlugIn = 201,
+        JavaUnavailable = 202,
+        PlugInCancelledConnection = 203,
+        PlugInWillHandleLoad = 204,
+        InsecurePlugInVersion = 205
+    };
</ins><span class="cx">     static const WTF::String& webKitPluginErrorDomain();
</span><ins>+
</ins><span class="cx"> #if USE(SOUP)
</span><del>-    enum Download { Transport = 499, CancelledByUser = 400, Destination = 401 };
</del><ins>+    enum Download {
+        Transport = 499,
+        CancelledByUser = 400,
+        Destination = 401
+    };
</ins><span class="cx">     static const WTF::String& webKitDownloadErrorDomain();
</span><span class="cx"> #endif
</span><ins>+
</ins><span class="cx"> #if PLATFORM(GTK)
</span><del>-    enum Print { General = 599, PrinterNotFound = 500, InvalidPageRange = 501 };
</del><ins>+    enum Print {
+        General = 599,
+        PrinterNotFound = 500,
+        InvalidPageRange = 501
+    };
</ins><span class="cx">     static const WTF::String& webKitPrintErrorDomain();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-
</del><span class="cx">     const WTF::String& domain() const { return m_platformError.domain(); }
</span><span class="cx">     int errorCode() const { return m_platformError.errorCode(); }
</span><span class="cx">     const WTF::String& failingURL() const { return m_platformError.failingURL(); }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebErrorscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebErrors.cpp (218243 => 218244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebErrors.cpp        2017-06-14 04:55:04 UTC (rev 218243)
+++ trunk/Source/WebKit2/Shared/WebErrors.cpp   2017-06-14 06:31:11 UTC (rev 218244)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> #include "WebErrors.h"
</span><span class="cx"> 
</span><span class="cx"> #include "APIError.h"
</span><del>-#include "WKErrorRef.h"
</del><span class="cx"> #include <WebCore/LocalizedStrings.h>
</span><span class="cx"> #include <WebCore/ResourceRequest.h>
</span><span class="cx"> #include <WebCore/ResourceResponse.h>
</span><span class="lines">@@ -38,44 +37,44 @@
</span><span class="cx"> 
</span><span class="cx"> ResourceError blockedError(const ResourceRequest& request)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeCannotUseRestrictedPort, request.url(), WEB_UI_STRING("Not allowed to use restricted network port", "WebKitErrorCannotUseRestrictedPort description"));
</del><ins>+    return ResourceError(API::Error::webKitPolicyErrorDomain(), API::Error::Policy::CannotUseRestrictedPort, request.url(), WEB_UI_STRING("Not allowed to use restricted network port", "WebKitErrorCannotUseRestrictedPort description"));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ResourceError blockedByContentBlockerError(const ResourceRequest& request)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentBlocker, request.url(), WEB_UI_STRING("The URL was blocked by a content blocker", "WebKitErrorBlockedByContentBlocker description"));
</del><ins>+    return ResourceError(API::Error::webKitPolicyErrorDomain(), API::Error::Policy::FrameLoadBlockedByContentBlocker, request.url(), WEB_UI_STRING("The URL was blocked by a content blocker", "WebKitErrorBlockedByContentBlocker description"));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ResourceError cannotShowURLError(const ResourceRequest& request)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeCannotShowURL, request.url(), WEB_UI_STRING("The URL can’t be shown", "WebKitErrorCannotShowURL description"));
</del><ins>+    return ResourceError(API::Error::webKitPolicyErrorDomain(), API::Error::Policy::CannotShowURL, request.url(), WEB_UI_STRING("The URL can’t be shown", "WebKitErrorCannotShowURL description"));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ResourceError interruptedForPolicyChangeError(const ResourceRequest& request)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeFrameLoadInterruptedByPolicyChange, request.url(), WEB_UI_STRING("Frame load interrupted", "WebKitErrorFrameLoadInterruptedByPolicyChange description"));
</del><ins>+    return ResourceError(API::Error::webKitPolicyErrorDomain(), API::Error::Policy::FrameLoadInterruptedByPolicyChange, request.url(), WEB_UI_STRING("Frame load interrupted", "WebKitErrorFrameLoadInterruptedByPolicyChange description"));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CONTENT_FILTERING)
</span><span class="cx"> ResourceError blockedByContentFilterError(const ResourceRequest& request)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeFrameLoadBlockedByContentFilter, request.url(), WEB_UI_STRING("The URL was blocked by a content filter", "WebKitErrorFrameLoadBlockedByContentFilter description"));
</del><ins>+    return ResourceError(API::Error::webKitPolicyErrorDomain(), API::Error::Policy::FrameLoadBlockedByContentFilter, request.url(), WEB_UI_STRING("The URL was blocked by a content filter", "WebKitErrorFrameLoadBlockedByContentFilter description"));
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> ResourceError cannotShowMIMETypeError(const ResourceResponse& response)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitPolicyErrorDomain(), kWKErrorCodeCannotShowMIMEType, response.url(), WEB_UI_STRING("Content with specified MIME type can’t be shown", "WebKitErrorCannotShowMIMEType description"));
</del><ins>+    return ResourceError(API::Error::webKitPolicyErrorDomain(), API::Error::Policy::CannotShowMIMEType, response.url(), WEB_UI_STRING("Content with specified MIME type can’t be shown", "WebKitErrorCannotShowMIMEType description"));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ResourceError pluginWillHandleLoadError(const ResourceResponse& response)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitPluginErrorDomain(), kWKErrorCodePlugInWillHandleLoad, response.url(), WEB_UI_STRING("Plug-in handled load", "WebKitErrorPlugInWillHandleLoad description"));
</del><ins>+    return ResourceError(API::Error::webKitPluginErrorDomain(), API::Error::Plugin::PlugInWillHandleLoad, response.url(), WEB_UI_STRING("Plug-in handled load", "WebKitErrorPlugInWillHandleLoad description"));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ResourceError internalError(const URL& url)
</span><span class="cx"> {
</span><del>-    return ResourceError(API::Error::webKitErrorDomain(), kWKErrorInternal, url, WEB_UI_STRING("WebKit encountered an internal error", "WebKitErrorInternal description"));
</del><ins>+    return ResourceError(API::Error::webKitErrorDomain(), API::Error::General::Internal, url, WEB_UI_STRING("WebKit encountered an internal error", "WebKitErrorInternal description"));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitPrivatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp (218243 => 218244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp 2017-06-14 04:55:04 UTC (rev 218243)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.cpp    2017-06-14 06:31:11 UTC (rev 218244)
</span><span class="lines">@@ -21,7 +21,6 @@
</span><span class="cx"> #include "WebKitPrivate.h"
</span><span class="cx"> 
</span><span class="cx"> #include "APIError.h"
</span><del>-#include "WKErrorRef.h"
</del><span class="cx"> #include "WebEvent.h"
</span><span class="cx"> #include "WebKitError.h"
</span><span class="cx"> #include <gdk/gdk.h>
</span><span class="lines">@@ -86,23 +85,23 @@
</span><span class="cx">         return WEBKIT_NETWORK_ERROR_CANCELLED;
</span><span class="cx">     case API::Error::Network::FileDoesNotExist:
</span><span class="cx">         return WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST;
</span><del>-    case kWKErrorCodeCannotShowMIMEType:
</del><ins>+    case API::Error::Policy::CannotShowMIMEType:
</ins><span class="cx">         return WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE;
</span><del>-    case kWKErrorCodeCannotShowURL:
</del><ins>+    case API::Error::Policy::CannotShowURL:
</ins><span class="cx">         return WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI;
</span><del>-    case kWKErrorCodeFrameLoadInterruptedByPolicyChange:
</del><ins>+    case API::Error::Policy::FrameLoadInterruptedByPolicyChange:
</ins><span class="cx">         return WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE;
</span><del>-    case kWKErrorCodeCannotUseRestrictedPort:
</del><ins>+    case API::Error::Policy::CannotUseRestrictedPort:
</ins><span class="cx">         return WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT;
</span><del>-    case kWKErrorCodeCannotFindPlugIn:
</del><ins>+    case API::Error::Plugin::CannotFindPlugIn:
</ins><span class="cx">         return WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN;
</span><del>-    case kWKErrorCodeCannotLoadPlugIn:
</del><ins>+    case API::Error::Plugin::CannotLoadPlugIn:
</ins><span class="cx">         return WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN;
</span><del>-    case kWKErrorCodeJavaUnavailable:
</del><ins>+    case API::Error::Plugin::JavaUnavailable:
</ins><span class="cx">         return WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE;
</span><del>-    case kWKErrorCodePlugInCancelledConnection:
</del><ins>+    case API::Error::Plugin::PlugInCancelledConnection:
</ins><span class="cx">         return WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED;
</span><del>-    case kWKErrorCodePlugInWillHandleLoad:
</del><ins>+    case API::Error::Plugin::PlugInWillHandleLoad:
</ins><span class="cx">         return WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD;
</span><span class="cx">     case API::Error::Download::Transport:
</span><span class="cx">         return WEBKIT_DOWNLOAD_ERROR_NETWORK;
</span><span class="lines">@@ -130,23 +129,23 @@
</span><span class="cx">     case WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST:
</span><span class="cx">         return API::Error::Network::FileDoesNotExist;
</span><span class="cx">     case WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE:
</span><del>-        return kWKErrorCodeCannotShowMIMEType;
</del><ins>+        return API::Error::Policy::CannotShowMIMEType;
</ins><span class="cx">     case WEBKIT_POLICY_ERROR_CANNOT_SHOW_URI:
</span><del>-        return kWKErrorCodeCannotShowURL;
</del><ins>+        return API::Error::Policy::CannotShowURL;
</ins><span class="cx">     case WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE:
</span><del>-        return kWKErrorCodeFrameLoadInterruptedByPolicyChange;
</del><ins>+        return API::Error::Policy::FrameLoadInterruptedByPolicyChange;
</ins><span class="cx">     case WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT:
</span><del>-        return kWKErrorCodeCannotUseRestrictedPort;
</del><ins>+        return API::Error::Policy::CannotUseRestrictedPort;
</ins><span class="cx">     case WEBKIT_PLUGIN_ERROR_CANNOT_FIND_PLUGIN:
</span><del>-        return kWKErrorCodeCannotFindPlugIn;
</del><ins>+        return API::Error::Plugin::CannotFindPlugIn;
</ins><span class="cx">     case WEBKIT_PLUGIN_ERROR_CANNOT_LOAD_PLUGIN:
</span><del>-        return kWKErrorCodeCannotLoadPlugIn;
</del><ins>+        return API::Error::Plugin::CannotLoadPlugIn;
</ins><span class="cx">     case WEBKIT_PLUGIN_ERROR_JAVA_UNAVAILABLE:
</span><del>-        return kWKErrorCodeJavaUnavailable;
</del><ins>+        return API::Error::Plugin::JavaUnavailable;
</ins><span class="cx">     case WEBKIT_PLUGIN_ERROR_CONNECTION_CANCELLED:
</span><del>-        return kWKErrorCodePlugInCancelledConnection;
</del><ins>+        return API::Error::Plugin::PlugInCancelledConnection;
</ins><span class="cx">     case WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD:
</span><del>-        return kWKErrorCodePlugInWillHandleLoad;
</del><ins>+        return API::Error::Plugin::PlugInWillHandleLoad;
</ins><span class="cx">     case WEBKIT_DOWNLOAD_ERROR_NETWORK:
</span><span class="cx">         return API::Error::Download::Transport;
</span><span class="cx">     case WEBKIT_DOWNLOAD_ERROR_CANCELLED_BY_USER:
</span></span></pre>
</div>
</div>

</body>
</html>