discovery-api/Overview.src.html
changeset 250 8b912f2bb9c7
parent 243 220f3226b2a1
child 254 f29ec967fb3b
--- a/discovery-api/Overview.src.html	Tue Oct 02 17:01:27 2012 -0400
+++ b/discovery-api/Overview.src.html	Wed Oct 03 02:40:46 2012 +0200
@@ -132,9 +132,9 @@
         well-known discovery service type that it wishes to interact with.
       </p>
       <p>
-        The user agent, having captured all advertised services on the network from the Service Discovery mechanisms
-        included in this recommendation, attempts to match the requested service type to a discovered service according
-        to the processing described herein.
+        The user agent, having captured all advertised services on the network from the <a>service discovery
+        mechanisms</a> included in this recommendation, attempts to match the requested service type to a discovered
+        service according to the processing described herein.
       </p>
       <p>
         If a service connectivity request is successful then the Web page is provided with the necessary information to
@@ -213,25 +213,24 @@
         are to be interpreted as requirements on user agents.
       </p>
       <p>
-        Conformance requirements phrased as algorithms or specific steps MAY be implemented in any
-        manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification
-        are intended to be easy to follow, and not intended to be performant.)
+        Conformance requirements phrased as algorithms or specific steps MAY be implemented in any manner, so long as
+        the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be
+        easy to follow, and not intended to be performant.)
       </p>
       <p>
         The only conformance class defined by this specification is a <dfn>user agent</dfn>.
       </p>
       <p>
-        User agents MAY impose implementation-specific limits on otherwise unconstrained inputs,
-        e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around
-        platform-specific limitations.
+        User agents MAY impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial
+        of service attacks, to guard against running out of memory, or to work around platform-specific limitations.
       </p>
       <p>
         When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid
-        in development, or for performance reasons), user agents MUST act as if they had no support
-        for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a
-        particular feature is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted
-        from the objects that implement that interface - leaving the attribute on the object but making it return null
-        or throw an exception is insufficient.
+        in development, or for performance reasons), user agents MUST act as if they had no support for the feature
+        whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature
+        is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted from the objects
+        that implement that interface - leaving the attribute on the object but making it return null or throw an
+        exception is insufficient.
       </p>
       <section>
         <h3>
@@ -357,8 +356,7 @@
           <p>
             When the <dfn id="dom-navigator-getnetworkservices"
                title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[,
-               errorCallback])</code></dfn> method is called, the <a>user agent</a> MUST run the
-               following steps:
+               errorCallback])</code></dfn> method is called, the <a>user agent</a> MUST run the following steps:
           </p>
           <ol class="rule">
             <li>Let <var>requested control types</var> be initially set to an empty array.
@@ -408,8 +406,8 @@
                 </li>
               </ol>
             </li>
-            <li>If <var>services found</var> is an empty array, then the <a>user agent</a> MUST
-            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
+            <li>If <var>services found</var> is an empty array, then the <a>user agent</a> MUST <a href=
+            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
                   class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an
                   object of type <code>Function</code>, with a new <a href=
                   "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href=
@@ -431,9 +429,8 @@
                   "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
                   argument, abort any remaining steps and return.
             </li>
-            <li>The <a>user agent</a> MUST prompt the user in a user-agent-specific manner for
-            permission to provide the <a href=
-            "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
+            <li>The <a>user agent</a> MUST prompt the user in a user-agent-specific manner for permission to provide
+            the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
                   class="externalDFN">entry script</a>'s <a href=
                   "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
                   class="externalDFN">origin</a> with an array of <a href=
@@ -477,11 +474,16 @@
             </li>
             <li>Set <var>services manager</var>'s <a href=
             "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of
-            services currently found in the <a>list of available service records</a> whose <code>type</code> property
+            items currently found in the <a>list of available service records</a> whose <code>type</code> property
             matches any of the tokens requested in <var>requested control types</var>.
             </li>
-            <li>Add the set of <var>services</var> to the <a>list of authorized service records</a> internally against
-            the newly created <var>services manager</var> object.
+            <li>Add <var>services</var> to the <var>services manager</var> object as its collection of <a>indexed
+            properties</a>.
+            </li>
+            <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a>
+            attribute to the number of items in <var>services</var>.
+            </li>
+            <li>Add <var>services manager</var> to the <a>list of active service managers</a>.
             </li>
             <li>The <a>user agent</a> MUST <a href=
             "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
@@ -499,9 +501,9 @@
           </p>
           <p>
             When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the
-            <a>user agent</a> MUST add the <code>url</code> property to the <dfn>entry script
-            origin's URL whitelist</dfn>. This list enables the Web page to override and initiate cross-site resource
-            requests towards these URLs, and any sub-resources of these URLs, within the current <a href=
+            <a>user agent</a> MUST add the <code>url</code> property to the <dfn>entry script origin's URL
+            whitelist</dfn>. This list enables the Web page to override and initiate cross-site resource requests
+            towards these URLs, and any sub-resources of these URLs, within the current <a href=
             "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
                class="externalDFN">entry script</a>'s <a href=
                "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
@@ -617,8 +619,8 @@
           </dt>
           <dd>
             <p>
-              Returns the current number of services belonging in the respective object's <a>list of authorized service
-              records</a>.
+              Returns the current number of items in the current object's collection of <a href=
+              "#networkservice"><code>NetworkService</code></a> objects.
             </p>
           </dd>
           <dt>
@@ -627,22 +629,21 @@
           </dt>
           <dd>
             <p>
-              Returns the current number of services matching one of the app-requested <a>valid service type</a> tokens
-              in the <a>list of available service records</a>.
+              Returns the current number of items matching one of the app-requested <a>valid service type</a> tokens in
+              the <a>list of available service records</a>.
             </p>
           </dd>
         </dl>
         <div>
           <p>
-            The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute MUST
-            return the number of services represented in the object's corresponding <a>list of authorized service
-            records</a> at the time of getting.
+            The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute MUST return the number of
+            <a href="#networkservice"><code>NetworkService</code></a> objects represented by the collection.
           </p>
           <p>
-            The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute
-            MUST return the number of services in the <a>list of available service records</a>
-            whose <code>type</code> attribute matches any of the <a>valid service type</a> tokens that was initially
-            used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object.
+            The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute MUST
+            return the number of services in the <a>list of available service records</a> whose <code>type</code>
+            attribute matches any of the <a>valid service type</a> tokens that was initially used to create the current
+            <a href="#networkservices"><code>NetworkServices</code></a> object.
           </p>
         </div>
       </section>
@@ -673,11 +674,10 @@
           </dd>
         </dl>
         <p>
-          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of one or
-          more current authorized services - the <a>list of authorized service records</a>. Each item in the <a>list of
-          authorized service records</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a>
-          object. The <a>list of authorized service records</a> is <span>immutable</span> meaning that it cannot be
-          modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object.
+          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of one
+          or more <a href="#networkservice"><code>NetworkService</code></a> objects. A <a href=
+          "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that it cannot
+          be modified.
         </p>
         <p class="note">
           Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the
@@ -688,25 +688,23 @@
           "http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#supported-property-indices"
              class="externalDFN">supported property indices</a> of <a href=
              "#networkservices"><code>NetworkServices</code></a> objects at any instant are the numbers from zero to
-             the number of items in the <a>list of authorized service records</a> represented by the respective object
-             minus one, if any services are represented in the <a>list of authorized service records</a>.
+             the number of the <a href="#networkservice"><code>NetworkService</code></a> objects in the collection
+             minus one.
         </p>
         <p>
           To <a href=
           "http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property"
              class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a
-             <a href="#networkservices"><code>NetworkServices</code></a> object's <a>list of authorized service
-             records</a>, the user agent MUST return the <a href=
-             "#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in
-             the <a>list of authorized service records</a>.
+             <a href="#networkservices"><code>NetworkServices</code></a> object the user agent MUST return the <a href=
+             "#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th item in
+             the collection.
         </p>
         <p>
           The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em class=
           "ct">MUST</em> return the first <a href="#networkservice"><code>NetworkService</code></a> object in the
-          <a>list of authorized service records</a> represented by the respective object whose <a href=
-          "#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the <var>id</var> argument.
-          When no services in the <a>list of authorized service records</a> match the given argument, the method
-          MUST return null.
+          collection whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the
+          <var>id</var> argument provided. When no <a href="#networkservice"><code>NetworkService</code></a> objects
+          match the given argument, the method MUST return null.
         </p>
         <p>
           Services available within the local network can connect and disconnect at different times during the
@@ -847,8 +845,8 @@
         </dl>
         <p>
           The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service.
-          The same service provided at different times or on different objects MUST have the same
-          <a href="#dom-networkservice-id"><code>id</code></a> value.
+          The same service provided at different times or on different objects MUST have the same <a href=
+          "#dom-networkservice-id"><code>id</code></a> value.
         </p>
         <p>
           The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for
