static void on_error(void *user_data, Evas_Object *webview, void *event_info) { Eina_Strbuf* buffer; const Ewk_Web_Error *error = (const Ewk_Web_Error *)event_info; buffer = eina_strbuf_new(); eina_strbuf_append_printf(buffer, "<html><body><div style=\"color:#ff0000\">ERROR!</div><br><div>Code: %d<br>Description: %s<br>URL: %s</div></body</html>", ewk_web_error_code_get(error), ewk_web_error_description_get(error), ewk_web_error_url_get(error)); ewk_view_html_string_load(webview, eina_strbuf_string_get(buffer), 0, ewk_web_error_url_get(error)); eina_strbuf_free(buffer); }
void PageClientBase::processDidCrash() { // Check if loading was ongoing, when web process crashed. double loadProgress = ewk_view_load_progress_get(m_viewImpl->view()); if (loadProgress >= 0 && loadProgress < 1) { loadProgress = 1; m_viewImpl->smartCallback<LoadProgress>().call(&loadProgress); } bool handled = false; m_viewImpl->smartCallback<WebProcessCrashed>().call(&handled); if (!handled) { CString url = m_viewImpl->page()->urlAtProcessExit().utf8(); WARN("WARNING: The web process experienced a crash on '%s'.\n", url.data()); // Display an error page ewk_view_html_string_load(m_viewImpl->view(), "The web process has crashed.", 0, url.data()); } }
void ViewClientEfl::webProcessCrashed(WKViewRef, WKURLRef url, const void* clientInfo) { EwkView* ewkView = toEwkView(clientInfo); // Check if loading was ongoing, when web process crashed. double loadProgress = WKPageGetEstimatedProgress(ewkView->wkPage()); if (loadProgress >= 0 && loadProgress < 1) { loadProgress = 1; ewkView->smartCallback<LoadProgress>().call(&loadProgress); } ewkView->smartCallback<TooltipTextUnset>().call(); bool handled = false; ewkView->smartCallback<WebProcessCrashed>().call(&handled); if (!handled) { WKEinaSharedString urlString(url); WARN("WARNING: The web process experienced a crash on '%s'.\n", static_cast<const char*>(urlString)); // Display an error page ewk_view_html_string_load(ewkView->evasObject(), "The web process has crashed.", 0, urlString); } }