Bug 222471 - [WPE][GTK] Bogus Response.{status,ok} for successful fetch() requests to a custom URI scheme handler
Summary: [WPE][GTK] Bogus Response.{status,ok} for successful fetch() requests to a cu...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WPE WebKit (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adrian Perez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-26 06:58 PST by Adrian Perez
Modified: 2021-02-26 23:24 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.93 KB, patch)
2021-02-26 08:45 PST, Adrian Perez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Perez 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
Comment 1 Adrian Perez 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.
Comment 2 Adrian Perez 2021-02-26 08:45:48 PST
Created attachment 421653 [details]
Patch
Comment 3 EWS Watchlist 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
Comment 4 EWS 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].