<!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>[163299] 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/163299">163299</a></dd>
<dt>Author</dt> <dd>mjs@apple.com</dd>
<dt>Date</dt> <dd>2014-02-03 03:13:17 -0800 (Mon, 03 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Adopt URLUtils interface and template in HTMLAnchorElement and HTMLAreaElement
https://bugs.webkit.org/show_bug.cgi?id=128067
Reviewed by Antti Koivisto.
Source/WebCore:
Tests: fast/dom/HTMLAnchorElement/anchor-password.html
fast/dom/HTMLAnchorElement/anchor-username.html
fast/dom/HTMLAreaElement/area-password.html
fast/dom/HTMLAreaElement/area-username.html
* html/HTMLAnchorElement.cpp:
* html/HTMLAnchorElement.h:
(WebCore::HTMLAnchorElement::setHref): Add version that takes
(and ignores) ExceptionCode. This is needed because the URLUtil
base interface is used for URL, which can throw an exception,
and HTMLAnchorElement, which cannot.
* html/HTMLAnchorElement.idl: implement URLUtils
* html/HTMLAreaElement.idl: implement URLUtils
* html/URLUtils.idl: Treat null as empty string for href
LayoutTests:
New tests for the newly added attributes.
* fast/dom/HTMLAnchorElement/anchor-password-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-password.html: Added.
* fast/dom/HTMLAnchorElement/anchor-username-expected.txt: Added.
* fast/dom/HTMLAnchorElement/anchor-username.html: Added.
* fast/dom/HTMLAreaElement/area-password.html: Added.
* fast/dom/HTMLAreaElement/area-username.html: Added.
Update a test to handle the new anchor properties.
* js/dom/dom-static-property-for-in-iteration-expected.txt:
* js/dom/dom-static-property-for-in-iteration.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsjsdomdomstaticpropertyforiniterationexpectedtxt">trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdomdomstaticpropertyforiniterationhtml">trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAnchorElementcpp">trunk/Source/WebCore/html/HTMLAnchorElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAnchorElementh">trunk/Source/WebCore/html/HTMLAnchorElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAnchorElementidl">trunk/Source/WebCore/html/HTMLAnchorElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAreaElementidl">trunk/Source/WebCore/html/HTMLAreaElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlURLUtilsidl">trunk/Source/WebCore/html/URLUtils.idl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomHTMLAnchorElementanchorpasswordexpectedtxt">trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-password-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLAnchorElementanchorpasswordhtml">trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-password.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLAnchorElementanchorusernameexpectedtxt">trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-username-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLAnchorElementanchorusernamehtml">trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-username.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLAreaElementareapasswordhtml">trunk/LayoutTests/fast/dom/HTMLAreaElement/area-password.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLAreaElementareausernamehtml">trunk/LayoutTests/fast/dom/HTMLAreaElement/area-username.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/LayoutTests/ChangeLog        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-02-02 Maciej Stachowiak <mjs@apple.com>
+
+ Adopt URLUtils interface and template in HTMLAnchorElement and HTMLAreaElement
+ https://bugs.webkit.org/show_bug.cgi?id=128067
+
+ Reviewed by Antti Koivisto.
+
+ New tests for the newly added attributes.
+ * fast/dom/HTMLAnchorElement/anchor-password-expected.txt: Added.
+ * fast/dom/HTMLAnchorElement/anchor-password.html: Added.
+ * fast/dom/HTMLAnchorElement/anchor-username-expected.txt: Added.
+ * fast/dom/HTMLAnchorElement/anchor-username.html: Added.
+ * fast/dom/HTMLAreaElement/area-password.html: Added.
+ * fast/dom/HTMLAreaElement/area-username.html: Added.
+
+ Update a test to handle the new anchor properties.
+ * js/dom/dom-static-property-for-in-iteration-expected.txt:
+ * js/dom/dom-static-property-for-in-iteration.html:
+
</ins><span class="cx"> 2014-02-03 Krzysztof Czech <k.czech@samsung.com>
</span><span class="cx">
</span><span class="cx"> [ATK] Expose aria-controls through ATK_RELATION_CONTROLLER_FOR
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLAnchorElementanchorpasswordexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-password-expected.txt (0 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-password-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-password-expected.txt        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+Test getting the password attribute of an 'a' element.
+
+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="trunkLayoutTestsfastdomHTMLAnchorElementanchorpasswordhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-password.html (0 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-password.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-password.html        2014-02-03 11:13:17 UTC (rev 163299)
</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 an 'a' element.");
+
+var a = document.createElement("a");
+
+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="trunkLayoutTestsfastdomHTMLAnchorElementanchorusernameexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-username-expected.txt (0 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-username-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-username-expected.txt        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+Test getting the username attribute of an 'a' element.
+
+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="trunkLayoutTestsfastdomHTMLAnchorElementanchorusernamehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-username.html (0 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-username.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAnchorElement/anchor-username.html        2014-02-03 11:13:17 UTC (rev 163299)
</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 an 'a' element.");
+
+var a = document.createElement("a");
+
+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="trunkLayoutTestsfastdomHTMLAreaElementareapasswordhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLAreaElement/area-password.html (0 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLAreaElement/area-password.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAreaElement/area-password.html        2014-02-03 11:13:17 UTC (rev 163299)
</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 an 'area' element.");
+
+var a = document.createElement("area");
+
+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="trunkLayoutTestsfastdomHTMLAreaElementareausernamehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/dom/HTMLAreaElement/area-username.html (0 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLAreaElement/area-username.html         (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLAreaElement/area-username.html        2014-02-03 11:13:17 UTC (rev 163299)
</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 an 'area' element.");
+
+var a = document.createElement("area");
+
+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="trunkLayoutTestsjsdomdomstaticpropertyforiniterationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -1,3 +1,4 @@
</span><ins>+nerget
</ins><span class="cx"> Checks that get_by_pname doesn't get confused about which properties go where when it comes to stacic properties.
</span><span class="cx">
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="lines">@@ -16,17 +17,19 @@
</span><span class="cx"> PASS a["hostname"] is
</span><span class="cx"> PASS a["rel"] is
</span><span class="cx"> PASS a["hreflang"] is
</span><ins>+PASS a["password"] is
</ins><span class="cx"> PASS a["ping"] is
</span><span class="cx"> PASS a["rev"] is
</span><span class="cx"> PASS a["host"] is
</span><span class="cx"> PASS a["charset"] is
</span><ins>+PASS a["username"] is
</ins><span class="cx"> PASS a["target"] is
</span><span class="cx"> PASS a["type"] is
</span><span class="cx"> PASS a["coords"] is
</span><span class="cx"> PASS a["name"] is
</span><span class="cx"> PASS a["shape"] is
</span><ins>+PASS a["protocol"] is file:
</ins><span class="cx"> PASS a["port"] is
</span><del>-PASS a["protocol"] is file:
</del><span class="cx"> PASS a["outerHTML"] is <a id="foo" href="bar">nerget</a>
</span><span class="cx"> PASS a["spellcheck"] is true
</span><span class="cx"> PASS a["webkitdropzone"] is
</span><span class="lines">@@ -59,9 +62,9 @@
</span><span class="cx"> PASS a["clientTop"] is 0
</span><span class="cx"> PASS a["lastElementChild"] is null
</span><span class="cx"> PASS a["offsetParent"] is [object HTMLBodyElement]
</span><del>-PASS a["nextElementSibling"] is [object HTMLScriptElement]
</del><ins>+PASS a["nextElementSibling"] is [object HTMLParagraphElement]
</ins><span class="cx"> PASS a["tagName"] is A
</span><del>-PASS a["previousElementSibling"] is [object HTMLDivElement]
</del><ins>+PASS a["previousElementSibling"] is null
</ins><span class="cx"> PASS a["childElementCount"] is 0
</span><span class="cx"> PASS a["scrollLeft"] is 0
</span><span class="cx"> PASS a["firstElementChild"] is null
</span><span class="lines">@@ -69,7 +72,7 @@
</span><span class="cx"> PASS a["clientLeft"] is 0
</span><span class="cx"> PASS a["offsetHeight"] is 18
</span><span class="cx"> PASS a["clientHeight"] is 0
</span><del>-PASS a["offsetTop"] is 1074
</del><ins>+PASS a["offsetTop"] is 8
</ins><span class="cx"> PASS a["scrollTop"] is 0
</span><span class="cx"> PASS a["scrollHeight"] is 0
</span><span class="cx"> PASS a["previousSibling"] is [object Text]
</span><span class="lines">@@ -108,4 +111,4 @@
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span><del>-nerget
</del><ins>+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsdomdomstaticpropertyforiniterationhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration.html (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration.html        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration.html        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <a id="foo" href="bar">nerget</a>
</span><ins>+ <div id="console"></div>
</ins><span class="cx"> <script>
</span><span class="cx"> var realShouldBe = function(expectedValue, actualString, actualValue) {
</span><span class="cx"> if (expectedValue === actualValue)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/Source/WebCore/ChangeLog        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-02-02 Maciej Stachowiak <mjs@apple.com>
+
+ Adopt URLUtils interface and template in HTMLAnchorElement and HTMLAreaElement
+ https://bugs.webkit.org/show_bug.cgi?id=128067
+
+ Reviewed by Antti Koivisto.
+
+ Tests: fast/dom/HTMLAnchorElement/anchor-password.html
+ fast/dom/HTMLAnchorElement/anchor-username.html
+ fast/dom/HTMLAreaElement/area-password.html
+ fast/dom/HTMLAreaElement/area-username.html
+
+ * html/HTMLAnchorElement.cpp:
+ * html/HTMLAnchorElement.h:
+ (WebCore::HTMLAnchorElement::setHref): Add version that takes
+ (and ignores) ExceptionCode. This is needed because the URLUtil
+ base interface is used for URL, which can throw an exception,
+ and HTMLAnchorElement, which cannot.
+ * html/HTMLAnchorElement.idl: implement URLUtils
+ * html/HTMLAreaElement.idl: implement URLUtils
+ * html/URLUtils.idl: Treat null as empty string for href
+
</ins><span class="cx"> 2014-02-03 Krzysztof Czech <k.czech@samsung.com>
</span><span class="cx">
</span><span class="cx"> [ATK] Expose aria-controls through ATK_RELATION_CONTROLLER_FOR
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAnchorElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -75,15 +75,6 @@
</span><span class="cx"> clearRootEditableElementForSelectionOnMouseDown();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-// 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();
-}
-
</del><span class="cx"> bool HTMLAnchorElement::supportsFocus() const
</span><span class="cx"> {
</span><span class="cx"> if (hasEditableStyle())
</span><span class="lines">@@ -330,180 +321,11 @@
</span><span class="cx"> return getAttribute(targetAttr);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-String HTMLAnchorElement::hash() const
-{
- String fragmentIdentifier = href().fragmentIdentifier();
- if (fragmentIdentifier.isEmpty())
- return emptyString();
- return AtomicString(String("#" + fragmentIdentifier));
-}
-
-void HTMLAnchorElement::setHash(const String& value)
-{
- URL url = href();
- if (value[0] == '#')
- url.setFragmentIdentifier(value.substring(1));
- else
- url.setFragmentIdentifier(value);
- setHref(url.string());
-}
-
-String HTMLAnchorElement::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());
-}
-
-void HTMLAnchorElement::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 HTMLAnchorElement::hostname() const
-{
- return href().host();
-}
-
-void HTMLAnchorElement::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 HTMLAnchorElement::pathname() const
-{
- return href().path();
-}
-
-void HTMLAnchorElement::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 HTMLAnchorElement::port() const
-{
- if (href().hasPort())
- return String::number(href().port());
-
- return emptyString();
-}
-
-void HTMLAnchorElement::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.
- unsigned port = value.toUInt();
- if (isDefaultPortForProtocol(port, url.protocol()))
- url.removePort();
- else
- url.setPort(port);
-
- setHref(url.string());
-}
-
-String HTMLAnchorElement::protocol() const
-{
- return href().protocol() + ":";
-}
-
-void HTMLAnchorElement::setProtocol(const String& value)
-{
- URL url = href();
- url.setProtocol(value);
- setHref(url.string());
-}
-
-String HTMLAnchorElement::search() const
-{
- String query = href().query();
- return query.isEmpty() ? emptyString() : "?" + query;
-}
-
-String HTMLAnchorElement::origin() const
-{
- RefPtr<SecurityOrigin> origin = SecurityOrigin::create(href());
- return origin->toString();
-}
-
-void HTMLAnchorElement::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());
-}
-
</del><span class="cx"> String HTMLAnchorElement::text()
</span><span class="cx"> {
</span><span class="cx"> return innerText();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-String HTMLAnchorElement::toString() const
-{
- return href().string();
-}
-
</del><span class="cx"> bool HTMLAnchorElement::isLiveLink() const
</span><span class="cx"> {
</span><span class="cx"> return isLink() && treatLinkAsLiveForEventType(m_wasShiftKeyDownOnMouseDown ? MouseEventWithShiftKey : MouseEventWithoutShiftKey);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAnchorElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAnchorElement.h (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAnchorElement.h        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.h        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include "HTMLElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "LinkHash.h"
</span><ins>+#include "URLUtils.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -53,7 +54,7 @@
</span><span class="cx"> // RelationUp = 0x00020000,
</span><span class="cx"> };
</span><span class="cx">
</span><del>-class HTMLAnchorElement : public HTMLElement {
</del><ins>+class HTMLAnchorElement : public HTMLElement, public URLUtils<HTMLAnchorElement> {
</ins><span class="cx"> public:
</span><span class="cx"> static PassRefPtr<HTMLAnchorElement> create(Document&);
</span><span class="cx"> static PassRefPtr<HTMLAnchorElement> create(const QualifiedName&, Document&);
</span><span class="lines">@@ -62,36 +63,12 @@
</span><span class="cx">
</span><span class="cx"> URL href() const;
</span><span class="cx"> void setHref(const AtomicString&);
</span><ins>+ void setHref(const AtomicString& value, ExceptionCode&) { setHref(value); }
</ins><span class="cx">
</span><span class="cx"> const AtomicString& name() const;
</span><span class="cx">
</span><del>- String hash() const;
- void setHash(const String&);
-
- String host() const;
- void setHost(const String&);
-
- String hostname() const;
- void setHostname(const String&);
-
- String pathname() const;
- void setPathname(const String&);
-
- String port() const;
- void setPort(const String&);
-
- String protocol() const;
- void setProtocol(const String&);
-
- String search() const;
- void setSearch(const String&);
-
- String origin() const;
-
</del><span class="cx"> String text();
</span><span class="cx">
</span><del>- String toString() const;
-
</del><span class="cx"> bool isLiveLink() const;
</span><span class="cx">
</span><span class="cx"> virtual bool willRespondToMouseClickEvents() override;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAnchorElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAnchorElement.idl (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAnchorElement.idl        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.idl        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -22,7 +22,6 @@
</span><span class="cx"> [Reflect] attribute DOMString charset;
</span><span class="cx"> [Reflect] attribute DOMString coords;
</span><span class="cx"> [Conditional=DOWNLOAD_ATTRIBUTE, Reflect] attribute DOMString download;
</span><del>- [Reflect, URL] attribute DOMString href;
</del><span class="cx"> [Reflect] attribute DOMString hreflang;
</span><span class="cx"> [Reflect] attribute DOMString name;
</span><span class="cx"> [Reflect] attribute DOMString ping;
</span><span class="lines">@@ -36,35 +35,12 @@
</span><span class="cx"> [Reflect] attribute DOMString accessKey;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>-#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
- readonly attribute DOMString hash;
- readonly attribute DOMString host;
- readonly attribute DOMString hostname;
- readonly attribute DOMString pathname;
- readonly attribute DOMString port;
- readonly attribute DOMString protocol;
- readonly attribute DOMString search;
-#else
- [TreatNullAs=NullString] attribute DOMString hash;
- [TreatNullAs=NullString] attribute DOMString host;
- [TreatNullAs=NullString] attribute DOMString hostname;
- [TreatNullAs=NullString] attribute DOMString pathname;
- [TreatNullAs=NullString] attribute DOMString port;
- [TreatNullAs=NullString] attribute DOMString protocol;
- [TreatNullAs=NullString] attribute DOMString search;
-
- [TreatNullAs=NullString] readonly attribute DOMString origin;
-#endif
-
</del><span class="cx"> readonly attribute DOMString text;
</span><span class="cx">
</span><del>-#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
- [NotEnumerable] DOMString toString();
-#endif
-
</del><span class="cx"> #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
</span><span class="cx"> // Objective-C extension:
</span><span class="cx"> readonly attribute URL absoluteLinkURL;
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+HTMLAnchorElement implements URLUtils;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAreaElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAreaElement.idl (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAreaElement.idl        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/Source/WebCore/html/HTMLAreaElement.idl        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -21,7 +21,6 @@
</span><span class="cx"> interface HTMLAreaElement : HTMLElement {
</span><span class="cx"> [Reflect] attribute DOMString alt;
</span><span class="cx"> [Reflect] attribute DOMString coords;
</span><del>- [Reflect, URL] attribute DOMString href;
</del><span class="cx"> [Reflect] attribute boolean noHref;
</span><span class="cx"> [Reflect] attribute DOMString ping;
</span><span class="cx"> [Reflect] attribute DOMString shape;
</span><span class="lines">@@ -30,14 +29,6 @@
</span><span class="cx"> #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
</span><span class="cx"> [Reflect] attribute DOMString accessKey;
</span><span class="cx"> #endif
</span><del>- // IE Extensions
- readonly attribute DOMString hash;
- readonly attribute DOMString host;
- readonly attribute DOMString hostname;
- readonly attribute DOMString pathname;
- readonly attribute DOMString port;
- readonly attribute DOMString protocol;
- readonly attribute DOMString search;
</del><span class="cx">
</span><span class="cx"> #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
</span><span class="cx"> // Objective-C extension:
</span><span class="lines">@@ -45,3 +36,4 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+HTMLAreaElement implements URLUtils;
</ins></span></pre></div>
<a id="trunkSourceWebCorehtmlURLUtilsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/URLUtils.idl (163298 => 163299)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/URLUtils.idl        2014-02-03 10:05:06 UTC (rev 163298)
+++ trunk/Source/WebCore/html/URLUtils.idl        2014-02-03 11:13:17 UTC (rev 163299)
</span><span class="lines">@@ -25,13 +25,22 @@
</span><span class="cx">
</span><span class="cx"> [NoInterfaceObject]
</span><span class="cx"> interface URLUtils {
</span><del>- [SetterRaisesException, URL] attribute DOMString href;
</del><ins>+ [SetterRaisesException, TreatNullAs=NullString, URL] attribute DOMString href;
</ins><span class="cx"> #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
</span><span class="cx"> [NotEnumerable] DOMString toString();
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> readonly attribute DOMString origin;
</span><span class="cx">
</span><ins>+#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
+ readonly attribute DOMString protocol;
+ readonly attribute DOMString host;
+ readonly attribute DOMString hostname;
+ readonly attribute DOMString port;
+ readonly attribute DOMString pathname;
+ readonly attribute DOMString search;
+ readonly attribute DOMString hash;
+#else
</ins><span class="cx"> [TreatNullAs=NullString] attribute DOMString protocol;
</span><span class="cx"> [TreatNullAs=NullString] attribute DOMString username;
</span><span class="cx"> [TreatNullAs=NullString] attribute DOMString password;
</span><span class="lines">@@ -42,4 +51,6 @@
</span><span class="cx"> [TreatNullAs=NullString] attribute DOMString search;
</span><span class="cx"> // attribute URLSearchParams? searchParams;
</span><span class="cx"> [TreatNullAs=NullString] attribute DOMString hash;
</span><ins>+#endif
+
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>