Skip to content
Permalink
Browse files

Use FrozenArray for Navigator#languages and MessageEvent#ports

[SameObject] cannot be used for ports because it is nullable, and "The
[SameObject] extended attribute must not be used on anything other than
a read only attribute whose type is an interface type or object."

It also can't be used for languages, simply because it can change.

Part of #11

Fixes https://www.w3.org/Bugs/Public/show_bug.cgi?id=23176
  • Loading branch information...
foolip committed Mar 11, 2016
1 parent 806874f commit e4df68a41b86753c7fcdd0d8ea4615f63ffc87e9
Showing with 24 additions and 25 deletions.
  1. +24 −25 source
49 source
<pre class="idl">[NoInterfaceObject, Exposed=(Window,Worker)]
interface <dfn>NavigatorLanguage</dfn> {
readonly attribute DOMString <span data-x="dom-navigator-language">language</span>;
readonly attribute DOMString[] <span data-x="dom-navigator-languages">languages</span>;
readonly attribute FrozenArray&lt;DOMString&gt; <span data-x="dom-navigator-languages">languages</span>;
};</pre>

<dl class="domintro">
<dt><dfn><code data-x="dom-navigator-languages">languages</code></dfn></dt>
<dd>

<p>Must return a <span data-x="dfn-read-only-array">read only</span> array of valid BCP 47
language tags representing either one or more <span data-x="a plausible language">plausible
languages</span>, or the user's preferred languages, ordered by preference with the most
preferred language first. The same object must be returned until the user agent needs to return
different values, or values in a different order. <ref spec=BCP47></p>
<p>Must return a <span>frozen array</span> of valid BCP 47 language tags representing either one
or more <span data-x="a plausible language">plausible languages</span>, or the user's preferred
languages, ordered by preference with the most preferred language first. The same object must be
returned until the user agent needs to return different values, or values in a different order.
<ref spec=BCP47></p>

<p>Whenever the user agent needs to make the <code
data-x="dom-navigator-languages">navigator.languages</code> attribute of a <code>Window</code>
readonly attribute USVString <span data-x="dom-MessageEvent-origin">origin</span>;
readonly attribute DOMString <span data-x="dom-MessageEvent-lastEventId">lastEventId</span>;
readonly attribute (<span>WindowProxy</span> or <span>MessagePort</span>)? <span data-x="dom-MessageEvent-source">source</span>;
readonly attribute <span>MessagePort</span>[]? <span data-x="dom-MessageEvent-ports">ports</span>;
readonly attribute FrozenArray&lt;<span>MessagePort</span>&gt;? <span data-x="dom-MessageEvent-ports">ports</span>;

void <span data-x="dom-MessageEvent-initMessageEvent">initMessageEvent</span>(DOMString type, boolean bubbles, boolean cancelable, any data, DOMString origin, DOMString lastEventId, (<span>WindowProxy</span> or <span>MessagePort</span>)? source, sequence&lt;<span>MessagePort</span>&gt;? ports);
};

<li><p>Let <var>message clone</var> be <var>cloneRecord</var>.[[Clone]].</p></li>

<li><p>Let <var>new ports</var> be a new <span data-x="dfn-read-only-array">read only</span>
array consisting of all <code>MessagePort</code> objects in
<var>cloneRecord</var>.[[TransferList]], if any, maintaining their relative order.</p></li>
<li><p>Let <var>new ports</var> be a new <span>frozen array</span> consisting of all
<code>MessagePort</code> objects in <var>cloneRecord</var>.[[TransferList]], if any, maintaining
their relative order.</p></li>

<li><p>Return from the <code data-x="dom-window-postMessage">postMessage()</code> method, but
<span>in parallel</span> continue running these steps.</p></li>

<li><p>Let <var>message clone</var> be <var>cloneRecord</var>.[[Clone]].</p></li>

<li><p>Let <var>new ports</var> be a new <span data-x="dfn-read-only-array">read only</span>
array consisting of all <code>MessagePort</code> objects in
<var>cloneRecord</var>.[[TransferList]], if any, maintaining their relative order.</p></li>
<li><p>Let <var>new ports</var> be a new <span>frozen array</span> consisting of all
<code>MessagePort</code> objects in <var>cloneRecord</var>.[[TransferList]], if any, maintaining
their relative order.</p></li>

<li><p>If there is no <var>target port</var> (i.e. if <var>source port</var>
is not entangled), or if <var>doomed</var> is true, then abort these steps.</p></li>
does not bubble, is not cancelable, has no default action, has a <code
data-x="dom-MessageEvent-data">data</code> attribute whose value is initialised to the empty
string, has a <code data-x="dom-MessageEvent-ports">ports</code> attribute whose value is
initialised to a <span data-x="dfn-read-only-array">read only</span> array containing
<var>inside port</var>, has a <code data-x="dom-MessageEvent-source">source</code> attribute
whose value is initialised to <var>inside port</var>. <span>Queue a task</span>, using the
<span>DOM manipulation task source</span>, to <span
data-x="concept-event-dispatch">dispatch</span> the event at <var>worker global
scope</var>.</p></li>
initialised to a new <span>frozen array</span> containing <var>inside port</var>, has a <code
data-x="dom-MessageEvent-source">source</code> attribute whose value is initialised to
<var>inside port</var>. <span>Queue a task</span>, using the <span>DOM manipulation task
source</span>, to <span data-x="concept-event-dispatch">dispatch</span> the event at <var>worker
global scope</var>.</p></li>

<li>

data-x="event-WorkerGlobalScope-connect">connect</code>, which does not bubble, is not
cancelable, has no default action, has a <code data-x="dom-MessageEvent-data">data</code>
attribute whose value is initialised to the empty string, has a <code
data-x="dom-MessageEvent-ports">ports</code> attribute whose value is initialised to a <span
data-x="dfn-read-only-array">read only</span> array containing only the newly created port,
and has a <code data-x="dom-MessageEvent-source">source</code> attribute whose value is
initialised to the newly created port. <span>Queue a task</span>, using the <span>DOM
manipulation task source</span>, to <span data-x="concept-event-dispatch">dispatch</span>
the event at <var>worker global scope</var>.</p></li>
data-x="dom-MessageEvent-ports">ports</code> attribute whose value is initialised to a new
<span>frozen array</span> containing only the newly created port, and has a <code
data-x="dom-MessageEvent-source">source</code> attribute whose value is initialised to the
newly created port. <span>Queue a task</span>, using the <span>DOM manipulation task
source</span>, to <span data-x="concept-event-dispatch">dispatch</span> the event at
<var>worker global scope</var>.</p></li>

<li>

0 comments on commit e4df68a

Please sign in to comment.
You can’t perform that action at this time.