Bug 96197

Summary: [EFL][WK2] Provide implementation for PageClientImpl::processDidCrash()
Product: WebKit Reporter: Jinwoo Song <jinwoo7.song>
Component: WebKit EFLAssignee: Jinwoo Song <jinwoo7.song>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, gyuyoung.kim, kenneth, lucas.de.marchi, rakuco, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch
gyuyoung.kim: review-
patch.
none
patch
none
patch
none
patch.
none
patch applied Christophe's comments.
none
patch
none
patch
gyuyoung.kim: commit-queue-
patch to fix build error.
gyuyoung.kim: review+
patch for landing.
gyuyoung.kim: review+
patch for landing.
none
patch for landing. none

Description Jinwoo Song 2012-09-09 00:21:26 PDT
WebKit2 EFL does not have a implementation for PageClientImpl::processDidCrash(). 
So when WebProcess is crashed, UI process does nothing and left alone as it is.
Comment 1 Jinwoo Song 2012-09-10 03:56:34 PDT
Created attachment 163083 [details]
patch
Comment 2 Chris Dumez 2012-09-10 04:56:25 PDT
Comment on attachment 163083 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163083&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1590
> + * Web process was crashed.

"has" crashed

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1592
> + * Emits signal: "process,crashed" with pointer to handle crash.

with pointer to "crash handling boolean" ?

> Source/WebKit2/UIProcess/API/efl/ewk_view.h:59
> + * - "process,crashed", bool*: reports that web process is crashed.

