After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 684448 - Delete web application button doesn't work in WebKit2
Delete web application button doesn't work in WebKit2
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Web Applications
3.5.x
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on: 691417
Blocks: 678610
 
 
Reported: 2012-09-20 09:33 UTC by Carlos Garcia Campos
Modified: 2013-01-11 09:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't use DOM bindings to delete a web application from about:applications (8.24 KB, patch)
2012-09-21 16:53 UTC, Carlos Garcia Campos
none Details | Review
Patch (4.04 KB, patch)
2012-09-21 16:53 UTC, Carlos Garcia Campos
reviewed Details | Review
Update: Don't use DOM bindings to delete a web application from about:applications (8.50 KB, patch)
2012-11-15 10:21 UTC, Carlos Garcia Campos
reviewed Details | Review
Update: Don't use DOM bindings to delete a web application from about:applications (8.53 KB, patch)
2013-01-09 14:17 UTC, Carlos Garcia Campos
committed Details | Review
Patch (3.97 KB, patch)
2013-01-09 14:17 UTC, Carlos Garcia Campos
committed Details | Review

Description Carlos Garcia Campos 2012-09-20 09:33:35 UTC
Because it requires DOM bindings that are not available in WebKit2. We could use a link, instead of a form, like chromium does for some prefs pages, and use the policy client API to catch the request, get the app id from the URL, delete the web app, ignore the request and start a new one for about:applications.
Comment 1 Carlos Garcia Campos 2012-09-21 16:53:26 UTC
Created attachment 224942 [details] [review]
Don't use DOM bindings to delete a web application from about:applications

Use a different form for every web application with a hidden value containing the application id. Then use the policy client to ignore any form submission from about:applications and delete the application instead, reloading the about:applications page. This solution will work for WebKit2 too.
Comment 2 Carlos Garcia Campos 2012-09-21 16:53:54 UTC
Created attachment 224943 [details] [review]
Patch
Comment 3 Carlos Garcia Campos 2012-11-15 10:21:38 UTC
Created attachment 229034 [details] [review]
Update: Don't use DOM bindings to delete a web application from about:applications

Include ephy-web-app-utils.h in ephy-window.c
Comment 4 Diego Escalante Urrelo (not reading bugmail) 2012-12-11 10:02:41 UTC
Review of attachment 229034 [details] [review]:

This looks good. The previous patch is obsolete, right?

::: embed/ephy-about-handler.c
@@ +235,3 @@
   }
 
+  g_string_append (data_str, "</table></body>");

This is because a single form would submit every Delete button, right?
Comment 5 Diego Escalante Urrelo (not reading bugmail) 2012-12-11 10:02:44 UTC
Review of attachment 229034 [details] [review]:

This looks good. The previous patch is obsolete, right?

::: embed/ephy-about-handler.c
@@ +235,3 @@
   }
 
+  g_string_append (data_str, "</table></body>");

This is because a single form would submit every Delete button, right?
Comment 6 Diego Escalante Urrelo (not reading bugmail) 2012-12-11 10:02:45 UTC
Review of attachment 229034 [details] [review]:

This looks good. The previous patch is obsolete, right?

::: embed/ephy-about-handler.c
@@ +235,3 @@
   }
 
+  g_string_append (data_str, "</table></body>");

This is because a single form would submit every Delete button, right?
Comment 7 Diego Escalante Urrelo (not reading bugmail) 2012-12-11 10:03:19 UTC
Thank you, bugzilla.
Comment 8 Xan Lopez 2013-01-08 17:52:52 UTC
Since we are going to have DOM bindings in WK2 I wonder if we shouldn't just fix the FIXME for WK2 and be done with this. I very much prefer the current approach to hidden forms and page reloads, fwiw.
Comment 9 Xan Lopez 2013-01-08 18:07:02 UTC
(In reply to comment #8)
> Since we are going to have DOM bindings in WK2 I wonder if we shouldn't just
> fix the FIXME for WK2 and be done with this. I very much prefer the current
> approach to hidden forms and page reloads, fwiw.

Just for the sake of clarification after talking with Carlos:

- The page already has a form. It's there just for the sake of forcing the page to load again, but no processing is done in the form itself. We hook into the buttons to know which app to delete using dom bindings, and we could easily just update the DOM there to remove that row.

- So one option is to leave the code as it is and just implement the WK2 version using the WK2 flavor of the DOM bindings.

- Another option is to do what this patch proposes, which moves processing of the app to delete to the form logic and gets rid of the DOM bindings usage.

- And yet a third option is to even improve the code to not have forms at all (and no reloads), and update the page with the bindings. Then we'd do the same in WK2 too.

My ideal scenario is the third one, then the first, and then the second, but I don't feel very strongly about this.
Comment 10 Xan Lopez 2013-01-08 18:54:55 UTC
After another chat with Carlos we did agree on reworking the patch to save the extra load it introduces (so we'd be down to just the current load through the form), but we'll stop using the bindings to simplify things for the time being.
Comment 11 Carlos Garcia Campos 2013-01-09 14:17:18 UTC
Created attachment 233076 [details] [review]
Update: Don't use DOM bindings to delete a web application from about:applications

Use policy use instead of ignore + load
Comment 12 Carlos Garcia Campos 2013-01-09 14:17:55 UTC
Created attachment 233077 [details] [review]
Patch

Same here for WebKit2
Comment 13 Xan Lopez 2013-01-10 16:23:08 UTC
Review of attachment 233076 [details] [review]:

Looks OK, just those two comments.

::: src/ephy-window.c
@@ +2476,3 @@
+
+	if (!uri->query)
+		return;

This leaks the URI.

@@ +2761,3 @@
 
+	if (reason == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED &&
+	    g_str_has_prefix (webkit_web_view_get_uri (web_view), "ephy-about:applications"))

My previous comment about this not being NULL safe still applies, I think.
Comment 14 Xan Lopez 2013-01-10 16:27:25 UTC
Review of attachment 233077 [details] [review]:

::: src/ephy-window.c
@@ +2635,2 @@
+	if (navigation_type == WEBKIT_NAVIGATION_TYPE_FORM_SUBMITTED &&
+	    g_str_has_prefix (webkit_web_view_get_uri (web_view), "ephy-about:applications"))

Just the same comment here.
Comment 15 Carlos Garcia Campos 2013-01-11 08:43:58 UTC
(In reply to comment #13)
> Review of attachment 233076 [details] [review]:
> 
> Looks OK, just those two comments.
> 
> ::: src/ephy-window.c
> @@ +2476,3 @@
> +
> +    if (!uri->query)
> +        return;
> 
> This leaks the URI.

Good catch. I'll remove the early return.

> @@ +2761,3 @@
> 
> +    if (reason == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED &&
> +        g_str_has_prefix (webkit_web_view_get_uri (web_view),
> "ephy-about:applications"))
> 
> My previous comment about this not being NULL safe still applies, I think.

I don't know in WebKit1, but in WebKit2 you are guaranteed to have a URI when the policy signal is emitted. In any case, a NULL check doesn't hurt here.