|
129 | 129 | } |
130 | 130 | </style> |
131 | 131 | </head> |
132 | | - <body data-cite="ENCODING"> |
| 132 | + <body data-cite="ENCODING SERVICE-WORKERS"> |
133 | 133 | <section id='abstract'> |
134 | 134 | <p> |
135 | 135 | This specification defines a JSON-based manifest file that provides |
|
222 | 222 | "orientation": "landscape", |
223 | 223 | "theme_color": "aliceblue", |
224 | 224 | "background_color": "red", |
225 | | - "serviceworker": { |
| 225 | + "serviceworker": |
226 | 226 | "src": "sw.js", |
227 | 227 | "scope": "/racer/", |
228 | 228 | "update_via_cache": "none" |
@@ -383,26 +383,14 @@ <h3> |
383 | 383 | following algorithm: |
384 | 384 | </p> |
385 | 385 | <ol> |
386 | | - <li>Let <var>manifest</var> and <var>manifest URL</var> be the values |
387 | | - that were created during <a>steps to determine installability of the |
388 | | - document</a>. |
| 386 | + <li>Let <var>manifest</var> be the manifest value created during <a> |
| 387 | + steps to determine installability of the document</a>. |
389 | 388 | </li> |
390 | | - <li>If <var>manifest URL</var> exists, and the result of running <a> |
391 | | - processing the `serviceworker` member</a> with <var>manifest</var> |
392 | | - returns a valid <var>registration</var>, the user agent MAY: |
393 | | - <ol> |
394 | | - <li>Let <var>client</var> be the <a>top-level browsing |
395 | | - context</a> {{Document}}'s <a>relevant settings object</a>, or |
396 | | - <code>null</code> if unavailable. |
397 | | - </li> |
398 | | - <li>Invoke <a>Start Register</a> with <var>scope</var> and <var> |
399 | | - src</var> members of the <var>registration</var>, a new |
400 | | - <var>promise</var>, <var>client</var>, <var>manifest URL</var>, |
401 | | - plus the <var>type</var> and <var>update_via_cache</var> |
402 | | - members of the <var>registration</var>. If the settled |
403 | | - <var>promise</var> is rejected, abort these steps. |
404 | | - </li> |
405 | | - </ol> |
| 389 | + <li>If |manifest|.{{WebAppManifest/serviceworker}} is not |
| 390 | + <code>undefined</code>, the user agent MAY run the <a>steps for |
| 391 | + registering a manifest's service worker</a> with |
| 392 | + |manifest|.{{WebAppManifest/serviceworker}}. If those steps return |
| 393 | + failure, abort these steps. |
406 | 394 | </li> |
407 | 395 | <li>Perform an unspecified sequence of actions to attempt to register |
408 | 396 | the web application in the user's operating system (e.g., create |
|
419 | 407 | context</a> for which the installation took place. |
420 | 408 | </li> |
421 | 409 | </ol> |
422 | | - <div class="issue" data-number="789"></div> |
423 | 410 | </section> |
424 | 411 | <section> |
425 | 412 | <!-- TODO(mgiuca): Move this section up above Installation process. (In |
@@ -2137,6 +2124,55 @@ <h3> |
2137 | 2124 | } |
2138 | 2125 | </pre> |
2139 | 2126 | </div> |
| 2127 | + <p> |
| 2128 | + The <dfn>steps for registering a manifest's service worker</dfn> are |
| 2129 | + given by the following algorithm, which takes a |
| 2130 | + {{ServiceWorkerRegistrationObject}} <var>registration</var> and |
| 2131 | + returns success or failure. |
| 2132 | + </p> |
| 2133 | + <ol> |
| 2134 | + <li>Let <var>serviceWorker</var> be the {{ServiceWorkerContainer}} |
| 2135 | + associated with the <a>top-level browsing context</a>. If there is |
| 2136 | + none, return failure. |
| 2137 | + </li> |
| 2138 | + <li>Let <var>options</var> be the result of running the <a>steps for |
| 2139 | + converting a service worker registration to an options dictionary</a> |
| 2140 | + on <var>registration</var>. |
| 2141 | + </li> |
| 2142 | + <li>Let <var>promise</var> be the result of invoking |
| 2143 | + |serviceWorker|.{{ServiceWorkerContainer/register()}} with arguments |
| 2144 | + |registration|.{{ServiceWorkerRegistrationObject/src}} and |
| 2145 | + <var>options</var>. |
| 2146 | + </li> |
| 2147 | + <li>Wait until <var>promise</var> settles. If the settled |
| 2148 | + <var>promise</var> is rejected, return failure. |
| 2149 | + </li> |
| 2150 | + <li>Return success. |
| 2151 | + </li> |
| 2152 | + </ol> |
| 2153 | + <p> |
| 2154 | + The <dfn>steps for converting a service worker registration to an |
| 2155 | + options dictionary</dfn> are given by the following algorithm. The |
| 2156 | + algorithm takes a {{ServiceWorkerRegistrationObject}} |
| 2157 | + <var>registration</var>, and returns a {{RegistrationOptions}} |
| 2158 | + dictionary which is suitable to pass to |
| 2159 | + {{ServiceWorkerContainer}}.{{ServiceWorkerContainer/register()}}. |
| 2160 | + </p> |
| 2161 | + <ol> |
| 2162 | + <li>Create a new {{RegistrationOptions}} <var>options</var>. |
| 2163 | + </li> |
| 2164 | + <li>Set |options|.{{RegistrationOptions/scope}} to |
| 2165 | + |registration|.{{ServiceWorkerRegistrationObject/scope}}. |
| 2166 | + </li> |
| 2167 | + <li>Set |options|.{{RegistrationOptions/type}} to |
| 2168 | + |registration|.{{ServiceWorkerRegistrationObject/type}}. |
| 2169 | + </li> |
| 2170 | + <li>Set |options|.{{RegistrationOptions/updateViaCache}} to |
| 2171 | + |registration|.{{ServiceWorkerRegistrationObject/update_via_cache}}. |
| 2172 | + </li> |
| 2173 | + <li>Return <var>options</var>. |
| 2174 | + </li> |
| 2175 | + </ol> |
2140 | 2176 | </section> |
2141 | 2177 | <section> |
2142 | 2178 | <h3> |
@@ -3236,7 +3272,8 @@ <h3> |
3236 | 3272 | </h3> |
3237 | 3273 | <p> |
3238 | 3274 | The <a>scope</a> member of a <a>ServiceWorkerRegistrationObject</a> |
3239 | | - dictionary is the service worker's associated <a>scope URL</a>. |
| 3275 | + dictionary is the service worker's associated <a data-cite= |
| 3276 | + "service-workers-1#dfn-scope-url">scope URL</a>. |
3240 | 3277 | </p> |
3241 | 3278 | <p> |
3242 | 3279 | The steps for <dfn>processing the <code>scope</code> member of a |
@@ -3276,7 +3313,7 @@ <h3> |
3276 | 3313 | <a>ServiceWorkerRegistrationObject</a> dictionary determines the |
3277 | 3314 | <a data-cite="service-workers-1#dfn-update-via-cache">update via |
3278 | 3315 | cache mode</a> for the service worker. The possible values are those |
3279 | | - of the <a>ServiceWorkerUpdateViaCache</a> enum defined in |
| 3316 | + of the {{ServiceWorkerUpdateViaCache}} enum defined in |
3280 | 3317 | [[SERVICE-WORKERS-1]]. |
3281 | 3318 | </p> |
3282 | 3319 | </section> |
@@ -3988,23 +4025,6 @@ <h3> |
3988 | 4025 | </li> |
3989 | 4026 | </ul> |
3990 | 4027 | </li> |
3991 | | - <li>[[SERVICE-WORKERS-1]] defines the following terms: |
3992 | | - <ul> |
3993 | | - <li> |
3994 | | - <a data-cite= |
3995 | | - "service-workers-1#start-register-algorithm"><dfn>Start |
3996 | | - Register</dfn></a> |
3997 | | - </li> |
3998 | | - <li> |
3999 | | - <a data-cite="service-workers-1#dfn-scope-url"><dfn>scope |
4000 | | - URL</dfn></a> |
4001 | | - </li> |
4002 | | - <li> |
4003 | | - <a data-cite= |
4004 | | - "service-workers-1#dfn-update-via-cache"><dfn>ServiceWorkerUpdateViaCache</dfn></a> |
4005 | | - </li> |
4006 | | - </ul> |
4007 | | - </li> |
4008 | 4028 | <li>[[ECMA-402]] defines the following terms: |
4009 | 4029 | <ul> |
4010 | 4030 | <li> |
@@ -4093,7 +4113,8 @@ <h3> |
4093 | 4113 | <ul> |
4094 | 4114 | <li> |
4095 | 4115 | <a data-cite= |
4096 | | - "ECMASCRIPT#sec-ecmascript-data-types-and-values"><dfn>Type</dfn>(<var>x</var>)</a> |
| 4116 | + "ECMASCRIPT#sec-ecmascript-data-types-and-values"><dfn data-dfn-for=""> |
| 4117 | + Type</dfn>(<var>x</var>)</a> |
4097 | 4118 | </li> |
4098 | 4119 | </ul> |
4099 | 4120 | </li> |
|
0 commit comments