<!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>[210238] 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/210238">210238</a></dd>
<dt>Author</dt> <dd>mcatanzaro@igalia.com</dd>
<dt>Date</dt> <dd>2017-01-03 03:59:28 -0800 (Tue, 03 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Expose WebKitSecurityOrigin API
https://bugs.webkit.org/show_bug.cgi?id=166632

Source/WebKit2:

Patch by Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt; and Carlos Garcia Campos &lt;cgarcia@igalia.com&gt; on 2017-01-03
Reviewed by Carlos Garcia Campos.

This API will be useful to have for various purposes, such as setting initial notification
permissions.

* PlatformGTK.cmake:
* UIProcess/API/gtk/WebKitAutocleanups.h:
* UIProcess/API/gtk/WebKitSecurityOrigin.cpp: Added.
(_WebKitSecurityOrigin::_WebKitSecurityOrigin):
(webkitSecurityOriginCreate):
(webkit_security_origin_new):
(webkit_security_origin_new_for_uri):
(webkit_security_origin_ref):
(webkit_security_origin_unref):
(webkit_security_origin_get_protocol):
(webkit_security_origin_get_host):
(webkit_security_origin_get_port):
(webkit_security_origin_is_opaque):
(webkit_security_origin_to_string):
* UIProcess/API/gtk/WebKitSecurityOrigin.h: Added.
* UIProcess/API/gtk/WebKitSecurityOriginPrivate.h: Added.
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
* UIProcess/API/gtk/webkit2.h:

Tools:

Reviewed by Carlos Garcia Campos.

* TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt:
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSecurityOrigin.cpp: Added.
(testSecurityOriginBasicConstructor):
(testSecurityOriginURIConstructor):
(testSecurityOriginDefaultPort):
(testSecurityOriginFileURI):
(testSecurityOriginDataURI):
(beforeAll):
(afterAll):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitAutocleanupsh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAutocleanups.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtk40sectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtkdocssgml">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkwebkit2h">trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkCMakeListstxt">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitSecurityOrigincpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOrigin.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitSecurityOriginh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOrigin.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitSecurityOriginPrivateh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOriginPrivate.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitSecurityOrigincpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSecurityOrigin.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (210237 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-01-03 10:24:38 UTC (rev 210237)
+++ trunk/Source/WebKit2/ChangeLog        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2017-01-03  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt; and Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Expose WebKitSecurityOrigin API
+        https://bugs.webkit.org/show_bug.cgi?id=166632
+
+        Reviewed by Carlos Garcia Campos.
+
+        This API will be useful to have for various purposes, such as setting initial notification
+        permissions.
+
+        * PlatformGTK.cmake:
+        * UIProcess/API/gtk/WebKitAutocleanups.h:
+        * UIProcess/API/gtk/WebKitSecurityOrigin.cpp: Added.
+        (_WebKitSecurityOrigin::_WebKitSecurityOrigin):
+        (webkitSecurityOriginCreate):
+        (webkit_security_origin_new):
+        (webkit_security_origin_new_for_uri):
+        (webkit_security_origin_ref):
+        (webkit_security_origin_unref):
+        (webkit_security_origin_get_protocol):
+        (webkit_security_origin_get_host):
+        (webkit_security_origin_get_port):
+        (webkit_security_origin_is_opaque):
+        (webkit_security_origin_to_string):
+        * UIProcess/API/gtk/WebKitSecurityOrigin.h: Added.
+        * UIProcess/API/gtk/WebKitSecurityOriginPrivate.h: Added.
+        * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
+        * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
+        * UIProcess/API/gtk/webkit2.h:
+
</ins><span class="cx"> 2017-01-03  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [SOUP] Load options allowStoredCredentials = DoNotAllowStoredCredentials with clientCredentialPolicy = MayAskClientForCredentials doesn't work
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (210237 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2017-01-03 10:24:38 UTC (rev 210237)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -220,6 +220,9 @@
</span><span class="cx">     UIProcess/API/gtk/WebKitSecurityManager.cpp
</span><span class="cx">     UIProcess/API/gtk/WebKitSecurityManager.h
</span><span class="cx">     UIProcess/API/gtk/WebKitSecurityManagerPrivate.h
</span><ins>+    UIProcess/API/gtk/WebKitSecurityOrigin.cpp
+    UIProcess/API/gtk/WebKitSecurityOrigin.h
+    UIProcess/API/gtk/WebKitSecurityOriginPrivate.h
</ins><span class="cx">     UIProcess/API/gtk/WebKitSettings.cpp
</span><span class="cx">     UIProcess/API/gtk/WebKitSettings.h
</span><span class="cx">     UIProcess/API/gtk/WebKitSettingsPrivate.h
</span><span class="lines">@@ -534,6 +537,7 @@
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitResponsePolicyDecision.h
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitScriptDialog.h
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitSecurityManager.h
</span><ins>+    ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitSecurityOrigin.h
</ins><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitSettings.h
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitURIRequest.h
</span><span class="cx">     ${WEBKIT2_DIR}/UIProcess/API/gtk/WebKitURIResponse.h
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitAutocleanupsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAutocleanups.h (210237 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAutocleanups.h        2017-01-03 10:24:38 UTC (rev 210237)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitAutocleanups.h        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitJavascriptResult, webkit_javascript_result_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitMimeInfo, webkit_mime_info_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitNavigationAction, webkit_navigation_action_free)
</span><ins>+G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitSecurityOrigin, webkit_security_origin_unref)
</ins><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserScript, webkit_user_script_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitUserStyleSheet, webkit_user_style_sheet_unref)
</span><span class="cx"> G_DEFINE_AUTOPTR_CLEANUP_FUNC (WebKitWebViewSessionState, webkit_web_view_session_state_unref)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitSecurityOrigincpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOrigin.cpp (0 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOrigin.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOrigin.cpp        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -0,0 +1,261 @@
</span><ins>+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;WebKitSecurityOrigin.h&quot;
+
+#include &quot;WebKitSecurityOriginPrivate.h&quot;
+#include &lt;WebCore/URL.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+using namespace WebKit;
+
+/**
+ * SECTION: WebKitSecurityOrigin
+ * @Short_description: A security boundary for websites
+ * @Title: WebKitSecurityOrigin
+ *
+ * #WebKitSecurityOrigin is a representation of a security domain
+ * defined by websites. A security origin normally consists of a
+ * protocol, a hostname, and a port number. It is also possible for a
+ * security origin to be opaque, as defined by the HTML standard, in
+ * which case it has no associated protocol, host, or port.
+ *
+ * Websites with the same security origin can access each other's
+ * resources for client-side scripting or database access.
+ *
+ * Since: 2.16
+ */
+
+struct _WebKitSecurityOrigin {
+    _WebKitSecurityOrigin(Ref&lt;WebCore::SecurityOrigin&gt;&amp;&amp; coreSecurityOrigin)
+        : securityOrigin(WTFMove(coreSecurityOrigin))
+    {
+    }
+
+    Ref&lt;WebCore::SecurityOrigin&gt; securityOrigin;
+    CString protocol;
+    CString host;
+    int referenceCount { 1 };
+};
+
+G_DEFINE_BOXED_TYPE(WebKitSecurityOrigin, webkit_security_origin, webkit_security_origin_ref, webkit_security_origin_unref)
+
+WebKitSecurityOrigin* webkitSecurityOriginCreate(Ref&lt;WebCore::SecurityOrigin&gt;&amp;&amp; coreSecurityOrigin)
+{
+    WebKitSecurityOrigin* origin = static_cast&lt;WebKitSecurityOrigin*&gt;(fastMalloc(sizeof(WebKitSecurityOrigin)));
+    new (origin) WebKitSecurityOrigin(WTFMove(coreSecurityOrigin));
+    return origin;
+}
+
+/**
+ * webkit_security_origin_new:
+ * @protocol: The protocol for the new origin
+ * @host: The host for the new origin
+ * @port: The port number for the new origin, or 0 to indicate the
+ *        default port for @protocol
+ *
+ * Create a new security origin from the provided protocol, host and
+ * port.
+ *
+ * Returns: (transfer full): A #WebKitSecurityOrigin.
+ *
+ * Since: 2.16
+ */
+WebKitSecurityOrigin* webkit_security_origin_new(const gchar* protocol, const gchar* host, guint16 port)
+{
+    g_return_val_if_fail(protocol, nullptr);
+    g_return_val_if_fail(host, nullptr);
+
+    std::optional&lt;uint16_t&gt; optionalPort;
+    if (port)
+        optionalPort = port;
+
+    return webkitSecurityOriginCreate(WebCore::SecurityOrigin::create(String::fromUTF8(protocol), String::fromUTF8(host), optionalPort));
+}
+
+/**
+ * webkit_security_origin_new_for_uri:
+ * @uri: The URI for the new origin
+ *
+ * Create a new security origin from the provided URI. Components of
+ * @uri other than protocol, host, and port do not affect the created
+ * #WebKitSecurityOrigin.
+ *
+ * Returns: (transfer full): A #WebKitSecurityOrigin.
+ *
+ * Since: 2.16
+ */
+WebKitSecurityOrigin* webkit_security_origin_new_for_uri(const gchar* uri)
+{
+    g_return_val_if_fail(uri, nullptr);
+
+    return webkitSecurityOriginCreate(WebCore::SecurityOrigin::create(WebCore::URL(WebCore::URL(), String::fromUTF8(uri))));
+}
+
+/**
+ * webkit_security_origin_ref:
+ * @origin: a #WebKitSecurityOrigin
+ *
+ * Atomically increments the reference count of @origin by one.
+ * This function is MT-safe and may be called from any thread.
+ *
+ * Returns: The passed #WebKitSecurityOrigin
+ *
+ * Since: 2.16
+ */
+WebKitSecurityOrigin* webkit_security_origin_ref(WebKitSecurityOrigin* origin)
+{
+    g_return_val_if_fail(origin, nullptr);
+
+    g_atomic_int_inc(&amp;origin-&gt;referenceCount);
+    return origin;
+}
+
+/**
+ * webkit_security_origin_unref:
+ * @origin: A #WebKitSecurityOrigin
+ *
+ * Atomically decrements the reference count of @origin by one.
+ * If the reference count drops to 0, all memory allocated by
+ * #WebKitSecurityOrigin is released. This function is MT-safe and may be
+ * called from any thread.
+ *
+ * Since: 2.16
+ */
+void webkit_security_origin_unref(WebKitSecurityOrigin* origin)
+{
+    g_return_if_fail(origin);
+
+    if (g_atomic_int_dec_and_test(&amp;origin-&gt;referenceCount)) {
+        origin-&gt;~WebKitSecurityOrigin();
+        fastFree(origin);
+    }
+}
+
+/**
+ * webkit_security_origin_get_protocol:
+ * @origin: a #WebKitSecurityOrigin
+ *
+ * Gets the protocol of @origin, or %NULL if @origin is opaque.
+ *
+ * Returns (allow-none): The protocol of the #WebKitSecurityOrigin
+ *
+ * Since: 2.16
+ */
+const gchar* webkit_security_origin_get_protocol(WebKitSecurityOrigin* origin)
+{
+    g_return_val_if_fail(origin, nullptr);
+
+    if (origin-&gt;securityOrigin-&gt;protocol().isEmpty())
+        return nullptr;
+
+    if (origin-&gt;protocol.isNull())
+        origin-&gt;protocol = origin-&gt;securityOrigin-&gt;protocol().utf8();
+    return origin-&gt;protocol.data();
+}
+
+/**
+ * webkit_security_origin_get_host:
+ * @origin: a #WebKitSecurityOrigin
+ *
+ * Gets the hostname of @origin, or %NULL if @origin is opaque or if its
+ * protocol does not require a host component.
+ *
+ * Returns: (allow-none): The host of the #WebKitSecurityOrigin
+ *
+ * Since: 2.16
+ */
+const gchar* webkit_security_origin_get_host(WebKitSecurityOrigin* origin)
+{
+    g_return_val_if_fail(origin, nullptr);
+
+    if (origin-&gt;securityOrigin-&gt;host().isEmpty())
+        return nullptr;
+
+    if (origin-&gt;host.isNull())
+        origin-&gt;host = origin-&gt;securityOrigin-&gt;host().utf8();
+    return origin-&gt;host.data();
+}
+
+/**
+ * webkit_security_origin_get_port:
+ * @origin: a #WebKitSecurityOrigin
+ *
+ * Gets the port of @origin. This function will always return 0 if the
+ * port is the default port for the given protocol. For example,
+ * http://example.com has the same security origin as
+ * http://example.com:80, and this function will return 0 for a
+ * #WebKitSecurityOrigin constructed from either URI. It will also
+ * return 0 if @origin is opaque.
+ *
+ * Returns: The port of the #WebKitSecurityOrigin.
+ *
+ * Since: 2.16
+ */
+guint16 webkit_security_origin_get_port(WebKitSecurityOrigin* origin)
+{
+    g_return_val_if_fail(origin, 0);
+
+    return origin-&gt;securityOrigin-&gt;port().value_or(0);
+}
+
+/**
+ * webkit_security_origin_is_opaque:
+ * @origin: a #WebKitSecurityOrigin
+ *
+ * Gets whether @origin is an opaque security origin, which does not
+ * possess an associated protocol, host, or port.
+ *
+ * Returns: %TRUE if @origin is opaque.
+ *
+ * Since: 2.16
+ */
+gboolean webkit_security_origin_is_opaque(WebKitSecurityOrigin* origin)
+{
+    g_return_val_if_fail(origin, TRUE);
+
+    return origin-&gt;securityOrigin-&gt;isUnique();
+}
+
+/**
+ * webkit_security_origin_to_string:
+ * @origin: a #WebKitSecurityOrigin
+ *
+ * Gets a string representation of @origin. The string representation
+ * is a valid URI with only protocol, host, and port components. It may
+ * be %NULL, but usually only if @origin is opaque.
+ *
+ * Returns: (allow-none) (transfer full): a URI representing @origin.
+ *
+ * Since: 2.16
+ */
+gchar* webkit_security_origin_to_string(WebKitSecurityOrigin* origin)
+{
+    g_return_val_if_fail(origin, nullptr);
+
+    CString cstring = origin-&gt;securityOrigin-&gt;toString().utf8();
+    return cstring == &quot;null&quot; ? nullptr : g_strdup (cstring.data());
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitSecurityOriginh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOrigin.h (0 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOrigin.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOrigin.h        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -0,0 +1,76 @@
</span><ins>+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) &amp;&amp; !defined(WEBKIT2_COMPILATION)
+#error &quot;Only &lt;webkit2/webkit2.h&gt; can be included directly.&quot;
+#endif
+
+#ifndef WebKitSecurityOrigin_h
+#define WebKitSecurityOrigin_h
+
+#include &lt;glib-object.h&gt;
+#include &lt;webkit2/WebKitDefines.h&gt;
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_SECURITY_ORIGIN (webkit_security_origin_get_type())
+
+typedef struct _WebKitSecurityOrigin WebKitSecurityOrigin;
+
+WEBKIT_API GType
+webkit_security_origin_get_type     (void);
+
+WEBKIT_API WebKitSecurityOrigin *
+webkit_security_origin_new          (const gchar          *protocol,
+                                     const gchar          *host,
+                                     guint16               port);
+
+WEBKIT_API WebKitSecurityOrigin *
+webkit_security_origin_new_for_uri  (const gchar          *uri);
+
+WEBKIT_API WebKitSecurityOrigin *
+webkit_security_origin_ref          (WebKitSecurityOrigin *origin);
+
+WEBKIT_API void
+webkit_security_origin_unref        (WebKitSecurityOrigin *origin);
+
+WEBKIT_API const gchar *
+webkit_security_origin_get_protocol (WebKitSecurityOrigin *origin);
+
+WEBKIT_API const gchar *
+webkit_security_origin_get_host     (WebKitSecurityOrigin *origin);
+
+WEBKIT_API guint16
+webkit_security_origin_get_port     (WebKitSecurityOrigin *origin);
+
+WEBKIT_API gboolean
+webkit_security_origin_is_opaque    (WebKitSecurityOrigin *origin);
+
+WEBKIT_API gchar *
+webkit_security_origin_to_string    (WebKitSecurityOrigin *origin);
+
+G_END_DECLS
+
+#endif /* WebKitSecurityOrigin_h */
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitSecurityOriginPrivateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOriginPrivate.h (0 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOriginPrivate.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSecurityOriginPrivate.h        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &quot;WebKitPrivate.h&quot;
+#include &quot;WebKitSecurityOrigin.h&quot;
+#include &lt;WebCore/SecurityOrigin.h&gt;
+
+WebKitSecurityOrigin* webkitSecurityOriginCreate(Ref&lt;WebCore::SecurityOrigin&gt;&amp;&amp;);
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtk40sectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt (210237 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt        2017-01-03 10:24:38 UTC (rev 210237)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -1211,6 +1211,26 @@
</span><span class="cx"> &lt;/SECTION&gt;
</span><span class="cx"> 
</span><span class="cx"> &lt;SECTION&gt;
</span><ins>+&lt;FILE&gt;WebKitSecurityOrigin&lt;/FILE&gt;
+WebKitSecurityOrigin
+webkit_security_origin_new
+webkit_security_origin_new_for_uri
+webkit_security_origin_ref
+webkit_security_origin_unref
+webkit_security_origin_get_protocol
+webkit_security_origin_get_host
+webkit_security_origin_get_port
+webkit_security_origin_is_opaque
+webkit_security_origin_to_string
+
+&lt;SUBSECTION Standard&gt;
+WEBKIT_TYPE_SECURITY_ORIGIN
+
+&lt;SUBSECTION Private&gt;
+webkit_security_origin_get_type
+&lt;/SECTION&gt;
+
+&lt;SECTION&gt;
</ins><span class="cx"> &lt;FILE&gt;WebKitWebsiteDataManager&lt;/FILE&gt;
</span><span class="cx"> WebKitWebsiteDataManager
</span><span class="cx"> webkit_website_data_manager_new
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtkdocssgml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml (210237 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml        2017-01-03 10:24:38 UTC (rev 210237)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx">     &lt;xi:include href=&quot;xml/WebKitUserContent.xml&quot;/&gt;
</span><span class="cx">     &lt;xi:include href=&quot;xml/WebKitNotification.xml&quot;/&gt;
</span><span class="cx">     &lt;xi:include href=&quot;xml/WebKitNotificationPermissionRequest.xml&quot;/&gt;
</span><ins>+    &lt;xi:include href=&quot;xml/WebKitSecurityOrigin.xml&quot;/&gt;
</ins><span class="cx">     &lt;xi:include href=&quot;xml/WebKitWebsiteDataManager.xml&quot;/&gt;
</span><span class="cx">   &lt;/chapter&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkwebkit2h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h (210237 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h        2017-01-03 10:24:38 UTC (rev 210237)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/webkit2.h        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx"> #include &lt;webkit2/WebKitResponsePolicyDecision.h&gt;
</span><span class="cx"> #include &lt;webkit2/WebKitScriptDialog.h&gt;
</span><span class="cx"> #include &lt;webkit2/WebKitSecurityManager.h&gt;
</span><ins>+#include &lt;webkit2/WebKitSecurityOrigin.h&gt;
</ins><span class="cx"> #include &lt;webkit2/WebKitSettings.h&gt;
</span><span class="cx"> #include &lt;webkit2/WebKitURIRequest.h&gt;
</span><span class="cx"> #include &lt;webkit2/WebKitURIResponse.h&gt;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (210237 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-01-03 10:24:38 UTC (rev 210237)
+++ trunk/Tools/ChangeLog        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2017-01-03  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
+
+        [GTK] Expose WebKitSecurityOrigin API
+        https://bugs.webkit.org/show_bug.cgi?id=166632
+
+        Reviewed by Carlos Garcia Campos.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt:
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSecurityOrigin.cpp: Added.
+        (testSecurityOriginBasicConstructor):
+        (testSecurityOriginURIConstructor):
+        (testSecurityOriginDefaultPort):
+        (testSecurityOriginFileURI):
+        (testSecurityOriginDataURI):
+        (beforeAll):
+        (afterAll):
+
</ins><span class="cx"> 2017-01-03  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] HTTP auth layout tests are flaky
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt (210237 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt        2017-01-03 10:24:38 UTC (rev 210237)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/CMakeLists.txt        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -118,6 +118,7 @@
</span><span class="cx"> ADD_WK2_TEST(TestUIClient TestUIClient.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestWebExtensions TestWebExtensions.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestWebKitPolicyClient TestWebKitPolicyClient.cpp)
</span><ins>+ADD_WK2_TEST(TestWebKitSecurityOrigin TestWebKitSecurityOrigin.cpp)
</ins><span class="cx"> ADD_WK2_TEST(TestWebKitSettings TestWebKitSettings.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestWebKitVersion TestWebKitVersion.cpp)
</span><span class="cx"> ADD_WK2_TEST(TestWebViewEditor TestWebViewEditor.cpp)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitSecurityOrigincpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSecurityOrigin.cpp (0 => 210238)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSecurityOrigin.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSecurityOrigin.cpp        2017-01-03 11:59:28 UTC (rev 210238)
</span><span class="lines">@@ -0,0 +1,142 @@
</span><ins>+/*
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 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 &quot;config.h&quot;
+
+#include &quot;TestMain.h&quot;
+#include &lt;webkit2/webkit2.h&gt;
+#include &lt;wtf/glib/GUniquePtr.h&gt;
+
+static void testSecurityOriginBasicConstructor(Test*, gconstpointer)
+{
+    WebKitSecurityOrigin* origin = webkit_security_origin_new(&quot;http&quot;, &quot;127.0.0.1&quot;, 1234);
+    g_assert(origin);
+    GUniquePtr&lt;char&gt; asString(webkit_security_origin_to_string(origin));
+    g_assert_cmpstr(asString.get(), ==, &quot;http://127.0.0.1:1234&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_protocol(origin), ==, &quot;http&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_host(origin), ==, &quot;127.0.0.1&quot;);
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 1234);
+    g_assert(!webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+}
+
+static void testSecurityOriginURIConstructor(Test*, gconstpointer)
+{
+    WebKitSecurityOrigin* origin = webkit_security_origin_new_for_uri(&quot;http://127.0.0.1:1234&quot;);
+    g_assert(origin);
+    GUniquePtr&lt;char&gt; asString(webkit_security_origin_to_string(origin));
+    g_assert_cmpstr(asString.get(), ==, &quot;http://127.0.0.1:1234&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_protocol(origin), ==, &quot;http&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_host(origin), ==, &quot;127.0.0.1&quot;);
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 1234);
+    g_assert(!webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+
+    origin = webkit_security_origin_new_for_uri(&quot;http://127.0.0.1:1234/this/path/?should=be#ignored&quot;);
+    g_assert(origin);
+    asString.reset(webkit_security_origin_to_string(origin));
+    g_assert_cmpstr(asString.get(), ==, &quot;http://127.0.0.1:1234&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_protocol(origin), ==, &quot;http&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_host(origin), ==, &quot;127.0.0.1&quot;);
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 1234);
+    g_assert(!webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+}
+
+static void testSecurityOriginDefaultPort(Test*, gconstpointer)
+{
+    WebKitSecurityOrigin* origin = webkit_security_origin_new(&quot;http&quot;, &quot;127.0.0.1&quot;, 0);
+    g_assert(origin);
+    GUniquePtr&lt;char&gt; asString(webkit_security_origin_to_string(origin));
+    g_assert_cmpstr(asString.get(), ==, &quot;http://127.0.0.1&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_protocol(origin), ==, &quot;http&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_host(origin), ==, &quot;127.0.0.1&quot;);
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 0);
+    g_assert(!webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+
+    origin = webkit_security_origin_new(&quot;http&quot;, &quot;127.0.0.1&quot;, 80);
+    g_assert(origin);
+    asString.reset(webkit_security_origin_to_string(origin));
+    g_assert_cmpstr(asString.get(), ==, &quot;http://127.0.0.1&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_protocol(origin), ==, &quot;http&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_host(origin), ==, &quot;127.0.0.1&quot;);
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 0);
+    g_assert(!webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+
+    origin = webkit_security_origin_new_for_uri(&quot;http://127.0.0.1&quot;);
+    g_assert(origin);
+    asString.reset(webkit_security_origin_to_string(origin));
+    g_assert_cmpstr(asString.get(), ==, &quot;http://127.0.0.1&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_protocol(origin), ==, &quot;http&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_host(origin), ==, &quot;127.0.0.1&quot;);
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 0);
+    g_assert(!webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+
+    origin = webkit_security_origin_new_for_uri(&quot;http://127.0.0.1:80&quot;);
+    g_assert(origin);
+    asString.reset(webkit_security_origin_to_string(origin));
+    g_assert_cmpstr(asString.get(), ==, &quot;http://127.0.0.1&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_protocol(origin), ==, &quot;http&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_host(origin), ==, &quot;127.0.0.1&quot;);
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 0);
+    g_assert(!webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+}
+
+static void testSecurityOriginFileURI(Test*, gconstpointer)
+{
+    WebKitSecurityOrigin* origin = webkit_security_origin_new_for_uri(&quot;file:///abcdefg&quot;);
+    g_assert(origin);
+    GUniquePtr&lt;char&gt; asString(webkit_security_origin_to_string(origin));
+    g_assert_cmpstr(asString.get(), ==, &quot;file://&quot;);
+    g_assert_cmpstr(webkit_security_origin_get_protocol(origin), ==, &quot;file&quot;);
+    g_assert(!webkit_security_origin_get_host(origin));
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 0);
+    g_assert(!webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+}
+
+static void testOpaqueSecurityOrigin(Test*, gconstpointer)
+{
+    WebKitSecurityOrigin* origin = webkit_security_origin_new_for_uri(&quot;data:Lali ho!&quot;);
+    g_assert(origin);
+    GUniquePtr&lt;char&gt; asString(webkit_security_origin_to_string(origin));
+    g_assert(!asString);
+    g_assert(!webkit_security_origin_get_protocol(origin));
+    g_assert(!webkit_security_origin_get_host(origin));
+    g_assert_cmpint(webkit_security_origin_get_port(origin), ==, 0);
+    g_assert(webkit_security_origin_is_opaque(origin));
+    webkit_security_origin_unref(origin);
+}
+
+void beforeAll()
+{
+    Test::add(&quot;WebKitSecurityOrigin&quot;, &quot;basic-constructor&quot;, testSecurityOriginBasicConstructor);
+    Test::add(&quot;WebKitSecurityOrigin&quot;, &quot;uri-constructor&quot;, testSecurityOriginURIConstructor);
+    Test::add(&quot;WebKitSecruityOrigin&quot;, &quot;default-port&quot;, testSecurityOriginDefaultPort);
+    Test::add(&quot;WebKitSecurityOrigin&quot;, &quot;file-uri&quot;, testSecurityOriginFileURI);
+    Test::add(&quot;WebKitSecruityOrigin&quot;, &quot;opaque-origin&quot;, testOpaqueSecurityOrigin);
+}
+
+void afterAll()
+{
+}
</ins></span></pre>
</div>
</div>

</body>
</html>