From 76fed9830123ae32ac5a928e0fadee6d2b1f6c34 Mon Sep 17 00:00:00 2001
From: alancutter
Date: Wed, 9 Nov 2022 13:54:01 +1100
Subject: [PATCH] Rewrite web app launch procedures in terms of the
web-app-launch spec algorithm (#63)
Fixes: WICG/web-app-launch#67
This updates 3 launch sites in manifest-incubations (note taking, protocol handlers and file handlers) to make use of the [=launch a web application with handling=] algorithm being added by: https://github.com/WICG/web-app-launch/pull/79/files
Note that the removal of Launch queue and launch params from this spec is due to these concepts already existing in https://wicg.github.io/web-app-launch/#script-interfaces-to-app-launches.
https://github.com/WICG/manifest-incubations/pull/63
---
index.html | 158 ++++++++++-------------------------------------------
1 file changed, 29 insertions(+), 129 deletions(-)
diff --git a/index.html b/index.html
index a50655d..6865142 100644
--- a/index.html
+++ b/index.html
@@ -281,10 +281,8 @@
If the type of |manifest|["note_taking"]["new_note_url"] is not
[=URL=], return.
- Let |browsing context:Browsing Context| be the result of creating
- a new [=top-level browsing context=].
-
- [=Navigate=] |browsing context| to resource
+ Run the steps to [=launch a web application=] setting |manifest|
+ to |manifest| and |target URL| to
|manifest|["note_taking"]["new_note_url"].
@@ -476,9 +474,14 @@
When a protocol handler description
protocol_handler having [=manifest=] manifest
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=] where the user agent, instead of [=navigating=]
+ to resultURL, SHOULD [=launch a web application=]
+ passing manifest and resultURL.
+
+
+ This should not invoke and alter [=invoke a protocol handler=] in
+ this way. The computation of resultURL should be
+ extracted out into a separate algorithm for general use.
@@ -851,12 +854,17 @@
- [=list/for each=] |file| of |files|
- - Let |params:LaunchParams| be a new {{LaunchParams}}
- with {{LaunchParams/files}} set to a {{FrozenArray}} with
- a single element that is a {{FileSystemHandle}}
- corresponding to |file|.
+
+
- Let |params:LaunchParams| be a new
+
+ LaunchParams with
+
+ files set to a {{FrozenArray}} with a single element
+ that is a {{FileSystemHandle}} corresponding to |file|.
- - [=launch a web app=] with |params|.
+
-
+ Launch a web application with handling passing
+ |manifest| and |params|.
@@ -864,12 +872,16 @@
- Else,
- - Let |params:LaunchParams| be a new {{LaunchParams}} with
- {{LaunchParams/files}} set to a {{FrozenArray}} of
- {{FileSystemHandle}}s that correspond to the file paths named
- by |files|.
+
- Let |params:LaunchParams| be a new
+
+ LaunchParams with
+
+ files set to a {{FrozenArray}} of {{FileSystemHandle}}s
+ that correspond to the file paths named by |files|.
- - [=launch a web app=] with |params|.
+
-
+ Launch a web application with handling passing |manifest|
+ and |params|.
@@ -1358,118 +1370,6 @@
-
-
- Launch queue and launch params
-
-
-
- LaunchParams interface
-
-
- [Exposed=Window] interface LaunchParams {
- readonly attribute DOMString? targetURL;
- readonly attribute FrozenArray<FileSystemHandle> files;
- };
-
-
- {{LaunchParams/targetURL}} represents the [=URL=] of the launch which
- MUST be [=manifest/within scope=] of the application.
-
-
- For every |file handle:FileSystemHandle| in {{LaunchParams/files}},
- querying the file system permission with
- {{FileSystemPermissionDescriptor/mode}} set to
- {{FileSystemPermissionMode/"readwrite"}} MUST return
- {{PermissionState/"granted"}}.
-
-
-
-
- LaunchConsumer function
-
-
- callback LaunchConsumer = any (LaunchParams params);
-
-
-
-
- LaunchQueue interface
-
-
- partial interface Window {
- readonly attribute LaunchQueue launchQueue;
- };
-
- [Exposed=Window] interface LaunchQueue {
- undefined setConsumer(LaunchConsumer consumer);
- };
-
-
- {{LaunchQueue}} has an unconsumed launch params which is a
- [=list=] of {{LaunchParams}} that is initially empty.
-
-
- {{LaunchQueue}} has an assigned launch consumer which is
- initially null.
-
-
-
- setConsumer method
-
-
- The {{LaunchQueue/setConsumer(consumer)}} method steps are:
-
-
- - Set the [=assigned launch consumer=] to |consumer|.
-
- - [=list/For each=] |launch_params:LaunchParams| of [=unconsumed
- launch params=]:
-
- - Invoke |consumer| with |launch_params|.
-
-
-
- - Set [=unconsumed launch params=] to the empty [=list=].
-
-
-
-
-
-
- Handling Web App Launches
-
-
- The steps to launch a web app are given by the following
- algorithm. The algorithm takes {{LaunchParams}}
- |params:LaunchParams|.
-
-
- - If |params| is null, set |params| to a new {{LaunchParams}} with
- {{LaunchParams/targetURL}} set to [=manifest/start_url=].
-
- - Create a new top level browsing context and navigate it to
- |params.targetUrl|.
-
- - Append |params| to the [=unconsumed launch params=] of the
- launched document's {{Window.LaunchQueue}}.
-
- - If the [=assigned launch consumer=] |consumer| is set:
-
- - [=list/For each=] |launch_params:LaunchParams| of
- [=unconsumed launch params=]:
-
- - Invoke |consumer| with |launch_params|.
-
-
-
- - Set [=unconsumed launch params=] to the empty list.
-
-
-
-
-
-