Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giow] (0) Add BroadcastChannel.close()
Affected topics: DOM APIs

git-svn-id: http://svn.whatwg.org/webapps@8661 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 6, 2014
1 parent 300e7de commit 5a73840
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 15 deletions.
34 changes: 29 additions & 5 deletions complete.html
Expand Up @@ -83494,6 +83494,7 @@ <h3 id=broadcasting-to-other-browsing-contexts><span class=secno>9.6 </span><dfn
interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget>EventTarget</a> {
readonly attribute DOMString <a href=#dom-broadcastchannel-name title=dom-BroadcastChannel-name>name</a>;
void <a href=#dom-broadcastchannel-postmessage title=dom-BroadcastChannel-postMessage>postMessage</a>(any message);
void <a href=#dom-broadcastchannel-close title=dom-BroadcastChannel-close>close</a>();
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-broadcastchannel-onmessage title=handler-BroadcastChannel-onmessage>onmessage</a>;
};</pre>

Expand Down Expand Up @@ -83521,15 +83522,23 @@ <h3 id=broadcasting-to-other-browsing-contexts><span class=secno>9.6 </span><dfn

</dd>

<dt><var title="">broadcastChannel</var> . <code title=dom-BroadcastChannel-close><a href=#dom-broadcastchannel-close>close</a></code>()</dt>

<dd>

<p>Closes the <code><a href=#broadcastchannel>BroadcastChannel</a></code> object, opening it up to garbage collection.</p>

</dd>

</dl><div class=impl>

<p>A <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn> and a
<dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>.</p>
<p>A <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn>, a
<dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>, and a <dfn id=concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</dfn>.</p>

<p>The <dfn id=dom-broadcastchannel title=dom-BroadcastChannel><code>BroadcastChannel()</code></dfn> constructor, when
invoked, must create and return a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#channel-name>channel
name</a> is the constructor's first argument, and whose <a href=#broadcastchannel-settings-object><code>BroadcastChannel</code>
settings object</a> is the <a href=#incumbent-settings-object>incumbent settings object</a>.</p>
name</a> is the constructor's first argument, whose <a href=#broadcastchannel-settings-object><code>BroadcastChannel</code>
settings object</a> is the <a href=#incumbent-settings-object>incumbent settings object</a>, and whose <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> is false.</p>

<p>The <dfn id=dom-broadcastchannel-name title=dom-BroadcastChannel-name><code>name</code></dfn> attribute must return the
<a href=#channel-name>channel name</a>.</p>
Expand Down Expand Up @@ -83571,6 +83580,9 @@ <h3 id=broadcasting-to-other-browsing-contexts><span class=secno>9.6 </span><dfn

<li><p>Their <a href=#channel-name>channel name</a> is a <a href=#case-sensitive>case-sensitive</a> match for <var title="">source channel</var>.</li>

<li><p>Their <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> is
false.</li>

</ul></li>

<li><p>Remove <var title="">source</var> from <var title="">destinations</var>.</li>
Expand Down Expand Up @@ -83609,11 +83621,23 @@ <h3 id=broadcasting-to-other-browsing-contexts><span class=secno>9.6 </span><dfn

</li>

</ol><p>While a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has an event listener registered for <code title=event-message><a href=#event-message>message</a></code> events, there must be a strong reference from <a href=#global-object>global
</ol><!--CLEANUP--><p>While a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed
flag</a> is false has an event listener registered for <code title=event-message><a href=#event-message>message</a></code> events, there must be a strong reference from <a href=#global-object>global
object</a> specified by the <code><a href=#broadcastchannel>BroadcastChannel</a></code> object's
<a href=#broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</a> to the <code><a href=#broadcastchannel>BroadcastChannel</a></code>
object itself.</p>

<p>The <dfn id=dom-broadcastchannel-close title=dom-BroadcastChannel-close><code>close()</code></dfn> method must set the
<a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> of the
<code><a href=#broadcastchannel>BroadcastChannel</a></code> object on which it was invoked to true.</p>

<p class=note>Authors are strongly encouraged to explicitly close <code><a href=#broadcastchannel>BroadcastChannel</a></code>
objects when they are no longer needed, so that they can be garbage collected. Creating many
<code><a href=#broadcastchannel>BroadcastChannel</a></code> objects and discarding them while leaving them with an event
listener and without closing them can lead to an apparent memory leak, since the objects will
continue to live for as long as they have an event listener (or until their page or worker is
closed).</p>

<hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event
handler IDL attributes</a>, by all objects implementing the <code><a href=#broadcastchannel>BroadcastChannel</a></code>
Expand Down
34 changes: 29 additions & 5 deletions index
Expand Up @@ -83494,6 +83494,7 @@ callback <dfn id=portcollectioncallback>PortCollectionCallback</dfn> = void (<a
interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget>EventTarget</a> {
readonly attribute DOMString <a href=#dom-broadcastchannel-name title=dom-BroadcastChannel-name>name</a>;
void <a href=#dom-broadcastchannel-postmessage title=dom-BroadcastChannel-postMessage>postMessage</a>(any message);
void <a href=#dom-broadcastchannel-close title=dom-BroadcastChannel-close>close</a>();
attribute <a href=#eventhandler>EventHandler</a> <a href=#handler-broadcastchannel-onmessage title=handler-BroadcastChannel-onmessage>onmessage</a>;
};</pre>

Expand Down Expand Up @@ -83521,15 +83522,23 @@ interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget

</dd>

<dt><var title="">broadcastChannel</var> . <code title=dom-BroadcastChannel-close><a href=#dom-broadcastchannel-close>close</a></code>()</dt>

<dd>

<p>Closes the <code><a href=#broadcastchannel>BroadcastChannel</a></code> object, opening it up to garbage collection.</p>

</dd>

</dl><div class=impl>

<p>A <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn> and a
<dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>.</p>
<p>A <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn>, a
<dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>, and a <dfn id=concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</dfn>.</p>

<p>The <dfn id=dom-broadcastchannel title=dom-BroadcastChannel><code>BroadcastChannel()</code></dfn> constructor, when
invoked, must create and return a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#channel-name>channel
name</a> is the constructor's first argument, and whose <a href=#broadcastchannel-settings-object><code>BroadcastChannel</code>
settings object</a> is the <a href=#incumbent-settings-object>incumbent settings object</a>.</p>
name</a> is the constructor's first argument, whose <a href=#broadcastchannel-settings-object><code>BroadcastChannel</code>
settings object</a> is the <a href=#incumbent-settings-object>incumbent settings object</a>, and whose <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> is false.</p>

<p>The <dfn id=dom-broadcastchannel-name title=dom-BroadcastChannel-name><code>name</code></dfn> attribute must return the
<a href=#channel-name>channel name</a>.</p>
Expand Down Expand Up @@ -83571,6 +83580,9 @@ interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget

<li><p>Their <a href=#channel-name>channel name</a> is a <a href=#case-sensitive>case-sensitive</a> match for <var title="">source channel</var>.</li>

<li><p>Their <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> is
false.</li>

</ul></li>

<li><p>Remove <var title="">source</var> from <var title="">destinations</var>.</li>
Expand Down Expand Up @@ -83609,11 +83621,23 @@ interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget

</li>

</ol><p>While a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object has an event listener registered for <code title=event-message><a href=#event-message>message</a></code> events, there must be a strong reference from <a href=#global-object>global
</ol><!--CLEANUP--><p>While a <code><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed
flag</a> is false has an event listener registered for <code title=event-message><a href=#event-message>message</a></code> events, there must be a strong reference from <a href=#global-object>global
object</a> specified by the <code><a href=#broadcastchannel>BroadcastChannel</a></code> object's
<a href=#broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</a> to the <code><a href=#broadcastchannel>BroadcastChannel</a></code>
object itself.</p>

<p>The <dfn id=dom-broadcastchannel-close title=dom-BroadcastChannel-close><code>close()</code></dfn> method must set the
<a href=#concept-broadcastchannel-closed title=concept-BroadcastChannel-closed>closed flag</a> of the
<code><a href=#broadcastchannel>BroadcastChannel</a></code> object on which it was invoked to true.</p>

<p class=note>Authors are strongly encouraged to explicitly close <code><a href=#broadcastchannel>BroadcastChannel</a></code>
objects when they are no longer needed, so that they can be garbage collected. Creating many
<code><a href=#broadcastchannel>BroadcastChannel</a></code> objects and discarding them while leaving them with an event
listener and without closing them can lead to an apparent memory leak, since the objects will
continue to live for as long as they have an event listener (or until their page or worker is
closed).</p>

<hr><p>The following are the <a href=#event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type title="event
handler event type">event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes>event
handler IDL attributes</a>, by all objects implementing the <code><a href=#broadcastchannel>BroadcastChannel</a></code>
Expand Down
37 changes: 32 additions & 5 deletions source
Expand Up @@ -92552,6 +92552,7 @@ callback <dfn>PortCollectionCallback</dfn> = void (<span>MessagePort</span> port
interface <dfn>BroadcastChannel</dfn> : <span>EventTarget</span> {
readonly attribute DOMString <span data-x="dom-BroadcastChannel-name">name</span>;
void <span data-x="dom-BroadcastChannel-postMessage">postMessage</span>(any message);
void <span data-x="dom-BroadcastChannel-close">close</span>();
attribute <span>EventHandler</span> <span data-x="handler-BroadcastChannel-onmessage">onmessage</span>;
};</pre>

Expand Down Expand Up @@ -92581,17 +92582,27 @@ interface <dfn>BroadcastChannel</dfn> : <span>EventTarget</span> {

</dd>

<dt><var data-x="">broadcastChannel</var> . <code data-x="dom-BroadcastChannel-close">close</code>()</dt>

<dd>

<p>Closes the <code>BroadcastChannel</code> object, opening it up to garbage collection.</p>

</dd>

</dl>

<div class="impl">

<p>A <code>BroadcastChannel</code> object has a <dfn>channel name</dfn> and a
<dfn><code>BroadcastChannel</code> settings object</dfn>.</p>
<p>A <code>BroadcastChannel</code> object has a <dfn>channel name</dfn>, a
<dfn><code>BroadcastChannel</code> settings object</dfn>, and a <dfn
data-x="concept-BroadcastChannel-closed">closed flag</dfn>.</p>

<p>The <dfn data-x="dom-BroadcastChannel"><code>BroadcastChannel()</code></dfn> constructor, when
invoked, must create and return a <code>BroadcastChannel</code> object whose <span>channel
name</span> is the constructor's first argument, and whose <span><code>BroadcastChannel</code>
settings object</span> is the <span>incumbent settings object</span>.</p>
name</span> is the constructor's first argument, whose <span><code>BroadcastChannel</code>
settings object</span> is the <span>incumbent settings object</span>, and whose <span
data-x="concept-BroadcastChannel-closed">closed flag</span> is false.</p>

<p>The <dfn data-x="dom-BroadcastChannel-name"><code>name</code></dfn> attribute must return the
<span>channel name</span>.</p>
Expand Down Expand Up @@ -92643,6 +92654,9 @@ interface <dfn>BroadcastChannel</dfn> : <span>EventTarget</span> {
<li><p>Their <span>channel name</span> is a <span>case-sensitive</span> match for <var
data-x="">source channel</var>.</p></li>

<li><p>Their <span data-x="concept-BroadcastChannel-closed">closed flag</span> is
false.</p></li>

</ul>

</li>
Expand Down Expand Up @@ -92690,12 +92704,25 @@ interface <dfn>BroadcastChannel</dfn> : <span>EventTarget</span> {

</ol>

<p>While a <code>BroadcastChannel</code> object has an event listener registered for <code
<!--CLEANUP-->
<p>While a <code>BroadcastChannel</code> object whose <span data-x="concept-BroadcastChannel-closed">closed
flag</span> is false has an event listener registered for <code
data-x="event-message">message</code> events, there must be a strong reference from <span>global
object</span> specified by the <code>BroadcastChannel</code> object's
<span><code>BroadcastChannel</code> settings object</span> to the <code>BroadcastChannel</code>
object itself.</p>

<p>The <dfn data-x="dom-BroadcastChannel-close"><code>close()</code></dfn> method must set the
<span data-x="concept-BroadcastChannel-closed">closed flag</span> of the
<code>BroadcastChannel</code> object on which it was invoked to true.</p>

<p class="note">Authors are strongly encouraged to explicitly close <code>BroadcastChannel</code>
objects when they are no longer needed, so that they can be garbage collected. Creating many
<code>BroadcastChannel</code> objects and discarding them while leaving them with an event
listener and without closing them can lead to an apparent memory leak, since the objects will
continue to live for as long as they have an event listener (or until their page or worker is
closed).</p>

<hr>

<p>The following are the <span>event handlers</span> (and their corresponding <span data-x="event
Expand Down

0 comments on commit 5a73840

Please sign in to comment.