Commit 6154a4d4 authored by jmalonzo@webkit.org's avatar jmalonzo@webkit.org

2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org>

         Reviewed by Xan Lopez.

         [GTK] Error reporting
         https://bugs.webkit.org/show_bug.cgi?id=18344

         Add the default error page for installation.

         * GNUmakefile.am:

2009-04-25  Jan Michael Alonzo  <jmalonzo@webkit.org>

         Reviewed by Xan Lopez.

         Display a default error page for load errors.

         * WebCoreSupport/FrameLoaderClientGtk.cpp:
         (WebKit::FrameLoaderClient::dispatchDidFailLoad):
         * resources/error.html: Added.

git-svn-id: svn://svn.chromium.org/blink/trunk@42865 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5757029f
2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org>
Reviewed by Xan Lopez.
[GTK] Error reporting
https://bugs.webkit.org/show_bug.cgi?id=18344
Add the default error page for installation.
* GNUmakefile.am:
2009-04-24 Diego Escalante Urrelo <diegoe@gnome.org> 2009-04-24 Diego Escalante Urrelo <diegoe@gnome.org>
Reviewed by Gustavo Noronha. Reviewed by Gustavo Noronha.
......
...@@ -451,8 +451,6 @@ DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile ...@@ -451,8 +451,6 @@ DerivedSources/webkitenumtypes.cpp: $(webkitgtk_h_api) GNUmakefile
&& cp xgen-gtc $@ \ && cp xgen-gtc $@ \
&& rm -f xgen-gtc && rm -f xgen-gtc
# END WEBKIT GTK+
#
# Files that will be distributed # Files that will be distributed
EXTRA_DIST = \ EXTRA_DIST = \
WebKit/LICENSE \ WebKit/LICENSE \
...@@ -467,7 +465,15 @@ EXTRA_DIST = \ ...@@ -467,7 +465,15 @@ EXTRA_DIST = \
$(srcdir)/WebKit/gtk/docs/webkitgtk-docs.sgml \ $(srcdir)/WebKit/gtk/docs/webkitgtk-docs.sgml \
$(srcdir)/WebKit/gtk/docs/webkitgtk-sections.txt \ $(srcdir)/WebKit/gtk/docs/webkitgtk-sections.txt \
$(srcdir)/WebKit/gtk/docs/version.xml.in \ $(srcdir)/WebKit/gtk/docs/version.xml.in \
$(srcdir)/WebKit/gtk/po/* $(srcdir)/WebKit/gtk/po/* \
$(srcdir)/WebKit/gtk/resources/*
# extra resource files
resourcesdir = ${datadir}/webkit-1.0/resources
dist_resources_DATA = \
$(shell ls $(srcdir)/WebKit/gtk/resources/*.html)
# END WEBKIT GTK+
# Files that will be cleaned # Files that will be cleaned
MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES) doltcompile doltlibtool WebKit/gtk/docs/version.xml WebKit/gtk/docs/GNUmakefile MAINTAINERCLEANFILES := $(stamp_files) $(BUILT_SOURCES) doltcompile doltlibtool WebKit/gtk/docs/version.xml WebKit/gtk/docs/GNUmakefile
...@@ -566,4 +572,4 @@ install-data-local: po-install-data-local ...@@ -566,4 +572,4 @@ install-data-local: po-install-data-local
installdirs-data-local: po-installdirs-data-local installdirs-data-local: po-installdirs-data-local
uninstall-local: po-uninstall-local uninstall-local: po-uninstall-local
\ No newline at end of file
2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org>
Reviewed by Xan Lopez.
Display a default error page for load errors.
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::dispatchDidFailLoad):
* resources/error.html: Added.
2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org> 2009-04-25 Jan Michael Alonzo <jmalonzo@webkit.org>
Reviewed by Xan Lopez. Reviewed by Xan Lopez.
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include "webkitprivate.h" #include "webkitprivate.h"
#include <JavaScriptCore/APICast.h> #include <JavaScriptCore/APICast.h>
#include <gio/gio.h>
#include <glib.h> #include <glib.h>
#include <stdio.h> #include <stdio.h>
#if PLATFORM(UNIX) #if PLATFORM(UNIX)
...@@ -846,10 +847,28 @@ void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) ...@@ -846,10 +847,28 @@ void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error)
return; return;
} }
String content = String::format("<html><head><title>%d</title></head><body>%s</body></html>", String content;
error.errorCode(), webError->message); gchar* fileContent = 0;
webkit_web_frame_load_alternate_string(m_frame, content.utf8().data(), gchar* errorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/resources/error.html", NULL, NULL);
NULL, error.failingURL().utf8().data()); GFile* errorFile = g_file_new_for_uri(errorURI);
if (!errorFile)
content = String::format("<html><body>%s</body></html>", webError->message);
else {
gboolean loaded = g_file_load_contents(errorFile, 0, &fileContent, 0, 0, 0);
if (!loaded)
content = String::format("<html><body>%s</body></html>", webError->message);
else
content = String::format(fileContent, error.failingURL().utf8().data(), webError->message);
}
webkit_web_frame_load_alternate_string(m_frame, content.utf8().data(), 0, error.failingURL().utf8().data());
g_free(fileContent);
if (errorFile)
g_object_unref(errorFile);
g_error_free(webError); g_error_free(webError);
// FIXME: load-done is deprecated. Please remove when signal's been removed. // FIXME: load-done is deprecated. Please remove when signal's been removed.
......
<html>
<head>
<title>Error</title>
<style type="text/css">
body {
background-color: #fff;
margin: 0;
padding: 0;
}
#errorContainer {
background: #fff;
min-width: 35em;
max-width: 35em;
position: absolute;
top: 2em;
left: 1em;
padding: 10px;
border: 2px solid #eee;
-webkit-border-radius: 5px;
}
#errorTitleText {
font-size: 120%;
font-weight: bold;
}
#errorMessageText {
font-size: 80%;
}
</style>
<script type="text/javascript">
function tryagain()
{
location.reload();
}
</script>
</head>
<body>
<div id="errorContainer">
<div id="errorTitle">
<p id="errorTitleText">Unable to load page</p>
</div>
<div id="errorMessage">
<p>Problem occurred while loading the URL %s</p>
<p id="errorMessageText">%s</a>
</p>
</div>
<form name="bl" onsubmit="tryagain()">
<input type="submit" value="try again"/>
</form>
</div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment