[html5] r8661 - [giow] (0) Add BroadcastChannel.close() Affected topics: DOM APIs

whatwg at whatwg.org whatwg at whatwg.org
Fri Jun 6 14:38:19 PDT 2014


Author: ianh
Date: 2014-06-06 14:38:15 -0700 (Fri, 06 Jun 2014)
New Revision: 8661

Modified:
   complete.html
   index
   source
Log:
[giow] (0) Add BroadcastChannel.close()
Affected topics: DOM APIs

Modified: complete.html
===================================================================
--- complete.html	2014-06-06 21:27:35 UTC (rev 8660)
+++ complete.html	2014-06-06 21:38:15 UTC (rev 8661)
@@ -83494,6 +83494,7 @@
 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>
 
@@ -83521,15 +83522,23 @@
 
    </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>
@@ -83571,6 +83580,9 @@
 
      <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>
@@ -83609,11 +83621,23 @@
 
    </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>

Modified: index
===================================================================
--- index	2014-06-06 21:27:35 UTC (rev 8660)
+++ index	2014-06-06 21:38:15 UTC (rev 8661)
@@ -83494,6 +83494,7 @@
 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>
 
@@ -83521,15 +83522,23 @@
 
    </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>
@@ -83571,6 +83580,9 @@
 
      <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>
@@ -83609,11 +83621,23 @@
 
    </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>

Modified: source
===================================================================
--- source	2014-06-06 21:27:35 UTC (rev 8660)
+++ source	2014-06-06 21:38:15 UTC (rev 8661)
@@ -92552,6 +92552,7 @@
 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>
 
@@ -92581,17 +92582,27 @@
 
    </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>
@@ -92643,6 +92654,9 @@
      <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>
@@ -92690,12 +92704,25 @@
 
   </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



More information about the Commit-Watchers mailing list