@@ -955,34 +953,38 @@
       <p>
         A <a>user agent</a> conforming to this specification MAY implement <abbr title=
         "Simple Service Discovery Protocol">SSDP</abbr> [[!UPNP-DEVICEARCH11]] and Zeroconf [[!DNS-SD]] + [[!MDNS]]
-        service discovery mechanisms to enable Web pages to request and connect with HTTP services running on networked
-        devices, discovered via either mechanism, through this API. When a <a>user agent</a> implements either of these
-        service discovery mechanisms, then it MUST conform to the corresponding algorithms provided
-        in this section of the specification.
+        <dfn>service discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to
+        enable Web pages to request and connect with HTTP services running on networked devices, discovered via either
+        mechanism, through this API. When a <a>user agent</a> implements either of these <a>service discovery
+        mechanisms</a>, then it MUST conform to the corresponding algorithms provided in this section of the
+        specification.
       </p>
       <p>
-        This section presents how the results of these two service discovery mechanisms will be matched to requested
-        service types, how the user agent stores available and active services, how their properties are applied to any
-        resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
+        This section presents how the results of these two <a>service discovery mechanisms</a> will be matched to
+        requested service types, how the user agent stores available and active services, how their properties are
+        applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
       </p>
       <p>
-        It is expected that user agents will perform these service discovery mechanisms asynchronously and
-        periodically update the <a>list of networked devices</a> as required. The timing of any service discovery
-        mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent
-        start-up, every X seconds during user agent execution or on invocation of this API from a Web page).
+        It is expected that user agents will perform these <a>service discovery mechanisms</a> asynchronously and
+        periodically update the <a>list of available service records</a> as required. The timing of any <a>service
+        discovery mechanisms</a> is an implementation detail left to the discretion of the implementer (e.g. by
+        continuously monitoring the network as a background process or on invocation of this API from a Web page).
       </p>
       <p>
         The <dfn>list of available service records</dfn> is a single dynamic internal lookup table within user agents
         that is used to track all the services that have been discovered and are available in the current network at
-        any given time. At any point during the running of either of the two service discovery mechanisms then existing
-        entries within this table can be updated, entries can be added and entries can be removed as the status of
-        networked services changes according to the rules defined in this specification.
+        any given time. At any point during the running of either of the two <a>service discovery mechanisms</a> then
+        existing entries within this table can be updated, entries can be added and entries can be removed as the
+        status of networked services changes according to the rules defined in this specification.
       </p>
       <p>
-        The <dfn>list of authorized service records</dfn> is a single dynamic internal lookup table within user agents
-        that is used to track the current services that are being shared with web pages at any given time from the
-        <a>list of available service records</a>. Each record in the <a>list of authorized service records</a> is
-        associated with a <var>services manager</var> object that is assigned as part of the <a href=
+        The <dfn>list of active service managers</dfn> is an internal list within user agents that is used to track all
+        <a href="#networkservices"><code>NetworkServices</code></a> objects currently being shared with any web pages
+        at the current time. Each <a href="#networkservices"><code>NetworkServices</code></a> object in the <a>list of
+        active service managers</a> represents a collection of one or more <a href=
+        "#networkservice"><code>NetworkService</code></a> objects - known as its <dfn>indexed properties</dfn>.
+        <a href="#networkservice"><code>NetworkService</code></a> objects are attached as the <a>indexed properties</a>
+        of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href=
         "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm.
       </p>
       <p>
@@ -1009,35 +1011,44 @@
           </ol>
         </li>
         <li>If <var>new service registration flag</var> is set to <code>true</code> then add <var>network service
-        record</var> to the <a>list of available service records</a> as a new entry.
+        record</var> to the <a>list of available service records</a> as a new item.
         </li>
-        <li>For each <var>active service</var> in the <a>list of authorized service records</a> run the following
-        steps:
+        <li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following steps:
           <ol class="rule">
-            <li>If <var>network service record</var>'s <code>type</code> property does not equal the current
-            <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
-            <var>active service</var> and continue at the next available <var>active service</var>.
+            <li>Let <var>service type in current service manager flag</var> be <code>false</code>.
             </li>
