Skip to content

Commit

Permalink
Restore DOMStringList so ancestorOrigins can use it
Browse files Browse the repository at this point in the history
This requires several follow-up changes:

* To DOM, so it’s no longer marked obsolete.
* To Indexed DB, to start making use of this definition and remove its
own version.
* To Service Workers, which can no longer use “ancestor origins array”.

Fixes whatwg#2179.
  • Loading branch information
annevk authored and Alice Boxhall committed Jan 7, 2019
1 parent 18330df commit 7a5285b
Showing 1 changed file with 70 additions and 15 deletions.
85 changes: 70 additions & 15 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2399,9 +2399,10 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<dfn data-x="map get" data-x-href="https://infra.spec.whatwg.org/#map-get">getting the value of an entry</dfn>, and
<dfn data-x="map set" data-x-href="https://infra.spec.whatwg.org/#map-set">setting the value of an entry</dfn></li>
<li>The <dfn data-x-href="https://infra.spec.whatwg.org/#list">list</dfn> data structure and the associated definitions for
<dfn data-x="list is empty" data-x-href="https://infra.spec.whatwg.org/#list-is-empty">is empty</dfn>,
<dfn data-x="list contains" data-x-href="https://infra.spec.whatwg.org/#list-contains">contains</dfn>,
<dfn data-x="list append" data-x-href="https://infra.spec.whatwg.org/#list-append">append</dfn>, and
<dfn data-x="list contains" data-x-href="https://infra.spec.whatwg.org/#list-contains">contains</dfn>,
<dfn data-x="list size" data-x-href="https://infra.spec.whatwg.org/#list-size">size</dfn>,
<dfn data-x="list is empty" data-x-href="https://infra.spec.whatwg.org/#list-is-empty">is empty</dfn>, and
<dfn data-x="list iterate" data-x-href="https://infra.spec.whatwg.org/#list-iterate">iterate</dfn></li>
<li>The <dfn data-x-href="https://infra.spec.whatwg.org/#stack">stack</dfn> data structure and the associated definitions for
<dfn data-x="stack push" data-x-href="https://infra.spec.whatwg.org/#stack-push">push</dfn> and
Expand Down Expand Up @@ -7658,6 +7659,60 @@ https://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E.
</div>


<h4>The <code>DOMStringList</code> interface</h4>

<p>The <code>DOMStringList</code> interface is a non-fashionable retro way of representing a list
of strings.</p>

<pre class="idl">[Exposed=(Window,Worker)]
interface <dfn>DOMStringList</dfn> {
readonly attribute unsigned long <span data-x="dom-DOMStringList-length">length</span>;
getter DOMString? <span data-x="dom-DOMStringList-item">item</span>(unsigned long index);
boolean <span data-x="dom-DOMStringList-contains">contains</span>(DOMString string);
};</pre>

<p w-nodev class="warning">New APIs must use <code data-x="">sequence&lt;DOMString></code> or
equivalent rather than <code>DOMStringList</code>.</p>

<dl class="domintro">

<dt><var>strings</var> . <code subdfn data-x="dom-DOMStringList-length">length</code></dt>
<dd><p>Returns the number of strings in <var>strings</var>.</p></dd>

<dt><var>strings</var>[<var>index</var>]</dt>
<dt><var>strings</var> . <code subdfn data-x="dom-DOMStringList-item">item</code>(<var>index</var>)</dt>
<dd><p>Returns the string with index <var>index</var> from <var>strings</var>.</p></dd>

<dt><var>strings</var> . <code subdfn data-x="dom-DOMStringList-contains">contains</code>(<var>string</var>)</dt>
<dd><p>Returns true if <var>strings</var> contains <var>string</var>, and false
otherwise.</p></dd>
</dl>

<div w-nodev>

<p>Each <code>DOMStringList</code> object has an associated <span>list</span>.</p>

<p>The <span>supported property indices</span> for a <code>DOMStringList</code> object are the
numbers zero to the associated list's <span data-x="list size">size</span> minus one. If its
associated list <span data-x="list is empty">is empty</span>, it has no <span>supported property
indices</span>.</p>

<p>The <dfn data-x="dom-DOMStringList-length"><code>length</code></dfn> attribute's getter must
this <code>DOMStringList</code> object's associated list's <span data-x="list
size">size</span>.</p>

