GNOME Bugzilla – Bug 683100
Use custom URI schemes to handle document URIs
Last modified: 2015-06-24 11:04:08 UTC
Instead of passing the HTML data directly to webkit using webkit_web_view_load_html_string(), we could implement custom URI schemes handlers for help URIs (help: ghelp: etc.) and use webkit_web_view_load_uri(). This way we don't need to change the URI of resources that are being loaded. This is required to port yelp to WebKit2, because in WebKit2 it's not possible to change the URI of a resource network request when it's loaded.
Created attachment 223045 [details] [review] yelp-document: Make document-uri property a YelpUri
Created attachment 223046 [details] [review] yelp-mallard-document: Fix use of uninitialized variable
Created attachment 223047 [details] [review] yelp-document: Return HTML mime type insted of NULL for search pages
Created attachment 223048 [details] [review] yelp-document: Add yelp_document_get_for_docuri()
Created attachment 223049 [details] [review] yelp-common.xsl: Use a full file:// URI for the javascript
Created attachment 223050 [details] [review] yelp-view: Fix memory leaks
Created attachment 223051 [details] [review] yelp-document: Mutex is unlocked twice when generating search results
Created attachment 223052 [details] [review] yelp-document: Use xref: uris for search results
Created attachment 223053 [details] [review] yelp-uri: Use 'index' as default page for help: uris when resolving a xref
Created attachment 223055 [details] [review] yelp-view: Don't free the passed GError in view_show_error_page()
Created attachment 223056 [details] [review] yelp-view: Use custom URI schemes to handle document URIs
The last patch requires new webkit API that hasn't landed yet, see bug: https://bugs.webkit.org/show_bug.cgi?id=95549
WebKit patch landed already http://trac.webkit.org/changeset/127749
Review of attachment 223047 [details] [review]: ::: libyelp/yelp-document.c @@ +1122,3 @@ + if (page_id != NULL && g_str_has_prefix (page_id, "search=")) + return g_strdup ("text/html"); I prefer application/xhtml+xml for anything created by Yelp.
Review of attachment 223045 [details] [review]: This is kind of peculiar, because a YelpUri contains information about the specific page, and not just the document. I need to look at this more.
Comment on attachment 223046 [details] [review] yelp-mallard-document: Fix use of uninitialized variable Attachment 223046 [details] pushed as 8b88fcd - yelp-mallard-document: Fix use of uninitialized variable
Review of attachment 223048 [details] [review]: The function name implies it would have the equivalent functionality as yelp_document_get_for_uri(), when in fact it only does lookups of existing documents, and doesn't create new documents. Maybe _lookup_document_uri()?
Comment on attachment 223050 [details] [review] yelp-view: Fix memory leaks Attachment 223050 [details] pushed as 10af959 - yelp-view: Fix memory leaks
Review of attachment 223052 [details] [review]: What's the rationale for this?
Attachment 223051 [details] pushed as 59091e4 - yelp-document: Mutex is unlocked twice when generating search results Attachment 223055 [details] pushed as 22ce877 - yelp-view: Don't free the passed GError in view_show_error_page()
(In reply to comment #19) > Review of attachment 223052 [details] [review]: > > What's the rationale for this? IIRC those links are resolved by will-send-request, using the fake URI trick. When using custom uri schemes, the relative paths are resolved using the uri loaded, so using xfer uris they are not considered relative, and they are handled like all other xfer uris.
(In reply to comment #14) > Review of attachment 223047 [details] [review]: > > ::: libyelp/yelp-document.c > @@ +1122,3 @@ > > + if (page_id != NULL && g_str_has_prefix (page_id, "search=")) > + return g_strdup ("text/html"); > > I prefer application/xhtml+xml for anything created by Yelp. It's probably a bug in WebKitGTK+ but using application/xhtml+xml makes the contents be rendered as plain text. I would need to look at it in more detail.
Created attachment 229631 [details] [review] yelp-document: Add yelp_document_lookup_document_uri()
Created attachment 229632 [details] [review] yelp-view: Use custom URI schemes to handle document URIs Updated to use yelp_document_lookup_document_uri()
Hi. At what stage are we in fixing this bug? Can I help? How? For 2 weeks I've been diving into yelp and webkit to fix some accessibility bugs. Now they told me I should rather think about webkit2, so I would like to help in the switch.
Current WebKit allows to implement the hack of fake uris that are resolved in send-request signal, using a WebProcess extension. I still think custom uri schemes is the right way to implement this, though.
Btw, I don't mind to rebase my patches and make them work with current webkit if there's any interest.
Hi. Sure, rebasing that patches could be really useful! Appart from that, what patches does need work?? The MIME type patch continues having the same problem, the application/xhtml+xml is rendered as plain text in Yelp and if I create a simple cgi script i python that returns a web with that mimetype and open that web with GNOME Web the content is rendered as XML. So it's probably a WebKit bug...
Hi! I have been checking what patches are needed now for implementing the WK2 port and what pathes need to be rebased. * Make document-uri property a YelpUri -> The patch needs rebase. * Return HTML mime type insted of NULL for search pages -> We continue having the WK bug so application/xhtml+xml MIME type is rendered as plain text. * Use a full file:// for the JS -> We don't need that anymore the JS code has been moved to the Yelp-XSL module. * Use xref: uris for search results -> The patch applies in master! * Use 'index' as default page for help: uris when resolving a xref -> The patch applies in master! * Add yelp_document_lookup_document_uri() -> The patch needs rebase * Use custom URI schemes to handle document URIs -> We can implement this feature using the new WK2 API for custom schemes so this patch is not needed anymore. Carlos, could you rebase those two patches? :) And could some Yelp developer gives us some thoughts about those patches??
Created attachment 286587 [details] [review] Rebase of the YelpUri patch I have made the rebase! I thought it would be more difficult...
Created attachment 286588 [details] [review] Rebase of the yelp_document_lookup_document_uri patch
Created attachment 289725 [details] [review] "return html mimetype" patch rebase Rebase and fix of "return html mimetype instead of null for searchs results" Carlos patch.
Just to sum up, the patches I've use to make the WK2 port have been: 1)Rebase of the YelpUri patch 2)Rebase of the yelp_document_lookup_document_uri patch 3)yelp-document: Use xref: uris for search results 4)"return html mimetype" patch rebase 5)yelp-uri: Use 'index' as default page for help: uris when resolving a xref