void __webprocess_crashed_cb(void* data, Evas_Object* obj, void* event_info)
{
printf("APP.C callback __webprocess_crashed_cb \n");
+ const char* message = "<html><body><h1>The renderer process has crashed!</h1>"
+ "<a href=\"https://google.com\">Open google</a></body></html>";
+ ewk_view_html_string_load(view, message, 0, 0);
Eina_Bool* handled = (Eina_Bool*)event_info;
*handled = EINA_TRUE;
- // EWebView (Evas_Object) on which this callback is triggered should be deleted immediately.
- // It is not safe to call any method on it.
- evas_object_del(obj);
- exit(EXIT_FAILURE);
}
Eina_Bool __mime_override_cb(const char* url, const char *mime, char **new_mime)
}
void RenderWidgetHostViewEfl::RenderProcessGone(base::TerminationStatus, int error_code) {
- // RenderWidgetHostImpl sets |view_| i.e. RenderWidgetHostViewEfl to NULL immediately after this call.
- // It expects RenderWidgetHostView to delete itself.
- // We only inform |web_view_| that renderer has crashed.
- // and in "process,crashed" callback, app is expected to delete the view.
- if (web_view_)
- web_view_->set_renderer_crashed();
Destroy();
}
int screen_orientation_ = 0;
+static const char* kRendererCrashedHTMLMessage =
+ "<html><body><h1>Renderer process has crashed!</h1></body></html>";
+
inline void SetDefaultStringIfNull(const char*& variable,
const char* default_string) {
if (!variable) {
return static_cast<RenderWidgetHostViewEfl*>(web_contents_->GetRenderWidgetHostView());
}
-void EWebView::set_renderer_crashed() {
-#ifndef NDEBUG
- DCHECK(!renderer_crashed_);
- renderer_crashed_ = true;
-#endif
-}
-
EWebView::EWebView(tizen_webview::WebView* owner, tizen_webview::WebContext* context, Evas_Object* object)
: public_webview_(owner),
evas_event_handler_(NULL),
min_page_scale_factor_(-1.0),
max_page_scale_factor_(-1.0),
inspector_server_(NULL),
-#ifndef NDEBUG
- renderer_crashed_(false),
-#endif
is_initialized_(false) {
}
return true;
}
+void EWebView::HandleRendererProcessCrash() {
+ const char* last_url = GetURL();
+
+ WebContents::CreateParams params(context_->browser_context());
+ params.context = GetContentImageObject();
+ web_contents_.reset(WebContents::Create(params));
+ web_contents_delegate_.reset(new WebContentsDelegateEfl(this));
+ web_contents_->SetDelegate(web_contents_delegate_.get());
+
+ bool callback_handled = false;
+ SmartCallback<EWebViewCallbacks::WebProcessCrashed>().call(&callback_handled);
+ if (!callback_handled)
+ LoadHTMLString(kRendererCrashedHTMLMessage, NULL, last_url);
+}
+
#if defined(OS_TIZEN_MOBILE) && !defined(EWK_BRINGUP)
void EWebView::cameraResultCb(service_h request,
service_h reply,
bool HandleGesture(ui::GestureEvent* event);
bool HandleTouchEvent(ui::TouchEvent* event);
+ void HandleRendererProcessCrash();
+
private:
#if defined(OS_TIZEN_MOBILE) && !defined(EWK_BRINGUP)
static void cameraResultCb(service_h request, service_h reply,
scoped_refptr<EdgeEffect> edge_effect_;
#endif
-#ifndef NDEBUG
- bool renderer_crashed_;
-#endif
#if defined(OS_TIZEN_MOBILE)
content::FileChooserParams::Mode filechooser_mode_;
#endif
if (status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION
|| status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED
|| status == base::TERMINATION_STATUS_PROCESS_CRASHED) {
- bool unused = false;
- web_view_->SmartCallback<EWebViewCallbacks::WebProcessCrashed>().call(&unused);
- // A sane app would handle the callback and delete the view immediately.
- // Otherwise, we will most probably crash when a method is called on |web_view_|.
+ web_view_->HandleRendererProcessCrash();
}
}