<!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>[180084] branches/safari-600.1.4.15-branch</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/180084">180084</a></dd>
<dt>Author</dt> <dd>lforschler@apple.com</dd>
<dt>Date</dt> <dd>2015-02-13 14:57:28 -0800 (Fri, 13 Feb 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/179933">r179933</a>. rdar://problem/19812665</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6001415branchLayoutTestsChangeLog">branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari6001415branchLayoutTestsfastdomDOMURLurloriginexpectedtxt">branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/url-origin-expected.txt</a></li>
<li><a href="#branchessafari6001415branchLayoutTestsfastdomDOMURLurloriginhtml">branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/url-origin.html</a></li>
<li><a href="#branchessafari6001415branchSourceWebCoreChangeLog">branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6001415branchSourceWebCorehtmlURLUtilsh">branches/safari-600.1.4.15-branch/Source/WebCore/html/URLUtils.h</a></li>
<li><a href="#branchessafari6001415branchSourceWebCoreplatformURLcpp">branches/safari-600.1.4.15-branch/Source/WebCore/platform/URL.cpp</a></li>
<li><a href="#branchessafari6001415branchSourceWebCoreplatformURLh">branches/safari-600.1.4.15-branch/Source/WebCore/platform/URL.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6001415branchLayoutTestsfasturlurlcredentialsescapingexpectedtxt">branches/safari-600.1.4.15-branch/LayoutTests/fast/url/url-credentials-escaping-expected.txt</a></li>
<li><a href="#branchessafari6001415branchLayoutTestsfasturlurlcredentialsescapinghtml">branches/safari-600.1.4.15-branch/LayoutTests/fast/url/url-credentials-escaping.html</a></li>
<li><a href="#branchessafari6001415branchLayoutTestshttptestsxmlhttprequestbasicauthcredentialsescapingexpectedtxt">branches/safari-600.1.4.15-branch/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping-expected.txt</a></li>
<li><a href="#branchessafari6001415branchLayoutTestshttptestsxmlhttprequestbasicauthcredentialsescapinghtml">branches/safari-600.1.4.15-branch/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#branchessafari6001415branchLayoutTestsfastdomDOMURLinvalidurlgettersexpectedtxt">branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/invalid-url-getters-expected.txt</a></li>
<li><a href="#branchessafari6001415branchLayoutTestsfastdomDOMURLinvalidurlgettershtml">branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/invalid-url-getters.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6001415branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -1,5 +1,31 @@
</span><span class="cx"> 2015-02-13 Lucas Forschler <lforschler@apple.com>
</span><span class="cx">
</span><ins>+ Merge r179933
+
+ 2015-02-10 Alexey Proskuryakov <ap@apple.com>
+
+ URL::setUser and URL::setPass don't percent encode
+ https://bugs.webkit.org/show_bug.cgi?id=141453
+ rdar://problem/14844503&16551802&19623145
+
+ Reviewed by Darin Adler.
+
+ * fast/url/url-credentials-escaping-expected.txt: Added.
+ * fast/url/url-credentials-escaping.html: Added.
+ This change is most directly testable via URL API.
+
+ * http/tests/xmlhttprequest/basic-auth-credentials-escaping-expected.txt: Added.
+ * http/tests/xmlhttprequest/basic-auth-credentials-escaping.html: Added.
+ Verify that this doesn't break XMLHttpRequest authentication.
+
+ * fast/dom/DOMURL/invalid-url-getters-expected.txt: Removed.
+ * fast/dom/DOMURL/invalid-url-getters.html: Removed.
+ * fast/dom/DOMURL/url-origin-expected.txt:
+ * fast/dom/DOMURL/url-origin.html:
+ Removed tests for invalid URLs, there is no such thing with URL API.
+
+2015-02-13 Lucas Forschler <lforschler@apple.com>
+
</ins><span class="cx"> Merge r179772
</span><span class="cx">
</span><span class="cx"> 2015-02-06 Said Abou-Hallawa <sabouhallawa@apple.com>
</span></span></pre></div>
<a id="branchessafari6001415branchLayoutTestsfastdomDOMURLinvalidurlgettersexpectedtxt"></a>
<div class="delfile"><h4>Deleted: branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/invalid-url-getters-expected.txt (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/invalid-url-getters-expected.txt        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/invalid-url-getters-expected.txt        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -1,19 +0,0 @@
</span><del>-Test what getters return on an invalid URL
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS invalidURL.toString() is 'http://@@:p@www.example.com:22/bar?x#y'
-FAIL invalidURL.origin should be . Was null.
-PASS invalidURL.username is ''
-PASS invalidURL.password is ''
-PASS invalidURL.host is ''
-PASS invalidURL.hostname is ''
-PASS invalidURL.port is ''
-PASS invalidURL.pathname is ''
-PASS invalidURL.search is ''
-PASS invalidURL.hash is ''
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="branchessafari6001415branchLayoutTestsfastdomDOMURLinvalidurlgettershtml"></a>
<div class="delfile"><h4>Deleted: branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/invalid-url-getters.html (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/invalid-url-getters.html        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/invalid-url-getters.html        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -1,29 +0,0 @@
</span><del>-<!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>
</del></span></pre></div>
<a id="branchessafari6001415branchLayoutTestsfastdomDOMURLurloriginexpectedtxt"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/url-origin-expected.txt (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/url-origin-expected.txt        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/url-origin-expected.txt        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -4,5 +4,4 @@
</span><span class="cx"> ftp://example.com/ttt?ggg => ftp://example.com
</span><span class="cx"> file:///home/abarth => file://
</span><span class="cx"> data:text/html,<b>foo</b> => null
</span><del>-http://@@@www.example.com/bar => null
</del><span class="cx">
</span></span></pre></div>
<a id="branchessafari6001415branchLayoutTestsfastdomDOMURLurloriginhtml"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/url-origin.html (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/url-origin.html        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/LayoutTests/fast/dom/DOMURL/url-origin.html        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -5,9 +5,6 @@
</span><span class="cx"> if (window.testRunner)
</span><span class="cx"> testRunner.dumpAsText();
</span><span class="cx">
</span><del>-var invalidURL = new URL("http://www.example.com/bar")
-invalidURL.username = "@@";
-
</del><span class="cx"> var cases = [
</span><span class="cx"> new URL("http://example.com/foo/bar"),
</span><span class="cx"> new URL("HTTP://example.com/foo/bar"),
</span><span class="lines">@@ -15,7 +12,6 @@
</span><span class="cx"> new URL("ftp://example.com/ttt?ggg"),
</span><span class="cx"> new URL("file:///home/abarth"),
</span><span class="cx"> new URL("data:text/html,<b>foo</b>"),
</span><del>- invalidURL
</del><span class="cx"> ];
</span><span class="cx">
</span><span class="cx"> window.onload = function(e)
</span></span></pre></div>
<a id="branchessafari6001415branchLayoutTestsfasturlurlcredentialsescapingexpectedtxtfromrev179933trunkLayoutTestsfasturlurlcredentialsescapingexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4.15-branch/LayoutTests/fast/url/url-credentials-escaping-expected.txt (from rev 179933, trunk/LayoutTests/fast/url/url-credentials-escaping-expected.txt) (0 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/fast/url/url-credentials-escaping-expected.txt         (rev 0)
+++ branches/safari-600.1.4.15-branch/LayoutTests/fast/url/url-credentials-escaping-expected.txt        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+Test that URL username and password accessors encode/decode correctly
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Basic syntax
+PASS build('user').toString() is "http://user@www.apple.com/"
+PASS build('user').username is "user"
+PASS build('%').toString() is "http://%@www.apple.com/"
+PASS build('%').username is "%"
+PASS build('%%').toString() is "http://%%@www.apple.com/"
+PASS build('%%').username is "%%"
+PASS build('%z').toString() is "http://%z@www.apple.com/"
+PASS build('%z').username is "%z"
+PASS build('%61').toString() is "http://%61@www.apple.com/"
+PASS build('%61').username is "%61"
+PASS build('%40').toString() is "http://%40@www.apple.com/"
+PASS build('%40').username is "%40"
+
+Simple encode set
+PASS build('').toString() is "http://%07%7F@www.apple.com/"
+PASS build('user', '').toString() is "http://user:%07%7F@www.apple.com/"
+
+Default encode set additions
+PASS build(' "#><?`').toString() is "http://%20%22%23%3E%3C%3F%60@www.apple.com/"
+PASS build('user', ' "#><?`').toString() is "http://user:%20%22%23%3E%3C%3F%60@www.apple.com/"
+
+Password encode set additions
+PASS build('/@\\').toString() is "http://%2F%40%5C@www.apple.com/"
+PASS build('user', '/@\\').toString() is "http://user:%2F%40%5C@www.apple.com/"
+':' shouldn't be encoded in the password per the URL Standard, although both Firefox and Chrome encode it
+PASS build('user', ':').toString() is "http://user::@www.apple.com/"
+
+Username encode set addition
+PASS build(':').toString() is "http://%3A@www.apple.com/"
+
+8-bit
+PASS build('юзер', 'пароль').toString() is "http://%D1%8E%D0%B7%D0%B5%D1%80:%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C@www.apple.com/"
+PASS build('юзер').username is "%D1%8E%D0%B7%D0%B5%D1%80"
+PASS build('user', 'пароль').password is "%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C"
+
+Some special characters that don't get encoded when used in credentials
+PASS build('!$&*()-+~').toString() is "http://!$&*()-+~@www.apple.com/"
+
+Some characters that shouldn't be encoded per the URL Standard, although both Firefox and Chrome encode them
+PASS build('^{|}[]=').toString() is "http://^{|}[]=@www.apple.com/"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari6001415branchLayoutTestsfasturlurlcredentialsescapinghtmlfromrev179933trunkLayoutTestsfasturlurlcredentialsescapinghtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4.15-branch/LayoutTests/fast/url/url-credentials-escaping.html (from rev 179933, trunk/LayoutTests/fast/url/url-credentials-escaping.html) (0 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/fast/url/url-credentials-escaping.html         (rev 0)
+++ branches/safari-600.1.4.15-branch/LayoutTests/fast/url/url-credentials-escaping.html        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -0,0 +1,72 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+
+description("Test that URL username and password accessors encode/decode correctly");
+
+function build(username, password)
+{
+ var url = new URL("http://www.apple.com");
+ if (username)
+ url.username = username;
+ if (password)
+ url.password = password;
+ return url;
+}
+
+debug("\nBasic syntax");
+
+shouldBe("build('user').toString()", '"http://user@www.apple.com/"');
+shouldBe("build('user').username", '"user"');
+
+shouldBe("build('%').toString()", '"http://%@www.apple.com/"');
+shouldBe("build('%').username", '"%"');
+
+shouldBe("build('%%').toString()", '"http://%%@www.apple.com/"');
+shouldBe("build('%%').username", '"%%"');
+
+shouldBe("build('%z').toString()", '"http://%z@www.apple.com/"');
+shouldBe("build('%z').username", '"%z"');
+
+// Yes, this is weird, percent signs don't get encoded.
+shouldBe("build('%61').toString()", '"http://%61@www.apple.com/"');
+shouldBe("build('%61').username", '"%61"');
+shouldBe("build('%40').toString()", '"http://%40@www.apple.com/"');
+shouldBe("build('%40').username", '"%40"');
+
+debug("\nSimple encode set");
+shouldBe("build('\x07\x7f').toString()", '"http://%07%7F@www.apple.com/"');
+shouldBe("build('user', '\x07\x7f').toString()", '"http://user:%07%7F@www.apple.com/"');
+
+debug("\nDefault encode set additions");
+shouldBe("build(' \"#><?`').toString()", '"http://%20%22%23%3E%3C%3F%60@www.apple.com/"');
+shouldBe("build('user', ' \"#><?`').toString()", '"http://user:%20%22%23%3E%3C%3F%60@www.apple.com/"');
+
+debug("\nPassword encode set additions");
+shouldBe("build('/@\\\\').toString()", '"http://%2F%40%5C@www.apple.com/"');
+shouldBe("build('user', '/@\\\\').toString()", '"http://user:%2F%40%5C@www.apple.com/"');
+debug("':' shouldn't be encoded in the password per the URL Standard, although both Firefox and Chrome encode it")
+shouldBe("build('user', ':').toString()", '"http://user::@www.apple.com/"');
+
+debug("\nUsername encode set addition");
+shouldBe("build(':').toString()", '"http://%3A@www.apple.com/"');
+
+debug("\n8-bit");
+shouldBe("build('юзер', 'пароль').toString()", '"http://%D1%8E%D0%B7%D0%B5%D1%80:%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C@www.apple.com/"');
+shouldBe("build('юзер').username", '"%D1%8E%D0%B7%D0%B5%D1%80"');
+shouldBe("build('user', 'пароль').password", '"%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C"');
+
+debug("\nSome special characters that don't get encoded when used in credentials");
+shouldBe("build('!$&*()-+~').toString()", '"http://!$&*()-+~@www.apple.com/"');
+
+debug("\nSome characters that shouldn't be encoded per the URL Standard, although both Firefox and Chrome encode them")
+shouldBe("build('^{|}[]=').toString()", '"http://^{|}[]=@www.apple.com/"');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari6001415branchLayoutTestshttptestsxmlhttprequestbasicauthcredentialsescapingexpectedtxtfromrev179933trunkLayoutTestshttptestsxmlhttprequestbasicauthcredentialsescapingexpectedtxt"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4.15-branch/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping-expected.txt (from rev 179933, trunk/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping-expected.txt) (0 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping-expected.txt         (rev 0)
+++ branches/safari-600.1.4.15-branch/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping-expected.txt        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+Tests for XMLHttpRequest authentication.
+
+async: User: 1, password: %a%.
+async2: User: 2, password: @.
+async3: User: 3, password: @.
+async4: User: 4, password: :.
+async5: User: 5, password: .
+async6: User: 6, password: a.
+async7: User: 7, password: /@\ "#><?`.
</ins></span></pre></div>
<a id="branchessafari6001415branchLayoutTestshttptestsxmlhttprequestbasicauthcredentialsescapinghtmlfromrev179933trunkLayoutTestshttptestsxmlhttprequestbasicauthcredentialsescapinghtml"></a>
<div class="copfile"><h4>Copied: branches/safari-600.1.4.15-branch/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping.html (from rev 179933, trunk/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping.html) (0 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping.html         (rev 0)
+++ branches/safari-600.1.4.15-branch/LayoutTests/http/tests/xmlhttprequest/basic-auth-credentials-escaping.html        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+<html>
+<meta charset="utf-8">
+<body>
+<p>Tests for XMLHttpRequest authentication.
+<script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ var console_messages = document.createElement("ol");
+ document.body.appendChild(console_messages);
+
+ function log(message)
+ {
+ var item = document.createElement("li");
+ item.appendChild(document.createTextNode(message));
+ console_messages.appendChild(item);
+ }
+
+ function sendAndLogResponse(uid, req)
+ {
+ try {
+ req.send("");
+ log(uid + ': ' + req.responseText);
+ } catch (e) {
+ log(uid + ": req.send raised exception: " + e);
+ log(uid + ": req.readyState: " + req.readyState);
+ log(uid + ": req.status: " + req.status);
+ }
+ }
+
+ // async
+ var asyncStep = 1;
+
+ req = new XMLHttpRequest;
+ req.onreadystatechange = processStateChange;
+ req.open("GET", "resources/basic-auth/basic-auth.php?uid=1", true, "1", "%a%");
+ req.send("");
+
+ function processStateChange() {
+
+ if (req.readyState == 4){
+ if (req.status == 200){
+ if (asyncStep == 1) {
+ asyncStep = 2;
+ log('async: ' + req.responseText);
+ req.onreadystatechange = processStateChange;
+ req.open("GET", "resources/basic-auth/basic-auth.php?uid=2", true, "2", "%40");
+ req.send("");
+ } else if (asyncStep == 2) {
+ asyncStep = 3;
+ log('async2: ' + req.responseText);
+ req.onreadystatechange = processStateChange;
+ req.open("GET", "resources/basic-auth/basic-auth.php?uid=3", true, "3", "@");
+ req.send("");
+ } else if (asyncStep == 3) {
+ asyncStep = 4;
+ log('async3: ' + req.responseText);
+ req.onreadystatechange = processStateChange;
+ req.open("GET", "resources/basic-auth/basic-auth.php?uid=4", true, "4", ":");
+ req.send("");
+ } else if (asyncStep == 4) {
+ asyncStep = 5;
+ log('async4: ' + req.responseText);
+ req.onreadystatechange = processStateChange;
+ req.open("GET", "resources/basic-auth/basic-auth.php?uid=5", true, "5", " ");
+ req.send("");
+ } else if (asyncStep == 5) {
+ asyncStep = 6;
+ log('async5: ' + req.responseText);
+ req.onreadystatechange = processStateChange;
+ req.open("GET", "resources/basic-auth/basic-auth.php?uid=6", true, "6", "%61");
+ req.send("");
+ } else if (asyncStep == 6) {
+ asyncStep = 7;
+ log('async6: ' + req.responseText);
+ req.onreadystatechange = processStateChange;
+ req.open("GET", "resources/basic-auth/basic-auth.php?uid=7", true, "7", "/@\\ \"#><?`");
+ req.send("");
+ } else if (asyncStep == 7) {
+ log('async7: ' + req.responseText);
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ } else {
+ log("async" + asyncStep + " failed with unexpected status: " + req.status + ". Response: '" + req.responseText + "'.");
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ }
+ }
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari6001415branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -1,5 +1,38 @@
</span><span class="cx"> 2015-02-13 Lucas Forschler <lforschler@apple.com>
</span><span class="cx">
</span><ins>+ Merge r179933
+
+ 2015-02-10 Alexey Proskuryakov <ap@apple.com>
+
+ URL::setUser and URL::setPass don't percent encode
+ https://bugs.webkit.org/show_bug.cgi?id=141453
+ rdar://problem/14844503&16551802&19623145
+
+ Reviewed by Darin Adler.
+
+ Tests: fast/url/url-credentials-escaping.html
+ http/tests/xmlhttprequest/basic-auth-credentials-escaping.html
+
+ Start adding some code that performs escaping in a way that matches the URL Standard.
+ Right now, it's only used where we failed to do any escaping at all, and over time,
+ we'll be moving towards a new implementation.
+
+ * html/URLUtils.h:
+ (WebCore::URLUtils<T>::username):
+ (WebCore::URLUtils<T>::password):
+ * platform/URL.cpp:
+ (WebCore::isSchemeFirstChar):
+ (WebCore::URL::user):
+ (WebCore::URL::pass):
+ (WebCore::URL::encodedUser):
+ (WebCore::URL::encodedPass):
+ (WebCore::URL::setUser):
+ (WebCore::URL::setPass):
+ (WebCore::encodeWithURLEscapeSequences):
+ * platform/URL.h:
+
+2015-02-13 Lucas Forschler <lforschler@apple.com>
+
</ins><span class="cx"> Merge r179772
</span><span class="cx">
</span><span class="cx"> 2015-02-06 Said Abou-Hallawa <sabouhallawa@apple.com>
</span></span></pre></div>
<a id="branchessafari6001415branchSourceWebCorehtmlURLUtilsh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.15-branch/Source/WebCore/html/URLUtils.h (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/Source/WebCore/html/URLUtils.h        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/html/URLUtils.h        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx"> template <typename T>
</span><span class="cx"> String URLUtils<T>::username() const
</span><span class="cx"> {
</span><del>- return href().user();
</del><ins>+ return href().encodedUser();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template <typename T>
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx"> template <typename T>
</span><span class="cx"> String URLUtils<T>::password() const
</span><span class="cx"> {
</span><del>- return href().pass();
</del><ins>+ return href().encodedPass();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> template <typename T>
</span></span></pre></div>
<a id="branchessafari6001415branchSourceWebCoreplatformURLcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/URL.cpp (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/URL.cpp        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/URL.cpp        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2004, 2007, 2008, 2011, 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2007, 2008, 2011, 2012, 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
</span><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -233,6 +233,108 @@
</span><span class="cx"> /* 252 */ BadChar, /* 253 */ BadChar, /* 254 */ BadChar, /* 255 */ BadChar
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+enum PercentEncodeCharacterClass {
+ // Class names match the URL Standard; each class is a superset of the previous one.
+ PercentEncodeSimple = 255,
+ PercentEncodeDefault = 127,
+ PercentEncodePassword = 63,
+ PercentEncodeUsername = 31,
+};
+
+static const unsigned char percentEncodeClassTable[256] = {
+ /* 0 nul */ PercentEncodeSimple, /* 1 soh */ PercentEncodeSimple, /* 2 stx */ PercentEncodeSimple, /* 3 etx */ PercentEncodeSimple,
+ /* 4 eot */ PercentEncodeSimple, /* 5 enq */ PercentEncodeSimple, /* 6 ack */ PercentEncodeSimple, /* 7 bel */ PercentEncodeSimple,
+ /* 8 bs */ PercentEncodeSimple, /* 9 ht */ PercentEncodeSimple, /* 10 nl */ PercentEncodeSimple, /* 11 vt */ PercentEncodeSimple,
+ /* 12 np */ PercentEncodeSimple, /* 13 cr */ PercentEncodeSimple, /* 14 so */ PercentEncodeSimple, /* 15 si */ PercentEncodeSimple,
+ /* 16 dle */ PercentEncodeSimple, /* 17 dc1 */ PercentEncodeSimple, /* 18 dc2 */ PercentEncodeSimple, /* 19 dc3 */ PercentEncodeSimple,
+ /* 20 dc4 */ PercentEncodeSimple, /* 21 nak */ PercentEncodeSimple, /* 22 syn */ PercentEncodeSimple, /* 23 etb */ PercentEncodeSimple,
+ /* 24 can */ PercentEncodeSimple, /* 25 em */ PercentEncodeSimple, /* 26 sub */ PercentEncodeSimple, /* 27 esc */ PercentEncodeSimple,
+ /* 28 fs */ PercentEncodeSimple, /* 29 gs */ PercentEncodeSimple, /* 30 rs */ PercentEncodeSimple, /* 31 us */ PercentEncodeSimple,
+ /* 32 sp */ PercentEncodeDefault,
+ /* 33 ! */ 0,
+ /* 34 " */ PercentEncodeDefault,
+ /* 35 # */ PercentEncodeDefault,
+ /* 36 $ */ 0,
+ /* 37 % */ 0,
+ /* 38 & */ 0,
+ /* 39 ' */ 0,
+ /* 40 ( */ 0,
+ /* 41 ) */ 0,
+ /* 42 * */ 0,
+ /* 43 + */ 0,
+ /* 44 , */ 0,
+ /* 45 - */ 0,
+ /* 46 . */ 0,
+ /* 47 / */ PercentEncodePassword,
+ /* 48 0 */ 0, /* 49 1 */ 0, /* 50 2 */ 0, /* 51 3 */ 0,
+ /* 52 4 */ 0, /* 53 5 */ 0, /* 54 6 */ 0, /* 55 7 */ 0,
+ /* 56 8 */ 0, /* 57 9 */ 0,
+ /* 58 : */ PercentEncodeUsername,
+ /* 59 ; */ 0,
+ /* 60 < */ PercentEncodeDefault,
+ /* 61 = */ 0,
+ /* 62 > */ PercentEncodeDefault,
+ /* 63 ? */ PercentEncodeDefault,
+ /* 64 @ */ PercentEncodePassword,
+ /* 65 A */ 0, /* 66 B */ 0, /* 67 C */ 0, /* 68 D */ 0,
+ /* 69 E */ 0, /* 70 F */ 0, /* 71 G */ 0, /* 72 H */ 0,
+ /* 73 I */ 0, /* 74 J */ 0, /* 75 K */ 0, /* 76 L */ 0,
+ /* 77 M */ 0, /* 78 N */ 0, /* 79 O */ 0, /* 80 P */ 0,
+ /* 81 Q */ 0, /* 82 R */ 0, /* 83 S */ 0, /* 84 T */ 0,
+ /* 85 U */ 0, /* 86 V */ 0, /* 87 W */ 0, /* 88 X */ 0,
+ /* 89 Y */ 0, /* 90 Z */ 0,
+ /* 91 [ */ 0,
+ /* 92 \ */ PercentEncodePassword,
+ /* 93 ] */ 0,
+ /* 94 ^ */ 0,
+ /* 95 _ */ 0,
+ /* 96 ` */ PercentEncodeDefault,
+ /* 97 a */ 0, /* 98 b */ 0, /* 99 c */ 0, /* 100 d */ 0,
+ /* 101 e */ 0, /* 102 f */ 0, /* 103 g */ 0, /* 104 h */ 0,
+ /* 105 i */ 0, /* 106 j */ 0, /* 107 k */ 0, /* 108 l */ 0,
+ /* 109 m */ 0, /* 110 n */ 0, /* 111 o */ 0, /* 112 p */ 0,
+ /* 113 q */ 0, /* 114 r */ 0, /* 115 s */ 0, /* 116 t */ 0,
+ /* 117 u */ 0, /* 118 v */ 0, /* 119 w */ 0, /* 120 x */ 0,
+ /* 121 y */ 0, /* 122 z */ 0,
+ /* 123 { */ 0,
+ /* 124 | */ 0,
+ /* 125 } */ 0,
+ /* 126 ~ */ 0,
+ /* 127 del */ PercentEncodeSimple,
+ /* 128 */ PercentEncodeSimple, /* 129 */ PercentEncodeSimple, /* 130 */ PercentEncodeSimple, /* 131 */ PercentEncodeSimple,
+ /* 132 */ PercentEncodeSimple, /* 133 */ PercentEncodeSimple, /* 134 */ PercentEncodeSimple, /* 135 */ PercentEncodeSimple,
+ /* 136 */ PercentEncodeSimple, /* 137 */ PercentEncodeSimple, /* 138 */ PercentEncodeSimple, /* 139 */ PercentEncodeSimple,
+ /* 140 */ PercentEncodeSimple, /* 141 */ PercentEncodeSimple, /* 142 */ PercentEncodeSimple, /* 143 */ PercentEncodeSimple,
+ /* 144 */ PercentEncodeSimple, /* 145 */ PercentEncodeSimple, /* 146 */ PercentEncodeSimple, /* 147 */ PercentEncodeSimple,
+ /* 148 */ PercentEncodeSimple, /* 149 */ PercentEncodeSimple, /* 150 */ PercentEncodeSimple, /* 151 */ PercentEncodeSimple,
+ /* 152 */ PercentEncodeSimple, /* 153 */ PercentEncodeSimple, /* 154 */ PercentEncodeSimple, /* 155 */ PercentEncodeSimple,
+ /* 156 */ PercentEncodeSimple, /* 157 */ PercentEncodeSimple, /* 158 */ PercentEncodeSimple, /* 159 */ PercentEncodeSimple,
+ /* 160 */ PercentEncodeSimple, /* 161 */ PercentEncodeSimple, /* 162 */ PercentEncodeSimple, /* 163 */ PercentEncodeSimple,
+ /* 164 */ PercentEncodeSimple, /* 165 */ PercentEncodeSimple, /* 166 */ PercentEncodeSimple, /* 167 */ PercentEncodeSimple,
+ /* 168 */ PercentEncodeSimple, /* 169 */ PercentEncodeSimple, /* 170 */ PercentEncodeSimple, /* 171 */ PercentEncodeSimple,
+ /* 172 */ PercentEncodeSimple, /* 173 */ PercentEncodeSimple, /* 174 */ PercentEncodeSimple, /* 175 */ PercentEncodeSimple,
+ /* 176 */ PercentEncodeSimple, /* 177 */ PercentEncodeSimple, /* 178 */ PercentEncodeSimple, /* 179 */ PercentEncodeSimple,
+ /* 180 */ PercentEncodeSimple, /* 181 */ PercentEncodeSimple, /* 182 */ PercentEncodeSimple, /* 183 */ PercentEncodeSimple,
+ /* 184 */ PercentEncodeSimple, /* 185 */ PercentEncodeSimple, /* 186 */ PercentEncodeSimple, /* 187 */ PercentEncodeSimple,
+ /* 188 */ PercentEncodeSimple, /* 189 */ PercentEncodeSimple, /* 190 */ PercentEncodeSimple, /* 191 */ PercentEncodeSimple,
+ /* 192 */ PercentEncodeSimple, /* 193 */ PercentEncodeSimple, /* 194 */ PercentEncodeSimple, /* 195 */ PercentEncodeSimple,
+ /* 196 */ PercentEncodeSimple, /* 197 */ PercentEncodeSimple, /* 198 */ PercentEncodeSimple, /* 199 */ PercentEncodeSimple,
+ /* 200 */ PercentEncodeSimple, /* 201 */ PercentEncodeSimple, /* 202 */ PercentEncodeSimple, /* 203 */ PercentEncodeSimple,
+ /* 204 */ PercentEncodeSimple, /* 205 */ PercentEncodeSimple, /* 206 */ PercentEncodeSimple, /* 207 */ PercentEncodeSimple,
+ /* 208 */ PercentEncodeSimple, /* 209 */ PercentEncodeSimple, /* 210 */ PercentEncodeSimple, /* 211 */ PercentEncodeSimple,
+ /* 212 */ PercentEncodeSimple, /* 213 */ PercentEncodeSimple, /* 214 */ PercentEncodeSimple, /* 215 */ PercentEncodeSimple,
+ /* 216 */ PercentEncodeSimple, /* 217 */ PercentEncodeSimple, /* 218 */ PercentEncodeSimple, /* 219 */ PercentEncodeSimple,
+ /* 220 */ PercentEncodeSimple, /* 221 */ PercentEncodeSimple, /* 222 */ PercentEncodeSimple, /* 223 */ PercentEncodeSimple,
+ /* 224 */ PercentEncodeSimple, /* 225 */ PercentEncodeSimple, /* 226 */ PercentEncodeSimple, /* 227 */ PercentEncodeSimple,
+ /* 228 */ PercentEncodeSimple, /* 229 */ PercentEncodeSimple, /* 230 */ PercentEncodeSimple, /* 231 */ PercentEncodeSimple,
+ /* 232 */ PercentEncodeSimple, /* 233 */ PercentEncodeSimple, /* 234 */ PercentEncodeSimple, /* 235 */ PercentEncodeSimple,
+ /* 236 */ PercentEncodeSimple, /* 237 */ PercentEncodeSimple, /* 238 */ PercentEncodeSimple, /* 239 */ PercentEncodeSimple,
+ /* 240 */ PercentEncodeSimple, /* 241 */ PercentEncodeSimple, /* 242 */ PercentEncodeSimple, /* 243 */ PercentEncodeSimple,
+ /* 244 */ PercentEncodeSimple, /* 245 */ PercentEncodeSimple, /* 246 */ PercentEncodeSimple, /* 247 */ PercentEncodeSimple,
+ /* 248 */ PercentEncodeSimple, /* 249 */ PercentEncodeSimple, /* 250 */ PercentEncodeSimple, /* 251 */ PercentEncodeSimple,
+ /* 252 */ PercentEncodeSimple, /* 253 */ PercentEncodeSimple, /* 254 */ PercentEncodeSimple, /* 255 */ PercentEncodeSimple
+};
+
</ins><span class="cx"> static int copyPathRemovingDots(char* dst, const char* src, int srcStart, int srcEnd);
</span><span class="cx"> static void encodeRelativeString(const String& rel, const TextEncoding&, CharBuffer& ouput);
</span><span class="cx"> static String substituteBackslashes(const String&);
</span><span class="lines">@@ -256,6 +358,8 @@
</span><span class="cx"> return (character | 0x20) == schemeCharacter;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String encodeWithURLEscapeSequences(const String& notEncodedString, PercentEncodeCharacterClass whatToEncode);
+
</ins><span class="cx"> // Copies the source to the destination, assuming all the source characters are
</span><span class="cx"> // ASCII. The destination buffer must be large enough. Null characters are allowed
</span><span class="cx"> // in the source string, and no attempt is made to null-terminate the result.
</span><span class="lines">@@ -598,19 +702,32 @@
</span><span class="cx"> return number;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String URL::user() const
+{
+ return decodeURLEscapeSequences(m_string.substring(m_userStart, m_userEnd - m_userStart));
+}
+
</ins><span class="cx"> String URL::pass() const
</span><span class="cx"> {
</span><span class="cx"> if (m_passwordEnd == m_userEnd)
</span><span class="cx"> return String();
</span><span class="cx">
</span><del>- return decodeURLEscapeSequences(m_string.substring(m_userEnd + 1, m_passwordEnd - m_userEnd - 1));
</del><ins>+ return decodeURLEscapeSequences(m_string.substring(m_userEnd + 1, m_passwordEnd - m_userEnd - 1));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-String URL::user() const
</del><ins>+String URL::encodedUser() const
</ins><span class="cx"> {
</span><del>- return decodeURLEscapeSequences(m_string.substring(m_userStart, m_userEnd - m_userStart));
</del><ins>+ return m_string.substring(m_userStart, m_userEnd - m_userStart);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+String URL::encodedPass() const
+{
+ if (m_passwordEnd == m_userEnd)
+ return String();
+
+ return m_string.substring(m_userEnd + 1, m_passwordEnd - m_userEnd - 1);
+}
+
</ins><span class="cx"> String URL::fragmentIdentifier() const
</span><span class="cx"> {
</span><span class="cx"> if (m_fragmentEnd == m_queryEnd)
</span><span class="lines">@@ -762,7 +879,7 @@
</span><span class="cx">
</span><span class="cx"> int end = m_userEnd;
</span><span class="cx"> if (!user.isEmpty()) {
</span><del>- String u = user;
</del><ins>+ String u = encodeWithURLEscapeSequences(user, PercentEncodeUsername);
</ins><span class="cx"> if (m_userStart == m_schemeEnd + 1)
</span><span class="cx"> u = "//" + u;
</span><span class="cx"> // Add '@' if we didn't have one before.
</span><span class="lines">@@ -784,12 +901,9 @@
</span><span class="cx"> if (!m_isValid)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- // FIXME: Non-ASCII characters must be encoded and escaped to match parse() expectations,
- // and to avoid changing more than just the user password.
-
</del><span class="cx"> int end = m_passwordEnd;
</span><span class="cx"> if (!password.isEmpty()) {
</span><del>- String p = ":" + password + "@";
</del><ins>+ String p = ":" + encodeWithURLEscapeSequences(password, PercentEncodePassword) + "@";
</ins><span class="cx"> if (m_userEnd == m_schemeEnd + 1)
</span><span class="cx"> p = "//" + p;
</span><span class="cx"> // Eat the existing '@' since we are going to add our own.
</span><span class="lines">@@ -1478,6 +1592,28 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String encodeWithURLEscapeSequences(const String& notEncodedString, PercentEncodeCharacterClass whatToEncode)
+{
+ CString asUTF8 = notEncodedString.utf8();
+
+ CharBuffer buffer(asUTF8.length() * 3 + 1);
+ char* p = buffer.data();
+
+ const char* str = asUTF8.data();
+ const char* strEnd = str + asUTF8.length();
+ while (str < strEnd) {
+ unsigned char c = *str++;
+ if (percentEncodeClassTable[c] >= whatToEncode)
+ appendEscapedChar(p, c);
+ else
+ *p++ = c;
+ }
+
+ ASSERT(p - buffer.data() <= static_cast<int>(buffer.size()));
+
+ return String(buffer.data(), p - buffer.data());
+}
+
</ins><span class="cx"> String encodeWithURLEscapeSequences(const String& notEncodedString)
</span><span class="cx"> {
</span><span class="cx"> CString asUTF8 = notEncodedString.utf8();
</span></span></pre></div>
<a id="branchessafari6001415branchSourceWebCoreplatformURLh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1.4.15-branch/Source/WebCore/platform/URL.h (180083 => 180084)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1.4.15-branch/Source/WebCore/platform/URL.h        2015-02-13 22:46:50 UTC (rev 180083)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/platform/URL.h        2015-02-13 22:57:28 UTC (rev 180084)
</span><span class="lines">@@ -113,6 +113,10 @@
</span><span class="cx"> bool hasFragmentIdentifier() const;
</span><span class="cx">
</span><span class="cx"> String baseAsString() const;
</span><ins>+ // Unlike user() and pass(), these functions don't decode escape sequences.
+ // This is necessary for accurate round-tripping, because encoding doesn't encode '%' characters.
+ String encodedUser() const;
+ String encodedPass() const;
</ins><span class="cx">
</span><span class="cx"> String fileSystemPath() const;
</span><span class="cx">
</span><span class="lines">@@ -252,6 +256,7 @@
</span><span class="cx"> String decodeURLEscapeSequences(const String&);
</span><span class="cx"> String decodeURLEscapeSequences(const String&, const TextEncoding&);
</span><span class="cx">
</span><ins>+// FIXME: This is a wrong concept to expose, different parts of a URL need different escaping per the URL Standard.
</ins><span class="cx"> String encodeWithURLEscapeSequences(const String&);
</span><span class="cx">
</span><span class="cx"> // Inlines.
</span></span></pre>
</div>
</div>
</body>
</html>