<!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>[163208] 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/163208">163208</a></dd>
<dt>Author</dt> <dd>mjs@apple.com</dd>
<dt>Date</dt> <dd>2014-01-31 15:06:25 -0800 (Fri, 31 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement (most of) URL API
https://bugs.webkit.org/show_bug.cgi?id=127795

Reviewed by Alexey Proskuryakov.

Source/WebCore: 

Tests: fast/dom/DOMURL/get-href-attribute-port.html
       fast/dom/DOMURL/invalid-url-getters.html
       fast/dom/DOMURL/set-href-attribute-hash.html
       fast/dom/DOMURL/set-href-attribute-host.html
       fast/dom/DOMURL/set-href-attribute-hostname.html
       fast/dom/DOMURL/set-href-attribute-pathname.html
       fast/dom/DOMURL/set-href-attribute-port.html
       fast/dom/DOMURL/set-href-attribute-protocol.html
       fast/dom/DOMURL/set-href-attribute-search.html
       fast/dom/DOMURL/set-href-attribute-whitespace.html
       fast/dom/DOMURL/url-constructor.html
       fast/dom/DOMURL/url-origin.html
       fast/dom/DOMURL/url-password.html
       fast/dom/DOMURL/url-username.html

* CMakeLists.txt: Update for new IDL file.
* DerivedSources.make: ditto
* GNUmakefile.list.am: ditto
* html/DOMURL.cpp: Implement URL() constructor and instance methods; cribbed from
HTMLAnchorElement mostly
(WebCore::DOMURL::DOMURL):
(WebCore::DOMURL::href):
(WebCore::DOMURL::setHref):
(WebCore::DOMURL::toString):
(WebCore::DOMURL::origin):
(WebCore::DOMURL::protocol):
(WebCore::DOMURL::setProtocol):
(WebCore::DOMURL::username):
(WebCore::DOMURL::setUsername):
(WebCore::DOMURL::password):
(WebCore::DOMURL::setPassword):
(WebCore::DOMURL::host):
(WebCore::parsePortFromStringPosition):
(WebCore::DOMURL::setHost):
(WebCore::DOMURL::hostname):
(WebCore::DOMURL::setHostname):
(WebCore::DOMURL::port):
(WebCore::DOMURL::setPort):
(WebCore::DOMURL::pathname):
(WebCore::DOMURL::setPathname):
(WebCore::DOMURL::search):
(WebCore::DOMURL::setSearch):
(WebCore::DOMURL::hash):
(WebCore::DOMURL::setHash):
* html/DOMURL.h:
(WebCore::DOMURL::create):
* html/DOMURL.idl: Update for new methods.
* html/URLUtils.idl: Added. New IDL file that contains most of the interface.

LayoutTests: 

Add a bunch of new tests for URL(), copied from HTMLAnchorElement API tests:

* fast/dom/DOMURL/get-href-attribute-port-expected.txt: Added.
* fast/dom/DOMURL/get-href-attribute-port.html: Added.
* fast/dom/DOMURL/resources: Added.
* fast/dom/DOMURL/resources/iframe-with-anchor.html: Added.
* fast/dom/DOMURL/set-href-attribute-hash-expected.txt: Added.
* fast/dom/DOMURL/set-href-attribute-hash.html: Added.
* fast/dom/DOMURL/set-href-attribute-host-expected.txt: Added.
* fast/dom/DOMURL/set-href-attribute-host.html: Added.
* fast/dom/DOMURL/set-href-attribute-hostname-expected.txt: Added.
* fast/dom/DOMURL/set-href-attribute-hostname.html: Added.
* fast/dom/DOMURL/set-href-attribute-pathname-expected.txt: Added.
* fast/dom/DOMURL/set-href-attribute-pathname.html: Added.
* fast/dom/DOMURL/set-href-attribute-port-expected.txt: Added.
* fast/dom/DOMURL/set-href-attribute-port.html: Added.
* fast/dom/DOMURL/set-href-attribute-protocol-expected.txt: Added.
* fast/dom/DOMURL/set-href-attribute-protocol.html: Added.
* fast/dom/DOMURL/set-href-attribute-search-expected.txt: Added.
* fast/dom/DOMURL/set-href-attribute-search.html: Added.
* fast/dom/DOMURL/set-href-attribute-whitespace-expected.txt: Added.
* fast/dom/DOMURL/set-href-attribute-whitespace.html: Added.
* fast/dom/DOMURL/url-origin-expected.txt: Added.
* fast/dom/DOMURL/url-origin.html: Added.

Brand new tests for username and password properties, accessors on invalid URLS,
and different constructor modes:
* fast/dom/DOMURL/invalid-url-getters-expected.txt: Added.
* fast/dom/DOMURL/invalid-url-getters.html: Added.
* fast/dom/DOMURL/url-constructor-expected.txt: Added.
* fast/dom/DOMURL/url-constructor.html: Added.
* fast/dom/DOMURL/url-password-expected.txt: Added.
* fast/dom/DOMURL/url-password.html: Added.
* fast/dom/DOMURL/url-username-expected.txt: Added.
* fast/dom/DOMURL/url-username.html: Added.

Update tests and results for the fact that URL constructor takes arguments.
* fast/dom/DOMURL/check-instanceof-domurl-functions.html:
* fast/dom/constructed-objects-prototypes-expected.txt:
* fast/dom/script-tests/constructed-objects-prototypes.js:
* js/dom/constructor-length.html:
* platform/efl/js/dom/constructor-length-expected.txt:
* platform/gtk-wk2/js/dom/constructor-length-expected.txt:
* platform/gtk/js/dom/constructor-length-expected.txt:
* platform/mac/js/dom/constructor-length-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLcheckinstanceofdomurlfunctionshtml">trunk/LayoutTests/fast/dom/DOMURL/check-instanceof-domurl-functions.html</a></li>
<li><a href="#trunkLayoutTestsfastdomconstructedobjectsprototypesexpectedtxt">trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomscripttestsconstructedobjectsprototypesjs">trunk/LayoutTests/fast/dom/script-tests/constructed-objects-prototypes.js</a></li>
<li><a href="#trunkLayoutTestsjsdomconstructorlengthhtml">trunk/LayoutTests/js/dom/constructor-length.html</a></li>
<li><a href="#trunkLayoutTestsplatformefljsdomconstructorlengthexpectedtxt">trunk/LayoutTests/platform/efl/js/dom/constructor-length-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkjsdomconstructorlengthexpectedtxt">trunk/LayoutTests/platform/gtk/js/dom/constructor-length-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformgtkwk2jsdomconstructorlengthexpectedtxt">trunk/LayoutTests/platform/gtk-wk2/js/dom/constructor-length-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacjsdomconstructorlengthexpectedtxt">trunk/LayoutTests/platform/mac/js/dom/constructor-length-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreGNUmakefilelistam">trunk/Source/WebCore/GNUmakefile.list.am</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMURLcpp">trunk/Source/WebCore/html/DOMURL.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMURLh">trunk/Source/WebCore/html/DOMURL.h</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMURLidl">trunk/Source/WebCore/html/DOMURL.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomDOMURLgethrefattributeportexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/get-href-attribute-port-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLgethrefattributeporthtml">trunk/LayoutTests/fast/dom/DOMURL/get-href-attribute-port.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLinvalidurlgettersexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/invalid-url-getters-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLinvalidurlgettershtml">trunk/LayoutTests/fast/dom/DOMURL/invalid-url-getters.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributehashexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributehashhtml">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributehostexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-host-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributehosthtml">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-host.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributehostnameexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hostname-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributehostnamehtml">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hostname.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributepathnameexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-pathname-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributepathnamehtml">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-pathname.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributeportexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-port-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributeporthtml">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-port.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributeprotocolexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributeprotocolhtml">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributesearchexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-search-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributesearchhtml">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-search.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributewhitespaceexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-whitespace-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLsethrefattributewhitespacehtml">trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-whitespace.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLurlconstructorexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/url-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLurlconstructorhtml">trunk/LayoutTests/fast/dom/DOMURL/url-constructor.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLurloriginexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/url-origin-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLurloriginhtml">trunk/LayoutTests/fast/dom/DOMURL/url-origin.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLurlpasswordexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/url-password-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLurlpasswordhtml">trunk/LayoutTests/fast/dom/DOMURL/url-password.html</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLurlusernameexpectedtxt">trunk/LayoutTests/fast/dom/DOMURL/url-username-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomDOMURLurlusernamehtml">trunk/LayoutTests/fast/dom/DOMURL/url-username.html</a></li>
<li><a href="#trunkSourceWebCorehtmlURLUtilsidl">trunk/Source/WebCore/html/URLUtils.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/ChangeLog        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2014-01-31  Maciej Stachowiak  &lt;mjs@apple.com&gt;
+
+        Implement (most of) URL API
+        https://bugs.webkit.org/show_bug.cgi?id=127795
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add a bunch of new tests for URL(), copied from HTMLAnchorElement API tests:
+
+        * fast/dom/DOMURL/get-href-attribute-port-expected.txt: Added.
+        * fast/dom/DOMURL/get-href-attribute-port.html: Added.
+        * fast/dom/DOMURL/resources: Added.
+        * fast/dom/DOMURL/resources/iframe-with-anchor.html: Added.
+        * fast/dom/DOMURL/set-href-attribute-hash-expected.txt: Added.
+        * fast/dom/DOMURL/set-href-attribute-hash.html: Added.
+        * fast/dom/DOMURL/set-href-attribute-host-expected.txt: Added.
+        * fast/dom/DOMURL/set-href-attribute-host.html: Added.
+        * fast/dom/DOMURL/set-href-attribute-hostname-expected.txt: Added.
+        * fast/dom/DOMURL/set-href-attribute-hostname.html: Added.
+        * fast/dom/DOMURL/set-href-attribute-pathname-expected.txt: Added.
+        * fast/dom/DOMURL/set-href-attribute-pathname.html: Added.
+        * fast/dom/DOMURL/set-href-attribute-port-expected.txt: Added.
+        * fast/dom/DOMURL/set-href-attribute-port.html: Added.
+        * fast/dom/DOMURL/set-href-attribute-protocol-expected.txt: Added.
+        * fast/dom/DOMURL/set-href-attribute-protocol.html: Added.
+        * fast/dom/DOMURL/set-href-attribute-search-expected.txt: Added.
+        * fast/dom/DOMURL/set-href-attribute-search.html: Added.
+        * fast/dom/DOMURL/set-href-attribute-whitespace-expected.txt: Added.
+        * fast/dom/DOMURL/set-href-attribute-whitespace.html: Added.
+        * fast/dom/DOMURL/url-origin-expected.txt: Added.
+        * fast/dom/DOMURL/url-origin.html: Added.
+
+        Brand new tests for username and password properties, accessors on invalid URLS,
+        and different constructor modes:
+        * fast/dom/DOMURL/invalid-url-getters-expected.txt: Added.
+        * fast/dom/DOMURL/invalid-url-getters.html: Added.
+        * fast/dom/DOMURL/url-constructor-expected.txt: Added.
+        * fast/dom/DOMURL/url-constructor.html: Added.
+        * fast/dom/DOMURL/url-password-expected.txt: Added.
+        * fast/dom/DOMURL/url-password.html: Added.
+        * fast/dom/DOMURL/url-username-expected.txt: Added.
+        * fast/dom/DOMURL/url-username.html: Added.
+
+        Update tests and results for the fact that URL constructor takes arguments.
+        * fast/dom/DOMURL/check-instanceof-domurl-functions.html:
+        * fast/dom/constructed-objects-prototypes-expected.txt:
+        * fast/dom/script-tests/constructed-objects-prototypes.js:
+        * js/dom/constructor-length.html:
+        * platform/efl/js/dom/constructor-length-expected.txt:
+        * platform/gtk-wk2/js/dom/constructor-length-expected.txt:
+        * platform/gtk/js/dom/constructor-length-expected.txt:
+        * platform/mac/js/dom/constructor-length-expected.txt:
+
</ins><span class="cx"> 2014-01-31  Bem Jones-Bey  &lt;bjonesbe@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Create clipping path from &lt;box&gt; value
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLcheckinstanceofdomurlfunctionshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/DOMURL/check-instanceof-domurl-functions.html (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/check-instanceof-domurl-functions.html        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/fast/dom/DOMURL/check-instanceof-domurl-functions.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -7,7 +7,7 @@
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> description(&quot;Test instanceof functions and properties of URL and webkitURL.&quot;);
</span><span class="cx"> 
</span><del>-var url = new URL;
</del><ins>+var url = new URL(&quot;about:blank&quot;);
</ins><span class="cx"> 
</span><span class="cx"> shouldBeTrue(&quot;'createObjectURL' in URL&quot;);
</span><span class="cx"> shouldBeTrue(&quot;'revokeObjectURL' in URL&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLgethrefattributeportexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/get-href-attribute-port-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/get-href-attribute-port-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/get-href-attribute-port-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test getting the port attribute of the URL in a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Default port is empty
+PASS a.port is ''
+Unspecified port should return empty string
+PASS a.port is ''
+Empty port should be empty
+PASS a.port is ''
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLgethrefattributeporthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/get-href-attribute-port.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/get-href-attribute-port.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/get-href-attribute-port.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test getting the port attribute of the URL in a URL object.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Default port is empty&quot;);
+shouldBe(&quot;a.port&quot;, &quot;''&quot;);
+
+debug(&quot;Unspecified port should return empty string&quot;);
+a.href = &quot;http://example.com/&quot;;
+shouldBe(&quot;a.port&quot;, &quot;''&quot;);
+
+debug(&quot;Empty port should be empty&quot;);
+a.href = &quot;http://example.com:/&quot;;
+shouldBe(&quot;a.port&quot;, &quot;''&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLinvalidurlgettersexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/invalid-url-getters-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/invalid-url-getters-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/invalid-url-getters-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+Test what getters return on an invalid URL
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+FAIL invalidURL should be http://@@:p@www.example.com:22/bar?x#y (of type string). Was http://@@:p@www.example.com:22/bar?x#y (of type object).
+FAIL url.origin should be . Threw exception ReferenceError: Can't find variable: url
+FAIL url.username should be . Threw exception ReferenceError: Can't find variable: url
+FAIL url.password should be . Threw exception ReferenceError: Can't find variable: url
+FAIL url.host should be . Threw exception ReferenceError: Can't find variable: url
+FAIL url.hostname should be . Threw exception ReferenceError: Can't find variable: url
+FAIL url.port should be . Threw exception ReferenceError: Can't find variable: url
+FAIL url.pathname should be . Threw exception ReferenceError: Can't find variable: url
+FAIL url.search should be . Threw exception ReferenceError: Can't find variable: url
+FAIL url.hash should be . Threw exception ReferenceError: Can't find variable: url
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLinvalidurlgettershtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/invalid-url-getters.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/invalid-url-getters.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/invalid-url-getters.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description(&quot;Test what getters return on an invalid URL&quot;);
+
+var invalidURL = new URL(&quot;http://u:p@www.example.com:22/bar?x#y&quot;)
+invalidURL.username = &quot;@@&quot;;
+
+shouldBe(&quot;invalidURL.toString()&quot;, &quot;'http://@@:p@www.example.com:22/bar?x#y'&quot;);
+shouldBe(&quot;invalidURL.origin&quot;, &quot;''&quot;);
+shouldBe(&quot;invalidURL.username&quot;, &quot;''&quot;);
+shouldBe(&quot;invalidURL.password&quot;, &quot;''&quot;);
+shouldBe(&quot;invalidURL.host&quot;, &quot;''&quot;);
+shouldBe(&quot;invalidURL.hostname&quot;, &quot;''&quot;);
+shouldBe(&quot;invalidURL.port&quot;, &quot;''&quot;);
+shouldBe(&quot;invalidURL.pathname&quot;, &quot;''&quot;);
+shouldBe(&quot;invalidURL.search&quot;, &quot;''&quot;);
+shouldBe(&quot;invalidURL.hash&quot;, &quot;''&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributehashexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+Test setting the hash attribute of the URL in a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Hash value does not start with '#'
+PASS a.href is 'https://www.mydomain.com:8080/path/testurl.html#hash-value'
+Hash value starts with '#'
+PASS a.href is 'file:///path/testurl.html#hash_value'
+'?' in hash value
+PASS a.href is 'http://www.mydomain.com/path/testurl.html#hash?value'
+'#' in hash value, and illegal characters in hostname
+PASS a.href = &quot;https://www.my\&quot;d(){}|~om?ain#com/path/testurl.html#middle&quot; threw exception TypeError: Type error.
+PASS a.href is 'https://www.my\&quot;d(){}|~om?ain#com/path/testurl.html#middle'
+Set hash to null
+PASS a.href is 'https://www.mydomain.com/path/testurl.html#'
+Set hash to empty string
+PASS a.href is 'https://www.mydomain.com/path/testurl.html#'
+Add hash to mailto: protocol
+PASS a.href is 'mailto:e-mail_address@goes_here#hash-value'
+Add hash to file: protocol
+PASS a.href is 'file:///some%20path#hash value'
+Set hash to '#'
+PASS a.href is 'http://mydomain.com/#'
+Add hash to non-standard protocol
+PASS a.href is 'foo:bar#hash'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributehashhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hash.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test setting the hash attribute of the URL in a URL object.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Hash value does not start with '#'&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/testurl.html#middle&quot;;
+a.hash = &quot;hash-value&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:8080/path/testurl.html#hash-value'&quot;);
+
+debug(&quot;Hash value starts with '#'&quot;);
+a.href = &quot;file:///path/testurl.html#middle&quot;;
+a.hash = &quot;#hash_value&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'file:///path/testurl.html#hash_value'&quot;);
+
+debug(&quot;'?' in hash value&quot;);
+a.href = &quot;http://www.mydomain.com/path/testurl.html#middle&quot;;
+a.hash = &quot;#hash?value&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http://www.mydomain.com/path/testurl.html#hash?value'&quot;);
+
+// The expected behavior should change when character table is updated.
+// IE8 and Firefox3.5.2 don't consider these characters as illegal.
+debug(&quot;'#' in hash value, and illegal characters in hostname&quot;);
+// with the URL API, assigning an invalid href throws
+shouldThrow('a.href = &quot;https://www.my\\&quot;d(){}|~om?ain#com/path/testurl.html#middle&quot;');
+a.hash = &quot;#hash#value&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.my\\\&quot;d(){}|~om?ain#com/path/testurl.html#middle'&quot;);
+
+// IE8 converts null to &quot;null&quot;, which is not the right thing to do.
+// Firefox 3.5.2 removes the '#' at the end, and it should per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug(&quot;Set hash to null&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html#middle&quot;;
+a.hash = null;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/testurl.html#'&quot;);
+
+// Firefox 3.5.2 removes the '#' at the end, and it should per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug(&quot;Set hash to empty string&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html#middle&quot;;
+a.hash = &quot;&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/testurl.html#'&quot;);
+
+// Firefox 3.5.2 does not allow setting hash to mailto: scheme, and it should.
+debug(&quot;Add hash to mailto: protocol&quot;);
+a.href = &quot;mailto:e-mail_address@goes_here&quot;;
+a.hash = &quot;hash-value&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'mailto:e-mail_address@goes_here#hash-value'&quot;);
+
+// IE8 does not percent-encode spaces in the hash component, but it does that
+// in the path component.
+debug(&quot;Add hash to file: protocol&quot;);
+a.href = &quot;file:///some path&quot;;
+a.hash = &quot;hash value&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'file:///some%20path#hash value'&quot;);
+
+debug(&quot;Set hash to '#'&quot;);
+a.href = &quot;http://mydomain.com#middle&quot;;
+a.hash = &quot;#&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http://mydomain.com/#'&quot;);
+
+// Firefox 3.5.2 does not allow setting hash to foo: scheme, and it should.
+debug(&quot;Add hash to non-standard protocol&quot;);
+try {
+a.href = &quot;foo:bar&quot;;
+a.hash = &quot;#hash&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'foo:bar#hash'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributehostexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-host-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-host-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-host-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+Test setting the host attribute of the URL in a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Basic test
+PASS a.href is 'https://www.otherdomain.com:0/path/'
+Set host with '?' in it
+PASS a.href is 'https://www.other/?domain.com:8080/path/?key=value'
+Set default port for another protocol
+PASS a.href is 'https://www.otherdomain.com:80/path/'
+Set default port
+PASS a.href is 'https://www.otherdomain.com/path/'
+Set host with letters in port number
+PASS a.href is 'https://www.otherdomain.com:44/path/'
+Leading space in port number
+PASS a.href is 'https://www.otherdomain.com:0/path/'
+Colon without port number
+PASS a.href is 'https://www.otherdomain.com:0/path/'
+Set host to null
+PASS a.href is 'https://www.mydomain.com:8080/path/'
+Set host to empty string
+PASS a.href is 'https://www.mydomain.com:8080/path/'
+Set host to URL with file: protocol
+PASS a.href is 'file://mydomain.com/path/'
+Set host containing slashes in it
+PASS a.href is 'https://www.otherdom/ain.com/path/'
+Set host to a malformed URL
+PASS a.href = &quot;https:/\rww.my@domain.com:8080/path/&quot; threw exception TypeError: Type error.
+PASS a.href is 'https:/\rww.my@domain.com:8080/path/'
+Set host that starts with ':'
+PASS a.href is 'https://domain.com:8080/path/'
+Set host to URL containing username and ..
+PASS a.href is 'https://rwwmy@www.other!domain.com:25/pa..th/'
+Set host to a URL with tel: protocol
+PASS a.href is 'tel:+1-816-555-1212'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributehosthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-host.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-host.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-host.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,128 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test setting the host attribute of the URL in a URL object.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Basic test&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = &quot;www.otherdomain.com:0&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdomain.com:0/path/'&quot;);
+
+// IE8 throws &quot;The URL is invalid&quot; exception.
+debug(&quot;Set host with '?' in it&quot;);
+try {
+a.href = &quot;https://www.mydomain.com:8080/path/?key=value&quot;;
+a.host = &quot;www.other?domain.com:8080&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.other/?domain.com:8080/path/?key=value'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+debug(&quot;Set default port for another protocol&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = &quot;www.otherdomain.com:80&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdomain.com:80/path/'&quot;);
+
+debug(&quot;Set default port&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = &quot;www.otherdomain.com:443&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdomain.com/path/'&quot;);
+
+// Firefox 3.5.2 rejects a port that contains non-digits.
+debug(&quot;Set host with letters in port number&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = &quot;www.otherdomain.com:44a5&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdomain.com:44/path/'&quot;);
+
+// Firefox 3.5.2 ignores the leading space in the port, but errs on reparsing the port.
+debug(&quot;Leading space in port number&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = &quot;www.otherdomain.com: 443&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdomain.com:0/path/'&quot;);
+
+// Firefox 3.5.2 removed the port, clearly against the spec .
+debug(&quot;Colon without port number&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = &quot;www.otherdomain.com:&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdomain.com:0/path/'&quot;);
+
+// IE8 converts null to &quot;null&quot;, which is not the right thing to do.
+// Firefox 3.5.2 allows setting the host to null, which it shouldn't per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug(&quot;Set host to null&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = null;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:8080/path/'&quot;);
+
+// Both IE8 and Firefox 3.5.2 allow setting the host to empty string, which they shouldn't, per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+// Since both do that in a buggy way, WebKit does not follow either one of them.
+debug(&quot;Set host to empty string&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = &quot;&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:8080/path/'&quot;);
+
+// Firefox 3.5.2 does not `set the host for file: .
+debug(&quot;Set host to URL with file: protocol&quot;);
+a.href = &quot;file:///path/&quot;;
+a.host = &quot;mydomain.com&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'file://mydomain.com/path/'&quot;);
+
+// IE8 throws if the host contains '/'
+debug(&quot;Set host containing slashes in it&quot;);
+try {
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.host = &quot;www.other\dom/ain.com&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdom/ain.com/path/'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// WebKit fails to strip the \r in the authority, and therefore treats the URL as invalid
+// and gets a different result than Firefox or Chrome; we should probably strip it
+debug(&quot;Set host to a malformed URL&quot;);
+shouldThrow('a.href = &quot;https:/\\rww.my@domain.com:8080/path/&quot;');
+a.host = &quot;www.other!domain.com:15&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https:/\\rww.my@domain.com:8080/path/'&quot;);
+
+// IE8 throws an &quot;Object Error&quot; exception.
+// Firefox 3.5.2 accepts this but throws an exception later
+// WebKit should just reject
+debug(&quot;Set host that starts with ':'&quot;);
+try {
+a.href = &quot;https://domain.com:8080/path/&quot;;
+a.host = &quot;:www.otherdomain.com:15&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://domain.com:8080/path/'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// IE8 throws a security exception if the host contains '@'
+debug(&quot;Set host to URL containing username and ..&quot;);
+try {
+a.href = &quot;https://rwwmy@domain.com:8080/pa..th/&quot;;
+a.host = &quot;www.other!domain.com:25&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://rwwmy@www.other!domain.com:25/pa..th/'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// Both IE8 and Firefox append the hosts, instead of rejecting, per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug(&quot;Set host to a URL with tel: protocol&quot;);
+a.href = &quot;tel:+1-816-555-1212&quot;;
+a.host = &quot;+1-800-555-1212&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'tel:+1-816-555-1212'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributehostnameexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hostname-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hostname-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hostname-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+Test setting the hostname attribute of the URL in a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Basic test
+PASS a.href is 'https://www.otherdomain.com:8080/path/'
+Extra slashes before hostname
+PASS a.href is 'https://www.otherdomain.com:8080/path/'
+Set hostname to URL with foo: protocol
+PASS a.href is 'foo://www.otherdomain.com/path/'
+Set hostname to null
+PASS a.href is 'https://www.mydomain.com:8080/path/'
+Set hostname to empty string
+PASS a.href is 'https://www.mydomain.com:8080/path/'
+Set hostname to URL with 2 colons
+PASS a.href is 'really:bad:url'
+Set a hostname that contains space in it
+PASS a.href = &quot;http://www.my domain.com/path/&quot; threw exception TypeError: Type error.
+PASS a.href is 'http://www.my domain.com/path/'
+Set hostname on a local file
+FAIL a.href should be c:/path/testurl.html. Was c://a/path/testurl.html.
+Set hostname to undefined
+PASS a.href is 'https://undefined:8080/path/'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributehostnamehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hostname.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hostname.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-hostname.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test setting the hostname attribute of the URL in a URL object.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Basic test&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.hostname = &quot;www.otherdomain.com&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdomain.com:8080/path/'&quot;);
+
+// IE8 throws an exception &quot;The URL is invalid&quot;.
+try {
+debug(&quot;Extra slashes before hostname&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.hostname = &quot;//www.otherdomain.com&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.otherdomain.com:8080/path/'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// Firefox 3.5.2 does not allow setting the host to foo: protocol
+debug(&quot;Set hostname to URL with foo: protocol&quot;);
+a.href = &quot;foo://www.mydomain.com/path/&quot;;
+a.hostname = &quot;www.otherdomain.com&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'foo://www.otherdomain.com/path/'&quot;);
+
+// IE8 converts null to &quot;null&quot;, which is not the right thing to do.
+// Firefox 3.5.2 allows setting the hostname to null, which is wrong per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug(&quot;Set hostname to null&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.hostname = null;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:8080/path/'&quot;);
+
+// Both IE8 and Firefox 3.5.2 allow setting the host to empty string, against the spec at
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+// Since both do that in a buggy way, WebKit should not follow either one of them.
+debug(&quot;Set hostname to empty string&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.hostname = &quot;&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:8080/path/'&quot;);
+
+// IE8 fails to process really: protocol.
+debug(&quot;Set hostname to URL with 2 colons&quot;);
+a.href = &quot;really:bad:url&quot;;
+a.hostname = &quot;mydomain.com&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'really:bad:url'&quot;);
+
+// The expected behavior should change when the character table is updated.
+// IE8 encodes the space in the hostname.
+// Firefox3.5.2 and WebKit consider space as illegal character and would not set 
+// the new hostname.
+debug(&quot;Set a hostname that contains space in it&quot;);
+shouldThrow('a.href = &quot;http://www.my domain.com/path/&quot;');
+a.hostname = &quot;www.other domain.com&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http://www.my domain.com/path/'&quot;);
+
+// IE8 throws an exception &quot;The URL is invalid&quot;.
+try {
+debug(&quot;Set hostname on a local file&quot;);
+a.href = &quot;c:/path/testurl.html&quot;;
+a.hostname= &quot;a&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'c:/path/testurl.html'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+debug(&quot;Set hostname to undefined&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/&quot;;
+a.hostname = undefined;
+shouldBe(&quot;a.href&quot;, &quot;'https://undefined:8080/path/'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributepathnameexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-pathname-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-pathname-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-pathname-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+Test setting the pathname attribute of the URL in a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Set pathname that starts with slash
+PASS a.href is 'https://www.mydomain.com/path%20name?key=value'
+Set pathname that does not start with slash and contains '?'
+PASS a.href is 'https://www.mydomain.com/pa%3Fth?key=value'
+Set pathname that starts with double slash and contains '#'
+PASS a.href is 'https://www.mydomain.com//path%23name?key=value'
+Set a pathname containing .. in it
+PASS a.href is 'https://www.mydomain.com/path?key=value'
+Set pathname to null
+PASS a.href is 'https://www.mydomain.com/?key=value'
+Set pathname to empty string
+PASS a.href is 'https://www.mydomain.com/?key=value'
+Set pathname that includes illegal characters to URL that contains illegal characters.
+PASS a.href = &quot;https://www.my|d[]()omain.com/path/testurl.html?key=value&quot; threw exception TypeError: Type error.
+PASS a.href is 'https://www.my|d[]()omain.com/path/testurl.html?key=value'
+Set pathname to URL that contains '@' in host
+PASS a.href = &quot;http://w@#ww&quot; threw exception TypeError: Type error.
+PASS a.href is 'http://w@#ww'
+Set pathname to a URL with non-hierarchical protocol
+PASS a.href is 'tel:+1800-555-1212'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributepathnamehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-pathname.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-pathname.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-pathname.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test setting the pathname attribute of the URL in a URL object.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Set pathname that starts with slash&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value&quot;;
+a.pathname = &quot;/path name&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path%20name?key=value'&quot;);
+
+// IE8 throws an &quot;Invalid URL&quot; exception.
+try {
+debug(&quot;Set pathname that does not start with slash and contains '?'&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value&quot;;
+a.pathname = &quot;pa?th&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/pa%3Fth?key=value'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// IE8 throws an &quot;Invalid URL&quot; exception.
+try {
+debug(&quot;Set pathname that starts with double slash and contains '#'&quot;);
+a.href = &quot;https://www.mydomain.com/path?key=value&quot;;
+a.pathname = &quot;//path#name&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com//path%23name?key=value'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+debug(&quot;Set a pathname containing .. in it&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value&quot;;
+a.pathname = &quot;/it/../path&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path?key=value'&quot;);
+
+// IE8 converts null to &quot;null&quot;, which is not the right thing to do.
+debug(&quot;Set pathname to null&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value&quot;;
+a.pathname = null;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/?key=value'&quot;);
+
+debug(&quot;Set pathname to empty string&quot;);
+a.href = &quot;https://www.mydomain.com/?key=value&quot;;
+a.pathname = &quot;&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/?key=value'&quot;);
+
+// The expected behavior should change when the character table is updated.
+// IE8 considers this URL as valid.
+debug(&quot;Set pathname that includes illegal characters to URL that contains illegal characters.&quot;);
+shouldThrow('a.href = &quot;https://www.my|d[]()omain.com/path/testurl.html?key=value&quot;');
+a.pathname = &quot;p$a|th&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.my|d[]()omain.com/path/testurl.html?key=value'&quot;);
+
+// IE8 throws a security exception. Gecko parses this as a URL with an empty hostname.
+try {
+debug(&quot;Set pathname to URL that contains '@' in host&quot;);
+shouldThrow('a.href = &quot;http://w@#ww&quot;');
+a.pathname = &quot;path&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http://w@#ww'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// IE8 allows setting the pathname, for non-hierarchial URL.
+// It is not supposed to allow that per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug(&quot;Set pathname to a URL with non-hierarchical protocol&quot;);
+a.href = &quot;tel:+1800-555-1212&quot;;
+a.pathname = &quot;the-path&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'tel:+1800-555-1212'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributeportexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-port-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-port-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-port-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+Test setting the port attribute of the URL in a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Default port as number
+PASS a.href is 'https://www.mydomain.com/path/testurl.html?key=value'
+Default port as string
+PASS a.href is 'https://www.mydomain.com/path/testurl.html?key=value'
+Set port to 0
+PASS a.href is 'https://www.mydomain.com:0/path/testurl.html?key=value'
+Set port to non-number
+PASS a.href is 'https://www.mydomain.com:4/path/testurl.html?key=value'
+Set port to null
+PASS a.href is 'https://www.mydomain.com:0/path/testurl.html?key=value'
+Set port to empty string
+PASS a.href is 'https://www.mydomain.com:0/path/testurl.html?key=value'
+Set port to undefined
+PASS a.href is 'https://www.mydomain.com:0/path/testurl.html?key=value'
+Set port to URL with foo: protocol
+PASS a.href is 'foo://bar:50/'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributeporthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-port.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-port.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-port.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test setting the port attribute of the URL in a URL object.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Default port as number&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/testurl.html?key=value&quot;;
+a.port = 443;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/testurl.html?key=value'&quot;);
+
+debug(&quot;Default port as string&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/testurl.html?key=value&quot;;
+a.port = &quot;443&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/testurl.html?key=value'&quot;);
+
+debug(&quot;Set port to 0&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/testurl.html?key=value&quot;;
+a.port = &quot;0&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:0/path/testurl.html?key=value'&quot;);
+
+// Firefox 3.5.2 does not accept the port if any character is not a digit.
+debug(&quot;Set port to non-number&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/testurl.html?key=value&quot;;
+a.port = &quot;4a&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:4/path/testurl.html?key=value'&quot;);
+
+// Firefox 3.5.2 does not accept the port if it is null.
+debug(&quot;Set port to null&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/testurl.html?key=value&quot;;
+a.port = null;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:0/path/testurl.html?key=value'&quot;);
+
+// Firefox 3.5.2 does not accept the port if it is null.
+debug(&quot;Set port to empty string&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/testurl.html?key=value&quot;;
+a.port = &quot;&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:0/path/testurl.html?key=value'&quot;);
+
+debug(&quot;Set port to undefined&quot;);
+a.href = &quot;https://www.mydomain.com:8080/path/testurl.html?key=value&quot;;
+a.port = undefined;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com:0/path/testurl.html?key=value'&quot;);
+
+// Firefox 3.5.2 does not allow setting the port on a URL with protocol foo: .
+debug(&quot;Set port to URL with foo: protocol&quot;);
+a.href = &quot;foo://bar/&quot;;
+a.port = 50;
+shouldBe(&quot;a.href&quot;, &quot;'foo://bar:50/'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributeprotocolexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+Test setting the protocol attribute of the URL in a URL object .
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Basic test
+PASS a.href is 'http-foo://www.mydomain.com/path/'
+Set a protocol that contains ':'
+PASS a.href is 'http://www.mydomain.com/path/'
+Set a protocol that contains invalid characters
+PASS a.href is 'https://www.mydomain.com/path/'
+Set a protocol to a URL with invalid host name
+PASS a.href is 'foo:^^'
+Set a protocol that starts with ':'
+PASS a.href is 'https://www.mydomain.com/path/'
+Set protocol to null
+PASS a.href is 'https://www.mydomain.com/path/'
+Set protocol to empty string
+PASS a.href is 'https://www.mydomain.com/path/'
+Set protocol to http on malformed URL
+PASS a.href is 'http:/??bar'
+Set protocol to a URL which points to a local file
+PASS a.href is 'f-oo:path'
+Set protocol to undefined
+PASS a.href is 'undefined://www.mydomain.com/path/'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributeprotocolhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-protocol.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,92 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test setting the protocol attribute of the URL in a URL object .');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Basic test&quot;);
+a.href = &quot;https://www.mydomain.com/path/&quot;;
+a.protocol = &quot;http-foo&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http-foo://www.mydomain.com/path/'&quot;);
+
+// IE8 throws &quot;Invalid argument&quot; exception.
+debug(&quot;Set a protocol that contains ':'&quot;);
+try {
+a.href = &quot;https://www.mydomain.com/path/&quot;;
+a.protocol = &quot;http:foo&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http://www.mydomain.com/path/'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// IE8 throws &quot;Invalid argument&quot; exception.
+debug(&quot;Set a protocol that contains invalid characters&quot;);
+try {
+a.href = &quot;https://www.mydomain.com/path/&quot;;
+a.protocol = &quot;http^foo&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// The expected behavior should change when the character table is updated.
+// IE8 encodes '^' in the host.
+debug(&quot;Set a protocol to a URL with invalid host name&quot;);
+a.href = &quot;h:^^&quot;;
+a.protocol = &quot;foo&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'foo:^^'&quot;);
+
+// IE8 throws &quot;Invalid argument&quot; exception.
+try {
+debug(&quot;Set a protocol that starts with ':'&quot;);
+a.href = &quot;https://www.mydomain.com/path/&quot;;
+a.protocol = &quot;:http&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// IE8 converts null to &quot;null&quot;, which is not the right thing to do.
+debug(&quot;Set protocol to null&quot;);
+a.href = &quot;https://www.mydomain.com/path/&quot;;
+a.protocol = null;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/'&quot;);
+
+// IE8 throws &quot;Invalid argument&quot; exception.
+try {
+debug(&quot;Set protocol to empty string&quot;);
+a.href = &quot;https://www.mydomain.com/path/&quot;;
+a.protocol = &quot;&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+// Firefox 4 adds three slashes, unlike Safari and Chrome
+debug(&quot;Set protocol to http on malformed URL&quot;);
+a.href = &quot;foo:??bar&quot;;
+a.protocol = &quot;http&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http:/??bar'&quot;);
+
+// IE8 keeps the protocol if it is 'c:'.
+debug(&quot;Set protocol to a URL which points to a local file&quot;);
+a.href = &quot;c:\path&quot;;
+a.protocol = &quot;f-oo&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'f-oo:path'&quot;);
+
+debug(&quot;Set protocol to undefined&quot;);
+a.href = &quot;https://www.mydomain.com/path/&quot;;
+a.protocol = undefined;
+shouldBe(&quot;a.href&quot;, &quot;'undefined://www.mydomain.com/path/'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributesearchexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-search-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-search-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-search-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+Test setting the search attribute of the URL in a URL object .
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Set search without '?'
+PASS a.href is 'https://www.mydomain.com/path/?value=key'
+Set search that starts with '?' and contains spaces
+PASS a.href is 'https://www.mydomain.com/path/?val%20ue=%20key?'
+Set search to a malformed URL
+PASS a.href is 's:www.mydomain.com/path/?%'
+Set search containing '#'
+PASS a.href is 'https://www.mydomain.com/path/?value%23key#hash'
+Set search to a malformed URL
+PASS a.href is 'bad:/|/url?value=key'
+Set search to null
+PASS a.href is 'https://www.mydomain.com/path/'
+Set search to empty string
+PASS a.href is 'https://www.mydomain.com/path/?'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributesearchhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-search.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-search.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-search.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test setting the search attribute of the URL in a URL object .');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Set search without '?'&quot;);
+a.href = &quot;https://www.mydomain.com/path/?key=value&quot;;
+a.search = &quot;value=key&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/?value=key'&quot;);
+
+// IE8 does not encode spaces in search string
+debug(&quot;Set search that starts with '?' and contains spaces&quot;);
+a.href = &quot;https://www.mydomain.com/path/?key=value&quot;;
+a.search = &quot;?val ue= key?&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/?val%20ue=%20key?'&quot;);
+
+debug(&quot;Set search to a malformed URL&quot;);
+a.href = &quot;s:www.mydomain.com/path/&quot;;
+a.search = &quot;%&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'s:www.mydomain.com/path/?%'&quot;);
+
+// IE8 throws &quot;The URL is invalid&quot; exception.
+debug(&quot;Set search containing '#'&quot;);
+try {
+a.href = &quot;https://www.mydomain.com/path/?key=value#hash&quot;;
+a.search = &quot;?value#key&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/?value%23key#hash'&quot;);
+} catch(e) {
+debug(&quot;Exception: &quot; + e.description);
+}
+
+debug(&quot;Set search to a malformed URL&quot;);
+a.href = &quot;bad:/|/url&quot;;
+a.search = &quot;?value=key&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'bad:/|/url?value=key'&quot;);
+
+// IE8 converts null to &quot;null&quot;, which is not the right thing to do.
+debug(&quot;Set search to null&quot;);
+a.href = &quot;https://www.mydomain.com/path/?key=value&quot;;
+a.search = null;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/'&quot;);
+
+// Firefox 3.5.2 Removes the '?', and it shouldn't, per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug(&quot;Set search to empty string&quot;);
+a.href = &quot;https://www.mydomain.com/path/?key=value&quot;;
+a.search = &quot;&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'https://www.mydomain.com/path/?'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributewhitespaceexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-whitespace-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-whitespace-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-whitespace-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+Test setting the href attribute of a URL object to a URL with leading and trailing whitespace.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Set href that starts with a space
+PASS a.hostname is 'www.mydomain.com'
+Set href that starts with a newline
+PASS a.hostname is 'www.mydomain.com'
+Set href that starts with a tab
+PASS a.hostname is 'www.mydomain.com'
+Set href that starts with a carriage return
+PASS a.hostname is 'www.mydomain.com'
+Set href that starts with a combination of newlines, spaces and tabs
+PASS a.hostname is 'www.mydomain.com'
+Set href that ends with a space
+PASS a.hostname is 'www.mydomain.com'
+Set href that ends with a newline
+PASS a.hostname is 'www.mydomain.com'
+Set href that ends with a tab
+PASS a.hostname is 'www.mydomain.com'
+Set href that ends with a carriage return
+PASS a.hostname is 'www.mydomain.com'
+Set href that ends with a combination of newlines, spaces and tabs
+PASS a.hostname is 'www.mydomain.com'
+Set href that starts and ends with a combination of newlines, spaces and tabs
+PASS a.hostname is 'www.mydomain.com'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLsethrefattributewhitespacehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-whitespace.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-whitespace.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/set-href-attribute-whitespace.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test setting the href attribute of a URL object to a URL with leading and trailing whitespace.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Set href that starts with a space&quot;);
+a.href = &quot; https://www.mydomain.com/path/testurl.html?key=value&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that starts with a newline&quot;);
+a.href = &quot;\nhttps://www.mydomain.com/path/testurl.html?key=value&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that starts with a tab&quot;);
+a.href = &quot;\thttps://www.mydomain.com/path/testurl.html?key=value&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that starts with a carriage return&quot;);
+a.href = &quot;\rhttps://www.mydomain.com/path/testurl.html?key=value&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that starts with a combination of newlines, spaces and tabs&quot;);
+a.href = &quot;\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that ends with a space&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value &quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that ends with a newline&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value\n&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that ends with a tab&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value\t&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that ends with a carriage return&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value\r&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that ends with a combination of newlines, spaces and tabs&quot;);
+a.href = &quot;https://www.mydomain.com/path/testurl.html?key=value\n \t\r \n&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+debug(&quot;Set href that starts and ends with a combination of newlines, spaces and tabs&quot;);
+a.href = &quot;\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value\n \t\r \n&quot;;
+shouldBe(&quot;a.hostname&quot;, &quot;'www.mydomain.com'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLurlconstructorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/url-constructor-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/url-constructor-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-constructor-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+Test getting the username attribute of a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+One-parameter constructor - valid URL
+PASS url.href is 'http://user:pass@example.com/path?query#fragment'
+One-parameter constructor - invalid URL should throw
+PASS url = new URL(&quot;%^$#&quot;) threw exception TypeError: Type error.
+One-parameter constructor - relative URL not valid against default base
+PASS url = new URL(&quot;foobar&quot;) threw exception TypeError: Type error.
+URL with string base
+PASS url.href is 'http://example.com/path/to/nowhere?ok'
+URL with URL base
+PASS url.href is 'http://example.com/path/to/nowhere?ok'
+URL with URL base that itself has a base
+PASS url.href is 'http://example.com/are/we/nowhere?ok'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLurlconstructorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/url-constructor.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/url-constructor.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-constructor.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test getting the username attribute of a URL object.');
+
+debug(&quot;One-parameter constructor - valid URL&quot;);
+var url = new URL(&quot;http://user:pass@example.com/path?query#fragment&quot;)
+shouldBe(&quot;url.href&quot;, &quot;'http://user:pass@example.com/path?query#fragment'&quot;);
+
+debug(&quot;One-parameter constructor - invalid URL should throw&quot;);
+shouldThrow('url = new URL(&quot;%^$#&quot;)');
+
+debug(&quot;One-parameter constructor - relative URL not valid against default base&quot;);
+shouldThrow('url = new URL(&quot;foobar&quot;)');
+
+debug(&quot;URL with string base&quot;);
+url = new URL(&quot;./nowhere?ok&quot;, &quot;http://example.com/path/to/&quot;);
+shouldBe(&quot;url.href&quot;, &quot;'http://example.com/path/to/nowhere?ok'&quot;);
+
+debug(&quot;URL with URL base&quot;);
+var base = new URL(&quot;http://example.com/path/to/&quot;);
+url = new URL(&quot;./nowhere?ok&quot;, base);
+shouldBe(&quot;url.href&quot;, &quot;'http://example.com/path/to/nowhere?ok'&quot;);
+
+debug(&quot;URL with URL base that itself has a base&quot;);
+var metabase = new URL(&quot;http://example.org/&quot;);
+var base = new URL(&quot;http://example.com/are/we/&quot;, metabase);
+url = new URL(&quot;./nowhere?ok&quot;, base);
+shouldBe(&quot;url.href&quot;, &quot;'http://example.com/are/we/nowhere?ok'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLurloriginexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/url-origin-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/url-origin-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-origin-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+http://example.com/foo/bar =&gt; http://example.com
+http://example.com/foo/bar =&gt; http://example.com
+https://example.com/ttt?ggg =&gt; https://example.com
+ftp://example.com/ttt?ggg =&gt; ftp://example.com
+file:///home/abarth =&gt; file://
+data:text/html,&lt;b&gt;foo&lt;/b&gt; =&gt; null
+http://@@@www.example.com/bar =&gt; null
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLurloriginhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/url-origin.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/url-origin.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-origin.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;body&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+var invalidURL = new URL(&quot;http://www.example.com/bar&quot;)
+invalidURL.username = &quot;@@&quot;;
+
+var cases = [
+    new URL(&quot;http://example.com/foo/bar&quot;),
+    new URL(&quot;HTTP://example.com/foo/bar&quot;),
+    new URL(&quot;https://example.com/ttt?ggg&quot;),
+    new URL(&quot;ftp://example.com/ttt?ggg&quot;),
+    new URL(&quot;file:///home/abarth&quot;),
+    new URL(&quot;data:text/html,&lt;b&gt;foo&lt;/b&gt;&quot;),
+    invalidURL
+];
+
+window.onload = function(e)
+{
+    var s = '';
+    for (var i = 0; i &lt; cases.length; ++i)
+        s += cases[i].href + ' =&gt; ' + cases[i].origin + '\n';
+
+    var pre = document.createElement('pre');
+    pre.textContent = s;
+    document.body.appendChild(pre);
+};
+
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLurlpasswordexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/url-password-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/url-password-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-password-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+Test getting the password attribute of a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Default password is empty
+PASS a.password is ''
+Unspecified password should return empty string
+PASS a.password is ''
+Empty password should be empty
+PASS a.password is ''
+Regular passowrd retrieval
+PASS a.password is 'abc123'
+Password with empty username
+PASS a.password is 'def456'
+Setting password
+PASS a.href is 'http://:xyzzy@example.com/'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLurlpasswordhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/url-password.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/url-password.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-password.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test getting the password attribute of a URL object.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Default password is empty&quot;);
+shouldBe(&quot;a.password&quot;, &quot;''&quot;);
+
+debug(&quot;Unspecified password should return empty string&quot;);
+a.href = &quot;http://example.com/&quot;;
+shouldBe(&quot;a.password&quot;, &quot;''&quot;);
+
+debug(&quot;Empty password should be empty&quot;);
+a.href = &quot;http://a:@example.com/&quot;;
+shouldBe(&quot;a.password&quot;, &quot;''&quot;);
+
+debug(&quot;Regular passowrd retrieval&quot;);
+a.href = &quot;http://joebob1:abc123@example.com/&quot;;
+shouldBe(&quot;a.password&quot;, &quot;'abc123'&quot;);
+
+debug(&quot;Password with empty username&quot;);
+a.href = &quot;http://:def456@example.com/&quot;;
+shouldBe(&quot;a.password&quot;, &quot;'def456'&quot;);
+
+debug(&quot;Setting password&quot;);
+a.href = &quot;http://@example.com/&quot;;
+a.password = &quot;xyzzy&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http://:xyzzy@example.com/'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLurlusernameexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/url-username-expected.txt (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/url-username-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-username-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+Test getting the username attribute of a URL object.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Default username is empty
+PASS a.username is ''
+Unspecified username should return empty string
+PASS a.username is ''
+Empty username should be empty
+PASS a.username is ''
+Regular username retrieval
+PASS a.username is 'joebob1'
+Username with empty password
+PASS a.username is 'joebob2'
+Username with non-empty password
+PASS a.username is 'joebob3'
+Setting username
+PASS a.href is 'http://joebob4@example.com/'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomDOMURLurlusernamehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/DOMURL/url-username.html (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/DOMURL/url-username.html                                (rev 0)
+++ trunk/LayoutTests/fast/dom/DOMURL/url-username.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script&gt;
+
+description('Test getting the username attribute of a URL object.');
+
+var a = new URL(&quot;about:blank&quot;);
+
+debug(&quot;Default username is empty&quot;);
+shouldBe(&quot;a.username&quot;, &quot;''&quot;);
+
+debug(&quot;Unspecified username should return empty string&quot;);
+a.href = &quot;http://example.com/&quot;;
+shouldBe(&quot;a.username&quot;, &quot;''&quot;);
+
+debug(&quot;Empty username should be empty&quot;);
+a.href = &quot;http://@example.com/&quot;;
+shouldBe(&quot;a.username&quot;, &quot;''&quot;);
+
+debug(&quot;Regular username retrieval&quot;);
+a.href = &quot;http://joebob1@example.com/&quot;;
+shouldBe(&quot;a.username&quot;, &quot;'joebob1'&quot;);
+
+debug(&quot;Username with empty password&quot;);
+a.href = &quot;http://joebob2:@example.com/&quot;;
+shouldBe(&quot;a.username&quot;, &quot;'joebob2'&quot;);
+
+debug(&quot;Username with non-empty password&quot;);
+a.href = &quot;http://joebob3:abc123@example.com/&quot;;
+shouldBe(&quot;a.username&quot;, &quot;'joebob3'&quot;);
+
+debug(&quot;Setting username&quot;);
+a.href = &quot;http://example.com/&quot;;
+a.username = &quot;joebob4&quot;;
+shouldBe(&quot;a.href&quot;, &quot;'http://joebob4@example.com/'&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastdomconstructedobjectsprototypesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/fast/dom/constructed-objects-prototypes-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -13,8 +13,8 @@
</span><span class="cx"> PASS (new inner.OverflowEvent()).constructor.isInner is true
</span><span class="cx"> PASS (new inner.ProgressEvent()).isInner is true
</span><span class="cx"> PASS (new inner.ProgressEvent()).constructor.isInner is true
</span><del>-PASS (new inner.URL()).isInner is true
-PASS (new inner.URL()).constructor.isInner is true
</del><ins>+PASS (new inner.URL('about:blank')).isInner is true
+PASS (new inner.URL('about:blank')).constructor.isInner is true
</ins><span class="cx"> PASS (new inner.XMLHttpRequest()).isInner is true
</span><span class="cx"> PASS (new inner.XMLHttpRequest()).constructor.isInner is true
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomscripttestsconstructedobjectsprototypesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/script-tests/constructed-objects-prototypes.js (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/script-tests/constructed-objects-prototypes.js        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/fast/dom/script-tests/constructed-objects-prototypes.js        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -11,6 +11,7 @@
</span><span class="cx"> var constructorNames = [&quot;Image&quot;, &quot;MediaController&quot;, &quot;Option&quot;, &quot;OverflowEvent&quot;, &quot;ProgressEvent&quot;, &quot;URL&quot;, &quot;XMLHttpRequest&quot;];
</span><span class="cx"> 
</span><span class="cx"> var argumentsForConstructor = {
</span><ins>+    'URL' : &quot;'about:blank'&quot;,
</ins><span class="cx">     'Worker' : &quot;'foo'&quot;,
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsjsdomconstructorlengthhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/dom/constructor-length.html (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/constructor-length.html        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/js/dom/constructor-length.html        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> shouldBe('WebKitTransitionEvent.length', '1');
</span><span class="cx"> shouldBe('WebSocket.length', '1');
</span><span class="cx"> shouldBe('Worker.length', '1');
</span><del>-shouldBe('URL.length', '0');
</del><ins>+shouldBe('URL.length', '1');
</ins><span class="cx"> shouldBe('XMLHttpRequest.length', '0');
</span><span class="cx"> shouldBe('XMLSerializer.length', '0');
</span><span class="cx"> shouldBe('XPathEvaluator.length', '0');
</span></span></pre></div>
<a id="trunkLayoutTestsplatformefljsdomconstructorlengthexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/efl/js/dom/constructor-length-expected.txt (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/efl/js/dom/constructor-length-expected.txt        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/platform/efl/js/dom/constructor-length-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> PASS WebKitTransitionEvent.length is 1
</span><span class="cx"> PASS WebSocket.length is 1
</span><span class="cx"> PASS Worker.length is 1
</span><del>-PASS URL.length is 0
</del><ins>+PASS URL.length is 1
</ins><span class="cx"> PASS XMLHttpRequest.length is 0
</span><span class="cx"> PASS XMLSerializer.length is 0
</span><span class="cx"> PASS XPathEvaluator.length is 0
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkjsdomconstructorlengthexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk/js/dom/constructor-length-expected.txt (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk/js/dom/constructor-length-expected.txt        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/platform/gtk/js/dom/constructor-length-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> PASS WebKitTransitionEvent.length is 1
</span><span class="cx"> PASS WebSocket.length is 1
</span><span class="cx"> PASS Worker.length is 1
</span><del>-PASS URL.length is 0
</del><ins>+PASS URL.length is 1
</ins><span class="cx"> PASS XMLHttpRequest.length is 0
</span><span class="cx"> PASS XMLSerializer.length is 0
</span><span class="cx"> PASS XPathEvaluator.length is 0
</span></span></pre></div>
<a id="trunkLayoutTestsplatformgtkwk2jsdomconstructorlengthexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/gtk-wk2/js/dom/constructor-length-expected.txt (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/gtk-wk2/js/dom/constructor-length-expected.txt        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/platform/gtk-wk2/js/dom/constructor-length-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> PASS WebKitTransitionEvent.length is 1
</span><span class="cx"> PASS WebSocket.length is 1
</span><span class="cx"> PASS Worker.length is 1
</span><del>-PASS URL.length is 0
</del><ins>+PASS URL.length is 1
</ins><span class="cx"> PASS XMLHttpRequest.length is 0
</span><span class="cx"> PASS XMLSerializer.length is 0
</span><span class="cx"> PASS XPathEvaluator.length is 0
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacjsdomconstructorlengthexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/js/dom/constructor-length-expected.txt (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/js/dom/constructor-length-expected.txt        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/LayoutTests/platform/mac/js/dom/constructor-length-expected.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> PASS WebKitTransitionEvent.length is 1
</span><span class="cx"> PASS WebSocket.length is 1
</span><span class="cx"> PASS Worker.length is 1
</span><del>-PASS URL.length is 0
</del><ins>+PASS URL.length is 1
</ins><span class="cx"> PASS XMLHttpRequest.length is 0
</span><span class="cx"> PASS XMLSerializer.length is 0
</span><span class="cx"> PASS XPathEvaluator.length is 0
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -492,6 +492,7 @@
</span><span class="cx">     html/RadioNodeList.idl
</span><span class="cx">     html/TextMetrics.idl
</span><span class="cx">     html/TimeRanges.idl
</span><ins>+    html/URLUtils.idl
</ins><span class="cx">     html/ValidityState.idl
</span><span class="cx">     html/VoidCallback.idl
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/Source/WebCore/ChangeLog        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -1,3 +1,59 @@
</span><ins>+2014-01-30  Maciej Stachowiak  &lt;mjs@apple.com&gt;
+
+        Implement (most of) URL API
+        https://bugs.webkit.org/show_bug.cgi?id=127795
+
+        Reviewed by Alexey Proskuryakov.
+
+        Tests: fast/dom/DOMURL/get-href-attribute-port.html
+               fast/dom/DOMURL/invalid-url-getters.html
+               fast/dom/DOMURL/set-href-attribute-hash.html
+               fast/dom/DOMURL/set-href-attribute-host.html
+               fast/dom/DOMURL/set-href-attribute-hostname.html
+               fast/dom/DOMURL/set-href-attribute-pathname.html
+               fast/dom/DOMURL/set-href-attribute-port.html
+               fast/dom/DOMURL/set-href-attribute-protocol.html
+               fast/dom/DOMURL/set-href-attribute-search.html
+               fast/dom/DOMURL/set-href-attribute-whitespace.html
+               fast/dom/DOMURL/url-constructor.html
+               fast/dom/DOMURL/url-origin.html
+               fast/dom/DOMURL/url-password.html
+               fast/dom/DOMURL/url-username.html
+
+        * CMakeLists.txt: Update for new IDL file.
+        * DerivedSources.make: ditto
+        * GNUmakefile.list.am: ditto
+        * html/DOMURL.cpp: Implement URL() constructor and instance methods; cribbed from
+        HTMLAnchorElement mostly
+        (WebCore::DOMURL::DOMURL):
+        (WebCore::DOMURL::href):
+        (WebCore::DOMURL::setHref):
+        (WebCore::DOMURL::toString):
+        (WebCore::DOMURL::origin):
+        (WebCore::DOMURL::protocol):
+        (WebCore::DOMURL::setProtocol):
+        (WebCore::DOMURL::username):
+        (WebCore::DOMURL::setUsername):
+        (WebCore::DOMURL::password):
+        (WebCore::DOMURL::setPassword):
+        (WebCore::DOMURL::host):
+        (WebCore::parsePortFromStringPosition):
+        (WebCore::DOMURL::setHost):
+        (WebCore::DOMURL::hostname):
+        (WebCore::DOMURL::setHostname):
+        (WebCore::DOMURL::port):
+        (WebCore::DOMURL::setPort):
+        (WebCore::DOMURL::pathname):
+        (WebCore::DOMURL::setPathname):
+        (WebCore::DOMURL::search):
+        (WebCore::DOMURL::setSearch):
+        (WebCore::DOMURL::hash):
+        (WebCore::DOMURL::setHash):
+        * html/DOMURL.h:
+        (WebCore::DOMURL::create):
+        * html/DOMURL.idl: Update for new methods.
+        * html/URLUtils.idl: Added. New IDL file that contains most of the interface.
+
</ins><span class="cx"> 2014-01-31  Bem Jones-Bey  &lt;bjonesbe@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Create clipping path from &lt;box&gt; value
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/Source/WebCore/DerivedSources.make        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -404,6 +404,7 @@
</span><span class="cx">     $(WebCore)/html/RadioNodeList.idl \
</span><span class="cx">     $(WebCore)/html/TextMetrics.idl \
</span><span class="cx">     $(WebCore)/html/TimeRanges.idl \
</span><ins>+    $(WebCore)/html/URLUtils.idl \
</ins><span class="cx">     $(WebCore)/html/ValidityState.idl \
</span><span class="cx">     $(WebCore)/html/VoidCallback.idl \
</span><span class="cx">     $(WebCore)/html/canvas/ANGLEInstancedArrays.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreGNUmakefilelistam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/GNUmakefile.list.am (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/GNUmakefile.list.am        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/Source/WebCore/GNUmakefile.list.am        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -1498,6 +1498,7 @@
</span><span class="cx">         $(WebCore)/html/RadioNodeList.idl \
</span><span class="cx">         $(WebCore)/html/TextMetrics.idl \
</span><span class="cx">         $(WebCore)/html/TimeRanges.idl \
</span><ins>+        $(WebCore)/html/URLUtils.idl \
</ins><span class="cx">         $(WebCore)/html/ValidityState.idl \
</span><span class="cx">         $(WebCore)/html/VoidCallback.idl \
</span><span class="cx">         $(WebCore)/html/canvas/ANGLEInstancedArrays.idl \
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMURLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMURL.cpp (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMURL.cpp        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/Source/WebCore/html/DOMURL.cpp        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -1,35 +1,34 @@
</span><span class="cx"> /*
</span><ins>+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Simon Hausmann &lt;hausmann@kde.org&gt;
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2014 Apple Inc. All rights reserved.
+ *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
</ins><span class="cx">  * Copyright (C) 2011 Google Inc. All rights reserved.
</span><span class="cx">  * Copyright (C) 2012 Motorola Mobility Inc.
</span><span class="cx">  *
</span><del>- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
</del><ins>+ * 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.
</ins><span class="cx">  *
</span><del>- * 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.
</del><ins>+ * 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.
</ins><span class="cx">  *
</span><del>- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 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.
</del><ins>+ * 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.
</ins><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><ins>+#include &quot;DOMURL.h&quot;
</ins><span class="cx"> 
</span><ins>+#include &quot;SecurityOrigin.h&quot;
+
</ins><span class="cx"> #if ENABLE(BLOB)
</span><del>-
-#include &quot;DOMURL.h&quot;
-
</del><span class="cx"> #include &quot;ActiveDOMObject.h&quot;
</span><span class="cx"> #include &quot;Blob.h&quot;
</span><span class="cx"> #include &quot;BlobURL.h&quot;
</span><span class="lines">@@ -37,11 +36,273 @@
</span><span class="cx"> #include &quot;PublicURLManager.h&quot;
</span><span class="cx"> #include &quot;ResourceRequest.h&quot;
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><del>-#include &quot;SecurityOrigin.h&quot;
</del><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><ins>+#endif // ENABLE(BLOB)
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+PassRefPtr&lt;DOMURL&gt; DOMURL::create(const String&amp; url, const String&amp; base, ExceptionCode&amp; ec) 
+{
+    return adoptRef(new DOMURL(url, base, ec)); 
+}
+
+PassRefPtr&lt;DOMURL&gt; DOMURL::create(const String&amp; url, const DOMURL* base, ExceptionCode&amp; ec) 
+{
+    ASSERT(base);
+    return adoptRef(new DOMURL(url, *base, ec)); 
+}
+
+PassRefPtr&lt;DOMURL&gt; DOMURL::create(const String&amp; url, ExceptionCode&amp; ec) 
+{
+    return adoptRef(new DOMURL(url, ec)); 
+}
+
+inline DOMURL::DOMURL(const String&amp; url, const String&amp; base, ExceptionCode&amp; ec)
+    : m_baseURL(URL(), base)
+    , m_url(m_baseURL, url)
+{
+    if (!m_baseURL.isValid() || !m_url.isValid())
+        ec = TypeError;
+}
+
+inline DOMURL::DOMURL(const String&amp; url, const DOMURL&amp; base, ExceptionCode&amp; ec)
+    : m_baseURL(base.href())
+    , m_url(m_baseURL, url)
+{
+    if (!m_baseURL.isValid() || !m_url.isValid())
+        ec = TypeError;
+}
+
+inline DOMURL::DOMURL(const String&amp; url, ExceptionCode&amp; ec)
+    : m_baseURL(blankURL())
+    , m_url(m_baseURL, url)
+{
+    if (!m_url.isValid())
+        ec = TypeError;
+}
+
+const URL&amp; DOMURL::href() const
+{
+    return m_url;
+}
+
+void DOMURL::setHref(const String&amp; url)
+{
+    m_url = URL(m_baseURL, url);
+}
+
+void DOMURL::setHref(const String&amp; url, ExceptionCode&amp; ec)
+{
+    setHref(url);
+    if (!m_url.isValid())
+        ec = TypeError;
+}
+
+const String&amp; DOMURL::toString() const
+{
+    return href().string();
+}
+
+String DOMURL::origin() const
+{
+    RefPtr&lt;SecurityOrigin&gt; origin = SecurityOrigin::create(href());
+    return origin-&gt;toString();
+}
+
+String DOMURL::protocol() const
+{
+    return href().protocol() + ':';
+}
+
+void DOMURL::setProtocol(const String&amp; value)
+{
+    URL url = href();
+    url.setProtocol(value);
+    setHref(url.string());
+}
+
+String DOMURL::username() const
+{
+    return href().user();
+}
+
+void DOMURL::setUsername(const String&amp; user)
+{
+    URL url = href();
+    url.setUser(user);
+    setHref(url);
+}
+
+String DOMURL::password() const
+{
+    return href().pass();
+}
+
+void DOMURL::setPassword(const String&amp; pass)
+{
+    URL url = href();
+    url.setPass(pass);
+    setHref(url);
+}
+
+String DOMURL::host() const
+{
+    const URL&amp; url = href();
+    if (url.hostEnd() == url.pathStart())
+        return url.host();
+    if (isDefaultPortForProtocol(url.port(), url.protocol()))
+        return url.host();
+    return url.host() + ':' + String::number(url.port());
+}
+
+// This function does not allow leading spaces before the port number.
+static unsigned parsePortFromStringPosition(const String&amp; value, unsigned portStart, unsigned&amp; portEnd)
+{
+    portEnd = portStart;
+    while (isASCIIDigit(value[portEnd]))
+        ++portEnd;
+    return value.substring(portStart, portEnd - portStart).toUInt();
+}
+
+void DOMURL::setHost(const String&amp; value)
+{
+    if (value.isEmpty())
+        return;
+    URL url = href();
+    if (!url.canSetHostOrPort())
+        return;
+
+    size_t separator = value.find(':');
+    if (!separator)
+        return;
+
+    if (separator == notFound)
+        url.setHostAndPort(value);
+    else {
+        unsigned portEnd;
+        unsigned port = parsePortFromStringPosition(value, separator + 1, portEnd);
+        if (!port) {
+            // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes
+            // specifically goes against RFC 3986 (p3.2) and
+            // requires setting the port to &quot;0&quot; if it is set to empty string.
+            url.setHostAndPort(value.substring(0, separator + 1) + '0');
+        } else {
+            if (isDefaultPortForProtocol(port, url.protocol()))
+                url.setHostAndPort(value.substring(0, separator));
+            else
+                url.setHostAndPort(value.substring(0, portEnd));
+        }
+    }
+    setHref(url.string());
+}
+
+String DOMURL::hostname() const
+{
+    return href().host();
+}
+
+void DOMURL::setHostname(const String&amp; value)
+{
+    // Before setting new value:
+    // Remove all leading U+002F SOLIDUS (&quot;/&quot;) characters.
+    unsigned i = 0;
+    unsigned hostLength = value.length();
+    while (value[i] == '/')
+        i++;
+
+    if (i == hostLength)
+        return;
+
+    URL url = href();
+    if (!url.canSetHostOrPort())
+        return;
+
+    url.setHost(value.substring(i));
+    setHref(url.string());
+}
+
+String DOMURL::port() const
+{
+    if (href().hasPort())
+        return String::number(href().port());
+
+    return emptyString();
+}
+
+void DOMURL::setPort(const String&amp; value)
+{
+    URL url = href();
+    if (!url.canSetHostOrPort())
+        return;
+
+    // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes
+    // specifically goes against RFC 3986 (p3.2) and
+    // requires setting the port to &quot;0&quot; if it is set to empty string.
+    // FIXME: http://url.spec.whatwg.org/ doesn't appear to require this; test what browsers do
+    unsigned port = value.toUInt();
+    if (isDefaultPortForProtocol(port, url.protocol()))
+        url.removePort();
+    else
+        url.setPort(port);
+
+    setHref(url.string());
+}
+
+String DOMURL::pathname() const
+{
+    return href().path();
+}
+
+void DOMURL::setPathname(const String&amp; value)
+{
+    URL url = href();
+    if (!url.canSetPathname())
+        return;
+
+    if (value[0] == '/')
+        url.setPath(value);
+    else
+        url.setPath(&quot;/&quot; + value);
+
+    setHref(url.string());
+}
+
+String DOMURL::search() const
+{
+    String query = href().query();
+    return query.isEmpty() ? emptyString() : &quot;?&quot; + query;
+}
+
+void DOMURL::setSearch(const String&amp; value)
+{
+    URL url = href();
+    String newSearch = (value[0] == '?') ? value.substring(1) : value;
+    // Make sure that '#' in the query does not leak to the hash.
+    url.setQuery(newSearch.replaceWithLiteral('#', &quot;%23&quot;));
+
+    setHref(url.string());
+}
+
+String DOMURL::hash() const
+{
+    String fragmentIdentifier = href().fragmentIdentifier();
+    if (fragmentIdentifier.isEmpty())
+        return emptyString();
+    return AtomicString(String(&quot;#&quot; + fragmentIdentifier));
+}
+
+void DOMURL::setHash(const String&amp; value)
+{
+    URL url = href();
+    if (value[0] == '#')
+        url.setFragmentIdentifier(value.substring(1));
+    else
+        url.setFragmentIdentifier(value);
+    setHref(url.string());
+}
+
+#if ENABLE(BLOB)
+
</ins><span class="cx"> String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob)
</span><span class="cx"> {
</span><span class="cx">     if (!scriptExecutionContext || !blob)
</span><span class="lines">@@ -75,6 +336,6 @@
</span><span class="cx">     scriptExecutionContext-&gt;publicURLManager().revoke(url);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#endif // ENABLE(BLOB)
+
</ins><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // ENABLE(BLOB)
</del></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMURLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMURL.h (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMURL.h        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/Source/WebCore/html/DOMURL.h        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #ifndef DOMURL_h
</span><span class="cx"> #define DOMURL_h
</span><span class="cx"> 
</span><ins>+#include &quot;ExceptionCode.h&quot;
</ins><span class="cx"> #include &quot;URL.h&quot;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="lines">@@ -42,8 +43,45 @@
</span><span class="cx"> class DOMURL : public RefCounted&lt;DOMURL&gt; {
</span><span class="cx"> 
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;DOMURL&gt; create() { return adoptRef(new DOMURL); }
</del><ins>+    static PassRefPtr&lt;DOMURL&gt; create(const String&amp; url, const String&amp; base, ExceptionCode&amp;);
+    static PassRefPtr&lt;DOMURL&gt; create(const String&amp; url, const DOMURL* base, ExceptionCode&amp;);
+    static PassRefPtr&lt;DOMURL&gt; create(const String&amp; url, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><ins>+    const URL&amp; href() const;
+    void setHref(const String&amp; url);
+    void setHref(const String&amp;, ExceptionCode&amp;);
+    const String&amp; toString() const;
+
+    String origin() const;
+
+    String protocol() const;
+    void setProtocol(const String&amp;);
+
+    String username() const;
+    void setUsername(const String&amp;);
+
+    String password() const;
+    void setPassword(const String&amp;);
+
+    String host() const;
+    void setHost(const String&amp;);
+
+    String hostname() const;
+    void setHostname(const String&amp;);
+
+    String port() const;
+    void setPort(const String&amp;);
+
+    String pathname() const;
+    void setPathname(const String&amp;);
+
+    String search() const;
+    void setSearch(const String&amp;);
+
+    String hash() const;
+    void setHash(const String&amp;);
+
+
</ins><span class="cx"> #if ENABLE(BLOB)
</span><span class="cx">     static void contextDestroyed(ScriptExecutionContext*);
</span><span class="cx"> 
</span><span class="lines">@@ -52,6 +90,13 @@
</span><span class="cx"> 
</span><span class="cx">     static String createPublicURL(ScriptExecutionContext*, URLRegistrable*);
</span><span class="cx"> #endif
</span><ins>+private:
+    DOMURL(const String&amp; url, const String&amp; base, ExceptionCode&amp;);
+    DOMURL(const String&amp; url, const DOMURL&amp; base, ExceptionCode&amp;);
+    DOMURL(const String&amp; url, ExceptionCode&amp;);
+
+    URL m_baseURL;
+    URL m_url;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMURLidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMURL.idl (163207 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMURL.idl        2014-01-31 22:59:49 UTC (rev 163207)
+++ trunk/Source/WebCore/html/DOMURL.idl        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -26,7 +26,10 @@
</span><span class="cx"> 
</span><span class="cx"> [
</span><span class="cx">     GlobalContext=DOMWindow&amp;WorkerGlobalScope,
</span><del>-    Constructor,
</del><ins>+    Constructor(DOMString url),
+    Constructor(DOMString url, DOMString base),
+    Constructor(DOMString url, DOMURL base),
+    ConstructorRaisesException,
</ins><span class="cx">     JSGenerateToNativeObject,
</span><span class="cx">     JSGenerateToJSObject,
</span><span class="cx">     JSNoStaticTables,
</span><span class="lines">@@ -36,3 +39,5 @@
</span><span class="cx">     [CallWith=ScriptExecutionContext,TreatReturnedNullStringAs=Null,Conditional=BLOB] static DOMString createObjectURL(Blob? blob);
</span><span class="cx">     [CallWith=ScriptExecutionContext,Conditional=BLOB] static void revokeObjectURL(DOMString url);
</span><span class="cx"> };
</span><ins>+
+DOMURL implements URLUtils;
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlURLUtilsidl"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/URLUtils.idl (0 => 163208)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/URLUtils.idl                                (rev 0)
+++ trunk/Source/WebCore/html/URLUtils.idl        2014-01-31 23:06:25 UTC (rev 163208)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * 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 AND ITS CONTRIBUTORS &quot;AS IS&quot; 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 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.
+ */
+
+[NoInterfaceObject]
+interface URLUtils {
+    [SetterRaisesException, URL] attribute DOMString href;
+#if defined(LANGUAGE_JAVASCRIPT) &amp;&amp; LANGUAGE_JAVASCRIPT
+    [NotEnumerable] DOMString toString();
+#endif
+
+    readonly attribute DOMString origin;
+
+    [TreatNullAs=NullString] attribute DOMString protocol;
+    [TreatNullAs=NullString] attribute DOMString username;
+    [TreatNullAs=NullString] attribute DOMString password;
+    [TreatNullAs=NullString] attribute DOMString host;
+    [TreatNullAs=NullString] attribute DOMString hostname;
+    [TreatNullAs=NullString] attribute DOMString port;
+    [TreatNullAs=NullString] attribute DOMString pathname;
+    [TreatNullAs=NullString] attribute DOMString search;
+    //    attribute URLSearchParams? searchParams;
+    [TreatNullAs=NullString] attribute DOMString hash;
+};
</ins></span></pre>
</div>
</div>

</body>
</html>