Bug 79775 - [GTK] Inconsistent state of WebKitWebView when replacing content in WebKit2
Summary: [GTK] Inconsistent state of WebKitWebView when replacing content in WebKit2
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks: 79777
  Show dependency treegraph
 
Reported: 2012-02-28 03:46 PST by Carlos Garcia Campos
Modified: 2012-02-28 10:25 PST (History)
3 users (show)

See Also:


Attachments
Patch (8.38 KB, patch)
2012-02-28 03:55 PST, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2012-02-28 03:46:16 PST
We are currently using a boolean set to true in webkit_web_view_replace_content() in order to ignore load events while replacing content. But that's not enough, because after replace_content() is called there might be load events of a previous ongoin operation, at least finished. So we need to set the replacing content state when the load of the replaced content starts.
Comment 1 Carlos Garcia Campos 2012-02-28 03:55:30 PST
Created attachment 129225 [details]
Patch
Comment 2 WebKit Review Bot 2012-02-28 03:58:23 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Comment 3 Martin Robinson 2012-02-28 10:03:08 PST
Comment on attachment 129225 [details]
Patch

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

Looks good. Please consider the minor cleanups below.

> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:82
> +    NoReplaceContent,

NotReplacingContent?

> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:703
> -    if (webView->priv->replacingContent) {
> +    if (webView->priv->replaceContentStatus == ReplacingContent) {
>          if (loadEvent == WEBKIT_LOAD_FINISHED)
> -            webView->priv->replacingContent = false;
> +            webView->priv->replaceContentStatus = DidReplaceContent;
>          return;
>      }
>  
> +    if (loadEvent == WEBKIT_LOAD_STARTED) {
> +        if (webView->priv->replaceContentStatus == WillReplaceContent) {
> +            webView->priv->replaceContentStatus = ReplacingContent;
> +            return;
> +        }
> +        webView->priv->replaceContentStatus = NoReplaceContent;
> +    }

Mind moving this to a helper called updateReplaceContentStatus?

> Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp:148
> +void WebViewTest::waitUntilTitleChanged(const char* expectedTitle)

Probably better to call this waitUntilTitleChangedTo.
Comment 4 Carlos Garcia Campos 2012-02-28 10:06:18 PST
(In reply to comment #3)
> (From update of attachment 129225 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=129225&action=review
> 
> Looks good. Please consider the minor cleanups below.
> 
> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:82
> > +    NoReplaceContent,
> 
> NotReplacingContent?

Sounds good.

> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:703
> > -    if (webView->priv->replacingContent) {
> > +    if (webView->priv->replaceContentStatus == ReplacingContent) {
> >          if (loadEvent == WEBKIT_LOAD_FINISHED)
> > -            webView->priv->replacingContent = false;
> > +            webView->priv->replaceContentStatus = DidReplaceContent;
> >          return;
> >      }
> >  
> > +    if (loadEvent == WEBKIT_LOAD_STARTED) {
> > +        if (webView->priv->replaceContentStatus == WillReplaceContent) {
> > +            webView->priv->replaceContentStatus = ReplacingContent;
> > +            return;
> > +        }
> > +        webView->priv->replaceContentStatus = NoReplaceContent;
> > +    }
> 
> Mind moving this to a helper called updateReplaceContentStatus?

Sure

> > Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp:148
> > +void WebViewTest::waitUntilTitleChanged(const char* expectedTitle)
> 
> Probably better to call this waitUntilTitleChangedTo.

I didn't add the 'To' because you can pass NULL to wait until title is changed to whatever thing. maybe it's better to use a default value of NULL, though
Comment 5 Martin Robinson 2012-02-28 10:08:49 PST
Comment on attachment 129225 [details]
Patch

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

>>> Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp:148
>>> +void WebViewTest::waitUntilTitleChanged(const char* expectedTitle)
>> 
>> Probably better to call this waitUntilTitleChangedTo.
> 
> I didn't add the 'To' because you can pass NULL to wait until title is changed to whatever thing. maybe it's better to use a default value of NULL, though

You could add another method called waitUntilTitleChanged that just calls waitUntilTitleChangedTo with a NULL parameter.
Comment 6 Carlos Garcia Campos 2012-02-28 10:25:05 PST
Committed r109120: <http://trac.webkit.org/changeset/109120>