<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[285155] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/285155">285155</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-11-02 01:47:27 -0700 (Tue, 02 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK][WPE] Support setting status code and getting HTTP method in custom URI scheme handlers
https://bugs.webkit.org/show_bug.cgi?id=231880

Patch by Zixing Liu <liushuyu011@gmail.com> on 2021-11-02
Reviewed by Carlos Garcia Campos.

Source/WebKit:

* SourcesGTK.txt: Added WebKitURISchemeResponse.cpp
* SourcesWPE.txt: Added WebKitURISchemeResponse.cpp
* UIProcess/API/glib/WebKitURISchemeRequest.cpp:
(webkit_uri_scheme_request_get_http_method): Added new API function
(webkit_uri_request_finish_with_response): Added new API function
* UIProcess/API/glib/WebKitURISchemeRequestPrivate.h:  Added.
* UIProcess/API/glib/WebKitURISchemeResponse.cpp: Added.
(webkit_uri_scheme_response_class_init): Added init function for the new type
(webkit_uri_scheme_response_new): Added new API function
(webkit_uri_scheme_response_set_status): Added new API function
(webkit_uri_scheme_response_set_content_type): Added new API function
* UIProcess/API/glib/WebKitURISchemeResponsePrivate.h: Copied from Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequestPrivate.h.
* UIProcess/API/gtk/WebKitAutocleanups.h: Register clean-up function for WebkitURISchemeResponse
* UIProcess/API/gtk/WebKitURISchemeRequest.h: Added function prototype for
webkit_uri_scheme_request_get_http_method
* UIProcess/API/gtk/WebKitURISchemeResponse.h: Added.
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Added new symbols and new types
* UIProcess/API/gtk/webkit2.h: Include a new header: WebKitURISchemeResponse.h
* UIProcess/API/wpe/WebKitURISchemeRequest.h: Added function prototype for
webkit_uri_scheme_request_get_http_method
* UIProcess/API/gtk/WebKitURISchemeResponse.h: Added.
* UIProcess/API/wpe/webkit.h: Include a new header: WebKitURISchemeResponse.h
* UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Added new symbols and new types

Tools:

* TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
(testWebContextURIScheme): Added tests to test new public APIs for WebKitGtk</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitPlatformGTKcmake">trunk/Source/WebKit/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKitPlatformWPEcmake">trunk/Source/WebKit/PlatformWPE.cmake</a></li>
<li><a href="#trunkSourceWebKitSourcesGTKtxt">trunk/Source/WebKit/SourcesGTK.txt</a></li>
<li><a href="#trunkSourceWebKitSourcesWPEtxt">trunk/Source/WebKit/SourcesWPE.txt</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIglibWebKitURISchemeRequestcpp">trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkWebKitAutocleanupsh">trunk/Source/WebKit/UIProcess/API/gtk/WebKitAutocleanups.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkWebKitURISchemeRequesth">trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeRequest.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkdocswebkit2gtk40sectionstxt">trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkdocswebkit2gtk40types">trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0.types</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkdocswebkit2gtkdocssgml">trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkwebkit2h">trunk/Source/WebKit/UIProcess/API/gtk/webkit2.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIwpeWebKitAutocleanupsh">trunk/Source/WebKit/UIProcess/API/wpe/WebKitAutocleanups.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIwpeWebKitURISchemeRequesth">trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeRequest.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIwpedocswpe10sectionstxt">trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-1.0-sections.txt</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIwpedocswpedocssgml">trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIwpewebkith">trunk/Source/WebKit/UIProcess/API/wpe/webkit.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKitGLibTestWebKitWebContextcpp">trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitUIProcessAPIglibWebKitURISchemeResponsecpp">trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponse.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIglibWebKitURISchemeResponsePrivateh">trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponsePrivate.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIgtkWebKitURISchemeResponseh">trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeResponse.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessAPIwpeWebKitURISchemeResponseh">trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeResponse.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/ChangeLog       2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2021-11-02  Zixing Liu  <liushuyu011@gmail.com>
+
+        [GTK][WPE] Support setting status code and getting HTTP method in custom URI scheme handlers
+        https://bugs.webkit.org/show_bug.cgi?id=231880
+
+        Reviewed by Carlos Garcia Campos.
+
+        * SourcesGTK.txt: Added WebKitURISchemeResponse.cpp
+        * SourcesWPE.txt: Added WebKitURISchemeResponse.cpp
+        * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
+        (webkit_uri_scheme_request_get_http_method): Added new API function
+        (webkit_uri_request_finish_with_response): Added new API function
+        * UIProcess/API/glib/WebKitURISchemeRequestPrivate.h:  Added.
+        * UIProcess/API/glib/WebKitURISchemeResponse.cpp: Added.
+        (webkit_uri_scheme_response_class_init): Added init function for the new type
+        (webkit_uri_scheme_response_new): Added new API function
+        (webkit_uri_scheme_response_set_status): Added new API function
+        (webkit_uri_scheme_response_set_content_type): Added new API function
+        * UIProcess/API/glib/WebKitURISchemeResponsePrivate.h: Copied from Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequestPrivate.h.
+        * UIProcess/API/gtk/WebKitAutocleanups.h: Register clean-up function for WebkitURISchemeResponse
+        * UIProcess/API/gtk/WebKitURISchemeRequest.h: Added function prototype for 
+        webkit_uri_scheme_request_get_http_method
+        * UIProcess/API/gtk/WebKitURISchemeResponse.h: Added.
+        * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt: Added new symbols and new types
+        * UIProcess/API/gtk/webkit2.h: Include a new header: WebKitURISchemeResponse.h
+        * UIProcess/API/wpe/WebKitURISchemeRequest.h: Added function prototype for 
+        webkit_uri_scheme_request_get_http_method
+        * UIProcess/API/gtk/WebKitURISchemeResponse.h: Added.
+        * UIProcess/API/wpe/webkit.h: Include a new header: WebKitURISchemeResponse.h
+        * UIProcess/API/wpe/docs/wpe-1.0-sections.txt: Added new symbols and new types
+
</ins><span class="cx"> 2021-11-01  Michael[tm] Smith  <mike@w3.org>
</span><span class="cx"> 
</span><span class="cx">         [WebInspector][CORS] Show HTTP status code in CORS messages.
</span></span></pre></div>
<a id="trunkSourceWebKitPlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/PlatformGTK.cmake (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/PlatformGTK.cmake    2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/PlatformGTK.cmake       2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -146,6 +146,7 @@
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitURIRequest.h
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitURIResponse.h
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitURISchemeRequest.h
</span><ins>+    ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitURISchemeResponse.h
</ins><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitURIUtilities.h
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitUserContent.h
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/gtk/WebKitUserContentFilterStore.h
</span></span></pre></div>
<a id="trunkSourceWebKitPlatformWPEcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/PlatformWPE.cmake (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/PlatformWPE.cmake    2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/PlatformWPE.cmake       2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -176,6 +176,7 @@
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIRequest.h
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIResponse.h
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURISchemeRequest.h
</span><ins>+    ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURISchemeResponse.h
</ins><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitURIUtilities.h
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContent.h
</span><span class="cx">     ${WEBKIT_DIR}/UIProcess/API/wpe/WebKitUserContentFilterStore.h
</span></span></pre></div>
<a id="trunkSourceWebKitSourcesGTKtxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/SourcesGTK.txt (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/SourcesGTK.txt       2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/SourcesGTK.txt  2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -173,6 +173,7 @@
</span><span class="cx"> UIProcess/API/glib/WebKitSettings.cpp @no-unify
</span><span class="cx"> UIProcess/API/glib/WebKitUIClient.cpp @no-unify
</span><span class="cx"> UIProcess/API/glib/WebKitURISchemeRequest.cpp @no-unify
</span><ins>+UIProcess/API/glib/WebKitURISchemeResponse.cpp @no-unify
</ins><span class="cx"> UIProcess/API/glib/WebKitURIUtilities.cpp @no-unify
</span><span class="cx"> UIProcess/API/glib/WebKitUserContent.cpp @no-unify
</span><span class="cx"> UIProcess/API/glib/WebKitUserContentFilterStore.cpp @no-unify
</span></span></pre></div>
<a id="trunkSourceWebKitSourcesWPEtxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/SourcesWPE.txt (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/SourcesWPE.txt       2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/SourcesWPE.txt  2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -164,6 +164,7 @@
</span><span class="cx"> UIProcess/API/glib/WebKitSettings.cpp @no-unify
</span><span class="cx"> UIProcess/API/glib/WebKitUIClient.cpp @no-unify
</span><span class="cx"> UIProcess/API/glib/WebKitURISchemeRequest.cpp @no-unify
</span><ins>+UIProcess/API/glib/WebKitURISchemeResponse.cpp @no-unify
</ins><span class="cx"> UIProcess/API/glib/WebKitURIUtilities.cpp @no-unify
</span><span class="cx"> UIProcess/API/glib/WebKitUserContent.cpp @no-unify
</span><span class="cx"> UIProcess/API/glib/WebKitUserContentFilterStore.cpp @no-unify
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIglibWebKitURISchemeRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp        2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp   2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> #include "APIData.h"
</span><span class="cx"> #include "WebKitPrivate.h"
</span><span class="cx"> #include "WebKitURISchemeRequestPrivate.h"
</span><ins>+#include "WebKitURISchemeResponsePrivate.h"
</ins><span class="cx"> #include "WebKitWebContextPrivate.h"
</span><span class="cx"> #include "WebKitWebView.h"
</span><span class="cx"> #include "WebPageProxy.h"
</span><span class="lines">@@ -64,12 +65,11 @@
</span><span class="cx">     CString uriScheme;
</span><span class="cx">     CString uriPath;
</span><span class="cx"> 
</span><del>-    GRefPtr<GInputStream> stream;
-    uint64_t streamLength;
</del><ins>+    GRefPtr<WebKitURISchemeResponse> response;
</ins><span class="cx">     GRefPtr<GCancellable> cancellable;
</span><span class="cx">     char readBuffer[gReadBufferSize];
</span><span class="cx">     uint64_t bytesRead;
</span><del>-    CString contentType;
</del><ins>+    const char* httpMethod;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_DEFINE_TYPE(WebKitURISchemeRequest, webkit_uri_scheme_request, G_TYPE_OBJECT)
</span><span class="lines">@@ -161,6 +161,26 @@
</span><span class="cx">     return webkitWebContextGetWebViewForPage(request->priv->webContext, request->priv->initiatingPage.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * webkit_uri_scheme_request_get_http_method:
+ * @request: a #WebKitURISchemeRequest
+ *
+ * Get the HTTP method of the @request
+ *
+ * Returns: the HTTP method of the @request
+ * 
+ * Since: 2.36
+ */
+const gchar* webkit_uri_scheme_request_get_http_method(WebKitURISchemeRequest* request)
+{
+    g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), nullptr);
+
+    if (!request->priv->httpMethod)
+        request->priv->httpMethod = g_intern_string(request->priv->task->request().httpMethod().utf8().data());
+
+    return request->priv->httpMethod;
+}
+
</ins><span class="cx"> static void webkitURISchemeRequestReadCallback(GInputStream* inputStream, GAsyncResult* result, WebKitURISchemeRequest* schemeRequest)
</span><span class="cx"> {
</span><span class="cx">     GRefPtr<WebKitURISchemeRequest> request = adoptGRef(schemeRequest);
</span><span class="lines">@@ -174,14 +194,22 @@
</span><span class="cx">     WebKitURISchemeRequestPrivate* priv = request->priv;
</span><span class="cx">     // Need to check the stream before proceeding as it can be cancelled if finish_error
</span><span class="cx">     // was previously call, which won't be detected by g_input_stream_read_finish().
</span><del>-    if (!priv->stream)
</del><ins>+    if (!priv->response)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    WebKitURISchemeResponse* resp = priv->response.get();
</ins><span class="cx">     if (!priv->bytesRead) {
</span><del>-        ResourceResponse response(priv->task->request().url(), extractMIMETypeFromMediaType(priv->contentType.data()), priv->streamLength, emptyString());
-        response.setTextEncodingName(extractCharsetFromMediaType(priv->contentType.data()));
-        response.setHTTPStatusCode(200);
-        response.setHTTPStatusText("OK"_s);
</del><ins>+        CString contentType = WebKitURISchemeResponseGetContentType(resp);
+        ResourceResponse response(priv->task->request().url(), extractMIMETypeFromMediaType(contentType.data()), WebKitURISchemeResponseGetStreamLength(resp), emptyString());
+        response.setTextEncodingName(extractCharsetFromMediaType(contentType.data()));
+        const CString& statusMessage = WebKitURISchemeResponseGetStatusMessage(resp);
+        if (statusMessage.isNull()) {
+            response.setHTTPStatusCode(200);
+            response.setHTTPStatusText("OK"_s);
+        } else {
+            response.setHTTPStatusCode(WebKitURISchemeResponseGetStatusCode(resp));
+            response.setHTTPStatusText(statusMessage.data());
+        }
</ins><span class="cx">         if (response.mimeType().isEmpty())
</span><span class="cx">             response.setMimeType(MIMETypeRegistry::mimeTypeForPath(response.url().path().toString()));
</span><span class="cx">         priv->task->didReceiveResponse(response);
</span><span class="lines">@@ -188,6 +216,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!bytesRead) {
</span><ins>+        priv->response = nullptr;
</ins><span class="cx">         priv->task->didComplete({ });
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -213,13 +242,31 @@
</span><span class="cx">     g_return_if_fail(G_IS_INPUT_STREAM(inputStream));
</span><span class="cx">     g_return_if_fail(streamLength == -1 || streamLength >= 0);
</span><span class="cx"> 
</span><del>-    request->priv->stream = inputStream;
-    // We use -1 in the API for consistency with soup when the content length is not known, but 0 internally.
-    request->priv->streamLength = streamLength == -1 ? 0 : streamLength;
</del><ins>+    GRefPtr<WebKitURISchemeResponse> response = adoptGRef(webkit_uri_scheme_response_new(inputStream, streamLength));
+    if (contentType)
+        webkit_uri_scheme_response_set_content_type(response.get(), contentType);
+
+    webkit_uri_scheme_request_finish_with_response(request, response.get());
+}
+
+/**
+ * webkit_uri_scheme_request_finish_with_response:
+ * @request: a #WebKitURISchemeRequest
+ * @response: a #WebKitURISchemeResponse
+ *
+ * Finish a #WebKitURISchemeRequest by returning a #WebKitURISchemeResponse
+ *
+ * Since: 2.36
+ */
+void webkit_uri_scheme_request_finish_with_response(WebKitURISchemeRequest* request, WebKitURISchemeResponse* response)
+{
+    g_return_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request));
+    g_return_if_fail(WEBKIT_IS_URI_SCHEME_RESPONSE(response));
+
</ins><span class="cx">     request->priv->cancellable = adoptGRef(g_cancellable_new());
</span><del>-    request->priv->bytesRead = 0;
-    request->priv->contentType = contentType;
-    g_input_stream_read_async(inputStream, request->priv->readBuffer, gReadBufferSize, RunLoopSourcePriority::AsyncIONetwork, request->priv->cancellable.get(),
</del><ins>+    request->priv->response = response;
+
+    g_input_stream_read_async(WebKitURISchemeResponseGetStream(response), request->priv->readBuffer, gReadBufferSize, RunLoopSourcePriority::AsyncIONetwork, request->priv->cancellable.get(),
</ins><span class="cx">         reinterpret_cast<GAsyncReadyCallback>(webkitURISchemeRequestReadCallback), g_object_ref(request));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -238,7 +285,7 @@
</span><span class="cx">     g_return_if_fail(error);
</span><span class="cx"> 
</span><span class="cx">     WebKitURISchemeRequestPrivate* priv = request->priv;
</span><del>-    priv->stream = nullptr;
</del><ins>+    priv->response = nullptr;
</ins><span class="cx">     ResourceError resourceError(g_quark_to_string(error->domain), toWebCoreError(error->code), priv->task->request().url(), String::fromUTF8(error->message));
</span><span class="cx">     priv->task->didComplete(resourceError);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIglibWebKitURISchemeResponsecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponse.cpp (0 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponse.cpp                               (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponse.cpp  2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -0,0 +1,207 @@
</span><ins>+/*
+ * Copyright (C) 2021 Zixing Liu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitURISchemeResponsePrivate.h"
+
+#include "WebKitPrivate.h"
+#include <glib/gi18n-lib.h>
+#include <wtf/glib/GRefPtr.h>
+#include <wtf/glib/WTFGType.h>
+
+enum {
+    PROP_0,
+    PROP_STREAM,
+    PROP_STREAM_LENGTH,
+    N_PROPERTIES,
+};
+
+static GParamSpec* sObjProperties[N_PROPERTIES] = { nullptr, };
+
+using namespace WebKit;
+using namespace WebCore;
+
+/**
+ * SECTION: WebKitURISchemeResponse
+ * @Short_description: Represents a URI scheme response
+ * @Title: WebKitURISchemeResponse
+ *
+ * If you register a particular URI scheme in a #WebKitWebContext,
+ * using webkit_web_context_register_uri_scheme(), you have to provide
+ * a #WebKitURISchemeRequestCallback. After that, when a URI response
+ * is made with that particular scheme, your callback will be
+ * called. There you will be able to provide more response parameters
+ * when the methods and properties of a #WebKitURISchemeRequest is not
+ * enough.
+ * 
+ * When you finished setting up your #WebKitURISchemeResponse, call
+ * webkit_uri_request_finish_with_response() with it to return the response.
+ *
+ */
+
+struct _WebKitURISchemeResponsePrivate {
+    GRefPtr<GInputStream> stream;
+    uint64_t streamLength;
+
+    int statusCode { -1 };
+    CString statusMessage;
+    CString contentType;
+};
+
+WEBKIT_DEFINE_TYPE(WebKitURISchemeResponse, webkit_uri_scheme_response, G_TYPE_OBJECT)
+
+static void webkitURISchemeResponseSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
+{
+    WebKitURISchemeResponse* response = WEBKIT_URI_SCHEME_RESPONSE(object);
+
+    switch (propId) {
+    case PROP_STREAM:
+        response->priv->stream = G_INPUT_STREAM(g_value_get_object(value));
+        break;
+    case PROP_STREAM_LENGTH: {
+        gint64 streamLength = g_value_get_int64(value);
+        // We use -1 in the API for consistency with soup when the content length is not known, but 0 internally.
+        response->priv->streamLength = streamLength == -1 ? 0 : streamLength;
+        break;
+    }
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
+    }
+}
+
+static void webkit_uri_scheme_response_class_init(WebKitURISchemeResponseClass* klass)
+{
+    GObjectClass* objectClass = G_OBJECT_CLASS(klass);
+    objectClass->set_property = webkitURISchemeResponseSetProperty;
+
+    /**
+     * WebKitURISchemeResponse:stream:
+     *
+     * The input stream to read from.
+     *
+     * Since: 2.36
+     */
+    sObjProperties[PROP_STREAM] = 
+        g_param_spec_object(
+            "stream",
+            _("Input stream"),
+            _("The input stream to read from."),
+            G_TYPE_INPUT_STREAM,
+            static_cast<GParamFlags>(WEBKIT_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+    /**
+     * WebKitURISchemeResponse:stream_length:
+     *
+     * The input stream length in bytes. -1 for unknown length.
+     *
+     * Since: 2.36
+     */
+    sObjProperties[PROP_STREAM_LENGTH] = 
+        g_param_spec_int64(
+            "stream-length",
+            _("Input stream length"),
+            _("The input stream length in bytes. -1 for unknown length."),
+            -1, INT64_MAX, -1,
+            static_cast<GParamFlags>(WEBKIT_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
+
+    g_object_class_install_properties(objectClass, N_PROPERTIES, sObjProperties);
+}
+
+// Private getters
+int WebKitURISchemeResponseGetStatusCode(const WebKitURISchemeResponse* response)
+{
+    return response->priv->statusCode;
+}
+
+GInputStream* WebKitURISchemeResponseGetStream(const WebKitURISchemeResponse* response)
+{
+    return response->priv->stream.get();
+}
+
+const CString& WebKitURISchemeResponseGetStatusMessage(const WebKitURISchemeResponse* response)
+{
+    return response->priv->statusMessage;
+}
+
+const CString& WebKitURISchemeResponseGetContentType(const WebKitURISchemeResponse* response)
+{
+    return response->priv->contentType;
+}
+
+uint64_t WebKitURISchemeResponseGetStreamLength(const WebKitURISchemeResponse* response)
+{
+    return response->priv->streamLength;
+}
+
+/**
+ * webkit_uri_scheme_response_new:
+ * @input_stream: a #GInputStream to read the contents of the request
+ * @stream_length: the length of the stream or -1 if not known
+ *
+ * Create a new #WebKitURISchemeResponse
+ *
+ * Returns: (transfer full): the newly created #WebKitURISchemeResponse.
+ *
+ * Since: 2.36
+ */
+WebKitURISchemeResponse* webkit_uri_scheme_response_new(GInputStream* inputStream, gint64 streamLength)
+{
+    g_return_val_if_fail(G_IS_INPUT_STREAM(inputStream), nullptr);
+    g_return_val_if_fail(streamLength == -1 || streamLength >= 0, nullptr);
+
+    return WEBKIT_URI_SCHEME_RESPONSE(g_object_new(WEBKIT_TYPE_URI_SCHEME_RESPONSE, "stream", inputStream, "stream-length", streamLength, nullptr));
+}
+
+/**
+ * webkit_uri_scheme_response_set_content_type:
+ * @response: a #WebKitURISchemeResponse
+ * @content_type: the content type of the stream
+ *
+ * Sets the content type for the @response
+ *
+ * Since: 2.36
+ */
+void webkit_uri_scheme_response_set_content_type(WebKitURISchemeResponse* response, const gchar* contentType)
+{
+    g_return_if_fail(WEBKIT_IS_URI_SCHEME_RESPONSE(response));
+
+    response->priv->contentType = contentType;
+}
+
+/**
+ * webkit_uri_scheme_response_set_status:
+ * @response: a #WebKitURISchemeResponse
+ * @status_code: the HTTP status code to be returned
+ * @reason_phrase: (allow-none): a reason phrase
+ *
+ * Sets the status code and reason phrase for the @response.
+ * If @status_code is a known value and @reason_phrase is %NULL, the @reason_phrase will be set automatically.
+ *
+ * Since: 2.36
+ */
+void webkit_uri_scheme_response_set_status(WebKitURISchemeResponse* response, guint statusCode, const gchar* statusMessage)
+{
+    g_return_if_fail(WEBKIT_IS_URI_SCHEME_RESPONSE(response));
+
+    response->priv->statusCode = static_cast<gint>(statusCode);
+    if (statusMessage)
+        response->priv->statusMessage = statusMessage;
+    else
+        response->priv->statusMessage = soup_status_get_phrase(statusCode);
+}
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIglibWebKitURISchemeResponsePrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponsePrivate.h (0 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponsePrivate.h                          (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeResponsePrivate.h     2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+/*
+ * Copyright (C) 2021 Zixing Liu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "WebKitURISchemeResponse.h"
+#include <wtf/text/CString.h>
+
+int WebKitURISchemeResponseGetStatusCode(const WebKitURISchemeResponse*);
+GInputStream* WebKitURISchemeResponseGetStream(const WebKitURISchemeResponse*);
+const CString& WebKitURISchemeResponseGetStatusMessage(const WebKitURISchemeResponse*);
+const CString& WebKitURISchemeResponseGetContentType(const WebKitURISchemeResponse*);
+uint64_t WebKitURISchemeResponseGetStreamLength(const WebKitURISchemeResponse*);
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkWebKitAutocleanupsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitAutocleanups.h (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitAutocleanups.h       2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitAutocleanups.h  2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURIRequest, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURIResponse, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURISchemeRequest, g_object_unref)
</span><ins>+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURISchemeResponse, g_object_unref)
</ins><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserContentFilterStore, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserContentManager, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserMediaPermissionRequest, g_object_unref)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkWebKitURISchemeRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeRequest.h (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeRequest.h   2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeRequest.h      2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include <glib-object.h>
</span><span class="cx"> #include <webkit2/WebKitDefines.h>
</span><span class="cx"> #include <webkit2/WebKitForwardDeclarations.h>
</span><ins>+#include <webkit2/WebKitURISchemeResponse.h>
</ins><span class="cx"> 
</span><span class="cx"> G_BEGIN_DECLS
</span><span class="cx"> 
</span><span class="lines">@@ -71,6 +72,9 @@
</span><span class="cx"> WEBKIT_API WebKitWebView *
</span><span class="cx"> webkit_uri_scheme_request_get_web_view (WebKitURISchemeRequest *request);
</span><span class="cx"> 
</span><ins>+WEBKIT_API const gchar *
+webkit_uri_scheme_request_get_http_method (WebKitURISchemeRequest *request);
+
</ins><span class="cx"> WEBKIT_API void
</span><span class="cx"> webkit_uri_scheme_request_finish       (WebKitURISchemeRequest *request,
</span><span class="cx">                                         GInputStream           *stream,
</span><span class="lines">@@ -78,6 +82,10 @@
</span><span class="cx">                                         const gchar            *content_type);
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_API void
</span><ins>+webkit_uri_scheme_request_finish_with_response (WebKitURISchemeRequest  *request,
+                                                WebKitURISchemeResponse *response);
+
+WEBKIT_API void
</ins><span class="cx"> webkit_uri_scheme_request_finish_error (WebKitURISchemeRequest *request,
</span><span class="cx">                                         GError                 *error);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkWebKitURISchemeResponseh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeResponse.h (0 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeResponse.h                          (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitURISchemeResponse.h     2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (C) 2021 Zixing Liu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitURISchemeResponse_h
+#define WebKitURISchemeResponse_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitForwardDeclarations.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_URI_SCHEME_RESPONSE            (webkit_uri_scheme_response_get_type())
+#define WEBKIT_URI_SCHEME_RESPONSE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_URI_SCHEME_RESPONSE, WebKitURISchemeResponse))
+#define WEBKIT_IS_URI_SCHEME_RESPONSE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_URI_SCHEME_RESPONSE))
+#define WEBKIT_URI_SCHEME_RESPONSE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_URI_SCHEME_RESPONSE, WebKitURISchemeResponseClass))
+#define WEBKIT_IS_URI_SCHEME_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_URI_SCHEME_RESPONSE))
+#define WEBKIT_URI_SCHEME_RESPONSE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_URI_SCHEME_RESPONSE, WebKitURISchemeResponseClass))
+
+typedef struct _WebKitURISchemeResponse        WebKitURISchemeResponse;
+typedef struct _WebKitURISchemeResponseClass   WebKitURISchemeResponseClass;
+typedef struct _WebKitURISchemeResponsePrivate WebKitURISchemeResponsePrivate;
+
+struct _WebKitURISchemeResponse {
+    GObject parent;
+
+    WebKitURISchemeResponsePrivate *priv;
+};
+
+struct _WebKitURISchemeResponseClass {
+    GObjectClass parent_class;
+
+    void (*_webkit_reserved0) (void);
+    void (*_webkit_reserved1) (void);
+    void (*_webkit_reserved2) (void);
+    void (*_webkit_reserved3) (void);
+};
+
+WEBKIT_API GType
+webkit_uri_scheme_response_get_type           (void);
+
+WEBKIT_API WebKitURISchemeResponse *
+webkit_uri_scheme_response_new                (GInputStream            *input_stream,
+                                               gint64                   stream_length);
+
+WEBKIT_API void
+webkit_uri_scheme_response_set_status         (WebKitURISchemeResponse *response,
+                                               guint                    status_code,
+                                               const gchar             *reason_phrase);
+
+WEBKIT_API void
+webkit_uri_scheme_response_set_content_type   (WebKitURISchemeResponse *response,
+                                               const gchar             *content_type);
+
+G_END_DECLS
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkdocswebkit2gtk40sectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt   2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt      2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -1277,7 +1277,9 @@
</span><span class="cx"> webkit_uri_scheme_request_get_uri
</span><span class="cx"> webkit_uri_scheme_request_get_path
</span><span class="cx"> webkit_uri_scheme_request_get_web_view
</span><ins>+webkit_uri_scheme_request_get_http_method
</ins><span class="cx"> webkit_uri_scheme_request_finish
</span><ins>+webkit_uri_scheme_request_finish_with_response
</ins><span class="cx"> webkit_uri_scheme_request_finish_error
</span><span class="cx"> 
</span><span class="cx"> <SUBSECTION Standard>
</span><span class="lines">@@ -1295,6 +1297,27 @@
</span><span class="cx"> </SECTION>
</span><span class="cx"> 
</span><span class="cx"> <SECTION>
</span><ins>+<FILE>WebKitURISchemeResponse</FILE>
+WebKitURISchemeResponse
+webkit_uri_scheme_response_new
+webkit_uri_scheme_response_set_content_type
+webkit_uri_scheme_response_set_status
+
+<SUBSECTION Standard>
+WebKitURISchemeResponseClass
+WEBKIT_TYPE_URI_SCHEME_RESPONSE
+WEBKIT_URI_SCHEME_RESPONSE
+WEBKIT_IS_URI_SCHEME_RESPONSE
+WEBKIT_URI_SCHEME_RESPONSE_CLASS
+WEBKIT_IS_URI_SCHEME_RESPONSE_CLASS
+WEBKIT_URI_SCHEME_RESPONSE_GET_CLASS
+
+<SUBSECTION Private>
+WebKitURISchemeResponsePrivate
+webkit_uri_scheme_response_get_type
+</SECTION>
+
+<SECTION>
</ins><span class="cx"> <FILE>WebKitVersion</FILE>
</span><span class="cx"> webkit_get_major_version
</span><span class="cx"> webkit_get_minor_version
</span><span class="lines">@@ -1985,4 +2008,3 @@
</span><span class="cx"> <SUBSECTION Standard>
</span><span class="cx"> WEBKIT_TYPE_MEMORY_PRESSURE_SETTINGS
</span><span class="cx"> </SECTION>
</span><del>-
</del></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkdocswebkit2gtk40types"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0.types (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0.types  2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0.types     2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -19,6 +19,7 @@
</span><span class="cx"> webkit_mime_info_get_type
</span><span class="cx"> webkit_web_inspector_get_type
</span><span class="cx"> webkit_uri_scheme_request_get_type
</span><ins>+webkit_uri_scheme_response_get_type
</ins><span class="cx"> webkit_context_menu_get_type
</span><span class="cx"> webkit_context_menu_item_get_type
</span><span class="cx"> webkit_web_extension_get_type
</span><span class="lines">@@ -42,4 +43,4 @@
</span><span class="cx"> webkit_device_info_permission_request_get_type
</span><span class="cx"> webkit_geolocation_manager_get_type
</span><span class="cx"> webkit_geolocation_position_get_type
</span><del>-webkit_pointer_lock_permission_request_get_type
</del><span class="cx">\ No newline at end of file
</span><ins>+webkit_pointer_lock_permission_request_get_type
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkdocswebkit2gtkdocssgml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml  2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml     2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     <xi:include href="xml/WebKitPlugin.xml"/>
</span><span class="cx">     <xi:include href="xml/WebKitWebInspector.xml"/>
</span><span class="cx">     <xi:include href="xml/WebKitURISchemeRequest.xml"/>
</span><ins>+    <xi:include href="xml/WebKitURISchemeResponse.xml"/>
</ins><span class="cx">     <xi:include href="xml/WebKitVersion.xml"/>
</span><span class="cx">     <xi:include href="xml/WebKitContextMenu.xml"/>
</span><span class="cx">     <xi:include href="xml/WebKitContextMenuItem.xml"/>
</span><span class="lines">@@ -170,5 +171,10 @@
</span><span class="cx">     <xi:include href="xml/api-index-2.30.xml"><xi:fallback /></xi:include>
</span><span class="cx">   </index>
</span><span class="cx"> 
</span><ins>+  <index id="api-index-2-36" role="2.36">
+    <title>Index of new symbols in 2.36</title>
+    <xi:include href="xml/api-index-2.36.xml"><xi:fallback /></xi:include>
+  </index>
+
</ins><span class="cx">   <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</span><span class="cx"> </book>
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIgtkwebkit2h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/gtk/webkit2.h (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/gtk/webkit2.h  2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/gtk/webkit2.h     2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx"> #include <webkit2/WebKitURIRequest.h>
</span><span class="cx"> #include <webkit2/WebKitURIResponse.h>
</span><span class="cx"> #include <webkit2/WebKitURISchemeRequest.h>
</span><ins>+#include <webkit2/WebKitURISchemeResponse.h>
</ins><span class="cx"> #include <webkit2/WebKitURIUtilities.h>
</span><span class="cx"> #include <webkit2/WebKitUserContent.h>
</span><span class="cx"> #include <webkit2/WebKitUserContentFilterStore.h>
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIwpeWebKitAutocleanupsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/wpe/WebKitAutocleanups.h (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitAutocleanups.h       2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitAutocleanups.h  2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURIRequest, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURIResponse, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURISchemeRequest, g_object_unref)
</span><ins>+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitURISchemeResponse, g_object_unref)
</ins><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserContentFilterStore, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserContentManager, g_object_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserMediaPermissionRequest, g_object_unref)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIwpeWebKitURISchemeRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeRequest.h (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeRequest.h   2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeRequest.h      2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include <glib-object.h>
</span><span class="cx"> #include <wpe/WebKitDefines.h>
</span><ins>+#include <wpe/WebKitURISchemeResponse.h>
</ins><span class="cx"> 
</span><span class="cx"> G_BEGIN_DECLS
</span><span class="cx"> 
</span><span class="lines">@@ -72,6 +73,9 @@
</span><span class="cx"> WEBKIT_API WebKitWebView *
</span><span class="cx"> webkit_uri_scheme_request_get_web_view (WebKitURISchemeRequest *request);
</span><span class="cx"> 
</span><ins>+WEBKIT_API const gchar *
+webkit_uri_scheme_request_get_http_method (WebKitURISchemeRequest *request);
+
</ins><span class="cx"> WEBKIT_API void
</span><span class="cx"> webkit_uri_scheme_request_finish       (WebKitURISchemeRequest *request,
</span><span class="cx">                                         GInputStream           *stream,
</span><span class="lines">@@ -79,6 +83,10 @@
</span><span class="cx">                                         const gchar            *content_type);
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_API void
</span><ins>+webkit_uri_scheme_request_finish_with_response (WebKitURISchemeRequest  *request,
+                                                WebKitURISchemeResponse *response);
+
+WEBKIT_API void
</ins><span class="cx"> webkit_uri_scheme_request_finish_error (WebKitURISchemeRequest *request,
</span><span class="cx">                                         GError                 *error);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIwpeWebKitURISchemeResponseh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeResponse.h (0 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeResponse.h                          (rev 0)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitURISchemeResponse.h     2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2021 Zixing Liu
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#if !defined(__WEBKIT_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <wpe/webkit.h> can be included directly."
+#endif
+
+#ifndef WebKitURISchemeResponse_h
+#define WebKitURISchemeResponse_h
+
+#include <glib-object.h>
+#include <wpe/WebKitDefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_URI_SCHEME_RESPONSE            (webkit_uri_scheme_response_get_type())
+#define WEBKIT_URI_SCHEME_RESPONSE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_URI_SCHEME_RESPONSE, WebKitURISchemeResponse))
+#define WEBKIT_IS_URI_SCHEME_RESPONSE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_URI_SCHEME_RESPONSE))
+#define WEBKIT_URI_SCHEME_RESPONSE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_URI_SCHEME_RESPONSE, WebKitURISchemeResponseClass))
+#define WEBKIT_IS_URI_SCHEME_RESPONSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_URI_SCHEME_RESPONSE))
+#define WEBKIT_URI_SCHEME_RESPONSE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_URI_SCHEME_RESPONSE, WebKitURISchemeResponseClass))
+
+typedef struct _WebKitURISchemeResponse        WebKitURISchemeResponse;
+typedef struct _WebKitURISchemeResponseClass   WebKitURISchemeResponseClass;
+typedef struct _WebKitURISchemeResponsePrivate WebKitURISchemeResponsePrivate;
+
+struct _WebKitURISchemeResponse {
+    GObject parent;
+
+    WebKitURISchemeResponsePrivate *priv;
+};
+
+struct _WebKitURISchemeResponseClass {
+    GObjectClass parent_class;
+
+    void (*_webkit_reserved0) (void);
+    void (*_webkit_reserved1) (void);
+    void (*_webkit_reserved2) (void);
+    void (*_webkit_reserved3) (void);
+};
+
+WEBKIT_API GType
+webkit_uri_scheme_response_get_type           (void);
+
+WEBKIT_API WebKitURISchemeResponse *
+webkit_uri_scheme_response_new                (GInputStream            *input_stream,
+                                               gint64                   stream_length);
+
+WEBKIT_API void
+webkit_uri_scheme_response_set_status         (WebKitURISchemeResponse *response,
+                                               guint                    status_code,
+                                               const gchar             *reason_phrase);
+
+WEBKIT_API void
+webkit_uri_scheme_response_set_content_type   (WebKitURISchemeResponse *response,
+                                               const gchar             *content_type);
+
+G_END_DECLS
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIwpedocswpe10sectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-1.0-sections.txt (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-1.0-sections.txt  2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-1.0-sections.txt     2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -1214,7 +1214,9 @@
</span><span class="cx"> webkit_uri_scheme_request_get_uri
</span><span class="cx"> webkit_uri_scheme_request_get_path
</span><span class="cx"> webkit_uri_scheme_request_get_web_view
</span><ins>+webkit_uri_scheme_request_get_http_method
</ins><span class="cx"> webkit_uri_scheme_request_finish
</span><ins>+webkit_uri_scheme_request_finish_with_response
</ins><span class="cx"> webkit_uri_scheme_request_finish_error
</span><span class="cx"> 
</span><span class="cx"> <SUBSECTION Standard>
</span><span class="lines">@@ -1232,6 +1234,27 @@
</span><span class="cx"> </SECTION>
</span><span class="cx"> 
</span><span class="cx"> <SECTION>
</span><ins>+<FILE>WebKitURISchemeResponse</FILE>
+WebKitURISchemeResponse
+webkit_uri_scheme_response_new
+webkit_uri_scheme_response_set_content_type
+webkit_uri_scheme_response_set_status
+
+<SUBSECTION Standard>
+WebKitURISchemeResponseClass
+WEBKIT_TYPE_URI_SCHEME_RESPONSE
+WEBKIT_URI_SCHEME_RESPONSE
+WEBKIT_IS_URI_SCHEME_RESPONSE
+WEBKIT_URI_SCHEME_RESPONSE_CLASS
+WEBKIT_IS_URI_SCHEME_RESPONSE_CLASS
+WEBKIT_URI_SCHEME_RESPONSE_GET_CLASS
+
+<SUBSECTION Private>
+WebKitURISchemeResponsePrivate
+webkit_uri_scheme_response_get_type
+</SECTION>
+
+<SECTION>
</ins><span class="cx"> <FILE>WebKitVersion</FILE>
</span><span class="cx"> webkit_get_major_version
</span><span class="cx"> webkit_get_minor_version
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIwpedocswpedocssgml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml 2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/wpe/docs/wpe-docs.sgml    2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx">     <xi:include href="xml/WebKitCookieManager.xml"/>
</span><span class="cx">     <xi:include href="xml/WebKitPlugin.xml"/>
</span><span class="cx">     <xi:include href="xml/WebKitURISchemeRequest.xml"/>
</span><ins>+    <xi:include href="xml/WebKitURISchemeResponse.xml"/>
</ins><span class="cx">     <xi:include href="xml/WebKitContextMenu.xml"/>
</span><span class="cx">     <xi:include href="xml/WebKitContextMenuItem.xml"/>
</span><span class="cx">     <xi:include href="xml/WebKitFormSubmissionRequest.xml"/>
</span><span class="lines">@@ -108,5 +109,10 @@
</span><span class="cx">     <xi:include href="xml/api-index-2.30.xml"><xi:fallback /></xi:include>
</span><span class="cx">   </index>
</span><span class="cx"> 
</span><ins>+  <index id="api-index-2-36" role="2.36">
+    <title>Index of new symbols in 2.36</title>
+    <xi:include href="xml/api-index-2.36.xml"><xi:fallback /></xi:include>
+  </index>
+
</ins><span class="cx">   <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
</span><span class="cx"> </book>
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPIwpewebkith"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/API/wpe/webkit.h (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/API/wpe/webkit.h   2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Source/WebKit/UIProcess/API/wpe/webkit.h      2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx"> #include <wpe/WebKitURIRequest.h>
</span><span class="cx"> #include <wpe/WebKitURIResponse.h>
</span><span class="cx"> #include <wpe/WebKitURISchemeRequest.h>
</span><ins>+#include <wpe/WebKitURISchemeResponse.h>
</ins><span class="cx"> #include <wpe/WebKitURIUtilities.h>
</span><span class="cx"> #include <wpe/WebKitUserContent.h>
</span><span class="cx"> #include <wpe/WebKitUserContentFilterStore.h>
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Tools/ChangeLog       2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2021-11-02  Zixing Liu  <liushuyu011@gmail.com>
+
+        [GTK][WPE] Support setting status code and getting HTTP method in custom URI scheme handlers
+        https://bugs.webkit.org/show_bug.cgi?id=231880
+
+        Reviewed by Carlos Garcia Campos.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp:
+        (testWebContextURIScheme): Added tests to test new public APIs for WebKitGtk
+
</ins><span class="cx"> 2021-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
</span><span class="cx"> 
</span><span class="cx">         ImageDiff.cpp(74): warning C4477: 'fprintf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 2 has type 'size_t'
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKitGLibTestWebKitWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp (285154 => 285155)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp      2021-11-02 06:56:01 UTC (rev 285154)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebContext.cpp 2021-11-02 08:47:27 UTC (rev 285155)
</span><span class="lines">@@ -95,10 +95,11 @@
</span><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        URISchemeHandler(const char* reply, int replyLength, const char* mimeType)
</del><ins>+        URISchemeHandler(const char* reply, int replyLength, const char* mimeType, int statusCode = 200)
</ins><span class="cx">             : reply(reply)
</span><span class="cx">             , replyLength(replyLength)
</span><span class="cx">             , mimeType(mimeType)
</span><ins>+            , statusCode(statusCode)
</ins><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -105,6 +106,7 @@
</span><span class="cx">         CString reply;
</span><span class="cx">         int replyLength;
</span><span class="cx">         CString mimeType;
</span><ins>+        int statusCode;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     static void uriSchemeRequestCallback(WebKitURISchemeRequest* request, gpointer userData)
</span><span class="lines">@@ -120,6 +122,13 @@
</span><span class="cx">         g_assert_nonnull(scheme);
</span><span class="cx">         g_assert_true(test->m_handlersMap.contains(String::fromUTF8(scheme)));
</span><span class="cx"> 
</span><ins>+        const char* method = webkit_uri_scheme_request_get_http_method(request);
+        g_assert_nonnull(method);
+        if (!g_strcmp0(scheme, "post"))
+            g_assert_cmpstr(method, ==, "POST");
+        else
+            g_assert_cmpstr(method, ==, "GET");
+
</ins><span class="cx">         const URISchemeHandler& handler = test->m_handlersMap.get(String::fromUTF8(scheme));
</span><span class="cx"> 
</span><span class="cx">         GRefPtr<GInputStream> inputStream = adoptGRef(g_memory_input_stream_new());
</span><span class="lines">@@ -154,12 +163,15 @@
</span><span class="cx">         else if (!handler.reply.isNull())
</span><span class="cx">             g_memory_input_stream_add_data(G_MEMORY_INPUT_STREAM(inputStream.get()), handler.reply.data(), handler.reply.length(), 0);
</span><span class="cx"> 
</span><del>-        webkit_uri_scheme_request_finish(request, inputStream.get(), handler.replyLength, handler.mimeType.data());
</del><ins>+        auto response = adoptGRef(webkit_uri_scheme_response_new(inputStream.get(), handler.replyLength));
+        webkit_uri_scheme_response_set_status(response.get(), handler.statusCode, nullptr);
+        webkit_uri_scheme_response_set_content_type(response.get(), handler.mimeType.data());
+        webkit_uri_scheme_request_finish_with_response(request, response.get());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void registerURISchemeHandler(const char* scheme, const char* reply, int replyLength, const char* mimeType)
</del><ins>+    void registerURISchemeHandler(const char* scheme, const char* reply, int replyLength, const char* mimeType, int statusCode = 200)
</ins><span class="cx">     {
</span><del>-        m_handlersMap.set(String::fromUTF8(scheme), URISchemeHandler(reply, replyLength, mimeType));
</del><ins>+        m_handlersMap.set(String::fromUTF8(scheme), URISchemeHandler(reply, replyLength, mimeType, statusCode));
</ins><span class="cx">         webkit_web_context_register_uri_scheme(m_webContext.get(), scheme, uriSchemeRequestCallback, this, 0);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -297,6 +309,31 @@
</span><span class="cx">     g_assert_true(test->m_loadFailed);
</span><span class="cx">     g_assert_error(test->m_error.get(), G_IO_ERROR, G_IO_ERROR_CLOSED);
</span><span class="cx"> 
</span><ins>+    test->registerURISchemeHandler("notfound", kBarHTML, strlen(kBarHTML), "text/html", 404);
+    test->m_loadEvents.clear();
+    test->loadURI("notfound:blank");
+    test->waitUntilLoadFinished();
+    g_assert_false(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed));
+
+    test->registerURISchemeHandler("nocontent", nullptr, 0, "application/json", 204);
+    test->m_loadEvents.clear();
+    test->loadURI("nocontent:blank");
+    test->waitUntilLoadFinished();
+    g_assert_false(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed));
+    g_assert_false(test->m_loadEvents.contains(LoadTrackingTest::LoadFailed));
+
+    static const char* formHTML = "<html><body><form id=\"test-form\" method=\"POST\" action=\"post:data\"></form></body></html>";
+    test->registerURISchemeHandler("post", nullptr, 0, "application/json", 204);
+    test->m_loadEvents.clear();
+    test->loadHtml(formHTML, "post:form");
+    test->waitUntilLoadFinished();
+    GUniqueOutPtr<GError> postError;
+    test->runJavaScriptAndWaitUntilFinished("document.getElementById('test-form').submit()", &postError.outPtr());
+    g_assert_no_error(postError.get());
+    test->waitUntilLoadFinished();
+    g_assert_false(test->m_loadEvents.contains(LoadTrackingTest::ProvisionalLoadFailed));
+    g_assert_false(test->m_loadEvents.contains(LoadTrackingTest::LoadFailed));
+
</ins><span class="cx">     // Torture test time: make sure it still works if we issue a bunch of different requests all at
</span><span class="cx">     // once. Each request should finish and return exactly the same data.
</span><span class="cx">     int numIterations = 25;
</span></span></pre>
</div>
</div>

</body>
</html>