<p>The <dfn data-x="dom-DOMStringList-item"><code>item(<var>index</var>)</code></dfn> method, when
invoked, must return the <var>index</var>th item in this <code>DOMStringList</code> object's
associated list, or null if <var>index</var> plus one is less than this <code>DOMStringList</code>
object's associated list's <span data-x="list size">size</span>.</p>

<p>The <dfn data-x="dom-DOMStringList-contains"><code>contains(<var>string</var>)</code></dfn>
method, when invoked, must return true if this <code>DOMStringList</code> object's associated list
<span data-x="list contains">contains</span> <var>string</var>, and false otherwise.</p>

</div>


<div w-nodev>

<h4>Garbage collection</h4>
Expand Down Expand Up @@ -80759,7 +80814,7 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
[Unforgeable] void <span data-x="dom-location-replace">replace</span>(USVString url);
[Unforgeable] void <span data-x="dom-location-reload">reload</span>();

[Unforgeable, SameObject] readonly attribute FrozenArray&lt;USVString&gt; <span data-x="dom-location-ancestorOrigins">ancestorOrigins</span>;
[Unforgeable, SameObject] readonly attribute <span>DOMStringList</span> <span data-x="dom-location-ancestorOrigins">ancestorOrigins</span>;
};</pre>

<dl class="domintro">
Expand Down Expand Up @@ -80840,9 +80895,9 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O

<dt><var>location</var> . <code subdfn data-x="dom-location-ancestorOrigins">ancestorOrigins</code></dt>
<dd>
<p>Returns an array whose values are the origins of the ancestor <span data-x="browsing
context">browsing contexts</span>, from the <span>parent browsing context</span> to the
<span>top-level browsing context</span>.</p>
<p>Returns a <code>DOMStringList</code> object listing the origins of the ancestor <span
data-x="browsing context">browsing contexts</span>, from the <span>parent browsing
context</span> to the <span>top-level browsing context</span>.</p>
</dd>
</dl>

Expand All @@ -80857,14 +80912,14 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
data-x="concept-document-url">URL</span>.</p>

<p>A <code>Location</code> object has an associated <dfn
data-x="concept-location-ancestor-origins-array">ancestor origins array</dfn>. When a
data-x="concept-location-ancestor-origins-list">ancestor origins list</dfn>. When a
<code>Location</code> object is created, its <span
data-x="concept-location-ancestor-origins-array">ancestor origins array</span> must be set to a
<span>frozen array</span> created from the list of strings that the following steps would
produce:</p>
data-x="concept-location-ancestor-origins-list">ancestor origins list</span> must be set to a
<code>DOMStringList</code> object whose associated list is the <span>list</span> of strings that
the following steps would produce:</p>

<ol>
<li><p>Let <var>output</var> be an empty ordered list of strings.</p></li>
<li><p>Let <var>output</var> be a new <span>list</span> of strings.</p></li>

<li><p>Let <var>current</var> be the <span data-x="concept-document-bc">browsing context</span>
of the <code>Document</code> with which this <code>Location</code> object is associated.</p></li>
Expand All @@ -80875,9 +80930,9 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<li><p>Let <var>current</var> be <var>current</var>'s <span>parent browsing
context</span>.</p></li>

<li><p>Append the <span data-x="Unicode serialization of an origin">Unicode serialization</span>
of <var>current</var>'s <span>active document</span>'s <span>origin</span> to <var>output</var>
as a new value.</p></li>
<li><p><span data-x="list append">Append</span> the <span data-x="Unicode serialization of an
origin">Unicode serialization</span> of <var>current</var>'s <span>active document</span>'s
<span>origin</span> to <var>output</var>.</p></li>

<li><p>Return to the step labeled <i>loop</i>.</p></li>

Expand Down Expand Up @@ -81402,7 +81457,7 @@ State: &lt;OUTPUT NAME=I>1&lt;/OUTPUT> &lt;INPUT VALUE="Increment" TYPE=BUTTON O
<span>"<code>SecurityError</code>"</span> <code>DOMException</code>.</p></li>

<li><p>Otherwise, return this <code>Location</code> object's <span
data-x="concept-location-ancestor-origins-array">ancestor origins array</span>.</p></li>
data-x="concept-location-ancestor-origins-list">ancestor origins list</span>.</p></li>
</ol>

<hr>
Expand Down

0 comments on commit 7a5285b

Please sign in to comment.