-            <li>If the <var>new service registration flag</var> is set to <code>true</code> then increment the
-              <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the
-              <var>services manager</var> associated with the current <var>active service</var> object by
-              <code>1</code> and then <a href=
-              "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
+            <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
+              <ol class="rule">
+                <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>active
+                service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this <var>active
+                service</var> and continue at the next available <var>active service</var>.
+                </li>
+                <li>Set the <var>service type in current service manager flag</var> to <code>true</code>.
+                </li>
+                <li>If the <var>new service registration flag</var> is set to <code>false</code>, the <var>network
+                service record</var>'s <code>id</code> property equals the <var>active service</var>'s <code>id</code>
+                attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a>
+                attribute is currently set to <code>false</code> then set <var>active service</var>'s <a href=
+                "#dom-networkservice-online"><code>online</code></a> attribute to <code>true</code> and then <a href=
+                "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
+                      class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
+                      "#event-serviceonline"><code>serviceonline</code></a> that uses the <a href=
+                      "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
+                      class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable,
+                      and has no default action, at the current <var>active service</var> object.
+                </li>
+              </ol>
+            </li>
+            <li>If the <var>new service registration flag</var> is set to <code>true</code> and the <var>service type
+            in current service manager flag</var> is also set to <code>true</code> then increment <var>service
+            manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a>
+            attribute by <code>1</code> and then <a href=
+            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
                   class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
                   "#event-serviceavailable"><code>serviceavailable</code></a> that uses the <a href=
                   "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
                   class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and
-                  has no default action, at the <var>services manager</var> associated with the current <var>active
-                  service</var> object.
-            </li>
-            <li>Set <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> attribute
-            to <code>true</code> and then <a href=
-            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
-                  class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
-                  "#event-serviceonline"><code>serviceonline</code></a> that uses the <a href=
-                  "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
-                  class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and
-                  has no default action, at the current <var>active service</var> object.
+                  has no default action, at the current <var>service manager</var> object.
             </li>
           </ol>
         </li>
@@ -1061,32 +1072,43 @@
             result of having previously called <a>setup a UPnP Events Subscription</a> against the current
             <var>existing service record</var>).
             </li>
-            <li>For each <var>active service</var> in <a>list of authorized service records</a> run the following
+            <li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following
             steps:
               <ol class="rule">
-                <li>If <var>existing service record</var>'s <code>type</code> property does not equal the current <var>
-                  active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
-                  <var>active service</var> and continue at the next available <var>active service</var>.
+                <li>Let <var>service type in current service manager flag</var> be <code>false</code>.
                 </li>
-                <li>Decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a>
-                attribute of the <var>services manager</var> associated with the current <var>active service</var>
-                object by <code>1</code> and then <a href=
+                <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
+                  <ol class="rule">
+                    <li>If <var>existing service record</var>'s <code>type</code> property does not equal the
+                    <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
+                    <var>active service</var> and continue at the next available <var>active service</var>.
+                    </li>
+                    <li>Set the <var>service type in current service manager flag</var> to <code>true</code>.
+                    </li>
+                    <li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active
+                    service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href=
+                    "#dom-networkservice-online"><code>online</code></a> attribute is currently set to
+                    <code>true</code> then set <var>active service</var>'s <a href="#dom-networkservice-online"><code>
+                      online</code></a> attribute to <code>false</code> and then <a href=
+                      "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
+                          class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
+                          "#event-serviceoffline"><code>serviceoffline</code></a> that uses the <a href=
+                          "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
+                          class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not
+                          cancellable, and has no default action, at the current <var>active service</var>.
+                    </li>
+                  </ol>
+                </li>
+                <li>If the <var>service type in current service manager flag</var> is set to <code>true</code> then
+                decrement <var>service manager</var>'s <a href=
+                "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code>
+                and then <a href=
                 "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
                       class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
                       "#event-serviceunavailable"><code>serviceunavailable</code></a> that uses the <a href=
                       "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
                       class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable,
-                      and has no default action, at the <var>services manager</var> associated with the current
-                      <var>active service</var> object.
-                </li>
-                <li>Set <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a>
-                attribute to <code>false</code> and then <a href=
-                "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
-                      class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href=
-                      "#event-serviceoffline"><code>serviceoffline</code></a> that uses the <a href=
-                      "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
-                      class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable,
-                      and has no default action, at the current <var>active service</var> object.
+                      and has no default action, at the current <var>service manager</var> object.
                 </li>
               </ol>
             </li>
@@ -1096,10 +1118,10 @@
         </li>
       </ol>
       <p>
