| Summary: | Should have a way to register GResources in web process | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Philip Chimento <philip.chimento> | ||||
| Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Enhancement | CC: | bugs-noreply, cgarcia | ||||
| Priority: | P2 | ||||||
| Version: | 528+ (Nightly build) | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
Philip Chimento
2014-09-16 13:56:04 PDT
(In reply to comment #0) > Created an attachment (id=238207) [details] > Sample package demonstrating the problem > > Currently, for loading an HTML page from a GResource, such as: > > webkit_web_view_load_uri (view, "resource:///com/example/my/resource/index.html"); > > you need to write a WebKitWebExtension and either compile the GResource into the extension, or call g_resource_load() and g_resources_register() in the extension's init function. And that wouldn't be enough either, if you use multi-webprocess model, the network process needs to access the gresource as well. > It would be convenient to provide some API such as webkit_web_view_register_gresource(view, "/path/to/my.gresource"). This might work, since we would notify the networking process to load the resources. > See the attached tarball for a little program that demonstrates the problem. If you do not load the extension, then you get this message: > > > The resource at '/com/example/WebKitTestGResource/resource.html' does not exist > > Of course a workaround would be to load the contents of the GResource URI in the calling program, and feed it to WebKit with webkit_web_view_load_html(), but that disallows the HTML page from referencing other files in the GResource (which is why I included a CSS file in the example GResource as well.) You could use a custom uri scheme, but all gresources would be loaded by the UI process and sent to the networking process. > > Of course a workaround would be to load the contents of the GResource URI in the calling program, and feed it to WebKit with webkit_web_view_load_html(), but that disallows the HTML page from referencing other files in the GResource (which is why I included a CSS file in the example GResource as well.) > > You could use a custom uri scheme, but all gresources would be loaded by the UI process and sent to the networking process. I thought about that, but wouldn't that potentially send large amounts of data through IPC? |