Changeset 42866 in webkit
- Timestamp:
- Apr 25, 2009 2:19:42 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r42865 r42866 1 2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org> 2 3 Reviewed by Xan Lopez. 4 5 [GTK] Error reporting 6 https://bugs.webkit.org/show_bug.cgi?id=18344 7 8 Add webkiterror to the build. 9 10 * GNUmakefile.am: 11 1 12 2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org> 2 13 -
trunk/GNUmakefile.am
r42865 r42866 316 316 WebKit/gtk/webkit/webkitdefines.h \ 317 317 WebKit/gtk/webkit/webkitdownload.h \ 318 WebKit/gtk/webkit/webkiterror.h \ 318 319 WebKit/gtk/webkit/webkitnetworkrequest.h \ 319 320 WebKit/gtk/webkit/webkitsoupauthdialog.h \ … … 350 351 WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp \ 351 352 WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h \ 353 WebKit/gtk/webkit/webkitdownload.cpp \ 354 WebKit/gtk/webkit/webkiterror.cpp \ 352 355 WebKit/gtk/webkit/webkitnetworkrequest.cpp \ 353 356 WebKit/gtk/webkit/webkitprivate.cpp \ … … 362 365 WebKit/gtk/webkit/webkitwebpolicydecision.cpp \ 363 366 WebKit/gtk/webkit/webkitwebsettings.cpp \ 364 WebKit/gtk/webkit/webkitdownload.cpp \365 367 WebKit/gtk/webkit/webkitwebview.cpp \ 366 368 WebKit/gtk/webkit/webkitwebwindowfeatures.cpp -
trunk/WebCore/ChangeLog
r42861 r42866 1 2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org> 2 3 Reviewed by Xan Lopez. 4 5 [GTK] Error reporting 6 https://bugs.webkit.org/show_bug.cgi?id=18344 7 8 Fix the SOUP resource handle to report SOUP_HTTP_ERROR for Soup 9 errors and G_IO_ERROR for gio errors. 10 11 * platform/network/soup/ResourceHandleSoup.cpp: 12 (WebCore::finishedCallback): 13 (WebCore::ResourceHandle::startHttp): 14 (WebCore::ResourceHandle::start): 15 (WebCore::readCallback): 16 (WebCore::openCallback): 17 (WebCore::queryInfoCallback): 18 (WebCore::ResourceHandle::startGio): 19 1 20 2009-04-25 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 21 -
trunk/WebCore/platform/network/soup/ResourceHandleSoup.cpp
r42861 r42866 122 122 } 123 123 124 enum125 {126 ERROR_TRANSPORT,127 ERROR_UNKNOWN_PROTOCOL,128 ERROR_BAD_NON_HTTP_METHOD,129 ERROR_UNABLE_TO_OPEN_FILE,130 };131 132 124 static void cleanupGioOperation(ResourceHandleInternal* handle); 133 125 … … 338 330 339 331 if (SOUP_STATUS_IS_TRANSPORT_ERROR(msg->status_code)) { 340 char* uri = soup_uri_to_string(soup_message_get_uri(msg), false); 341 ResourceError error("webkit-network-error", ERROR_TRANSPORT, uri, String::fromUTF8(msg->reason_phrase)); 342 g_free(uri); 332 ResourceError error(g_quark_to_string(SOUP_HTTP_ERROR), 333 msg->status_code, 334 soup_uri_to_string(soup_message_get_uri(msg), false), 335 String::fromUTF8(msg->reason_phrase)); 343 336 client->didFail(handle.get(), error); 344 337 return; … … 533 526 534 527 if (error) { 535 ResourceError resourceError("webkit-network-error", ERROR_UNABLE_TO_OPEN_FILE, urlString, error->message); 528 ResourceError resourceError(g_quark_to_string(SOUP_HTTP_ERROR), 529 msg->status_code, 530 urlString, 531 String::fromUTF8(error->message)); 536 532 g_error_free(error); 537 533 … … 561 557 } 562 558 563 static gboolean reportUnknownProtocolError(gpointer callback_data)564 {565 ResourceHandle* handle = static_cast<ResourceHandle*>(callback_data);566 ResourceHandleInternal* d = handle->getInternal();567 ResourceHandleClient* client = handle->client();568 569 if (d->m_cancelled || !client) {570 handle->deref();571 return false;572 }573 574 KURL url = handle->request().url();575 ResourceError error("webkit-network-error", ERROR_UNKNOWN_PROTOCOL, url.string(), url.protocol());576 client->didFail(handle, error);577 578 handle->deref();579 return false;580 }581 582 559 bool ResourceHandle::start(Frame* frame) 583 560 { … … 609 586 return startGio(url); 610 587 611 // Error must not be reported immediately, but through an idle function. 612 // Despite error, we should return true so a proper handle is created, 613 // to which this failure can be reported. 614 ref(); 615 d->m_idleHandler = g_idle_add(reportUnknownProtocolError, this); 588 // Error must not be reported immediately 589 this->scheduleFailure(InvalidURLFailure); 590 616 591 return true; 617 592 } … … 667 642 // GIO-based loader 668 643 669 static inline ResourceError networkErrorForFile(GFile* file, GError* error)670 {671 // FIXME: Map gio errors to a more detailed error code when we have it in WebKit.672 gchar* uri = g_file_get_uri(file);673 ResourceError resourceError("webkit-network-error", ERROR_TRANSPORT, uri, error ? String::fromUTF8(error->message) : String());674 g_free(uri);675 return resourceError;676 }677 678 644 static void cleanupGioOperation(ResourceHandleInternal* d) 679 645 { … … 734 700 gssize bytesRead = g_input_stream_read_finish(d->m_inputStream, res, &error); 735 701 if (error) { 736 ResourceError resourceError = networkErrorForFile(d->m_gfile, error); 702 ResourceError resourceError(g_quark_to_string(G_IO_ERROR), 703 error->code, 704 g_file_get_uri(d->m_gfile), 705 error ? String::fromUTF8(error->message) : String()); 737 706 g_error_free(error); 738 707 cleanupGioOperation(d); … … 777 746 GFileInputStream* in = g_file_read_finish(G_FILE(source), res, &error); 778 747 if (error) { 779 ResourceError resourceError = networkErrorForFile(d->m_gfile, error); 748 ResourceError resourceError(g_quark_to_string(G_IO_ERROR), 749 error->code, 750 g_file_get_uri(d->m_gfile), 751 error ? String::fromUTF8(error->message) : String()); 752 780 753 g_error_free(error); 781 754 cleanupGioOperation(d); … … 824 797 // and set a timeout to unmount it later after it's been idle 825 798 // for a while). 826 827 ResourceError resourceError = networkErrorForFile(d->m_gfile, error); 799 ResourceError resourceError(g_quark_to_string(G_IO_ERROR), 800 error->code, 801 g_file_get_uri(d->m_gfile), 802 error ? String::fromUTF8(error->message) : String()); 828 803 g_error_free(error); 829 804 cleanupGioOperation(d); … … 835 810 // FIXME: what if the URI points to a directory? Should we 836 811 // generate a listing? How? What do other backends do here? 837 838 ResourceError resourceError = networkErrorForFile(d->m_gfile, 0); 812 ResourceError resourceError(g_quark_to_string(G_IO_ERROR), 813 G_IO_ERROR_FAILED, 814 g_file_get_uri(d->m_gfile), 815 String()); 839 816 cleanupGioOperation(d); 840 817 client->didFail(handle, resourceError); … … 858 835 { 859 836 if (request().httpMethod() != "GET" && request().httpMethod() != "POST") { 860 ResourceError error("webkit-network-error", ERROR_BAD_NON_HTTP_METHOD, url.string(), request().httpMethod()); 837 ResourceError error(g_quark_to_string(SOUP_HTTP_ERROR), 838 SOUP_STATUS_METHOD_NOT_ALLOWED, 839 url.string(), request().httpMethod()); 861 840 d->client()->didFail(this, error); 862 841 return false; -
trunk/WebKit/gtk/ChangeLog
r42865 r42866 1 1 2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org> 2 2 3 Reviewed by Xan Lopez. 4 5 Display a default error page for load errors. 6 7 * WebCoreSupport/FrameLoaderClientGtk.cpp: 8 (WebKit::FrameLoaderClient::dispatchDidFailLoad): 9 * resources/error.html: Added. 3 Reviewed by Xan Lopez. 4 5 [GTK] Error reporting 6 https://bugs.webkit.org/show_bug.cgi?id=18344 7 8 Update FrameLoad errors to use WebKitErrors. 9 10 * WebCoreSupport/FrameLoaderClientGtk.cpp: 11 (WebKit::FrameLoaderClient::cancelledError): 12 (WebKit::FrameLoaderClient::blockedError): 13 (WebKit::FrameLoaderClient::cannotShowURLError): 14 (WebKit::FrameLoaderClient::interruptForPolicyChangeError): 15 (WebKit::FrameLoaderClient::cannotShowMIMETypeError): 16 (WebKit::FrameLoaderClient::fileDoesNotExistError): 17 (WebKit::FrameLoaderClient::pluginWillHandleLoadError): 18 (WebKit::FrameLoaderClient::shouldFallBack): 19 * webkit/webkiterror.h: Added. 20 * webkit/webkiterror.cpp: Added. 21 22 2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org> 23 24 Reviewed by Xan Lopez. 25 26 [GTK] Error reporting 27 https://bugs.webkit.org/show_bug.cgi?id=18344 28 29 Display a default error page for load errors. 30 31 * WebCoreSupport/FrameLoaderClientGtk.cpp: 32 (WebKit::FrameLoaderClient::dispatchDidFailLoad): 33 * resources/error.html: Added. 10 34 11 35 2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org> -
trunk/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
r42865 r42866 50 50 #include "JSDOMBinding.h" 51 51 #include "ScriptController.h" 52 #include "webkit webview.h"52 #include "webkiterror.h" 53 53 #include "webkitnetworkrequest.h" 54 #include "webkitprivate.h" 54 55 #include "webkitwebframe.h" 55 56 #include "webkitwebnavigationaction.h" 56 57 #include "webkitwebpolicydecision.h" 57 #include "webkit private.h"58 #include "webkitwebview.h" 58 59 59 60 #include <JavaScriptCore/APICast.h> 60 61 #include <gio/gio.h> 61 62 #include <glib.h> 63 #include <glib/gi18n-lib.h> 62 64 #include <stdio.h> 63 65 #if PLATFORM(UNIX) … … 885 887 } 886 888 887 ResourceError FrameLoaderClient::cancelledError(const ResourceRequest& )888 { 889 notImplemented();890 ResourceError error("", 0, "", "");891 error.setIsCancellation(true); 892 return error; 893 } 894 895 ResourceError FrameLoaderClient::blockedError(const ResourceRequest&) 896 { 897 notImplemented(); 898 return ResourceError("", 0, "", ""); 899 } 900 901 ResourceError FrameLoaderClient::cannotShowURLError(const ResourceRequest&) 902 { 903 notImplemented(); 904 return ResourceError("", 0, "", ""); 905 } 906 907 ResourceError FrameLoaderClient::interruptForPolicyChangeError(const ResourceRequest&) 908 { 909 notImplemented(); 910 return ResourceError("", 0, "", ""); 911 } 912 913 ResourceError FrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse&) 914 { 915 notImplemented(); 916 return ResourceError("", 0, "", ""); 917 } 918 919 ResourceError FrameLoaderClient::fileDoesNotExistError(const ResourceResponse&) 920 { 921 notImplemented(); 922 return ResourceError("", 0, "", ""); 923 } 924 925 ResourceError FrameLoaderClient::pluginWillHandleLoadError(const ResourceResponse&) 926 { 927 notImplemented(); 928 return ResourceError("", 0, "", ""); 929 } 930 931 bool FrameLoaderClient::shouldFallBack(const ResourceError&) 932 { 933 notImplemented();934 return false;889 ResourceError FrameLoaderClient::cancelledError(const ResourceRequest& request) 890 { 891 return ResourceError(g_quark_to_string(WEBKIT_NETWORK_ERROR), WEBKIT_NETWORK_ERROR_CANCELLED, 892 request.url().string(), _("Load request cancelled")); 893 } 894 895 ResourceError FrameLoaderClient::blockedError(const ResourceRequest& request) 896 { 897 return ResourceError(g_quark_to_string(WEBKIT_POLICY_ERROR), WEBKIT_POLICY_ERROR_CANNOT_USE_RESTRICTED_PORT, 898 request.url().string(), _("Not allowed to use restricted network port")); 899 } 900 901 ResourceError FrameLoaderClient::cannotShowURLError(const ResourceRequest& request) 902 { 903 return ResourceError(g_quark_to_string(WEBKIT_POLICY_ERROR), WEBKIT_POLICY_ERROR_CANNOT_SHOW_URL, 904 request.url().string(), _("URL cannot be shown")); 905 } 906 907 ResourceError FrameLoaderClient::interruptForPolicyChangeError(const ResourceRequest& request) 908 { 909 return ResourceError(g_quark_to_string(WEBKIT_POLICY_ERROR), WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE, 910 request.url().string(), _("Frame load was interrupted")); 911 } 912 913 ResourceError FrameLoaderClient::cannotShowMIMETypeError(const ResourceResponse& response) 914 { 915 return ResourceError(g_quark_to_string(WEBKIT_POLICY_ERROR), WEBKIT_POLICY_ERROR_CANNOT_SHOW_MIME_TYPE, 916 response.url().string(), _("Content with the specified MIME type cannot be shown")); 917 } 918 919 ResourceError FrameLoaderClient::fileDoesNotExistError(const ResourceResponse& response) 920 { 921 return ResourceError(g_quark_to_string(WEBKIT_NETWORK_ERROR), WEBKIT_NETWORK_ERROR_FILE_DOES_NOT_EXIST, 922 response.url().string(), _("File does not exist")); 923 } 924 925 ResourceError FrameLoaderClient::pluginWillHandleLoadError(const ResourceResponse& response) 926 { 927 return ResourceError(g_quark_to_string(WEBKIT_PLUGIN_ERROR), WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD, 928 response.url().string(), _("Plugin will handle load")); 929 } 930 931 bool FrameLoaderClient::shouldFallBack(const ResourceError& error) 932 { 933 // FIXME: Needs to check domain. 934 // FIXME: Mac checks for WebKitErrorPlugInWillHandleLoad here to avoid 935 // loading plugin content twice. Do we need it? 936 return error.errorCode() != WEBKIT_NETWORK_ERROR_CANCELLED; 935 937 } 936 938
Note: See TracChangeset
for help on using the changeset viewer.