-        User agents SHOULD expire a service record from the <a>list of available service
-        records</a> when its <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this
-        condition is met the <a>user agent</a> SHOULD run the rule for <a>removing an available service</a>, passing in
-        the expired service record's <code>id</code> attribute as the only argument.
+        User agents SHOULD expire a service record from the <a>list of available service records</a> when its
+        <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this condition is met the
+        <a>user agent</a> SHOULD run the rule for <a>removing an available service</a>, passing in the expired service
+        record's <code>id</code> attribute as the only argument.
       </p>
       <section>
         <h4>
@@ -1109,8 +1131,7 @@
         <p>
           For each DNS response received from a user-agent-initiated Multicast DNS Browse for <abbr title=
           "DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved
-          recommended automatic browsing domain [[!MDNS]], the <a>user agent</a> MUST run the
-          following steps:
+          recommended automatic browsing domain [[!MDNS]], the <a>user agent</a> MUST run the following steps:
         </p>
         <ol class="rule">
           <li>Let <var>service mDNS responses</var> be an array of PTR records received by issuing a Multicast DNS
@@ -1156,38 +1177,37 @@
           Simple Service Discovery Protocol (<abbr title="Simple Service Discovery Protocol">SSDP</abbr>)
         </h5>
         <p>
-          A user agent that implements UPnP service discovery MUST issue an <dfn>advertisement for
-          UPnP root devices</dfn> against the user's current local network according to the full normative text and
-          timing provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [[!UPNP-DEVICEARCH11]].
+          A user agent that implements UPnP service discovery MUST issue a <dfn>search request for UPnP root
+          devices</dfn> against the user's current local network according to the full normative text and timing
+          provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [[!UPNP-DEVICEARCH11]].
         </p>
         <p>
-          The user agent MUST issue all <a title=
-          "advertisement for UPnP root devices">advertisements for UPnP root devices</a> with a HTTP request line equal
-          to <code>M-SEARCH * HTTP/1.1</code>, with a HOST header equal to the reserved multicast address and port of
-          <code>239.255.255.250:1900</code>, a MAN header equal to <code>ssdp:discover</code>, an ST header equal to
-          <code>upnp:rootdevice</code> and a user-agent defined MX header equal to a <dfn>maximum UPnP advertisement
-          response wait time</dfn> value between <code>1</code> and <code>5</code> seconds.
+          The user agent MUST issue all <a title="search request for UPnP root devices">search requests for UPnP root
+          devices</a> with a HTTP request line equal to <code>M-SEARCH * HTTP/1.1</code>, with a HOST header equal to
+          the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to
+          <code>ssdp:discover</code>, an ST header equal to <code>upnp:rootdevice</code> and a user-agent defined MX
+          header equal to a <dfn>maximum UPnP advertisement response wait time</dfn> value between <code>1</code> and
+          <code>5</code> seconds.
         </p>
         <p>
-          The user agent MUST listen for incoming requests and process any incoming responses to
-          any <a>advertisement for UPnP root devices</a> on the <dfn>standard UPnP address and port</dfn>, on all
-          current local network interface addresses with the port <code>1900</code>, according to the rules defined in
-          this section.
+          The user agent MUST listen for any incoming responses to any <a>search request for UPnP root devices</a>.
         </p>
         <p>
-          For each <dfn>HTTP Response</dfn> following an initial <a>advertisement for UPnP root devices</a> sent on a
+          For each <dfn>HTTP Response</dfn> following an initial <a>search request for UPnP root devices</a> sent on a
           <a>standard UPnP address and port</a> the user agent MUST run the following steps:
         </p>
         <ol class="rule">
           <li>If the <a>HTTP Response</a> is not a HTTP 200 OK response then this response is invalid and the user
-          agent MUST discard this response, abort any remaining steps and return. The user agent
-          MAY issue a new <a>advertisement for UPnP root devices</a> as a result of this error
+          agent MUST discard this response, abort any remaining steps and return. The user agent MAY issue a new
+          <a>search request for UPnP root devices</a> as a result of this error occurring.
+          </li>
+          <li>If the <a>maximum UPnP advertisement response wait time</a> has been exceeded since the initial <a>search
+          request for UPnP root devices</a> was sent then the <a>HTTP Response</a> is invalid and the user agent MUST
+          discard this response, abort any remaining steps and return. The user agent MAY stop listening for responses
+          from the current <a>search request for UPnP root devices</a> as a result of this error occurring. Equally,
+          the user agent MAY issue a new <a>search request for UPnP root devices</a> as a result of this error
           occurring.
           </li>
