<!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>[193622] 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/193622">193622</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-12-07 04:36:18 -0800 (Mon, 07 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] Add webkit_uri_request_get_http_method
https://bugs.webkit.org/show_bug.cgi?id=151601
Source/WebKit2:
Patch by Jon Forsberg <jon.orebro@gmail.com> on 2015-12-07
Reviewed by Martin Robinson.
Add a method to get the HTTP method of a WebKitURIRequest.
* UIProcess/API/gtk/WebKitURIRequest.cpp:
(webkit_uri_request_get_http_method):
* UIProcess/API/gtk/WebKitURIRequest.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
Tools:
Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2015-12-07
Reviewed by Martin Robinson.
Add test case to check HTTP method of WebKitURIRequest.
* TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
(testURIRequestHTTPMethod):
(serverCallback):
(beforeAll):
* TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
(sendRequestCallback):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitURIRequestcpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitURIRequesth">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtk40sectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestLoaderClientcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkWebExtensionTestcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (193621 => 193622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-12-07 12:02:11 UTC (rev 193621)
+++ trunk/Source/WebKit2/ChangeLog        2015-12-07 12:36:18 UTC (rev 193622)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-12-07 Jon Forsberg <jon.orebro@gmail.com>
+
+ [GTK] Add webkit_uri_request_get_http_method
+ https://bugs.webkit.org/show_bug.cgi?id=151601
+
+ Reviewed by Martin Robinson.
+
+ Add a method to get the HTTP method of a WebKitURIRequest.
+
+ * UIProcess/API/gtk/WebKitURIRequest.cpp:
+ (webkit_uri_request_get_http_method):
+ * UIProcess/API/gtk/WebKitURIRequest.h:
+ * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
+
</ins><span class="cx"> 2015-12-07 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Add WebKitWebPage::console-message-sent signal to Web Extensions API
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitURIRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp (193621 => 193622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp        2015-12-07 12:02:11 UTC (rev 193621)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.cpp        2015-12-07 12:36:18 UTC (rev 193622)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> struct _WebKitURIRequestPrivate {
</span><span class="cx"> WebCore::ResourceRequest resourceRequest;
</span><span class="cx"> CString uri;
</span><ins>+ const char* httpMethod;
</ins><span class="cx"> GUniquePtr<SoupMessageHeaders> httpHeaders;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -171,6 +172,32 @@
</span><span class="cx"> return request->priv->httpHeaders.get();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/**
+ * webkit_uri_request_get_http_method:
+ * @request: a #WebKitURIRequest
+ *
+ * Get the HTTP method of the #WebKitURIRequest.
+ *
+ * Returns: the HTTP method of the #WebKitURIRequest or %NULL if @request is not
+ * an HTTP request.
+ *
+ * Since: 2.12
+ */
+const gchar* webkit_uri_request_get_http_method(WebKitURIRequest* request)
+{
+ g_return_val_if_fail(WEBKIT_IS_URI_REQUEST(request), nullptr);
+
+ if (!request->priv->resourceRequest.url().protocolIsInHTTPFamily())
+ return nullptr;
+
+ if (request->priv->resourceRequest.httpMethod().isEmpty())
+ return nullptr;
+
+ if (!request->priv->httpMethod)
+ request->priv->httpMethod = g_intern_string(request->priv->resourceRequest.httpMethod().utf8().data());
+ return request->priv->httpMethod;
+}
+
</ins><span class="cx"> WebKitURIRequest* webkitURIRequestCreateForResourceRequest(const ResourceRequest& resourceRequest)
</span><span class="cx"> {
</span><span class="cx"> WebKitURIRequest* uriRequest = WEBKIT_URI_REQUEST(g_object_new(WEBKIT_TYPE_URI_REQUEST, NULL));
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitURIRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.h (193621 => 193622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.h        2015-12-07 12:02:11 UTC (rev 193621)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitURIRequest.h        2015-12-07 12:36:18 UTC (rev 193622)
</span><span class="lines">@@ -70,6 +70,9 @@
</span><span class="cx"> webkit_uri_request_set_uri (WebKitURIRequest *request,
</span><span class="cx"> const gchar *uri);
</span><span class="cx">
</span><ins>+WEBKIT_API const gchar *
+webkit_uri_request_get_http_method (WebKitURIRequest *request);
+
</ins><span class="cx"> WEBKIT_API SoupMessageHeaders *
</span><span class="cx"> webkit_uri_request_get_http_headers (WebKitURIRequest *request);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtk40sectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt (193621 => 193622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt        2015-12-07 12:02:11 UTC (rev 193621)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt        2015-12-07 12:36:18 UTC (rev 193622)
</span><span class="lines">@@ -462,6 +462,7 @@
</span><span class="cx"> webkit_uri_request_new
</span><span class="cx"> webkit_uri_request_get_uri
</span><span class="cx"> webkit_uri_request_set_uri
</span><ins>+webkit_uri_request_get_http_method
</ins><span class="cx"> webkit_uri_request_get_http_headers
</span><span class="cx">
</span><span class="cx"> <SUBSECTION Standard>
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (193621 => 193622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-12-07 12:02:11 UTC (rev 193621)
+++ trunk/Tools/ChangeLog        2015-12-07 12:36:18 UTC (rev 193622)
</span><span class="lines">@@ -1,5 +1,21 @@
</span><span class="cx"> 2015-12-07 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><ins>+ [GTK] Add webkit_uri_request_get_http_method
+ https://bugs.webkit.org/show_bug.cgi?id=151601
+
+ Reviewed by Martin Robinson.
+
+ Add test case to check HTTP method of WebKitURIRequest.
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
+ (testURIRequestHTTPMethod):
+ (serverCallback):
+ (beforeAll):
+ * TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
+ (sendRequestCallback):
+
+2015-12-07 Carlos Garcia Campos <cgarcia@igalia.com>
+
</ins><span class="cx"> [GTK] Add WebKitWebPage::console-message-sent signal to Web Extensions API
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=79918
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestLoaderClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp (193621 => 193622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp        2015-12-07 12:02:11 UTC (rev 193621)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp        2015-12-07 12:36:18 UTC (rev 193622)
</span><span class="lines">@@ -404,6 +404,20 @@
</span><span class="cx"> g_assert(!strncmp(mainResourceData, "1", mainResourceDataSize));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void testURIRequestHTTPMethod(WebViewTest* test, gconstpointer)
+{
+ GRefPtr<WebKitURIRequest> uriRequest = adoptGRef(webkit_uri_request_new("file:///foo/bar"));
+ g_assert(uriRequest.get());
+ g_assert_cmpstr(webkit_uri_request_get_uri(uriRequest.get()), ==, "file:///foo/bar");
+ g_assert(!webkit_uri_request_get_http_method(uriRequest.get()));
+
+ webkit_uri_request_set_uri(uriRequest.get(), kServer->getURIForPath("/http-get-method").data());
+ test->loadRequest(uriRequest.get());
+ test->waitUntilLoadFinished();
+
+ test->runJavaScriptAndWaitUntilFinished("xhr = new XMLHttpRequest; xhr.open('POST', '/http-post-method', false); xhr.send();", nullptr);
+}
+
</ins><span class="cx"> static void testURIResponseHTTPHeaders(WebViewTest* test, gconstpointer)
</span><span class="cx"> {
</span><span class="cx"> test->loadHtml("<html><body>No HTTP headers</body></html>", "file:///");
</span><span class="lines">@@ -455,7 +469,7 @@
</span><span class="cx">
</span><span class="cx"> soup_message_set_status(message, SOUP_STATUS_OK);
</span><span class="cx">
</span><del>- if (g_str_has_prefix(path, "/normal"))
</del><ins>+ if (g_str_has_prefix(path, "/normal") || g_str_has_prefix(path, "/http-get-method"))
</ins><span class="cx"> soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString));
</span><span class="cx"> else if (g_str_equal(path, "/error"))
</span><span class="cx"> soup_message_set_status(message, SOUP_STATUS_CANT_CONNECT);
</span><span class="lines">@@ -516,6 +530,7 @@
</span><span class="cx"> ViewIsLoadingTest::add("WebKitWebView", "is-loading", testWebViewIsLoading);
</span><span class="cx"> WebPageURITest::add("WebKitWebPage", "get-uri", testWebPageURI);
</span><span class="cx"> WebViewTest::add("WebKitURIRequest", "http-headers", testURIRequestHTTPHeaders);
</span><ins>+ WebViewTest::add("WebKitURIRequest", "http-method", testURIRequestHTTPMethod);
</ins><span class="cx"> WebViewTest::add("WebKitURIResponse", "http-headers", testURIResponseHTTPHeaders);
</span><span class="cx"> WebViewTest::add("WebKitWebPage", "redirect-to-data-uri", testRedirectToDataURI);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkWebExtensionTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp (193621 => 193622)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp        2015-12-07 12:02:11 UTC (rev 193621)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp        2015-12-07 12:36:18 UTC (rev 193622)
</span><span class="lines">@@ -143,6 +143,7 @@
</span><span class="cx">
</span><span class="cx"> static gboolean sendRequestCallback(WebKitWebPage*, WebKitURIRequest* request, WebKitURIResponse* redirectResponse, gpointer)
</span><span class="cx"> {
</span><ins>+ gboolean returnValue = FALSE;
</ins><span class="cx"> const char* requestURI = webkit_uri_request_get_uri(request);
</span><span class="cx"> g_assert(requestURI);
</span><span class="cx">
</span><span class="lines">@@ -165,10 +166,17 @@
</span><span class="cx"> SoupMessageHeaders* headers = webkit_uri_request_get_http_headers(request);
</span><span class="cx"> g_assert(headers);
</span><span class="cx"> soup_message_headers_append(headers, "DNT", "1");
</span><ins>+ } else if (g_str_has_suffix(requestURI, "/http-get-method")) {
+ g_assert_cmpstr(webkit_uri_request_get_http_method(request), ==, "GET");
+ g_assert(webkit_uri_request_get_http_method(request) == SOUP_METHOD_GET);
+ } else if (g_str_has_suffix(requestURI, "/http-post-method")) {
+ g_assert_cmpstr(webkit_uri_request_get_http_method(request), ==, "POST");
+ g_assert(webkit_uri_request_get_http_method(request) == SOUP_METHOD_POST);
+ returnValue = TRUE;
</ins><span class="cx"> } else if (g_str_has_suffix(requestURI, "/cancel-this.js"))
</span><del>- return TRUE;
</del><ins>+ returnValue = TRUE;
</ins><span class="cx">
</span><del>- return FALSE;
</del><ins>+ return returnValue;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static GVariant* serializeContextMenu(WebKitContextMenu* menu)
</span></span></pre>
</div>
</div>
</body>
</html>