<!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 <mjs@apple.com>
+
+ 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 <bjonesbe@adobe.com>
</span><span class="cx">
</span><span class="cx"> Create clipping path from <box> 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"> <script>
</span><span class="cx"> description("Test instanceof functions and properties of URL and webkitURL.");
</span><span class="cx">
</span><del>-var url = new URL;
</del><ins>+var url = new URL("about:blank");
</ins><span class="cx">
</span><span class="cx"> shouldBeTrue("'createObjectURL' in URL");
</span><span class="cx"> shouldBeTrue("'revokeObjectURL' in URL");
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test getting the port attribute of the URL in a URL object.');
+
+var a = new URL("about:blank");
+
+debug("Default port is empty");
+shouldBe("a.port", "''");
+
+debug("Unspecified port should return empty string");
+a.href = "http://example.com/";
+shouldBe("a.port", "''");
+
+debug("Empty port should be empty");
+a.href = "http://example.com:/";
+shouldBe("a.port", "''");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description("Test what getters return on an invalid URL");
+
+var invalidURL = new URL("http://u:p@www.example.com:22/bar?x#y")
+invalidURL.username = "@@";
+
+shouldBe("invalidURL.toString()", "'http://@@:p@www.example.com:22/bar?x#y'");
+shouldBe("invalidURL.origin", "''");
+shouldBe("invalidURL.username", "''");
+shouldBe("invalidURL.password", "''");
+shouldBe("invalidURL.host", "''");
+shouldBe("invalidURL.hostname", "''");
+shouldBe("invalidURL.port", "''");
+shouldBe("invalidURL.pathname", "''");
+shouldBe("invalidURL.search", "''");
+shouldBe("invalidURL.hash", "''");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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 = "https://www.my\"d(){}|~om?ain#com/path/testurl.html#middle" threw exception TypeError: Type error.
+PASS a.href is 'https://www.my\"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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test setting the hash attribute of the URL in a URL object.');
+
+var a = new URL("about:blank");
+
+debug("Hash value does not start with '#'");
+a.href = "https://www.mydomain.com:8080/path/testurl.html#middle";
+a.hash = "hash-value";
+shouldBe("a.href", "'https://www.mydomain.com:8080/path/testurl.html#hash-value'");
+
+debug("Hash value starts with '#'");
+a.href = "file:///path/testurl.html#middle";
+a.hash = "#hash_value";
+shouldBe("a.href", "'file:///path/testurl.html#hash_value'");
+
+debug("'?' in hash value");
+a.href = "http://www.mydomain.com/path/testurl.html#middle";
+a.hash = "#hash?value";
+shouldBe("a.href", "'http://www.mydomain.com/path/testurl.html#hash?value'");
+
+// The expected behavior should change when character table is updated.
+// IE8 and Firefox3.5.2 don't consider these characters as illegal.
+debug("'#' in hash value, and illegal characters in hostname");
+// with the URL API, assigning an invalid href throws
+shouldThrow('a.href = "https://www.my\\"d(){}|~om?ain#com/path/testurl.html#middle"');
+a.hash = "#hash#value";
+shouldBe("a.href", "'https://www.my\\\"d(){}|~om?ain#com/path/testurl.html#middle'");
+
+// IE8 converts null to "null", 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("Set hash to null");
+a.href = "https://www.mydomain.com/path/testurl.html#middle";
+a.hash = null;
+shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html#'");
+
+// 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("Set hash to empty string");
+a.href = "https://www.mydomain.com/path/testurl.html#middle";
+a.hash = "";
+shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html#'");
+
+// Firefox 3.5.2 does not allow setting hash to mailto: scheme, and it should.
+debug("Add hash to mailto: protocol");
+a.href = "mailto:e-mail_address@goes_here";
+a.hash = "hash-value";
+shouldBe("a.href", "'mailto:e-mail_address@goes_here#hash-value'");
+
+// IE8 does not percent-encode spaces in the hash component, but it does that
+// in the path component.
+debug("Add hash to file: protocol");
+a.href = "file:///some path";
+a.hash = "hash value";
+shouldBe("a.href", "'file:///some%20path#hash value'");
+
+debug("Set hash to '#'");
+a.href = "http://mydomain.com#middle";
+a.hash = "#";
+shouldBe("a.href", "'http://mydomain.com/#'");
+
+// Firefox 3.5.2 does not allow setting hash to foo: scheme, and it should.
+debug("Add hash to non-standard protocol");
+try {
+a.href = "foo:bar";
+a.hash = "#hash";
+shouldBe("a.href", "'foo:bar#hash'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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 = "https:/\rww.my@domain.com:8080/path/" 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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test setting the host attribute of the URL in a URL object.');
+
+var a = new URL("about:blank");
+
+debug("Basic test");
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = "www.otherdomain.com:0";
+shouldBe("a.href", "'https://www.otherdomain.com:0/path/'");
+
+// IE8 throws "The URL is invalid" exception.
+debug("Set host with '?' in it");
+try {
+a.href = "https://www.mydomain.com:8080/path/?key=value";
+a.host = "www.other?domain.com:8080";
+shouldBe("a.href", "'https://www.other/?domain.com:8080/path/?key=value'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+debug("Set default port for another protocol");
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = "www.otherdomain.com:80";
+shouldBe("a.href", "'https://www.otherdomain.com:80/path/'");
+
+debug("Set default port");
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = "www.otherdomain.com:443";
+shouldBe("a.href", "'https://www.otherdomain.com/path/'");
+
+// Firefox 3.5.2 rejects a port that contains non-digits.
+debug("Set host with letters in port number");
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = "www.otherdomain.com:44a5";
+shouldBe("a.href", "'https://www.otherdomain.com:44/path/'");
+
+// Firefox 3.5.2 ignores the leading space in the port, but errs on reparsing the port.
+debug("Leading space in port number");
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = "www.otherdomain.com: 443";
+shouldBe("a.href", "'https://www.otherdomain.com:0/path/'");
+
+// Firefox 3.5.2 removed the port, clearly against the spec .
+debug("Colon without port number");
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = "www.otherdomain.com:";
+shouldBe("a.href", "'https://www.otherdomain.com:0/path/'");
+
+// IE8 converts null to "null", 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("Set host to null");
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = null;
+shouldBe("a.href", "'https://www.mydomain.com:8080/path/'");
+
+// 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("Set host to empty string");
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = "";
+shouldBe("a.href", "'https://www.mydomain.com:8080/path/'");
+
+// Firefox 3.5.2 does not `set the host for file: .
+debug("Set host to URL with file: protocol");
+a.href = "file:///path/";
+a.host = "mydomain.com";
+shouldBe("a.href", "'file://mydomain.com/path/'");
+
+// IE8 throws if the host contains '/'
+debug("Set host containing slashes in it");
+try {
+a.href = "https://www.mydomain.com:8080/path/";
+a.host = "www.other\dom/ain.com";
+shouldBe("a.href", "'https://www.otherdom/ain.com/path/'");
+} catch(e) {
+debug("Exception: " + 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("Set host to a malformed URL");
+shouldThrow('a.href = "https:/\\rww.my@domain.com:8080/path/"');
+a.host = "www.other!domain.com:15";
+shouldBe("a.href", "'https:/\\rww.my@domain.com:8080/path/'");
+
+// IE8 throws an "Object Error" exception.
+// Firefox 3.5.2 accepts this but throws an exception later
+// WebKit should just reject
+debug("Set host that starts with ':'");
+try {
+a.href = "https://domain.com:8080/path/";
+a.host = ":www.otherdomain.com:15";
+shouldBe("a.href", "'https://domain.com:8080/path/'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// IE8 throws a security exception if the host contains '@'
+debug("Set host to URL containing username and ..");
+try {
+a.href = "https://rwwmy@domain.com:8080/pa..th/";
+a.host = "www.other!domain.com:25";
+shouldBe("a.href", "'https://rwwmy@www.other!domain.com:25/pa..th/'");
+} catch(e) {
+debug("Exception: " + 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("Set host to a URL with tel: protocol");
+a.href = "tel:+1-816-555-1212";
+a.host = "+1-800-555-1212";
+shouldBe("a.href", "'tel:+1-816-555-1212'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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 = "http://www.my domain.com/path/" 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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test setting the hostname attribute of the URL in a URL object.');
+
+var a = new URL("about:blank");
+
+debug("Basic test");
+a.href = "https://www.mydomain.com:8080/path/";
+a.hostname = "www.otherdomain.com";
+shouldBe("a.href", "'https://www.otherdomain.com:8080/path/'");
+
+// IE8 throws an exception "The URL is invalid".
+try {
+debug("Extra slashes before hostname");
+a.href = "https://www.mydomain.com:8080/path/";
+a.hostname = "//www.otherdomain.com";
+shouldBe("a.href", "'https://www.otherdomain.com:8080/path/'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// Firefox 3.5.2 does not allow setting the host to foo: protocol
+debug("Set hostname to URL with foo: protocol");
+a.href = "foo://www.mydomain.com/path/";
+a.hostname = "www.otherdomain.com";
+shouldBe("a.href", "'foo://www.otherdomain.com/path/'");
+
+// IE8 converts null to "null", 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("Set hostname to null");
+a.href = "https://www.mydomain.com:8080/path/";
+a.hostname = null;
+shouldBe("a.href", "'https://www.mydomain.com:8080/path/'");
+
+// 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("Set hostname to empty string");
+a.href = "https://www.mydomain.com:8080/path/";
+a.hostname = "";
+shouldBe("a.href", "'https://www.mydomain.com:8080/path/'");
+
+// IE8 fails to process really: protocol.
+debug("Set hostname to URL with 2 colons");
+a.href = "really:bad:url";
+a.hostname = "mydomain.com";
+shouldBe("a.href", "'really:bad:url'");
+
+// 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("Set a hostname that contains space in it");
+shouldThrow('a.href = "http://www.my domain.com/path/"');
+a.hostname = "www.other domain.com";
+shouldBe("a.href", "'http://www.my domain.com/path/'");
+
+// IE8 throws an exception "The URL is invalid".
+try {
+debug("Set hostname on a local file");
+a.href = "c:/path/testurl.html";
+a.hostname= "a";
+shouldBe("a.href", "'c:/path/testurl.html'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+debug("Set hostname to undefined");
+a.href = "https://www.mydomain.com:8080/path/";
+a.hostname = undefined;
+shouldBe("a.href", "'https://undefined:8080/path/'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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 = "https://www.my|d[]()omain.com/path/testurl.html?key=value" 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 = "http://w@#ww" 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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test setting the pathname attribute of the URL in a URL object.');
+
+var a = new URL("about:blank");
+
+debug("Set pathname that starts with slash");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value";
+a.pathname = "/path name";
+shouldBe("a.href", "'https://www.mydomain.com/path%20name?key=value'");
+
+// IE8 throws an "Invalid URL" exception.
+try {
+debug("Set pathname that does not start with slash and contains '?'");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value";
+a.pathname = "pa?th";
+shouldBe("a.href", "'https://www.mydomain.com/pa%3Fth?key=value'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// IE8 throws an "Invalid URL" exception.
+try {
+debug("Set pathname that starts with double slash and contains '#'");
+a.href = "https://www.mydomain.com/path?key=value";
+a.pathname = "//path#name";
+shouldBe("a.href", "'https://www.mydomain.com//path%23name?key=value'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+debug("Set a pathname containing .. in it");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value";
+a.pathname = "/it/../path";
+shouldBe("a.href", "'https://www.mydomain.com/path?key=value'");
+
+// IE8 converts null to "null", which is not the right thing to do.
+debug("Set pathname to null");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value";
+a.pathname = null;
+shouldBe("a.href", "'https://www.mydomain.com/?key=value'");
+
+debug("Set pathname to empty string");
+a.href = "https://www.mydomain.com/?key=value";
+a.pathname = "";
+shouldBe("a.href", "'https://www.mydomain.com/?key=value'");
+
+// The expected behavior should change when the character table is updated.
+// IE8 considers this URL as valid.
+debug("Set pathname that includes illegal characters to URL that contains illegal characters.");
+shouldThrow('a.href = "https://www.my|d[]()omain.com/path/testurl.html?key=value"');
+a.pathname = "p$a|th";
+shouldBe("a.href", "'https://www.my|d[]()omain.com/path/testurl.html?key=value'");
+
+// IE8 throws a security exception. Gecko parses this as a URL with an empty hostname.
+try {
+debug("Set pathname to URL that contains '@' in host");
+shouldThrow('a.href = "http://w@#ww"');
+a.pathname = "path";
+shouldBe("a.href", "'http://w@#ww'");
+} catch(e) {
+debug("Exception: " + 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("Set pathname to a URL with non-hierarchical protocol");
+a.href = "tel:+1800-555-1212";
+a.pathname = "the-path";
+shouldBe("a.href", "'tel:+1800-555-1212'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test setting the port attribute of the URL in a URL object.');
+
+var a = new URL("about:blank");
+
+debug("Default port as number");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = 443;
+shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html?key=value'");
+
+debug("Default port as string");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = "443";
+shouldBe("a.href", "'https://www.mydomain.com/path/testurl.html?key=value'");
+
+debug("Set port to 0");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = "0";
+shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
+
+// Firefox 3.5.2 does not accept the port if any character is not a digit.
+debug("Set port to non-number");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = "4a";
+shouldBe("a.href", "'https://www.mydomain.com:4/path/testurl.html?key=value'");
+
+// Firefox 3.5.2 does not accept the port if it is null.
+debug("Set port to null");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = null;
+shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
+
+// Firefox 3.5.2 does not accept the port if it is null.
+debug("Set port to empty string");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = "";
+shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
+
+debug("Set port to undefined");
+a.href = "https://www.mydomain.com:8080/path/testurl.html?key=value";
+a.port = undefined;
+shouldBe("a.href", "'https://www.mydomain.com:0/path/testurl.html?key=value'");
+
+// Firefox 3.5.2 does not allow setting the port on a URL with protocol foo: .
+debug("Set port to URL with foo: protocol");
+a.href = "foo://bar/";
+a.port = 50;
+shouldBe("a.href", "'foo://bar:50/'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test setting the protocol attribute of the URL in a URL object .');
+
+var a = new URL("about:blank");
+
+debug("Basic test");
+a.href = "https://www.mydomain.com/path/";
+a.protocol = "http-foo";
+shouldBe("a.href", "'http-foo://www.mydomain.com/path/'");
+
+// IE8 throws "Invalid argument" exception.
+debug("Set a protocol that contains ':'");
+try {
+a.href = "https://www.mydomain.com/path/";
+a.protocol = "http:foo";
+shouldBe("a.href", "'http://www.mydomain.com/path/'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// IE8 throws "Invalid argument" exception.
+debug("Set a protocol that contains invalid characters");
+try {
+a.href = "https://www.mydomain.com/path/";
+a.protocol = "http^foo";
+shouldBe("a.href", "'https://www.mydomain.com/path/'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// The expected behavior should change when the character table is updated.
+// IE8 encodes '^' in the host.
+debug("Set a protocol to a URL with invalid host name");
+a.href = "h:^^";
+a.protocol = "foo";
+shouldBe("a.href", "'foo:^^'");
+
+// IE8 throws "Invalid argument" exception.
+try {
+debug("Set a protocol that starts with ':'");
+a.href = "https://www.mydomain.com/path/";
+a.protocol = ":http";
+shouldBe("a.href", "'https://www.mydomain.com/path/'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// IE8 converts null to "null", which is not the right thing to do.
+debug("Set protocol to null");
+a.href = "https://www.mydomain.com/path/";
+a.protocol = null;
+shouldBe("a.href", "'https://www.mydomain.com/path/'");
+
+// IE8 throws "Invalid argument" exception.
+try {
+debug("Set protocol to empty string");
+a.href = "https://www.mydomain.com/path/";
+a.protocol = "";
+shouldBe("a.href", "'https://www.mydomain.com/path/'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// Firefox 4 adds three slashes, unlike Safari and Chrome
+debug("Set protocol to http on malformed URL");
+a.href = "foo:??bar";
+a.protocol = "http";
+shouldBe("a.href", "'http:/??bar'");
+
+// IE8 keeps the protocol if it is 'c:'.
+debug("Set protocol to a URL which points to a local file");
+a.href = "c:\path";
+a.protocol = "f-oo";
+shouldBe("a.href", "'f-oo:path'");
+
+debug("Set protocol to undefined");
+a.href = "https://www.mydomain.com/path/";
+a.protocol = undefined;
+shouldBe("a.href", "'undefined://www.mydomain.com/path/'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test setting the search attribute of the URL in a URL object .');
+
+var a = new URL("about:blank");
+
+debug("Set search without '?'");
+a.href = "https://www.mydomain.com/path/?key=value";
+a.search = "value=key";
+shouldBe("a.href", "'https://www.mydomain.com/path/?value=key'");
+
+// IE8 does not encode spaces in search string
+debug("Set search that starts with '?' and contains spaces");
+a.href = "https://www.mydomain.com/path/?key=value";
+a.search = "?val ue= key?";
+shouldBe("a.href", "'https://www.mydomain.com/path/?val%20ue=%20key?'");
+
+debug("Set search to a malformed URL");
+a.href = "s:www.mydomain.com/path/";
+a.search = "%";
+shouldBe("a.href", "'s:www.mydomain.com/path/?%'");
+
+// IE8 throws "The URL is invalid" exception.
+debug("Set search containing '#'");
+try {
+a.href = "https://www.mydomain.com/path/?key=value#hash";
+a.search = "?value#key";
+shouldBe("a.href", "'https://www.mydomain.com/path/?value%23key#hash'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+debug("Set search to a malformed URL");
+a.href = "bad:/|/url";
+a.search = "?value=key";
+shouldBe("a.href", "'bad:/|/url?value=key'");
+
+// IE8 converts null to "null", which is not the right thing to do.
+debug("Set search to null");
+a.href = "https://www.mydomain.com/path/?key=value";
+a.search = null;
+shouldBe("a.href", "'https://www.mydomain.com/path/'");
+
+// Firefox 3.5.2 Removes the '?', and it shouldn't, per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug("Set search to empty string");
+a.href = "https://www.mydomain.com/path/?key=value";
+a.search = "";
+shouldBe("a.href", "'https://www.mydomain.com/path/?'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test setting the href attribute of a URL object to a URL with leading and trailing whitespace.');
+
+var a = new URL("about:blank");
+
+debug("Set href that starts with a space");
+a.href = " https://www.mydomain.com/path/testurl.html?key=value";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that starts with a newline");
+a.href = "\nhttps://www.mydomain.com/path/testurl.html?key=value";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that starts with a tab");
+a.href = "\thttps://www.mydomain.com/path/testurl.html?key=value";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that starts with a carriage return");
+a.href = "\rhttps://www.mydomain.com/path/testurl.html?key=value";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that starts with a combination of newlines, spaces and tabs");
+a.href = "\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that ends with a space");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value ";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that ends with a newline");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value\n";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that ends with a tab");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value\t";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that ends with a carriage return");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value\r";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that ends with a combination of newlines, spaces and tabs");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value\n \t\r \n";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+debug("Set href that starts and ends with a combination of newlines, spaces and tabs");
+a.href = "\n \t\r \nhttps://www.mydomain.com/path/testurl.html?key=value\n \t\r \n";
+shouldBe("a.hostname", "'www.mydomain.com'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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("%^$#") threw exception TypeError: Type error.
+One-parameter constructor - relative URL not valid against default base
+PASS url = new URL("foobar") 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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test getting the username attribute of a URL object.');
+
+debug("One-parameter constructor - valid URL");
+var url = new URL("http://user:pass@example.com/path?query#fragment")
+shouldBe("url.href", "'http://user:pass@example.com/path?query#fragment'");
+
+debug("One-parameter constructor - invalid URL should throw");
+shouldThrow('url = new URL("%^$#")');
+
+debug("One-parameter constructor - relative URL not valid against default base");
+shouldThrow('url = new URL("foobar")');
+
+debug("URL with string base");
+url = new URL("./nowhere?ok", "http://example.com/path/to/");
+shouldBe("url.href", "'http://example.com/path/to/nowhere?ok'");
+
+debug("URL with URL base");
+var base = new URL("http://example.com/path/to/");
+url = new URL("./nowhere?ok", base);
+shouldBe("url.href", "'http://example.com/path/to/nowhere?ok'");
+
+debug("URL with URL base that itself has a base");
+var metabase = new URL("http://example.org/");
+var base = new URL("http://example.com/are/we/", metabase);
+url = new URL("./nowhere?ok", base);
+shouldBe("url.href", "'http://example.com/are/we/nowhere?ok'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 => http://example.com
+http://example.com/foo/bar => http://example.com
+https://example.com/ttt?ggg => https://example.com
+ftp://example.com/ttt?ggg => ftp://example.com
+file:///home/abarth => file://
+data:text/html,<b>foo</b> => null
+http://@@@www.example.com/bar => 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>+<!DOCTYPE html>
+<html>
+<body>
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+var invalidURL = new URL("http://www.example.com/bar")
+invalidURL.username = "@@";
+
+var cases = [
+ new URL("http://example.com/foo/bar"),
+ new URL("HTTP://example.com/foo/bar"),
+ new URL("https://example.com/ttt?ggg"),
+ new URL("ftp://example.com/ttt?ggg"),
+ new URL("file:///home/abarth"),
+ new URL("data:text/html,<b>foo</b>"),
+ invalidURL
+];
+
+window.onload = function(e)
+{
+ var s = '';
+ for (var i = 0; i < cases.length; ++i)
+ s += cases[i].href + ' => ' + cases[i].origin + '\n';
+
+ var pre = document.createElement('pre');
+ pre.textContent = s;
+ document.body.appendChild(pre);
+};
+
+</script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test getting the password attribute of a URL object.');
+
+var a = new URL("about:blank");
+
+debug("Default password is empty");
+shouldBe("a.password", "''");
+
+debug("Unspecified password should return empty string");
+a.href = "http://example.com/";
+shouldBe("a.password", "''");
+
+debug("Empty password should be empty");
+a.href = "http://a:@example.com/";
+shouldBe("a.password", "''");
+
+debug("Regular passowrd retrieval");
+a.href = "http://joebob1:abc123@example.com/";
+shouldBe("a.password", "'abc123'");
+
+debug("Password with empty username");
+a.href = "http://:def456@example.com/";
+shouldBe("a.password", "'def456'");
+
+debug("Setting password");
+a.href = "http://@example.com/";
+a.password = "xyzzy";
+shouldBe("a.href", "'http://:xyzzy@example.com/'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 "PASS" messages, followed by "TEST COMPLETE".
+
+
+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>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<script>
+
+description('Test getting the username attribute of a URL object.');
+
+var a = new URL("about:blank");
+
+debug("Default username is empty");
+shouldBe("a.username", "''");
+
+debug("Unspecified username should return empty string");
+a.href = "http://example.com/";
+shouldBe("a.username", "''");
+
+debug("Empty username should be empty");
+a.href = "http://@example.com/";
+shouldBe("a.username", "''");
+
+debug("Regular username retrieval");
+a.href = "http://joebob1@example.com/";
+shouldBe("a.username", "'joebob1'");
+
+debug("Username with empty password");
+a.href = "http://joebob2:@example.com/";
+shouldBe("a.username", "'joebob2'");
+
+debug("Username with non-empty password");
+a.href = "http://joebob3:abc123@example.com/";
+shouldBe("a.username", "'joebob3'");
+
+debug("Setting username");
+a.href = "http://example.com/";
+a.username = "joebob4";
+shouldBe("a.href", "'http://joebob4@example.com/'");
+
+</script>
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</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 = ["Image", "MediaController", "Option", "OverflowEvent", "ProgressEvent", "URL", "XMLHttpRequest"];
</span><span class="cx">
</span><span class="cx"> var argumentsForConstructor = {
</span><ins>+ 'URL' : "'about:blank'",
</ins><span class="cx"> 'Worker' : "'foo'",
</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 <mjs@apple.com>
+
+ 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 <bjonesbe@adobe.com>
</span><span class="cx">
</span><span class="cx"> Create clipping path from <box> 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 <hausmann@kde.org>
+ * 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 "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE 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 "config.h"
</span><ins>+#include "DOMURL.h"
</ins><span class="cx">
</span><ins>+#include "SecurityOrigin.h"
+
</ins><span class="cx"> #if ENABLE(BLOB)
</span><del>-
-#include "DOMURL.h"
-
</del><span class="cx"> #include "ActiveDOMObject.h"
</span><span class="cx"> #include "Blob.h"
</span><span class="cx"> #include "BlobURL.h"
</span><span class="lines">@@ -37,11 +36,273 @@
</span><span class="cx"> #include "PublicURLManager.h"
</span><span class="cx"> #include "ResourceRequest.h"
</span><span class="cx"> #include "ScriptExecutionContext.h"
</span><del>-#include "SecurityOrigin.h"
</del><span class="cx"> #include <wtf/MainThread.h>
</span><ins>+#endif // ENABLE(BLOB)
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+PassRefPtr<DOMURL> DOMURL::create(const String& url, const String& base, ExceptionCode& ec)
+{
+ return adoptRef(new DOMURL(url, base, ec));
+}
+
+PassRefPtr<DOMURL> DOMURL::create(const String& url, const DOMURL* base, ExceptionCode& ec)
+{
+ ASSERT(base);
+ return adoptRef(new DOMURL(url, *base, ec));
+}
+
+PassRefPtr<DOMURL> DOMURL::create(const String& url, ExceptionCode& ec)
+{
+ return adoptRef(new DOMURL(url, ec));
+}
+
+inline DOMURL::DOMURL(const String& url, const String& base, ExceptionCode& ec)
+ : m_baseURL(URL(), base)
+ , m_url(m_baseURL, url)
+{
+ if (!m_baseURL.isValid() || !m_url.isValid())
+ ec = TypeError;
+}
+
+inline DOMURL::DOMURL(const String& url, const DOMURL& base, ExceptionCode& ec)
+ : m_baseURL(base.href())
+ , m_url(m_baseURL, url)
+{
+ if (!m_baseURL.isValid() || !m_url.isValid())
+ ec = TypeError;
+}
+
+inline DOMURL::DOMURL(const String& url, ExceptionCode& ec)
+ : m_baseURL(blankURL())
+ , m_url(m_baseURL, url)
+{
+ if (!m_url.isValid())
+ ec = TypeError;
+}
+
+const URL& DOMURL::href() const
+{
+ return m_url;
+}
+
+void DOMURL::setHref(const String& url)
+{
+ m_url = URL(m_baseURL, url);
+}
+
+void DOMURL::setHref(const String& url, ExceptionCode& ec)
+{
+ setHref(url);
+ if (!m_url.isValid())
+ ec = TypeError;
+}
+
+const String& DOMURL::toString() const
+{
+ return href().string();
+}
+
+String DOMURL::origin() const
+{
+ RefPtr<SecurityOrigin> origin = SecurityOrigin::create(href());
+ return origin->toString();
+}
+
+String DOMURL::protocol() const
+{
+ return href().protocol() + ':';
+}
+
+void DOMURL::setProtocol(const String& value)
+{
+ URL url = href();
+ url.setProtocol(value);
+ setHref(url.string());
+}
+
+String DOMURL::username() const
+{
+ return href().user();
+}
+
+void DOMURL::setUsername(const String& user)
+{
+ URL url = href();
+ url.setUser(user);
+ setHref(url);
+}
+
+String DOMURL::password() const
+{
+ return href().pass();
+}
+
+void DOMURL::setPassword(const String& pass)
+{
+ URL url = href();
+ url.setPass(pass);
+ setHref(url);
+}
+
+String DOMURL::host() const
+{
+ const URL& 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& value, unsigned portStart, unsigned& portEnd)
+{
+ portEnd = portStart;
+ while (isASCIIDigit(value[portEnd]))
+ ++portEnd;
+ return value.substring(portStart, portEnd - portStart).toUInt();
+}
+
+void DOMURL::setHost(const String& 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 "0" 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& value)
+{
+ // Before setting new value:
+ // Remove all leading U+002F SOLIDUS ("/") 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& 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 "0" 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& value)
+{
+ URL url = href();
+ if (!url.canSetPathname())
+ return;
+
+ if (value[0] == '/')
+ url.setPath(value);
+ else
+ url.setPath("/" + value);
+
+ setHref(url.string());
+}
+
+String DOMURL::search() const
+{
+ String query = href().query();
+ return query.isEmpty() ? emptyString() : "?" + query;
+}
+
+void DOMURL::setSearch(const String& 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('#', "%23"));
+
+ setHref(url.string());
+}
+
+String DOMURL::hash() const
+{
+ String fragmentIdentifier = href().fragmentIdentifier();
+ if (fragmentIdentifier.isEmpty())
+ return emptyString();
+ return AtomicString(String("#" + fragmentIdentifier));
+}
+
+void DOMURL::setHash(const String& 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->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 "ExceptionCode.h"
</ins><span class="cx"> #include "URL.h"
</span><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/PassRefPtr.h>
</span><span class="lines">@@ -42,8 +43,45 @@
</span><span class="cx"> class DOMURL : public RefCounted<DOMURL> {
</span><span class="cx">
</span><span class="cx"> public:
</span><del>- static PassRefPtr<DOMURL> create() { return adoptRef(new DOMURL); }
</del><ins>+ static PassRefPtr<DOMURL> create(const String& url, const String& base, ExceptionCode&);
+ static PassRefPtr<DOMURL> create(const String& url, const DOMURL* base, ExceptionCode&);
+ static PassRefPtr<DOMURL> create(const String& url, ExceptionCode&);
</ins><span class="cx">
</span><ins>+ const URL& href() const;
+ void setHref(const String& url);
+ void setHref(const String&, ExceptionCode&);
+ const String& toString() const;
+
+ String origin() const;
+
+ String protocol() const;
+ void setProtocol(const String&);
+
+ String username() const;
+ void setUsername(const String&);
+
+ String password() const;
+ void setPassword(const String&);
+
+ String host() const;
+ void setHost(const String&);
+
+ String hostname() const;
+ void setHostname(const String&);
+
+ String port() const;
+ void setPort(const String&);
+
+ String pathname() const;
+ void setPathname(const String&);
+
+ String search() const;
+ void setSearch(const String&);
+
+ String hash() const;
+ void setHash(const String&);
+
+
</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& url, const String& base, ExceptionCode&);
+ DOMURL(const String& url, const DOMURL& base, ExceptionCode&);
+ DOMURL(const String& url, ExceptionCode&);
+
+ 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&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 "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE 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) && 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>