Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite web app launch procedures in terms of the web-app-launch spec algorithm #63

Merged
merged 4 commits into from
Nov 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 11 additions & 123 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"dom",
"file-system-access",
"mimesniff",
"web-app-launch",
"window-controls-overlay"
],
profile: "web-platform",
Expand Down Expand Up @@ -281,11 +282,8 @@ <h3>
<li>If the type of |manifest|["note_taking"]["new_note_url"] is not
[=URL=], return.
</li>
<li>Let |browsing context:Browsing Context| be the result of creating
a new [=top-level browsing context=].
</li>
<li>[=Navigate=] |browsing context| to resource
|manifest|["note_taking"]["new_note_url"].
<li>Run the steps to [=launch a web app with handling=] passing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you pass with explicit parameter names?

"setting manifest to manifest and target URL to manifest[note_taking][new_note_url]".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

|manifest| and |manifest|["note_taking"]["new_note_url"].
</li>
</ol>
</section>
Expand Down Expand Up @@ -476,9 +474,10 @@ <h3>
When a <a>protocol handler description</a>
<var>protocol_handler</var> having [=manifest=] <var>manifest</var>
is invoked, it goes through the same steps used to [=invoke a
protocol handler=] defined in [=HTML=], where the user agent SHOULD
navigate to [=url=] and the appropriate browsing context is set to
a new top level browsing context.
protocol handler=] defined in [=HTML=] where the user agent,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's usually best not to put which spec stuff if defined in as definitions get moved around to different docs:

Suggested change
protocol handler=] defined in [=HTML=] where the user agent,
protocol handler=] where the user agent,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a side this launch instruction seems quite iffy to me, I believe it intends to extract the |resultURL| variable in the algorithm referenced to know what URL to navigate to. I think it needs work but it's a bit out of scope for what I'm trying to do here.

instead of [=navigating=] to [=url=], SHOULD
[=launch a web app with handling=] passing <var>manifest</var> and
[=url=].
</p>
</section>
</section>
Expand Down Expand Up @@ -856,7 +855,8 @@ <h2>
a single element that is a {{FileSystemHandle}}
corresponding to |file|.
</li>
<li>[=launch a web app=] with |params|.
<li>[=Launch a web app with handling=] passing |manifest|
and |params|.
</li>
</ol>
</li>
Expand All @@ -869,8 +869,8 @@ <h2>
{{FileSystemHandle}}s that correspond to the file paths named
by |files|.
</li>
<li>[=launch a web app=] with |params|.
</li>
<li>[=Launch a web app with handling=] passing |manifest| and
|params|.
</ol>
</li>
</ol>
Expand Down Expand Up @@ -1358,118 +1358,6 @@ <h4>
</section>
</section>
</section>
<section data-cite="file-system-access permissions">
<h2>
Launch queue and launch params
</h2>
<section data-dfn-for="LaunchParams">
<h3>
<dfn>LaunchParams</dfn> interface
</h3>
<pre class="idl">
[Exposed=Window] interface LaunchParams {
readonly attribute DOMString? targetURL;
readonly attribute FrozenArray&lt;FileSystemHandle&gt; files;
};
</pre>
<p>
{{LaunchParams/targetURL}} represents the [=URL=] of the launch which
MUST be [=manifest/within scope=] of the application.
</p>
<p>
For every |file handle:FileSystemHandle| in {{LaunchParams/files}},
querying the file system permission with
{{FileSystemPermissionDescriptor/mode}} set to
{{FileSystemPermissionMode/"readwrite"}} MUST return
{{PermissionState/"granted"}}.
</p>
</section>
<section data-dfn-for="LaunchConsumer">
<h3>
<dfn>LaunchConsumer</dfn> function
</h3>
<pre class="idl">
callback LaunchConsumer = any (LaunchParams params);
</pre>
</section>
<section data-dfn-for="LaunchQueue">
<h3>
<dfn>LaunchQueue</dfn> interface
</h3>
<pre class="idl">
partial interface Window {
readonly attribute LaunchQueue launchQueue;
};

[Exposed=Window] interface LaunchQueue {
undefined setConsumer(LaunchConsumer consumer);
};
</pre>
<p>
{{LaunchQueue}} has an <dfn>unconsumed launch params</dfn> which is a
[=list=] of {{LaunchParams}} that is initially empty.
</p>
<p>
{{LaunchQueue}} has an <dfn>assigned launch consumer</dfn> which is
initially null.
</p>
<section>
<h2>
<dfn>setConsumer</dfn> method
</h2>
<p>
The {{LaunchQueue/setConsumer(consumer)}} method steps are:
</p>
<ol class="algorithm">
<li>Set the [=assigned launch consumer=] to |consumer|.
</li>
<li>[=list/For each=] |launch_params:LaunchParams| of [=unconsumed
launch params=]:
<ol>
<li>Invoke |consumer| with |launch_params|.
</li>
</ol>
</li>
<li>Set [=unconsumed launch params=] to the empty [=list=].
</li>
</ol>
</section>
</section>
<section>
<h3>
Handling Web App Launches
</h3>
<p>
The steps to <dfn>launch a web app</dfn> are given by the following
algorithm. The algorithm takes {{LaunchParams}}
|params:LaunchParams|.
</p>
<ol class="algorithm">
<li>If |params| is null, set |params| to a new {{LaunchParams}} with
{{LaunchParams/targetURL}} set to [=manifest/start_url=].
</li>
<li>Create a new top level browsing context and navigate it to
|params.targetUrl|.
</li>
<li>Append |params| to the [=unconsumed launch params=] of the
launched document's {{Window.LaunchQueue}}.
</li>
<li>If the [=assigned launch consumer=] |consumer| is set:
<ol>
<li>[=list/For each=] |launch_params:LaunchParams| of
[=unconsumed launch params=]:
<ol>
<li>Invoke |consumer| with |launch_params|.
</li>
</ol>
</li>
<li>Set [=unconsumed launch params=] to the empty list.
</li>
</ol>
</li>
</ol>
</section>
</section>
<section id="conformance"></section>
</body>
</html>