void FrameLoaderClientEfl::dispatchDidFailLoad(const ResourceError& err) { if (!shouldFallBack(err)) return; m_loadError = err; ewk_frame_load_error(m_frame, m_loadError.domain().utf8().data(), m_loadError.errorCode(), m_loadError.isCancellation(), m_loadError.localizedDescription().utf8().data(), m_loadError.failingURL().utf8().data()); }
void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) { if (m_loadingErrorPage) return; notifyStatus(m_frame, WEBKIT_LOAD_FAILED); WebKitWebView* webView = getViewFromFrame(m_frame); GError* webError = g_error_new_literal(g_quark_from_string(error.domain().utf8().data()), error.errorCode(), error.localizedDescription().utf8().data()); gboolean isHandled = false; g_signal_emit_by_name(webView, "load-error", m_frame, error.failingURL().utf8().data(), webError, &isHandled); if (isHandled) { g_error_free(webError); return; } if (!shouldFallBack(error)) { g_error_free(webError); return; } m_loadingErrorPage = true; String content; gchar* fileContent = 0; gchar* errorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/resources/error.html", NULL, NULL); GFile* errorFile = g_file_new_for_uri(errorURI); g_free(errorURI); if (!errorFile) content = makeString("<html><body>", webError->message, "</body></html>"); else { gboolean loaded = g_file_load_contents(errorFile, 0, &fileContent, 0, 0, 0); if (!loaded) content = makeString("<html><body>", webError->message, "</body></html>"); 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); }
void FrameLoaderClient::dispatchDidFailLoad(const ResourceError& error) { WebKitWebView* webView = getViewFromFrame(m_frame); GError* webError = g_error_new_literal(g_quark_from_string(error.domain().utf8().data()), error.errorCode(), error.localizedDescription().utf8().data()); gboolean isHandled = false; g_signal_emit_by_name(webView, "load-error", m_frame, error.failingURL().utf8().data(), webError, &isHandled); if (isHandled) { g_error_free(webError); return; } if (!shouldFallBack(error)) { g_error_free(webError); // FIXME: load-done is deprecated. Please remove when signal's been removed. g_signal_emit_by_name(m_frame, "load-done", false); return; } String content; gchar* fileContent = 0; gchar* errorURI = g_filename_to_uri(DATA_DIR"/webkit-1.0/resources/error.html", NULL, NULL); GFile* errorFile = g_file_new_for_uri(errorURI); g_free(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); // FIXME: load-done is deprecated. Please remove when signal's been removed. g_signal_emit_by_name(m_frame, "load-done", false); }