diff --git a/index.html b/index.html index 236ae10..d497abe 100644 --- a/index.html +++ b/index.html @@ -286,17 +286,16 @@

Launching a Web App with Handling

- This specification amends the existing algorithm to - launch a web - application to include the behavior of [=manifest/launch_handler=] + This specification replaces the existing algorithm to [=launch a web + application=] to include the behavior of [=manifest/launch_handler=] by replacing it with the steps to [=launch a web app with handling=].

- The steps to launch a web app with handling are given by - the following algorithm. The algorithm takes a - processed manifest - |manifest:processed manifest|, an optional [=URL=] or - {{LaunchParams}} |params| and an optional POST resource |POST resource|. + The steps to launch a web app with handling + are given by the following algorithm. The algorithm takes a + [=Document/processed manifest=] |manifest:processed manifest|, an + optional [=URL=] or {{LaunchParams}} |params|, an optional [=POST + resource=] |POST resource| and returns an [=application context=].

  1. If |params| is null, set |params| to @@ -305,18 +304,22 @@

  2. If |params| is a [=URL=], set |params| to a new {{LaunchParams}} with {{LaunchParams/targetURL}} set to |params|.
  3. -
  4. Set |client| to the result of running the steps to - [=prepare a web app launch client=] passing |manifest|, |params| +
  5. Assert: |params|.{{LaunchParams/targetURL}} is [=manifest/within + scope=] of |manifest|. +
  6. +
  7. Set |application context| to the result of running the steps to + [=prepare an application context=] passing |manifest|, |params| and |POST resource|.
  8. Append |params| to the [=unconsumed launch params=] of the - |client|'s document's {{Window/launchQueue}}. + |application context|'s document's {{Window/launchQueue}}.
  9. Run the steps to [=process unconsumed launch params=] on the - |client|'s document's {{Window/launchQueue}}. + |application context|'s [=navigable/active document=]'s + {{Window/launchQueue}}.

    - |client| may be an existing [=web app launch client=] with - an [=assigned launch consumer=] hence it is necessary to process + |application context| may be an existing instance with an + [=assigned launch consumer=] hence it is necessary to process the newly appended {{LaunchParams}}.

  10. @@ -324,24 +327,14 @@

    - Preparing a [=Web App Launch Client=] + Preparing an [=application context=]

    - A web app launch client is a - [=top-level browsing context=] associated with the web app. -

    -

    - The exact form of this association is up to the user agent e.g. a - dedicated app window separate UI presentation from general hyperlink - browsing. -

    -

    - To prepare a web app launch client given a - processed - manifest |manifest|, a {{LaunchParams}} - |launch params:LaunchParams| and an optional - POST resource |POST resource|, - run the following steps: + The steps to prepare an application context are given by + the following algorithm. The algorithm takes a + [=Document/processed manifest=] |manifest:processed manifest|, a + {{LaunchParams}} |launch params|, an optional [=POST + resource=] |POST resource| and returns an [=application context=].

    1. Let [=client mode target=] |client_mode| be @@ -358,63 +351,43 @@

      [=client mode/navigate-new=]
        -
      1. Return the result of running the steps to [=prepare a new - web app launch client=] passing |manifest|, - |launch params| and |POST resource|. +
      2. Return the result of running the steps to [=create a new + application context=] passing |manifest|, |launch + params|.{{LaunchParams/targetURL}} and |POST resource|.
      [=client mode/navigate-existing=] or [=client mode/focus-existing=]
        -
      1. If there is no [=top-level browsing context=] for - the web app, return the result of running the steps to - [=prepare a new web app launch client=] passing |manifest| - |target URL|. +
      2. If there is no [=application context=] that has |manifest| + [=applied=], return the result of running the steps to + [=create a new application context=] passing |manifest|, + |launch params|.{{LaunchParams/targetURL}} and |POST + resource|. +
      3. +
      4. Let |application context| be an [=application context=] + that has |manifest| [=applied=], the user agent selects + the most appropriate one if there are multiple. +

        + An appropriate selection strategy would be to pick the + one that was most recently in focus. +

      5. -
      6. Let |client| be a [=top-level browsing context=] - for the web app, the exact selection algorithm is decided - by the user agent. +
      7. Bring |application context|'s viewport into focus.
      8. If |client mode| is [=client mode/navigate-existing=], - run the steps to navigate - |client| to |launch params|.{{LaunchParams/targetURL}} - passing |POST resource|. + [=navigate=] |application context| to |launch + params|.{{LaunchParams/targetURL}} passing |POST + resource|.
      9. -
      10. Return |client|. +
      11. Return |application context|.

    -
    -

    - Preparing a new [=Web App Launch Client=] -

    -

    - To prepare a new web app launch client given a - processed - manifest |manifest:processed manifest|, {{LaunchParams}} - |launch params:LaunchParams| and optional - POST resource |POST resource|, - run the following steps: -

    -
      -
    1. Let |traversable| be the result of - - creating a fresh top-level traversable passing - |launch params|.{{LaunchParams/targetURL}} and |POST resource|. -
    2. -
    3. Let |browsing context| be the |traversable|'s - active browsing context. -
    4. -
    5. [=Apply=] |manifest| to |browsing context|. -
    6. -
    7. Return |browsing context|. -
    8. -
    -

    Processing [=unconsumed launch params=]