RESOLVED FIXED 85998
[GTK] Add webkit_web_view_can_show_mime_type() to WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=85998
Summary [GTK] Add webkit_web_view_can_show_mime_type() to WebKit2 GTK+ API
Carlos Garcia Campos
Reported 2012-05-09 08:51:00 PDT
It's useful to know whether a mime type can be displayed in a WebView.
Attachments
Patch (16.80 KB, patch)
2012-05-09 08:56 PDT, Carlos Garcia Campos
no flags
Updated patch to match wk1 behaviour (17.39 KB, patch)
2012-05-09 09:44 PDT, Carlos Garcia Campos
mrobinson: review+
Carlos Garcia Campos
Comment 1 2012-05-09 08:56:16 PDT
WebKit Review Bot
Comment 2 2012-05-09 09:01:17 PDT
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
Martin Robinson
Comment 3 2012-05-09 09:16:47 PDT
Comment on attachment 140955 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=140955&action=review > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:202 > + if (decisionType != WEBKIT_POLICY_DECISION_TYPE_RESPONSE) { > + webkit_policy_decision_use(decision); > + return TRUE; > + } > + > + WebKitURIResponse* response = webkit_response_policy_decision_get_response(WEBKIT_RESPONSE_POLICY_DECISION(decision)); > + if (webkit_web_view_can_show_mime_type(webView, webkit_uri_response_get_mime_type(response))) > + webkit_policy_decision_use(decision); > + else > + webkit_policy_decision_download(decision); > + Hrm. It seems odd that a library would write non-cache data to the filesystem without the embedder specifically opting in to that.
Carlos Garcia Campos
Comment 4 2012-05-09 09:24:24 PDT
(In reply to comment #3) > (From update of attachment 140955 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=140955&action=review > > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:202 > > + if (decisionType != WEBKIT_POLICY_DECISION_TYPE_RESPONSE) { > > + webkit_policy_decision_use(decision); > > + return TRUE; > > + } > > + > > + WebKitURIResponse* response = webkit_response_policy_decision_get_response(WEBKIT_RESPONSE_POLICY_DECISION(decision)); > > + if (webkit_web_view_can_show_mime_type(webView, webkit_uri_response_get_mime_type(response))) > > + webkit_policy_decision_use(decision); > > + else > > + webkit_policy_decision_download(decision); > > + > > Hrm. It seems odd that a library would write non-cache data to the filesystem without the embedder specifically opting in to that. This is what wk1 does, try to open a binary file in minibrowser, for example, and the data is loaded inot the view as text. That's no expected. Note that download() doesn't download the file, but initiates a download operation. That's how all browsers work when you click on link and the content can't be shown in the web view.
Carlos Garcia Campos
Comment 5 2012-05-09 09:26:25 PDT
(In reply to comment #4) > (In reply to comment #3) > > (From update of attachment 140955 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=140955&action=review > > > > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:202 > > > + if (decisionType != WEBKIT_POLICY_DECISION_TYPE_RESPONSE) { > > > + webkit_policy_decision_use(decision); > > > + return TRUE; > > > + } > > > + > > > + WebKitURIResponse* response = webkit_response_policy_decision_get_response(WEBKIT_RESPONSE_POLICY_DECISION(decision)); > > > + if (webkit_web_view_can_show_mime_type(webView, webkit_uri_response_get_mime_type(response))) > > > + webkit_policy_decision_use(decision); > > > + else > > > + webkit_policy_decision_download(decision); > > > + > > > > Hrm. It seems odd that a library would write non-cache data to the filesystem without the embedder specifically opting in to that. > > This is what wk1 does, try to open a binary file in minibrowser, for example, and the data is loaded inot the view as text. That's no expected. Note that download() doesn't download the file, but initiates a download operation. That's how all browsers work when you click on link and the content can't be shown in the web view. wait, I'm wrong, they ignore it actually, only download it when response has an attachment
Carlos Garcia Campos
Comment 6 2012-05-09 09:44:57 PDT
Created attachment 140961 [details] Updated patch to match wk1 behaviour
Carlos Garcia Campos
Comment 7 2012-05-29 09:10:05 PDT
Philippe Normand
Comment 8 2012-05-29 12:57:47 PDT
ERROR:../../Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp:715:void testWebViewCanShowMIMEType(WebViewTest*, const void*): assertion failed: (webkit_web_view_can_show_mime_type(test->m_webView, "audio/ogg")) On the 3 bots. Can you please keep an eye on the bot next time after landing a patch adding new tests? Thanks :)
Carlos Garcia Campos
Comment 9 2012-05-29 23:43:02 PDT
(In reply to comment #8) > ERROR:../../Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp:715:void testWebViewCanShowMIMEType(WebViewTest*, const void*): assertion failed: (webkit_web_view_can_show_mime_type(test->m_webView, "audio/ogg")) > > On the 3 bots. Can you please keep an eye on the bot next time after landing a patch adding new tests? Thanks :) This passed locally, sorry, I'll fix it.
Note You need to log in before you can comment on or make changes to this bug.