<!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>[210218] 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/210218">210218</a></dd>
<dt>Author</dt> <dd>mcatanzaro@igalia.com</dd>
<dt>Date</dt> <dd>2016-12-31 16:48:19 -0800 (Sat, 31 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>SecurityOrigin::create triplet constructor does not canonicalize port
https://bugs.webkit.org/show_bug.cgi?id=166624

Reviewed by Daniel Bates.

Source/WebCore:

It is currently possible to create two different unequal SecurityOrigin objects that
represent the same security origin. The SecurityOrigin create functions that take URL and
String parameters convert the port to nullopt if it is the default port for the protocol,
but the separate protocol/host/port constructor doesn't. Change it to parallel the other
constructors.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::create):
* page/SecurityOrigin.h: Export isSameOriginAs for use by tests.

Tools:

* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/PlatformWin.cmake:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: Added.
(TestWebKitAPI::SecurityOriginTest::SetUp):
(TestWebKitAPI::TEST_F):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageSecurityOrigincpp">trunk/Source/WebCore/page/SecurityOrigin.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSecurityOriginh">trunk/Source/WebCore/page/SecurityOrigin.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPIPlatformGTKcmake">trunk/Tools/TestWebKitAPI/PlatformGTK.cmake</a></li>
<li><a href="#trunkToolsTestWebKitAPIPlatformWincmake">trunk/Tools/TestWebKitAPI/PlatformWin.cmake</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreSecurityOrigincpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210217 => 210218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-31 09:57:11 UTC (rev 210217)
+++ trunk/Source/WebCore/ChangeLog        2017-01-01 00:48:19 UTC (rev 210218)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-12-31  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
+
+        SecurityOrigin::create triplet constructor does not canonicalize port
+        https://bugs.webkit.org/show_bug.cgi?id=166624
+
+        Reviewed by Daniel Bates.
+
+        It is currently possible to create two different unequal SecurityOrigin objects that
+        represent the same security origin. The SecurityOrigin create functions that take URL and
+        String parameters convert the port to nullopt if it is the default port for the protocol,
+        but the separate protocol/host/port constructor doesn't. Change it to parallel the other
+        constructors.
+
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::create):
+        * page/SecurityOrigin.h: Export isSameOriginAs for use by tests.
+
</ins><span class="cx"> 2016-12-25  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove setDOMException and a few custom bindings
</span></span></pre></div>
<a id="trunkSourceWebCorepageSecurityOrigincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SecurityOrigin.cpp (210217 => 210218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SecurityOrigin.cpp        2016-12-31 09:57:11 UTC (rev 210217)
+++ trunk/Source/WebCore/page/SecurityOrigin.cpp        2017-01-01 00:48:19 UTC (rev 210218)
</span><span class="lines">@@ -490,7 +490,8 @@
</span><span class="cx"> {
</span><span class="cx">     String decodedHost = decodeURLEscapeSequences(host);
</span><span class="cx">     auto origin = create(URL(URL(), protocol + &quot;://&quot; + host + &quot;/&quot;));
</span><del>-    origin-&gt;m_port = port;
</del><ins>+    if (port &amp;&amp; !isDefaultPortForProtocol(*port, protocol))
+        origin-&gt;m_port = port;
</ins><span class="cx">     return origin;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageSecurityOriginh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/SecurityOrigin.h (210217 => 210218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/SecurityOrigin.h        2016-12-31 09:57:11 UTC (rev 210217)
+++ trunk/Source/WebCore/page/SecurityOrigin.h        2017-01-01 00:48:19 UTC (rev 210218)
</span><span class="lines">@@ -198,7 +198,7 @@
</span><span class="cx"> 
</span><span class="cx">     // This method implements the &quot;same origin&quot; algorithm from the HTML Standard:
</span><span class="cx">     // https://html.spec.whatwg.org/multipage/browsers.html#same-origin
</span><del>-    bool isSameOriginAs(const SecurityOrigin*) const;
</del><ins>+    WEBCORE_EXPORT bool isSameOriginAs(const SecurityOrigin*) const;
</ins><span class="cx"> 
</span><span class="cx">     static URL urlWithUniqueSecurityOrigin();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (210217 => 210218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-12-31 09:57:11 UTC (rev 210217)
+++ trunk/Tools/ChangeLog        2017-01-01 00:48:19 UTC (rev 210218)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-12-31  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
+
+        SecurityOrigin::create triplet constructor does not canonicalize port
+        https://bugs.webkit.org/show_bug.cgi?id=166624
+
+        Reviewed by Daniel Bates.
+
+        * TestWebKitAPI/PlatformGTK.cmake:
+        * TestWebKitAPI/PlatformWin.cmake:
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp: Added.
+        (TestWebKitAPI::SecurityOriginTest::SetUp):
+        (TestWebKitAPI::TEST_F):
+
</ins><span class="cx"> 2016-12-30  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Improve user agent construction
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIPlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/PlatformGTK.cmake (210217 => 210218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/PlatformGTK.cmake        2016-12-31 09:57:11 UTC (rev 210217)
+++ trunk/Tools/TestWebKitAPI/PlatformGTK.cmake        2017-01-01 00:48:19 UTC (rev 210218)
</span><span class="lines">@@ -133,6 +133,7 @@
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/HTMLParserIdioms.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/PublicSuffix.cpp
</span><ins>+    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SecurityOrigin.cpp
</ins><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/URL.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/URLParser.cpp
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIPlatformWincmake"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/PlatformWin.cmake (210217 => 210218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/PlatformWin.cmake        2016-12-31 09:57:11 UTC (rev 210217)
+++ trunk/Tools/TestWebKitAPI/PlatformWin.cmake        2017-01-01 00:48:19 UTC (rev 210218)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/IntSize.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/LayoutUnit.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/ParsedContentRange.cpp
</span><ins>+    ${TESTWEBKITAPI_DIR}/Tests/WebCore/SecurityOrigin.cpp
</ins><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/SharedBuffer.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/TimeRanges.cpp
</span><span class="cx">     ${TESTWEBKITAPI_DIR}/Tests/WebCore/TransformationMatrix.cpp
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (210217 => 210218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-12-31 09:57:11 UTC (rev 210217)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-01-01 00:48:19 UTC (rev 210218)
</span><span class="lines">@@ -514,6 +514,7 @@
</span><span class="cx">                 CDC8E4961BC6F10800594FEC /* video-without-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48B1BC5C96200594FEC /* video-without-audio.html */; };
</span><span class="cx">                 CDC8E4971BC6F10800594FEC /* video-without-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48C1BC5C96200594FEC /* video-without-audio.mp4 */; };
</span><span class="cx">                 CDE195B51CFE0B880053D256 /* FullscreenTopContentInset.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */; };
</span><ins>+                CE06DF9B1E1851F200E570C9 /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE06DF9A1E1851F200E570C9 /* SecurityOrigin.cpp */; };
</ins><span class="cx">                 CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */; };
</span><span class="cx">                 CE3524F81B1431F60028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F21B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp */; };
</span><span class="cx">                 CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */; };
</span><span class="lines">@@ -1274,6 +1275,7 @@
</span><span class="cx">                 CDC8E48C1BC5C96200594FEC /* video-without-audio.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = &quot;video-without-audio.mp4&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FullscreenTopContentInset.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenTopContentInset.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                CE06DF9A1E1851F200E570C9 /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = WillPerformClientRedirectToURLCrash.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WillPerformClientRedirectToURLCrash.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextFieldDidBeginAndEndEditing.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1555,6 +1557,7 @@
</span><span class="cx">                                 83B88A331C80056D00BB2418 /* HTMLParserIdioms.cpp */,
</span><span class="cx">                                 14464012167A8305000BD218 /* LayoutUnit.cpp */,
</span><span class="cx">                                 CD225C071C45A69200140761 /* ParsedContentRange.cpp */,
</span><ins>+                                CE06DF9A1E1851F200E570C9 /* SecurityOrigin.cpp */,
</ins><span class="cx">                                 41973B5C1AF22875006C7B36 /* SharedBuffer.cpp */,
</span><span class="cx">                                 CDC2C7141797089D00E627FB /* TimeRanges.cpp */,
</span><span class="cx">                                 7AD3FE8D1D75FB8D00B169A4 /* TransformationMatrix.cpp */,
</span><span class="lines">@@ -2611,6 +2614,7 @@
</span><span class="cx">                                 835CF9671D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp in Sources */,
</span><span class="cx">                                 7A909A7F1D877480007E10F8 /* FloatRect.cpp in Sources */,
</span><span class="cx">                                 7CCE7F121A411AE600447C4C /* ScrollPinningBehaviors.cpp in Sources */,
</span><ins>+                                CE06DF9B1E1851F200E570C9 /* SecurityOrigin.cpp in Sources */,
</ins><span class="cx">                                 7CCE7ECB1A411A7E00447C4C /* SetAndUpdateCacheModel.mm in Sources */,
</span><span class="cx">                                 7CCE7ECC1A411A7E00447C4C /* SetDocumentURI.mm in Sources */,
</span><span class="cx">                                 7C83E0521D0A641800FEBCF3 /* SharedBuffer.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreSecurityOrigincpp"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp (0 => 210218)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp        2017-01-01 00:48:19 UTC (rev 210218)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+/*
+ * Copyright (C) 2016 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;WTFStringUtilities.h&quot;
+#include &lt;WebCore/SecurityOrigin.h&gt;
+#include &lt;WebCore/URL.h&gt;
+#include &lt;wtf/MainThread.h&gt;
+
+using namespace WebCore;
+
+namespace TestWebKitAPI {
+
+class SecurityOriginTest : public testing::Test {
+public:
+    void SetUp() final {
+        WTF::initializeMainThread();
+    }
+};
+
+TEST_F(SecurityOriginTest, SecurityOriginConstructors)
+{
+    Ref&lt;SecurityOrigin&gt; o1 = SecurityOrigin::create(&quot;http&quot;, &quot;example.com&quot;, std::optional&lt;uint16_t&gt;(80));
+    Ref&lt;SecurityOrigin&gt; o2 = SecurityOrigin::create(&quot;http&quot;, &quot;example.com&quot;, std::optional&lt;uint16_t&gt;());
+    Ref&lt;SecurityOrigin&gt; o3 = SecurityOrigin::createFromString(&quot;http://example.com&quot;);
+    Ref&lt;SecurityOrigin&gt; o4 = SecurityOrigin::createFromString(&quot;http://example.com:80&quot;);
+    Ref&lt;SecurityOrigin&gt; o5 = SecurityOrigin::create(URL(URL(), &quot;http://example.com&quot;));
+    Ref&lt;SecurityOrigin&gt; o6 = SecurityOrigin::create(URL(URL(), &quot;http://example.com:80&quot;));
+
+    EXPECT_EQ(String(&quot;http&quot;), o1-&gt;protocol());
+    EXPECT_EQ(String(&quot;http&quot;), o2-&gt;protocol());
+    EXPECT_EQ(String(&quot;http&quot;), o3-&gt;protocol());
+    EXPECT_EQ(String(&quot;http&quot;), o4-&gt;protocol());
+    EXPECT_EQ(String(&quot;http&quot;), o5-&gt;protocol());
+    EXPECT_EQ(String(&quot;http&quot;), o6-&gt;protocol());
+
+    EXPECT_EQ(String(&quot;example.com&quot;), o1-&gt;host());
+    EXPECT_EQ(String(&quot;example.com&quot;), o2-&gt;host());
+    EXPECT_EQ(String(&quot;example.com&quot;), o3-&gt;host());
+    EXPECT_EQ(String(&quot;example.com&quot;), o4-&gt;host());
+    EXPECT_EQ(String(&quot;example.com&quot;), o5-&gt;host());
+    EXPECT_EQ(String(&quot;example.com&quot;), o6-&gt;host());
+
+    EXPECT_FALSE(o1-&gt;port());
+    EXPECT_FALSE(o2-&gt;port());
+    EXPECT_FALSE(o3-&gt;port());
+    EXPECT_FALSE(o4-&gt;port());
+    EXPECT_FALSE(o5-&gt;port());
+    EXPECT_FALSE(o6-&gt;port());
+
+    EXPECT_EQ(&quot;http://example.com&quot;, o1-&gt;toString());
+    EXPECT_EQ(&quot;http://example.com&quot;, o2-&gt;toString());
+    EXPECT_EQ(&quot;http://example.com&quot;, o3-&gt;toString());
+    EXPECT_EQ(&quot;http://example.com&quot;, o4-&gt;toString());
+    EXPECT_EQ(&quot;http://example.com&quot;, o5-&gt;toString());
+    EXPECT_EQ(&quot;http://example.com&quot;, o6-&gt;toString());
+
+    EXPECT_TRUE(o1-&gt;isSameOriginAs(o2.ptr()));
+    EXPECT_TRUE(o1-&gt;isSameOriginAs(o3.ptr()));
+    EXPECT_TRUE(o1-&gt;isSameOriginAs(o4.ptr()));
+    EXPECT_TRUE(o1-&gt;isSameOriginAs(o5.ptr()));
+    EXPECT_TRUE(o1-&gt;isSameOriginAs(o6.ptr()));
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>