"has" crashed.
Comment 3 Jinwoo Song 2012-09-10 16:31:02 PDT
Created attachment 163243 [details]
patch
Comment 4 Jinwoo Song 2012-09-10 16:31:23 PDT
(In reply to comment #2)
> (From update of attachment 163083 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=163083&action=review
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1590
> > + * Web process was crashed.
> 
> "has" crashed
fixed.
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1592
> > + * Emits signal: "process,crashed" with pointer to handle crash.
> 
> with pointer to "crash handling boolean" ?
fixed.
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view.h:59
> > + * - "process,crashed", bool*: reports that web process is crashed.
> 
> "has" crashed.
fixed.
Comment 5 Chris Dumez 2012-09-10 22:09:51 PDT
Comment on attachment 163243 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163243&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1605
> +        exit(0);

Frankly, I'm a bit scared by this. Why would we exit the app? It seems no other port is doing this.
I think we should simply display an error page.

To my knowledge, the fact that the WebProcess crashed is not a dead end. If you open a new URL, a new WebProcess would be created.
Comment 6 Gyuyoung Kim 2012-09-10 22:21:22 PDT
Comment on attachment 163243 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163243&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1599
> +    fprintf(stderr, "WARNING: The web process experienced a crash on '%s'.\n", priv->pageProxy->urlAtProcessExit().utf8().data());

IMO, EINA_LOG_DOM_WARN is better than fprintf for ewk layer.

> Source/WebKit2/UIProcess/API/efl/ewk_view.h:59
> + * - "process,crashed", bool*: reports that web process has crashed.

Eina_Bool is correct.
Comment 7 Kenneth Rohde Christiansen 2012-09-11 00:17:14 PDT
Comment on attachment 163243 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163243&action=review

> Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp:110
>  void PageClientImpl::processDidCrash()
>  {
> -    notImplemented();
> +    ewk_view_process_crashed(m_viewWidget);
>  }

This seems very simplistic. For Qt we handle lots of things relating to our view, history etc. I am not entirely sure where that is done, but I think it would make sense to have a look and analyse it.

As the class name shows this is information meant for the view (ie. client of the page)
Comment 8 Jinwoo Song 2012-09-11 01:24:06 PDT
Comment on attachment 163243 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163243&action=review

>> Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp:110
>>  }
> 
> This seems very simplistic. For Qt we handle lots of things relating to our view, history etc. I am not entirely sure where that is done, but I think it would make sense to have a look and analyse it.
> 
> As the class name shows this is information meant for the view (ie. client of the page)

Yes, I also think it's very simple. I look into the Qt and found that Qt handles warning message, resetGestureRecognizers, and load progress. (void QQuickWebViewPrivate::processDidCrash()). But I could not find other place where other things are handled.
As you know, GTK has no implementation for processDidCrash() and default behavior is done in WebPageProxy::processDidCrash().

>> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1599
>> +    fprintf(stderr, "WARNING: The web process experienced a crash on '%s'.\n", priv->pageProxy->urlAtProcessExit().utf8().data());
> 
> IMO, EINA_LOG_DOM_WARN is better than fprintf for ewk layer.

Okay, I'll use EINA_LOG_DOM_WARN.

>> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1605
>> +        exit(0);
> 
> Frankly, I'm a bit scared by this. Why would we exit the app? It seems no other port is doing this.
> I think we should simply display an error page.
> 
> To my knowledge, the fact that the WebProcess crashed is not a dead end. If you open a new URL, a new WebProcess would be created.

I agree with you and I'll change to only display the error message.

>> Source/WebKit2/UIProcess/API/efl/ewk_view.h:59
>> + * - "process,crashed", bool*: reports that web process has crashed.
> 
> Eina_Bool is correct.

I'll fix it.
Comment 9 Jinwoo Song 2012-09-11 01:36:02 PDT
Created attachment 163300 [details]
patch.
Comment 10 Gyuyoung Kim 2012-09-11 01:52:00 PDT
Why not request review again ?
Comment 11 Jinwoo Song 2012-09-11 01:54:31 PDT
(In reply to comment #10)
> Why not request review again ?
Okay, I set the flag.
Comment 12 Gyuyoung Kim 2012-09-11 02:30:54 PDT
Comment on attachment 163300 [details]
patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=163300&action=review

Looks good to me except for my comment.

> Source/WebKit2/UIProcess/API/efl/ewk_view.h:59
> + * - "process,crashed", Eina_Bool*: reports that web process has crashed.

If new signal depends on a parameter which gets a result from callback function, we added comment for parameter as below,

http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.h#L71
Comment 13 Jinwoo Song 2012-09-11 03:06:48 PDT
Created attachment 163318 [details]
patch
Comment 14 Jinwoo Song 2012-09-11 03:08:18 PDT
(In reply to comment #12)
> (From update of attachment 163300 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=163300&action=review
> 
> Looks good to me except for my comment.
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view.h:59
> > + * - "process,crashed", Eina_Bool*: reports that web process has crashed.
> 
> If new signal depends on a parameter which gets a result from callback function, we added comment for parameter as below,
> 
> http://trac.webkit.org/browser/trunk/Source/WebKit/efl/ewk/ewk_view.h#L71

Done. :)
Comment 15 Gyuyoung Kim 2012-09-11 03:24:18 PDT
(In reply to comment #8)

> Yes, I also think it's very simple. I look into the Qt and found that Qt handles warning message, resetGestureRecognizers, and load progress. (void QQuickWebViewPrivate::processDidCrash()). But I could not find other place where other things are handled.
> As you know, GTK has no implementation for processDidCrash() and default behavior is done in WebPageProxy::processDidCrash().

One more thing. I'm not sure if we can reset gesture recognizer like qt port. But, it looks we need to check whether page loading is ongoing or not. IMO, we're able to do similar stuff as qt port for finishing page loading using below functions.

- ewk_view_load_progress_get
- ewk_view_load_progress_changed
Comment 16 Jinwoo Song 2012-09-11 03:32:42 PDT
(In reply to comment #15)
> (In reply to comment #8)
> 
> > Yes, I also think it's very simple. I look into the Qt and found that Qt handles warning message, resetGestureRecognizers, and load progress. (void QQuickWebViewPrivate::processDidCrash()). But I could not find other place where other things are handled.
> > As you know, GTK has no implementation for processDidCrash() and default behavior is done in WebPageProxy::processDidCrash().
> 
> One more thing. I'm not sure if we can reset gesture recognizer like qt port. But, it looks we need to check whether page loading is ongoing or not. IMO, we're able to do similar stuff as qt port for finishing page loading using below functions.
> 
> - ewk_view_load_progress_get
> - ewk_view_load_progress_changed

Okay, I'll do this and upload a patch again. Thanks for advice. :-)
Comment 17 Jinwoo Song 2012-09-12 21:31:18 PDT
Created attachment 163769 [details]
patch
Comment 18 Gyuyoung Kim 2012-09-12 21:41:08 PDT
Comment on attachment 163769 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163769&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_private.h:34
> +extern int _ewk_log_dom;

Nit : A new line is needed.

> Source/WebKit2/UIProcess/API/efl/ewk_view_private.h:104
> +void ewk_view_process_crashed(Evas_Object* ewkView);

ditto.
Comment 19 Jinwoo Song 2012-09-12 21:56:56 PDT
Created attachment 163771 [details]
patch.
Comment 20 Jinwoo Song 2012-09-12 21:57:27 PDT
(In reply to comment #18)
> (From update of attachment 163769 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=163769&action=review
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_private.h:34
> > +extern int _ewk_log_dom;
> 
> Nit : A new line is needed.
Done.
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view_private.h:104
> > +void ewk_view_process_crashed(Evas_Object* ewkView);
> 
> ditto.
Done.
Comment 21 Simon Hausmann 2012-09-12 22:05:29 PDT
Comment on attachment 163771 [details]
patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=163771&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_private.h:34
> +extern int _ewk_log_dom;

Just a thought, wouldn't it be simpler to do the import in ewk_view.cpp instead of here? :)
Comment 22 Chris Dumez 2012-09-12 22:45:10 PDT
Comment on attachment 163771 [details]
patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=163771&action=review

> Source/WebKit2/ChangeLog:13
> +        with a url at process exit. And after checking if loading was onging, if so, set

"ongoing"

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1644
> +

We could even show an HTML error page here, like Qt port is doing. (e.g. using ewk_view_html_string_load())

> Source/WebKit2/UIProcess/API/efl/ewk_view_private.h:104
> +void ewk_view_process_crashed(Evas_Object* ewkView);

wouldn't it be clearer if we used ewk_view_webprocess_crashed()?
Comment 23 Jinwoo Song 2012-09-12 22:53:51 PDT
(In reply to comment #21)
> (From update of attachment 163771 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=163771&action=review
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_private.h:34
> > +extern int _ewk_log_dom;
> 
> Just a thought, wouldn't it be simpler to do the import in ewk_view.cpp instead of here? :)
Actually, I referenced WebKit1 EFL in ewk_private.h.(Source/WebKit/efl/ewk/ewk_private.h)
Also, I'm considering to add Eina Log macros in the ewk_private.h in WebKit2 so as to use the macros in other use cases. That's the reason I put it there. :)
Comment 24 Jinwoo Song 2012-09-13 00:22:33 PDT
(In reply to comment #22)
> (From update of attachment 163771 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=163771&action=review
> 
> > Source/WebKit2/ChangeLog:13
> > +        with a url at process exit. And after checking if loading was onging, if so, set
> 
> "ongoing"
Fixed.
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1644
> > +
> 
> We could even show an HTML error page here, like Qt port is doing. (e.g. using ewk_view_html_string_load())
I applied your suggestion. 
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view_private.h:104
> > +void ewk_view_process_crashed(Evas_Object* ewkView);
> 
> wouldn't it be clearer if we used ewk_view_webprocess_crashed()?
Yes, I agree with you. I changed the name of the function and callback.
Comment 25 Jinwoo Song 2012-09-13 00:24:52 PDT
Created attachment 163798 [details]
patch applied Christophe's comments.
Comment 26 Gyuyoung Kim 2012-09-13 00:26:50 PDT
Comment on attachment 163798 [details]
patch applied Christophe's comments.

View in context: https://bugs.webkit.org/attachment.cgi?id=163798&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1655
> +   

Unneeded line.
Comment 27 Jinwoo Song 2012-09-13 00:29:30 PDT
Created attachment 163802 [details]
patch
Comment 28 Jinwoo Song 2012-09-13 00:29:59 PDT
(In reply to comment #26)
> (From update of attachment 163798 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=163798&action=review
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1655
> > +   
> 
> Unneeded line.
Fixed.
Comment 29 Chris Dumez 2012-09-13 00:30:38 PDT
Comment on attachment 163802 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163802&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1648
> +        ewk_view_html_string_load(ewkView, errorHTML.utf8().data(), 0, 0);

The last argument is the unreachable URL. You should probably pass url.utf8().data().
Comment 30 Gyuyoung Kim 2012-09-13 00:36:02 PDT
Comment on attachment 163802 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163802&action=review

>> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1648
>> +        ewk_view_html_string_load(ewkView, errorHTML.utf8().data(), 0, 0);
> 
> The last argument is the unreachable URL. You should probably pass url.utf8().data().

How about pass "file:///" ?
Comment 31 Chris Dumez 2012-09-13 00:59:56 PDT
Comment on attachment 163802 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163802&action=review

>>> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1648
>>> +        ewk_view_html_string_load(ewkView, errorHTML.utf8().data(), 0, 0);
>> 
>> The last argument is the unreachable URL. You should probably pass url.utf8().data().
> 
> How about pass "file:///" ?

I don't understand your comment. How is "file:///" the unreachable url? The unreachable url is priv->pageProxy->urlAtProcessExit().
Comment 32 Kenneth Rohde Christiansen 2012-09-13 01:04:41 PDT
Comment on attachment 163802 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163802&action=review

>>> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1648
>>> +        ewk_view_html_string_load(ewkView, errorHTML.utf8().data(), 0, 0);
>> 
>> The last argument is the unreachable URL. You should probably pass url.utf8().data().
> 
> How about pass "file:///" ?

Now can you make sure the process is alive here?

Also webkit fills in <html> and <body> for you

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1653
> +        // Check if loading was ongoing, when process crashed.
> +        double loadProgress = ewk_view_load_progress_get(ewkView);
> +        if (loadProgress >= 0 && loadProgress < 1)
> +            ewk_view_load_progress_changed(ewkView, 1);

This seems like something that should be handled even if the handled is true, I would probably move it to ::processDidCrash()
Comment 33 Jinwoo Song 2012-09-13 03:01:19 PDT
Created attachment 163825 [details]
patch

Applied the comments by Kenneth and Christophe.
Comment 34 Gyuyoung Kim 2012-09-13 03:21:13 PDT
Comment on attachment 163825 [details]
patch

Attachment 163825 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13833737
Comment 35 Gyuyoung Kim 2012-09-13 03:28:51 PDT
Comment on attachment 163825 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=163825&action=review

> don't understand your comment. How is "file:///" the unreachable url? The unreachable url is priv->pageProxy->urlAtProcessExit().

There was misunderstanding. The unreachable url is right. Thanks.

> Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp:110
> +    double loadProgress = ewk_view_load_progress_get(m_viewWidget);

Need to include ewk_view.h

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1646
> +        // Display a process crash page

process -> webprocess ?
Comment 36 Kenneth Rohde Christiansen 2012-09-13 04:22:17 PDT
> process -> webprocess ?

-> web process
Comment 37 Jinwoo Song 2012-09-13 17:22:45 PDT
Created attachment 164008 [details]
patch to fix build error.
Comment 38 Jinwoo Song 2012-09-13 17:24:58 PDT
(In reply to comment #35)
> (From update of attachment 163825 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=163825&action=review
> 
> > don't understand your comment. How is "file:///" the unreachable url? The unreachable url is priv->pageProxy->urlAtProcessExit().
> 
> There was misunderstanding. The unreachable url is right. Thanks.
> 
> > Source/WebKit2/UIProcess/API/efl/PageClientImpl.cpp:110
> > +    double loadProgress = ewk_view_load_progress_get(m_viewWidget);
> 
> Need to include ewk_view.h
Added missing header. silly mistake :(
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1646
> > +        // Display a process crash page
> 
> process -> webprocess ?
Comment 39 Jinwoo Song 2012-09-13 17:25:15 PDT
(In reply to comment #36)
> > process -> webprocess ?
> 
> -> web process
Fixed.
Comment 40 Gyuyoung Kim 2012-09-13 18:11:55 PDT
Comment on attachment 164008 [details]
patch to fix build error.

View in context: https://bugs.webkit.org/attachment.cgi?id=164008&action=review

> Source/WebKit2/ChangeLog:14
> +        with a url at process exit and load a error page.

process -> web process ?
Comment 41 Jinwoo Song 2012-09-13 18:19:59 PDT
Created attachment 164021 [details]
patch for landing.
Comment 42 Jinwoo Song 2012-09-13 18:20:11 PDT
(In reply to comment #40)
> (From update of attachment 164008 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=164008&action=review
> 
> > Source/WebKit2/ChangeLog:14
> > +        with a url at process exit and load a error page.
> 
> process -> web process ?
Fixed.
Comment 43 Gyuyoung Kim 2012-09-14 23:59:18 PDT
Comment on attachment 164021 [details]
patch for landing.

View in context: https://bugs.webkit.org/attachment.cgi?id=164021&action=review

> Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1646
> +        // Display a process crash page

process -> web process.
Comment 44 Jinwoo Song 2012-09-15 00:27:05 PDT
Created attachment 164276 [details]
patch for landing.
Comment 45 Jinwoo Song 2012-09-15 00:27:51 PDT
(In reply to comment #43)
> (From update of attachment 164021 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=164021&action=review
> 
> > Source/WebKit2/UIProcess/API/efl/ewk_view.cpp:1646
> > +        // Display a process crash page
> 
> process -> web process.
modified the comment to 
// Display an error page
Comment 46 Gyuyoung Kim 2012-09-15 01:39:21 PDT
Comment on attachment 164276 [details]
patch for landing.

View in context: https://bugs.webkit.org/attachment.cgi?id=164276&action=review

I already set r+. So, if you add my name to reviewer field in ChangeLog, you don't need to request r+ again. Just request cq? again.

> Source/WebKit2/ChangeLog:13
> +        If the application does not handle the crash event, show a Eina Log warning message

s/a Eina/an Eina/s

> Source/WebKit2/ChangeLog:14
> +        with a url at web process exit and load a error page.

s/a error/an error/s
Comment 47 Jinwoo Song 2012-09-15 04:57:08 PDT
(In reply to comment #46)
> (From update of attachment 164276 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=164276&action=review
> 
> I already set r+. So, if you add my name to reviewer field in ChangeLog, you don't need to request r+ again. Just request cq? again.
Okay, I see. Thanks for the tip. :)
> 
> > Source/WebKit2/ChangeLog:13
> > +        If the application does not handle the crash event, show a Eina Log warning message
> 
> s/a Eina/an Eina/s
I'll fix it.
> 
> > Source/WebKit2/ChangeLog:14
> > +        with a url at web process exit and load a error page.
> 
> s/a error/an error/s
I'll fix it.
Comment 48 Jinwoo Song 2012-09-15 05:02:53 PDT
Created attachment 164284 [details]
patch for landing.
Comment 49 WebKit Review Bot 2012-09-15 08:14:43 PDT
Comment on attachment 164284 [details]
patch for landing.

Clearing flags on attachment: 164284

Committed r128690: <http://trac.webkit.org/changeset/128690>
Comment 50 WebKit Review Bot 2012-09-15 08:14:49 PDT
All reviewed patches have been landed.  Closing bug.