RESOLVED FIXED222471
[WPE][GTK] Bogus Response.{status,ok} for successful fetch() requests to a custom URI scheme handler
https://bugs.webkit.org/show_bug.cgi?id=222471
Summary [WPE][GTK] Bogus Response.{status,ok} for successful fetch() requests to a cu...
Adrian Perez
Reported 2021-02-26 06:58:08 PST
Steps to reproduce: 1. Use webkit_web_context_register_uri_scheme(), e.g. "myscheme", make the callback always finish requests with a valid GInputStream (for example, return the "Hello world" string for any requested URI). 2. Load a page that contains this: fetch("myscheme:/someresource", {mode: "no-cors"}) .then(response => { console.log("Status:", response.ok, response.status) response.text().then(text => { console.log("Text:", text); }); }) .catch(console.error); Expected outcome ---------------- * The response is considered successful. * The logged output contains: Status: true 200 Text: Hello, world Actual outcome -------------- * The response is NOT considered successful, yet the * The logged output contains: Status: false 0 Text: Hello, world
Attachments
Patch (1.93 KB, patch)
2021-02-26 08:45 PST, Adrian Perez
no flags
Adrian Perez
Comment 1 2021-02-26 07:00:23 PST
This is somewhat related to bug #203273 but much, much smaller in scope, and I think setting the status to “200 OK” when an URI scheme request is finished with a valid “GInputStreams” should not be controversial, so let's tackle this small annoyance first.
Adrian Perez
Comment 2 2021-02-26 08:45:48 PST
EWS Watchlist
Comment 3 2021-02-26 08:47:00 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
EWS
Comment 4 2021-02-26 23:24:35 PST
Committed r273618: <https://commits.webkit.org/r273618> All reviewed patches have been landed. Closing bug and clearing flags on attachment 421653 [details].
Alex Christensen
Comment 5 2021-11-02 09:12:22 PDT
Comment on attachment 421653 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=421653&action=review > Source/WebKit/ChangeLog:8 > + No new tests needed. This should be easy to add a unit test for, especially if you care about not regressing this functionality in the future.
Carlos Garcia Campos
Comment 6 2021-11-03 01:29:36 PDT
We have recently added api to set the response, including api tests for checking the status and message.
Note You need to log in before you can comment on or make changes to this bug.