Bug 69832

Summary: [Qt][WK2] Implement decidePolicyForResponse in our PolicyClient
Product: WebKit Reporter: Jesus Sanchez-Palencia <jesus>
Component: WebKit QtAssignee: Jesus Sanchez-Palencia <jesus>
Status: RESOLVED FIXED    
Severity: Normal CC: cshu, gopal.1.raghavan, webkit.review.bot, yael, zalan
Priority: P2 Keywords: Qt, QtTriaged
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 70115    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch kenneth: review+

Description Jesus Sanchez-Palencia 2011-10-11 05:44:58 PDT
Our PolicyClient implementation is missing decidePolicyForResponse and, therefore, can't check for a response mime type and decide whether it should download or load it.
Comment 1 Jesus Sanchez-Palencia 2011-10-11 09:01:09 PDT
Created attachment 110519 [details]
Patch
Comment 2 Chang Shu 2011-10-11 10:45:23 PDT
Comment on attachment 110519 [details]
Patch

It looks to me the patch is missing some code.
Comment 3 Jesus Sanchez-Palencia 2011-10-11 11:15:53 PDT
Created attachment 110544 [details]
Patch
Comment 4 Jesus Sanchez-Palencia 2011-10-11 11:16:46 PDT
(In reply to comment #2)
> (From update of attachment 110519 [details])
> It looks to me the patch is missing some code.

Yeah, sorry, I forgot the QtWebPageProxy piece. Here it goes...
Comment 5 Chang Shu 2011-10-11 11:30:44 PDT
Comment on attachment 110544 [details]
Patch

The implementation in WK1 may output "Ignore" policy. Can you explain why we don't need it here?
Also, is it possible to create some test cases?
Comment 6 Gopal Raghavan 2011-10-11 12:01:35 PDT
This could be duplicate. There is a related patch for navigationPolicy in https://bugs.webkit.org/show_bug.cgi?id=69572.
Comment 7 Jesus Sanchez-Palencia 2011-10-11 12:05:41 PDT
Comment on attachment 110544 [details]
Patch

Patch is missing a Ignore for downloadable content from subframes. I will update it and upload a new version.
Comment 8 Jesus Sanchez-Palencia 2011-10-11 12:07:34 PDT
(In reply to comment #6)
> This could be duplicate. There is a related patch for navigationPolicy in https://bugs.webkit.org/show_bug.cgi?id=69572.

Gopal, this patch is implemented decidePolicyForResponse that we currently missing in our PolicyClient. This function used to be called decidePolicyForMIMEType.
Comment 9 Jesus Sanchez-Palencia 2011-10-11 12:51:10 PDT
Created attachment 110561 [details]
Patch
Comment 10 Jesus Sanchez-Palencia 2011-10-11 12:58:19 PDT
(In reply to comment #5)
> (From update of attachment 110544 [details])
> The implementation in WK1 may output "Ignore" policy. Can you explain why we don't need it here?

This new patch is covering the Ignore cases, according to decisions made for N9's browser (https://gitorious.org/+qtwebkit-webkit2-dev/webkit/qtwebkit-webkit2-dev/blobs/master/WebKit2/UIProcess/API/qt/ClientImpl.cpp#line439)

> Also, is it possible to create some test cases?
There is no API directly related to this so it isn't testable directly but it will be covered when the Download API patch is reviewed and landed. I will block the other bug (#68692) with this one to keep this ongoing "relation".
Comment 11 zalan 2011-10-13 07:40:28 PDT
This is inline with N9's browser policy decision. There's no perfect way to handle non-supported subframe content AFAICS. 
This looks good to me. (as long as there isnt a priority use-case that overrides it)
Comment 12 WebKit Review Bot 2011-10-13 11:43:08 PDT
Comment on attachment 110561 [details]
Patch

Clearing flags on attachment: 110561

Committed r97375: <http://trac.webkit.org/changeset/97375>
Comment 13 WebKit Review Bot 2011-10-13 11:43:13 PDT
All reviewed patches have been landed.  Closing bug.
Comment 14 Jesus Sanchez-Palencia 2011-10-14 11:34:45 PDT
This broke QtWebKit2 trunk making it impossible to load pages. While working on it I had my Download patch (https://bugs.webkit.org/show_bug.cgi?id=68962) applied locally and I didn't realize they depended on each other. I don't believe this patch should only work with the download one, so I will investigate and clarify it. Sorry for breaking QtWK2...
Comment 15 Jesus Sanchez-Palencia 2011-10-14 13:59:07 PDT
Created attachment 111069 [details]
Patch
Comment 16 Jesus Sanchez-Palencia 2011-10-14 14:00:48 PDT
(In reply to comment #15)
> Created an attachment (id=111069) [details]
> Patch

We were dealing with an empty ResourceResponse so this patch adds the needed serialization code. It was working locally because I had this implemented on another patch... Nothing has changed on the decidePolicyForResponse implementation.
Comment 17 Kenneth Rohde Christiansen 2011-10-15 06:36:36 PDT
Comment on attachment 111069 [details]
Patch

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

> Source/WebKit2/UIProcess/qt/ClientImpl.cpp:274
> +    // It makes the browser intentionally behave differently when it comes to text(application)/xml content in subframes vs. mainframe.

I think we should not write "browser" :-) maybe client? The W3C specs call it "user agent"
Comment 18 Jesus Sanchez-Palencia 2011-10-17 05:04:42 PDT
(In reply to comment #17)
> I think we should not write "browser" :-) maybe client? The W3C specs call it "user agent"

Ok, Kenneth, I will fix this and land the patch. Thanks for the review!
Comment 19 Jesus Sanchez-Palencia 2011-10-17 05:41:14 PDT
Committed r97608: <http://trac.webkit.org/changeset/97608>