[wpe-webkit] Allowing CORS for custom URI scheme

Adrian Perez de Castro aperez at igalia.com
Tue Oct 22 14:48:33 PDT 2019


Hello Ryan,

On Sun, 05 May 2019 18:53:49 -0400, Ryan Walklin <ryan at testtoast.com> wrote:
 
> I'm trying to get communication between my app and a WebKitWPE instance
> going, using the advice in this thread -
> https://lists.webkit.org/pipermail/webkit-wpe/2018-June/000019.html.
> 
> What I want to do is register a custom URI scheme, which I've done with
> webkit_web_context_register_uri_scheme(). Then I want to load my UI into
> WPE, using either webpack for development, or a bundle file URL for
> deployment. Then my plan was to use my custom URI to make API calls into my
> app to update the UI with XHR, ie with an app hosted from 127.0.0.1:8080
> (via webpack-dev-server) call 
> 
> $.ajax({ customuri://function/with/some/state }) 
> 
> and get JSON back to update the UI. However I get CORS errors, even after
> setting webkit_security_manager_register_uri_scheme_as_cors_enabled() for my
> custom scheme. The URI scheme callback fires, however I think because the
> response from the callback doesn't include the Access-Control-Allow-Origin
> '*' header, webkit then drops the response. 
> 
> Is there any way to solve this and let me use a custom URI this way, or is
> there a better way to have this API style interaction with the WPE host app?

Today I finally got back to this, and I have made a WIP patch (untested,
and still needs unit tests before we can merge it). If you would like to
try it out, you can find it attached to the bug at

  https://bugs.webkit.org/show_bug.cgi?id=203273

I hope something like this would work for you. If you have any feedback
on the API added by the patch, please let me know :)

Regards,
—Adrián
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-wpe/attachments/20191023/3f2d0441/attachment.bin>


More information about the webkit-wpe mailing list