Skip to content

Commit dc9d831

Browse files
annevkdomenic
authored andcommitted
IDNA: use proposed UTS46 flags to avoid breaking YouTube
Tests: web-platform-tests/wpt#5976. Fixes #53 and fixes #267 by no longer breaking on hyphens in the 3rd and 4th position of a domain label. This is known to break YouTube: r3---sn-2gb7ln7k.googlevideo.com. This is fixed by setting the proposed CheckHyphens flag to false. Fixes #110 by clarifying that BIDI and CONTEXTJ checks are to be done by setting the proposed CheckBidi and CheckJoiners flags to true. Follow-up #313 is filed to remove the proposed bits once Unicode is updated. #317 also tracks a potential cleanup.
1 parent c643963 commit dc9d831

1 file changed

Lines changed: 26 additions & 19 deletions

File tree

url.bs

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -278,28 +278,35 @@ U+005C (\), or U+005D (]).
278278

279279
<h3 id=idna>IDNA</h3>
280280

281-
<p>The <dfn id=concept-domain-to-ascii>domain to ASCII</dfn> given a
282-
<a>domain</a> <var>domain</var>, runs these steps:
281+
<p>The <dfn id=concept-domain-to-ascii>domain to ASCII</dfn> algorithm, given a <a>domain</a>
282+
<var>domain</var> and optionally a boolean <var>beStrict</var>, runs these steps:
283283

284284
<ol>
285-
<li><p>Let <var>result</var> be the result of running <a abstract-op lt=ToASCII>Unicode ToASCII</a> with
286-
<i>domain_name</i> set to <var>domain</var>, <i>UseSTD3ASCIIRules</i> set to false,
287-
<i>processing_option</i> set to <i>Nontransitional_Processing</i>, and <i>VerifyDnsLength</i> set
288-
to false.
285+
<li><p>If <var>beStrict</var> is not given, set it to false.
286+
287+
<li>
288+
<p>Let <var>result</var> be the result of running <a abstract-op lt=ToASCII>Unicode ToASCII</a>
289+
with <i>domain_name</i> set to <var>domain</var>, <i>UseSTD3ASCIIRules</i> set to
290+
<var>beStrict</var>, <i>CheckHyphens</i> set to false, <i>CheckBidi</i> set to true,
291+
<i>CheckJoiners</i> set to true, <i>processing_option</i> set to
292+
<i>Nontransitional_Processing</i>, and <i>VerifyDnsLength</i> set to <var>beStrict</var>.
293+
294+
<p class="XXX">This and <a>domain to Unicode</a> below are based on a proposed revision. See
295+
<a href="https://github.com/whatwg/url/issues/313">issue #313</a>.
289296

290297
<li><p>If <var>result</var> is a failure value, <a>validation error</a>, return failure.
291298

292299
<li><p>Return <var>result</var>.
293300
</ol>
294301

295-
<p>The <dfn id=concept-domain-to-unicode>domain to Unicode</dfn> given a
296-
<a>domain</a> <var>domain</var>, runs these steps:
302+
<p>The <dfn id=concept-domain-to-unicode>domain to Unicode</dfn> algorithm, given a <a>domain</a>
303+
<var>domain</var>, runs these steps:
297304

298305
<ol>
299306
<li><p>Let <var>result</var> be the result of running
300-
<a abstract-op lt=ToUnicode>Unicode ToUnicode</a> with
301-
<i>domain_name</i> set to <var>domain</var>,
302-
<i>UseSTD3ASCIIRules</i> set to false.
307+
<a abstract-op lt=ToUnicode>Unicode ToUnicode</a> with <i>domain_name</i> set to <var>domain</var>,
308+
<i>CheckHyphens</i> set to false, <i>CheckBidi</i> set to true, <i>CheckJoiners</i> set to true,
309+
and <i>UseSTD3ASCIIRules</i> set to false.
303310

304311
<li><p>Signify <a>validation errors</a> for any returned errors, and then, return
305312
<var>result</var>.
@@ -315,16 +322,16 @@ U+005C (\), or U+005D (]).
315322
<p>A <var>domain</var> is a <dfn>valid domain</dfn> if these steps return success:
316323

317324
<ol>
318-
<li><p>Let <var>result</var> be the result of running
319-
<a abstract-op lt=ToASCII>Unicode ToASCII</a> with
320-
<i>domain_name</i> set to <var>domain</var>,
321-
<i>UseSTD3ASCIIRules</i> set to true, <i>processing_option</i> set to
322-
<i>Nontransitional_Processing</i>, and <i>VerifyDnsLength</i> set to true.
325+
<li><p>Let <var>result</var> be the result of running <a>domain to ASCII</a> with <var>domain</var>
326+
and true.
323327

324-
<li><p>If <var>result</var> is a failure value, return failure.
328+
<li><p>If <var>result</var> is failure, then return failure.
325329

326330
<li><p>Set <var>result</var> to the result of running
327-
<a abstract-op lt=ToUnicode>Unicode ToUnicode</a> with
331+
<a abstract-op lt=ToUnicode>Unicode ToUnicode</a> with <i>domain_name</i> set to <var>result</var>,
332+
<i>CheckHyphens</i> set to false, <i>CheckBidi</i> set to true, <i>CheckJoiners</i> set to true,
333+
and <i>UseSTD3ASCIIRules</i> set to true.
334+
328335
<i>domain_name</i> set to <var>result</var>,
329336
<i>UseSTD3ASCIIRules</i> set to true.
330337

@@ -3152,7 +3159,7 @@ spec: MEDIA-SOURCE; urlPrefix: https://w3c.github.io/media-source/#idl-def-
31523159
type: interface; text: MediaSource
31533160
spec: MEDIACAPTURE-STREAMS; urlPrefix: https://w3c.github.io/mediacapture-main/#idl-def-
31543161
type: interface; text: MediaStream
3155-
spec: UTS46; urlPrefix: http://www.unicode.org/reports/tr46/
3162+
spec: UTS46; urlPrefix: http://www.unicode.org/reports/tr46/proposed.html
31563163
type: abstract-op; text: ToASCII; url: #ToASCII
31573164
type: abstract-op; text: ToUnicode; url: #ToUnicode
31583165
</pre>

0 commit comments

Comments
 (0)