Bug 84018 - [GTK][WK2] Implement API for generic permission requests
: [GTK][WK2] Implement API for generic permission requests
Status: RESOLVED FIXED
: WebKit
WebKit Gtk
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To:
:
: Gtk
:
: 83879
  Show dependency treegraph
 
Reported: 2012-04-16 03:37 PST by
Modified: 2012-05-25 06:45 PST (History)


Attachments
Patch Proposal (19.72 KB, patch)
2012-04-16 03:44 PST, Mario Sanchez Prada
pnormand: commit‑queue-
Review Patch | Details | Formatted Diff | Diff
Patch Proposal (19.53 KB, patch)
2012-04-16 04:05 PST, Mario Sanchez Prada
no flags Review Patch | Details | Formatted Diff | Diff
Patch Proposal (20.06 KB, patch)
2012-04-20 10:33 PST, Mario Sanchez Prada
mrobinson: review+
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2012-04-16 03:37:55 PST
This will be useful for implementing things like geolocation or fullscreen permission requests
------- Comment #1 From 2012-04-16 03:44:39 PST -------
Created an attachment (id=137309) [details]
Patch Proposal
------- Comment #2 From 2012-04-16 03:47: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 From 2012-04-16 03:50:01 PST -------
(From update of attachment 137309 [details])
Attachment 137309 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/12416004
------- Comment #4 From 2012-04-16 04:05:30 PST -------
Created an attachment (id=137312) [details]
Patch Proposal
------- Comment #5 From 2012-04-17 00:34:29 PST -------
(From update of attachment 137312 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=137312&action=review

Looks good.

> Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:29
> + * There are situations where a web browser would need to ask the user

Not all embedders are web browsers

> Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:33
> + * #WebKitWebVice::permission-request signal with a

WebKitWebVice? :-P

> Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:40
> + * If the signal handler does nothing, WebKit will act as if
> + * webkit_permission_request_deny() was called as soon as signal
> + * handling completes. To handle a permission request in an
> + * asynchronous way, simply increment the reference count of the
> + * #WebKitPermissionRequest object.

This depends on the implementation, or it should be enforced by the interface.

> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:656
> +     *

You should mention here that if this signal is not hanlded, the default behaviour is to deny the request

> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:661
> +     *

A code snippet here would help to understand how to use this signal

> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h:146
> +    gboolean   (* permission_request)    (WebKitWebView              *web_view,
> +                                          WebKitPermissionRequest    *permission_request);

There's an extra space before parameter names.
------- Comment #6 From 2012-04-20 10:33:02 PST -------
Created an attachment (id=138114) [details]
Patch Proposal

Thanks for the review. Attached new patch addressing all the issues.

See some comments below...

(In reply to comment #5)
> [...]
> Not all embedders are web browsers
>
Fixed.

> > Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:33
> > + * #WebKitWebVice::permission-request signal with a
> 
> WebKitWebVice? :-P

You have to admit it was a great name to have in the API, a bit useless though.

Fixed.

> > Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:40
> > + * If the signal handler does nothing, WebKit will act as if
> > + * webkit_permission_request_deny() was called as soon as signal
> > + * handling completes. To handle a permission request in an
> > + * asynchronous way, simply increment the reference count of the
> > + * #WebKitPermissionRequest object.
> 
> This depends on the implementation, or it should be enforced by the interface.

Fixed (just removed)

> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:656
> > +     *
> 
> You should mention here that if this signal is not hanlded, the default behaviour is to deny the request
>
Fixed.

> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:661
> > +     *
> 
> A code snippet here would help to understand how to use this signal
>

Fixed.

> > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h:146
> > +    gboolean   (* permission_request)    (WebKitWebView              *web_view,
> > +                                          WebKitPermissionRequest    *permission_request);
> 
> There's an extra space before parameter names.

Fixed.
------- Comment #7 From 2012-04-26 09:01:59 PST -------
(From update of attachment 138114 [details])
View in context: https://bugs.webkit.org/attachment.cgi?id=138114&action=review

Looks good. In the future, some requests show allow asynchronous handling. Some probably won't allow that. The documentation in WebKitWebView should explain the situation and we should add some API to make this discoverable.

> Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:30
> + * for permission on certain type of operations, such as switching to

"to ask the user for permission on certain type" -> "to ask the user for permission to do certain types"

> Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp:31
> + * full screen mode or reporting the user's location through the

Nit: you use "full screen" here but "fullscreen" below.

> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:198
> +static gboolean webkitWebViewPermissionRequest(WebKitWebView*, WebKitPermissionRequest* decision)
> +{
> +    webkit_permission_request_deny(decision);
> +    return TRUE;
> +}

Installing a default handler like this means that the request cannot be answered asynchronously. Perhaps it's better to do this in the finalize method for the concrete types.

> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:655
> +     * decide about a permission request, such as allowing the browser
> +     * switch to fullscreen mode, sharing its location or similar.

"allowing the browser to switch to fullscreen"

"or similar" -> "or similar operations."

> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:658
> +     * A possible way to use this signal could be through a dialog to
> +     * allow the user decide what to do with the request:

"through a dialog to allow" -> "through a dialog allowing"
------- Comment #8 From 2012-05-25 06:45:44 PST -------
Committed r118522: <http://trac.webkit.org/changeset/118522>