title: QtWebEngine Fetch API fails with custom scheme
body: <p>Im trying to create custom schema for <a href="https://doc.qt.io/qt-5/qwebengineview.html" rel="nofollow noreferrer">QtWebEngineView</a> with <a href="https://doc.qt.io/qt-5/qwebengineurlschemehandler.html" rel="nofollow noreferrer">QWebEngineUrlSchemeHandler</a> to serve web page from local drive. Page is using <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="nofollow noreferrer">Fetch API</a> to request some json files.</p>
  <p>Here is implementation for my custom scheme</p>
  <p><strong>appschemehandler.cpp</strong></p>
  <pre><code>AppSchemeHandler::AppSchemeHandler(QObject *parent):
      QWebEngineUrlSchemeHandler(parent),
      m_scheme(QWebEngineUrlScheme(&quot;app&quot;))
  {
      m_scheme.setFlags(
          QWebEngineUrlScheme::SecureScheme |
          QWebEngineUrlScheme::LocalAccessAllowed |
          QWebEngineUrlScheme::ViewSourceAllowed |
          QWebEngineUrlScheme::ContentSecurityPolicyIgnored |
          QWebEngineUrlScheme::CorsEnabled
      );
      QWebEngineUrlScheme::registerScheme(m_scheme);
  }
  
  void AppSchemeHandler::install()
  {
      QWebEngineProfile::defaultProfile()-&gt;installUrlSchemeHandler(&quot;app&quot;, this);
  }
  
  void AppSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job)
  {
      ...
  }
  
  </code></pre>
  <p><strong>main.cpp</strong></p>
  <pre><code>int main(int argc, char *argv[])
  {
      AppSchemeHandler appSchemeHandler(nullptr);
  
      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  
      QGuiApplication app(argc, argv);
  
      appSchemeHandler.install();
  
  
      QQmlApplicationEngine engine;
  
      const QUrl url(QStringLiteral(&quot;qrc:/main.qml&quot;));
  
      QObject::connect(&amp;engine, &amp;QQmlApplicationEngine::objectCreated,
                       &amp;app, [url](QObject *obj, const QUrl &amp;objUrl) {
          if (!obj &amp;&amp; url == objUrl)
              QCoreApplication::exit(-1);
  
      }, Qt::QueuedConnection);
  
  
      engine.load(url);
  
      return app.exec();
  }
  </code></pre>
  <p><strong>main.qml</strong></p>
  <pre><code>Window {
      id: browser
  
      visible: true
      width: 800
      height: 600
  
      WebEngineView {
          id: webengine
  
          anchors.fill: parent
          url: 'app://my-app'
      }
  }
  </code></pre>
  <p><strong>index.html</strong></p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;UTF-8&quot;&gt;
      &lt;title&gt;Lets Fetch!&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Lets Fetch!&lt;/h1&gt;
      &lt;script&gt;
          fetch(&quot;/myFile.json&quot;).then(res =&gt; console.log(res.json()));
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Everything works as it should until web page is trying to <code>fetch()</code>. This is what I get to chromium console.
  <code>Fetch API cannot load app://my-app/myFile.json. URL scheme &quot;app&quot; is not supported.</code></p>
  <p>I made quick test with <a href="https://www.electronjs.org/" rel="nofollow noreferrer">Electron</a> that provides <code>protocol.registerSchemesAsPrivileged()</code> and there is no problems using Fetch API. So then I inspected electron process args and found <code>--fetch-schemes=app</code>. I think that is not Chromium (Blink?) arg since there is no change even if I pass it to my Qt application straight or through <code>QTWEBENGINE_CHROMIUM_FLAGS</code> environment variable.</p>
  <p>What is the Qt way of adding custom fetch schemes?</p>