Skip to content

Commit

Permalink
[] (0) Support IDNA when setting document.domain.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@1506 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Apr 29, 2008
1 parent 7c7d035 commit 1b2d50c
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 32 deletions.
60 changes: 44 additions & 16 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -27243,22 +27243,50 @@ never reset. This is nice and consistent.)
attribute on <code>Document</code> objects must be initialised to <a
href="#domain0">the document's domain</a>, if it has one, and the empty
string otherwise. On getting, the attribute must return its current value.
On setting, if the new value is an allowed value (as defined below), the
attribute's value must be changed to the new value, and the <a
href="#effective3">effective script origin</a> of the
<code>Document</code> must be changed so that its host part is the new
value and the port part is "manual override". If the new value is not an
allowed value, then a <a href="#security9">security exception</a> must be
raised instead.

<p>A new value is an allowed value for the <code
title=dom-document-domain><a href="#domain">document.domain</a></code>
attribute if it is equal to the attribute's current value, or if the
current value is not an IP address and the new value, prefixed by a U+002E
FULL STOP ("."), exactly matches the end of the current value.

<p class=big-issue>Should change this to a step-by-step algorithm so that
we can support both IDNA and punycode input.
On setting, the user agent must run the following algorithm:

<ol>
<li>
<p>Apply the IDNA ToASCII algorithm to the new value, with both the
AllowUnassigned and UseSTD3ASCIIRules flags set. Let <var title="">new
value</var> be the result of the ToASCII algorithm.</p>

<p>If ToASCII fails to convert one of the components of the string, e.g.
because it is too long or because it contains invalid characters, then
throw a <a href="#security9">security exception</a> and abort these
steps. <a href="#refsRFC3490">[RFC3490]</a></p>

<li>
<p>If <var title="">new value</var> is not exactly equal to the current
value of the <code title=dom-document-domain><a
href="#domain">document.domain</a></code> attribute, then run these
substeps:</p>

<ol>
<li>
<p>If the current value is an IP address, throw a <a
href="#security9">security exception</a> and abort these steps.</p>

<li>
<p>If <var title="">new value</var>, prefixed by a U+002E FULL STOP
("."), does not exactly match the end of the current value, throw a <a
href="#security9">security exception</a> and abort these steps.</p>
</ol>

<li>
<p>Set the attribute's value to <var title="">new value</var>.</p>

<li>
<p>Set the host part of the <a href="#effective3">effective script
origin</a> tuple of the <code>Document</code> to <var title="">new
value</var>.</p>

<li>
<p>Set the port part of the <a href="#effective3">effective script
origin</a> tuple of the <code>Document</code> to "manual override" (a
value that, for the purposes of comparing origins, is the same as
"manual override" but not the same as any other value).</p>
</ol>

<p>The <dfn id=domain0 title="the document's domain">domain</dfn> of a
<code>Document</code> is the host part of the document's <a
Expand Down
88 changes: 72 additions & 16 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -24964,22 +24964,78 @@ never reset. This is nice and consistent.)
attribute on <code>Document</code> objects must be initialised to
<span>the document's domain</span>, if it has one, and the empty
string otherwise. On getting, the attribute must return its current
value. On setting, if the new value is an allowed value (as defined
below), the attribute's value must be changed to the new value, and
the <span>effective script origin</span> of the
<code>Document</code> must be changed so that its host part is the
new value and the port part is "manual override". If the new value
is not an allowed value, then a <span>security exception</span> must
be raised instead.</p>

<p>A new value is an allowed value for the <code
title="dom-document-domain">document.domain</code> attribute if it
is equal to the attribute's current value, or if the current value
is not an IP address and the new value, prefixed by a U+002E FULL
STOP ("."), exactly matches the end of the current value.</p>

<p class="big-issue">Should change this to a step-by-step algorithm
so that we can support both IDNA and punycode input.</p>
value. On setting, the user agent must run the following
algorithm:</p>

<ol>

<li>

<p>Apply the IDNA ToASCII algorithm to the new value, with both
the AllowUnassigned and UseSTD3ASCIIRules flags set. Let <var
title="">new value</var> be the result of the ToASCII
algorithm.</p>

<p>If ToASCII fails to convert one of the components of the
string, e.g. because it is too long or because it contains invalid
characters, then throw a <span>security exception</span> and abort
these steps. <a href="#refsRFC3490">[RFC3490]</a></p>

</li>

<li>

<p>If <var title="">new value</var> is not exactly equal to the
current value of the <code
title="dom-document-domain">document.domain</code> attribute, then
run these substeps:</p>

<ol>

<li>

<p>If the current value is an IP address, throw a <span>security
exception</span> and abort these steps.</p>

</li>

<li>

<p>If <var title="">new value</var>, prefixed by a U+002E FULL
STOP ("."), does not exactly match the end of the current value,
throw a <span>security exception</span> and abort these
steps.</p>

</li>

</ol>

</li>

<li>

<p>Set the attribute's value to <var title="">new value</var>.</p>

</li>

<li>

<p>Set the host part of the <span>effective script origin</span>
tuple of the <code>Document</code> to <var title="">new
value</var>.</p>

</li>

<li>

<p>Set the port part of the <span>effective script origin</span>
tuple of the <code>Document</code> to "manual override" (a value
that, for the purposes of comparing origins, is the same as
"manual override" but not the same as any other value).</p>

</li>

</ol>

<p>The <dfn title="the document's domain">domain</dfn> of a
<code>Document</code> is the host part of the document's
Expand Down

0 comments on commit 1b2d50c

Please sign in to comment.