-          <li>If the <a>maximum UPnP advertisement response wait time</a> has been exceeded since the initial
-          <a>advertisement for UPnP root devices</a> was sent then the <a>HTTP Response</a> is invalid and the user
-          agent MUST discard this response, abort any remaining steps and return.
-          </li>
           <li>Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the <a>HTTP
           Response</a>, with each key being the name of a HTTP response header and each value being that HTTP response
           header's value.
@@ -1195,24 +1215,26 @@
           <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one
           <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the
           value of its <var>ST</var> entry is not <code>upnp:rootdevice</code>, then the <a>HTTP Response</a> is
-          invalid and the <a>user agent</a> MUST discard this response, abort any remaining steps
-          and return.
+          invalid and the <a>user agent</a> MUST discard this response, abort any remaining steps and return.
           </li>
-          <li>The user agent MUST run the rule for <a>obtaining a UPnP Device Description File</a>
-          passing in the first occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device
-          descriptor URL</var> argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the
-          <var>device identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp
-          device</var> as the <var>device expiry</var> argument.
+          <li>The user agent MUST run the rule for <a>obtaining a UPnP Device Description File</a> passing in the first
+          occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor URL</var>
+          argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device
+          identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var>
+          (minus the leading string of <code>max-age=</code>) as the <var>device expiry</var> argument.
           </li>
         </ol>
         <p>
-          For each <dfn>HTTP Request</dfn> received on a <a>standard UPnP address and port</a> the user agent
-          MUST run the following steps:
+          The user agent MUST listen for incoming requests on the <dfn>standard UPnP address and port</dfn> on all
+          current local network interface addresses with the port <code>1900</code>.
+        </p>
+        <p>
+          For each <dfn>HTTP Request</dfn> received on a <a>standard UPnP address and port</a> the user agent MUST run
+          the following steps:
         </p>
         <ol class="rule">
           <li>If the <a>HTTP Request</a> is not a HTTP NOTIFY request then it is not a valid UPnP Request and the user
-          agent MUST return a HTTP 200 OK response, discard this request, abort any remaining steps
-          and return.
+          agent MUST discard this request, abort any remaining steps and return.
           </li>
           <li>Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the <a>HTTP
           Request</a>, with each key being the name of a HTTP header and each value being that HTTP header's value.
@@ -1220,20 +1242,20 @@
           <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one
           <var>USN</var> entry, at least one <var>NT</var> entry, at least one <var>NTS</var> entry and at least one
           <var>LOCATION</var> entry or the value of its <var>NT</var> entry is not <code>upnp:rootdevice</code>, then
-          the <a>HTTP Request</a> is a malformed UPnP Request and the <a>user agent</a> MUST return
-          a 400 Bad Request response, discard this request, abort any remaining steps and return.
+          the <a>HTTP Request</a> is a malformed UPnP Request and the <a>user agent</a> MUST discard this request,
+          abort any remaining steps and return.
           </li>
-          <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> or
-          <code>ssdp:update</code> then the user agent MUST run the rule for <a>obtaining a UPnP
-          Device Description File</a> passing in the first occurrence of <var>LOCATION</var> from <var>ssdp
-          device</var> as the <var>device descriptor URL</var> argument and the first occurrence of <var>USN</var> from
-          <var>ssdp device</var> as the <var>device identifier</var> argument and the first occurrence of
-          <var>CACHE-CONTROL</var> from <var>ssdp device</var> as the <var>device expiry</var>.<br>
+          <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> then the user agent
+          MUST run the rule for <a>obtaining a UPnP Device Description File</a> passing in the first occurrence of
+          <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor URL</var> argument and the
+          first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument
+          and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the leading string of
+          <code>max-age=</code>) as the <var>device expiry</var>.<br>
             <br>
             Otherwise, if <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:byebye</code> then the
-            user agent MUST run the rule for <a>removing all services from a registered UPnP
-            Device</a> passing in the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device
-            identifier</var> argument.
+            user agent MUST run the rule for <a>removing all services from a registered UPnP Device</a> passing in the
+            first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var>
+            argument.
           </li>
         </ol>
         <p>
@@ -1248,19 +1270,12 @@
           description using HTTP' in [[!UPNP-DEVICEARCH11]].
           </li>
           <li>If the value provided in <var>device descriptor URL</var> cannot be resolved as a reachable URL on the
