Diff
Modified: trunk/LayoutTests/ChangeLog (236526 => 236527)
--- trunk/LayoutTests/ChangeLog 2018-09-26 21:53:14 UTC (rev 236526)
+++ trunk/LayoutTests/ChangeLog 2018-09-26 21:56:31 UTC (rev 236527)
@@ -1,3 +1,12 @@
+2018-09-26 Alex Christensen <achristen...@webkit.org>
+
+ uidna_nameToASCII only needs a buffer capacity of 64
+ https://bugs.webkit.org/show_bug.cgi?id=190006
+
+ Reviewed by Chris Dumez.
+
+ * fast/dom/DOMURL/parsing.html:
+
2018-09-26 Ryosuke Niwa <rn...@webkit.org>
Selection should work across shadow boundary when initiated by a mouse drag
Modified: trunk/LayoutTests/fast/dom/DOMURL/parsing-expected.txt (236526 => 236527)
--- trunk/LayoutTests/fast/dom/DOMURL/parsing-expected.txt 2018-09-26 21:53:14 UTC (rev 236526)
+++ trunk/LayoutTests/fast/dom/DOMURL/parsing-expected.txt 2018-09-26 21:56:31 UTC (rev 236527)
@@ -14,6 +14,7 @@
PASS breakDownURL('http://a:b@c:1/e/f?g%h') is 'protocol=http:, username=a, password=b, hostname=c, host=c:1, port=1, pathname=/e/f, search=?g%h, origin=http://c:1'
PASS breakDownURL('http://ex%61mple.com/') is 'protocol=http:, host=example.com, pathname=/, origin=http://example.com, toString=http://example.com/'
PASS breakDownURL('http://ex%2fmple.com/') threw exception TypeError: Type error.
+PASS i is 54
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/dom/DOMURL/parsing.html (236526 => 236527)
--- trunk/LayoutTests/fast/dom/DOMURL/parsing.html 2018-09-26 21:53:14 UTC (rev 236526)
+++ trunk/LayoutTests/fast/dom/DOMURL/parsing.html 2018-09-26 21:56:31 UTC (rev 236527)
@@ -57,4 +57,14 @@
shouldBe("breakDownURL('http://ex%61mple.com/')", "'protocol=http:, host=example.com, pathname=/, origin=http://example.com, toString=http://example.com/'");
shouldThrow("breakDownURL('http://ex%2fmple.com/')");
+var longUnicodeDomain = "\u1234";
+var i = 0;
+try {
+ for (i = 0; i < 100; ++i) {
+ longUnicodeDomain += "a"
+ new URL("http://" + longUnicodeDomain + "/");
+ }
+} catch (e) { }
+shouldBe("i", "54");
+
</script>
Modified: trunk/Source/WebCore/ChangeLog (236526 => 236527)
--- trunk/Source/WebCore/ChangeLog 2018-09-26 21:53:14 UTC (rev 236526)
+++ trunk/Source/WebCore/ChangeLog 2018-09-26 21:56:31 UTC (rev 236527)
@@ -1,5 +1,18 @@
2018-09-26 Alex Christensen <achristen...@webkit.org>
+ uidna_nameToASCII only needs a buffer capacity of 64
+ https://bugs.webkit.org/show_bug.cgi?id=190006
+
+ Reviewed by Chris Dumez.
+
+ This is specified in https://www.unicode.org/reports/tr46/#ToASCII
+ This is how Chrome and Firefox also behave with long unicode hosts.
+
+ * platform/URLParser.cpp:
+ (WebCore::URLParser::domainToASCII):
+
+2018-09-26 Alex Christensen <achristen...@webkit.org>
+
URLWithUserTypedString should return nil for URLs deemed to be invalid by WebCore::URL
https://bugs.webkit.org/show_bug.cgi?id=189979
<rdar://problem/44119696>
Modified: trunk/Source/WebCore/platform/URLParser.cpp (236526 => 236527)
--- trunk/Source/WebCore/platform/URLParser.cpp 2018-09-26 21:53:14 UTC (rev 236526)
+++ trunk/Source/WebCore/platform/URLParser.cpp 2018-09-26 21:56:31 UTC (rev 236527)
@@ -620,7 +620,6 @@
template<typename CharacterType>
void URLParser::encodeQuery(const Vector<UChar>& source, const TextEncoding& encoding, CodePointIterator<CharacterType> iterator)
{
- // FIXME: It is unclear in the spec what to do when encoding fails. The behavior should be specified and tested.
auto encoded = encoding.encode(StringView(source.data(), source.size()), UnencodableHandling::URLEncodedEntities);
auto* data = ""
size_t length = encoded.size();
@@ -2568,11 +2567,12 @@
return ascii;
}
- UChar hostnameBuffer[defaultInlineBufferSize];
+ const size_t maxDomainLength = 64;
+ UChar hostnameBuffer[maxDomainLength];
UErrorCode error = U_ZERO_ERROR;
UIDNAInfo processingDetails = UIDNA_INFO_INITIALIZER;
- int32_t numCharactersConverted = uidna_nameToASCII(&internationalDomainNameTranscoder(), StringView(domain).upconvertedCharacters(), domain.length(), hostnameBuffer, defaultInlineBufferSize, &processingDetails, &error);
- ASSERT(numCharactersConverted <= static_cast<int32_t>(defaultInlineBufferSize));
+ int32_t numCharactersConverted = uidna_nameToASCII(&internationalDomainNameTranscoder(), StringView(domain).upconvertedCharacters(), domain.length(), hostnameBuffer, maxDomainLength, &processingDetails, &error);
+ ASSERT(numCharactersConverted <= static_cast<int32_t>(maxDomainLength));
if (U_SUCCESS(error) && !processingDetails.errors) {
for (int32_t i = 0; i < numCharactersConverted; ++i) {
@@ -2584,8 +2584,6 @@
syntaxViolation(iteratorForSyntaxViolationPosition);
return ascii;
}
-
- // FIXME: Check for U_BUFFER_OVERFLOW_ERROR and retry with an allocated buffer.
return std::nullopt;
}