Editorial updates to NSD spec
authorRich Tibbett <richt@opera.com>
Wed, 03 Oct 2012 14:47:11 +0200
changeset 254f29ec967fb3b
parent 253 a1f05d57cfcd
child 255 79d50d0d9582
Editorial updates to NSD spec
discovery-api/Overview.html
discovery-api/Overview.src.html
discovery-api/WD.html
     1.1 --- a/discovery-api/Overview.html	Tue Oct 02 18:07:01 2012 -0700
     1.2 +++ b/discovery-api/Overview.html	Wed Oct 03 14:47:11 2012 +0200
     1.3 @@ -463,8 +463,8 @@
     1.4        <p>
     1.5          Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known
     1.6          service type, known by developers and advertised by Local-networked Devices. User authorization, where the user
     1.7 -        connects the web page to one or more discovered services, is expected before the web page is able to interact
     1.8 -        with any Local-networked Services.
     1.9 +        connects the web page to discovered services, is expected before the web page is able to interact with any
    1.10 +        Local-networked Services.
    1.11        </p>
    1.12        <p>
    1.13          A web page creates a request to obtain connectivity to services running in the network by specifying a
    1.14 @@ -748,15 +748,15 @@
    1.15            </dt>
    1.16            <dd>
    1.17              <p>
    1.18 -              Prompts the user to select one or more discovered network services that have advertised support for the
    1.19 -              requested service type.
    1.20 +              Prompts the user to select discovered network services that have advertised support for the requested
    1.21 +              service type.
    1.22              </p>
    1.23              <p>
    1.24                The <var title="">type</var> argument contains one or more <a href="#dfn-valid-service-type"
    1.25                   class="internalDFN">valid service type</a> tokens that the web page would like to interact with.
    1.26              </p>
    1.27              <p>
    1.28 -              If the user accepts, the <var title="">successCallback</var> is invoked, with one or more <a href=
    1.29 +              If the user accepts, the <var title="">successCallback</var> is invoked, with zero or more <a href=
    1.30                "#networkservice"><code>NetworkService</code></a> objects as its argument.
    1.31              </p>
    1.32              <p>
    1.33 @@ -826,18 +826,6 @@
    1.34                  </li>
    1.35                </ol>
    1.36              </li>
    1.37 -            <li>If <var>services found</var> is an empty array, then the <a href="#dfn-user-agent"
    1.38 -                  class="internalDFN">user agent</a> <em class="rfc2119"
    1.39 -                  title="must">must</em> <a href=
    1.40 -                  "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
    1.41 -                  class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an
    1.42 -                  object of type <code>Function</code>, with a new <a href=
    1.43 -                  "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href=
    1.44 -                  "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
    1.45 -                  (<a href=
    1.46 -                  "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
    1.47 -                  argument, abort any remaining steps and return.
    1.48 -            </li>
    1.49              <li>Return, and run the remaining steps asynchronously.
    1.50              </li>
    1.51              <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to
    1.52 @@ -853,15 +841,16 @@
    1.53                    "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
    1.54                    argument, abort any remaining steps and return.
    1.55              </li>
    1.56 -            <li>The <a href="#dfn-user-agent"
    1.57 +            <li>If <var>services found</var> is not an empty array then the <a href="#dfn-user-agent"
    1.58                    class="internalDFN">user agent</a> <em class="rfc2119"
    1.59                    title="must">must</em> prompt the user in a user-agent-specific manner for permission to provide the
    1.60                    <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
    1.61                    class="externalDFN">entry script</a>'s <a href=
    1.62                    "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
    1.63                    class="externalDFN">origin</a> with an array of <a href=
    1.64 -                  "#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of
    1.65 -                  <var>services found</var>.
    1.66 +                  "#networkservice"><code>NetworkService</code></a> objects representing the <a href=
    1.67 +                  "#dfn-user-authorized"
    1.68 +                  class="internalDFN">user-authorized</a> subset of <var>services found</var>.
    1.69                <p>
    1.70                  If the user grants permission to access one or more networked services then the <a href=
    1.71                  "#dfn-user-agent"
    1.72 @@ -885,10 +874,14 @@
    1.73                  If the user never responds, this algorithm stalls on this step.
    1.74                </p>
    1.75              </li>
    1.76 -            <li>Let <var>services</var> be the array of one or more <a href=
    1.77 -            "#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
    1.78 +            <li>Let <var>services</var> be an empty array.
    1.79              </li>
    1.80 -            <li>For each Object <var>service</var> in <var>services</var>, run the following sub-steps:
    1.81 +            <li>If <var>services found</var> is not an empty array then set <var>services</var> to be an array of one
    1.82 +            or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted
    1.83 +            permission above - known as the current objects <dfn id="dfn-user-authorized">user-authorized</dfn>
    1.84 +            services.
    1.85 +            </li>
    1.86 +            <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps:
    1.87                <ol class="rule">
    1.88                  <li>Add the <var>service</var>'s <code>url</code> parameter to the <a href=
    1.89                  "#dfn-entry-script-origin-s-url-whitelist"
    1.90 @@ -911,9 +904,10 @@
    1.91                    class="internalDFN">list of available service records</a> whose <code>type</code> property matches
    1.92                    any of the tokens requested in <var>requested control types</var>.
    1.93              </li>
    1.94 -            <li>Add <var>services</var> to the <var>services manager</var> object as its collection of <a href=
    1.95 -            "#dfn-indexed-properties"
    1.96 -                  class="internalDFN">indexed properties</a>.
    1.97 +            <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of
    1.98 +              <a href="#dfn-indexed-properties-1"
    1.99 +                  class="internalDFN">indexed properties</a>. If <var>services</var> is an empty array then the
   1.100 +                  <var>services manager</var> does not have any <var>indexed properties</var>.
   1.101              </li>
   1.102              <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a>
   1.103              attribute to the number of items in <var>services</var>.
   1.104 @@ -953,7 +947,11 @@
   1.105                 Web Messaging, XMLHttpRequest).
   1.106            </p>
   1.107            <p>
   1.108 -            If the user navigates away from the current browsing context, the <a href="#dfn-user-agent"
   1.109 +            If the user navigates away from the <a href=
   1.110 +            "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
   1.111 +               class="externalDFN">entry script</a>'s <a href=
   1.112 +               "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
   1.113 +               class="externalDFN">origin</a> then the <a href="#dfn-user-agent"
   1.114                 class="internalDFN">user agent</a> <em class="ct"><em class="rfc2119"
   1.115                  title="must">must</em></em> remove all previously whitelisted urls from the <a href=
   1.116                  "#dfn-entry-script-origin-s-url-whitelist"
   1.117 @@ -1028,10 +1026,13 @@
   1.118          <span class="secno">5.</span> Obtaining networked services
   1.119        </h2>
   1.120        <p>
   1.121 -        The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from
   1.122 -        a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access
   1.123 -        to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given
   1.124 -        request.
   1.125 +        The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero or
   1.126 +        more <dfn id="dfn-indexed-properties">indexed properties</dfn> that are each a <a href="#dfn-user-authorized"
   1.127 +           class="internalDFN">user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object.
   1.128 +      </p>
   1.129 +      <p>
   1.130 +        A <a href="#networkservices"><code>NetworkServices</code></a> object is the top level success callback
   1.131 +        parameter from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>.
   1.132        </p>
   1.133        <pre class="widl">
   1.134  [NoInterfaceObject]
   1.135 @@ -1128,10 +1129,14 @@
   1.136            </dd>
   1.137          </dl>
   1.138          <p>
   1.139 -          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of one
   1.140 -          or more <a href="#networkservice"><code>NetworkService</code></a> objects. A <a href=
   1.141 -          "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that it cannot
   1.142 -          be modified.
   1.143 +          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of
   1.144 +          zero or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a href=
   1.145 +          "#dfn-indexed-properties-1"
   1.146 +             class="internalDFN">indexed properties</a>. A <a href="#networkservices"><code>NetworkServices</code></a>
   1.147 +             object is <span>immutable</span> meaning that <a href="#dfn-indexed-properties-1"
   1.148 +             class="internalDFN">indexed properties</a> cannot be added and <a href="#dfn-indexed-properties-1"
   1.149 +             class="internalDFN">indexed properties</a> cannot be removed for the lifetime of a <a href=
   1.150 +             "#networkservices"><code>NetworkServices</code></a> object.
   1.151          </p>
   1.152          <div class="note">
   1.153            <div class="note-title">
   1.154 @@ -1445,8 +1450,8 @@
   1.155        <p>
   1.156          This section presents how the results of these two <a href="#dfn-service-discovery-mechanisms"
   1.157             class="internalDFN">service discovery mechanisms</a> will be matched to requested service types, how the
   1.158 -           user agent stores available and active services, how their properties are applied to any resulting <a href=
   1.159 -           "#networkservice"><code>NetworkService</code></a> objects.
   1.160 +           user agent stores available and active services and how their properties are applied to any resulting
   1.161 +           <a href="#networkservice"><code>NetworkService</code></a> objects.
   1.162        </p>
   1.163        <p>
   1.164          It is expected that user agents will perform these <a href="#dfn-service-discovery-mechanisms"
   1.165 @@ -1470,13 +1475,14 @@
   1.166        <p>
   1.167          The <dfn id="dfn-list-of-active-service-managers">list of active service managers</dfn> is an internal list
   1.168          within user agents that is used to track all <a href="#networkservices"><code>NetworkServices</code></a>
   1.169 -        objects currently being shared with any web pages at the current time. Each <a href=
   1.170 +        objects currently being shared with any web pages at the current time within the user agent. Each <a href=
   1.171          "#networkservices"><code>NetworkServices</code></a> object in the <a href=
   1.172          "#dfn-list-of-active-service-managers"
   1.173 -           class="internalDFN">list of active service managers</a> represents a collection of one or more <a href=
   1.174 +           class="internalDFN">list of active service managers</a> represents a collection of zero or more <a href=
   1.175             "#networkservice"><code>NetworkService</code></a> objects - known as its <dfn id=
   1.176 -           "dfn-indexed-properties">indexed properties</dfn>. <a href="#networkservice"><code>NetworkService</code></a>
   1.177 -           objects are attached as the <a href="#dfn-indexed-properties"
   1.178 +           "dfn-indexed-properties-1">indexed properties</dfn>. <a href=
   1.179 +           "#networkservice"><code>NetworkService</code></a> objects are attached as the <a href=
   1.180 +           "#dfn-indexed-properties-1"
   1.181             class="internalDFN">indexed properties</a> of a <a href="#networkservices"><code>NetworkServices</code></a>
   1.182             object as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>
   1.183             algorithm.
   1.184 @@ -2204,8 +2210,11 @@
   1.185             title="must">must</em> only garbage collect a <a href="#networkservices"
   1.186             class="internalDFN"><code>NetworkServices</code></a> object and remove its entry from the <a href=
   1.187             "#dfn-list-of-active-service-managers"
   1.188 -           class="internalDFN">list of active service managers</a> when the user has navigated away from the browsing
   1.189 -           context in which that <a href="#networkservices"
   1.190 +           class="internalDFN">list of active service managers</a> when the user has navigated away from the <a href=
   1.191 +           "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
   1.192 +           class="externalDFN">entry script</a>'s <a href=
   1.193 +           "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
   1.194 +           class="externalDFN">origin</a> in which the current <a href="#networkservices"
   1.195             class="internalDFN"><code>NetworkServices</code></a> object was provided.
   1.196        </p>
   1.197        <p>
   1.198 @@ -2217,7 +2226,7 @@
   1.199        <p>
   1.200          A user agent <em class="rfc2119"
   1.201             title="must">must</em> garbage collect the <a href="#networkservice"
   1.202 -           class="internalDFN"><code>NetworkService</code></a> <a href="#dfn-indexed-properties"
   1.203 +           class="internalDFN"><code>NetworkService</code></a> <a href="#dfn-indexed-properties-1"
   1.204             class="internalDFN">indexed properties</a> of a <a href="#networkservices"
   1.205             class="internalDFN"><code>NetworkServices</code></a> object when that <a href="#networkservices"
   1.206             class="internalDFN"><code>NetworkServices</code></a> object itself has been garbage-collected.
     2.1 --- a/discovery-api/Overview.src.html	Tue Oct 02 18:07:01 2012 -0700
     2.2 +++ b/discovery-api/Overview.src.html	Wed Oct 03 14:47:11 2012 +0200
     2.3 @@ -35,7 +35,7 @@
     2.4            class='remove'>
     2.5  var respecConfig = {
     2.6            specStatus:   "ED",
     2.7 -          //publishDate:  "2012-10-09",
     2.8 +          //publishDate:  "2012-10-04",
     2.9            shortName:    "discovery-api",
    2.10            edDraftURI:   "http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html",
    2.11            previousMaturity: "FPWD",
    2.12 @@ -124,7 +124,7 @@
    2.13        <p>
    2.14          Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known
    2.15          service type, known by developers and advertised by Local-networked Devices. User authorization, where the user
    2.16 -        connects the web page to one or more discovered services, is expected before the web page is able to interact
    2.17 +        connects the web page to discovered services, is expected before the web page is able to interact
    2.18          with any Local-networked Services.
    2.19        </p>
    2.20        <p>
    2.21 @@ -336,7 +336,7 @@
    2.22            </dt>
    2.23            <dd>
    2.24              <p>
    2.25 -              Prompts the user to select one or more discovered network services that have advertised support for the
    2.26 +              Prompts the user to select discovered network services that have advertised support for the
    2.27                requested service type.
    2.28              </p>
    2.29              <p>
    2.30 @@ -344,7 +344,7 @@
    2.31                page would like to interact with.
    2.32              </p>
    2.33              <p>
    2.34 -              If the user accepts, the <var title="">successCallback</var> is invoked, with one or more <a href=
    2.35 +              If the user accepts, the <var title="">successCallback</var> is invoked, with zero or more <a href=
    2.36                "#networkservice"><code>NetworkService</code></a> objects as its argument.
    2.37              </p>
    2.38              <p>
    2.39 @@ -406,16 +406,6 @@
    2.40                  </li>
    2.41                </ol>
    2.42              </li>
    2.43 -            <li>If <var>services found</var> is an empty array, then the <a>user agent</a> MUST <a href=
    2.44 -            "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task"
    2.45 -                  class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an
    2.46 -                  object of type <code>Function</code>, with a new <a href=
    2.47 -                  "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href=
    2.48 -                  "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
    2.49 -                  (<a href=
    2.50 -                  "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
    2.51 -                  argument, abort any remaining steps and return.
    2.52 -            </li>
    2.53              <li>Return, and run the remaining steps asynchronously.
    2.54              </li>
    2.55              <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to
    2.56 @@ -429,13 +419,14 @@
    2.57                    "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
    2.58                    argument, abort any remaining steps and return.
    2.59              </li>
    2.60 -            <li>The <a>user agent</a> MUST prompt the user in a user-agent-specific manner for permission to provide
    2.61 +            <li>If <var>services found</var> is not an empty array then the <a>user agent</a> MUST prompt the user in a
    2.62 +              user-agent-specific manner for permission to provide
    2.63              the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
    2.64                    class="externalDFN">entry script</a>'s <a href=
    2.65                    "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
    2.66                    class="externalDFN">origin</a> with an array of <a href=
    2.67 -                  "#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of
    2.68 -                  <var>services found</var>.
    2.69 +                  "#networkservice"><code>NetworkService</code></a> objects representing the <a>user-authorized</a> subset
    2.70 +                  of <var>services found</var>.
    2.71                <p>
    2.72                  If the user grants permission to access one or more networked services then the <a>user agent</a>
    2.73                  SHOULD include an "ongoing local-network communication" indicator.
    2.74 @@ -455,10 +446,14 @@
    2.75                  If the user never responds, this algorithm stalls on this step.
    2.76                </p>
    2.77              </li>
    2.78 -            <li>Let <var>services</var> be the array of one or more <a href=
    2.79 -            "#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
    2.80 +            <li>Let <var>services</var> be an empty array.
    2.81              </li>
    2.82 -            <li>For each Object <var>service</var> in <var>services</var>, run the following sub-steps:
    2.83 +            <li>
    2.84 +               If <var>services found</var> is not an empty array then set <var>services</var> to be an array of one or more <a href=
    2.85 +            "#networkservice"><code>NetworkService</code></a> objects for which the user granted permission above - known as the
    2.86 +            current objects <dfn>user-authorized</dfn> services.
    2.87 +            </li>
    2.88 +            <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps:
    2.89                <ol class="rule">
    2.90                  <li>Add the <var>service</var>'s <code>url</code> parameter to the <a>entry script origin's
    2.91                    <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
    2.92 @@ -477,8 +472,9 @@
    2.93              items currently found in the <a>list of available service records</a> whose <code>type</code> property
    2.94              matches any of the tokens requested in <var>requested control types</var>.
    2.95              </li>
    2.96 -            <li>Add <var>services</var> to the <var>services manager</var> object as its collection of <a>indexed
    2.97 -            properties</a>.
    2.98 +            <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of <a>indexed
    2.99 +            properties</a>. If <var>services</var> is an empty array then the <var>services manager</var> does not have any
   2.100 +            <var>indexed properties</var>.
   2.101              </li>
   2.102              <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a>
   2.103              attribute to the number of items in <var>services</var>.
   2.104 @@ -511,7 +507,11 @@
   2.105                 Web Messaging, XMLHttpRequest).
   2.106            </p>
   2.107            <p>
   2.108 -            If the user navigates away from the current browsing context, the <a>user agent</a> <em class=
   2.109 +            If the user navigates away from the
   2.110 +            <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
   2.111 +                  class="externalDFN">entry script</a>'s <a href=
   2.112 +                  "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
   2.113 +                  class="externalDFN">origin</a> then the <a>user agent</a> <em class=
   2.114              "ct">MUST</em> remove all previously whitelisted urls from the <a>entry script origin's URL whitelist</a>.
   2.115              There is no persistence to network service selections provided to a web page. It is not possible to access
   2.116              a previously white-listed networked service without the necessary user authorization in all of the
   2.117 @@ -581,10 +581,14 @@
   2.118          Obtaining networked services
   2.119        </h2>
   2.120        <p>
   2.121 -        The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from
   2.122 -        a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access
   2.123 -        to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given
   2.124 -        request.
   2.125 +        The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero
   2.126 +        or more <dfn>indexed properties</dfn> that are
   2.127 +        each a <a>user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object.
   2.128 +      </p>
   2.129 +      <p>
   2.130 +        A <a href="#networkservices"><code>NetworkServices</code></a> object is the top level success callback
   2.131 +        parameter from a call to
   2.132 +        <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>.
   2.133        </p>
   2.134        <pre class="widl">
   2.135  [NoInterfaceObject]
   2.136 @@ -674,10 +678,11 @@
   2.137            </dd>
   2.138          </dl>
   2.139          <p>
   2.140 -          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of one
   2.141 -          or more <a href="#networkservice"><code>NetworkService</code></a> objects. A <a href=
   2.142 -          "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that it cannot
   2.143 -          be modified.
   2.144 +          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of zero
   2.145 +          or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a>indexed properties</a>. A <a href=
   2.146 +          "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that
   2.147 +          <a>indexed properties</a> cannot be added and <a>indexed properties</a> cannot be removed for the lifetime of
   2.148 +          a <a href="#networkservices"><code>NetworkServices</code></a> object.
   2.149          </p>
   2.150          <p class="note">
   2.151            Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the
   2.152 @@ -961,7 +966,7 @@
   2.153        </p>
   2.154        <p>
   2.155          This section presents how the results of these two <a>service discovery mechanisms</a> will be matched to
   2.156 -        requested service types, how the user agent stores available and active services, how their properties are
   2.157 +        requested service types, how the user agent stores available and active services and how their properties are
   2.158          applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
   2.159        </p>
   2.160        <p>
   2.161 @@ -980,8 +985,9 @@
   2.162        <p>
   2.163          The <dfn>list of active service managers</dfn> is an internal list within user agents that is used to track all
   2.164          <a href="#networkservices"><code>NetworkServices</code></a> objects currently being shared with any web pages
   2.165 -        at the current time. Each <a href="#networkservices"><code>NetworkServices</code></a> object in the <a>list of
   2.166 -        active service managers</a> represents a collection of one or more <a href=
   2.167 +        at the current time within the user agent. Each <a href="#networkservices"><code>NetworkServices</code></a> object
   2.168 +        in the <a>list of
   2.169 +        active service managers</a> represents a collection of zero or more <a href=
   2.170          "#networkservice"><code>NetworkService</code></a> objects - known as its <dfn>indexed properties</dfn>.
   2.171          <a href="#networkservice"><code>NetworkService</code></a> objects are attached as the <a>indexed properties</a>
   2.172          of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href=
   2.173 @@ -1565,8 +1571,12 @@
   2.174        </h3>
   2.175        <p>
   2.176          A user agent MUST only garbage collect a <a><code>NetworkServices</code></a> object and remove its entry from
   2.177 -        the <a>list of active service managers</a> when the user has navigated away from the browsing context in which
   2.178 -        that <a><code>NetworkServices</code></a> object was provided.
   2.179 +        the <a>list of active service managers</a> when the user has navigated away from the
   2.180 +        <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script"
   2.181 +              class="externalDFN">entry script</a>'s <a href=
   2.182 +              "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin"
   2.183 +              class="externalDFN">origin</a> in which
   2.184 +        the current <a><code>NetworkServices</code></a> object was provided.
   2.185        </p>
   2.186        <p>
   2.187          A user agent MUST NOT garbage collect individual <a><code>NetworkService</code></a> objects until their parent
     3.1 --- a/discovery-api/WD.html	Tue Oct 02 18:07:01 2012 -0700
     3.2 +++ b/discovery-api/WD.html	Wed Oct 03 14:47:11 2012 +0200
     3.3 @@ -5,8 +5,8 @@
     3.4        Network Service Discovery
     3.5      </title>
     3.6      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     3.7 -    
     3.8 -    
     3.9 +
    3.10 +
    3.11      <style type="text/css">
    3.12  /* Custom ReSpec CSS (by Rich Tibbett) */
    3.13  
    3.14 @@ -45,7 +45,7 @@
    3.15   *****************************************************************/
    3.16  
    3.17  /* --- INLINES --- */
    3.18 -em.rfc2119 { 
    3.19 +em.rfc2119 {
    3.20      text-transform:     lowercase;
    3.21      font-variant:       small-caps;
    3.22      font-style:         normal;
    3.23 @@ -200,50 +200,51 @@
    3.24  
    3.25  /* this from google-code-prettify */
    3.26  .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
    3.27 -</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD"><!--[if lt IE 9]><script src='undefined://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head><body><div class="head">
    3.28 +</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-WD"><!--[if lt IE 9]><script src='undefined://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head>
    3.29 +  <body><div class="head">
    3.30    <p>
    3.31 -    
    3.32 +
    3.33        <a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a>
    3.34 -    
    3.35 +
    3.36    </p>
    3.37    <h1 class="title" id="title">Network Service Discovery</h1>
    3.38 -  
    3.39 +
    3.40    <h2 id="w3c-working-draft-04-october-2012"><abbr title="World Wide Web Consortium">W3C</abbr> Working Draft 04 October 2012</h2>
    3.41    <dl>
    3.42 -    
    3.43 +
    3.44        <dt>This version:</dt>
    3.45        <dd><a href="http://www.w3.org/TR/2012/WD-discovery-api-20121004/">http://www.w3.org/TR/2012/WD-discovery-api-20121004/</a></dd>
    3.46        <dt>Latest published version:</dt>
    3.47        <dd><a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a></dd>
    3.48 -    
    3.49 -    
    3.50 +
    3.51 +
    3.52        <dt>Latest editor's draft:</dt>
    3.53        <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/discovery-api/Overview.html</a></dd>
    3.54 -    
    3.55 -    
    3.56 -    
    3.57 -    
    3.58 -    
    3.59 +
    3.60 +
    3.61 +
    3.62 +
    3.63 +
    3.64        <dt>Previous version:</dt>
    3.65        <dd><a href="http://www.w3.org/TR/2012/WD-discovery-api-20120807/">http://www.w3.org/TR/2012/WD-discovery-api-20120807/</a></dd>
    3.66 -    
    3.67 -    
    3.68 +
    3.69 +
    3.70      <dt>Editors:</dt>
    3.71      <dd><span>Rich Tibbett</span>, <a href="http://opera.com/">Opera Software ASA</a></dd>
    3.72  <dd><span>Clarke Stevens</span>, <a href="http://cablelabs.com/">CableLabs</a></dd>
    3.73  
    3.74 -    
    3.75 +
    3.76    </dl>
    3.77 -  
    3.78 -  
    3.79 -  
    3.80 -  
    3.81 -    
    3.82 +
    3.83 +
    3.84 +
    3.85 +
    3.86 +
    3.87        <p class="copyright">
    3.88 -        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 
    3.89 +        <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> ©
    3.90          2012
    3.91 -        
    3.92 -        <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> 
    3.93 +
    3.94 +        <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup>
    3.95          (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>,
    3.96          <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>,
    3.97          <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
    3.98 @@ -251,8 +252,8 @@
    3.99          <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
   3.100          <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.
   3.101        </p>
   3.102 -    
   3.103 -  
   3.104 +
   3.105 +
   3.106    <hr>
   3.107  </div>
   3.108      <section id="abstract" class="introductory"><h2>Abstract</h2>
   3.109 @@ -262,63 +263,63 @@
   3.110          within the current network.
   3.111        </p>
   3.112      </section><section id="sotd" class="introductory"><h2>Status of This Document</h2>
   3.113 -  
   3.114 -    
   3.115 -      
   3.116 +
   3.117 +
   3.118 +
   3.119          <p>
   3.120            <em>This section describes the status of this document at the time of its publication. Other
   3.121            documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision
   3.122            of this technical report can be found in the <a href="http://www.w3.org/TR/"><abbr title="World Wide Web Consortium">W3C</abbr> technical reports
   3.123            index</a> at http://www.w3.org/TR/.</em>
   3.124          </p>
   3.125 -        
   3.126 +
   3.127        <p>
   3.128          This document represents the early consensus of the group on the scope and features of the proposed <abbr title="Application Programming Interface">API</abbr>.
   3.129        </p>
   3.130 -    
   3.131 +
   3.132          <p>
   3.133            This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as a Working Draft.
   3.134 -          
   3.135 +
   3.136              This document is intended to become a <abbr title="World Wide Web Consortium">W3C</abbr> Recommendation.
   3.137 -          
   3.138 -          If you wish to make comments regarding this document, please send them to 
   3.139 -          <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> 
   3.140 +
   3.141 +          If you wish to make comments regarding this document, please send them to
   3.142 +          <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a>
   3.143            (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>,
   3.144            <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>).
   3.145 -          
   3.146 -          
   3.147 +
   3.148 +
   3.149            All feedback is welcome.
   3.150          </p>
   3.151 -        
   3.152 +
   3.153            <p>
   3.154              Publication as a Working Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership.
   3.155 -            This is a draft document and may be updated, replaced or obsoleted by other documents at 
   3.156 +            This is a draft document and may be updated, replaced or obsoleted by other documents at
   3.157              any time. It is inappropriate to cite this document as other than work in progress.
   3.158            </p>
   3.159 -        
   3.160 -        
   3.161 +
   3.162 +
   3.163          <p>
   3.164 -          
   3.165 -            This document was produced by a group operating under the 
   3.166 +
   3.167 +            This document was produced by a group operating under the
   3.168              <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
   3.169 -          
   3.170 -          
   3.171 -          
   3.172 -            
   3.173 -              <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a> 
   3.174 -            
   3.175 -            made in connection with the deliverables of the group; that page also includes instructions for 
   3.176 +
   3.177 +
   3.178 +
   3.179 +
   3.180 +              <abbr title="World Wide Web Consortium">W3C</abbr> maintains a <a href="http://www.w3.org/2004/01/pp-impl/43696/status" rel="disclosure">public list of any patent disclosures</a>
   3.181 +
   3.182 +            made in connection with the deliverables of the group; that page also includes instructions for
   3.183              disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains
   3.184              <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
   3.185              information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
   3.186              6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>.
   3.187 -          
   3.188 -          
   3.189 +
   3.190 +
   3.191          </p>
   3.192 -        
   3.193 -      
   3.194 -    
   3.195 -  
   3.196 +
   3.197 +
   3.198 +
   3.199 +
   3.200  </section><section id="toc"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>
   3.201          Introduction
   3.202        </a></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">2. </span>Conformance</a><ul class="toc"><li class="tocline"><a href="#dependencies" class="tocxref"><span class="secno">2.1 </span>
   3.203 @@ -366,7 +367,7 @@
   3.204        </a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">B. </span>
   3.205          Acknowledgements
   3.206        </a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">C. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">C.1 </span>Normative references</a></li></ul></li></ul></section>
   3.207 -    
   3.208 +
   3.209      <section class="informative" id="introduction">
   3.210        <!--OddPage--><h2><span class="secno">1. </span>
   3.211          Introduction
   3.212 @@ -379,7 +380,7 @@
   3.213        <p>
   3.214          Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known
   3.215          service type, known by developers and advertised by Local-networked Devices. User authorization, where the user
   3.216 -        connects the web page to one or more discovered services, is expected before the web page is able to interact
   3.217 +        connects the web page to discovered services, is expected before the web page is able to interact
   3.218          with any Local-networked Services.
   3.219        </p>
   3.220        <p>
   3.221 @@ -387,9 +388,9 @@
   3.222          well-known discovery service type that it wishes to interact with.
   3.223        </p>
   3.224        <p>
   3.225 -        The user agent, having captured all advertised services on the network from the Service Discovery mechanisms
   3.226 -        included in this recommendation, attempts to match the requested service type to a discovered service according
   3.227 -        to the processing described herein.
   3.228 +        The user agent, having captured all advertised services on the network from the <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery
   3.229 +        mechanisms</a> included in this recommendation, attempts to match the requested service type to a discovered
   3.230 +        service according to the processing described herein.
   3.231        </p>
   3.232        <p>
   3.233          If a service connectivity request is successful then the Web page is provided with the necessary information to
   3.234 @@ -472,25 +473,24 @@
   3.235          are to be interpreted as requirements on user agents.
   3.236        </p>
   3.237        <p>
   3.238 -        Conformance requirements phrased as algorithms or specific steps <em class="rfc2119" title="may">may</em> be implemented in any
   3.239 -        manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification
   3.240 -        are intended to be easy to follow, and not intended to be performant.)
   3.241 +        Conformance requirements phrased as algorithms or specific steps <em class="rfc2119" title="may">may</em> be implemented in any manner, so long as
   3.242 +        the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be
   3.243 +        easy to follow, and not intended to be performant.)
   3.244        </p>
   3.245        <p>
   3.246          The only conformance class defined by this specification is a <dfn id="dfn-user-agent">user agent</dfn>.
   3.247        </p>
   3.248        <p>
   3.249 -        User agents <em class="rfc2119" title="may">may</em> impose implementation-specific limits on otherwise unconstrained inputs,
   3.250 -        e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around
   3.251 -        platform-specific limitations.
   3.252 +        User agents <em class="rfc2119" title="may">may</em> impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial
   3.253 +        of service attacks, to guard against running out of memory, or to work around platform-specific limitations.
   3.254        </p>
   3.255        <p>
   3.256          When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid
   3.257 -        in development, or for performance reasons), user agents <em class="rfc2119" title="must">must</em> act as if they had no support
   3.258 -        for the feature whatsoever, and as if the feature was not mentioned in this specification. For example, if a
   3.259 -        particular feature is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted
   3.260 -        from the objects that implement that interface - leaving the attribute on the object but making it return null
   3.261 -        or throw an exception is insufficient.
   3.262 +        in development, or for performance reasons), user agents <em class="rfc2119" title="must">must</em> act as if they had no support for the feature
   3.263 +        whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature
   3.264 +        is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted from the objects
   3.265 +        that implement that interface - leaving the attribute on the object but making it return null or throw an
   3.266 +        exception is insufficient.
   3.267        </p>
   3.268        <section id="dependencies">
   3.269          <h3><span class="secno">2.1 </span>
   3.270 @@ -586,7 +586,7 @@
   3.271            </dt>
   3.272            <dd>
   3.273              <p>
   3.274 -              Prompts the user to select one or more discovered network services that have advertised support for the
   3.275 +              Prompts the user to select discovered network services that have advertised support for the
   3.276                requested service type.
   3.277              </p>
   3.278              <p>
   3.279 @@ -594,7 +594,7 @@
   3.280                page would like to interact with.
   3.281              </p>
   3.282              <p>
   3.283 -              If the user accepts, the <var title="">successCallback</var> is invoked, with one or more <a href="#networkservice"><code>NetworkService</code></a> objects as its argument.
   3.284 +              If the user accepts, the <var title="">successCallback</var> is invoked, with zero or more <a href="#networkservice"><code>NetworkService</code></a> objects as its argument.
   3.285              </p>
   3.286              <p>
   3.287                If the user declines, the <var title="">errorCallback</var> (if any) is invoked.
   3.288 @@ -604,8 +604,7 @@
   3.289          <div>
   3.290            <p>
   3.291              When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[,
   3.292 -               errorCallback])</code></dfn> method is called, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the
   3.293 -               following steps:
   3.294 +               errorCallback])</code></dfn> method is called, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps:
   3.295            </p>
   3.296            <ol class="rule">
   3.297              <li>Let <var>requested control types</var> be initially set to an empty array.
   3.298 @@ -648,12 +647,6 @@
   3.299                  </li>
   3.300                </ol>
   3.301              </li>
   3.302 -            <li>If <var>services found</var> is an empty array, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em>
   3.303 -            <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
   3.304 -                  object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1
   3.305 -                  (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
   3.306 -                  argument, abort any remaining steps and return.
   3.307 -            </li>
   3.308              <li>Return, and run the remaining steps asynchronously.
   3.309              </li>
   3.310              <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to
   3.311 @@ -662,9 +655,10 @@
   3.312                    (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its
   3.313                    argument, abort any remaining steps and return.
   3.314              </li>
   3.315 -            <li>The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> prompt the user in a user-agent-specific manner for
   3.316 -            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="#networkservice"><code>NetworkService</code></a> objects representing the user-authorized subset of
   3.317 -                  <var>services found</var>.
   3.318 +            <li>If <var>services found</var> is not an empty array then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> prompt the user in a
   3.319 +              user-agent-specific manner for permission to provide
   3.320 +            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="#networkservice"><code>NetworkService</code></a> objects representing the <a href="#dfn-user-authorized" class="internalDFN">user-authorized</a> subset
   3.321 +                  of <var>services found</var>.
   3.322                <p>
   3.323                  If the user grants permission to access one or more networked services then the <a href="#dfn-user-agent" class="internalDFN">user agent</a>
   3.324                  <em class="rfc2119" title="should">should</em> include an "ongoing local-network communication" indicator.
   3.325 @@ -679,9 +673,13 @@
   3.326                  If the user never responds, this algorithm stalls on this step.
   3.327                </p>
   3.328              </li>
   3.329 -            <li>Let <var>services</var> be the array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission.
   3.330 +            <li>Let <var>services</var> be an empty array.
   3.331              </li>
   3.332 -            <li>For each Object <var>service</var> in <var>services</var>, run the following sub-steps:
   3.333 +            <li>
   3.334 +               If <var>services found</var> is not an empty array then set <var>services</var> to be an array of one or more <a href="#networkservice"><code>NetworkService</code></a> objects for which the user granted permission above - known as the
   3.335 +            current objects <dfn id="dfn-user-authorized">user-authorized</dfn> services.
   3.336 +            </li>
   3.337 +            <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps:
   3.338                <ol class="rule">
   3.339                  <li>Add the <var>service</var>'s <code>url</code> parameter to the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's
   3.340                    <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
   3.341 @@ -696,11 +694,17 @@
   3.342              object.
   3.343              </li>
   3.344              <li>Set <var>services manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of
   3.345 -            services currently found in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> whose <code>type</code> property
   3.346 +            items currently found in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> whose <code>type</code> property
   3.347              matches any of the tokens requested in <var>requested control types</var>.
   3.348              </li>
   3.349 -            <li>Add the set of <var>services</var> to the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> internally against
   3.350 -            the newly created <var>services manager</var> object.
   3.351 +            <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of <a href="#dfn-indexed-properties-1" class="internalDFN">indexed
   3.352 +            properties</a>. If <var>services</var> is an empty array then the <var>services manager</var> does not have any
   3.353 +            <var>indexed properties</var>.
   3.354 +            </li>
   3.355 +            <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a>
   3.356 +            attribute to the number of items in <var>services</var>.
   3.357 +            </li>
   3.358 +            <li>Add <var>services manager</var> to the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a>.
   3.359              </li>
   3.360              <li>The <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <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>successCallback</var> with <var>services
   3.361                    manager</var> as its argument.
   3.362 @@ -711,13 +715,14 @@
   3.363            </p>
   3.364            <p>
   3.365              When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the
   3.366 -            <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> add the <code>url</code> property to the <dfn id="dfn-entry-script-origin-s-url-whitelist">entry script
   3.367 -            origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</dfn>. This list enables the Web page to override and initiate cross-site resource
   3.368 -            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" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
   3.369 +            <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> add the <code>url</code> property to the <dfn id="dfn-entry-script-origin-s-url-whitelist">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr>
   3.370 +            whitelist</dfn>. This list enables the Web page to override and initiate cross-site resource requests
   3.371 +            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" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events,
   3.372                 Web Messaging, XMLHttpRequest).
   3.373            </p>
   3.374            <p>
   3.375 -            If the user navigates away from the current browsing context, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="ct"><em class="rfc2119" title="must">must</em></em> remove all previously whitelisted urls from the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
   3.376 +            If the user navigates away from the
   3.377 +            <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> then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="ct"><em class="rfc2119" title="must">must</em></em> remove all previously whitelisted urls from the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>.
   3.378              There is no persistence to network service selections provided to a web page. It is not possible to access
   3.379              a previously white-listed networked service without the necessary user authorization in all of the
   3.380              following cases:
   3.381 @@ -777,10 +782,14 @@
   3.382          Obtaining networked services
   3.383        </h2>
   3.384        <p>
   3.385 -        The <a href="#networkservices"><code>NetworkServices</code></a> interface is the top-level response object from
   3.386 -        a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> and provides access
   3.387 -        to a set of user-authorized <a href="#networkservice"><code>NetworkService</code></a> objects for the given
   3.388 -        request.
   3.389 +        The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero
   3.390 +        or more <dfn id="dfn-indexed-properties">indexed properties</dfn> that are
   3.391 +        each a <a href="#dfn-user-authorized" class="internalDFN">user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object.
   3.392 +      </p>
   3.393 +      <p>
   3.394 +        A <a href="#networkservices"><code>NetworkServices</code></a> object is the top level success callback
   3.395 +        parameter from a call to
   3.396 +        <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>.
   3.397        </p>
   3.398        <pre class="widl">[NoInterfaceObject]
   3.399  interface <dfn id="networkservices">NetworkServices</dfn> {
   3.400 @@ -808,8 +817,7 @@
   3.401            </dt>
   3.402            <dd>
   3.403              <p>
   3.404 -              Returns the current number of services belonging in the respective object's <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service
   3.405 -              records</a>.
   3.406 +              Returns the current number of items in the current object's collection of <a href="#networkservice"><code>NetworkService</code></a> objects.
   3.407              </p>
   3.408            </dd>
   3.409            <dt>
   3.410 @@ -817,22 +825,21 @@
   3.411            </dt>
   3.412            <dd>
   3.413              <p>
   3.414 -              Returns the current number of services matching one of the app-requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens
   3.415 -              in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>.
   3.416 +              Returns the current number of items matching one of the app-requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens in
   3.417 +              the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>.
   3.418              </p>
   3.419            </dd>
   3.420          </dl>
   3.421          <div>
   3.422            <p>
   3.423 -            The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119" title="must">must</em>
   3.424 -            return the number of services represented in the object's corresponding <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service
   3.425 -            records</a> at the time of getting.
   3.426 +            The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119" title="must">must</em> return the number of
   3.427 +            <a href="#networkservice"><code>NetworkService</code></a> objects represented by the collection.
   3.428            </p>
   3.429            <p>
   3.430 -            The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute
   3.431 -            <em class="rfc2119" title="must">must</em> return the number of services in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>
   3.432 -            whose <code>type</code> attribute matches any of the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that was initially
   3.433 -            used to create the current <a href="#networkservices"><code>NetworkServices</code></a> object.
   3.434 +            The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute <em class="rfc2119" title="must">must</em>
   3.435 +            return the number of services in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> whose <code>type</code>
   3.436 +            attribute matches any of the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that was initially used to create the current
   3.437 +            <a href="#networkservices"><code>NetworkServices</code></a> object.
   3.438            </p>
   3.439          </div>
   3.440        </section>
   3.441 @@ -860,11 +867,10 @@
   3.442            </dd>
   3.443          </dl>
   3.444          <p>
   3.445 -          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current list of one or
   3.446 -          more current authorized services - the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a>. Each item in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of
   3.447 -          authorized service records</a> is represented by a <a href="#networkservice"><code>NetworkService</code></a>
   3.448 -          object. The <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> is <span>immutable</span> meaning that it cannot be
   3.449 -          modified for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object.
   3.450 +          A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of zero
   3.451 +          or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a>. A <a href="#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that
   3.452 +          <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> cannot be added and <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> cannot be removed for the lifetime of
   3.453 +          a <a href="#networkservices"><code>NetworkServices</code></a> object.
   3.454          </p>
   3.455          <div class="note"><div class="note-title"><span>Note</span></div><p class="">
   3.456            Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the
   3.457 @@ -872,20 +878,19 @@
   3.458          </p></div>
   3.459          <p>
   3.460            The <a href="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
   3.461 -             the number of items in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> represented by the respective object
   3.462 -             minus one, if any services are represented in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a>.
   3.463 +             the number of the <a href="#networkservice"><code>NetworkService</code></a> objects in the collection
   3.464 +             minus one.
   3.465          </p>
   3.466          <p>
   3.467            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
   3.468 -             <a href="#networkservices"><code>NetworkServices</code></a> object's <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service
   3.469 -             records</a>, the user agent <em class="rfc2119" title="must">must</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th service in
   3.470 -             the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a>.
   3.471 +             <a href="#networkservices"><code>NetworkServices</code></a> object the user agent <em class="rfc2119" title="must">must</em> return the <a href="#networkservice"><code>NetworkService</code></a> object that represents the <var>index</var>th item in
   3.472 +             the collection.
   3.473          </p>
   3.474          <p>
   3.475            The <dfn id="dom-networkservices-getservicebyid"><code>getServiceById(id)</code></dfn> method <em class="ct"><em class="rfc2119" title="must">must</em></em> return the first <a href="#networkservice"><code>NetworkService</code></a> object in the
   3.476 -          <a href="#dfn-list-of-authorized-service-records" class="internalDFN">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.
   3.477 -          When no services in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> match the given argument, the method
   3.478 -          <em class="rfc2119" title="must">must</em> return null.
   3.479 +          collection whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the
   3.480 +          <var>id</var> argument provided. When no <a href="#networkservice"><code>NetworkService</code></a> objects
   3.481 +          match the given argument, the method <em class="rfc2119" title="must">must</em> return null.
   3.482          </p>
   3.483          <p>
   3.484            Services available within the local network can connect and disconnect at different times during the
   3.485 @@ -1010,8 +1015,7 @@
   3.486          </dl>
   3.487          <p>
   3.488            The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service.
   3.489 -          The same service provided at different times or on different objects <em class="rfc2119" title="must">must</em> have the same
   3.490 -          <a href="#dom-networkservice-id"><code>id</code></a> value.
   3.491 +          The same service provided at different times or on different objects <em class="rfc2119" title="must">must</em> have the same <a href="#dom-networkservice-id"><code>id</code></a> value.
   3.492          </p>
   3.493          <p>
   3.494            The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for
   3.495 @@ -1109,34 +1113,38 @@
   3.496        </h2>
   3.497        <p>
   3.498          A <a href="#dfn-user-agent" class="internalDFN">user agent</a> conforming to this specification <em class="rfc2119" title="may">may</em> implement <abbr title="Simple Service Discovery Protocol">SSDP</abbr> [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] and Zeroconf [<cite><a class="bibref" href="#bib-DNS-SD">DNS-SD</a></cite>] + [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>]
   3.499 -        service discovery mechanisms to enable Web pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on networked
   3.500 -        devices, discovered via either mechanism, through this <abbr title="Application Programming Interface">API</abbr>. When a <a href="#dfn-user-agent" class="internalDFN">user agent</a> implements either of these
   3.501 -        service discovery mechanisms, then it <em class="rfc2119" title="must">must</em> conform to the corresponding algorithms provided
   3.502 -        in this section of the specification.
   3.503 +        <dfn id="dfn-service-discovery-mechanisms">service discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to
   3.504 +        enable Web pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on networked devices, discovered via either
   3.505 +        mechanism, through this <abbr title="Application Programming Interface">API</abbr>. When a <a href="#dfn-user-agent" class="internalDFN">user agent</a> implements either of these <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery
   3.506 +        mechanisms</a>, then it <em class="rfc2119" title="must">must</em> conform to the corresponding algorithms provided in this section of the
   3.507 +        specification.
   3.508        </p>
   3.509        <p>
   3.510 -        This section presents how the results of these two service discovery mechanisms will be matched to requested
   3.511 -        service types, how the user agent stores available and active services, how their properties are applied to any
   3.512 -        resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
   3.513 +        This section presents how the results of these two <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> will be matched to
   3.514 +        requested service types, how the user agent stores available and active services and how their properties are
   3.515 +        applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects.
   3.516        </p>
   3.517        <p>
   3.518 -        It is expected that user agents will perform these service discovery mechanisms asynchronously and
   3.519 -        periodically update the <a>list of networked devices</a> as required. The timing of any service discovery
   3.520 -        mechanisms is an implementation detail left to the discretion of the implementer (e.g. once on user agent
   3.521 -        start-up, every X seconds during user agent execution or on invocation of this <abbr title="Application Programming Interface">API</abbr> from a Web page).
   3.522 +        It is expected that user agents will perform these <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> asynchronously and
   3.523 +        periodically update the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> as required. The timing of any <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service
   3.524 +        discovery mechanisms</a> is an implementation detail left to the discretion of the implementer (e.g. by
   3.525 +        continuously monitoring the network as a background process or on invocation of this <abbr title="Application Programming Interface">API</abbr> from a Web page).
   3.526        </p>
   3.527        <p>
   3.528          The <dfn id="dfn-list-of-available-service-records">list of available service records</dfn> is a single dynamic internal lookup table within user agents
   3.529          that is used to track all the services that have been discovered and are available in the current network at
   3.530 -        any given time. At any point during the running of either of the two service discovery mechanisms then existing
   3.531 -        entries within this table can be updated, entries can be added and entries can be removed as the status of
   3.532 -        networked services changes according to the rules defined in this specification.
   3.533 +        any given time. At any point during the running of either of the two <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> then
   3.534 +        existing entries within this table can be updated, entries can be added and entries can be removed as the
   3.535 +        status of networked services changes according to the rules defined in this specification.
   3.536        </p>
   3.537        <p>
   3.538 -        The <dfn id="dfn-list-of-authorized-service-records">list of authorized service records</dfn> is a single dynamic internal lookup table within user agents
   3.539 -        that is used to track the current services that are being shared with web pages at any given time from the
   3.540 -        <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>. Each record in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> is
   3.541 -        associated with a <var>services manager</var> object that is assigned as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm.
   3.542 +        The <dfn id="dfn-list-of-active-service-managers">list of active service managers</dfn> is an internal list within user agents that is used to track all
   3.543 +        <a href="#networkservices"><code>NetworkServices</code></a> objects currently being shared with any web pages
   3.544 +        at the current time within the user agent. Each <a href="#networkservices"><code>NetworkServices</code></a> object
   3.545 +        in the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of
   3.546 +        active service managers</a> represents a collection of zero or more <a href="#networkservice"><code>NetworkService</code></a> objects - known as its <dfn id="dfn-indexed-properties-1">indexed properties</dfn>.
   3.547 +        <a href="#networkservice"><code>NetworkService</code></a> objects are attached as the <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a>
   3.548 +        of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm.
   3.549        </p>
   3.550        <p>
   3.551          The rule for <dfn id="dfn-adding-an-available-service">adding an available service</dfn> is the process of adding a new service or updating an
   3.552 @@ -1162,25 +1170,33 @@
   3.553            </ol>
   3.554          </li>
   3.555          <li>If <var>new service registration flag</var> is set to <code>true</code> then add <var>network service
   3.556 -        record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> as a new entry.
   3.557 +        record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> as a new item.
   3.558          </li>
   3.559 -        <li>For each <var>active service</var> in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> run the following
   3.560 -        steps:
   3.561 +        <li>For each <var>service manager</var> in the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a> run the following steps:
   3.562            <ol class="rule">
   3.563 -            <li>If <var>network service record</var>'s <code>type</code> property does not equal the current
   3.564 -            <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
   3.565 -            <var>active service</var> and continue at the next available <var>active service</var>.
   3.566 +            <li>Let <var>service type in current service manager flag</var> be <code>false</code>.
   3.567              </li>
   3.568 -            <li>If the <var>new service registration flag</var> is set to <code>true</code> then increment the
   3.569 -              <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute of the
   3.570 -              <var>services manager</var> associated with the current <var>active service</var> object by
   3.571 -              <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
   3.572 -                  has no default action, at the <var>services manager</var> associated with the current <var>active
   3.573 -                  service</var> object.
   3.574 +            <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
   3.575 +              <ol class="rule">
   3.576 +                <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>active
   3.577 +                service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this <var>active
   3.578 +                service</var> and continue at the next available <var>active service</var>.
   3.579 +                </li>
   3.580 +                <li>Set the <var>service type in current service manager flag</var> to <code>true</code>.
   3.581 +                </li>
   3.582 +                <li>If the <var>new service registration flag</var> is set to <code>false</code>, the <var>network
   3.583 +                service record</var>'s <code>id</code> property equals the <var>active service</var>'s <code>id</code>
   3.584 +                attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a>
   3.585 +                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,
   3.586 +                      and has no default action, at the current <var>active service</var> object.
   3.587 +                </li>
   3.588 +              </ol>
   3.589              </li>
   3.590 -            <li>Set <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> attribute
   3.591 -            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
   3.592 -                  has no default action, at the current <var>active service</var> object.
   3.593 +            <li>If the <var>new service registration flag</var> is set to <code>true</code> and the <var>service type
   3.594 +            in current service manager flag</var> is also set to <code>true</code> then increment <var>service
   3.595 +            manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a>
   3.596 +            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
   3.597 +                  has no default action, at the current <var>service manager</var> object.
   3.598              </li>
   3.599            </ol>
   3.600          </li>
   3.601 @@ -1204,22 +1220,31 @@
   3.602              result of having previously called <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events Subscription</a> against the current
   3.603              <var>existing service record</var>).
   3.604              </li>
   3.605 -            <li>For each <var>active service</var> in <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> run the following
   3.606 +            <li>For each <var>service manager</var> in the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a> run the following
   3.607              steps:
   3.608                <ol class="rule">
   3.609 -                <li>If <var>existing service record</var>'s <code>type</code> property does not equal the current <var>
   3.610 -                  active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
   3.611 -                  <var>active service</var> and continue at the next available <var>active service</var>.
   3.612 +                <li>Let <var>service type in current service manager flag</var> be <code>false</code>.
   3.613                  </li>
   3.614 -                <li>Decrement the <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a>
   3.615 -                attribute of the <var>services manager</var> associated with the current <var>active service</var>
   3.616 -                object 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,
   3.617 -                      and has no default action, at the <var>services manager</var> associated with the current
   3.618 -                      <var>active service</var> object.
   3.619 +                <li>For each <var>active service</var> in <var>service manager</var> run the following steps:
   3.620 +                  <ol class="rule">
   3.621 +                    <li>If <var>existing service record</var>'s <code>type</code> property does not equal the
   3.622 +                    <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this
   3.623 +                    <var>active service</var> and continue at the next available <var>active service</var>.
   3.624 +                    </li>
   3.625 +                    <li>Set the <var>service type in current service manager flag</var> to <code>true</code>.
   3.626 +                    </li>
   3.627 +                    <li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active
   3.628 +                    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
   3.629 +                    <code>true</code> then set <var>active service</var>'s <a href="#dom-networkservice-online"><code>
   3.630 +                      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
   3.631 +                          cancellable, and has no default action, at the current <var>active service</var>.
   3.632 +                    </li>
   3.633 +                  </ol>
   3.634                  </li>
   3.635 -                <li>Set <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a>
   3.636 -                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,
   3.637 -                      and has no default action, at the current <var>active service</var> object.
   3.638 +                <li>If the <var>service type in current service manager flag</var> is set to <code>true</code> then
   3.639 +                decrement <var>service manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code>
   3.640 +                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,
   3.641 +                      and has no default action, at the current <var>service manager</var> object.
   3.642                  </li>
   3.643                </ol>
   3.644              </li>
   3.645 @@ -1229,10 +1254,10 @@
   3.646          </li>
   3.647        </ol>
   3.648        <p>
   3.649 -        User agents <em class="rfc2119" title="should">should</em> expire a service record from the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service
   3.650 -        records</a> when its <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this
   3.651 -        condition is met the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> run the rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a>, passing in
   3.652 -        the expired service record's <code>id</code> attribute as the only argument.
   3.653 +        User agents <em class="rfc2119" title="should">should</em> expire a service record from the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> when its
   3.654 +        <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this condition is met the
   3.655 +        <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> run the rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a>, passing in the expired service
   3.656 +        record's <code>id</code> attribute as the only argument.
   3.657        </p>
   3.658        <section id="zeroconf-mdns-dns-sd">
   3.659          <h3><span class="secno">7.1 </span>
   3.660 @@ -1240,8 +1265,7 @@
   3.661          </h3>
   3.662          <p>
   3.663            For each <abbr title="Domain Name System">DNS</abbr> response received from a user-agent-initiated Multicast <abbr title="Domain Name System">DNS</abbr> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name <code>_services._dns-sd._udp</code> on the resolved
   3.664 -          recommended automatic browsing domain [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>], the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the
   3.665 -          following steps:
   3.666 +          recommended automatic browsing domain [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>], the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> run the following steps:
   3.667          </p>
   3.668          <ol class="rule">
   3.669            <li>Let <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var> be an array of <abbr title="DNS Pointer Record">PTR</abbr> records received by issuing a Multicast <abbr title="Domain Name System">DNS</abbr>
   3.670 @@ -1287,37 +1311,37 @@
   3.671            Simple Service Discovery Protocol (<abbr title="Simple Service Discovery Protocol">SSDP</abbr>)
   3.672          </h3>
   3.673          <p>
   3.674 -          A user agent that implements UPnP service discovery <em class="rfc2119" title="must">must</em> issue an <dfn id="dfn-advertisement-for-upnp-root-devices">advertisement for
   3.675 -          UPnP root devices</dfn> against the user's current local network according to the full normative text and
   3.676 -          timing provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
   3.677 +          A user agent that implements UPnP service discovery <em class="rfc2119" title="must">must</em> issue a <dfn id="dfn-search-request-for-upnp-root-devices">search request for UPnP root
   3.678 +          devices</dfn> against the user's current local network according to the full normative text and timing
   3.679 +          provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
   3.680          </p>
   3.681          <p>
   3.682 -          The user agent <em class="rfc2119" title="must">must</em> issue all <a title="advertisement for UPnP root devices" href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisements for UPnP root devices</a> with a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> request line equal
   3.683 -          to <code>M-SEARCH * <abbr title="Hypertext Transfer Protocol">HTTP</abbr>/1.1</code>, with a HOST header equal to the reserved multicast address and port of
   3.684 -          <code>239.255.255.250:1900</code>, a MAN header equal to <code>ssdp:discover</code>, an ST header equal to
   3.685 -          <code>upnp:rootdevice</code> and a user-agent defined MX header equal to a <dfn id="dfn-maximum-upnp-advertisement-response-wait-time">maximum UPnP advertisement
   3.686 -          response wait time</dfn> value between <code>1</code> and <code>5</code> seconds.
   3.687 +          The user agent <em class="rfc2119" title="must">must</em> issue all <a title="search request for UPnP root devices" href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search requests for UPnP root
   3.688 +          devices</a> with a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> request line equal to <code>M-SEARCH * <abbr title="Hypertext Transfer Protocol">HTTP</abbr>/1.1</code>, with a HOST header equal to
   3.689 +          the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to
   3.690 +          <code>ssdp:discover</code>, an ST header equal to <code>upnp:rootdevice</code> and a user-agent defined MX
   3.691 +          header equal to a <dfn id="dfn-maximum-upnp-advertisement-response-wait-time">maximum UPnP advertisement response wait time</dfn> value between <code>1</code> and
   3.692 +          <code>5</code> seconds.
   3.693          </p>
   3.694          <p>
   3.695 -          The user agent <em class="rfc2119" title="must">must</em> listen for incoming requests and process any incoming responses to
   3.696 -          any <a href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisement for UPnP root devices</a> on the <dfn id="dfn-standard-upnp-address-and-port">standard UPnP address and port</dfn>, on all
   3.697 -          current local network interface addresses with the port <code>1900</code>, according to the rules defined in
   3.698 -          this section.
   3.699 +          The user agent <em class="rfc2119" title="must">must</em> listen for any incoming responses to any <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a>.
   3.700          </p>
   3.701          <p>
   3.702 -          For each <dfn id="dfn-http-response"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</dfn> following an initial <a href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisement for UPnP root devices</a> sent on a
   3.703 +          For each <dfn id="dfn-http-response"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</dfn> following an initial <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a> sent on a
   3.704            <a href="#dfn-standard-upnp-address-and-port" class="internalDFN">standard UPnP address and port</a> the user agent <em class="rfc2119" title="must">must</em> run the following steps:
   3.705          </p>
   3.706          <ol class="rule">
   3.707            <li>If the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is not a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response then this response is invalid and the user
   3.708 -          agent <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps and return. The user agent
   3.709 -          <em class="rfc2119" title="may">may</em> issue a new <a href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisement for UPnP root devices</a> as a result of this error
   3.710 +          agent <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps and return. The user agent <em class="rfc2119" title="may">may</em> issue a new
   3.711 +          <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a> as a result of this error occurring.
   3.712 +          </li>
   3.713 +          <li>If the <a href="#dfn-maximum-upnp-advertisement-response-wait-time" class="internalDFN">maximum UPnP advertisement response wait time</a> has been exceeded since the initial <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search
   3.714 +          request for UPnP root devices</a> was sent then the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is invalid and the user agent <em class="rfc2119" title="must">must</em>
   3.715 +          discard this response, abort any remaining steps and return. The user agent <em class="rfc2119" title="may">may</em> stop listening for responses
   3.716 +          from the current <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a> as a result of this error occurring. Equally,
   3.717 +          the user agent <em class="rfc2119" title="may">may</em> issue a new <a href="#dfn-search-request-for-upnp-root-devices" class="internalDFN">search request for UPnP root devices</a> as a result of this error
   3.718            occurring.
   3.719            </li>
   3.720 -          <li>If the <a href="#dfn-maximum-upnp-advertisement-response-wait-time" class="internalDFN">maximum UPnP advertisement response wait time</a> has been exceeded since the initial
   3.721 -          <a href="#dfn-advertisement-for-upnp-root-devices" class="internalDFN">advertisement for UPnP root devices</a> was sent then the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is invalid and the user
   3.722 -          agent <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps and return.
   3.723 -          </li>
   3.724            <li>Let <var>ssdp device</var> be an Object with a property for each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header received in the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr>
   3.725            Response</a>, with each key being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> response header and each value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> response
   3.726            header's value.
   3.727 @@ -1325,24 +1349,26 @@
   3.728            <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one
   3.729            <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the
   3.730            value of its <var>ST</var> entry is not <code>upnp:rootdevice</code>, then the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is
   3.731 -          invalid and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps
   3.732 -          and return.
   3.733 +          invalid and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> discard this response, abort any remaining steps and return.
   3.734            </li>
   3.735 -          <li>The user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file" class="internalDFN">obtaining a UPnP Device Description File</a>
   3.736 -          passing in the first occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device
   3.737 -          descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the
   3.738 -          <var>device identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp
   3.739 -          device</var> as the <var>device expiry</var> argument.
   3.740 +          <li>The user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file" class="internalDFN">obtaining a UPnP Device Description File</a> passing in the first
   3.741 +          occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var>
   3.742 +          argument and the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device
   3.743 +          identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var>
   3.744 +          (minus the leading string of <code>max-age=</code>) as the <var>device expiry</var> argument.
   3.745            </li>
   3.746          </ol>
   3.747          <p>
   3.748 -          For each <dfn id="dfn-http-request"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</dfn> received on a <a href="#dfn-standard-upnp-address-and-port" class="internalDFN">standard UPnP address and port</a> the user agent
   3.749 -          <em class="rfc2119" title="must">must</em> run the following steps:
   3.750 +          The user agent <em class="rfc2119" title="must">must</em> listen for incoming requests on the <dfn id="dfn-standard-upnp-address-and-port">standard UPnP address and port</dfn> on all
   3.751 +          current local network interface addresses with the port <code>1900</code>.
   3.752 +        </p>
   3.753 +        <p>
   3.754 +          For each <dfn id="dfn-http-request"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</dfn> received on a <a href="#dfn-standard-upnp-address-and-port" class="internalDFN">standard UPnP address and port</a> the user agent <em class="rfc2119" title="must">must</em> run
   3.755 +          the following steps:
   3.756          </p>
   3.757          <ol class="rule">
   3.758            <li>If the <a href="#dfn-http-request" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> is not a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request then it is not a valid UPnP Request and the user
   3.759 -          agent <em class="rfc2119" title="must">must</em> return a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response, discard this request, abort any remaining steps
   3.760 -          and return.
   3.761 +          agent <em class="rfc2119" title="must">must</em> discard this request, abort any remaining steps and return.
   3.762            </li>
   3.763            <li>Let <var>ssdp device</var> be an Object with a property for each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header received in the <a href="#dfn-http-request" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr>
   3.764            Request</a>, with each key being the name of a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header and each value being that <abbr title="Hypertext Transfer Protocol">HTTP</abbr> header's value.
   3.765 @@ -1350,20 +1376,20 @@
   3.766            <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one
   3.767            <var>USN</var> entry, at least one <var>NT</var> entry, at least one <var>NTS</var> entry and at least one
   3.768            <var>LOCATION</var> entry or the value of its <var>NT</var> entry is not <code>upnp:rootdevice</code>, then
   3.769 -          the <a href="#dfn-http-request" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> is a malformed UPnP Request and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> return
   3.770 -          a 400 Bad Request response, discard this request, abort any remaining steps and return.
   3.771 +          the <a href="#dfn-http-request" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> is a malformed UPnP Request and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> discard this request,
   3.772 +          abort any remaining steps and return.
   3.773            </li>
   3.774 -          <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> or
   3.775 -          <code>ssdp:update</code> then the user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file" class="internalDFN">obtaining a UPnP
   3.776 -          Device Description File</a> passing in the first occurrence of <var>LOCATION</var> from <var>ssdp
   3.777 -          device</var> as the <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> argument and the first occurrence of <var>USN</var> from
   3.778 -          <var>ssdp device</var> as the <var>device identifier</var> argument and the first occurrence of
   3.779 -          <var>CACHE-CONTROL</var> from <var>ssdp device</var> as the <var>device expiry</var>.<br>
   3.780 +          <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> then the user agent
   3.781 +          <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-obtaining-a-upnp-device-description-file" class="internalDFN">obtaining a UPnP Device Description File</a> passing in the first occurrence of
   3.782 +          <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> argument and the
   3.783 +          first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument
   3.784 +          and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the leading string of
   3.785 +          <code>max-age=</code>) as the <var>device expiry</var>.<br>
   3.786              <br>
   3.787              Otherwise, if <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:byebye</code> then the
   3.788 -            user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-removing-all-services-from-a-registered-upnp-device" class="internalDFN">removing all services from a registered UPnP
   3.789 -            Device</a> passing in the first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device
   3.790 -            identifier</var> argument.
   3.791 +            user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-removing-all-services-from-a-registered-upnp-device" class="internalDFN">removing all services from a registered UPnP Device</a> passing in the
   3.792 +            first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var>
   3.793 +            argument.
   3.794            </li>
   3.795          </ol>
   3.796          <p>
   3.797 @@ -1378,19 +1404,12 @@
   3.798            description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>].
   3.799            </li>
   3.800            <li>If the value provided in <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> cannot be resolved as a reachable <abbr title="Uniform Resource Locator">URL</abbr> on the
   3.801 -          current network or the <var>root device descriptor file</var> remains empty then it is invalid and the
   3.802 -          <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort any remaining steps and return.
   3.803 +          current network or the <var>device descriptor file</var> remains empty then it is invalid and the <a href="#dfn-user-agent" class="internalDFN">user
   3.804 +          agent</a> <em class="rfc2119" title="must">must</em> abort any remaining steps and return.
   3.805            </li>
   3.806            <li>Run the rule for <a href="#dfn-processing-a-upnp-device-description-file" class="internalDFN">processing a UPnP Device Description File</a>, passing in the current <var>device
   3.807            descriptor file</var>, <var>device identifier</var> and <var>device expiry</var> arguments.
   3.808            </li>
   3.809 -          <li>If the current <var>device descriptor file</var> contains a <code>&lt;deviceList&gt;</code> element then
   3.810 -          for each <code>&lt;device&gt;</code> element within <code>&lt;deviceList&gt;</code> - herein known as an
   3.811 -          <var>embedded device descriptor file</var> - the user agent <em class="rfc2119" title="must">must</em> run the rule for
   3.812 -          <a href="#dfn-processing-a-upnp-device-description-file" class="internalDFN">processing a UPnP Device Description File</a>, passing in the current <var>embedded device descriptor
   3.813 -          file</var> as the <var>device descriptor file</var> argument, along with the common <var>device
   3.814 -          identifier</var> and <var>device expiry</var> arguments.
   3.815 -          </li>
   3.816          </ol>
   3.817          <p>
   3.818            The rule for <dfn id="dfn-processing-a-upnp-device-description-file">processing a UPnP Device Description File</dfn> is the process of parsing the contents of a
   3.819 @@ -1399,8 +1418,8 @@
   3.820          </p>
   3.821          <p>
   3.822            The rule for <a href="#dfn-processing-a-upnp-device-description-file" class="internalDFN">processing a UPnP Device Description File</a> takes three arguments - <var>device descriptor
   3.823 -          file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user agent
   3.824 -          <em class="rfc2119" title="must">must</em> run the following steps:
   3.825 +          file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user agent <em class="rfc2119" title="must">must</em>
   3.826 +          run the following steps:
   3.827          </p>
   3.828          <ol class="rule">
   3.829            <li>Let <var>advertised services</var> be a list of all advertised services obtained from the <var>device
   3.830 @@ -1415,8 +1434,8 @@
   3.831                <code>eventsUrl</code>, <code>config</code>, <code>expiryTimestamp</code>.
   3.832                </li>
   3.833                <li>Set <var>network service record</var>'s <code>id</code> property to the concatenated string value of
   3.834 -              <var>device identifier</var> with the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code>
   3.835 -              sub-element.
   3.836 +              the first occurrence of the <code>&lt;UDN&gt;</code> element in the <var>device descriptor file</var>
   3.837 +              with the <var>advertised service</var>'s <code>&lt;serviceId&gt;</code> sub-element.
   3.838                </li>
   3.839                <li>Set <var>network service record</var>'s <code>deviceId</code> property to the value of <var>device
   3.840                identifier</var>.
   3.841 @@ -1448,6 +1467,13 @@
   3.842                </li>
   3.843              </ol>
   3.844            </li>
   3.845 +          <li>If <var>device descriptor file</var> contains a <code>&lt;deviceList&gt;</code> element then for each
   3.846 +          <code>&lt;device&gt;</code> element within <code>&lt;deviceList&gt;</code> - herein known as an <var>embedded
   3.847 +          device descriptor file</var> - the user agent <em class="rfc2119" title="must">must</em> run the rule for <a href="#dfn-processing-a-upnp-device-description-file" class="internalDFN">processing a UPnP Device Description
   3.848 +          File</a>, passing in the current <var>embedded device descriptor file</var> as the <var>device descriptor
   3.849 +          file</var> argument, along with the current <var>device identifier</var> and <var>device expiry</var>
   3.850 +          arguments.
   3.851 +          </li>
   3.852          </ol>
   3.853          <p>
   3.854            The rule for <dfn id="dfn-removing-all-services-from-a-registered-upnp-device">removing all services from a registered UPnP Device</dfn> is the process of removing all
   3.855 @@ -1486,8 +1512,8 @@
   3.856            string value of <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> towards the <var>network service record</var>'s
   3.857            <code>eventsUrl</code> property.
   3.858            </li>
   3.859 -          <li>If a non-200 OK response is received from the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request then the <a href="#dfn-user-agent" class="internalDFN">user agent</a>
   3.860 -            <em class="rfc2119" title="must">must</em> abort these steps.
   3.861 +          <li>If a non-200 OK response is received from the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em>
   3.862 +          abort these steps.
   3.863            </li>
   3.864            <li>On receiving a valid 200 OK response, run the following steps:
   3.865              <ol class="rule">
   3.866 @@ -1514,8 +1540,12 @@
   3.867                    record</var>'s <code>eventsUrl</code> property.
   3.868                    </li>
   3.869                    <li>On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first
   3.870 -                  included <em>SID</em> header, if it exists. All other <abbr title="Hypertext Transfer Protocol">HTTP</abbr> responses should cause the <a href="#dfn-user-agent" class="internalDFN">user
   3.871 -                  agent</a> to continue from the step labeled <em>refresh subscription</em> above.
   3.872 +                  included <em>SID</em> header and set <var>timeout date</var> to the sum of the current UTC date value
   3.873 +                  plus the integer value of the first included <em>TIMEOUT</em> header (minus the leading string of
   3.874 +                  <code>Second-</code>), if it exists. If the current date is greater than or equal to <var>timeout
   3.875 +                  date</var> then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> continue from the step labeled <em>refresh
   3.876 +                  subscription</em> above. For all non 200 OK responses the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> continue from the
   3.877 +                  step labeled <em>refresh subscription</em> above.
   3.878                    </li>
   3.879                  </ol>
   3.880                </li>
   3.881 @@ -1524,8 +1554,7 @@
   3.882                  agent</a> is to run the following steps:
   3.883                  <ol class="rule">
   3.884                    <li>Let <var>content clone</var> be the result of obtaining the message body of the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY
   3.885 -                  request. If <var>content clone</var> is empty, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em>
   3.886 -                  abort these steps.
   3.887 +                  request. If <var>content clone</var> is empty, then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort these steps.
   3.888                    </li>
   3.889                    <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" class="externalDFN"><code>Event</code></a> interface with the name <a href="#event-notify"><code>notify</code></a>, which does not bubble, is not cancellable, and has no
   3.890                          default action.
   3.891 @@ -1537,18 +1566,19 @@
   3.892                      <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 <var>notification event</var> at the current
   3.893                          <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> object.
   3.894                    </li>
   3.895 +                  <li>Return a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response to the sender of the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request.
   3.896 +                  </li>
   3.897                  </ol>
   3.898                </li>
   3.899              </ol>
   3.900            </li>
   3.901          </ol>
   3.902          <p>
   3.903 -          A <a href="#dfn-user-agent" class="internalDFN">user agent</a> can <dfn id="dfn-terminate-an-existing-upnp-events-subscription">terminate an existing UPnP Events Subscription</dfn> at any time for any
   3.904 -          <var>active service</var> in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> by sending an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> UNSUBSCRIBE
   3.905 -          request - as defined in 'Section 4.1.4: Cancelling a subscription with UNSUBSCRIBE' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]
   3.906 -          - with a HOST header set to that <var>active service</var>'s <code>eventsUrl</code> property and a SID header
   3.907 -          set to the <var>callback ID</var> obtained when the initial <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events Subscription</a> action
   3.908 -          occurred.
   3.909 +          A <a href="#dfn-user-agent" class="internalDFN">user agent</a> can <dfn id="dfn-terminate-an-existing-upnp-events-subscription">terminate an existing UPnP Events Subscription</dfn> at any time for a
   3.910 +          <var>network service record</var> by sending an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> UNSUBSCRIBE request - as defined in 'Section 4.1.4:
   3.911 +          Cancelling a subscription with UNSUBSCRIBE' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] - with a HOST header set to that
   3.912 +          <var>active service</var>'s <code>eventsUrl</code> property and a SID header set to the <var>callback
   3.913 +          ID</var> obtained when the initial <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events Subscription</a> action occurred.
   3.914          </p>
   3.915        </section>
   3.916        <section id="network-topology-monitoring">
   3.917 @@ -1558,15 +1588,14 @@
   3.918          <div>
   3.919            <p>
   3.920              When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> detects that the user has dropped from their connected network then, for each
   3.921 -            <var>existing service record</var> in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, the user agent
   3.922 -            <em class="rfc2119" title="must">must</em> run the general rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a> passing in each
   3.923 -            <var>existing service record</var>'s <code>id</code> property as the only argument for each call.
   3.924 +            <var>existing service record</var> in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, the user agent <em class="rfc2119" title="must">must</em> run
   3.925 +            the general rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a> passing in each <var>existing service
   3.926 +            record</var>'s <code>id</code> property as the only argument for each call.
   3.927            </p>
   3.928            <p>
   3.929              When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> detects that the user has connected to a new network or reconnected to an
   3.930 -            existing network, then it <em class="rfc2119" title="should">should</em> restart its discovery mechanisms as defined in the
   3.931 -            <a href="#service-discovery">Service Discovery</a> section of this specification, maintaining the existing
   3.932 -            <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> currently in use.
   3.933 +            existing network, then it <em class="rfc2119" title="should">should</em> restart its discovery mechanisms as defined in the <a href="#service-discovery">Service Discovery</a> section of this specification, maintaining the existing <a href="#dfn-list-of-active-service-managers" class="internalDFN">list
   3.934 +            of active service managers</a> currently in use.
   3.935            </p>
   3.936          </div>
   3.937        </section>
   3.938 @@ -1659,10 +1688,19 @@
   3.939          Garbage collection
   3.940        </h2>
   3.941        <p>
   3.942 -        Only when the user navigates away from the current browsing context can <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a>
   3.943 -        objects be garbage-collected, its records in the <a href="#dfn-entry-script-origin-s-url-whitelist" class="internalDFN">entry script origin's <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a> be removed and its
   3.944 -        corresponding entry in the <a href="#dfn-list-of-authorized-service-records" class="internalDFN">list of authorized service records</a> be removed according to passing each
   3.945 -        expired object identifier through the rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a>.
   3.946 +        A user agent <em class="rfc2119" title="must">must</em> only garbage collect a <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object and remove its entry from
   3.947 +        the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a> when the user has navigated away from the
   3.948 +        <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> in which
   3.949 +        the current <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object was provided.
   3.950 +      </p>
   3.951 +      <p>
   3.952 +        A user agent <em class="rfc2119" title="must not">must not</em> garbage collect individual <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> objects until their parent
   3.953 +        <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object has been garbage collected.
   3.954 +      </p>
   3.955 +      <p>
   3.956 +        A user agent <em class="rfc2119" title="must">must</em> garbage collect the <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> of a
   3.957 +        <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object when that <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object itself has been
   3.958 +        garbage-collected.
   3.959        </p>
   3.960      </section>
   3.961      <section id="use-cases-and-requirements">
   3.962 @@ -1954,13 +1992,13 @@
   3.963          CableLabs, Opera Software ASA, <abbr title="World Wide Web Consortium">W3C</abbr> Device APIs Working Group, <abbr title="World Wide Web Consortium">W3C</abbr> Web and TV Interest Group.
   3.964        </p>
   3.965      </section>
   3.966 -  
   3.967 +
   3.968  
   3.969  <section id="references" class="appendix"><!--OddPage--><h2><span class="secno">C. </span>References</h2><section id="normative-references"><h3><span class="secno">C.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DNS-SD">[DNS-SD]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt"><cite>DNS-Based Service Discovery.</cite></a> 27 February 2011. IETF Draft. URL: <a href="http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt">http://files.dns-sd.org/draft-cheshire-dnsext-dns-sd.txt</a>
   3.970 -</dd><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/"><cite>DOM4.</cite></a> URL: <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/">http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/</a> 
   3.971 -</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 29 March 2012. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a> 
   3.972 +</dd><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Ms2ger. <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/"><cite>DOM4.</cite></a> URL: <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/">http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html/</a>
   3.973 +</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/html5"><cite>HTML5.</cite></a> 29 March 2012. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5">http://www.w3.org/TR/html5</a>
   3.974  </dd><dt id="bib-MDNS">[MDNS]</dt><dd>S. Cheshire; M. Krochmal. <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt"><cite>Multicast DNS.</cite></a> 14 February 2011. IETF Draft. URL: <a href="http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt">http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt</a>
   3.975 -</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a> 
   3.976 +</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119.  URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
   3.977  </dd><dt id="bib-UPNP-DEVICEARCH11">[UPNP-DEVICEARCH11]</dt><dd><a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf"><cite>UPnP Device Architecture 1.1</cite></a>. 15 October 2008. UPnP Forum. PDF document. URL: <a href="http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf">http://upnp.org/specs/arch/UPnP-arch-DeviceArchitecture-v1.1.pdf</a>
   3.978 -</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite>Web IDL.</cite></a> 27 September 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a> 
   3.979 +</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/"><cite>Web IDL.</cite></a> 27 September 2011. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a>
   3.980  </dd></dl></section></section></body></html>
   3.981 \ No newline at end of file