-          current network or the <var>root device descriptor file</var> remains empty then it is invalid and the
-          <a>user agent</a> MUST abort any remaining steps and return.
+          current network or the <var>device descriptor file</var> remains empty then it is invalid and the <a>user
+          agent</a> MUST abort any remaining steps and return.
           </li>
           <li>Run the rule for <a>processing a UPnP Device Description File</a>, passing in the current <var>device
           descriptor file</var>, <var>device identifier</var> and <var>device expiry</var> arguments.
           </li>
-          <li>If the current <var>device descriptor file</var> contains a <code>&lt;deviceList&gt;</code> element then
-          for each <code>&lt;device&gt;</code> element within <code>&lt;deviceList&gt;</code> - herein known as an
-          <var>embedded device descriptor file</var> - the user agent MUST run the rule for
-          <a>processing a UPnP Device Description File</a>, passing in the current <var>embedded device descriptor
-          file</var> as the <var>device descriptor file</var> argument, along with the common <var>device
-          identifier</var> and <var>device expiry</var> arguments.
-          </li>
         </ol>
         <p>
           The rule for <dfn>processing a UPnP Device Description File</dfn> is the process of parsing the contents of a
@@ -1269,8 +1284,8 @@
         </p>
         <p>
           The rule for <a>processing a UPnP Device Description File</a> takes three arguments - <var>device descriptor
-          file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user agent
-          MUST run the following steps:
+          file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user agent MUST
+          run the following steps:
         </p>
         <ol class="rule">
           <li>Let <var>advertised services</var> be a list of all advertised services obtained from the <var>device
@@ -1285,8 +1300,8 @@
               <code>eventsUrl</code>, <code>config</code>, <code>expiryTimestamp</code>.
               </li>
               <li>Set <var>network service record</var>'s <code>id</code> property to the concatenated string value of
-              <var>device identifier</var> with the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code>
-              sub-element.
+              the first occurrence of the <code>&lt;UDN&gt;</code> element in the <var>device descriptor file</var>
+              with the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code> sub-element.
               </li>
               <li>Set <var>network service record</var>'s <code>deviceId</code> property to the value of <var>device
               identifier</var>.
@@ -1318,6 +1333,13 @@
               </li>
             </ol>
           </li>
+          <li>If <var>device descriptor file</var> contains a <code>&lt;deviceList&gt;</code> element then for each
+          <code>&lt;device&gt;</code> element within <code>&lt;deviceList&gt;</code> - herein known as an <var>embedded
+          device descriptor file</var> - the user agent MUST run the rule for <a>processing a UPnP Device Description
+          File</a>, passing in the current <var>embedded device descriptor file</var> as the <var>device descriptor
+          file</var> argument, along with the current <var>device identifier</var> and <var>device expiry</var>
+          arguments.
+          </li>
         </ol>
         <p>
           The rule for <dfn>removing all services from a registered UPnP Device</dfn> is the process of removing all
@@ -1356,8 +1378,8 @@
           string value of <var>callback URL</var> towards the <var>network service record</var>'s
           <code>eventsUrl</code> property.
           </li>
-          <li>If a non-200 OK response is received from the HTTP SUBSCRIBE request then the <a>user agent</a>
-            MUST abort these steps.
+          <li>If a non-200 OK response is received from the HTTP SUBSCRIBE request then the <a>user agent</a> MUST
+          abort these steps.
           </li>
           <li>On receiving a valid 200 OK response, run the following steps:
             <ol class="rule">
@@ -1384,8 +1406,12 @@
                   record</var>'s <code>eventsUrl</code> property.
                   </li>
                   <li>On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first
-                  included <em>SID</em> header, if it exists. All other HTTP responses should cause the <a>user
-                  agent</a> to continue from the step labeled <em>refresh subscription</em> above.
+                  included <em>SID</em> header and set <var>timeout date</var> to the sum of the current UTC date value
+                  plus the integer value of the first included <em>TIMEOUT</em> header (minus the leading string of
+                  <code>Second-</code>), if it exists. If the current date is greater than or equal to <var>timeout
+                  date</var> then the <a>user agent</a> SHOULD continue from the step labeled <em>refresh
+                  subscription</em> above. For all non 200 OK responses the <a>user agent</a> SHOULD continue from the
+                  step labeled <em>refresh subscription</em> above.
                   </li>
                 </ol>
               </li>
