- From: Mercurial notifier <cvsmail@w3.org>
- Date: Wed, 06 Feb 2013 14:04:04 +0000
- To: public-dap-commits@w3.org
changeset: 382:d3c0dcc5d055 tag: tip parent: 381:1dd6a0a5cbc5 parent: 380:25fca44efdfa user: Dominique Hazael-Massieux <dom@w3.org> date: Wed Feb 06 09:03:57 2013 -0500 files: battery/Overview.html description: merge diff -r 1dd6a0a5cbc5 -r d3c0dcc5d055 battery/Overview.html --- a/battery/Overview.html Wed Feb 06 09:02:26 2013 -0500 +++ b/battery/Overview.html Wed Feb 06 09:03:57 2013 -0500 @@ -1,41 +1,480 @@ <!DOCTYPE html> -<html> - <head> +<html lang="en" dir="ltr"> +<head> <title>Battery Status API</title> - <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> - <script src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script> - <script class="remove"> - var respecConfig = { - specStatus: "ED", - shortName: "battery-status", - //publishDate: "2012-05-08", - previousPublishDate: "2012-05-08", - previousMaturity: "CR", - edDraftURI: "http://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html", - // lcEnd: "2011-12-20", - crEnd: "2012-07-01", - editors: [ - { name: "Anssi Kostiainen", company: "Nokia", companyURL: "http://nokia.com/" }, - { name: "Mounir Lamouri", company: "Mozilla", companyURL: "http://mozilla.org/" } - ], - inlineCSS: true, - noIDLIn: true, - extraCSS: ["../ReSpec.js/css/respec.css"], - wg: "Device APIs Working Group", - wgURI: "http://www.w3.org/2009/dap/", - wgPublicList: "public-device-apis", - wgPatentURI: "http://www.w3.org/2004/01/pp-impl/43696/status", - testSuiteURI: "http://w3c-test.org/dap/battery/tests/" - }; - </script> - </head> - <body> - <section id="abstract"> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> + + + <style>/***************************************************************** + * ReSpec 3 CSS + * Robin Berjon - http://berjon.com/ + *****************************************************************/ + +/* --- INLINES --- */ +em.rfc2119 { + text-transform: lowercase; + font-variant: small-caps; + font-style: normal; + color: #900; +} + +h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym, +h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr { + border: none; +} + +dfn { + font-weight: bold; +} + +a.internalDFN { + color: inherit; + border-bottom: 1px solid #99c; + text-decoration: none; +} + +a.externalDFN { + color: inherit; + border-bottom: 1px dotted #ccc; + text-decoration: none; +} + +a.bibref { + text-decoration: none; +} + +cite .bibref { + font-style: normal; +} + +code { + color: #ff4500; +} + + +/* --- --- */ +ol.algorithm { counter-reset:numsection; list-style-type: none; } +ol.algorithm li { margin: 0.5em 0; } +ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; } + +/* --- TOC --- */ +.toc a, .tof a { + text-decoration: none; +} + +a .secno, a .figno { + color: #000; +} + +ul.tof, ol.tof { + list-style: none outside none; +} + +.caption { + margin-top: 0.5em; + font-style: italic; +} + +/* --- TABLE --- */ +table.simple { + border-spacing: 0; + border-collapse: collapse; + border-bottom: 3px solid #005a9c; +} + +.simple th { + background: #005a9c; + color: #fff; + padding: 3px 5px; + text-align: left; +} + +.simple th[scope="row"] { + background: inherit; + color: inherit; + border-top: 1px solid #ddd; +} + +.simple td { + padding: 3px 10px; + border-top: 1px solid #ddd; +} + +.simple tr:nth-child(even) { + background: #f0f6ff; +} + +/* --- DL --- */ +.section dd > p:first-child { + margin-top: 0; +} + +.section dd > p:last-child { + margin-bottom: 0; +} + +.section dd { + margin-bottom: 1em; +} + +.section dl.attrs dd, .section dl.eldef dd { + margin-bottom: 0; +} +</style><style>/* --- EXAMPLES --- */ +div.example-title { + min-width: 7.5em; + color: #b9ab2d; +} +div.example-title span { + text-transform: uppercase; +} +aside.example, div.example, div.illegal-example { + padding: 0.5em; + margin: 1em 0; + position: relative; + clear: both; +} +div.illegal-example { color: red } +div.illegal-example p { color: black } +aside.example, div.example { + padding: .5em; + border-left-width: .5em; + border-left-style: solid; + border-color: #e0cb52; + background: #fcfaee; +} + +aside.example div.example { + border-left-width: .1em; + border-color: #999; + background: #fff; +} +aside.example div.example div.example-title { + color: #999; +} +</style><style>/* --- ISSUES/NOTES --- */ +div.issue-title, div.note-title { + padding-right: 1em; + min-width: 7.5em; + color: #b9ab2d; +} +div.issue-title { color: #e05252; } +div.note-title { color: #52e052; } +div.issue-title span, div.note-title span { + text-transform: uppercase; +} +div.note, div.issue { + margin-top: 1em; + margin-bottom: 1em; +} +.note > p:first-child, .issue > p:first-child { margin-top: 0 } +.issue, .note { + padding: .5em; + border-left-width: .5em; + border-left-style: solid; +} +div.issue, div.note { + padding: 0.5em; + margin: 1em 0; + position: relative; + clear: both; +} +span.note, span.issue { padding: .1em .5em .15em; } + +.issue { + border-color: #e05252; + background: #fbe9e9; +} +.note { + border-color: #52e052; + background: #e9fbe9; +} + + +</style><style>/* HIGHLIGHTS */ +code.prettyprint { + color: inherit; +} + +/* this from google-code-prettify */ +.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} +</style><style>/* --- WEB IDL --- */ +pre.idl { + border-top: 1px solid #90b8de; + border-bottom: 1px solid #90b8de; + padding: 1em; + line-height: 120%; +} + +pre.idl::before { + content: "WebIDL"; + display: block; + width: 150px; + background: #90b8de; + color: #fff; + font-family: initial; + padding: 3px; + font-weight: bold; + margin: -1em 0 1em -1em; +} + +.idlType { + color: #ff4500; + font-weight: bold; + text-decoration: none; +} + +/*.idlModule*/ +/*.idlModuleID*/ +/*.idlInterface*/ +.idlInterfaceID, .idlDictionaryID, .idlCallbackID, .idlEnumID { + font-weight: bold; + color: #005a9c; +} + +.idlSuperclass { + font-style: italic; + color: #005a9c; +} + +/*.idlAttribute*/ +.idlAttrType, .idlFieldType, .idlMemberType { + color: #005a9c; +} +.idlAttrName, .idlFieldName, .idlMemberName { + color: #ff4500; +} +.idlAttrName a, .idlFieldName a, .idlMemberName a { + color: #ff4500; + border-bottom: 1px dotted #ff4500; + text-decoration: none; +} + +/*.idlMethod*/ +.idlMethType, .idlCallbackType { + color: #005a9c; +} +.idlMethName { + color: #ff4500; +} +.idlMethName a { + color: #ff4500; + border-bottom: 1px dotted #ff4500; + text-decoration: none; +} + +/*.idlParam*/ +.idlParamType { + color: #005a9c; +} +.idlParamName, .idlDefaultValue { + font-style: italic; +} + +.extAttr { + color: #666; +} + +/*.idlConst*/ +.idlConstType { + color: #005a9c; +} +.idlConstName { + color: #ff4500; +} +.idlConstName a { + color: #ff4500; + border-bottom: 1px dotted #ff4500; + text-decoration: none; +} + +/*.idlException*/ +.idlExceptionID { + font-weight: bold; + color: #c00; +} + +.idlTypedefID, .idlTypedefType { + color: #005a9c; +} + +.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code { + color: #c00; + font-weight: normal; +} + +.excName a { + font-family: monospace; +} + +.idlRaises a.idlType, .excName a.idlType { + border-bottom: 1px dotted #c00; +} + +.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse { + width: 45px; + text-align: center; +} +.excGetSetTrue, .prmNullTrue, .prmOptTrue { color: #0c0; } +.excGetSetFalse, .prmNullFalse, .prmOptFalse { color: #c00; } + +.idlImplements a { + font-weight: bold; +} + +dl.attributes, dl.methods, dl.constants, dl.fields, dl.dictionary-members { + margin-left: 2em; +} + +.attributes dt, .methods dt, .constants dt, .fields dt, .dictionary-members dt { + font-weight: normal; +} + +.attributes dt code, .methods dt code, .constants dt code, .fields dt code, .dictionary-members dt code { + font-weight: bold; + color: #000; + font-family: monospace; +} + +.attributes dt code, .fields dt code, .dictionary-members dt code { + background: #ffffd2; +} + +.attributes dt .idlAttrType code, .fields dt .idlFieldType code, .dictionary-members dt .idlMemberType code { + color: #005a9c; + background: transparent; + font-family: inherit; + font-weight: normal; + font-style: italic; +} + +.methods dt code { + background: #d9e6f8; +} + +.constants dt code { + background: #ddffd2; +} + +.attributes dd, .methods dd, .constants dd, .fields dd, .dictionary-members dd { + margin-bottom: 1em; +} + +table.parameters, table.exceptions { + border-spacing: 0; + border-collapse: collapse; + margin: 0.5em 0; + width: 100%; +} +table.parameters { border-bottom: 1px solid #90b8de; } +table.exceptions { border-bottom: 1px solid #deb890; } + +.parameters th, .exceptions th { + color: #fff; + padding: 3px 5px; + text-align: left; + font-family: initial; + font-weight: normal; + text-shadow: #666 1px 1px 0; +} +.parameters th { background: #90b8de; } +.exceptions th { background: #deb890; } + +.parameters td, .exceptions td { + padding: 3px 10px; + border-top: 1px solid #ddd; + vertical-align: top; +} + +.parameters tr:first-child td, .exceptions tr:first-child td { + border-top: none; +} + +.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName { + width: 100px; +} + +.parameters td.prmType { + width: 120px; +} + +table.exceptions table { + border-spacing: 0; + border-collapse: collapse; + width: 100%; +} +</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head> + <body><div class="head"> + <p> + + <a href="http://www.w3.org/"><img width="72" height="48" src="https://www.w3.org/Icons/w3c_home" alt="W3C"></a> + + </p> + <h1 class="title" id="title">Battery Status API</h1> + + <h2 id="w3c-editor-s-draft-06-february-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 06 February 2013</h2> + <dl> + + <dt>This version:</dt> + <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/default/battery/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/default/battery/Overview.html</a></dd> + <dt>Latest published version:</dt> + <dd><a href="http://www.w3.org/TR/battery-status/">http://www.w3.org/TR/battery-status/</a></dd> + + + <dt>Latest editor's draft:</dt> + <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/default/battery/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/default/battery/Overview.html</a></dd> + + + <dt>Test suite:</dt> + <dd><a href="http://w3c-test.org/dap/battery/tests/">http://w3c-test.org/dap/battery/tests/</a></dd> + + + + + + + + <dt>Editors:</dt> + <dd><span>Anssi Kostiainen</span>, <a href="http://nokia.com/">Nokia</a></dd> +<dd><span>Mounir Lamouri</span>, <a href="http://mozilla.org/">Mozilla</a></dd> + + + </dl> + + + + + + <p class="copyright"> + <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © + 2013 + + <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> + (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, + <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, + <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. + <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, + <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and + <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. + </p> + + + <hr> +</div> + <section id="abstract" class="introductory"><h2>Abstract</h2><p> This specification defines an API that provides information about the battery status of the hosting device. - </section> + </p></section><section id="sotd" class="introductory"><h2>Status of This Document</h2> + - <section id="sotd"> + + <p> + <em>This section describes the status of this document at the time of its publication. Other + documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision + 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 + index</a> at http://www.w3.org/TR/.</em> + </p> + <p> The functionality described in this specification was initially specified as part of the @@ -45,10 +484,57 @@ specification that could be implemented on its own merits without interference with other, often unrelated, features. </p> - </section> - <section class="informative"> - <h2>Introduction</h2> + <p> + This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as an Editor's Draft. + + + If you wish to make comments regarding this document, please send them to + <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> + (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>, + <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>). + + + + + All comments are welcome. + + + </p><p> + Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership. + This is a draft document and may be updated, replaced or obsoleted by other documents at + any time. It is inappropriate to cite this document as other than work in progress. + </p> + + + <p> + + This document was produced by a group operating under the + <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. + + + + + <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> + + made in connection with the deliverables of the group; that page also includes instructions for + disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains + <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the + information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section + 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. + + + </p> + + + + +</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>Introduction</a></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">2. </span>Conformance</a></li><li class="tocline"><a href="#terminology" class="tocxref"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a href="#security-and-privacy-considerations" class="tocxref"><span class="secno">4. </span>Security and privacy considerations</a></li><li class="tocline"><a href="#navigatorbattery-interface" class="tocxref"><span class="secno">5. </span><span class="formerLink"><code>NavigatorBattery</code></span> Interface</a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">5.1 </span>Attributes</a></li></ul></li><li class="tocline"><a href="#batterymanager-interface" class="tocxref"><span class="secno">6. </span><span class="formerLink"><cod>BatteryManager</code></span> Interface</a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">6.1 </span>Attributes</a></li><li class="tocline"><a href="#event-handlers" class="tocxref"><span class="secno">6.2 </span>Event handlers</a></li></ul></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">7. </span>Examples</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">A. </span>Acknowledgements</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">B.1 </span>Normative references</a></li></ul></li></ul></section> + + + + <section class="informative" id="introduction"> + <!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p> <p> The Battery Status API specification defines a means for web developers to programmatically determine the battery status of the @@ -76,139 +562,144 @@ for new emails every ten seconds without knowledge of the battery status: </p> - <pre class="example sh_javascript"> - <!DOCTYPE html> - <html> - <head> - <title>Email Client</title> - <script> - var mail = { - INTERVAL_DEFAULT: 1000 * 10, - interval: null, - timer: 0, + <div class="example"><div class="example-title"><span>Example 1</span></div><pre class="example highlight prettyprint"><span class="dec"><!DOCTYPE html></span><span class="pln"> +</span><span class="tag"><html></span><span class="pln"> +</span><span class="tag"><head></span><span class="pln"> + </span><span class="tag"><title></span><span class="pln">Email Client</span><span class="tag"></title></span><span class="pln"> + </span><span class="tag"><script></span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> mail </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + INTERVAL_DEFAULT</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln"> + interval</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">,</span><span class="pln"> + timer</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> - check: function () { - console.log('Checking the server for new emails using an interval of ' + - (mail.interval / 1000) + ' seconds.'); - }, - - setTimer: function (interval) { - if (interval === mail.interval) { return; } - if (mail.timer !== 0) { clearTimeout(mail.timer); } - if (interval) { mail.timer = setInterval(function () { mail.check(); }, interval); } - mail.interval = interval; - } - }; + check</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'Checking the server for new emails using an interval of '</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">/</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">' seconds.'</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> + + setTimer</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval </span><span class="pun">===</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> + </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">timer </span><span class="pun">!==</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> clearTimeout</span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">timer</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> + </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">timer </span><span class="pun">=</span><span class="pln"> setInterval</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">check</span><span class="pun">();</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> interval</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> + mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">=</span><span class="pln"> interval</span><span class="pun">;</span><span class="pln"> + </span><span class="pun">}</span><span class="pln"> + </span><span class="pun">};</span><span class="pln"> - window.addEventListener('load', function () { - mail.setTimer(!mail.interval ? mail.INTERVAL_DEFAULT : mail.interval); - }, false); - </script> - </head> - <body></body> - </html> - - </pre> + window</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'load'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(!</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">?</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">INTERVAL_DEFAULT </span><span class="pun">:</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">interval</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + </span><span class="tag"></script></span><span class="pln"> +</span><span class="tag"></head></span><span class="pln"> +</span><span class="tag"><body></body></span><span class="pln"> +</span><span class="tag"></html></span></pre></div> <p> The script will always check for emails every ten seconds, even if the battery level is critically low and the device is not charging. This is an example of poor resource management. </p> <p> - Using the <a>BatteryManager</a> interface, the web application is, for + Using the <a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a> interface, the web application is, for example, able to throttle checking for emails if the device is low on battery, stop checking for emails if the battery is critically low and resume normal operation when the battery is charging: </p> - <pre class="example sh_javascript"> - <!DOCTYPE html> - <html> - <head> - <title>Battery-aware Email Client</title> - <script> - var mail = { - INTERVAL_BATTERY_LOW: 1000 * 60 * 10, - INTERVAL_DEFAULT: 1000 * 10, - interval: null, - timer: 0, - - check: function () { - console.log('Checking the server for new emails using an interval of ' + - (mail.interval / 1000) + ' seconds.'); - }, - - setTimer: function (interval) { - if (interval === mail.interval) { return; } - if (mail.timer !== 0) { clearTimeout(mail.timer); } - if (interval) { mail.timer = setInterval(function () { mail.check(); }, interval); } - mail.interval = interval; - } - }; - - window.addEventListener('load', function () { - mail.setTimer(!mail.interval ? mail.INTERVAL_DEFAULT : mail.interval); - }, false); - - var battery = navigator.battery; - - battery.addEventListener('dischargingtimechange', function () { - if (battery.dischargingTime < 60 * 30 || battery.level < 0.1) { - mail.setTimer(mail.INTERVAL_BATTERY_LOW); - console.log('30 minutes remaining or level below 10%, checking the server less frequently.'); - } else if (battery.dischargingTime < 60 * 10 || battery.level < 0.05) { - mail.setTimer(null); - console.log('10 minutes remaining or level below 5%, stop checking the server.'); - } - }, false); - - battery.addEventListener('chargingchange', function () { - if (battery.charging) { - mail.setTimer(mail.INTERVAL_DEFAULT); - console.log('Battery is charging, checking the server normally.'); - } - }, false); - </script> - </head> - <body></body> - </html> - </pre> + <div class="example"><div class="example-title"><span>Example 2</span></div><pre class="example highlight prettyprint"><span class="dec"><!DOCTYPE html></span><span class="pln"> +</span><span class="tag"><html></span><span class="pln"> +</span><span class="tag"><head></span><span class="pln"> + </span><span class="tag"><title></span><span class="pln">Battery-aware Email Client</span><span class="tag"></title></span><span class="pln"> + </span><span class="tag"><script></span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> mail </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + INTERVAL_BATTERY_LOW</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">60</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln"> + INTERVAL_DEFAULT</span><span class="pun">:</span><span class="pln"> </span><span class="lit">1000</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">10</span><span class="pun">,</span><span class="pln"> + interval</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">,</span><span class="pln"> + timer</span><span class="pun">:</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> + + check</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'Checking the server for new emails using an interval of '</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">/</span><span class="pln"> </span><span class="lit">1000</span><span class="pun">)</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">' seconds.'</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> + + setTimer</span><span class="pun">:</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval </span><span class="pun">===</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="kwd">return</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> + </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">timer </span><span class="pun">!==</span><span class="pln"> </span><span class="lit">0</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> clearTimeout</span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">timer</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> + </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">interval</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">timer </span><span class="pun">=</span><span class="pln"> setInterval</span><span class="pun">(</span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">check</span><span class="pun">();</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> interval</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> + mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">=</span><span class="pln"> interval</span><span class="pun">;</span><span class="pln"> + </span><span class="pun">}</span><span class="pln"> + </span><span class="pun">};</span><span class="pln"> + + window</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'load'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(!</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">interval </span><span class="pun">?</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">INTERVAL_DEFAULT </span><span class="pun">:</span><span class="pln"> mail</span><span class="pun">.</span><span class="pln">interval</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + + </span><span class="kwd">var</span><span class="pln"> battery </span><span class="pun">=</span><span class="pln"> navigator</span><span class="pun">.</span><span class="pln">battery</span><span class="pun">;</span><span class="pln"> + + battery</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'dischargingtimechange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">dischargingTime </span><span class="pun"><</span><span class="pln"> </span><span class="lit">60</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">30</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> battery</span><span class="pun">.</span><span class="pln">level </span><span class="pun"><</span><span class="pln"> </span><span class="lit">0.1</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">INTERVAL_BATTERY_LOW</span><span class="pun">);</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'30 minutes remaining or level below 10%, checking the server less frequently.'</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">dischargingTime </span><span class="pun"><</span><span class="pln"> </span><span class="lit">60</span><span class="pln"> </span><span class="pun">*</span><span class="pln"> </span><span class="lit">10</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> battery</span><span class="pun">.</span><span class="pln">level </span><span class="pun"><</span><span class="pln"> </span><span class="lit">0.05</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(</span><span class="kwd">null</span><span class="pun">);</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'10 minutes remaining or level below 5%, stop checking the server.'</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">}</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + + battery</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'chargingchange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">charging</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + mail</span><span class="pun">.</span><span class="pln">setTimer</span><span class="pun">(</span><span class="pln">mail</span><span class="pun">.</span><span class="pln">INTERVAL_DEFAULT</span><span class="pun">);</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="str">'Battery is charging, checking the server normally.'</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">}</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + </span><span class="tag"></script></span><span class="pln"> +</span><span class="tag"></head></span><span class="pln"> +</span><span class="tag"><body></body></span><span class="pln"> +</span><span class="tag"></html></span></pre></div> </section> - <section id="conformance"> + <section id="conformance"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2> +<p> + As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, + and notes in this specification are non-normative. Everything else in this specification is + normative. +</p> +<p> + The key words <em class="rfc2119" title="must">must</em>, <em class="rfc2119" title="must not">must not</em>, <em class="rfc2119" title="required">required</em>, <em class="rfc2119" title="should">should</em>, <em class="rfc2119" title="should not">should not</em>, <em class="rfc2119" title="recommended">recommended</em>, <em class="rfc2119" title="may">may</em>, + and <em class="rfc2119" title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class="bibref" href="#bib-RFC2119">RFC2119</a></cite>]. +</p> + <p> This specification defines conformance criteria that apply to a single - product: the <dfn>user agent</dfn> that implements the + product: the <dfn id="dfn-user-agent">user agent</dfn> that implements the interfaces that it contains. </p> <p> Implementations that use ECMAScript to implement the APIs defined in this specification must implement them in a manner consistent with the - ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]], + ECMAScript Bindings defined in the Web IDL specification [<cite><a class="bibref" href="#bib-WEBIDL">WEBIDL</a></cite>], as this specification uses that specification and terminology. </p> </section> - <section> - <h2>Terminology</h2> + <section id="terminology"> + <!--OddPage--><h2><span class="secno">3. </span>Terminology</h2> <p> The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler"> EventHandler</a></code> interface represents a callback used for event - handlers as defined in [[!HTML5]]. + handlers as defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>]. </p> <p> - The concepts <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task"> + The concepts <dfn id="dfn-queue-a-task"><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task"> queue a task</a></dfn> and - <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event"> - fires a simple event</a></dfn> are defined in [[!HTML5]]. + <dfn id="dfn-fires-a-simple-event"><a href="http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event"> + fires a simple event</a></dfn> are defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>]. </p> <p> - The terms <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers"> + The terms <dfn id="dfn-event-handlers"><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers"> event handlers</a></dfn> and - <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type"> - event handler event types</a></dfn> are defined in [[!HTML5]]. + <dfn id="dfn-event-handler-event-types"><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type"> + event handler event types</a></dfn> are defined in [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>]. </p> </section> - <section> - <h2>Security and privacy considerations</h2> + <section id="security-and-privacy-considerations"> + <!--OddPage--><h2><span class="secno">4. </span>Security and privacy considerations</h2> <p> The API defined in this specification is used to determine the battery status of the hosting device. The information disclosed has minimal @@ -217,125 +708,108 @@ is a battery or not in the hosting device. </p> </section> - <section> - <h2><a>NavigatorBattery</a> Interface</h2> + <section id="navigatorbattery-interface"> + <!--OddPage--><h2><span class="secno">5. </span><a href="#idl-def-NavigatorBattery" class="idlType"><code>NavigatorBattery</code></a> Interface</h2> <p> - The <a>NavigatorBattery</a> interface is exposed on the + The <a href="#idl-def-NavigatorBattery" class="idlType"><code>NavigatorBattery</code></a> interface is exposed on the <code>Navigator</code> object. </p> - <div class="idl" title="Navigator implements NavigatorBattery"></div> - <dl title="[NoInterfaceObject] interface NavigatorBattery" class="idl"> - <dt>readonly attribute BatteryManager battery</dt> - <dd> + <pre class="idl"><span class="idlImplements"><a>Navigator</a> implements <a href="#idl-def-NavigatorBattery" class="idlType"><code>NavigatorBattery</code></a>;</span></pre><div class="idlImplementsDesc"><p>All instances of the <code><a>Navigator</a></code> type are defined to also implement the <a href="#idl-def-NavigatorBattery" class="idlType"><code>NavigatorBattery</code></a> interface.</p></div> + <pre class="idl"><span class="idlInterface" id="idl-def-NavigatorBattery">[<span class="extAttr">NoInterfaceObject</span>] +interface <span class="idlInterfaceID">NavigatorBattery</span> { +<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a></span> <span class="idlAttrName"><a href="#widl-NavigatorBattery-battery">battery</a></span>;</span> +};</span></pre><section id="attributes"><h3><span class="secno">5.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-NavigatorBattery-battery"><code>battery</code> of type <span class="idlAttrType"><a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a></span>, readonly</dt><dd> The object that exposes the battery status information. - </dd> - </dl> + </dd></dl></section> </section> - <section> - <h2><a>BatteryManager</a> Interface</h2> - <dl title="[NoInterfaceObject] - interface BatteryManager : EventTarget" - class="idl"> - <dt>readonly attribute boolean charging</dt> - <dd> + <section id="batterymanager-interface"> + <!--OddPage--><h2><span class="secno">6. </span><a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a> Interface</h2> + <pre class="idl"><span class="idlInterface" id="idl-def-BatteryManager">[<span class="extAttr">NoInterfaceObject</span>] +interface <span class="idlInterfaceID">BatteryManager</span> : <span class="idlSuperclass"><a>EventTarget</a></span> { +<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>boolean</a></span> <span class="idlAttrName"><a href="#widl-BatteryManager-charging">charging</a></span>;</span> +<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unrestricted double</a></span> <span class="idlAttrName"><a href="#widl-BatteryManager-chargingTime">chargingTime</a></span>;</span> +<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unrestricted double</a></span> <span class="idlAttrName"><a href="#widl-BatteryManager-dischargingTime">dischargingTime</a></span>;</span> +<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>double</a></span> <span class="idlAttrName"><a href="#widl-BatteryManager-level">level</a></span>;</span> +<span class="idlAttribute"> attribute <span class="idlAttrType"><a>EventHandler</a></span> <span class="idlAttrName"><a href="#widl-BatteryManager-onchargingchange">onchargingchange</a></span>;</span> +<span class="idlAttribute"> attribute <span class="idlAttrType"><a>EventHandler</a></span> <span class="idlAttrName"><a href="#widl-BatteryManager-onchargingtimechange">onchargingtimechange</a></span>;</span> +<span class="idlAttribute"> attribute <span class="idlAttrType"><a>EventHandler</a></span> <span class="idlAttrName"><a href="#widl-BatteryManager-ondischargingtimechange">ondischargingtimechange</a></span>;</span> +<span class="idlAttribute"> attribute <span class="idlAttrType"><a>EventHandler</a></span> <span class="idlAttrName"><a href="#widl-BatteryManager-onlevelchange">onlevelchange</a></span>;</span> +};</span></pre><section id="attributes-1"><h3><span class="secno">6.1 </span>Attributes</h3><dl class="attributes"><dt id="widl-BatteryManager-charging"><code>charging</code> of type <span class="idlAttrType"><a>boolean</a></span>, readonly</dt><dd> Represents if the system's battery is charging. - </dd> - <dt>readonly attribute unrestricted double chargingTime</dt> - <dd> + </dd><dt id="widl-BatteryManager-chargingTime"><code>chargingTime</code> of type <span class="idlAttrType"><a>unrestricted double</a></span>, readonly</dt><dd> Represents the time remaining in seconds until the system's battery is fully charged. - </dd> - <dt>readonly attribute unrestricted double dischargingTime</dt> - <dd> + </dd><dt id="widl-BatteryManager-dischargingTime"><code>dischargingTime</code> of type <span class="idlAttrType"><a>unrestricted double</a></span>, readonly</dt><dd> Represents the time remaining in seconds until the system's battery is completely discharged and the system is about to be suspended. - </dd> - <dt>readonly attribute double level</dt> - <dd> + </dd><dt id="widl-BatteryManager-level"><code>level</code> of type <span class="idlAttrType"><a>double</a></span>, readonly</dt><dd> Represents the current battery level scaled from 0 to 1.0. - </dd> - <dt class="no-docs"> - attribute EventHandler onchargingchange - </dt> - <dd> - </dd> - <dt class="no-docs"> - attribute EventHandler onchargingtimechange - </dt> - <dd> - </dd> - <dt class="no-docs"> - attribute EventHandler ondischargingtimechange - </dt> - <dd> - </dd> - <dt class="no-docs"> - attribute EventHandler onlevelchange - </dt> - <dd> - </dd> - </dl> + </dd><dt id="widl-BatteryManager-onchargingchange"><code>onchargingchange</code> of type <span class="idlAttrType"><a>EventHandler</a></span></dt><dd> + </dd><dt id="widl-BatteryManager-onchargingtimechange"><code>onchargingtimechange</code> of type <span class="idlAttrType"><a>EventHandler</a></span></dt><dd> + </dd><dt id="widl-BatteryManager-ondischargingtimechange"><code>ondischargingtimechange</code> of type <span class="idlAttrType"><a>EventHandler</a></span></dt><dd> + </dd><dt id="widl-BatteryManager-onlevelchange"><code>onlevelchange</code> of type <span class="idlAttrType"><a>EventHandler</a></span></dt><dd> + </dd></dl></section> <p> When a <code>BatteryManager</code> object is created, - <code>charging</code> MUST be set to true, <code>chargingTime</code> + <code>charging</code> <em class="rfc2119" title="must">must</em> be set to true, <code>chargingTime</code> to 0, <code>level</code> to 1.0 and <code>dischargingTime</code> to the value positive Infinity, if the implementation is unable to report the battery's charging state, charging time, level or remaining time respectively. </p> <p> - The <code>charging</code> attribute MUST be set to false if the battery + The <code>charging</code> attribute <em class="rfc2119" title="must">must</em> be set to false if the battery is discharging, and set to true, if the battery is charging, the implementation is unable to report the state, or there is no battery attached to the system, or otherwise. When the battery charging state - is updated, the <a>user agent</a> MUST <a>queue a task</a> which sets - the <code>charging</code> attribute's value and <a>fires a simple - event</a> named <code><a>chargingchange</a></code> at the - <a>BatteryManager</a> object. + is updated, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="#dfn-queue-a-task" class="internalDFN">queue a task</a> which sets + the <code>charging</code> attribute's value and <a href="#dfn-fires-a-simple-event" class="internalDFN">fires a simple + event</a> named <code><a href="#dfn-chargingchange" class="internalDFN">chargingchange</a></code> at the + <a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a> object. </p> <p> - The <code>chargingTime</code> attribute MUST be set to 0, if the + The <code>chargingTime</code> attribute <em class="rfc2119" title="must">must</em> be set to 0, if the battery is full or there is no battery attached to the system, and to the value positive Infinity if the battery is discharging, the implementation is unable to report the remaining charging time, or - otherwise. When the battery charging time is updated, the <a>user - agent</a> MUST <a>queue a task</a> which sets the - <code>chargingTime</code> attribute's value and <a>fires a simple - event</a> named <code><a>chargingtimechange</a></code> at the - <a>BatteryManager</a> object. + otherwise. When the battery charging time is updated, the <a href="#dfn-user-agent" class="internalDFN">user + agent</a> <em class="rfc2119" title="must">must</em> <a href="#dfn-queue-a-task" class="internalDFN">queue a task</a> which sets the + <code>chargingTime</code> attribute's value and <a href="#dfn-fires-a-simple-event" class="internalDFN">fires a simple + event</a> named <code><a href="#dfn-chargingtimechange" class="internalDFN">chargingtimechange</a></code> at the + <a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a> object. </p> <p> - The <code>dischargingTime</code> attribute MUST be set to the value + The <code>dischargingTime</code> attribute <em class="rfc2119" title="must">must</em> be set to the value positive Infinity, if the battery is charging, the implementation is unable to report the remaining discharging time, there is no battery attached to the system, or otherwise. When the battery discharging time - is updated, the <a>user agent</a> MUST <a>queue a task</a> which sets - the <code>dischargingTime</code> attribute's value and <a>fires a - simple event </a> named <code><a>dischargingtimechange</a></code> at the - <a>BatteryManager</a> object. + is updated, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="#dfn-queue-a-task" class="internalDFN">queue a task</a> which sets + the <code>dischargingTime</code> attribute's value and <a href="#dfn-fires-a-simple-event" class="internalDFN">fires a + simple event </a> named <code><a href="#dfn-dischargingtimechange" class="internalDFN">dischargingtimechange</a></code> at the + <a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a> object. </p> <p> - The <code>level</code> attribute MUST be set to 0 if the system's + The <code>level</code> attribute <em class="rfc2119" title="must">must</em> be set to 0 if the system's battery is depleted and the system is about to be suspended, and to 1.0 if the battery is full, the implementation is unable to report the battery's level, or there is no battery attached to the system. When - the battery level is updated, the <a>user agent</a> MUST <a>queue a + the battery level is updated, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> <a href="#dfn-queue-a-task" class="internalDFN">queue a task</a> which sets the <code>level</code> attribute's value and - <a>fires a simple event</a> named <code><a>levelchange</a></code> at - the <a>BatteryManager</a> object. + <a href="#dfn-fires-a-simple-event" class="internalDFN">fires a simple event</a> named <code><a href="#dfn-levelchange" class="internalDFN">levelchange</a></code> at + the <a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a> object. </p> - <div class="note"> - The definition of how often the <code><a>chargingtimechange</a></code>, - <code><a>dischargingtimechange</a></code>, and <code><a>levelchange</a> + <div class="note"><div class="note-title"><span>Note</span></div><div class=""> + The definition of how often the <code><a href="#dfn-chargingtimechange" class="internalDFN">chargingtimechange</a></code>, + <code><a href="#dfn-dischargingtimechange" class="internalDFN">dischargingtimechange</a></code>, and <code><a href="#dfn-levelchange" class="internalDFN">levelchange</a> </code> events are fired is left to the implementation. - </div> - <section> - <h2>Event handlers</h2> + </div></div> + <section id="event-handlers"> + <h3><span class="secno">6.2 </span>Event handlers</h3> <p> - The following are the <a>event handlers</a> (and their corresponding - <a>event handler event types</a>) that MUST be supported as - attributes by the <a>BatteryManager</a> object: + The following are the <a href="#dfn-event-handlers" class="internalDFN">event handlers</a> (and their corresponding + <a href="#dfn-event-handler-event-types" class="internalDFN">event handler event types</a>) that <em class="rfc2119" title="must">must</em> be supported as + attributes by the <a href="#idl-def-BatteryManager" class="idlType"><code>BatteryManager</code></a> object: </p> <table class="simple"> <thead> @@ -347,80 +821,74 @@ <tbody> <tr> <td><strong><code>onchargingchange</code></strong></td> - <td><code><dfn>chargingchange</dfn></code></td> + <td><code><dfn id="dfn-chargingchange">chargingchange</dfn></code></td> </tr> <tr> <td><strong><code>onchargingtimechange</code></strong></td> - <td><code><dfn>chargingtimechange</dfn></code></td> + <td><code><dfn id="dfn-chargingtimechange">chargingtimechange</dfn></code></td> </tr> <tr> <td><strong><code>ondischargingtimechange</code></strong></td> - <td><code><dfn>dischargingtimechange</dfn></code></td> + <td><code><dfn id="dfn-dischargingtimechange">dischargingtimechange</dfn></code></td> </tr> <tr> <td><strong><code>onlevelchange</code></strong></td> - <td><code><dfn>levelchange</dfn></code></td> + <td><code><dfn id="dfn-levelchange">levelchange</dfn></code></td> </tr> </tbody> </table> </section> </section> - <section class="informative"> - <h2>Examples</h2> + <section class="informative" id="examples"> + <!--OddPage--><h2><span class="secno">7. </span>Examples</h2><p><em>This section is non-normative.</em></p> <p> This trivial example writes the battery level to the console each time the level changes: </p> - <pre class="example sh_javascript"> - navigator.battery.onlevelchange = function () { - console.log(navigator.battery.level); - }; - </pre> + <div class="example"><div class="example-title"><span>Example 3</span></div><pre class="example highlight prettyprint"><span class="pln">navigator</span><span class="pun">.</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">onlevelchange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">level</span><span class="pun">);</span><span class="pln"> +</span><span class="pun">};</span></pre></div> <p> Alternatively, the same using the <code>addEventListener()</code> method: </p> - <pre class="example sh_javascript"> - navigator.battery.addEventListener('levelchange', function () { - console.log(navigator.battery.level); - }, false); - </pre> + <div class="example"><div class="example-title"><span>Example 4</span></div><pre class="example highlight prettyprint"><span class="pln">navigator</span><span class="pun">.</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'levelchange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">battery</span><span class="pun">.</span><span class="pln">level</span><span class="pun">);</span><span class="pln"> +</span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span></pre></div> <p> The following example updates the indicators to show the charging state, level and time remaining in minutes: </p> - <pre class="example sh_javascript"> - <!DOCTYPE html> - <html> - <head> - <title>Battery Status API Example</title> - <script> - var battery = navigator.battery; - - battery.onchargingchange = function () { - document.querySelector('#charging').textContent = battery.charging ? 'charging' : 'not charging'; - }; + <div class="example"><div class="example-title"><span>Example 5</span></div><pre class="example highlight prettyprint"><span class="dec"><!DOCTYPE html></span><span class="pln"> +</span><span class="tag"><html></span><span class="pln"> +</span><span class="tag"><head></span><span class="pln"> + </span><span class="tag"><title></span><span class="pln">Battery Status API Example</span><span class="tag"></title></span><span class="pln"> + </span><span class="tag"><script></span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> battery </span><span class="pun">=</span><span class="pln"> navigator</span><span class="pun">.</span><span class="pln">battery</span><span class="pun">;</span><span class="pln"> + + battery</span><span class="pun">.</span><span class="pln">onchargingchange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + document</span><span class="pun">.</span><span class="pln">querySelector</span><span class="pun">(</span><span class="str">'#charging'</span><span class="pun">).</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> battery</span><span class="pun">.</span><span class="pln">charging </span><span class="pun">?</span><span class="pln"> </span><span class="str">'charging'</span><span class="pln"> </span><span class="pun">:</span><span class="pln"> </span><span class="str">'not charging'</span><span class="pun">;</span><span class="pln"> + </span><span class="pun">};</span><span class="pln"> - battery.onlevelchange = function () { - document.querySelector('#level').textContent = battery.level; - }; + battery</span><span class="pun">.</span><span class="pln">onlevelchange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + document</span><span class="pun">.</span><span class="pln">querySelector</span><span class="pun">(</span><span class="str">'#level'</span><span class="pun">).</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> battery</span><span class="pun">.</span><span class="pln">level</span><span class="pun">;</span><span class="pln"> + </span><span class="pun">};</span><span class="pln"> - battery.ondischargingtimechange = function () { - document.querySelector('#dischargingTime').textContent = battery.dischargingTime / 60; - }; - </script> - </head> - <body> - <div id="charging">(charging state unknown)</div> - <div id="level">(battery level unknown)</div> - <div id="dischargingTime">(discharging time unknown)</div> - </body> - </html> - </pre> + battery</span><span class="pun">.</span><span class="pln">ondischargingtimechange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + document</span><span class="pun">.</span><span class="pln">querySelector</span><span class="pun">(</span><span class="str">'#dischargingTime'</span><span class="pun">).</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> battery</span><span class="pun">.</span><span class="pln">dischargingTime </span><span class="pun">/</span><span class="pln"> </span><span class="lit">60</span><span class="pun">;</span><span class="pln"> + </span><span class="pun">};</span><span class="pln"> + </span><span class="tag"></script></span><span class="pln"> +</span><span class="tag"></head></span><span class="pln"> +</span><span class="tag"><body></span><span class="pln"> + </span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"charging"</span><span class="tag">></span><span class="pln">(charging state unknown)</span><span class="tag"></div></span><span class="pln"> + </span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"level"</span><span class="tag">></span><span class="pln">(battery level unknown)</span><span class="tag"></div></span><span class="pln"> + </span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"dischargingTime"</span><span class="tag">></span><span class="pln">(discharging time unknown)</span><span class="tag"></div></span><span class="pln"> +</span><span class="tag"></body></span><span class="pln"> +</span><span class="tag"></html></span></pre></div> </section> - <section class="appendix"> - <h2>Acknowledgements</h2> + <section class="appendix" id="acknowledgements"> + <!--OddPage--><h2><span class="secno">A. </span>Acknowledgements</h2> <p> The group is deeply indebted to Mounir Lamouri, Jonas Sicking, and the Mozilla WebAPI team in general for their invaluable feedback @@ -436,5 +904,9 @@ doing so. </p> </section> - </body> -</html> + + +<section id="references" class="appendix"><!--OddPage--><h2><span class="secno">B. </span>References</h2><section id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-HTML5">[HTML5]</dt><dd>Robin Berjon et al. <a href="http://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. 17 December 2012. W3C Candidate Recommendation. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a> +</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> +</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. URL: <a href="http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a> +</dd></dl></section></section></body></html> \ No newline at end of file diff -r 1dd6a0a5cbc5 -r d3c0dcc5d055 battery/Overview.src.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/battery/Overview.src.html Wed Feb 06 09:03:57 2013 -0500 @@ -0,0 +1,441 @@ +<!DOCTYPE html> +<html> + <head> + <title>Battery Status API</title> + <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> + <script src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script> + <script class="remove"> + var respecConfig = { + specStatus: "ED", + shortName: "battery-status", + //publishDate: "2012-05-08", + previousPublishDate: "2012-05-08", + previousMaturity: "CR", + edDraftURI: "http://dvcs.w3.org/hg/dap/raw-file/default/battery/Overview.html", + // lcEnd: "2011-12-20", + crEnd: "2012-07-01", + editors: [ + { name: "Anssi Kostiainen", company: "Nokia", companyURL: "http://nokia.com/" }, + { name: "Mounir Lamouri", company: "Mozilla", companyURL: "http://mozilla.org/" } + ], + inlineCSS: true, + noIDLIn: true, + extraCSS: ["../ReSpec.js/css/respec.css"], + wg: "Device APIs Working Group", + wgURI: "http://www.w3.org/2009/dap/", + wgPublicList: "public-device-apis", + wgPatentURI: "http://www.w3.org/2004/01/pp-impl/43696/status", + testSuiteURI: "http://w3c-test.org/dap/battery/tests/", + scheme: "https" + }; + </script> + </head> + <body> + <section id="abstract"> + This specification defines an API that provides information about the + battery status of the hosting device. + </section> + + <section id="sotd"> + <p> + The functionality described in this specification was initially + specified as part of the + <a href="http://www.w3.org/TR/system-info-api/">System Information + API</a> but has been extracted in order to be more readily available, + more straightforward to implement, and in order to produce a + specification that could be implemented on its own merits without + interference with other, often unrelated, features. + </p> + </section> + + <section class="informative"> + <h2>Introduction</h2> + <p> + The Battery Status API specification defines a means for web + developers to programmatically determine the battery status of the + hosting device. Without knowing the battery status of a device, a web + developer must design the web application with an assumption of + sufficient battery level for the task at hand. This means the battery + of a device may exhaust faster than desired because web developers are + unable to make decisions based on the battery status. Given knowledge + of the battery status, web developers are able to craft web content and + applications which are power-efficient, thereby leading to improved + user experience. + </p> + <p> + The Battery Status API can be used to defer or scale back work when + the device is not charging in or is low on battery. An archetype of an + advanced web application, a web-based email client, may check the + server for new email every few seconds if the device is charging, + but do so less frequently if the device is not charging or is low on + battery. Another example is a web-based word processor which could + monitor the battery level and save changes before the battery runs + out to prevent data loss. + </p> + <p> + The following example shows how a web-based email client could check + for new emails every ten seconds without knowledge of the battery + status: + </p> + <pre class="example sh_javascript"> + <!DOCTYPE html> + <html> + <head> + <title>Email Client</title> + <script> + var mail = { + INTERVAL_DEFAULT: 1000 * 10, + interval: null, + timer: 0, + + check: function () { + console.log('Checking the server for new emails using an interval of ' + + (mail.interval / 1000) + ' seconds.'); + }, + + setTimer: function (interval) { + if (interval === mail.interval) { return; } + if (mail.timer !== 0) { clearTimeout(mail.timer); } + if (interval) { mail.timer = setInterval(function () { mail.check(); }, interval); } + mail.interval = interval; + } + }; + + window.addEventListener('load', function () { + mail.setTimer(!mail.interval ? mail.INTERVAL_DEFAULT : mail.interval); + }, false); + </script> + </head> + <body></body> + </html> + + </pre> + <p> + The script will always check for emails every ten seconds, even if the + battery level is critically low and the device is not charging. + This is an example of poor resource management. + </p> + <p> + Using the <a>BatteryManager</a> interface, the web application is, for + example, able to throttle checking for emails if the device is low on + battery, stop checking for emails if the battery is critically low and + resume normal operation when the battery is charging: + </p> + <pre class="example sh_javascript"> + <!DOCTYPE html> + <html> + <head> + <title>Battery-aware Email Client</title> + <script> + var mail = { + INTERVAL_BATTERY_LOW: 1000 * 60 * 10, + INTERVAL_DEFAULT: 1000 * 10, + interval: null, + timer: 0, + + check: function () { + console.log('Checking the server for new emails using an interval of ' + + (mail.interval / 1000) + ' seconds.'); + }, + + setTimer: function (interval) { + if (interval === mail.interval) { return; } + if (mail.timer !== 0) { clearTimeout(mail.timer); } + if (interval) { mail.timer = setInterval(function () { mail.check(); }, interval); } + mail.interval = interval; + } + }; + + window.addEventListener('load', function () { + mail.setTimer(!mail.interval ? mail.INTERVAL_DEFAULT : mail.interval); + }, false); + + var battery = navigator.battery; + + battery.addEventListener('dischargingtimechange', function () { + if (battery.dischargingTime < 60 * 30 || battery.level < 0.1) { + mail.setTimer(mail.INTERVAL_BATTERY_LOW); + console.log('30 minutes remaining or level below 10%, checking the server less frequently.'); + } else if (battery.dischargingTime < 60 * 10 || battery.level < 0.05) { + mail.setTimer(null); + console.log('10 minutes remaining or level below 5%, stop checking the server.'); + } + }, false); + + battery.addEventListener('chargingchange', function () { + if (battery.charging) { + mail.setTimer(mail.INTERVAL_DEFAULT); + console.log('Battery is charging, checking the server normally.'); + } + }, false); + </script> + </head> + <body></body> + </html> + </pre> + </section> + + <section id="conformance"> + <p> + This specification defines conformance criteria that apply to a single + product: the <dfn>user agent</dfn> that implements the + interfaces that it contains. + </p> + <p> + Implementations that use ECMAScript to implement the APIs defined in + this specification must implement them in a manner consistent with the + ECMAScript Bindings defined in the Web IDL specification [[!WEBIDL]], + as this specification uses that specification and terminology. + </p> + </section> + <section> + <h2>Terminology</h2> + <p> + The <code><a href="http://dev.w3.org/html5/spec/webappapis.html#eventhandler"> + EventHandler</a></code> interface represents a callback used for event + handlers as defined in [[!HTML5]]. + </p> + <p> + The concepts <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#queue-a-task"> + queue a task</a></dfn> and + <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#fire-a-simple-event"> + fires a simple event</a></dfn> are defined in [[!HTML5]]. + </p> + <p> + The terms <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handlers"> + event handlers</a></dfn> and + <dfn><a href="http://dev.w3.org/html5/spec/webappapis.html#event-handler-event-type"> + event handler event types</a></dfn> are defined in [[!HTML5]]. + </p> + </section> + <section> + <h2>Security and privacy considerations</h2> + <p> + The API defined in this specification is used to determine the battery + status of the hosting device. The information disclosed has minimal + impact on privacy or fingerprinting, and therefore is exposed without + permission grants. For example, authors cannot directly know if there + is a battery or not in the hosting device. + </p> + </section> + <section> + <h2><a>NavigatorBattery</a> Interface</h2> + <p> + The <a>NavigatorBattery</a> interface is exposed on the + <code>Navigator</code> object. + </p> + <div class="idl" title="Navigator implements NavigatorBattery"></div> + <dl title="[NoInterfaceObject] interface NavigatorBattery" class="idl"> + <dt>readonly attribute BatteryManager battery</dt> + <dd> + The object that exposes the battery status information. + </dd> + </dl> + </section> + + <section> + <h2><a>BatteryManager</a> Interface</h2> + <dl title="[NoInterfaceObject] + interface BatteryManager : EventTarget" + class="idl"> + <dt>readonly attribute boolean charging</dt> + <dd> + Represents if the system's battery is charging. + </dd> + <dt>readonly attribute unrestricted double chargingTime</dt> + <dd> + Represents the time remaining in seconds until the system's battery + is fully charged. + </dd> + <dt>readonly attribute unrestricted double dischargingTime</dt> + <dd> + Represents the time remaining in seconds until the system's battery + is completely discharged and the system is about to be suspended. + </dd> + <dt>readonly attribute double level</dt> + <dd> + Represents the current battery level scaled from 0 to 1.0. + </dd> + <dt class="no-docs"> + attribute EventHandler onchargingchange + </dt> + <dd> + </dd> + <dt class="no-docs"> + attribute EventHandler onchargingtimechange + </dt> + <dd> + </dd> + <dt class="no-docs"> + attribute EventHandler ondischargingtimechange + </dt> + <dd> + </dd> + <dt class="no-docs"> + attribute EventHandler onlevelchange + </dt> + <dd> + </dd> + </dl> + <p> + When a <code>BatteryManager</code> object is created, + <code>charging</code> MUST be set to true, <code>chargingTime</code> + to 0, <code>level</code> to 1.0 and <code>dischargingTime</code> to + the value positive Infinity, if the implementation is unable to report + the battery's charging state, charging time, level or remaining time + respectively. + </p> + <p> + The <code>charging</code> attribute MUST be set to false if the battery + is discharging, and set to true, if the battery is charging, the + implementation is unable to report the state, or there is no battery + attached to the system, or otherwise. When the battery charging state + is updated, the <a>user agent</a> MUST <a>queue a task</a> which sets + the <code>charging</code> attribute's value and <a>fires a simple + event</a> named <code><a>chargingchange</a></code> at the + <a>BatteryManager</a> object. + </p> + <p> + The <code>chargingTime</code> attribute MUST be set to 0, if the + battery is full or there is no battery attached to the system, and to + the value positive Infinity if the battery is discharging, the + implementation is unable to report the remaining charging time, or + otherwise. When the battery charging time is updated, the <a>user + agent</a> MUST <a>queue a task</a> which sets the + <code>chargingTime</code> attribute's value and <a>fires a simple + event</a> named <code><a>chargingtimechange</a></code> at the + <a>BatteryManager</a> object. + </p> + <p> + The <code>dischargingTime</code> attribute MUST be set to the value + positive Infinity, if the battery is charging, the implementation is + unable to report the remaining discharging time, there is no battery + attached to the system, or otherwise. When the battery discharging time + is updated, the <a>user agent</a> MUST <a>queue a task</a> which sets + the <code>dischargingTime</code> attribute's value and <a>fires a + simple event </a> named <code><a>dischargingtimechange</a></code> at the + <a>BatteryManager</a> object. + </p> + <p> + The <code>level</code> attribute MUST be set to 0 if the system's + battery is depleted and the system is about to be suspended, and to + 1.0 if the battery is full, the implementation is unable to report the + battery's level, or there is no battery attached to the system. When + the battery level is updated, the <a>user agent</a> MUST <a>queue a + task</a> which sets the <code>level</code> attribute's value and + <a>fires a simple event</a> named <code><a>levelchange</a></code> at + the <a>BatteryManager</a> object. + </p> + <div class="note"> + The definition of how often the <code><a>chargingtimechange</a></code>, + <code><a>dischargingtimechange</a></code>, and <code><a>levelchange</a> + </code> events are fired is left to the implementation. + </div> + <section> + <h2>Event handlers</h2> + <p> + The following are the <a>event handlers</a> (and their corresponding + <a>event handler event types</a>) that MUST be supported as + attributes by the <a>BatteryManager</a> object: + </p> + <table class="simple"> + <thead> + <tr> + <th>event handler</th> + <th>event handler event type</th> + </tr> + </thead> + <tbody> + <tr> + <td><strong><code>onchargingchange</code></strong></td> + <td><code><dfn>chargingchange</dfn></code></td> + </tr> + <tr> + <td><strong><code>onchargingtimechange</code></strong></td> + <td><code><dfn>chargingtimechange</dfn></code></td> + </tr> + <tr> + <td><strong><code>ondischargingtimechange</code></strong></td> + <td><code><dfn>dischargingtimechange</dfn></code></td> + </tr> + <tr> + <td><strong><code>onlevelchange</code></strong></td> + <td><code><dfn>levelchange</dfn></code></td> + </tr> + </tbody> + </table> + </section> + </section> + + <section class="informative"> + <h2>Examples</h2> + <p> + This trivial example writes the battery level to the console each time + the level changes: + </p> + <pre class="example sh_javascript"> + navigator.battery.onlevelchange = function () { + console.log(navigator.battery.level); + }; + </pre> + <p> + Alternatively, the same using the <code>addEventListener()</code> + method: + </p> + <pre class="example sh_javascript"> + navigator.battery.addEventListener('levelchange', function () { + console.log(navigator.battery.level); + }, false); + </pre> + <p> + The following example updates the indicators to show the charging + state, level and time remaining in minutes: + </p> + <pre class="example sh_javascript"> + <!DOCTYPE html> + <html> + <head> + <title>Battery Status API Example</title> + <script> + var battery = navigator.battery; + + battery.onchargingchange = function () { + document.querySelector('#charging').textContent = battery.charging ? 'charging' : 'not charging'; + }; + + battery.onlevelchange = function () { + document.querySelector('#level').textContent = battery.level; + }; + + battery.ondischargingtimechange = function () { + document.querySelector('#dischargingTime').textContent = battery.dischargingTime / 60; + }; + </script> + </head> + <body> + <div id="charging">(charging state unknown)</div> + <div id="level">(battery level unknown)</div> + <div id="dischargingTime">(discharging time unknown)</div> + </body> + </html> + </pre> + </section> + <section class="appendix"> + <h2>Acknowledgements</h2> + <p> + The group is deeply indebted to Mounir Lamouri, Jonas Sicking, and + the Mozilla WebAPI team in general for their invaluable feedback + based on prototype implementations. Many thanks to the people behind + the System Information API and Device Orientation Event specification + for the initial inspiration. Also thanks to the nice folks bringing us + the Page Visibility specification, which motivated the editor of this + specification to write the introduction chapter discussing some + real-world high value use cases that apply equally to this + specification. Special thanks to all the participants of the Device + APIs Working Group and others who have sent in substantial feedback + and comments, and made the Web a better place for everyone by + doing so. + </p> + </section> + </body> +</html> diff -r 1dd6a0a5cbc5 -r d3c0dcc5d055 discovery-api/Overview.html --- a/discovery-api/Overview.html Wed Feb 06 09:02:26 2013 -0500 +++ b/discovery-api/Overview.html Wed Feb 06 09:03:57 2013 -0500 @@ -1,12 +1,12 @@ <!DOCTYPE html> -<html lang="en" dir="ltr"> -<head> +<html lang="en" + dir="ltr"> + <head> <title> Network Service Discovery </title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - - + <meta http-equiv="Content-Type" + content="text/html; charset=utf-8"> <style type="text/css"> /* Custom ReSpec CSS (by Rich Tibbett) */ @@ -39,360 +39,448 @@ table tbody th:first-child { border-left:solid } table td, table th { border-left:solid; border-right:solid; border-bottom:solid thin; vertical-align:top; padding:0.2em } </style> - <style>/***************************************************************** - * ReSpec 3 CSS - * Robin Berjon - http://berjon.com/ - *****************************************************************/ + <style type="text/css"> +/***************************************************************** + * ReSpec 3 CSS + * Robin Berjon - http://berjon.com/ + *****************************************************************/ -/* --- INLINES --- */ -em.rfc2119 { + /* --- INLINES --- */ + em.rfc2119 { text-transform: lowercase; font-variant: small-caps; font-style: normal; color: #900; -} + } -h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym, -h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr { + h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym, + h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr { border: none; -} + } -dfn { + dfn { font-weight: bold; -} + } -a.internalDFN { + a.internalDFN { color: inherit; border-bottom: 1px solid #99c; text-decoration: none; -} + } -a.externalDFN { + a.externalDFN { color: inherit; border-bottom: 1px dotted #ccc; text-decoration: none; -} + } -a.bibref { + a.bibref { text-decoration: none; -} + } -cite .bibref { + cite .bibref { font-style: normal; -} + } -code { + code { color: #ff4500; -} + } -/* --- --- */ -ol.algorithm { counter-reset:numsection; list-style-type: none; } -ol.algorithm li { margin: 0.5em 0; } -ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; } + /* --- --- */ + ol.algorithm { counter-reset:numsection; list-style-type: none; } + ol.algorithm li { margin: 0.5em 0; } + ol.algorithm li:before { font-weight: bold; counter-increment: numsection; content: counters(numsection, ".") ") "; } -/* --- TOC --- */ -.toc a, .tof a { + /* --- TOC --- */ + .toc a, .tof a { text-decoration: none; -} + } -a .secno, a .figno { + a .secno, a .figno { color: #000; -} + } -ul.tof, ol.tof { + ul.tof, ol.tof { list-style: none outside none; -} + } -.caption { + .caption { margin-top: 0.5em; font-style: italic; -} + } -/* --- TABLE --- */ -table.simple { + /* --- TABLE --- */ + table.simple { border-spacing: 0; border-collapse: collapse; border-bottom: 3px solid #005a9c; -} + } -.simple th { + .simple th { background: #005a9c; color: #fff; padding: 3px 5px; text-align: left; -} + } -.simple th[scope="row"] { + .simple th[scope="row"] { background: inherit; color: inherit; border-top: 1px solid #ddd; -} + } -.simple td { + .simple td { padding: 3px 10px; border-top: 1px solid #ddd; -} + } -.simple tr:nth-child(even) { + .simple tr:nth-child(even) { background: #f0f6ff; -} + } -/* --- DL --- */ -.section dd > p:first-child { + /* --- DL --- */ + .section dd > p:first-child { margin-top: 0; -} + } -.section dd > p:last-child { + .section dd > p:last-child { margin-bottom: 0; -} + } -.section dd { + .section dd { margin-bottom: 1em; -} + } -.section dl.attrs dd, .section dl.eldef dd { + .section dl.attrs dd, .section dl.eldef dd { margin-bottom: 0; -} -</style><style>/* --- ISSUES/NOTES --- */ -div.issue-title, div.note-title { + } + </style> + <style type="text/css"> +/* --- ISSUES/NOTES --- */ + div.issue-title, div.note-title { padding-right: 1em; min-width: 7.5em; color: #b9ab2d; -} -div.issue-title { color: #e05252; } -div.note-title { color: #52e052; } -div.issue-title span, div.note-title span { + } + div.issue-title { color: #e05252; } + div.note-title { color: #52e052; } + div.issue-title span, div.note-title span { text-transform: uppercase; -} -div.note, div.issue { + } + div.note, div.issue { margin-top: 1em; margin-bottom: 1em; -} -.note > p:first-child, .issue > p:first-child { margin-top: 0 } -.issue, .note { + } + .note > p:first-child, .issue > p:first-child { margin-top: 0 } + .issue, .note { padding: .5em; border-left-width: .5em; border-left-style: solid; -} -div.issue, div.note { + } + div.issue, div.note { padding: 0.5em; margin: 1em 0; position: relative; clear: both; -} -span.note, span.issue { padding: .1em .5em .15em; } + } + span.note, span.issue { padding: .1em .5em .15em; } -.issue { + .issue { border-color: #e05252; background: #fbe9e9; -} -.note { + } + .note { border-color: #52e052; background: #e9fbe9; -} + } -</style><style>/* HIGHLIGHTS */ -code.prettyprint { + </style> + <style type="text/css"> +/* HIGHLIGHTS */ + code.prettyprint { color: inherit; -} + } -/* this from google-code-prettify */ -.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} -</style><link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='http://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head> - <body><div class="head"> - <p> - - <a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a> - - </p> - <h1 class="title" id="title">Network Service Discovery</h1> - - <h2 id="w3c-editor-s-draft-17-january-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 17 January 2013</h2> - <dl> - - <dt>This version:</dt> - <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> - <dt>Latest published version:</dt> - <dd><a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a></dd> - - - <dt>Latest editor's draft:</dt> - <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> - - - - - - - - - <dt>Editors:</dt> - <dd><span>Rich Tibbett</span>, <a href="http://opera.com/">Opera Software ASA</a></dd> -<dd><span>Clarke Stevens</span>, <a href="http://cablelabs.com/">CableLabs</a></dd> - - - </dl> - - - - - + /* this from google-code-prettify */ + .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} + </style> + <link rel="stylesheet" + href="http://www.w3.org/StyleSheets/TR/W3C-ED" + type="text/css"> + </head> + <body> + <div class="head"> + <p> + <a href="http://www.w3.org/"><img width="72" + height="48" + src="http://www.w3.org/Icons/w3c_home" + alt="W3C"></a> + </p> + <h1 class="title" + id="title"> + Network Service Discovery + </h1> + <h2 id="w3c-editor-s-draft-05-february-2013"> + <abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 05 February 2013 + </h2> + <dl> + <dt> + This version: + </dt> + <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> + <dt> + Latest published version: + </dt> + <dd> + <a href="http://www.w3.org/TR/discovery-api/">http://www.w3.org/TR/discovery-api/</a> + </dd> + <dt> + Latest editor's draft: + </dt> + <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> + <dt> + Editors: + </dt> + <dd> + <span>Rich Tibbett</span>, <a href="http://opera.com/">Opera Software ASA</a> + </dd> + <dd> + <span>Clarke Stevens</span>, <a href="http://cablelabs.com/">CableLabs</a> + </dd> + </dl> <p class="copyright"> - <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © - 2013 - - <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> - (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, - <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, - <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. - <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, - <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and - <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. + <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2013 <a href= + "http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href= + "http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href= + "http://www.ercim.eu/"><abbr title= + "European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href= + "http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. + <abbr title="World Wide Web Consortium">W3C</abbr> <a href= + "http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href= + "http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href= + "http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. </p> - - - <hr> -</div> - <section id="abstract" class="introductory"><h2>Abstract</h2> + <hr> + </div> + <section id="abstract" + class="introductory"> + <h2> + Abstract + </h2> <p> This specification defines a mechanism for an HTML document to discover and subsequently communicate with <abbr title="Hypertext Transfer Protocol">HTTP</abbr>-based services advertised via common discovery protocols within the current network. </p> - </section><section id="sotd" class="introductory"><h2>Status of This Document</h2> - - - - <p> - <em>This section describes the status of this document at the time of its publication. Other - documents may supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and the latest revision - 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 - index</a> at http://www.w3.org/TR/.</em> - </p> - + </section> + <section id="sotd" + class="introductory"> + <h2> + Status of This Document + </h2> <p> - This document represents the early consensus of the group on the scope and features of the proposed <abbr title="Application Programming Interface">API</abbr>. + <em>This section describes the status of this document at the time of its publication. Other documents may + supersede this document. A list of current <abbr title="World Wide Web Consortium">W3C</abbr> publications and + the latest revision 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 index</a> at http://www.w3.org/TR/.</em> </p> - - <p> - This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as an Editor's Draft. - - - If you wish to make comments regarding this document, please send them to - <a href="mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> - (<a href="mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>, - <a href="http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>). - - - - - All comments are welcome. - - - </p><p> - Publication as an Editor's Draft does not imply endorsement by the <abbr title="World Wide Web Consortium">W3C</abbr> Membership. - This is a draft document and may be updated, replaced or obsoleted by other documents at - any time. It is inappropriate to cite this document as other than work in progress. - </p> - - - <p> - - This document was produced by a group operating under the - <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. - - - - - <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> - - made in connection with the deliverables of the group; that page also includes instructions for - disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains - <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the - information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section - 6 of the <abbr title="World Wide Web Consortium">W3C</abbr> Patent Policy</a>. - - - </p> - - - - -</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> - Introduction - </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> - Dependencies - </a></li></ul></li><li class="tocline"><a href="#terminology" class="tocxref"><span class="secno">3. </span> - Terminology - </a></li><li class="tocline"><a href="#requesting-networked-services" class="tocxref"><span class="secno">4. </span> - Requesting networked services - </a><ul class="toc"><li class="tocline"><a href="#methods" class="tocxref"><span class="secno">4.1 </span> - Methods - </a></li><li class="tocline"><a href="#error-handling" class="tocxref"><span class="secno">4.2 </span> - Error Handling - </a></li></ul></li><li class="tocline"><a href="#obtaining-networked-services" class="tocxref"><span class="secno">5. </span> - Obtaining networked services - </a><ul class="toc"><li class="tocline"><a href="#attributes" class="tocxref"><span class="secno">5.1 </span> - Attributes - </a></li><li class="tocline"><a href="#methods-1" class="tocxref"><span class="secno">5.2 </span> - Methods - </a></li><li class="tocline"><a href="#events" class="tocxref"><span class="secno">5.3 </span> - Events - </a></li></ul></li><li class="tocline"><a href="#communicating-with-a-networked-service" class="tocxref"><span class="secno">6. </span> - Communicating with a networked service - </a><ul class="toc"><li class="tocline"><a href="#attributes-1" class="tocxref"><span class="secno">6.1 </span> - Attributes - </a></li><li class="tocline"><a href="#states" class="tocxref"><span class="secno">6.2 </span> - States - </a></li><li class="tocline"><a href="#events-1" class="tocxref"><span class="secno">6.3 </span> - Events - </a></li></ul></li><li class="tocline"><a href="#service-discovery" class="tocxref"><span class="secno">7. </span> - Service Discovery - </a><ul class="toc"><li class="tocline"><a href="#zeroconf-mdns-dns-sd" class="tocxref"><span class="secno">7.1 </span> - Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>) - </a></li><li class="tocline"><a href="#simple-service-discovery-protocol-ssdp" class="tocxref"><span class="secno">7.2 </span> - Simple Service Discovery Protocol (<abbr title="Simple Service Discovery Protocol">SSDP</abbr>) - </a></li><li class="tocline"><a href="#discovery-and-launch-protocol-dial" class="tocxref"><span class="secno">7.3 </span> - Discovery and Launch Protocol (<abbr title="Discovery and Launch Protocol">DIAL</abbr>) - </a></li><li class="tocline"><a href="#network-topology-monitoring" class="tocxref"><span class="secno">7.4 </span> - Network Topology Monitoring - </a></li></ul></li><li class="tocline"><a href="#events-summary" class="tocxref"><span class="secno">8. </span> - Events Summary - </a></li><li class="tocline"><a href="#garbage-collection" class="tocxref"><span class="secno">9. </span> - Garbage collection - </a></li><li class="tocline"><a href="#use-cases-and-requirements" class="tocxref"><span class="secno">10. </span> - Use Cases and Requirements - </a></li><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">A. </span> - Examples - </a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">B. </span> - Acknowledgements - </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> - - <section class="informative" id="introduction"> - <!--OddPage--><h2><span class="secno">1. </span> - Introduction - </h2><p><em>This section is non-normative.</em></p> <p> - To enable Web pages to connect and communicate with Local-networked Services provided over <abbr title="Hypertext Transfer Protocol">HTTP</abbr>, this - specification introduces the <a href="#navigatornetworkservice"><code>NavigatorNetworkService</code></a> - interface. + This document represents the early consensus of the group on the scope and features of the proposed + <abbr title="Application Programming Interface">API</abbr>. + </p> + <p> + This document was published by the <a href="http://www.w3.org/2009/dap/">Device APIs Working Group</a> as an + Editor's Draft. If you wish to make comments regarding this document, please send them to <a href= + "mailto:public-device-apis@w3.org">public-device-apis@w3.org</a> (<a href= + "mailto:public-device-apis-request@w3.org?subject=subscribe">subscribe</a>, <a href= + "http://lists.w3.org/Archives/Public/public-device-apis/">archives</a>). All comments are welcome. + </p> + <p> + Publication as an Editor's Draft does not imply endorsement by the <abbr title= + "World Wide Web Consortium">W3C</abbr> Membership. This is a draft document and may be updated, replaced or + obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in + progress. + </p> + <p> + This document was produced by a group operating under the <a href= + "http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 <abbr title= + "World Wide Web Consortium">W3C</abbr> Patent Policy</a>. <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> made in connection with the deliverables of the + group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge + of a patent which the individual believes contains <a href= + "http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose + the information in accordance with <a href= + "http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the <abbr title= + "World Wide Web Consortium">W3C</abbr> Patent Policy</a>. + </p> + </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> Introduction</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> Dependencies</a> + </li> + </ul> + </li> + <li class="tocline"> + <a href="#terminology" + class="tocxref"><span class="secno">3.</span> Terminology</a> + </li> + <li class="tocline"> + <a href="#requesting-networked-services" + class="tocxref"><span class="secno">4.</span> Requesting networked services</a> + <ul class="toc"> + <li class="tocline"> + <a href="#methods" + class="tocxref"><span class="secno">4.1</span> Methods</a> + </li> + <li class="tocline"> + <a href="#error-handling" + class="tocxref"><span class="secno">4.2</span> Error Handling</a> + </li> + </ul> + </li> + <li class="tocline"> + <a href="#obtaining-networked-services" + class="tocxref"><span class="secno">5.</span> Obtaining networked services</a> + <ul class="toc"> + <li class="tocline"> + <a href="#attributes" + class="tocxref"><span class="secno">5.1</span> Attributes</a> + </li> + <li class="tocline"> + <a href="#methods-1" + class="tocxref"><span class="secno">5.2</span> Methods</a> + </li> + <li class="tocline"> + <a href="#events" + class="tocxref"><span class="secno">5.3</span> Events</a> + </li> + </ul> + </li> + <li class="tocline"> + <a href="#communicating-with-a-networked-service" + class="tocxref"><span class="secno">6.</span> Communicating with a networked service</a> + <ul class="toc"> + <li class="tocline"> + <a href="#attributes-1" + class="tocxref"><span class="secno">6.1</span> Attributes</a> + </li> + <li class="tocline"> + <a href="#states" + class="tocxref"><span class="secno">6.2</span> States</a> + </li> + <li class="tocline"> + <a href="#events-1" + class="tocxref"><span class="secno">6.3</span> Events</a> + </li> + </ul> + </li> + <li class="tocline"> + <a href="#service-discovery" + class="tocxref"><span class="secno">7.</span> Service Discovery</a> + <ul class="toc"> + <li class="tocline"> + <a href="#zeroconf-mdns-dns-sd" + class="tocxref"><span class="secno">7.1</span> Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>)</a> + </li> + <li class="tocline"> + <a href="#simple-service-discovery-protocol-ssdp" + class="tocxref"><span class="secno">7.2</span> Simple Service Discovery Protocol (<abbr title= + "Simple Service Discovery Protocol">SSDP</abbr>)</a> + </li> + <li class="tocline"> + <a href="#discovery-and-launch-protocol-dial" + class="tocxref"><span class="secno">7.3</span> Discovery and Launch Protocol (<abbr title= + "Discovery and Launch Protocol">DIAL</abbr>)</a> + </li> + <li class="tocline"> + <a href="#network-topology-monitoring" + class="tocxref"><span class="secno">7.4</span> Network Topology Monitoring</a> + </li> + </ul> + </li> + <li class="tocline"> + <a href="#events-summary" + class="tocxref"><span class="secno">8.</span> Events Summary</a> + </li> + <li class="tocline"> + <a href="#garbage-collection" + class="tocxref"><span class="secno">9.</span> Garbage collection</a> + </li> + <li class="tocline"> + <a href="#use-cases-and-requirements" + class="tocxref"><span class="secno">10.</span> Use Cases and Requirements</a> + </li> + <li class="tocline"> + <a href="#examples" + class="tocxref"><span class="secno">A.</span> Examples</a> + </li> + <li class="tocline"> + <a href="#acknowledgements" + class="tocxref"><span class="secno">B.</span> Acknowledgements</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> + <section class="informative" + id="introduction"> + <h2> + <span class="secno">1.</span> Introduction + </h2> + <p> + <em>This section is non-normative.</em> + </p> + <p> + To enable Web pages to connect and communicate with Local-networked Services provided over <abbr title= + "Hypertext Transfer Protocol">HTTP</abbr>, this specification introduces the <a href= + "#navigatornetworkservice"><code>NavigatorNetworkService</code></a> interface. </p> <p> Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user - connects the web page to discovered services, is expected before the web page is able to interact - with any Local-networked Services. + connects the web page to discovered services, is expected before the web page is able to interact with any + Local-networked Services. </p> <p> A web page creates a request to obtain connectivity to services running in the network by specifying a well-known discovery service type that it wishes to interact with. </p> <p> - The user agent, having captured all advertised services on the network from the <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery - mechanisms</a> included in this recommendation, attempts to match the requested service type to a discovered - service according to the processing described herein. + The user agent, having captured all advertised services on the network from the <a href= + "#dfn-service-discovery-mechanisms" + class="internalDFN">service discovery mechanisms</a> included in this recommendation, attempts to match the + requested service type to a discovered service according to the processing described herein. </p> <p> If a service connectivity request is successful then the Web page is provided with the necessary information to @@ -402,69 +490,125 @@ <p> Once connected to a Local-networked Service the Web page can send requests and receive responses to the Local-networked Service via the messaging format and appropriate channel inferred from the service type - authorized via the provided <abbr title="Application Programming Interface">API</abbr>. The Web page, once connected, can also receive service-pushed events, in the - messaging format supported by the Local-networked Device, if such event subscription functionality is provided - by the connected Local-networked Service. + authorized via the provided <abbr title="Application Programming Interface">API</abbr>. The Web page, once + connected, can also receive service-pushed events, in the messaging format supported by the Local-networked + Device, if such event subscription functionality is provided by the connected Local-networked Service. </p> <div class="example"> <p> - Example of requesting a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> advertised service: + Example of requesting a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> + advertised service: </p> <hr> - <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + <pre class="highlight prettyprint"> +<span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class= +"pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln"> - </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun"><</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln"> + </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class= +"pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class= +"pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class= +"pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class= +"pun"><</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class= +"pun">++)</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class= +"pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class= +"pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> -navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">(</span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> showServices</span><span class="pun">);</span></pre> +navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class= +"pun">(</span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class= +"pln"> showServices</span><span class="pun">);</span> +</pre> </div> <div class="example"> <p> Example of requesting a UPnP advertised service, also handling error conditions: </p> <hr> - <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + <pre class="highlight prettyprint"> +<span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class= +"pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="com">// Show a list of all the services provided to the web page</span><span class="pln"> - </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun"><</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln"> + </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class= +"pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class= +"pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class= +"pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class= +"pun"><</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class= +"pun">++)</span><span class="pln"> console</span><span class="pun">.</span><span class="pln">log</span><span class= +"pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class= +"pun">].</span><span class="pln">name </span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> -</span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class="pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln"> </span><span class="str">"Error occurred: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> e</span><span class="pun">.</span><span class="pln">code </span><span class="pun">);</span><span class="pln"> +</span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class= +"pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class= +"pln"> </span><span class="str">"Error occurred: "</span><span class="pln"> </span><span class= +"pun">+</span><span class="pln"> e</span><span class="pun">.</span><span class="pln">code </span><span class= +"pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> -navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">(</span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pun">,</span><span class="pln"> showServices</span><span class="pun">,</span><span class="pln"> error</span><span class="pun">);</span></pre> +navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class= +"pun">(</span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class= +"pun">,</span><span class="pln"> showServices</span><span class="pun">,</span><span class= +"pln"> error</span><span class="pun">);</span> +</pre> </div> <div class="example"> <p> - Example of requesting either a <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> or UPnP advertised service: + Example of requesting either a <abbr title="Domain Name System">DNS</abbr>-<abbr title= + "Service Discovery">SD</abbr> or UPnP advertised service: </p> <hr> - <pre class="highlight prettyprint"><span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - </span><span class="com">// Show a list of all the services provided to the web page (+ service type)</span><span class="pln"> - </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class="pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun"><</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> - console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">'('</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class="pln">type </span><span class="pun">+</span><span class="pln"> </span><span class="str">')'</span><span class="pln"> </span><span class="pun">);</span><span class="pln"> + <pre class="highlight prettyprint"> +<span class="kwd">function</span><span class="pln"> showServices</span><span class="pun">(</span><span class= +"pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class= +"com">// Show a list of all the services provided to the web page (+ service type)</span><span class="pln"> + </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class= +"pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class= +"pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> services</span><span class= +"pun">.</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class= +"pun"><</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class= +"pun">++)</span><span class="pln"> + console</span><span class="pun">.</span><span class="pln">log</span><span class="pun">(</span><span class= +"pln"> services</span><span class="pun">[</span><span class="pln">i</span><span class="pun">].</span><span class= +"pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">'('</span><span class= +"pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class= +"pln">i</span><span class="pun">].</span><span class="pln">type </span><span class="pun">+</span><span class= +"pln"> </span><span class="str">')'</span><span class="pln"> </span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> -navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">([</span><span class="pln"> +navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class= +"pun">([</span><span class="pln"> </span><span class="str">'zeroconf:_boxee-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'upnp:urn:schemas-upnp-org:service:ContentDirectory:1'</span><span class="pln"> -</span><span class="pun">],</span><span class="pln"> showServices</span><span class="pun">);</span></pre> +</span><span class="pun">],</span><span class="pln"> showServices</span><span class="pun">);</span> +</pre> </div> <p> For more detailed examples see the <a href="#examples">Examples</a> section. </p> </section> - <section id="conformance"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2> -<p> - As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, - and notes in this specification are non-normative. Everything else in this specification is - normative. -</p> -<p> - The key words <em class="rfc2119" title="must">must</em>, <em class="rfc2119" title="must not">must not</em>, <em class="rfc2119" title="required">required</em>, <em class="rfc2119" title="should">should</em>, <em class="rfc2119" title="should not">should not</em>, <em class="rfc2119" title="recommended">recommended</em>, <em class="rfc2119" title="may">may</em>, - and <em class="rfc2119" title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class="bibref" href="#bib-RFC2119">RFC2119</a></cite>]. -</p> - + <section id="conformance"> + <h2> + <span class="secno">2.</span> Conformance + </h2> + <p> + As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this + specification are non-normative. Everything else in this specification is normative. + </p> + <p> + The key words <em class="rfc2119" + title="must">must</em>, <em class="rfc2119" + title="must not">must not</em>, <em class="rfc2119" + title="required">required</em>, <em class="rfc2119" + title="should">should</em>, <em class="rfc2119" + title="should not">should not</em>, <em class="rfc2119" + title="recommended">recommended</em>, <em class="rfc2119" + title="may">may</em>, and <em class="rfc2119" + title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class= + "bibref" + href="#bib-RFC2119">RFC2119</a></cite>]. + </p> <p> Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the meaning of the key word ("must", "should", @@ -475,57 +619,65 @@ are to be interpreted as requirements on user agents. </p> <p> - Conformance requirements phrased as algorithms or specific steps <em class="rfc2119" title="may">may</em> be implemented in any manner, so long as - the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be - easy to follow, and not intended to be performant.) + Conformance requirements phrased as algorithms or specific steps <em class="rfc2119" + title="may">may</em> be implemented in any manner, so long as the end result is equivalent. (In particular, + the algorithms defined in this specification are intended to be easy to follow, and not intended to be + performant.) </p> <p> The only conformance class defined by this specification is a <dfn id="dfn-user-agent">user agent</dfn>. </p> <p> - User agents <em class="rfc2119" title="may">may</em> impose implementation-specific limits on otherwise unconstrained inputs, e.g. to prevent denial - of service attacks, to guard against running out of memory, or to work around platform-specific limitations. + User agents <em class="rfc2119" + title="may">may</em> impose implementation-specific limits on otherwise unconstrained inputs, e.g. to + prevent denial of service attacks, to guard against running out of memory, or to work around + platform-specific limitations. </p> <p> When support for a feature is disabled (e.g. as an emergency measure to mitigate a security problem, or to aid - in development, or for performance reasons), user agents <em class="rfc2119" title="must">must</em> act as if they had no support for the feature - whatsoever, and as if the feature was not mentioned in this specification. For example, if a particular feature - is accessed via an attribute in a Web IDL interface, the attribute itself would be omitted from the objects - that implement that interface - leaving the attribute on the object but making it return null or throw an - exception is insufficient. + in development, or for performance reasons), user agents <em class="rfc2119" + title="must">must</em> act as if they had no support for the feature whatsoever, and as if the feature was + not mentioned in this specification. For example, if a particular feature is accessed via an attribute in a + Web IDL interface, the attribute itself would be omitted from the objects that implement that interface - + leaving the attribute on the object but making it return null or throw an exception is insufficient. </p> <section id="dependencies"> - <h3><span class="secno">2.1 </span> - Dependencies + <h3> + <span class="secno">2.1</span> Dependencies </h3>This specification relies on several other underlying specifications. <dl> <dt> HTML </dt> <dd> - Many fundamental concepts from HTML are used by this specification. [<cite><a class="bibref" href="#bib-HTML5">HTML5</a></cite>] + Many fundamental concepts from HTML are used by this specification. [<cite><a class="bibref" + href="#bib-HTML5">HTML5</a></cite>] </dd> <dt> WebIDL </dt> <dd> - The IDL blocks in this specification use the semantics of the WebIDL specification. [<cite><a class="bibref" href="#bib-WEBIDL">WEBIDL</a></cite>] + The IDL blocks in this specification use the semantics of the WebIDL specification. [<cite><a class= + "bibref" + href="#bib-WEBIDL">WEBIDL</a></cite>] </dd> </dl> </section> </section> <section id="terminology"> - <!--OddPage--><h2><span class="secno">3. </span> - Terminology + <h2> + <span class="secno">3.</span> Terminology </h2> <p> The construction "a <code>Foo</code> object", where <code>Foo</code> is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface <code>Foo</code>". </p> <p> - The term DOM is used to refer to the <abbr title="Application Programming Interface">API</abbr> set made available to scripts in Web applications, and does not - necessarily imply the existence of an actual <code>Document</code> object or of any other <code>Node</code> - objects as defined in the DOM Core specifications. [<cite><a class="bibref" href="#bib-DOM4">DOM4</a></cite>] + The term DOM is used to refer to the <abbr title="Application Programming Interface">API</abbr> set made + available to scripts in Web applications, and does not necessarily imply the existence of an actual + <code>Document</code> object or of any other <code>Node</code> objects as defined in the DOM Core + specifications. [<cite><a class="bibref" + href="#bib-DOM4">DOM4</a></cite>] </p> <p> An IDL attribute is said to be <em>getting</em> when its value is being retrieved (e.g. by author script), and @@ -533,40 +685,49 @@ </p> <p> A <dfn id="dfn-valid-service-type">valid service type</dfn> is any of the following: - </p><ul> - <li> - a string that begins with <code>upnp:</code> or <code>zeroconf:</code> - followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, - U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E. - </li> - <li> - a string that begins with <code>dial:</code> followed by an integer version. - </li> - </ul> - <p></p> + </p> + <ul> + <li>a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters + in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, + U+005E to U+007E. + </li> + <li>a string that begins with <code>dial:</code> followed by an integer version. + </li> + </ul> <p> - A <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> provided in the <code>type</code> attribute of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method will be matched against the - services currently contained in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> according to the algorithms - defined in this specification. + A <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> provided in the <code>type</code> attribute of the <a href= + "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method will be matched against the + services currently contained in the <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a> according to the algorithms defined in this + specification. </p> <p> - A <dfn id="dfn-user-agent-generated-callback-url">user-agent generated callback url</dfn> is a Local-network accessible <abbr title="Uniform Resource Locator">URL</abbr> endpoint that a <a href="#dfn-user-agent" class="internalDFN">user - agent</a> generates and maintains for receiving <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY requests from UPnP Event sources. It is only - required when the user agent implements UPnP Service Discovery as defined in this specification. + A <dfn id="dfn-user-agent-generated-callback-url">user-agent generated callback url</dfn> is a Local-network + accessible <abbr title="Uniform Resource Locator">URL</abbr> endpoint that a <a href="#dfn-user-agent" + class="internalDFN">user agent</a> generates and maintains for receiving <abbr title= + "Hypertext Transfer Protocol">HTTP</abbr> NOTIFY requests from UPnP Event sources. It is only required when + the user agent implements UPnP Service Discovery as defined in this specification. </p> </section> <section id="requesting-networked-services"> - <!--OddPage--><h2><span class="secno">4. </span> - Requesting networked services + <h2> + <span class="secno">4.</span> Requesting networked services </h2> - <pre class="widl">[Supplemental, NoInterfaceObject] + <pre class="widl"> +[Supplemental, NoInterfaceObject] interface <dfn id="navigatornetworkservice">NavigatorNetworkService</dfn> { // Obtain a Local-networked Service void <a href="#dom-navigator-getnetworkservices">getNetworkServices</a>( in any type, - in <a href="#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback, - in optional <a href="#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback ); + in <a href= +"#navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</a> successCallback, + in optional <a href= +"#navigatornetworkserviceerrorcallback">NavigatorNetworkServiceErrorCallback</a> errorCallback ); }; -<a class="externalDFN" href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href="#navigatornetworkservice">NavigatorNetworkService</a>; +<a class="externalDFN" + href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">Navigator</a> implements <a href= + "#navigatornetworkservice">NavigatorNetworkService</a>; [Callback=FunctionOnly, NoInterfaceObject] interface <dfn id="navigatornetworkservicesuccesscallback">NavigatorNetworkServiceSuccessCallback</dfn> { @@ -586,25 +747,29 @@ }; </pre> <section id="methods"> - <h3><span class="secno">4.1 </span> - Methods + <h3> + <span class="secno">4.1</span> Methods </h3> <dl class="domintro"> <dt> - <var title="">window</var> . <code title="dom-navigator"><a href="http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a></code> . - <code title="dom-navigator-getNetworkServices"><a href="#dom-navigator-getnetworkservices">getNetworkServices</a></code> ( <var title="">type</var> , <var title="">successCallback</var> [, <var title="">errorCallback</var> ] ) + <var title="">window</var> . <code title="dom-navigator"><a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/timers.html#navigator">navigator</a></code> . + <code title="dom-navigator-getNetworkServices"><a href= + "#dom-navigator-getnetworkservices">getNetworkServices</a></code> ( <var title="">type</var> , <var title= + "">successCallback</var> [, <var title="">errorCallback</var> ] ) </dt> <dd> <p> - Prompts the user to select discovered network services that have advertised support for the - requested service type. + Prompts the user to select discovered network services that have advertised support for the requested + service type. </p> <p> - The <var title="">type</var> argument contains one or more <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens that the web - page would like to interact with. + The <var title="">type</var> argument contains one or more <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> tokens that the web page would like to interact with. </p> <p> - 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. + 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. </p> <p> If the user declines, the <var title="">errorCallback</var> (if any) is invoked. @@ -613,30 +778,45 @@ </dl> <div> <p> - When the <dfn id="dom-navigator-getnetworkservices" title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, - 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: + When the <dfn id="dom-navigator-getnetworkservices" + title="dom-navigator-getnetworkservices"><code>getNetworkServices(type, successCallback[, + 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: </p> <ol class="rule"> <li>Let <var>requested control types</var> be initially set to an empty array. </li> - <li>If <var>type</var> is an array consisting of one or more <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens, then let - <var>requested control types</var> by the value of <var>type</var>, removing any non-<a href="#dfn-valid-service-type" class="internalDFN">valid service - type</a> tokens from the resulting array. + <li>If <var>type</var> is an array consisting of one or more <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> tokens, then let <var>requested control types</var> by the + value of <var>type</var>, removing any non-<a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> tokens from the resulting array. </li> - <li>If <var>type</var> is a string consisting of one <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> token, then let - <var>requested control types</var> be an array containing one item with a value of <var>type</var>. + <li>If <var>type</var> is a string consisting of one <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> token, then let <var>requested control types</var> be an + array containing one item with a value of <var>type</var>. </li> - <li>If <var>requested control types</var> is an array that contains at least one or more <a title="valid service type" href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens then continue to the step labeled <em>process</em> - below. Otherwise, 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>errorCallback</var>, if it is provided and is an - object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2 - (<a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as + <li>If <var>requested control types</var> is an array that contains at least one or more <a title= + "valid service type" + href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> tokens then continue to the step labeled <em>process</em> + below. Otherwise, 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>errorCallback</var>, if it is provided and is an + object of type <code>Function</code>, with a new <a href= + "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href= + "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 2 + (<a href= + "#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a>) as its argument, abort any remaining steps and return. </li> <li> <em>Process</em>: Let <var>services found</var> be an empty array. </li> - <li>For each <var>available service</var> in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> run the following - steps: + <li>For each <var>available service</var> in the <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a> run the following steps: <ol class="rule"> <li>For each <var>requested control type</var> in <var>requested control types</var>: If <var>available service</var>'s <code>type</code> attribute equals the <var>requested control type</var> then let <var> @@ -648,7 +828,8 @@ <li> <em>Attach</em>: If <var>matched service</var> is not empty then run the following steps: <ol class="rule"> - <li>Let <var>new service object</var> be a new <a href="#networkservice"><code>NetworkService</code></a> object, mapping the parameters of <var>matched + <li>Let <var>new service object</var> be a new <a href= + "#networkservice"><code>NetworkService</code></a> object, mapping the parameters of <var>matched service</var> to this new object where possible. </li> <li>Append <var>new service object</var> to the <var>services found</var> array. @@ -660,87 +841,170 @@ <li>Return, and run the remaining steps asynchronously. </li> <li>Optionally, e.g. based on a previously-established user preference, for security reasons, or due to - platform limitations, the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="may">may</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>errorCallback</var>, if it is provided and is an - object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1 - (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its + platform limitations, the <a href="#dfn-user-agent" + class="internalDFN">user agent</a> <em class="rfc2119" + title="may">may</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>errorCallback</var>, if it is provided and is an + object of type <code>Function</code>, with a new <a href= + "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href= + "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1 + (<a href= + "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return. </li> - <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 - user-agent-specific manner for permission to provide - the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> with an array of <a href="#networkservice"><code>NetworkService</code></a> objects representing the <a href="#dfn-user-authorized" class="internalDFN">user-authorized</a> subset - of <var>services found</var>. + <li>The user agent <em class="rfc2119" + title="must not">must not</em> provide the entry script's origin with a <a href= + "#networkservices"><code>NetworkServices</code></a> object without prior permission given by the + user. <p> - If the user grants permission to access one or more networked services then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> - <em class="rfc2119" title="should">should</em> include an "ongoing local-network communication" indicator. + 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="may">may</em> choose to prompt the user in a user-agent-specific manner for permission to + provide the <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" + class="externalDFN">entry script</a>'s <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" + class="externalDFN">origin</a> with a <a href="#networkservices"><code>NetworkServices</code></a> + object representing the <a href="#dfn-user-authorized" + class="internalDFN">user-authorized</a> subset of <var>services found</var>. </p> <p> - If the user denies permission, then 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>errorCallback</var>, if it is provided and is an - object of type <code>Function</code>, with a new <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href="#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1 - (<a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its + Alternatively, the user agent <em class="rfc2119" + title="may">may</em> choose to queue a task to invoke <var>successCallback</var> or + <var>errorCallback</var> immediately based on a previously-established user preference, for security + reasons, or due to platform limitations. In such an implementation, if <var>successCallback</var> is + to be fired as a result of a previously-established user preference then the <a href= + "#dfn-user-agent" + class="internalDFN">user agent</a> <em class="rfc2119" + title="must">must</em> continue at the next step of this algorithm. + </p> + <p> + If permission has been granted by the user to access one or more networked services then the <a href= + "#dfn-user-agent" + class="internalDFN">user agent</a> <em class="rfc2119" + title="should">should</em> include an "ongoing local-network communication" indicator. + </p> + <p> + If permission has been denied by the user, <a href="#dfn-user-agent" + class="internalDFN">user agent</a> or platform, then 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>errorCallback</var>, if it is provided and is an + object of type <code>Function</code>, with a new <a href= + "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href= + "#dom-navigatornetworkserviceerror-code"><code>code</code></a> attribute has the numeric value 1 + (<a href= + "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return. </p> <p> - If the user never responds, this algorithm stalls on this step. + If the user never responds or no previously-established user preference has been met, this algorithm + stalls on this step. </p> </li> <li>Let <var>services</var> be an empty array. </li> - <li> - 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 - current objects <dfn id="dfn-user-authorized">user-authorized</dfn> services. + <li>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 current objects <dfn id="dfn-user-authorized">user-authorized</dfn> + services. + </li> + <li>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> granted in 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>. </li> <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps: <ol class="rule"> - <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 - <abbr title="Uniform Resource Locator">URL</abbr> whitelist</a>. + <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 <abbr title="Uniform Resource Locator">URL</abbr> + whitelist</a>. </li> <li>If <var>service</var>'s <code>type</code> parameter begins with the DOMString "<code>upnp:</code>" - and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events - Subscription</a> for <var>service</var>. + and the <var>service</var>'s <code>eventsUrl</code> parameter is not empty then <a href= + "#dfn-setup-a-upnp-events-subscription" + class="internalDFN">setup a UPnP Events Subscription</a> for <var>service</var>. </li> </ol> </li> <li>Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a> object. </li> - <li>Set <var>services manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of - 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 - matches any of the tokens requested in <var>requested control types</var>. + <li>Store <var>requested control types</var> against <var>services manager</var> as an internal variable. </li> - <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 - properties</a>. If <var>services</var> is an empty array then the <var>services manager</var> does not have any - <var>indexed properties</var>. + <li>Set <var>services manager</var>'s <a href= + "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of + 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 matches + any of the tokens requested in <var>requested control types</var>. + </li> + <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 properties</a>. If <var>services</var> is an empty array then the + <var>services manager</var> does not have any <var>indexed properties</var>. </li> <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a> attribute to the number of items in <var>services</var>. </li> - <li>Add <var>services manager</var> to the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of active service managers</a>. + <li>Add <var>services manager</var> to the <a href="#dfn-list-of-active-service-managers" + class="internalDFN">list of active service managers</a>. </li> - <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 + <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 manager</var> as its argument. </li> </ol> <p> - The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source" class="externalDFN">task source</a> for these <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task" class="externalDFN">tasks</a> is the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source" class="externalDFN">user interaction task source</a>. + The <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#task-source" + class="externalDFN">task source</a> for these <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#concept-task" + class="externalDFN">tasks</a> is the <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#user-interaction-task-source" + class="externalDFN">user interaction task source</a>. </p> <p> When a <a href="#networkservice"><code>NetworkService</code></a> object is provided to a Web page, the - <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> - whitelist</dfn>. This list enables the Web page to override and initiate cross-site resource requests - towards these URLs, and any sub-resources of these URLs, within the current <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" class="externalDFN">entry script</a>'s <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, + <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> whitelist</dfn>. This list enables the Web page to override and + initiate cross-site resource requests towards these URLs, and any sub-resources of these URLs, within + the current <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" + class="externalDFN">entry script</a>'s <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" + class="externalDFN">origin</a> via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest). </p> <p> - If the user navigates away from 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> 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>. - There is no persistence to network service selections provided to a web page. It is not possible to access - a previously white-listed networked service without the necessary user authorization in all of the - following cases: + If the user navigates away from 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> 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>. There is no persistence to network service selections provided to a web page. It is not + possible to access a previously white-listed networked service without the necessary user authorization + in all of the following cases: </p> <ul> <li>If the current script is reloaded at any point in the same or different window. </li> - <li>if the current script reinvokes the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its + <li>if the current script reinvokes the <a href= + "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method at any point in its execution. </li> <li>If the user navigates forward or back in their history to reload the current page. @@ -751,75 +1015,91 @@ </div> </section> <section id="error-handling"> - <h3><span class="secno">4.2 </span> - Error Handling + <h3> + <span class="secno">4.2</span> Error Handling </h3> <dl class="domintro"> <dt> - <var title="">error</var> . <code title="dom-NavigatorNetworkServiceError-code"><a href="#dom-navigatornetworkserviceerror-code">code</a></code> + <var title="">error</var> . <code title="dom-NavigatorNetworkServiceError-code"><a href= + "#dom-navigatornetworkserviceerror-code">code</a></code> </dt> <dd> <p> Returns the current error's error code. At the current time, this will be <code>1</code> or - <code>2</code>, for which the corresponding error constants <a href="#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and <a href="#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are + <code>2</code>, for which the corresponding error constants <a href= + "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a> and <a href= + "#dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></a> are defined. </p> </dd> </dl> <p> - The <dfn id="dom-navigatornetworkserviceerror-code" title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a <a href="#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object <em class="ct"><em class="rfc2119" title="must">must</em></em> return the code for the error, which will be one of the following: + The <dfn id="dom-navigatornetworkserviceerror-code" + title="dom-navigatornetworkserviceerror-code"><code>code</code></dfn> attribute of a <a href= + "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object <em class= + "ct"><em class="rfc2119" + title="must">must</em></em> return the code for the error, which will be one of the following: </p> <dl> <dt> - <dfn id="dom-navigatornetworkserviceerror-permission_denied" title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> + <dfn id="dom-navigatornetworkserviceerror-permission_denied" + title="dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></dfn> (numeric value 1) </dt> <dd> The user or user agent denied the page permission to access any services. </dd> <dt> - <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix" title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn> + <dfn id="dom-navigatornetworkserviceerror-unknown_type_prefix" + title="dom-navigatornetworkserviceerror-unknown_type_prefix"><code>UNKNOWN_TYPE_PREFIX_ERR</code></dfn> (numeric value 2) </dt> <dd> - No <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> tokens were provided in the method invocation. + No <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> tokens were provided in the method invocation. </dd> </dl> </section> </section> <section id="obtaining-networked-services"> - <!--OddPage--><h2><span class="secno">5. </span> - Obtaining networked services + <h2> + <span class="secno">5.</span> Obtaining networked services </h2> <p> - The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero - or more <dfn id="dfn-indexed-properties">indexed properties</dfn> that are - each a <a href="#dfn-user-authorized" class="internalDFN">user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object. + The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero or + more <dfn id="dfn-indexed-properties">indexed properties</dfn> that are each a <a href="#dfn-user-authorized" + class="internalDFN">user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object. </p> <p> A <a href="#networkservices"><code>NetworkServices</code></a> object is the top level success callback - parameter from a call to - <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>. + parameter from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>. </p> - <pre class="widl">[NoInterfaceObject] + <pre class="widl"> +[NoInterfaceObject] interface <dfn id="networkservices">NetworkServices</dfn> { readonly attribute unsigned long <a href="#dom-networkservices-length">length</a>; getter <a href="#networkservice">NetworkService</a> (unsigned long index); - <a href="#networkservice">NetworkService</a>? <a href="#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id); + <a href="#networkservice">NetworkService</a>? <a href= +"#dom-networkservices-getservicebyid">getServiceById</a>(DOMString id); readonly attribute unsigned long <a href="#dom-networkservices-servicesavailable">servicesAvailable</a>; // event handler attributes - attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a> <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>; - attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a> <a href="#dom-networkservices-onserviceunavailable">onserviceunavailable</a>; + attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" + class="externalDFN">EventHandler</a> <a href="#dom-networkservices-onserviceavailable">onserviceavailable</a>; + attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" + class="externalDFN">EventHandler</a> <a href= + "#dom-networkservices-onserviceunavailable">onserviceunavailable</a>; }; -<a href="#networkservices">NetworkServices</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>; +<a href="#networkservices">NetworkServices</a> implements <a href= +"http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" + class="externalDFN">EventTarget</a>; </pre> <section id="attributes"> - <h3><span class="secno">5.1 </span> - Attributes + <h3> + <span class="secno">5.1</span> Attributes </h3> <dl class="domintro"> <dt> @@ -827,39 +1107,49 @@ </dt> <dd> <p> - Returns the current number of items in the current object's collection of <a href="#networkservice"><code>NetworkService</code></a> objects. + Returns the current number of items in the current object's collection of <a href= + "#networkservice"><code>NetworkService</code></a> objects. </p> </dd> <dt> - <code title="dom-networkservices-servicesavailable"><a href="#dom-networkservices-servicesavailable">servicesAvailable</a></code> + <code title="dom-networkservices-servicesavailable"><a href= + "#dom-networkservices-servicesavailable">servicesAvailable</a></code> </dt> <dd> <p> - 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 - the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>. + 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 the <a href= + "#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a>. </p> </dd> </dl> <div> <p> - The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119" title="must">must</em> return the number of - <a href="#networkservice"><code>NetworkService</code></a> objects represented by the collection. + The <dfn id="dom-networkservices-length"><code>length</code></dfn> attribute <em class="rfc2119" + title="must">must</em> return the number of <a href="#networkservice"><code>NetworkService</code></a> + objects represented by the collection. </p> <p> - The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute <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> 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 used to create the current - <a href="#networkservices"><code>NetworkServices</code></a> object. + The <dfn id="dom-networkservices-servicesavailable"><code>servicesAvailable</code></dfn> attribute + <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> 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 used to create the current <a href= + "#networkservices"><code>NetworkServices</code></a> object. </p> </div> </section> <section id="methods-1"> - <h3><span class="secno">5.2 </span> - Methods + <h3> + <span class="secno">5.2</span> Methods </h3> <dl class="domintro"> <dt> - <code title="networkservices-getter"><a href="#networkservices">services</a></code> [ <var title="">index</var> ] + <code title="networkservices-getter"><a href="#networkservices">services</a></code> [ <var title= + "">index</var> ] </dt> <dd> <p> @@ -867,7 +1157,9 @@ </p> </dd> <dt> - <code title="networkservices-getter"><a href="#networkservices">services</a></code> . <code title="dom-networkservices-getservicebyid"><a href="#dom-networkservices-getservicebyid">getServiceById</a></code> ( <var title="">id</var> ) + <code title="networkservices-getter"><a href="#networkservices">services</a></code> . <code title= + "dom-networkservices-getservicebyid"><a href= + "#dom-networkservices-getservicebyid">getServiceById</a></code> ( <var title="">id</var> ) </dt> <dd> <p> @@ -877,45 +1169,70 @@ </dd> </dl> <p> - A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of zero - 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 - <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 - a <a href="#networkservices"><code>NetworkServices</code></a> object. + A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of + zero 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 <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 a <a href= + "#networkservices"><code>NetworkServices</code></a> object. </p> - <div class="note"><div class="note-title"><span>Note</span></div><p class=""> - Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the - first has the index 0, and each subsequent service is numbered one higher than the previous one. - </p></div> + <div class="note"> + <div class="note-title"> + <span>Note</span> + </div> + <p class=""> + Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the + first has the index 0, and each subsequent service is numbered one higher than the previous one. + </p> + </div> <p> - 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 + 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 the number of the <a href="#networkservice"><code>NetworkService</code></a> objects in the collection minus one. </p> <p> - To <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a - <a href="#networkservices"><code>NetworkServices</code></a> object 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 - the collection. + To <a href= + "http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#determine-the-value-of-an-indexed-property" + class="externalDFN">determine the value of an indexed property</a> for a given index <var>index</var> in a + <a href="#networkservices"><code>NetworkServices</code></a> object 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 the collection. </p> <p> - 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 - collection whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to the value of the - <var>id</var> argument provided. When no <a href="#networkservice"><code>NetworkService</code></a> objects - match the given argument, the method <em class="rfc2119" title="must">must</em> return null. + 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 collection whose <a href="#dom-networkservice-id"><code>id</code></a> attribute is equal to + the value of the <var>id</var> argument provided. When no <a href= + "#networkservice"><code>NetworkService</code></a> objects match the given argument, the method <em class= + "rfc2119" + title="must">must</em> return null. </p> <p> Services available within the local network can connect and disconnect at different times during the - execution of a web page. A <a href="#dfn-user-agent" class="internalDFN">user agent</a> can inform a web page when the state of networked services - matching the requested <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> change. Web pages can use this information to enable in-page - experiences for communicating the state of networked services with the ability to change the particular - service or set of services the page is connected to by re-invoking the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method. + execution of a web page. A <a href="#dfn-user-agent" + class="internalDFN">user agent</a> can inform a web page when the state of networked services matching the + requested <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> change. Web pages can use this information to enable in-page + experiences for communicating the state of networked services with the ability to change the particular + service or set of services the page is connected to by re-invoking the <a href= + "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method. </p> </section> <section id="events"> - <h3><span class="secno">5.3 </span> - Events + <h3> + <span class="secno">5.3</span> Events </h3> <p> - The following are the event handlers (and their corresponding event handler event types) that <em class="ct"><em class="rfc2119" title="must">must</em></em> be supported, as IDL attributes, by all objects implementing the <a href="#networkservices"><code>NetworkServices</code></a> interface: + The following are the event handlers (and their corresponding event handler event types) that <em class= + "ct"><em class="rfc2119" + title="must">must</em></em> be supported, as IDL attributes, by all objects implementing the <a href= + "#networkservices"><code>NetworkServices</code></a> interface: </p> <table border="1"> <thead> @@ -931,7 +1248,8 @@ <tbody> <tr> <td> - <dfn id="dom-networkservices-onserviceavailable" title="dom-NetworkServices-onserviceavailable"><code>onserviceavailable</code></dfn> + <dfn id="dom-networkservices-onserviceavailable" + title="dom-NetworkServices-onserviceavailable"><code>onserviceavailable</code></dfn> </td> <td> <a href="#event-serviceavailable"><code>serviceavailable</code></a> @@ -939,7 +1257,8 @@ </tr> <tr> <td> - <dfn id="dom-networkservices-onserviceunavailable" title="dom-NetworkServices-onserviceunavailable"><code>onserviceunavailable</code></dfn> + <dfn id="dom-networkservices-onserviceunavailable" + title="dom-NetworkServices-onserviceunavailable"><code>onserviceunavailable</code></dfn> </td> <td> <a href="#event-serviceunavailable"><code>serviceunavailable</code></a> @@ -950,14 +1269,16 @@ </section> </section> <section id="communicating-with-a-networked-service"> - <!--OddPage--><h2><span class="secno">6. </span> - Communicating with a networked service + <h2> + <span class="secno">6.</span> Communicating with a networked service </h2> <p> The <a href="#networkservice"><code>NetworkService</code></a> interface is used to provide a set of connection - information for an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> service endpoint and if available, service events, running on a networked device. + information for an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> service endpoint and if available, + service events, running on a networked device. </p> - <pre class="widl">[NoInterfaceObject] + <pre class="widl"> +[NoInterfaceObject] interface <dfn id="networkservice">NetworkService</dfn> { readonly attribute DOMString <a href="#dom-networkservice-id">id</a>; readonly attribute DOMString <a href="#dom-networkservice-name">name</a>; @@ -968,21 +1289,27 @@ readonly attribute boolean <a href="#dom-networkservice-online">online</a>; // event handler attributes - attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a> <a href="#dom-networkservice-onserviceonline">onserviceonline</a>; - attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a> <a href="#dom-networkservice-onserviceoffline">onserviceoffline</a>; + attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" + class="externalDFN">EventHandler</a> <a href="#dom-networkservice-onserviceonline">onserviceonline</a>; + attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" + class="externalDFN">EventHandler</a> <a href="#dom-networkservice-onserviceoffline">onserviceoffline</a>; - attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" class="externalDFN">EventHandler</a> <a href="#dom-networkservice-onnotify">onnotify</a>; + attribute <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#eventhandler" + class="externalDFN">EventHandler</a> <a href="#dom-networkservice-onnotify">onnotify</a>; }; -<a href="#networkservice">NetworkService</a> implements <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" class="externalDFN">EventTarget</a>; +<a href="#networkservice">NetworkService</a> implements <a href= +"http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-eventtarget" + class="externalDFN">EventTarget</a>; </pre> <section id="attributes-1"> - <h3><span class="secno">6.1 </span> - Attributes + <h3> + <span class="secno">6.1</span> Attributes </h3> <dl class="domintro"> <dt> - <var title="">service</var> . <code title="dom-networkservice-id"><a href="#dom-networkservice-id">id</a></code> + <var title="">service</var> . <code title="dom-networkservice-id"><a href= + "#dom-networkservice-id">id</a></code> </dt> <dd> <p> @@ -990,7 +1317,8 @@ </p> </dd> <dt> - <var title="">service</var> . <code title="dom-networkservice-name"><a href="#dom-networkservice-name">name</a></code> + <var title="">service</var> . <code title="dom-networkservice-name"><a href= + "#dom-networkservice-name">name</a></code> </dt> <dd> <p> @@ -998,24 +1326,31 @@ </p> </dd> <dt> - <var title="">service</var> . <code title="dom-networkservice-type"><a href="#dom-networkservice-type">type</a></code> + <var title="">service</var> . <code title="dom-networkservice-type"><a href= + "#dom-networkservice-type">type</a></code> </dt> <dd> <p> - The <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> token value of the user-selected service. + The <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> token value of the user-selected service. </p> </dd> <dt> - <var title="">service</var> . <code title="dom-networkservice-url"><a href="#dom-networkservice-url">url</a></code> + <var title="">service</var> . <code title="dom-networkservice-url"><a href= + "#dom-networkservice-url">url</a></code> </dt> <dd> <p> - The control <abbr title="Uniform Resource Locator">URL</abbr> endpoint (including any required port information) of the user-selected control service - that has been added to 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>. + The control <abbr title="Uniform Resource Locator">URL</abbr> endpoint (including any required port + information) of the user-selected control service that has been added to 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>. </p> </dd> <dt> - <var title="">service</var> . <code title="dom-networkservice-config"><a href="#dom-networkservice-config">config</a></code> + <var title="">service</var> . <code title="dom-networkservice-config"><a href= + "#dom-networkservice-config">config</a></code> </dt> <dd> <p> @@ -1025,21 +1360,27 @@ </dl> <p> The <dfn id="dom-networkservice-id"><code>id</code></dfn> attribute is a unique identifier for the service. - The same service provided at different times or on different objects <em class="rfc2119" title="must">must</em> have the same <a href="#dom-networkservice-id"><code>id</code></a> value. + 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. </p> <p> The <dfn id="dom-networkservice-name"><code>name</code></dfn> attribute represents a human-readable title for the service. </p> <p> - The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a href="#dfn-valid-service-type" class="internalDFN">valid - service type</a> of the service. + The <dfn id="dom-networkservice-type"><code>type</code></dfn> attribute reflects the value of the <a href= + "#dfn-valid-service-type" + class="internalDFN">valid service type</a> of the service. </p> <p> - The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href="http://www.w3.org/TR/html5/urls.html#absolute-url" class="externalDFN">absolute <abbr title="Uniform Resource Locator">URL</abbr></a> pointing to the root <abbr title="Hypertext Transfer Protocol">HTTP</abbr> endpoint for the service that has been - added to 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>. Web pages can subsequently use this value for - implicit cross-document messaging via various existing mechanisms (e.g. Web Sockets, Server-Sent Events, - Web Messaging, XMLHttpRequest). + The <dfn id="dom-networkservice-url"><code>url</code></dfn> attribute is an <a href= + "http://www.w3.org/TR/html5/urls.html#absolute-url" + class="externalDFN">absolute <abbr title="Uniform Resource Locator">URL</abbr></a> pointing to the root + <abbr title="Hypertext Transfer Protocol">HTTP</abbr> endpoint for the service that has been added to 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>. + Web pages can subsequently use this value for implicit cross-document messaging via various existing + mechanisms (e.g. Web Sockets, Server-Sent Events, Web Messaging, XMLHttpRequest). </p> <p> The <dfn id="dom-networkservice-config"><code>config</code></dfn> attribute provides the raw configuration @@ -1047,12 +1388,13 @@ </p> </section> <section id="states"> - <h3><span class="secno">6.2 </span> - States + <h3> + <span class="secno">6.2</span> States </h3> <dl class="domintro"> <dt> - <var title="">service</var> . <code title="dom-networkservice-online"><a href="#dom-networkservice-online">online</a></code> + <var title="">service</var> . <code title="dom-networkservice-online"><a href= + "#dom-networkservice-online">online</a></code> </dt> <dd> <p> @@ -1067,15 +1409,19 @@ reporting itself as being either <var>online</var>, and therefore accessible on the local network, in which case this attribute will return <code>true</code> or, <var>offline</var>, and therefore not accessible on the local network, either temporarily or permanently, in which case this attribute will return - <code>false</code>. This attribute <em class="rfc2119" title="must">must</em> default to <code>true</code>. + <code>false</code>. This attribute <em class="rfc2119" + title="must">must</em> default to <code>true</code>. </p> </section> <section id="events-1"> - <h3><span class="secno">6.3 </span> - Events + <h3> + <span class="secno">6.3</span> Events </h3> <p> - The following are the event handlers (and their corresponding event handler event types) that <em class="ct"><em class="rfc2119" title="must">must</em></em> be supported, as IDL attributes, by all objects implementing the <a href="#networkservice"><code>NetworkService</code></a> interface: + The following are the event handlers (and their corresponding event handler event types) that <em class= + "ct"><em class="rfc2119" + title="must">must</em></em> be supported, as IDL attributes, by all objects implementing the <a href= + "#networkservice"><code>NetworkService</code></a> interface: </p> <table border="1"> <thead> @@ -1091,7 +1437,8 @@ <tbody> <tr> <td> - <dfn id="dom-networkservice-onnotify" title="dom-NetworkService-onnotify"><code>onnotify</code></dfn> + <dfn id="dom-networkservice-onnotify" + title="dom-NetworkService-onnotify"><code>onnotify</code></dfn> </td> <td> <a href="#event-notify"><code>notify</code></a> @@ -1099,7 +1446,8 @@ </tr> <tr> <td> - <dfn id="dom-networkservice-onserviceonline" title="dom-NetworkService-onserviceonline"><code>onserviceonline</code></dfn> + <dfn id="dom-networkservice-onserviceonline" + title="dom-NetworkService-onserviceonline"><code>onserviceonline</code></dfn> </td> <td> <a href="#event-serviceonline"><code>serviceonline</code></a> @@ -1107,7 +1455,8 @@ </tr> <tr> <td> - <dfn id="dom-networkservice-onserviceoffline" title="dom-NetworkService-onserviceoffline"><code>onserviceoffline</code></dfn> + <dfn id="dom-networkservice-onserviceoffline" + title="dom-NetworkService-onserviceoffline"><code>onserviceoffline</code></dfn> </td> <td> <a href="#event-serviceoffline"><code>serviceoffline</code></a> @@ -1118,324 +1467,487 @@ </section> </section> <section id="service-discovery"> - <!--OddPage--><h2><span class="secno">7. </span> - Service Discovery + <h2> + <span class="secno">7.</span> Service Discovery </h2> <p> - 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>], Zeroconf [<cite><a class="bibref" href="#bib-DNS-SD">DNS-SD</a></cite>] + [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>] or - <abbr title="Discovery and Launch Protocol">DIAL</abbr> [<a href="https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification"><abbr title="Discovery and Launch Protocol">DIAL</abbr></a>] - <dfn id="dfn-service-discovery-mechanisms">service discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to - enable Web pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on networked 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 <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery - mechanisms</a>, then it <em class="rfc2119" title="must">must</em> conform to the corresponding algorithms provided in this section of the - specification. + 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>], Zeroconf [<cite><a class="bibref" + href="#bib-DNS-SD">DNS-SD</a></cite>] + [<cite><a class="bibref" + href="#bib-MDNS">MDNS</a></cite>] and/or <abbr title="Discovery and Launch Protocol">DIAL</abbr> [<a href= + "https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification"><abbr title= + "Discovery and Launch Protocol">DIAL</abbr></a>] <dfn id="dfn-service-discovery-mechanisms">service + discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to enable Web + pages to request and connect with <abbr title="Hypertext Transfer Protocol">HTTP</abbr> services running on + networked devices, discovered via any of these mechanisms, through this <abbr title= + "Application Programming Interface">API</abbr>. When a <a href="#dfn-user-agent" + class="internalDFN">user agent</a> implements any of these <a href="#dfn-service-discovery-mechanisms" + class="internalDFN">service discovery mechanisms</a>, then it <em class="rfc2119" + title="must">must</em> conform to the corresponding algorithms provided in this section of the + specification. </p> <p> - 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 - requested service types, how the user agent stores available and active services and how their properties are - applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects. + This section presents how the results of these <a href="#dfn-service-discovery-mechanisms" + class="internalDFN">service discovery mechanisms</a> will be matched to requested service types, how the + user agent stores available and active services and how their properties are applied to any resulting + <a href="#networkservice"><code>NetworkService</code></a> objects. </p> <p> - It is expected that user agents will perform these <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> asynchronously and - 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 - discovery mechanisms</a> is an implementation detail left to the discretion of the implementer (e.g. by - continuously monitoring the network as a background process or on invocation of this <abbr title="Application Programming Interface">API</abbr> from a Web page). + It is expected that user agents will perform these <a href="#dfn-service-discovery-mechanisms" + class="internalDFN">service discovery mechanisms</a> asynchronously and 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 discovery mechanisms</a> is an implementation detail left to the discretion of + the implementer (e.g. by continuously monitoring the network as a background process or on invocation of + this <abbr title="Application Programming Interface">API</abbr> from a Web page). </p> <p> - 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 - that is used to track all the services that have been discovered and are available in the current network at - any given time. At any point during the running of either of the two <a href="#dfn-service-discovery-mechanisms" class="internalDFN">service discovery mechanisms</a> then - existing entries within this table can be updated, entries can be added and entries can be removed as the - status of networked services changes according to the rules defined in this specification. + 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 that is used to track all the services that have been discovered and + are available in the current network at the current 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 existing entries within this table can be updated, + entries can be added and entries can be removed as the status of networked services changes according to the + rules defined in this specification. </p> <p> - The <dfn 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 - <a href="#networkservices"><code>NetworkServices</code></a> objects currently being shared with any web pages - at the current time within the user agent. Each <a href="#networkservices"><code>NetworkServices</code></a> object - in the <a href="#dfn-list-of-active-service-managers" class="internalDFN">list of - 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>. - <a href="#networkservice"><code>NetworkService</code></a> objects are attached as the <a href="#dfn-indexed-properties-1" class="internalDFN">indexed properties</a> - of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> algorithm. + 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 <a href="#networkservices"><code>NetworkServices</code></a> + objects currently being shared with any web pages at the current time within the user agent. Each <a href= + "#networkservices"><code>NetworkServices</code></a> object in the <a href= + "#dfn-list-of-active-service-managers" + class="internalDFN">list of 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>. <a href= + "#networkservice"><code>NetworkService</code></a> objects are attached as the <a href= + "#dfn-indexed-properties-1" + class="internalDFN">indexed properties</a> of a <a href="#networkservices"><code>NetworkServices</code></a> + object as part of the <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> + algorithm. </p> <p> - 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 - existing service in the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> that is generally available on the user's - current network. This rule takes one argument, <var>network service record</var>, and consists of running the - following steps: + 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 existing service that is generally available on the user's current network + in the <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a>. This rule takes one argument, <var>network + service record</var>, and consists of running the following steps: </p> <ol class="rule"> - <li>Let <var>new service registration flag</var> be <code>true</code>. - </li> - <li>For each <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, run - the following sub-steps: + <li>For each <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a>, run the following sub-steps: <ol class="rule"> <li>If the <var>existing service record</var>'s <code>id</code> property does not equal <var>network service record</var>'s <code>id</code> property then abort any remaining sub-steps and continue at the next available <var>existing service record</var>. </li> - <li>Set <var>new service registration flag</var> to <code>false</code>. - </li> - <li>Replace the value of <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service - records</a> with the value of <var>network service record</var>. + <li>Replace the value of <var>existing service record</var> in the current <a href= + "#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a> with the value of <var>network service + record</var>, aborting any remaining steps in this algorithm and return. </li> </ol> </li> - <li>If <var>new service registration flag</var> is set to <code>true</code> then add <var>network service - record</var> to the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> as a new item. + <li>Add <var>network service record</var> to the <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a> as a new item. </li> - <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: + <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: <ol class="rule"> - <li>Let <var>service type in current service manager flag</var> be <code>false</code>. - </li> <li>For each <var>active service</var> in <var>service manager</var> run the following steps: <ol class="rule"> - <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>active - service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this <var>active - service</var> and continue at the next available <var>active service</var>. - </li> - <li>Set the <var>service type in current service manager flag</var> to <code>true</code>. - </li> - <li>If the <var>new service registration flag</var> is set to <code>false</code>, the <var>network - service record</var>'s <code>id</code> property equals the <var>active service</var>'s <code>id</code> - attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> - attribute is currently set to <code>false</code> then set <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> attribute to <code>true</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceonline"><code>serviceonline</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, + <li>If the <var>network service record</var>'s <code>id</code> property equals the <var>active + service</var>'s <code>id</code> attribute then set <var>active service</var>'s <a href= + "#dom-networkservice-online"><code>online</code></a> attribute to <code>true</code> and then <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" + class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href= + "#event-serviceonline"><code>serviceonline</code></a> that uses the <a href= + "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and has no default action, at the current <var>active service</var> object. </li> </ol> </li> - <li>If the <var>new service registration flag</var> is set to <code>true</code> and the <var>service type - in current service manager flag</var> is also set to <code>true</code> then increment <var>service - manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> - attribute by <code>1</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceavailable"><code>serviceavailable</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and + <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>. + </li> + <li>For each <var>requested control type</var> of the <var>requested control types</var> in <var>service + manager</var> run the following steps: + <ol class="rule"> + <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>requested + control type</var> then abort any remaining sub-steps and continue at the next available <var>requested + control type</var>. + </li> + <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>, abort any + remaining sub-steps and continue. + </li> + </ol> + </li> + <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then + increment <var>service manager</var>'s <a href= + "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and + then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" + class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href= + "#event-serviceavailable"><code>serviceavailable</code></a> that uses the <a href= + "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and has no default action, at the current <var>service manager</var> object. </li> </ol> </li> </ol> <p> - The rule for <dfn id="dfn-removing-an-available-service">removing an available service</dfn> is the general process of removing a service from the - <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> that has left the user's current network or has otherwise expired. - This rule takes one argument, <var>service identifier</var>, and consists of running the following steps: + The rule for <dfn id="dfn-removing-an-available-service">removing an available service</dfn> is the general + process of removing a service from the <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a> that has left the user's current network or has + otherwise expired. This rule takes one argument, <var>service identifier</var>, and consists of running the + following steps: </p> <ol class="rule"> - <li>For each <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, run - the following sub-steps: + <li>For each <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a>, run the following sub-steps: <ol class="rule"> <li>If the <var>existing service record</var>'s <code>id</code> property does not match <var>service identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and continue at the next available <var>existing service record</var>. </li> - <li>If the <var>existing service record</var>'s <code>type</code> property begins with the DOMString - "<code>upnp:</code>" and <var>existing service record</var>'s <code>eventsURL</code> property is set then - run the rule to <a href="#dfn-terminate-an-existing-upnp-events-subscription" class="internalDFN">terminate an existing UPnP Events Subscription</a>, if one is currently active (as a - result of having previously called <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events Subscription</a> against the current - <var>existing service record</var>). + <li>Let <var>'service type in use' flag</var> be <code>false</code>. </li> - <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: + <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: <ol class="rule"> - <li>Let <var>service type in current service manager flag</var> be <code>false</code>. + <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>. </li> <li>For each <var>active service</var> in <var>service manager</var> run the following steps: <ol class="rule"> - <li>If <var>existing service record</var>'s <code>type</code> property does not equal the - <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this - <var>active service</var> and continue at the next available <var>active service</var>. - </li> - <li>Set the <var>service type in current service manager flag</var> to <code>true</code>. - </li> <li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active - service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> attribute is currently set to + service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href= + "#dom-networkservice-online"><code>online</code></a> attribute is currently set to <code>true</code> then set <var>active service</var>'s <a href="#dom-networkservice-online"><code> - online</code></a> attribute to <code>false</code> and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceoffline"><code>serviceoffline</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not + online</code></a> attribute to <code>false</code> and then <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" + class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href= + "#event-serviceoffline"><code>serviceoffline</code></a> that uses the <a href= + "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and has no default action, at the current <var>active service</var>. </li> </ol> </li> - <li>If the <var>service type in current service manager flag</var> is set to <code>true</code> then - decrement <var>service manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> - and then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href="#event-serviceunavailable"><code>serviceunavailable</code></a> that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, + <li>For each <var>requested control type</var> of the <var>requested control types</var> in + <var>service manager</var> run the following steps: + <ol class="rule"> + <li>If <var>existing service record</var>'s <code>type</code> property does not equal + <var>requested control type</var> then abort any remaining sub-steps and continue at the next + available <var>requested control type</var>. + </li> + <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code> and the + <var>'service type in use' flag</var> to <code>true</code>, abort any remaining sub-steps and + continue. + </li> + </ol> + </li> + <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then + decrement <var>service manager</var>'s <a href= + "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> + and then <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" + class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href= + "#event-serviceunavailable"><code>serviceunavailable</code></a> that uses the <a href= + "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> interface, which does not bubble, is not cancellable, and has no default action, at the current <var>service manager</var> object. </li> </ol> </li> - <li>Remove <var>existing service record</var> from the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>. + <li>If the <var>'service type in use' flag</var> is <code>false</code> and the <var>existing service + record</var>'s <code>type</code> property begins with the DOMString "<code>upnp:</code>" and <var>existing + service record</var>'s <code>eventsURL</code> property is set then run the rule to <a href= + "#dfn-terminate-an-existing-upnp-events-subscription" + class="internalDFN">terminate an existing UPnP Events Subscription</a>, if one is currently active + (as a result of having previously called <a href="#dfn-setup-a-upnp-events-subscription" + class="internalDFN">setup a UPnP Events Subscription</a> against the current <var>existing service + record</var>). + </li> + <li>Remove <var>existing service record</var> from the current <a href= + "#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a>. </li> </ol> </li> </ol> <p> - 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 - <code>expiryTimestamp</code> attribute exceeds the current UTC timestamp. When this 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 the expired service - record's <code>id</code> attribute as the only argument. + 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 <code>expiryTimestamp</code> attribute + exceeds the current UTC timestamp. When this 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 the expired service record's + <code>id</code> attribute as the only argument. </p> <section id="zeroconf-mdns-dns-sd"> - <h3><span class="secno">7.1 </span> - Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>) + <h3> + <span class="secno">7.1</span> Zeroconf (<abbr title="Multicast DNS">mDNS</abbr> + <abbr title= + "Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr>) </h3> <p> - 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 - 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: + 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 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: </p> <ol class="rule"> - <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> - Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name of the current discovered service type. + <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> Browse for <abbr title="DNS Pointer Record">PTR</abbr> records with the name + of the current discovered service type. </li> - <li>For each Object <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> in <var>service <abbr title="Multicast DNS">mDNS</abbr> responses</var>, run the following - steps: + <li>For each Object <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> in <var>service + <abbr title="Multicast DNS">mDNS</abbr> responses</var>, run the following steps: <ol> <li>Let <var>network service record</var> be an Object consisting of the following empty properties: <code>id</code>, <code>name</code>, <code>type</code>, <code>url</code>, <code>config</code>, <code>expiryTimestamp</code>. </li> - <li>Set <var>network service record</var>'s <code>id</code> property to the value of the full <abbr title="DNS Pointer Record">PTR</abbr> Service - Instance Name [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>]. + <li>Set <var>network service record</var>'s <code>id</code> property to the value of the full + <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name [<cite><a class="bibref" + href="#bib-MDNS">MDNS</a></cite>]. </li> - <li>Set <var>network service record</var>'s <code>name</code> property to the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service - Instance Name's <var>Instance</var> component [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>]. + <li>Set <var>network service record</var>'s <code>name</code> property to the value of the <abbr title= + "DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Instance</var> component [<cite><a class= + "bibref" + href="#bib-MDNS">MDNS</a></cite>]. </li> <li>Set <var>network service record</var>'s <code>type</code> property to the concatenation of the string - <code>zeroconf:</code> followed be the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service Instance Name's <var>Service</var> - component [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>]. + <code>zeroconf:</code> followed be the value of the <abbr title="DNS Pointer Record">PTR</abbr> Service + Instance Name's <var>Service</var> component [<cite><a class="bibref" + href="#bib-MDNS">MDNS</a></cite>]. </li> - <li>Set <var>network service record</var>'s <code>url</code> property to the resolvable Service <abbr title="Uniform Resource Locator">URL</abbr> - obtained from performing an <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> Lookup [<cite><a class="bibref" href="#bib-DNS-SD">DNS-SD</a></cite>] of the current service from the <abbr title="DNS Pointer Record">PTR</abbr> record provided - [<cite><a class="bibref" href="#bib-MDNS">MDNS</a></cite>]. + <li>Set <var>network service record</var>'s <code>url</code> property to the resolvable Service + <abbr title="Uniform Resource Locator">URL</abbr> obtained from performing an <abbr title= + "Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> Lookup [<cite><a class="bibref" + href="#bib-DNS-SD">DNS-SD</a></cite>] of the current service from the <abbr title= + "DNS Pointer Record">PTR</abbr> record provided [<cite><a class="bibref" + href="#bib-MDNS">MDNS</a></cite>]. </li> <li>Set <var>network service record</var>'s <code>config</code> property to the string value of the - contents of the first <abbr title="Domain Name System">DNS</abbr>-<abbr title="Service Discovery">SD</abbr> TXT record associated with the <var>service <abbr title="Multicast DNS">mDNS</abbr> response</var> as defined - in [<cite><a class="bibref" href="#bib-DNS-SD">DNS-SD</a></cite>]. + contents of the first <abbr title="Domain Name System">DNS</abbr>-<abbr title= + "Service Discovery">SD</abbr> TXT record associated with the <var>service <abbr title= + "Multicast DNS">mDNS</abbr> response</var> as defined in [<cite><a class="bibref" + href="#bib-DNS-SD">DNS-SD</a></cite>]. </li> <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the current date, in UTC timestamp format, plus a value of <code>120</code> seconds. </li> - <li>Run the general rule for <a href="#dfn-adding-an-available-service" class="internalDFN">adding an available service</a>, passing in the current <var>network - service record</var> as the only argument. + <li>Run the general rule for <a href="#dfn-adding-an-available-service" + class="internalDFN">adding an available service</a>, passing in the current <var>network service + record</var> as the only argument. </li> </ol> </li> </ol> </section> <section id="simple-service-discovery-protocol-ssdp"> - <h3><span class="secno">7.2 </span> - Simple Service Discovery Protocol (<abbr title="Simple Service Discovery Protocol">SSDP</abbr>) + <h3> + <span class="secno">7.2</span> Simple Service Discovery Protocol (<abbr title= + "Simple Service Discovery Protocol">SSDP</abbr>) </h3> <p> - 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 - devices</dfn> against the user's current local network according to the full normative text and timing - provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. + 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 devices</dfn> against the user's current local network according to the full normative text and + timing provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [<cite><a class="bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. </p> <p> - 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 - 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 - the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to - <code>ssdp:discover</code>, an ST header equal to <code>upnp:rootdevice</code> and a user-agent defined MX - header equal to a <dfn id="dfn-maximum-upnp-advertisement-response-wait-time">maximum UPnP advertisement response wait time</dfn> value between <code>1</code> and - <code>5</code> seconds. + 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 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 the reserved multicast + address and port of <code>239.255.255.250:1900</code> and a MAN header equal to + <code>ssdp:discover</code>. The <a href="#dfn-user-agent" + class="internalDFN">user agent</a> must also send an ST header with this <abbr title= + "Hypertext Transfer Protocol">HTTP</abbr> request equal to the String value of <code>ssdp:all</code> or + <code>upnp:rootdevice</code> or a single <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> token. The user-agent <em class="rfc2119" + title="must">must</em> also send an MX 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 <code>5</code> seconds with this <abbr title= + "Hypertext Transfer Protocol">HTTP</abbr> request. </p> <p> - 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>. + 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>. </p> <p> - 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 - <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: + 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 <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: </p> <ol class="rule"> - <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 - 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 - <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. + <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 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 <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. </li> - <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 - 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> - discard this response, abort any remaining steps and return. The user agent <em class="rfc2119" title="may">may</em> stop listening for responses - 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, - 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 - occurring. + <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 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> discard this response, abort any remaining steps and return. The user agent + <em class="rfc2119" + title="may">may</em> stop listening for responses 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, 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 occurring. </li> - <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> - 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 - header's value. + <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> 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 header's value. </li> <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one - <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the - value of its <var>ST</var> entry is not <code>upnp:rootdevice</code>, then the <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is - 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. + <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry then the + <a href="#dfn-http-response" + class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is 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. </li> - <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 - occurrence of <var>LOCATION</var> from <var>ssdp 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 <var>ssdp device</var> as the <var>device - identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> - (minus the leading string of <code>max-age=</code>) as the <var>device expiry</var> argument. + <li>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 occurrence of + <var>LOCATION</var> from <var>ssdp 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 + <var>ssdp device</var> as the <var>device identifier</var> argument and the first occurrence of + <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the leading string of + <code>max-age=</code>) as the <var>device expiry</var> argument. </li> </ol> <p> - 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 - current local network interface addresses with the port <code>1900</code>. + 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 current local network + interface addresses with the port <code>1900</code>. </p> <p> - 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 - the following steps: + 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 the following steps: </p> <ol class="rule"> - <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 - agent <em class="rfc2119" title="must">must</em> discard this request, abort any remaining steps and return. + <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 agent <em class="rfc2119" + title="must">must</em> discard this request, abort any remaining steps and return. </li> - <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> - 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. + <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> 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. </li> - <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one - <var>USN</var> entry, at least one <var>NT</var> entry, at least one <var>NTS</var> entry and at least one - <var>LOCATION</var> entry or the value of its <var>NT</var> entry is not <code>upnp:rootdevice</code>, then - the <a 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, - abort any remaining steps and return. + <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> and the <a href= + "#dfn-http-request" + class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Request</a> does not contain + at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, at least one + <var>NT</var> entry, at least one <var>NTS</var> entry and at least one <var>LOCATION</var> entry, then + the <a href="#dfn-user-agent" + class="internalDFN">user agent</a> <em class="rfc2119" + title="must">must</em> discard this request, abort any remaining steps and return. </li> <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> 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 Device Description File</a> passing in the first occurrence of - <var>LOCATION</var> from <var>ssdp 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 <var>ssdp device</var> as the <var>device identifier</var> argument - and the first occurrence of <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the leading string of - <code>max-age=</code>) as the <var>device expiry</var>.<br> + <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 + <var>LOCATION</var> from <var>ssdp 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 + <var>ssdp device</var> as the <var>device identifier</var> argument and the first occurrence of + <var>CACHE-CONTROL</var> from <var>ssdp device</var> (minus the leading string of + <code>max-age=</code>) as the <var>device expiry</var>.<br> <br> Otherwise, if <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:byebye</code> then the - user agent <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 - first occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> - argument. + 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 first + occurrence of <var>USN</var> from <var>ssdp device</var> as the <var>device identifier</var> argument. </li> </ol> <p> - The rule for <dfn id="dfn-obtaining-a-upnp-device-description-file">obtaining a UPnP Device Description File</dfn> is the process of obtaining the contents of - a standard UPnP Device Description [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] from a <abbr title="Uniform Resource Locator">URL</abbr>-based resource. This rule takes three - arguments - <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var>, <var>device identifier</var> and <var>device expiry</var> - and - when called the user agent <em class="rfc2119" title="must">must</em> run the following steps: + The rule for <dfn id="dfn-obtaining-a-upnp-device-description-file">obtaining a UPnP Device Description + File</dfn> is the process of obtaining the contents of a standard UPnP Device Description [<cite><a class= + "bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] from a <abbr title= + "Uniform Resource Locator">URL</abbr>-based resource. This rule takes three arguments - <var>device + descriptor <abbr title="Uniform Resource Locator">URL</abbr></var>, <var>device identifier</var> and + <var>device expiry</var> - and when called the user agent <em class="rfc2119" + title="must">must</em> run the following steps: </p> <ol class="rule"> - <li>Let <var>device descriptor file</var> contain the contents of the file located at the <abbr title="Uniform Resource Locator">URL</abbr> provided in - <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> obtained according to the rules defined in 'Section 2.11: Retrieving a - description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. + <li>Let <var>device descriptor file</var> contain the contents of the file located at the <abbr title= + "Uniform Resource Locator">URL</abbr> provided in <var>device descriptor <abbr title= + "Uniform Resource Locator">URL</abbr></var> obtained according to the rules defined in 'Section 2.11: + Retrieving a description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' in [<cite><a class= + "bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. </li> - <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 - 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 - agent</a> <em class="rfc2119" title="must">must</em> abort any remaining steps and return. + <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 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 agent</a> <em class="rfc2119" + title="must">must</em> abort any remaining steps and return. </li> - <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 - descriptor file</var>, <var>device identifier</var> and <var>device expiry</var> arguments. + <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 + descriptor file</var>, <var>device identifier</var> and <var>device expiry</var> arguments. </li> </ol> <p> - 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 - standard UPnP Device Description [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] and registering the UPnP services contained therein - within the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>. + 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 standard UPnP Device Description [<cite><a class= + "bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] and registering the UPnP services contained + therein within the <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a>. </p> <p> - 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 - file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the user agent <em class="rfc2119" title="must">must</em> - run the following steps: + 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 file</var>, <var>device identifier</var> and <var>device expiry</var> - and when called the + user agent <em class="rfc2119" + title="must">must</em> run the following steps: </p> <ol class="rule"> <li>Let <var>advertised services</var> be a list of all advertised services obtained from the <var>device descriptor file</var> containing the value of the first occurrence of the <code><serviceList></code> - element as it is defined in 'Section 2.3: Device Description' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. + element as it is defined in 'Section 2.3: Device Description' in [<cite><a class="bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. </li> <li>For each <code><service></code> element - known as an <var>advertised service</var> - in <var>advertised services</var> run the following steps: @@ -1473,58 +1985,74 @@ <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the current date, in UTC timestamp format, plus the value of <var>device expiry</var>. </li> - <li>Run the general rule for <a href="#dfn-adding-an-available-service" class="internalDFN">adding an available service</a>, passing in the current <var>network - service record</var> as the only argument. + <li>Run the general rule for <a href="#dfn-adding-an-available-service" + class="internalDFN">adding an available service</a>, passing in the current <var>network service + record</var> as the only argument. </li> </ol> </li> <li>If <var>device descriptor file</var> contains a <code><deviceList></code> element then for each <code><device></code> element within <code><deviceList></code> - herein known as an <var>embedded - 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 - File</a>, passing in the current <var>embedded device descriptor file</var> as the <var>device descriptor - file</var> argument, along with the current <var>device identifier</var> and <var>device expiry</var> - arguments. + 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 File</a>, passing in the current <var>embedded + device descriptor file</var> as the <var>device descriptor file</var> argument, along with the current + <var>device identifier</var> and <var>device expiry</var> arguments. </li> </ol> <p> - The rule for <dfn 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 - services associated with a device from the <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a> that has left the user's - current network or has otherwise timed out or expired. This rule takes one argument, <var>device - identifier</var>, and consists of running the following steps: + 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 services associated with a device from the + <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a> that has left the user's current network or has + otherwise timed out or expired. This rule takes one argument, <var>device identifier</var>, and consists + of running the following steps: </p> <ol class="rule"> - <li>For each <var>existing service record</var> in the current <a href="#dfn-list-of-available-service-records" class="internalDFN">list of available service records</a>, run - the following sub-steps: + <li>For each <var>existing service record</var> in the current <a href= + "#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a>, run the following sub-steps: <ol class="rule"> <li>If the <var>existing service record</var>'s <code>deviceId</code> property does not match <var>device identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and continue at the next available <var>existing service record</var>. </li> - <li>Run the general rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a> passing in <var>existing service - record</var>'s <code>id</code> property as the only argument. + <li>Run the general rule for <a href="#dfn-removing-an-available-service" + class="internalDFN">removing an available service</a> passing in <var>existing service + record</var>'s <code>id</code> property as the only argument. </li> </ol> </li> </ol> <p> - When the <a href="#dfn-user-agent" class="internalDFN">user agent</a> is to <dfn id="dfn-setup-a-upnp-events-subscription">setup a UPnP Events Subscription</dfn>, it is to run the following - steps with the current <var>network service record</var> object as defined in 'Section 4.1.2: SUBSCRIBE with - NT and CALLBACK' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]: + When the <a href="#dfn-user-agent" + class="internalDFN">user agent</a> is to <dfn id="dfn-setup-a-upnp-events-subscription">setup a UPnP + Events Subscription</dfn>, it is to run the following steps with the current <var>network service + record</var> object as defined in 'Section 4.1.2: SUBSCRIBE with NT and CALLBACK' in [<cite><a class= + "bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]: </p> <ol class="rule"> - <li>If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a href="#dfn-user-agent" class="internalDFN">user - agent</a> <em class="rfc2119" title="must">must</em> abort these steps. + <li>If <var>network service record</var>'s <code>eventsUrl</code> property is empty then the <a href= + "#dfn-user-agent" + class="internalDFN">user agent</a> <em class="rfc2119" + title="must">must</em> abort these steps. </li> - <li>Let <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> be the value of creating a new <a href="#dfn-user-agent-generated-callback-url" class="internalDFN">user-agent generated callback url</a>. + <li>Let <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> be the value of creating a new + <a href="#dfn-user-agent-generated-callback-url" + class="internalDFN">user-agent generated callback url</a>. </li> - <li>Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>NT</em> header with a string value of <code>upnp:event</code>, a - <em>TIMEOUT</em> header with a user-agent defined timeout value (in the form <code>Second-XX</code> where - <code>XX</code> is the user-agent defined timeout value in seconds) and a <em>CALLBACK</em> header with a - string value of <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> towards the <var>network service record</var>'s + <li>Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>NT</em> header + with a string value of <code>upnp:event</code>, a <em>TIMEOUT</em> header with a user-agent defined timeout + value (in the form <code>Second-XX</code> where <code>XX</code> is the user-agent defined timeout value in + seconds) and a <em>CALLBACK</em> header with a string value of <var>callback <abbr title= + "Uniform Resource Locator">URL</abbr></var> towards the <var>network service record</var>'s <code>eventsUrl</code> property. </li> - <li>If a non-200 OK response is received from the <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> - abort these steps. + <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> abort these steps. </li> <li>On receiving a valid 200 OK response, run the following steps: <ol class="rule"> @@ -1537,47 +2065,63 @@ <li>Run the following steps asynchronously and continue to the step labeled <em>listen</em> below. </li> <li> - <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a href="#dfn-user-agent" class="internalDFN">user - agent</a>: + <em>Refresh Subscription</em>: Run the following steps at a set interval (X) within the <a href= + "#dfn-user-agent" + class="internalDFN">user agent</a>: <ol class="rule"> <li>Let <var>current date</var> equal the current UTC date. </li> <li>If <var>current date</var> is less than the <var>timeout date</var> then continue to the step labeled <em>refresh subscription</em> above. </li> - <li>Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a <em>SID</em> header with the string value of <var>callback - ID</var> and a user-agent defined <em>TIMEOUT</em> header (in the form <code>Second-XX</code> where - <code>XX</code> is the user-agent defined timeout value in seconds) towards the <var>network service - record</var>'s <code>eventsUrl</code> property. + <li>Send a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> SUBSCRIBE request with a + <em>SID</em> header with the string value of <var>callback ID</var> and a user-agent defined + <em>TIMEOUT</em> header (in the form <code>Second-XX</code> where <code>XX</code> is the user-agent + defined timeout value in seconds) towards the <var>network service record</var>'s + <code>eventsUrl</code> property. </li> <li>On receiving a valid 200 OK, update <var>callback ID</var> with the string value of the first included <em>SID</em> header and set <var>timeout date</var> to the sum of the current UTC date value plus the integer value of the first included <em>TIMEOUT</em> header (minus the leading string of <code>Second-</code>), if it exists. If the current date is greater than or equal to <var>timeout - date</var> then the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="should">should</em> continue from the step labeled <em>refresh - 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 - step labeled <em>refresh subscription</em> above. + 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 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 step labeled <em>refresh subscription</em> above. </li> </ol> </li> <li> - <em>Listen</em>: For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request received at the <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> the <a href="#dfn-user-agent" class="internalDFN">user - agent</a> is to run the following steps: + <em>Listen</em>: For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY request received + at the <var>callback <abbr title="Uniform Resource Locator">URL</abbr></var> the <a href= + "#dfn-user-agent" + class="internalDFN">user agent</a> is to run the following steps: <ol class="rule"> - <li>Let <var>content clone</var> be the result of obtaining the message body of the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> NOTIFY - 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. + <li>Let <var>content clone</var> be the result of obtaining the message body of the <abbr title= + "Hypertext Transfer Protocol">HTTP</abbr> NOTIFY 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. </li> - <li>Let <var>notification event</var> be a new simple event that uses the <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" 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 + <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 default action. </li> <li>Let the <code>data</code> attribute of <var>notification event</var> have the DOMString value of <var>content clone</var>. </li> <li> - <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 - <a href="#networkservice" class="internalDFN"><code>NetworkService</code></a> object. + <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 + <a href="#networkservice" + class="internalDFN"><code>NetworkService</code></a> object. </li> - <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. + <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. </li> </ol> </li> @@ -1585,92 +2129,142 @@ </li> </ol> <p> - 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 - <var>network service record</var> by sending an <abbr title="Hypertext Transfer Protocol">HTTP</abbr> UNSUBSCRIBE 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>] - with a HOST header set to that - <var>active service</var>'s <code>eventsUrl</code> property and a SID header set to the <var>callback - ID</var> obtained when the initial <a href="#dfn-setup-a-upnp-events-subscription" class="internalDFN">setup a UPnP Events Subscription</a> action occurred. + 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 <var>network service record</var> by sending an <abbr title= + "Hypertext Transfer Protocol">HTTP</abbr> UNSUBSCRIBE 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>] - with a HOST header set to that <var>active + service</var>'s <code>eventsUrl</code> property and a SID header set to the <var>callback ID</var> + obtained when the initial <a href="#dfn-setup-a-upnp-events-subscription" + class="internalDFN">setup a UPnP Events Subscription</a> action occurred. </p> </section> <section id="discovery-and-launch-protocol-dial"> - <h3><span class="secno">7.3 </span> - Discovery and Launch Protocol (<abbr title="Discovery and Launch Protocol">DIAL</abbr>) + <h3> + <span class="secno">7.3</span> Discovery and Launch Protocol (<abbr title= + "Discovery and Launch Protocol">DIAL</abbr>) </h3> - <p> - A user agent that implements <abbr title="Discovery and Launch Protocol">DIAL</abbr> service discovery <em class="rfc2119" title="must">must</em> issue a <dfn id="dfn-search-request-for-dial-enabled-devices">search request for <abbr title="Discovery and Launch Protocol">DIAL</abbr>-enabled - devices</dfn> against the user's current local network according to the full normative text and timing - provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. + <p> + A user agent that implements <abbr title="Discovery and Launch Protocol">DIAL</abbr> service discovery + <em class="rfc2119" + title="must">must</em> issue a <dfn id="dfn-search-request-for-dial-enabled-devices">search request for + <abbr title="Discovery and Launch Protocol">DIAL</abbr>-enabled devices</dfn> against the user's current + local network according to the full normative text and timing provided in 'Section 1.3.2: Search request + with M-SEARCH' detailed in [<cite><a class="bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. </p> <p> - Let <var>dial version</var> be the version number specified in the <a href="#dfn-valid-service-type" class="internalDFN">valid service type</a> token. - Let <var>dial search target</var> be the concatentation of the - <code>urn:dial-multiscreen-org:service:dial:</code> string constant with the <var>dial version</var> - (currently, <var>dial version</var> can only be <code>1</code>) + Let <var>dial version</var> be the version number specified in the <a href="#dfn-valid-service-type" + class="internalDFN">valid service type</a> token. Let <var>dial search target</var> be the concatentation + of the <code>urn:dial-multiscreen-org:service:dial:</code> string constant with the <var>dial + version</var> (currently, <var>dial version</var> can only be <code>1</code>) </p> <p> - The user agent <em class="rfc2119" title="must">must</em> issue all <a title="search request for DIAL devices">search requests for <abbr title="Discovery and Launch Protocol">DIAL</abbr> - 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 - the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to - <code>ssdp:discover</code>, an ST header equal to <var>dial search target</var> - and a user-agent defined MX header equal to a <dfn id="dfn-maximum-dial-advertisement-response-wait-time">maximum <abbr title="Discovery and Launch Protocol">DIAL</abbr> advertisement response wait time</dfn> - value between <code>1</code> and <code>5</code> seconds. + The user agent <em class="rfc2119" + title="must">must</em> issue all <a title="search request for DIAL devices">search requests for + <abbr title="Discovery and Launch Protocol">DIAL</abbr> 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 the reserved multicast + address and port of <code>239.255.255.250:1900</code>, a MAN header equal to <code>ssdp:discover</code>, + an ST header equal to <var>dial search target</var> and a user-agent defined MX header equal to a <dfn id= + "dfn-maximum-dial-advertisement-response-wait-time">maximum <abbr title= + "Discovery and Launch Protocol">DIAL</abbr> advertisement response wait time</dfn> value between + <code>1</code> and <code>5</code> seconds. </p> <p> - The user agent <em class="rfc2119" title="must">must</em> listen for any incoming responses to a <a>search request for <abbr title="Discovery and Launch Protocol">DIAL</abbr> devices</a>. + The user agent <em class="rfc2119" + title="must">must</em> listen for any incoming responses to a <a>search request for <abbr title= + "Discovery and Launch Protocol">DIAL</abbr> devices</a>. </p> <p> - For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response following an initial <a>search request for <abbr title="Discovery and Launch Protocol">DIAL</abbr> devices</a> sent 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 the following steps: + For each <abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response following an initial <a>search + request for <abbr title="Discovery and Launch Protocol">DIAL</abbr> devices</a> sent 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 the following steps: </p> <ol class="rule"> - <li>If the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response is not a <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 200 OK response then this response is invalid and the user - 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 - <a>search request for <abbr title="Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error occurring. + <li>If the <abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response is not a <abbr title= + "Hypertext Transfer Protocol">HTTP</abbr> 200 OK response then this response is invalid and the user 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 <a>search request for <abbr title= + "Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error occurring. </li> - <li>If the <a href="#dfn-maximum-dial-advertisement-response-wait-time" class="internalDFN">maximum <abbr title="Discovery and Launch Protocol">DIAL</abbr> advertisement response wait time</a> has been exceeded since the initial <a>search - request for <abbr title="Discovery and Launch Protocol">DIAL</abbr> 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> - discard this response, abort any remaining steps and return. The user agent <em class="rfc2119" title="may">may</em> stop listening for responses - from the current <a>search request for <abbr title="Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error occurring. Equally, - the user agent <em class="rfc2119" title="may">may</em> issue a new <a>search request for <abbr title="Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error - occurring. + <li>If the <a href="#dfn-maximum-dial-advertisement-response-wait-time" + class="internalDFN">maximum <abbr title="Discovery and Launch Protocol">DIAL</abbr> advertisement + response wait time</a> has been exceeded since the initial <a>search request for <abbr title= + "Discovery and Launch Protocol">DIAL</abbr> 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> discard this response, abort any remaining steps and return. The user agent + <em class="rfc2119" + title="may">may</em> stop listening for responses from the current <a>search request for <abbr title= + "Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error occurring. Equally, + the user agent <em class="rfc2119" + title="may">may</em> issue a new <a>search request for <abbr title= + "Discovery and Launch Protocol">DIAL</abbr> devices</a> as a result of this error occurring. </li> - <li>Let <var>dial 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> - 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 - header's value. + <li>Let <var>dial 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> 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 header's value. </li> <li>If <var>dial device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the - value of its <var>ST</var> entry is not <var>dial search target</var>, then the - <a href="#dfn-http-response" class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is 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. + value of its <var>ST</var> entry is not <var>dial search target</var>, then the <a href="#dfn-http-response" + class="internalDFN"><abbr title="Hypertext Transfer Protocol">HTTP</abbr> Response</a> is 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. </li> - <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 - occurrence of <var>LOCATION</var> from <var>dial 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 <var>dial device</var> as the <var>device - identifier</var> argument and the first occurrence of <var>CACHE-CONTROL</var> from <var>dial device</var> - (minus the leading string of <code>max-age=</code>) as the <var>device expiry</var> argument. + <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 occurrence of + <var>LOCATION</var> from <var>dial 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 + <var>dial device</var> as the <var>device identifier</var> argument and the first occurrence of + <var>CACHE-CONTROL</var> from <var>dial device</var> (minus the leading string of + <code>max-age=</code>) as the <var>device expiry</var> argument. </li> </ol> <p> - The rule for <dfn id="dfn-obtaining-a-dial-device-description-file">obtaining a <abbr title="Discovery and Launch Protocol">DIAL</abbr> Device Description File</dfn> is the process of obtaining the contents of - a standard UPnP Device Description [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] from a <abbr title="Uniform Resource Locator">URL</abbr>-based resource. This rule takes three - arguments - <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var>, <var>device identifier</var> and <var>device expiry</var> - and - when called the user agent <em class="rfc2119" title="must">must</em> run the following steps: + The rule for <dfn id="dfn-obtaining-a-dial-device-description-file">obtaining a <abbr title= + "Discovery and Launch Protocol">DIAL</abbr> Device Description File</dfn> is the process of obtaining the + contents of a standard UPnP Device Description [<cite><a class="bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>] from a <abbr title= + "Uniform Resource Locator">URL</abbr>-based resource. This rule takes three arguments - <var>device + descriptor <abbr title="Uniform Resource Locator">URL</abbr></var>, <var>device identifier</var> and + <var>device expiry</var> - and when called the user agent <em class="rfc2119" + title="must">must</em> run the following steps: </p> <ol class="rule"> - <li>Let <var>device descriptor file</var> contain the contents of the file located at the <abbr title="Uniform Resource Locator">URL</abbr> provided in - <var>device descriptor <abbr title="Uniform Resource Locator">URL</abbr></var> obtained according to the rules defined in 'Section 2.11: Retrieving a - description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' in [<cite><a class="bibref" href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. + <li>Let <var>device descriptor file</var> contain the contents of the file located at the <abbr title= + "Uniform Resource Locator">URL</abbr> provided in <var>device descriptor <abbr title= + "Uniform Resource Locator">URL</abbr></var> obtained according to the rules defined in 'Section 2.11: + Retrieving a description using <abbr title="Hypertext Transfer Protocol">HTTP</abbr>' in [<cite><a class= + "bibref" + href="#bib-UPNP-DEVICEARCH11">UPNP-DEVICEARCH11</a></cite>]. </li> - <li>Let <var>application url</var> be the value of the first occurrence of the <code>Application-<abbr title="Uniform Resource Locator">URL</abbr></code> - response header field obtained according to the rules defined in 'Section 5.4: Device Description Response' in - [<a href="https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification"><abbr title="Discovery and Launch Protocol">DIAL</abbr></a>] + <li>Let <var>application url</var> be the value of the first occurrence of the + <code>Application-<abbr title="Uniform Resource Locator">URL</abbr></code> response header field obtained + according to the rules defined in 'Section 5.4: Device Description Response' in [<a href= + "https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification"><abbr title= + "Discovery and Launch Protocol">DIAL</abbr></a>] </li> - <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 - current network or the <var>device descriptor file</var> remains empty or <var>application url</var> is undefined - then it is invalid and the <a href="#dfn-user-agent" class="internalDFN">user agent</a> <em class="rfc2119" title="must">must</em> abort any remaining steps and return. + <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 current network or + the <var>device descriptor file</var> remains empty or <var>application url</var> is undefined then it is + invalid and the <a href="#dfn-user-agent" + class="internalDFN">user agent</a> <em class="rfc2119" + title="must">must</em> abort any remaining steps and return. </li> - <li>Run the following steps to add the newly discovered <abbr title="Discovery and Launch Protocol">DIAL</abbr> service: + <li>Run the following steps to add the newly discovered <abbr title= + "Discovery and Launch Protocol">DIAL</abbr> service: <ol class="rule"> <li>Let <var>network service record</var> be a new Object consisting of the following empty properties: <code>id</code>, <code>deviceId</code>, <code>name</code>, <code>type</code>, <code>url</code>, @@ -1688,41 +2282,51 @@ </li> <li>Set <var>network service record</var>'s <code>type</code> property to <var>dial search target</var>. </li> - <li>Set <var>network service record</var>'s <code>url</code> property to the string value of the <var> - application url</var>. + <li>Set <var>network service record</var>'s <code>url</code> property to the string value of the + <var>application url</var>. </li> <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the current date, in UTC timestamp format, plus the value of <var>device expiry</var>. </li> - <li>Run the general rule for <a href="#dfn-adding-an-available-service" class="internalDFN">adding an available service</a>, passing in the current <var>network - service record</var> as the only argument. + <li>Run the general rule for <a href="#dfn-adding-an-available-service" + class="internalDFN">adding an available service</a>, passing in the current <var>network service + record</var> as the only argument. </li> </ol> </li> </ol> </section> <section id="network-topology-monitoring"> - <h3><span class="secno">7.4 </span> - Network Topology Monitoring + <h3> + <span class="secno">7.4</span> Network Topology Monitoring </h3> <div> <p> - 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 - <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 - the general rule for <a href="#dfn-removing-an-available-service" class="internalDFN">removing an available service</a> passing in each <var>existing service - record</var>'s <code>id</code> property as the only argument for each call. + When the <a href="#dfn-user-agent" + class="internalDFN">user agent</a> detects that the user has dropped from a connected network then, for + each <var>existing service record</var> in the <a href="#dfn-list-of-available-service-records" + class="internalDFN">list of available service records</a> discovered via that network connection, the + <a href="#dfn-user-agent" + class="internalDFN">user agent</a> <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 <var>existing service + record</var>'s <code>id</code> property as the only argument for each call. </p> <p> - 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 - 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 - of active service managers</a> currently in use. + 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 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 of active service managers</a> currently in use. </p> </div> </section> </section> <section id="events-summary"> - <!--OddPage--><h2><span class="secno">8. </span> - Events Summary + <h2> + <span class="secno">8.</span> Events Summary </h2> <p> The following events are dispatched on the <a href="#networkservices"><code>NetworkServices</code></a> and/or @@ -1748,7 +2352,8 @@ <dfn id="event-serviceavailable"><code>serviceavailable</code></dfn> </td> <td> - <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> + <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> </td> <td> When a new service that matches one of the <a>requested type tokens</a> is found in the current network. @@ -1759,7 +2364,8 @@ <dfn id="event-serviceunavailable"><code>serviceunavailable</code></dfn> </td> <td> - <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> + <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> </td> <td> When an existing service that matches one of the <a>requested type tokens</a> gracefully leaves or @@ -1771,7 +2377,8 @@ <dfn id="event-serviceonline"><code>serviceonline</code></dfn> </td> <td> - <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> + <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> </td> <td> When a current service renews its service registration within the current network. @@ -1782,7 +2389,8 @@ <dfn id="event-serviceoffline"><code>serviceoffline</code></dfn> </td> <td> - <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> + <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> </td> <td> When a current service gracefully leaves or otherwise expires from the current network. @@ -1793,42 +2401,57 @@ <dfn id="event-notify"><code>notify</code></dfn> </td> <td> - <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" class="externalDFN"><code>Event</code></a> + <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" + class="externalDFN"><code>Event</code></a> </td> <td> - When a valid UPnP Events Subscription Message is received on a <a href="#dfn-user-agent-generated-callback-url" class="internalDFN">user-agent generated callback url</a> - for a current service. This event never fires for Zeroconf-based services. + When a valid UPnP Events Subscription Message is received on a <a href= + "#dfn-user-agent-generated-callback-url" + class="internalDFN">user-agent generated callback url</a> for a current service. This event never + fires for Zeroconf-based services. </td> </tr> </tbody> </table> </section> <section id="garbage-collection"> - <!--OddPage--><h2><span class="secno">9. </span> - Garbage collection + <h2> + <span class="secno">9.</span> Garbage collection </h2> <p> - 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 - 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 - <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 - the current <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object was provided. + 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 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 <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 the current <a href="#networkservices" + class="internalDFN"><code>NetworkServices</code></a> object was provided. </p> <p> - 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 - <a href="#networkservices" class="internalDFN"><code>NetworkServices</code></a> object has been garbage collected. + 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 <a href="#networkservices" + class="internalDFN"><code>NetworkServices</code></a> object has been garbage collected. </p> <p> - 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 - <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 - garbage-collected. + 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 <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 garbage-collected. </p> </section> <section id="use-cases-and-requirements"> - <!--OddPage--><h2><span class="secno">10. </span> - Use Cases and Requirements + <h2> + <span class="secno">10.</span> Use Cases and Requirements </h2> <p> - This section covers what the requirements are for this <abbr title="Application Programming Interface">API</abbr>, as well as illustrates some use cases. + This section covers what the requirements are for this <abbr title= + "Application Programming Interface">API</abbr>, as well as illustrates some use cases. </p> <ul class="rule"> <li>Once a user has given permission, user agents should provide the ability for Web pages to communicate @@ -1889,17 +2512,22 @@ </li> </ul> </li> - <li>User agents should provide an <abbr title="Application Programming Interface">API</abbr> exposed to script that exposes the features above. The user is notified - by UI anytime interaction with Local-networked Services is requested, giving the user full ability to cancel or - abort the transaction. The user selects the Local-networked Services to be connected to the current Web page, - and can cancel these at any time. No invocations to these APIs occur silently without user intervention. + <li>User agents should provide an <abbr title="Application Programming Interface">API</abbr> exposed to script + that exposes the features above. The user is notified by UI anytime interaction with Local-networked Services + is requested, giving the user full ability to cancel or abort the transaction. The user selects the + Local-networked Services to be connected to the current Web page, and can cancel these at any time. No + invocations to these APIs occur silently without user intervention. </li> </ul> </section> - <section class="informative appendix" id="examples"> - <!--OddPage--><h2><span class="secno">A. </span> - Examples - </h2><p><em>This section is non-normative.</em></p> + <section class="informative appendix" + id="examples"> + <h2> + <span class="secno">A.</span> Examples + </h2> + <p> + <em>This section is non-normative.</em> + </p> <div class="example"> <p> This sample code exposes a button. When clicked, this button is disabled and the user is prompted to offer a @@ -1919,63 +2547,148 @@ Server</a>. </p> <hr> - <pre class="highlight prettyprint"><span class="tag"><input</span><span class="pln"> </span><span class="atn">type</span><span class="pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">value</span><span class="pun">=</span><span class="atv">"Start"</span><span class="pln"> </span><span class="atn">onclick</span><span class="pun">=</span><span class="atv">"</span><span class="pln">start</span><span class="pun">()</span><span class="atv">"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"startBtn"</span><span class="tag">/></span><span class="pln"> -</span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"debugconsole"</span><span class="tag">></div></span><span class="pln"> + <pre class="highlight prettyprint"> +<span class="tag"><input</span><span class="pln"> </span><span class="atn">type</span><span class= +"pun">=</span><span class="atv">"button"</span><span class="pln"> </span><span class="atn">value</span><span class= +"pun">=</span><span class="atv">"Start"</span><span class="pln"> </span><span class="atn">onclick</span><span class= +"pun">=</span><span class="atv">"</span><span class="pln">start</span><span class="pun">()</span><span class= +"atv">"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class= +"atv">"startBtn"</span><span class="tag">/></span><span class="pln"> +</span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class= +"pun">=</span><span class="atv">"debugconsole"</span><span class="tag">></div></span><span class="pln"> </span><span class="tag"><script></span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> startBtn </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">'startBtn'</span><span class="pun">),</span><span class="pln"> - debug </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">'debugconsole'</span><span class="pun">);</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> startBtn </span><span class="pun">=</span><span class= +"pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class= +"pun">(</span><span class="str">'startBtn'</span><span class="pun">),</span><span class="pln"> + debug </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class= +"pln">getElementById</span><span class="pun">(</span><span class="str">'debugconsole'</span><span class= +"pun">);</span><span class="pln"> - </span><span class="kwd">function</span><span class="pln"> start</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">(</span><span class="str">'zeroconf:_xbmc-jsonrpc._tcp'</span><span class="pun">,</span><span class="pln"> gotXBMCService</span><span class="pun">,</span><span class="pln"> error</span><span class="pun">);</span><span class="pln"> - startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> - </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>Service Discovery not supported!"</span><span class="pun">;</span><span class="pln"> + </span><span class="kwd">function</span><span class="pln"> start</span><span class="pun">()</span><span class= +"pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class= +"pun">.</span><span class="pln">getNetworkServices</span><span class="pun">)</span><span class= +"pln"> </span><span class="pun">{</span><span class="pln"> + navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class= +"pun">(</span><span class="str">'zeroconf:_xbmc-jsonrpc._tcp'</span><span class="pun">,</span><span class= +"pln"> gotXBMCService</span><span class="pun">,</span><span class="pln"> error</span><span class= +"pun">);</span><span class="pln"> + startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class= +"pln"> </span><span class="kwd">true</span><span class="pun">;</span><span class="pln"> + </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class= +"pln"> </span><span class="pun">{</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>Service Discovery not supported!"</span><span class= +"pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> - </span><span class="kwd">function</span><span class="pln"> gotXBMCService</span><span class="pun">(</span><span class="pln">services</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">function</span><span class="pln"> gotXBMCService</span><span class="pun">(</span><span class= +"pln">services</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="com">// Listen for service disconnect messages</span><span class="pln"> - services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'serviceoffline'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" disconnected."</span><span class="pun">;</span><span class="pln"> - startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln"> - </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class= +"pln">addEventListener</span><span class="pun">(</span><span class="str">'serviceoffline'</span><span class= +"pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class= +"pun">(</span><span class="pln"> e </span><span class="pun">)</span><span class="pln"> </span><span class= +"pun">{</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class= +"pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class= +"pln">name </span><span class="pun">+</span><span class="pln"> </span><span class= +"str">" disconnected."</span><span class="pun">;</span><span class="pln"> + startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class= +"pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class= +"pun">);</span><span class="pln"> -</span><span class="com">// Send a service message to get albums list (and process the service response)</span><span class="pln"> +</span><span class= +"com">// Send a service message to get albums list (and process the service response)</span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class="pun">();</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">url </span><span class="pun">+</span><span class="pln"> </span><span class="str">"/getAlbums"</span><span class="pun">);</span><span class="pln"> </span><span class="com">// services[0].url and its sub-resources have been</span><span class="pln"> - </span><span class="com">// whitelisted for cross-site XHR use in this</span><span class="pln"> - </span><span class="com">// current browsing context.</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class= +"pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class= +"pun">();</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class= +"str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class= +"lit">0</span><span class="pun">].</span><span class="pln">url </span><span class="pun">+</span><span class= +"pln"> </span><span class="str">"/getAlbums"</span><span class="pun">);</span><span class="pln"> </span><span class= +"com">// services[0].url and its sub-resources have been</span><span class="pln"> + </span><span class= +"com">// whitelisted for cross-site XHR use in this</span><span class="pln"> + </span><span class= +"com">// current browsing context.</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'application/json-rpc'</span><span class="pun">);</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class= +"pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">'application/json-rpc'</span><span class="pun">);</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'readystatechange'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">200</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">addEventListener</span><span class= +"pun">(</span><span class="str">'readystatechange'</span><span class="pun">,</span><span class= +"pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class= +"pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class= +"pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class= +"lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class= +"pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class= +"lit">200</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="kwd">return</span><span class="pun">;</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" response received: "</span><span class="pun">;</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> JSON</span><span class="pun">.</span><span class="pln">parse</span><span class="pun">(</span><span class="pln">response</span><span class="pun">.</span><span class="pln">responseText</span><span class="pun">);</span><span class="pln"> - </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class= +"pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class= +"pln">name </span><span class="pun">+</span><span class="pln"> </span><span class= +"str">" response received: "</span><span class="pun">;</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class= +"pln"> JSON</span><span class="pun">.</span><span class="pln">parse</span><span class="pun">(</span><span class= +"pln">response</span><span class="pun">.</span><span class="pln">responseText</span><span class= +"pun">);</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class= +"pun">);</span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> - </span><span class="pun">{</span><span class="pln"> </span><span class="str">"jsonrpc"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"2.0"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"method"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"AudioLibrary.GetAlbums"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"params"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> </span><span class="str">"genreid"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> - </span><span class="str">"artistid"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"start"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"end"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="str">"id"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class= +"pln"> </span><span class="pun">[</span><span class="pln"> + </span><span class="pun">{</span><span class="pln"> </span><span class="str">"jsonrpc"</span><span class= +"pun">:</span><span class="pln"> </span><span class="str">"2.0"</span><span class="pun">,</span><span class= +"pln"> </span><span class="str">"method"</span><span class="pun">:</span><span class="pln"> </span><span class= +"str">"AudioLibrary.GetAlbums"</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">"params"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">{</span><span class= +"pln"> </span><span class="str">"genreid"</span><span class="pun">:</span><span class="pln"> </span><span class= +"pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> + </span><span class="str">"artistid"</span><span class="pun">:</span><span class="pln"> </span><span class= +"pun">-</span><span class="lit">1</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">"start"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">-</span><span class= +"lit">1</span><span class="pun">,</span><span class="pln"> </span><span class="str">"end"</span><span class= +"pun">:</span><span class="pln"> </span><span class="pun">-</span><span class="lit">1</span><span class= +"pln"> </span><span class="pun">},</span><span class="pln"> </span><span class="str">"id"</span><span class= +"pun">:</span><span class="pln"> </span><span class="str">"1"</span><span class="pln"> </span><span class= +"pun">}</span><span class="pln"> </span><span class="pun">];</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">));</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" request sent: "</span><span class="pun">;</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">);</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class= +"pln">JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class= +"pln">svcMsg</span><span class="pun">));</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class= +"pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class= +"pln">name </span><span class="pun">+</span><span class="pln"> </span><span class= +"str">" request sent: "</span><span class="pun">;</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class= +"pln"> JSON</span><span class="pun">.</span><span class="pln">stringify</span><span class="pun">(</span><span class= +"pln">svcMsg</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> - </span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class="pln"> err </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>An error occurred obtaining a local network service."</span><span class="pun">;</span><span class="pln"> - startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln"> + </span><span class="kwd">function</span><span class="pln"> error</span><span class="pun">(</span><span class= +"pln"> err </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>An error occurred obtaining a local network service."</span><span class= +"pun">;</span><span class="pln"> + startBtn</span><span class="pun">.</span><span class="pln">disabled </span><span class="pun">=</span><span class= +"pln"> </span><span class="kwd">false</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> -</span><span class="tag"></script></span></pre> +</span><span class="tag"></script></span> +</pre> </div> <div class="example"> <p> @@ -1990,113 +2703,267 @@ format supported by the device. </p> <hr> - <pre class="highlight prettyprint"><span class="tag"><select</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"make"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"make"</span><span class="tag">></span><span class="pln"> - </span><span class="tag"><option</span><span class="pln"> </span><span class="atn">selected</span><span class="pun">=</span><span class="atv">"selected"</span><span class="pln"> </span><span class="atn">disabled</span><span class="pun">=</span><span class="atv">"disabled"</span><span class="tag">></span><span class="pln">Select make</span><span class="tag"></option></span><span class="pln"> - </span><span class="tag"><option></span><span class="pln">Sony</span><span class="tag"></option></span><span class="pln"> - </span><span class="tag"><option></span><span class="pln">Philips</span><span class="tag"></option></span><span class="pln"> - </span><span class="tag"><option></span><span class="pln">Alba</span><span class="tag"></option></span><span class="pln"> + <pre class="highlight prettyprint"> +<span class="tag"><select</span><span class="pln"> </span><span class="atn">name</span><span class= +"pun">=</span><span class="atv">"make"</span><span class="pln"> </span><span class="atn">id</span><span class= +"pun">=</span><span class="atv">"make"</span><span class="tag">></span><span class="pln"> + </span><span class="tag"><option</span><span class="pln"> </span><span class="atn">selected</span><span class= +"pun">=</span><span class="atv">"selected"</span><span class="pln"> </span><span class= +"atn">disabled</span><span class="pun">=</span><span class="atv">"disabled"</span><span class= +"tag">></span><span class="pln">Select make</span><span class="tag"></option></span><span class="pln"> + </span><span class="tag"><option></span><span class="pln">Sony</span><span class= +"tag"></option></span><span class="pln"> + </span><span class="tag"><option></span><span class="pln">Philips</span><span class= +"tag"></option></span><span class="pln"> + </span><span class="tag"><option></span><span class="pln">Alba</span><span class= +"tag"></option></span><span class="pln"> </span><span class="tag"></select></span><span class="pln"> -</span><span class="tag"><select</span><span class="pln"> </span><span class="atn">name</span><span class="pun">=</span><span class="atv">"model"</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"model"</span><span class="tag">></select></span><span class="pln"> -</span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class="pun">=</span><span class="atv">"debugconsole"</span><span class="tag">></div></span><span class="pln"> +</span><span class="tag"><select</span><span class="pln"> </span><span class="atn">name</span><span class= +"pun">=</span><span class="atv">"model"</span><span class="pln"> </span><span class="atn">id</span><span class= +"pun">=</span><span class="atv">"model"</span><span class="tag">></select></span><span class="pln"> +</span><span class="tag"><div</span><span class="pln"> </span><span class="atn">id</span><span class= +"pun">=</span><span class="atv">"debugconsole"</span><span class="tag">></div></span><span class="pln"> </span><span class="tag"><script></span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> debug </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">'debugconsole'</span><span class="pun">);</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> debug </span><span class="pun">=</span><span class= +"pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class= +"pun">(</span><span class="str">'debugconsole'</span><span class="pun">);</span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> models </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - </span><span class="str">"Sony"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> - </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Bravia TV S1000"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> - </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"Bravia TV S2000"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"zeroconf"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"_mediarenderer._http._tcp"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> - </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"HiFi WD10"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> models </span><span class="pun">=</span><span class= +"pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="str">"Sony"</span><span class="pun">:</span><span class="pln"> </span><span class= +"pun">[</span><span class="pln"> + </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class= +"pln"> </span><span class="str">"Bravia TV S1000"</span><span class="pun">,</span><span class= +"pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class= +"str">"upnp"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class= +"pun">:</span><span class="pln"> </span><span class= +"str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pln"> </span><span class= +"pun">},</span><span class="pln"> + </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class= +"pln"> </span><span class="str">"Bravia TV S2000"</span><span class="pun">,</span><span class= +"pln"> </span><span class="str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class= +"str">"zeroconf"</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">"service"</span><span class="pun">:</span><span class="pln"> </span><span class= +"str">"_mediarenderer._http._tcp"</span><span class="pln"> </span><span class="pun">},</span><span class="pln"> + </span><span class="pun">{</span><span class="str">"name"</span><span class="pun">:</span><span class= +"pln"> </span><span class="str">"HiFi WD10"</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">"type"</span><span class="pun">:</span><span class="pln"> </span><span class="str">"upnp"</span><span class= +"pun">,</span><span class="pln"> </span><span class="str">"service"</span><span class="pun">:</span><span class= +"pln"> </span><span class="str">"urn:schemas-upnp-org:service:RenderingControl:1"</span><span class= +"pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="pun">],</span><span class="pln"> - </span><span class="str">"Philips"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class="pun">],</span><span class="pln"> - </span><span class="str">"Alba"</span><span class="pun">:</span><span class="pln"> </span><span class="pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class="pun">]</span><span class="pln"> + </span><span class="str">"Philips"</span><span class="pun">:</span><span class="pln"> </span><span class= +"pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class= +"pun">],</span><span class="pln"> + </span><span class="str">"Alba"</span><span class="pun">:</span><span class="pln"> </span><span class= +"pun">[</span><span class="pln"> </span><span class="com">/* ... */</span><span class="pln"> </span><span class= +"pun">]</span><span class="pln"> </span><span class="pun">};</span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> makeEl </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">"make"</span><span class="pun">),</span><span class="pln"> - modelEl </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class="pun">(</span><span class="str">"model"</span><span class="pun">);</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> makeEl </span><span class="pun">=</span><span class= +"pln"> document</span><span class="pun">.</span><span class="pln">getElementById</span><span class= +"pun">(</span><span class="str">"make"</span><span class="pun">),</span><span class="pln"> + modelEl </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class= +"pln">getElementById</span><span class="pun">(</span><span class="str">"model"</span><span class= +"pun">);</span><span class="pln"> - makeEl</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - modelEl</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">=</span><span class="pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"> </span><span class="com">// reset</span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> defaultOption </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln"> - defaultOption</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> </span><span class="str">"Select model"</span><span class="pun">;</span><span class="pln"> - defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"disabled"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"disabled"</span><span class="pun">);</span><span class="pln"> - defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"selected"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"selected"</span><span class="pun">);</span><span class="pln"> - modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">defaultOption</span><span class="pun">);</span><span class="pln"> - </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class="pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class="pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">].</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class="pun"><</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class="pun">++)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> option </span><span class="pun">=</span><span class="pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class="pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln"> - option</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"name"</span><span class="pun">];</span><span class="pln"> - option</span><span class="pun">.</span><span class="pln">setAttribute</span><span class="pun">(</span><span class="str">"value"</span><span class="pun">,</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"type"</span><span class="pun">]</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class="str">":"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"service"</span><span class="pun">]);</span><span class="pln"> - modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class="pln">option</span><span class="pun">);</span><span class="pln"> + makeEl</span><span class="pun">.</span><span class="pln">addEventListener</span><span class= +"pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class= +"kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + modelEl</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">=</span><span class= +"pln"> </span><span class="str">""</span><span class="pun">;</span><span class="pln"> </span><span class= +"com">// reset</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> defaultOption </span><span class="pun">=</span><span class= +"pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class= +"pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln"> + defaultOption</span><span class="pun">.</span><span class="pln">textContent </span><span class= +"pun">=</span><span class="pln"> </span><span class="str">"Select model"</span><span class="pun">;</span><span class= +"pln"> + defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class= +"pun">(</span><span class="str">"disabled"</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">"disabled"</span><span class="pun">);</span><span class="pln"> + defaultOption</span><span class="pun">.</span><span class="pln">setAttribute</span><span class= +"pun">(</span><span class="str">"selected"</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">"selected"</span><span class="pun">);</span><span class="pln"> + modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class="pun">(</span><span class= +"pln">defaultOption</span><span class="pun">);</span><span class="pln"> + </span><span class="kwd">for</span><span class="pun">(</span><span class="kwd">var</span><span class= +"pln"> i </span><span class="pun">=</span><span class="pln"> </span><span class="lit">0</span><span class= +"pun">,</span><span class="pln"> l </span><span class="pun">=</span><span class="pln"> models</span><span class= +"pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class= +"pun">].</span><span class="pln">length</span><span class="pun">;</span><span class="pln"> i </span><span class= +"pun"><</span><span class="pln"> l</span><span class="pun">;</span><span class="pln"> i</span><span class= +"pun">++)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> option </span><span class="pun">=</span><span class= +"pln"> document</span><span class="pun">.</span><span class="pln">createElement</span><span class= +"pun">(</span><span class="str">"option"</span><span class="pun">);</span><span class="pln"> + option</span><span class="pun">.</span><span class="pln">textContent </span><span class= +"pun">=</span><span class="pln"> models</span><span class="pun">[</span><span class="pln">makeEl</span><span class= +"pun">.</span><span class="pln">value</span><span class="pun">][</span><span class="pln">i</span><span class= +"pun">][</span><span class="str">"name"</span><span class="pun">];</span><span class="pln"> + option</span><span class="pun">.</span><span class="pln">setAttribute</span><span class= +"pun">(</span><span class="str">"value"</span><span class="pun">,</span><span class="pln"> models</span><span class= +"pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class= +"pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"type"</span><span class= +"pun">]</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> </span><span class= +"str">":"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> models</span><span class= +"pun">[</span><span class="pln">makeEl</span><span class="pun">.</span><span class="pln">value</span><span class= +"pun">][</span><span class="pln">i</span><span class="pun">][</span><span class="str">"service"</span><span class= +"pun">]);</span><span class="pln"> + modelEl</span><span class="pun">.</span><span class="pln">appendChild</span><span class= +"pun">(</span><span class="pln">option</span><span class="pun">);</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> - </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class= +"pun">);</span><span class="pln"> - modelEl</span><span class="pun">.</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class="pun">.</span><span class="pln">getNetworkServices </span><span class="pun">&&</span><span class="pln"> - modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class="pln"> </span><span class="str">"upnp:urn:schemas-upnp-org:service:RenderingControl:1"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class="pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value</span><span class="pun">,</span><span class="pln"> successCallback</span><span class="pun">,</span><span class="pln"> errorCallback</span><span class="pun">);</span><span class="pln"> - </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class="pln"> </span><span class="str">"zeroconf:_mediarenderer._http._tcp"</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>Service type is not implemented by this application."</span><span class="pun">;</span><span class="pln"> - </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>Service Discovery is not supported!"</span><span class="pun">;</span><span class="pln"> + modelEl</span><span class="pun">.</span><span class="pln">addEventListener</span><span class= +"pun">(</span><span class="str">'change'</span><span class="pun">,</span><span class="pln"> </span><span class= +"kwd">function</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">if</span><span class="pun">(</span><span class="pln">navigator</span><span class= +"pun">.</span><span class="pln">getNetworkServices </span><span class="pun">&&</span><span class="pln"> + modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class= +"pln"> </span><span class="str">"upnp:urn:schemas-upnp-org:service:RenderingControl:1"</span><span class= +"pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + navigator</span><span class="pun">.</span><span class="pln">getNetworkServices</span><span class= +"pun">(</span><span class="pln">modelEl</span><span class="pun">.</span><span class="pln">value</span><span class= +"pun">,</span><span class="pln"> successCallback</span><span class="pun">,</span><span class= +"pln"> errorCallback</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class= +"pln"> </span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class= +"pln">modelEl</span><span class="pun">.</span><span class="pln">value </span><span class="pun">==</span><span class= +"pln"> </span><span class="str">"zeroconf:_mediarenderer._http._tcp"</span><span class="pun">)</span><span class= +"pln"> </span><span class="pun">{</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>Service type is not implemented by this application."</span><span class= +"pun">;</span><span class="pln"> + </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">else</span><span class= +"pln"> </span><span class="pun">{</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>Service Discovery is not supported!"</span><span class= +"pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> - </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class= +"pun">);</span><span class="pln"> </span><span class="tag"></script></span><span class="pln"> </span><span class="tag"><script></span><span class="pln"> - </span><span class="kwd">function</span><span class="pln"> successCallback</span><span class="pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + </span><span class="kwd">function</span><span class="pln"> successCallback</span><span class= +"pun">(</span><span class="pln"> services </span><span class="pun">)</span><span class="pln"> </span><span class= +"pun">{</span><span class="pln"> </span><span class="com">// Listen for service push notification messages</span><span class="pln"> - services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">addEventListener</span><span class="pun">(</span><span class="str">'notify'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> msg </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" event received: "</span><span class="pun">;</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> msg</span><span class="pun">.</span><span class="pln">data</span><span class="pun">;</span><span class="pln"> - </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class="pun">);</span><span class="pln"> + services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class= +"pln">addEventListener</span><span class="pun">(</span><span class="str">'notify'</span><span class= +"pun">,</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class= +"pun">(</span><span class="pln"> msg </span><span class="pun">)</span><span class="pln"> </span><span class= +"pun">{</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class= +"pun">+=</span><span class="pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class= +"pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class= +"pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class= +"str">" event received: "</span><span class="pun">;</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">textContent </span><span class= +"pun">+=</span><span class="pln"> msg</span><span class="pun">.</span><span class="pln">data</span><span class= +"pun">;</span><span class="pln"> + </span><span class="pun">},</span><span class="pln"> </span><span class="kwd">false</span><span class= +"pun">);</span><span class="pln"> </span><span class="com">// Send a control signal to mute the service audio</span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class="pun">();</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class="str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">url</span><span class="pun">);</span><span class="pln"> </span><span class="com">// services[0].url and its</span><span class="pln"> - </span><span class="com">// sub-resources have been whitelisted for</span><span class="pln"> - </span><span class="com">// cross-site XHR use in this current</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> svcXhr </span><span class="pun">=</span><span class= +"pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">XMLHttpRequest</span><span class= +"pun">();</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">open</span><span class="pun">(</span><span class= +"str">"POST"</span><span class="pun">,</span><span class="pln"> services</span><span class="pun">[</span><span class= +"lit">0</span><span class="pun">].</span><span class="pln">url</span><span class="pun">);</span><span class= +"pln"> </span><span class="com">// services[0].url and its</span><span class="pln"> + </span><span class= +"com">// sub-resources have been whitelisted for</span><span class="pln"> + </span><span class= +"com">// cross-site XHR use in this current</span><span class="pln"> </span><span class="com">// browsing context.</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'SOAPAction'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'urn:schemas-upnp-org:service:RenderingControl:1#SetMute'</span><span class="pun">);</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class="pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class="str">'text/xml; charset="utf-8";'</span><span class="pun">);</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class= +"pun">(</span><span class="str">'SOAPAction'</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">'urn:schemas-upnp-org:service:RenderingControl:1#SetMute'</span><span class="pun">);</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">setRequestHeader</span><span class= +"pun">(</span><span class="str">'Content-Type'</span><span class="pun">,</span><span class="pln"> </span><span class= +"str">'text/xml; charset="utf-8";'</span><span class="pun">);</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">onreadystatechange </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class="pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class="lit">200</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">onreadystatechange </span><span class= +"pun">=</span><span class="pln"> </span><span class="kwd">function</span><span class="pln"> </span><span class= +"pun">(</span><span class="pln"> response </span><span class="pun">)</span><span class="pln"> </span><span class= +"pun">{</span><span class="pln"> + </span><span class="kwd">if</span><span class="pun">(</span><span class="pln"> response</span><span class= +"pun">.</span><span class="pln">readyState </span><span class="pun">!=</span><span class="pln"> </span><span class= +"lit">4</span><span class="pln"> </span><span class="pun">||</span><span class="pln"> response</span><span class= +"pun">.</span><span class="pln">status </span><span class="pun">!=</span><span class="pln"> </span><span class= +"lit">200</span><span class="pln"> </span><span class="pun">)</span><span class="pln"> </span><span class="kwd">return</span><span class="pun">;</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" response received: "</span><span class="pun">;</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> response</span><span class="pun">.</span><span class="pln">responseXML</span><span class="pun">;</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class= +"pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class= +"pln">name </span><span class="pun">+</span><span class="pln"> </span><span class= +"str">" response received: "</span><span class="pun">;</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">textContent </span><span class= +"pun">+=</span><span class="pln"> response</span><span class="pun">.</span><span class= +"pln">responseXML</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> </span><span class="com">// Service messaging to mute the provided service</span><span class="pln"> - </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class="pln"> </span><span class="str">'<?xml version="1.0" encoding="utf-8"?>'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'<s:Body>'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'<u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1">'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'<InstanceID>0</InstanceID>'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'<Channel>Master</Channel>'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'<DesiredMute>true</DesiredMute>'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'</u:SetMute>'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> - </span><span class="str">'</s:Body>'</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class="kwd">var</span><span class="pln"> svcMsg </span><span class="pun">=</span><span class= +"pln"> </span><span class="str">'<?xml version="1.0" encoding="utf-8"?>'</span><span class= +"pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class= +"str">'<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" '</span><span class= +"pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class= +"str">'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">'</span><span class="pln"> </span><span class= +"pun">+</span><span class="pln"> + </span><span class="str">'<s:Body>'</span><span class="pln"> </span><span class= +"pun">+</span><span class="pln"> + </span><span class= +"str">'<u:SetMute xmlns:u="urn:schemas-upnp-org:service:RenderingControl:1">'</span><span class= +"pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class="str">'<InstanceID>0</InstanceID>'</span><span class= +"pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class="str">'<Channel>Master</Channel>'</span><span class= +"pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class="str">'<DesiredMute>true</DesiredMute>'</span><span class= +"pln"> </span><span class="pun">+</span><span class="pln"> + </span><span class="str">'</u:SetMute>'</span><span class="pln"> </span><span class= +"pun">+</span><span class="pln"> + </span><span class="str">'</s:Body>'</span><span class="pln"> </span><span class= +"pun">+</span><span class="pln"> </span><span class="str">'</s:Envelope>'</span><span class="pun">;</span><span class="pln"> - svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class="pln">svcMsg</span><span class="pun">);</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class="pln">name </span><span class="pun">+</span><span class="pln"> </span><span class="str">" request sent: "</span><span class="pun">;</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class="pln"> svcMsg</span><span class="pun">;</span><span class="pln"> + svcXhr</span><span class="pun">.</span><span class="pln">send</span><span class="pun">(</span><span class= +"pln">svcMsg</span><span class="pun">);</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>"</span><span class="pln"> </span><span class="pun">+</span><span class= +"pln"> services</span><span class="pun">[</span><span class="lit">0</span><span class="pun">].</span><span class= +"pln">name </span><span class="pun">+</span><span class="pln"> </span><span class= +"str">" request sent: "</span><span class="pun">;</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">textContent </span><span class="pun">+=</span><span class= +"pln"> svcMsg</span><span class="pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> - </span><span class="kwd">function</span><span class="pln"> errorCallback</span><span class="pun">(</span><span class="pln"> error </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> - debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class="pln"> </span><span class="str">"<br>An error occurred: "</span><span class="pln"> </span><span class="pun">+</span><span class="pln"> error</span><span class="pun">.</span><span class="pln">code</span><span class="pun">;</span><span class="pln"> + </span><span class="kwd">function</span><span class="pln"> errorCallback</span><span class="pun">(</span><span class= +"pln"> error </span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln"> + debug</span><span class="pun">.</span><span class="pln">innerHTML </span><span class="pun">+=</span><span class= +"pln"> </span><span class="str">"<br>An error occurred: "</span><span class="pln"> </span><span class= +"pun">+</span><span class="pln"> error</span><span class="pun">.</span><span class="pln">code</span><span class= +"pun">;</span><span class="pln"> </span><span class="pun">}</span><span class="pln"> -</span><span class="tag"></script></span></pre> +</span><span class="tag"></script></span> +</pre> </div> </section> <section id="acknowledgements"> - <!--OddPage--><h2><span class="secno">B. </span> - Acknowledgements + <h2> + <span class="secno">B.</span> Acknowledgements </h2> <p> Thanks are expressed by the editor to the following individuals for their feedback on this specification to @@ -2109,16 +2976,79 @@ Thanks are also expressed by the editor to the following organizations and groups for their support in producing this specification to date (in alphabetical order):<br> <br> - 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. + 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. </p> </section> - - -<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> -</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> -</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Robin Berjon; et al. <a href="http://www.w3.org/TR/html5/"><cite>HTML5.</cite></a> 17 December 2012. W3C Candidate Recommendation. (Work in progress.) URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a> -</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> -</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> -</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> -</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> -</dd></dl></section></section></body></html> \ No newline at end of file + <section id="references" + class="appendix"> + <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> + </dd> + <dt id="bib-DOM4"> + [DOM4] + </dt> + <dd> + Anne van Kesteren; Aryeh Gregor; Lachlan Hunt; Ms2ger. <a href= + "http://www.w3.org/TR/2012/WD-dom-20121206"><cite>DOM4</cite></a>. 6 December 2012. W3C Working Draft. URL: + <a href="http://www.w3.org/TR/2012/WD-dom-20121206">http://www.w3.org/TR/2012/WD-dom-20121206</a> + </dd> + <dt id="bib-HTML5"> + [HTML5] + </dt> + <dd> + Robin Berjon et al. <a href="http://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. 17 December 2012. W3C + Candidate Recommendation. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a> + </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> + </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> + </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> + </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. URL: <a href= + "http://www.w3.org/TR/2011/WD-WebIDL-20110927/">http://www.w3.org/TR/2011/WD-WebIDL-20110927/</a> + </dd> + </dl> + </section> + </section> + </body> +</html> diff -r 1dd6a0a5cbc5 -r d3c0dcc5d055 discovery-api/Overview.src.html --- a/discovery-api/Overview.src.html Wed Feb 06 09:02:26 2013 -0500 +++ b/discovery-api/Overview.src.html Wed Feb 06 09:03:57 2013 -0500 @@ -124,8 +124,8 @@ <p> Using this <abbr title="Application Programming Interface">API</abbr> consists of requesting a well-known service type, known by developers and advertised by Local-networked Devices. User authorization, where the user - connects the web page to discovered services, is expected before the web page is able to interact - with any Local-networked Services. + connects the web page to discovered services, is expected before the web page is able to interact with any + Local-networked Services. </p> <p> A web page creates a request to obtain connectivity to services running in the network by specifying a @@ -271,17 +271,15 @@ </p> <p> A <dfn>valid service type</dfn> is any of the following: - <ul> - <li> - a string that begins with <code>upnp:</code> or <code>zeroconf:</code> - followed by one or more characters in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, - U+0030 to U+0039, U+0041 to U+005A, U+005E to U+007E. - </li> - <li> - a string that begins with <code>dial:</code> followed by an integer version. - </li> - </ul> </p> + <ul> + <li>a string that begins with <code>upnp:</code> or <code>zeroconf:</code> followed by one or more characters + in the ranges U+0021, U+0023 to U+0027, U+002A to U+002B, U+002D to U+002E, U+0030 to U+0039, U+0041 to U+005A, + U+005E to U+007E. + </li> + <li>a string that begins with <code>dial:</code> followed by an integer version. + </li> + </ul> <p> A <a>valid service type</a> provided in the <code>type</code> attribute of the <a href= "#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a> method will be matched against the @@ -344,8 +342,8 @@ </dt> <dd> <p> - Prompts the user to select discovered network services that have advertised support for the - requested service type. + Prompts the user to select discovered network services that have advertised support for the requested + service type. </p> <p> The <var title="">type</var> argument contains one or more <a>valid service type</a> tokens that the web @@ -427,21 +425,31 @@ "#dom-navigatornetworkserviceerror-permission_denied"><code>PERMISSION_DENIED_ERR</code></a>) as its argument, abort any remaining steps and return. </li> - <li>If <var>services found</var> is not an empty array then the <a>user agent</a> MUST prompt the user in a - user-agent-specific manner for permission to provide - the <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" - class="externalDFN">entry script</a>'s <a href= - "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" - class="externalDFN">origin</a> with an array of <a href= - "#networkservice"><code>NetworkService</code></a> objects representing the <a>user-authorized</a> subset - of <var>services found</var>. + <li>The user agent MUST NOT provide the entry script's origin with a <a href= + "#networkservices"><code>NetworkServices</code></a> object without prior permission given by the user. <p> - If the user grants permission to access one or more networked services then the <a>user agent</a> - SHOULD include an "ongoing local-network communication" indicator. + If <var>services found</var> is not an empty array then the <a>user agent</a> MAY choose to prompt the + user in a user-agent-specific manner for permission to provide the <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/browsers.html#entry-script" + class="externalDFN">entry script</a>'s <a href= + "http://www.whatwg.org/specs/web-apps/current-work/complete/origin-0.html#origin" + class="externalDFN">origin</a> with a <a href="#networkservices"><code>NetworkServices</code></a> + object representing the <a>user-authorized</a> subset of <var>services found</var>. </p> <p> - If the user denies permission, then the <a>user agent</a> MUST <a href= - "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" + Alternatively, the user agent MAY choose to queue a task to invoke <var>successCallback</var> or + <var>errorCallback</var> immediately based on a previously-established user preference, for security + reasons, or due to platform limitations. In such an implementation, if <var>successCallback</var> is to + be fired as a result of a previously-established user preference then the <a>user agent</a> MUST + continue at the next step of this algorithm. + </p> + <p> + If permission has been granted by the user to access one or more networked services then the <a>user + agent</a> SHOULD include an "ongoing local-network communication" indicator. + </p> + <p> + If permission has been denied by the user, <a>user agent</a> or platform, then the <a>user agent</a> + MUST <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to invoke <var>errorCallback</var>, if it is provided and is an object of type <code>Function</code>, with a new <a href= "#navigatornetworkserviceerror"><code>NavigatorNetworkServiceError</code></a> object whose <a href= @@ -451,15 +459,21 @@ argument, abort any remaining steps and return. </p> <p> - If the user never responds, this algorithm stalls on this step. + If the user never responds or no previously-established user preference has been met, this algorithm + stalls on this step. </p> </li> <li>Let <var>services</var> be an empty array. </li> - <li> - 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 - current objects <dfn>user-authorized</dfn> services. + <li>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 current objects <dfn>user-authorized</dfn> services. + </li> + <li>Remove all previously whitelisted urls from the <a>entry script origin's URL whitelist</a> granted in + 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>. </li> <li>For each Object <var>service</var> in <var>services</var>, if any, run the following sub-steps: <ol class="rule"> @@ -475,14 +489,16 @@ <li>Let <var>services manager</var> be a new <a href="#networkservices"><code>NetworkServices</code></a> object. </li> + <li>Store <var>requested control types</var> against <var>services manager</var> as an internal variable. + </li> <li>Set <var>services manager</var>'s <a href= "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute to the number of items currently found in the <a>list of available service records</a> whose <code>type</code> property matches any of the tokens requested in <var>requested control types</var>. </li> - <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of <a>indexed - properties</a>. If <var>services</var> is an empty array then the <var>services manager</var> does not have any - <var>indexed properties</var>. + <li>Add <var>services</var>, if any, to the <var>services manager</var> object as its collection of + <a>indexed properties</a>. If <var>services</var> is an empty array then the <var>services manager</var> + does not have any <var>indexed properties</var>. </li> <li>Set <var>services manager</var>'s <a href="#dom-networkservices-length"><code>length</code></a> attribute to the number of items in <var>services</var>. @@ -515,15 +531,14 @@ Web Messaging, XMLHttpRequest). </p> <p> - If the user navigates away from 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> then the <a>user agent</a> <em class= - "ct">MUST</em> remove all previously whitelisted urls from the <a>entry script origin's URL whitelist</a>. - There is no persistence to network service selections provided to a web page. It is not possible to access - a previously white-listed networked service without the necessary user authorization in all of the - following cases: + If the user navigates away from 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> then the <a>user agent</a> <em class="ct">MUST</em> remove all previously + whitelisted urls from the <a>entry script origin's URL whitelist</a>. There is no persistence to network + service selections provided to a web page. It is not possible to access a previously white-listed + networked service without the necessary user authorization in all of the following cases: </p> <ul> <li>If the current script is reloaded at any point in the same or different window. @@ -589,14 +604,13 @@ Obtaining networked services </h2> <p> - The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero - or more <dfn>indexed properties</dfn> that are - each a <a>user-authorized</a> <a href="#networkservice"><code>NetworkService</code></a> object. + The <a href="#networkservices"><code>NetworkServices</code></a> interface represents a collection of zero or + more <dfn>indexed properties</dfn> that are each a <a>user-authorized</a> <a href= + "#networkservice"><code>NetworkService</code></a> object. </p> <p> A <a href="#networkservices"><code>NetworkServices</code></a> object is the top level success callback - parameter from a call to - <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>. + parameter from a call to <a href="#dom-navigator-getnetworkservices"><code>getNetworkServices()</code></a>. </p> <pre class="widl"> [NoInterfaceObject] @@ -686,11 +700,11 @@ </dd> </dl> <p> - A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of zero - or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a>indexed properties</a>. A <a href= - "#networkservices"><code>NetworkServices</code></a> object is <span>immutable</span> meaning that - <a>indexed properties</a> cannot be added and <a>indexed properties</a> cannot be removed for the lifetime of - a <a href="#networkservices"><code>NetworkServices</code></a> object. + A <a href="#networkservices"><code>NetworkServices</code></a> object represents the current collection of + zero or more <a href="#networkservice"><code>NetworkService</code></a> objects - its <a>indexed + properties</a>. A <a href="#networkservices"><code>NetworkServices</code></a> object is + <span>immutable</span> meaning that <a>indexed properties</a> cannot be added and <a>indexed properties</a> + cannot be removed for the lifetime of a <a href="#networkservices"><code>NetworkServices</code></a> object. </p> <p class="note"> Each service in a <a href="#networkservices"><code>NetworkServices</code></a> object thus has an index; the @@ -965,18 +979,19 @@ </h2> <p> A <a>user agent</a> conforming to this specification MAY implement <abbr title= - "Simple Service Discovery Protocol">SSDP</abbr> [[!UPNP-DEVICEARCH11]], Zeroconf [[!DNS-SD]] + [[!MDNS]] or - <abbr title="Discovery and Launch Protocol">DIAL</abbr> [<a href = "https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification">DIAL</a>] - <dfn>service discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to - enable Web pages to request and connect with HTTP services running on networked devices, discovered via either - mechanism, through this API. When a <a>user agent</a> implements either of these <a>service discovery + "Simple Service Discovery Protocol">SSDP</abbr> [[!UPNP-DEVICEARCH11]], Zeroconf [[!DNS-SD]] + [[!MDNS]] and/or + <abbr title="Discovery and Launch Protocol">DIAL</abbr> [<a href= + "https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification">DIAL</a>] <dfn>service + discovery mechanisms</dfn> - the requirements detailed in this section of the specification - to enable Web + pages to request and connect with HTTP services running on networked devices, discovered via any of these + mechanisms, through this API. When a <a>user agent</a> implements any of these <a>service discovery mechanisms</a>, then it MUST conform to the corresponding algorithms provided in this section of the specification. </p> <p> - This section presents how the results of these two <a>service discovery mechanisms</a> will be matched to - requested service types, how the user agent stores available and active services and how their properties are - applied to any resulting <a href="#networkservice"><code>NetworkService</code></a> objects. + This section presents how the results of these <a>service discovery mechanisms</a> will be matched to requested + service types, how the user agent stores available and active services and how their properties are applied to + any resulting <a href="#networkservice"><code>NetworkService</code></a> objects. </p> <p> It is expected that user agents will perform these <a>service discovery mechanisms</a> asynchronously and @@ -987,16 +1002,15 @@ <p> The <dfn>list of available service records</dfn> is a single dynamic internal lookup table within user agents that is used to track all the services that have been discovered and are available in the current network at - any given time. At any point during the running of either of the two <a>service discovery mechanisms</a> then + the current time. At any point during the running of either of the two <a>service discovery mechanisms</a> then existing entries within this table can be updated, entries can be added and entries can be removed as the status of networked services changes according to the rules defined in this specification. </p> <p> The <dfn>list of active service managers</dfn> is an internal list within user agents that is used to track all <a href="#networkservices"><code>NetworkServices</code></a> objects currently being shared with any web pages - at the current time within the user agent. Each <a href="#networkservices"><code>NetworkServices</code></a> object - in the <a>list of - active service managers</a> represents a collection of zero or more <a href= + at the current time within the user agent. Each <a href="#networkservices"><code>NetworkServices</code></a> + object in the <a>list of active service managers</a> represents a collection of zero or more <a href= "#networkservice"><code>NetworkService</code></a> objects - known as its <dfn>indexed properties</dfn>. <a href="#networkservice"><code>NetworkService</code></a> objects are attached as the <a>indexed properties</a> of a <a href="#networkservices"><code>NetworkServices</code></a> object as part of the <a href= @@ -1004,13 +1018,11 @@ </p> <p> The rule for <dfn>adding an available service</dfn> is the process of adding a new service or updating an - existing service in the <a>list of available service records</a> that is generally available on the user's - current network. This rule takes one argument, <var>network service record</var>, and consists of running the + existing service that is generally available on the user's current network in the <a>list of available service + records</a>. This rule takes one argument, <var>network service record</var>, and consists of running the following steps: </p> <ol class="rule"> - <li>Let <var>new service registration flag</var> be <code>true</code>. - </li> <li>For each <var>existing service record</var> in the current <a>list of available service records</a>, run the following sub-steps: <ol class="rule"> @@ -1018,32 +1030,20 @@ service record</var>'s <code>id</code> property then abort any remaining sub-steps and continue at the next available <var>existing service record</var>. </li> - <li>Set <var>new service registration flag</var> to <code>false</code>. - </li> <li>Replace the value of <var>existing service record</var> in the current <a>list of available service - records</a> with the value of <var>network service record</var>. + records</a> with the value of <var>network service record</var>, aborting any remaining steps in this + algorithm and return. </li> </ol> </li> - <li>If <var>new service registration flag</var> is set to <code>true</code> then add <var>network service - record</var> to the <a>list of available service records</a> as a new item. + <li>Add <var>network service record</var> to the <a>list of available service records</a> as a new item. </li> <li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following steps: <ol class="rule"> - <li>Let <var>service type in current service manager flag</var> be <code>false</code>. - </li> <li>For each <var>active service</var> in <var>service manager</var> run the following steps: <ol class="rule"> - <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>active - service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this <var>active - service</var> and continue at the next available <var>active service</var>. - </li> - <li>Set the <var>service type in current service manager flag</var> to <code>true</code>. - </li> - <li>If the <var>new service registration flag</var> is set to <code>false</code>, the <var>network - service record</var>'s <code>id</code> property equals the <var>active service</var>'s <code>id</code> - attribute and <var>active service</var>'s <a href="#dom-networkservice-online"><code>online</code></a> - attribute is currently set to <code>false</code> then set <var>active service</var>'s <a href= + <li>If the <var>network service record</var>'s <code>id</code> property equals the <var>active + service</var>'s <code>id</code> attribute 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= @@ -1054,11 +1054,24 @@ </li> </ol> </li> - <li>If the <var>new service registration flag</var> is set to <code>true</code> and the <var>service type - in current service manager flag</var> is also set to <code>true</code> then increment <var>service - manager</var>'s <a href="#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> - attribute by <code>1</code> and then <a href= - "http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" + <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>. + </li> + <li>For each <var>requested control type</var> of the <var>requested control types</var> in <var>service + manager</var> run the following steps: + <ol class="rule"> + <li>If <var>network service record</var>'s <code>type</code> property does not equal <var>requested + control type</var> then abort any remaining sub-steps and continue at the next available <var>requested + control type</var>. + </li> + <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code>, abort any + remaining sub-steps and continue. + </li> + </ol> + </li> + <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then + increment <var>service manager</var>'s <a href= + "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and + then <a href="http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#queue-a-task" class="externalDFN">queue a task</a> to dispatch a newly created event with the name <a href= "#event-serviceavailable"><code>serviceavailable</code></a> that uses the <a href= "http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#event" @@ -1081,25 +1094,15 @@ identifier</var> then skip any remaining sub-steps for the current <var>existing service record</var> and continue at the next available <var>existing service record</var>. </li> - <li>If the <var>existing service record</var>'s <code>type</code> property begins with the DOMString - "<code>upnp:</code>" and <var>existing service record</var>'s <code>eventsURL</code> property is set then - run the rule to <a>terminate an existing UPnP Events Subscription</a>, if one is currently active (as a - result of having previously called <a>setup a UPnP Events Subscription</a> against the current - <var>existing service record</var>). + <li>Let <var>'service type in use' flag</var> be <code>false</code>. </li> <li>For each <var>service manager</var> in the <a>list of active service managers</a> run the following steps: <ol class="rule"> - <li>Let <var>service type in current service manager flag</var> be <code>false</code>. + <li>Let <var>'service type in current service manager' flag</var> be <code>false</code>. </li> <li>For each <var>active service</var> in <var>service manager</var> run the following steps: <ol class="rule"> - <li>If <var>existing service record</var>'s <code>type</code> property does not equal the - <var>active service</var>'s <code>type</code> attribute then abort any remaining sub-steps for this - <var>active service</var> and continue at the next available <var>active service</var>. - </li> - <li>Set the <var>service type in current service manager flag</var> to <code>true</code>. - </li> <li>If <var>existing service record</var>'s <code>id</code> property equals the <var>active service</var>'s <code>id</code> attribute and <var>active service</var>'s <a href= "#dom-networkservice-online"><code>online</code></a> attribute is currently set to @@ -1114,7 +1117,20 @@ </li> </ol> </li> - <li>If the <var>service type in current service manager flag</var> is set to <code>true</code> then + <li>For each <var>requested control type</var> of the <var>requested control types</var> in + <var>service manager</var> run the following steps: + <ol class="rule"> + <li>If <var>existing service record</var>'s <code>type</code> property does not equal + <var>requested control type</var> then abort any remaining sub-steps and continue at the next + available <var>requested control type</var>. + </li> + <li>Set the <var>'service type in current service manager' flag</var> to <code>true</code> and the + <var>'service type in use' flag</var> to <code>true</code>, abort any remaining sub-steps and + continue. + </li> + </ol> + </li> + <li>If the <var>'service type in current service manager' flag</var> is set to <code>true</code> then decrement <var>service manager</var>'s <a href= "#dom-networkservices-servicesavailable"><code>servicesAvailable</code></a> attribute by <code>1</code> and then <a href= @@ -1127,6 +1143,12 @@ </li> </ol> </li> + <li>If the <var>'service type in use' flag</var> is <code>false</code> and the <var>existing service + record</var>'s <code>type</code> property begins with the DOMString "<code>upnp:</code>" and <var>existing + service record</var>'s <code>eventsURL</code> property is set then run the rule to <a>terminate an existing + UPnP Events Subscription</a>, if one is currently active (as a result of having previously called <a>setup + a UPnP Events Subscription</a> against the current <var>existing service record</var>). + </li> <li>Remove <var>existing service record</var> from the current <a>list of available service records</a>. </li> </ol> @@ -1199,10 +1221,11 @@ <p> The user agent MUST issue all <a title="search request for UPnP root devices">search requests for UPnP root devices</a> with a HTTP request line equal to <code>M-SEARCH * HTTP/1.1</code>, with a HOST header equal to - the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to - <code>ssdp:discover</code>, an ST header equal to <code>upnp:rootdevice</code> and a user-agent defined MX - header equal to a <dfn>maximum UPnP advertisement response wait time</dfn> value between <code>1</code> and - <code>5</code> seconds. + the reserved multicast address and port of <code>239.255.255.250:1900</code> and a MAN header equal to + <code>ssdp:discover</code>. The <a>user agent</a> must also send an ST header with this HTTP request equal to + the String value of <code>ssdp:all</code> or <code>upnp:rootdevice</code> or a single <a>valid service + type</a> token. The user-agent MUST also send an MX header equal to a <dfn>maximum UPnP advertisement + response wait time</dfn> value between <code>1</code> and <code>5</code> seconds with this HTTP request. </p> <p> The user agent MUST listen for any incoming responses to any <a>search request for UPnP root devices</a>. @@ -1228,9 +1251,9 @@ header's value. </li> <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one - <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the - value of its <var>ST</var> entry is not <code>upnp:rootdevice</code>, then the <a>HTTP Response</a> is - invalid and the <a>user agent</a> MUST discard this response, abort any remaining steps and return. + <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry then the + <a>HTTP Response</a> is invalid and the <a>user agent</a> MUST discard this response, abort any remaining + steps and return. </li> <li>The user agent MUST run the rule for <a>obtaining a UPnP Device Description File</a> passing in the first occurrence of <var>LOCATION</var> from <var>ssdp device</var> as the <var>device descriptor URL</var> @@ -1254,11 +1277,10 @@ <li>Let <var>ssdp device</var> be an Object with a property for each HTTP header received in the <a>HTTP Request</a>, with each key being the name of a HTTP header and each value being that HTTP header's value. </li> - <li>If <var>ssdp device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one - <var>USN</var> entry, at least one <var>NT</var> entry, at least one <var>NTS</var> entry and at least one - <var>LOCATION</var> entry or the value of its <var>NT</var> entry is not <code>upnp:rootdevice</code>, then - the <a>HTTP Request</a> is a malformed UPnP Request and the <a>user agent</a> MUST discard this request, - abort any remaining steps and return. + <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> and the <a>HTTP + Request</a> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, + at least one <var>NT</var> entry, at least one <var>NTS</var> entry and at least one <var>LOCATION</var> + entry, then the <a>user agent</a> MUST discard this request, abort any remaining steps and return. </li> <li>If <var>ssdp device</var>'s <var>NTS</var> entry is equal to <code>ssdp:alive</code> then the user agent MUST run the rule for <a>obtaining a UPnP Device Description File</a> passing in the first occurrence of @@ -1470,43 +1492,42 @@ <h5> Discovery and Launch Protocol (<abbr title="Discovery and Launch Protocol">DIAL</abbr>) </h5> - <p> + <p> A user agent that implements DIAL service discovery MUST issue a <dfn>search request for DIAL-enabled devices</dfn> against the user's current local network according to the full normative text and timing provided in 'Section 1.3.2: Search request with M-SEARCH' detailed in [[!UPNP-DEVICEARCH11]]. </p> <p> - Let <var>dial version</var> be the version number specified in the <a>valid service type</a> token. - Let <var>dial search target</var> be the concatentation of the + Let <var>dial version</var> be the version number specified in the <a>valid service type</a> token. Let + <var>dial search target</var> be the concatentation of the <code>urn:dial-multiscreen-org:service:dial:</code> string constant with the <var>dial version</var> (currently, <var>dial version</var> can only be <code>1</code>) </p> <p> - The user agent MUST issue all <a title="search request for DIAL devices">search requests for DIAL - devices</a> with a HTTP request line equal to <code>M-SEARCH * HTTP/1.1</code>, with a HOST header equal to - the reserved multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to - <code>ssdp:discover</code>, an ST header equal to <var>dial search target</var> - and a user-agent defined MX header equal to a <dfn>maximum DIAL advertisement response wait time</dfn> - value between <code>1</code> and <code>5</code> seconds. + The user agent MUST issue all <a title="search request for DIAL devices">search requests for DIAL devices</a> + with a HTTP request line equal to <code>M-SEARCH * HTTP/1.1</code>, with a HOST header equal to the reserved + multicast address and port of <code>239.255.255.250:1900</code>, a MAN header equal to + <code>ssdp:discover</code>, an ST header equal to <var>dial search target</var> and a user-agent defined MX + header equal to a <dfn>maximum DIAL advertisement response wait time</dfn> value between <code>1</code> and + <code>5</code> seconds. </p> <p> The user agent MUST listen for any incoming responses to a <a>search request for DIAL devices</a>. </p> <p> - For each HTTP Response following an initial <a>search request for DIAL devices</a> sent on a - <a>standard UPnP address and port</a> the user agent MUST run the following steps: + For each HTTP Response following an initial <a>search request for DIAL devices</a> sent on a <a>standard UPnP + address and port</a> the user agent MUST run the following steps: </p> <ol class="rule"> - <li>If the HTTP Response is not a HTTP 200 OK response then this response is invalid and the user - agent MUST discard this response, abort any remaining steps and return. The user agent MAY issue a new - <a>search request for DIAL devices</a> as a result of this error occurring. + <li>If the HTTP Response is not a HTTP 200 OK response then this response is invalid and the user agent MUST + discard this response, abort any remaining steps and return. The user agent MAY issue a new <a>search request + for DIAL devices</a> as a result of this error occurring. </li> <li>If the <a>maximum DIAL advertisement response wait time</a> has been exceeded since the initial <a>search request for DIAL devices</a> was sent then the <a>HTTP Response</a> is invalid and the user agent MUST discard this response, abort any remaining steps and return. The user agent MAY stop listening for responses - from the current <a>search request for DIAL devices</a> as a result of this error occurring. Equally, - the user agent MAY issue a new <a>search request for DIAL devices</a> as a result of this error - occurring. + from the current <a>search request for DIAL devices</a> as a result of this error occurring. Equally, the + user agent MAY issue a new <a>search request for DIAL devices</a> as a result of this error occurring. </li> <li>Let <var>dial device</var> be an Object with a property for each HTTP header received in the <a>HTTP Response</a>, with each key being the name of a HTTP response header and each value being that HTTP response @@ -1514,9 +1535,8 @@ </li> <li>If <var>dial device</var> does not contain at least one <var>CACHE-CONTROL</var> entry, at least one <var>USN</var> entry, at least one <var>ST</var> entry and at least one <var>LOCATION</var> entry or the - value of its <var>ST</var> entry is not <var>dial search target</var>, then the - <a>HTTP Response</a> is invalid and the <a>user agent</a> MUST discard this response, abort any remaining - steps and return. + value of its <var>ST</var> entry is not <var>dial search target</var>, then the <a>HTTP Response</a> is + invalid and the <a>user agent</a> MUST discard this response, abort any remaining steps and return. </li> <li>The user agent MUST run the rule for <a>obtaining a UPnP Device Description File</a> passing in the first occurrence of <var>LOCATION</var> from <var>dial device</var> as the <var>device descriptor URL</var> @@ -1537,12 +1557,12 @@ description using HTTP' in [[!UPNP-DEVICEARCH11]]. </li> <li>Let <var>application url</var> be the value of the first occurrence of the <code>Application-URL</code> - response header field obtained according to the rules defined in 'Section 5.4: Device Description Response' in - [<a href = "https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification">DIAL</a>] + response header field obtained according to the rules defined in 'Section 5.4: Device Description Response' + in [<a href="https://sites.google.com/a/dial-multiscreen.org/dial/dial-protocol-specification">DIAL</a>] </li> <li>If the value provided in <var>device descriptor URL</var> cannot be resolved as a reachable URL on the - current network or the <var>device descriptor file</var> remains empty or <var>application url</var> is undefined - then it is invalid and the <a>user agent</a> MUST abort any remaining steps and return. + current network or the <var>device descriptor file</var> remains empty or <var>application url</var> is + undefined then it is invalid and the <a>user agent</a> MUST abort any remaining steps and return. </li> <li>Run the following steps to add the newly discovered DIAL service: <ol class="rule"> @@ -1562,8 +1582,8 @@ </li> <li>Set <var>network service record</var>'s <code>type</code> property to <var>dial search target</var>. </li> - <li>Set <var>network service record</var>'s <code>url</code> property to the string value of the <var> - application url</var>. + <li>Set <var>network service record</var>'s <code>url</code> property to the string value of the + <var>application url</var>. </li> <li>Set <var>network service record</var>'s <code>expiryTimestamp</code> property to the value of the current date, in UTC timestamp format, plus the value of <var>device expiry</var>. @@ -1581,10 +1601,11 @@ </h3> <div> <p> - When the <a>user agent</a> detects that the user has dropped from their connected network then, for each - <var>existing service record</var> in the <a>list of available service records</a>, the user agent MUST run - the general rule for <a>removing an available service</a> passing in each <var>existing service - record</var>'s <code>id</code> property as the only argument for each call. + When the <a>user agent</a> detects that the user has dropped from a connected network then, for each + <var>existing service record</var> in the <a>list of available service records</a> discovered via that + network connection, the <a>user agent</a> MUST run the general rule for <a>removing an available + service</a> passing in each <var>existing service record</var>'s <code>id</code> property as the only + argument for each call. </p> <p> When the <a>user agent</a> detects that the user has connected to a new network or reconnected to an @@ -1689,12 +1710,11 @@ </h3> <p> A user agent MUST only garbage collect a <a><code>NetworkServices</code></a> object and remove its entry from - the <a>list of active service managers</a> when the user has navigated away from the - <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 - the current <a><code>NetworkServices</code></a> object was provided. + the <a>list of active service managers</a> when the user has navigated away from 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> in which the current <a><code>NetworkServices</code></a> object was provided. </p> <p> A user agent MUST NOT garbage collect individual <a><code>NetworkService</code></a> objects until their parent diff -r 1dd6a0a5cbc5 -r d3c0dcc5d055 light/Overview.html --- a/light/Overview.html Wed Feb 06 09:02:26 2013 -0500 +++ b/light/Overview.html Wed Feb 06 09:03:57 2013 -0500 @@ -1,5 +1,6 @@ <!DOCTYPE html> -<html lang="en" dir="ltr"><head> +<html lang="en" dir="ltr"> +<head> <title>Ambient Light Events</title> <meta charset="utf-8"> @@ -363,7 +364,7 @@ border-collapse: collapse; width: 100%; } -</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"></head> +</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head> <body><div class="head"> <p> @@ -372,17 +373,17 @@ </p> <h1 class="title" id="title">Ambient Light Events</h1> - <h2 id="w3c-editor-s-draft-30-january-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 30 January 2013</h2> + <h2 id="w3c-editor-s-draft-06-february-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 06 February 2013</h2> <dl> <dt>This version:</dt> - <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/tip/light/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/light/Overview.html</a></dd> + <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/default/light/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/default/light/Overview.html</a></dd> <dt>Latest published version:</dt> <dd><a href="http://www.w3.org/TR/ambient-light/">http://www.w3.org/TR/ambient-light/</a></dd> <dt>Latest editor's draft:</dt> - <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/tip/light/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/light/Overview.html</a></dd> + <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/default/light/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/default/light/Overview.html</a></dd> @@ -409,7 +410,7 @@ <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, - <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. + <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. @@ -435,7 +436,7 @@ <p> The functionality described in this specification was initially specified as part of the - <a href="http://dvcs.w3.org/hg/dap/raw-file/tip/sensor-api/Overview.html"> + <a href="http://dvcs.w3.org/hg/dap/raw-file/default/sensor-api/Overview.html"> Sensor API</a> but has been extracted in order to be more straightforward to implement, and in order to produce a specification that could be implemented on its own merits without interference with @@ -794,7 +795,7 @@ </section> -<section id="references" class="appendix"><!--OddPage--><h2><span class="secno">B. </span>References</h2><section id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><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> -</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Robin Berjon et al. <a href="http://www.w3.org/TR/html5/"><cite>HTML5.</cite></a> 17 December 2012. W3C Candidate Recommendation. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a> +<section id="references" class="appendix"><!--OddPage--><h2><span class="secno">B. </span>References</h2><section id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Lachlan Hunt; Ms2ger. <a href="http://www.w3.org/TR/2012/WD-dom-20121206"><cite>DOM4</cite></a>. 6 December 2012. W3C Working Draft. URL: <a href="http://www.w3.org/TR/2012/WD-dom-20121206">http://www.w3.org/TR/2012/WD-dom-20121206</a> +</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Robin Berjon et al. <a href="http://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. 17 December 2012. W3C Candidate Recommendation. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a> </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> </dd></dl></section></section></body></html> \ No newline at end of file diff -r 1dd6a0a5cbc5 -r d3c0dcc5d055 light/Overview.src.html --- a/light/Overview.src.html Wed Feb 06 09:02:26 2013 -0500 +++ b/light/Overview.src.html Wed Feb 06 09:03:57 2013 -0500 @@ -11,7 +11,7 @@ //publishDate: "2012-12-13", previousPublishDate: "2012-12-13", previousMaturity: "LC", - edDraftURI: "http://dvcs.w3.org/hg/dap/raw-file/tip/light/Overview.html", + edDraftURI: "http://dvcs.w3.org/hg/dap/raw-file/default/light/Overview.html", lcEnd: "2013-01-26", editors: [ { name: "Doug Turner", company: "Mozilla Corporation", companyURL: "http://mozilla.com/" }, @@ -24,6 +24,7 @@ wgURI: "http://www.w3.org/2009/dap/", wgPublicList: "public-device-apis", wgPatentURI: "http://www.w3.org/2004/01/pp-impl/43696/status", + scheme: "https" }; </script> </head> @@ -37,7 +38,7 @@ <p> The functionality described in this specification was initially specified as part of the - <a href="http://dvcs.w3.org/hg/dap/raw-file/tip/sensor-api/Overview.html"> + <a href="http://dvcs.w3.org/hg/dap/raw-file/default/sensor-api/Overview.html"> Sensor API</a> but has been extracted in order to be more straightforward to implement, and in order to produce a specification that could be implemented on its own merits without interference with diff -r 1dd6a0a5cbc5 -r d3c0dcc5d055 proximity/Overview.html --- a/proximity/Overview.html Wed Feb 06 09:02:26 2013 -0500 +++ b/proximity/Overview.html Wed Feb 06 09:03:57 2013 -0500 @@ -1,5 +1,6 @@ <!DOCTYPE html> -<html lang="en" dir="ltr"><head> +<html lang="en" dir="ltr"> +<head> <title>Proximity Events</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> @@ -363,7 +364,7 @@ border-collapse: collapse; width: 100%; } -</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"></head> +</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/W3C-ED"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head> <body><div class="head"> <p> @@ -372,17 +373,17 @@ </p> <h1 class="title" id="title">Proximity Events</h1> - <h2 id="w3c-editor-s-draft-30-january-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 30 January 2013</h2> + <h2 id="w3c-editor-s-draft-06-february-2013"><abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft 06 February 2013</h2> <dl> <dt>This version:</dt> - <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html</a></dd> + <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/default/proximity/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/default/proximity/Overview.html</a></dd> <dt>Latest published version:</dt> <dd><a href="http://www.w3.org/TR/proximity/">http://www.w3.org/TR/proximity/</a></dd> <dt>Latest editor's draft:</dt> - <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html</a></dd> + <dd><a href="http://dvcs.w3.org/hg/dap/raw-file/default/proximity/Overview.html">http://dvcs.w3.org/hg/dap/raw-file/default/proximity/Overview.html</a></dd> <dt>Test suite:</dt> @@ -412,7 +413,7 @@ <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, - <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. + <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>), All Rights Reserved. <abbr title="World Wide Web Consortium">W3C</abbr> <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. @@ -438,7 +439,7 @@ <p> The functionality described in this specification was initially specified as part of the - <a href="http://dvcs.w3.org/hg/dap/raw-file/tip/sensor-api/Overview.html"> + <a href="http://dvcs.w3.org/hg/dap/raw-file/default/sensor-api/Overview.html"> Sensor API</a> but has been extracted in order to be more straightforward to implement, and in order to produce a specification that could be implemented on its own merits without interference with @@ -811,7 +812,7 @@ </section> -<section id="references" class="appendix"><!--OddPage--><h2><span class="secno">B. </span>References</h2><section id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><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> -</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Robin Berjon et al. <a href="http://www.w3.org/TR/html5/"><cite>HTML5.</cite></a> 17 December 2012. W3C Candidate Recommendation. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a> +<section id="references" class="appendix"><!--OddPage--><h2><span class="secno">B. </span>References</h2><section id="normative-references"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-DOM4">[DOM4]</dt><dd>Anne van Kesteren; Aryeh Gregor; Lachlan Hunt; Ms2ger. <a href="http://www.w3.org/TR/2012/WD-dom-20121206"><cite>DOM4</cite></a>. 6 December 2012. W3C Working Draft. URL: <a href="http://www.w3.org/TR/2012/WD-dom-20121206">http://www.w3.org/TR/2012/WD-dom-20121206</a> +</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Robin Berjon et al. <a href="http://www.w3.org/TR/html5/"><cite>HTML5</cite></a>. 17 December 2012. W3C Candidate Recommendation. URL: <a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a> </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> </dd></dl></section></section></body></html> \ No newline at end of file diff -r 1dd6a0a5cbc5 -r d3c0dcc5d055 proximity/Overview.src.html --- a/proximity/Overview.src.html Wed Feb 06 09:02:26 2013 -0500 +++ b/proximity/Overview.src.html Wed Feb 06 09:03:57 2013 -0500 @@ -11,7 +11,7 @@ //publishDate: "2012-12-06", previousPublishDate: "2012-07-12", previousMaturity: "WD", - edDraftURI: "http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html", + edDraftURI: "http://dvcs.w3.org/hg/dap/raw-file/default/proximity/Overview.html", //lcEnd: "yyyy-mm-dd", editors: [ { name: "Anssi Kostiainen", company: "Nokia", companyURL: "http://nokia.com/" }, @@ -26,7 +26,8 @@ wgURI: "http://www.w3.org/2009/dap/", wgPublicList: "public-device-apis", wgPatentURI: "http://www.w3.org/2004/01/pp-impl/43696/status", - testSuiteURI: "http://w3c-test.org/dap/proximity/tests/" + testSuiteURI: "http://w3c-test.org/dap/proximity/tests/", + scheme: "https" }; </script> </head> @@ -40,7 +41,7 @@ <p> The functionality described in this specification was initially specified as part of the - <a href="http://dvcs.w3.org/hg/dap/raw-file/tip/sensor-api/Overview.html"> + <a href="http://dvcs.w3.org/hg/dap/raw-file/default/sensor-api/Overview.html"> Sensor API</a> but has been extracted in order to be more straightforward to implement, and in order to produce a specification that could be implemented on its own merits without interference with
Received on Wednesday, 6 February 2013 14:04:23 UTC