Skip to content

Commit

Permalink
git squash commit for replace-launch-algorithm.
Browse files Browse the repository at this point in the history
a9ac7fc
Branch: replace-launch-algorithm

5e7a975
Clean up

7444e95
clean up variables

cd6973a
Add missing return
  • Loading branch information
alancutter committed Nov 7, 2022
1 parent 4e18f74 commit 1ad172a
Showing 1 changed file with 48 additions and 55 deletions.
103 changes: 48 additions & 55 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,56 +283,41 @@ <h2>
</h2>
<section>
<h2>
Launching a Web App
Launching a Web App with Handling
</h2>
<p>
When launching a web app via any means the trigger of the launch
should run the steps to [=launch a web app=] with a {{LaunchParams}}
containing relevant launch information (e.g. share data in the event
of a share target launch).
This specification amends the existing algorithm to
<a data-cite="appmanifest#dfn-launch-a-web-application">launch a web
application</a> to include the behavior of [=manifest/launch_handler=]
by replacing it with the steps to [=launch a web app with handling=].
</p>
<p class="note">
Examples of different web app launch triggers:
</p>
<ul class="note">
<!--
This should be part of the <p> above but class="note"s don't agree
with nested <ul>s and will kick them out of the note box.
-->
<li>OS application launch surfaces
</li>
<li><a href="https://wicg.github.io/manifest-incubations/index.html#protocol_handlers-member">Protocol handling</a>
</li>
<li><a href="https://wicg.github.io/manifest-incubations/index.html#file_handlers-member">File handling</a>
</li>
<li><a href="https://wicg.github.io/manifest-incubations/index.html#share_target-member">Share target</a>
</li>
<li>Link capturing
</li>
</ul>
<p>
The steps to <dfn>launch a web app</dfn> are given by the following
algorithm and takes an optional {{LaunchParams}}
|params:LaunchParams|.
The steps to <dfn>launch a web app with handling</dfn> are given by
the following algorithm. The algorithm takes a
<a data-cite="appmanifest#dfn-processed-manifest">processed manifest</a>
|manifest:processed manifest|, an optional [=URL=] or
{{LaunchParams}} |params| and an optional <a data-cite="html#post-resource">POST resource</a> |POST resource|.
</p>
<ol class="algorithm">
<li>If |params| is null, set |params| to a new {{LaunchParams}} with
{{LaunchParams/targetURL}} set to [=manifest/start_url=].
<li>If |params| is null, set |params| to
|manifest|.[=manifest/start_url=].
</li>
<li>If |params| is a [=URL=], set |params| to a new {{LaunchParams}}
with {{LaunchParams/targetURL}} set to |params|.
</li>
<li>Set |client| to the result of running the steps to
[=prepare a web app launch client=] passing the web app's
<a data-cite="appmanifest#dfn-processed-manifest">processed
manifest</a> and |params|.{{LaunchParams/targetURL}}.
[=prepare a web app launch client=] passing |manifest|, |params|
and |POST resource|.
</li>
<li>Append |params| to the [=unconsumed launch params=] of the
|client|'s document's {{Window/launchQueue}}.
</li>
<li>Run the steps to [=process unconsumed launch params=] on the
|client|'s document's {{Window/launchQueue}}.
<p class="note">
|client| may be an existing window client with an
[=assigned launch consumer=] hence it is necessary to process
the newly appended |params|.
|client| may be an existing [=web app launch client=] with
an [=assigned launch consumer=] hence it is necessary to process
the newly appended {{LaunchParams}}.
</p>
</li>
</ol>
Expand All @@ -353,17 +338,19 @@ <h2>
<p>
To <dfn>prepare a web app launch client</dfn> given a
<a data-cite="appmanifest#dfn-processed-manifest"> processed
manifest</a> |manifest| and |target URL: URL|, run the following
steps:
manifest</a> |manifest|, a {{LaunchParams}}
|launch params:LaunchParams| and an optional
<a data-cite="html#post-resource">POST resource</a> |POST resource|,
run the following steps:
</p>
<ol class="algorithm">
<li>Let [=client mode target=] |client_mode| be
|manifest|["launch_handler"]["client_mode"].
|manifest|.[=manifest/launch_handler=].[=manifest/client_mode=].
</li>
<li>If |client_mode| is [=client mode/auto=], set |client_mode| to either
[=client mode/navigate-new=] or [=client mode/navigate-existing=]
according to the user agent's decision for which is most
appropriate.
<li>If |client_mode| is [=client mode/auto=], set |client_mode| to
either [=client mode/navigate-new=] or
[=client mode/navigate-existing=] according to the user agent's
decision for which is most appropriate.
</li>
<li>
<p>Switching on |client mode|, run the following substeps:</p>
Expand All @@ -372,25 +359,27 @@ <h2>
<dd>
<ol class="algorithm">
<li>Return the result of running the steps to [=prepare a new
web app launch client=] passing |manifest| and
|target URL|.
web app launch client=] passing |manifest|,
|launch params| and |POST resource|.
</li>
</ol>
<dt>[=client mode/navigate-existing=] or
[=client mode/focus-existing=]</code>
<dd>
<ol class="algorithm">
<li>If there is no [=top-level browsing context=] for
the web app, return the result of the result of
the web app, return the result of running the steps to
[=prepare a new web app launch client=] passing |manifest|
and |target URL|.
|target URL|.
</li>
<li>Let |client| be a [=top-level browsing context=]
for the web app, the exact selection algorithm is decided
by the user agent.
</li>
<li>If |client mode| is [=client mode/navigate-existing=],
run the steps to [=navigate=] |client| to |target URL|.
run the steps to <a data-cite="html#navigate">navigate</a>
|client| to |launch params|.{{LaunchParams/targetURL}}
passing |POST resource|.
</li>
<li>Return |client|.
</li>
Expand All @@ -406,19 +395,23 @@ <h2>
<p>
To <dfn>prepare a new web app launch client</dfn> given a
<a data-cite="appmanifest#dfn-processed-manifest">processed
manifest</a> |manifest| and |target URL:URL|, run the following steps:
manifest</a> |manifest:processed manifest|, {{LaunchParams}}
|launch params:LaunchParams| and optional
<a data-cite="html#post-resource">POST resource</a> |POST resource|,
run the following steps:
</p>
<ol class="algorithm">
<li>Let |client| be the result of
<a href="https://html.spec.whatwg.org/multipage/browsers.html#creating-a-new-top-level-browsing-context">
creating a new top-level browsing context</a>.
<li>Let |traversable| be the result of
<a data-cite="html#create-a-fresh-top-level-traversable">
creating a fresh top-level traversable</a> passing
|launch params|.{{LaunchParams/targetURL}} and |POST resource|.
</li>
<li><a data-cite="appmanifest#dfn-applied">Apply</a> |manifest| to
|client|.
<li>Let |browsing context| be the |traversable|'s
<a data-cite="html#nav-bc">active browsing context</a>.
</li>
<li>Run the steps to [=navigate=] |client| passing |target URL|.
<li>[=Apply=] |manifest| to |browsing context|.
</li>
<li>Return |client|.
<li>Return |browsing context|.
</li>
</ol>
</section>
Expand Down

0 comments on commit 1ad172a

Please sign in to comment.