@@ -1394,8 +1420,7 @@
                 agent</a> is to run the following steps:
                 <ol class="rule">
                   <li>Let <var>content clone</var> be the result of obtaining the message body of the HTTP NOTIFY
-                  request. If <var>content clone</var> is empty, then the <a>user agent</a> MUST
-                  abort these steps.
+                  request. If <var>content clone</var> is empty, then the <a>user agent</a> MUST abort these steps.
                   </li>
                   <li>Let <var>notification event</var> be a new simple event that uses the <a href=
                   "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event"
@@ -1411,18 +1436,19 @@
                         class="externalDFN">Queue a task</a> to dispatch <var>notification event</var> at the current
                         <a><code>NetworkService</code></a> object.
                   </li>
+                  <li>Return a HTTP 200 OK response to the sender of the HTTP NOTIFY request.
+                  </li>
                 </ol>
               </li>
             </ol>
           </li>
         </ol>
         <p>
-          A <a>user agent</a> can <dfn>terminate an existing UPnP Events Subscription</dfn> at any time for any
-          <var>active service</var> in the <a>list of authorized service records</a> by sending an HTTP UNSUBSCRIBE
-          request - as defined in 'Section 4.1.4: Cancelling a subscription with UNSUBSCRIBE' in [[!UPNP-DEVICEARCH11]]
-          - with a HOST header set to that <var>active service</var>'s <code>eventsUrl</code> property and a SID header
-          set to the <var>callback ID</var> obtained when the initial <a>setup a UPnP Events Subscription</a> action
-          occurred.
+          A <a>user agent</a> can <dfn>terminate an existing UPnP Events Subscription</dfn> at any time for a
+          <var>network service record</var> by sending an HTTP UNSUBSCRIBE request - as defined in 'Section 4.1.4:
+          Cancelling a subscription with UNSUBSCRIBE' in [[!UPNP-DEVICEARCH11]] - with a HOST header set to that
+          <var>active service</var>'s <code>eventsUrl</code> property and a SID header set to the <var>callback
+          ID</var> obtained when the initial <a>setup a UPnP Events Subscription</a> action occurred.
         </p>
       </section>
       <section>
@@ -1432,15 +1458,15 @@
         <div>
           <p>
             When the <a>user agent</a> detects that the user has dropped from their connected network then, for each
-            <var>existing service record</var> in the <a>list of available service records</a>, the user agent
-            MUST run the general rule for <a>removing an available service</a> passing in each
-            <var>existing service record</var>'s <code>id</code> property as the only argument for each call.
+            <var>existing service record</var> in the <a>list of available service records</a>, the user agent MUST run
+            the general rule for <a>removing an available service</a> passing in each <var>existing service
+            record</var>'s <code>id</code> property as the only argument for each call.
           </p>
           <p>
             When the <a>user agent</a> detects that the user has connected to a new network or reconnected to an
-            existing network, then it SHOULD restart its discovery mechanisms as defined in the
-            <a href="#service-discovery">Service Discovery</a> section of this specification, maintaining the existing
-            <a>list of authorized service records</a> currently in use.
+            existing network, then it SHOULD restart its discovery mechanisms as defined in the <a href=
+            "#service-discovery">Service Discovery</a> section of this specification, maintaining the existing <a>list
+            of active service managers</a> currently in use.
           </p>
         </div>
       </section>
@@ -1538,10 +1564,18 @@
         Garbage collection
       </h3>
       <p>
-        Only when the user navigates away from the current browsing context can <a><code>NetworkService</code></a>
-        objects be garbage-collected, its records in the <a>entry script origin's URL whitelist</a> be removed and its
-        corresponding entry in the <a>list of authorized service records</a> be removed according to passing each
-        expired object identifier through the rule for <a>removing an available service</a>.
+        A user agent MUST only garbage collect a <a><code>NetworkServices</code></a> object and remove its entry from
+        the <a>list of active service managers</a> when the user has navigated away from the browsing context in which
+        that <a><code>NetworkServices</code></a> object was provided.
+      </p>
+      <p>
+        A user agent MUST NOT garbage collect individual <a><code>NetworkService</code></a> objects until their parent
+        <a><code>NetworkServices</code></a> object has been garbage collected.
+      </p>
+      <p>
+        A user agent MUST garbage collect the <a><code>NetworkService</code></a> <a>indexed properties</a> of a
+        <a><code>NetworkServices</code></a> object when that <a><code>NetworkServices</code></a> object itself has been
+        garbage-collected.
       </p>
     </section>
     <section>