From 0cac578815b9d89cdbf4dd33077e276dea7dcd6f Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Mon, 17 May 2021 15:24:50 -0700 Subject: [PATCH 01/20] First pass at adding beforeinstallprompt back --- index.html | 403 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 365 insertions(+), 38 deletions(-) diff --git a/index.html b/index.html index 2ca032f..3b376d5 100644 --- a/index.html +++ b/index.html @@ -40,7 +40,7 @@

-

+

display_override member

@@ -129,55 +129,382 @@

"https://wicg.io">WICG.

-
+

- note_taking member + Installable web applications

-

- The note_taking member of the Web Application Manifest is - an object that contains - information related to note-taking. It has the following members: -

-
    -
  • [=note_taking/new_note_url=] -
  • -
-

- new_note_url member -

+

+ Installation prompts +

+

+ There are multiple ways that the installation process can be + triggered: +

+
    +
  • An end-user can manually + trigger the installation process through the user agent's + UI, directly invoking the steps + to present an install prompt. +
  • +
  • The installation process can occur through an automated + install prompt: that is, a UI that the user agent presents to + the user when, for instance, there are sufficient installability signals to + warrant installation of + the web application. +
  • +
  • The installation process can occur through a site-triggered + install prompt: the site can programmatically request that the + user agent present an install prompt to the user. The user agent MAY + restrict the availability of this feature to cases where, for + instance, there are sufficient installability signals to + warrant installation of + the web application. +
  • +

- The [=note_taking=] new_note_url member is a URL - [=manifest/within scope=] of the manifest, to open when the user - wants to take a new note using the web application (e.g., from an - operating system shortcut icon or keyboard shortcut). Defining this - member indicates that the web application is a note-taking - application. + In any case, the user agent MUST NOT present an install prompt + if the document is not installable.

+

+ Prior to presenting an automated install prompt, a user agent + MUST run the steps to notify that an install prompt is + available, to give the site the opportunity to prevent the + default action (which is to install the application). Alternatively, + the user agent MAY, at any time (only if the document is + installable), run + the steps to notify that an install prompt is available at any + time, giving the site the opportunity to show a site-triggered + install prompt without automatically showing the prompt. +

+

+ To present + an install prompt: +

+
    +
  1. Show some user-agent-specific UI, asking the user whether to + proceed with installing the app. See privacy and security considerations for + recommendations relating to this UI. The result of this + choice is either accepted or dismissed. +
  2. +
  3. Return result, and in parallel: +
      +
    1. If result is accepted, run the steps to + install the web application. +
    2. +
    +
  4. +
+

+ The steps to notify that an install prompt is available + are given by the following algorithm: +

+
    +
  1. Wait until the {{Document}} of the top-level browsing + context is completely loaded. +
  2. +
  3. If there is already an install prompt being presented or if + the steps to install the web application are currently being + executed, then abort this step. +
  4. +
  5. + Queue a task on the application life-cycle task + source to do the following: +
      +
    1. Let event be a newly constructed + BeforeInstallPromptEvent named + beforeinstallprompt, with its + cancelable attribute initialized to true. +
    2. +
    3. Let mayShowPrompt be the result of firing + event at the {{Window}} object of the top-level + browsing context. +
    4. +
    5. If mayShowPrompt is true, then the user agent MAY, + in parallel, request to present an install prompt + with event. +
    6. +
    +
  6. +
-
+
+

+ Installation Events +

+

+ Installation events and supporting the {{BeforeInstallPrompt}} is + OPTIONAL. +

+

+ DOM events fired by this specification use the + application life-cycle task source. +

+
+

+ BeforeInstallPromptEvent Interface +

+
+ The beforeinstallprompt event is somewhat misnamed, as it + does not necessarily signal that an automated install prompt + will follow (depending on the user agent, it might just be giving + the site the ability to trigger an install prompt). It is so named + for historical reasons. +
+
+            [Exposed=Window]
+            interface BeforeInstallPromptEvent : Event {
+              constructor(DOMString type, optional EventInit eventInitDict = {});
+              Promise<PromptResponseObject> prompt();
+            };
+  
+            dictionary PromptResponseObject {
+              AppBannerPromptOutcome userChoice;
+            };
+  
+            enum AppBannerPromptOutcome {
+              "accepted",
+              "dismissed"
+            };
+          
+

+ The BeforeInstallPromptEvent is dispatched when the site is + allowed to present a site-triggered install prompt, or prior + to the user agent presenting an automated install prompt. It + allows the site to cancel the automated install prompt, as + well as manually present the site-triggered install prompt. +

+
+ If the BeforeInstallPromptEvent is not cancelled, + the user agent is allowed to present an install prompt + (specifically, an automated install prompt) to the end-user. + Canceling the default action (via preventDefault) prevents the + user agent from presenting an install prompt. The user agent + is free to run steps to notify that an install prompt is + available again at a later time. +
+

+ The PromptResponseObject contains the result of calling + prompt(). It + contains one member, userChoice, which states the user's + chosen outcome. +

+

+ An instance of a BeforeInstallPromptEvent has the following + internal slots: +

+
+
+ [[\didPrompt]] +
+
+ A boolean, initially false. Represents whether this + event was used to present an install prompt to the + end-user. +
+
+ [[\userResponsePromise]] +
+
+ A promise that represents the outcome of presenting an install + prompt. +
+
+
+

+ prompt() method +

+

+ The prompt method, when called, runs the following + steps: +

+
    +
  1. If this.[[\userResponsePromise]] is + pending: +
      +
    1. If this event's isTrusted + attribute is false, reject + this.[[\userResponsePromise]] with + {{"NotAllowedError"}}, optionally informing the developer + that untrusted events can't call prompt(). +
    2. +
    3. Else if this.[[\didPrompt]] is + false, set this.[[\didPrompt]] + to true, then in parallel, request to + present an install prompt with this event. Wait, possibly + indefinitely, for the end-user to make a choice. +
    4. +
    +
  2. +
  3. Return this.[[\userResponsePromise]]. +
  4. +
+

+ To request to present an install + prompt with BeforeInstallPromptEvent + event: +

+
    +
  1. + Present an install prompt and let outcome be + the result. +
  2. +
  3. Resolve event.[[\userResponsePromise]] with + a newly created PromptResponseObject whose + userChoice member is + the value of outcome. +
  4. +
+
+
+

+ Usage example +

+

+ This example shows how one might prevent an automated install + prompt from showing until the user clicks a button to show a + site-triggered install prompt. In this way, the site can + leave installation at the user's discretion (rather than + prompting at an arbitrary time), whilst still providing a + prominent UI to do so. +

+
+              window.addEventListener("beforeinstallprompt", event => {
+                // Suppress automatic prompting.
+                event.preventDefault();
+  
+                // Show the (disabled-by-default) install button. This button
+                // resolves the installButtonClicked promise when clicked.
+                installButton.disabled = false;
+  
+                // Wait for the user to click the button.
+                installButton.addEventListener("click", async e => {
+                  // The prompt() method can only be used once.
+                  installButton.disabled = true;
+  
+                  // Show the prompt.
+                  const { userChoice } = await event.prompt();
+                  console.info(`user choice was: ${userChoice}`);
+                });
+              });
+            
+
+
+

+ AppBannerPromptOutcome enum +

+

+ The AppBannerPromptOutcome enum's values represent the + outcomes from presenting an install prompt. +

+
+
+ accepted: +
+
+ The end-user indicated that they would like the user agent to + install the web application. +
+
+ dismissed: +
+
+ The end-user dismissed the install prompt. +
+
+
+
+
+
+

+ Installation process +

+

+ The steps to install the web application are given by the + following algorithm: +

+
    +
  1. Let manifest be the manifest of an installable document. +
  2. +
  3. Perform an unspecified sequence of actions to attempt to register + the web application in the user's operating system (e.g., create + shortcuts that launch the web application, register the application + in the system uninstall menu, etc.). If the installation fails (which + can be for any reason, for example, the OS denying permission to the + user agent to add an icon to the home screen of the device), abort + these steps. +
  4. +
+
+

- Usage Example + Extensions to the Window object

- The following shows a [=manifest=] for a note-taking application. + The following extensions to the Window object specify + the event handler idl attribute on which events relating to + the installation of a web application are fired.

-
-          {
-            "name": "My Note Taking App",
-            "description": "You can take notes!",
-            "icons": [{
-              "src": "icon/hd_hi",
-              "sizes": "128x128"
-            }],
-            "start_url": "/index.html",
-            "display": "standalone",
-            "note_taking": {
-              "new_note_url": "/new_note.html"
-            }
+        
+          partial interface Window {
+            attribute EventHandler onappinstalled;
+            attribute EventHandler onbeforeinstallprompt;
+          };
+        
+
+          function handleInstalled(ev) {
+            const date = new Date(ev.timeStamp / 1000);
+            console.log(`Yay! Our app got installed at ${date.toTimeString()}.`);
           }
+
+          // Using the event handler IDL attribute
+          window.onappinstalled = handleInstalled;
+
+          // Using .addEventListener()
+          window.addEventListener("appinstalled", handleInstalled);
         
+
+

+ onappinstalled attribute +

+

+ The onappinstalled is an event handler IDL + attribute for the "appinstalled" event type. The + interface used for these events is the Event + interface [[DOM]]. This event is dispatched as a result of a + successful installation (see the steps to install the web + application). +

+
+
+

+ onbeforeinstallprompt attribute +

+

+ The onbeforeinstallprompt is an event handler IDL + attribute for the "beforeinstallprompt" event type. + The interface used for these events is the + BeforeInstallPromptEvent interface (see the steps to + notify that an install prompt is available). +

+
From a8dec577bdddfa2f51a5494842f8bdba2dca9edd Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Mon, 17 May 2021 16:10:10 -0700 Subject: [PATCH 02/20] Adding back appinstalled event step --- index.html | 548 ++++++++++++++++++++++++++++------------------------- 1 file changed, 289 insertions(+), 259 deletions(-) diff --git a/index.html b/index.html index 3b376d5..678928d 100644 --- a/index.html +++ b/index.html @@ -17,7 +17,7 @@ github: "WICG/manifest-incubations", shortName: "manifest-incubations", xref: { - specs: ["appmanifest"], + specs: ["appmanifest", "dom"], profile: "web-platform", }, }; @@ -129,139 +129,195 @@

"https://wicg.io">WICG.

+
+

+ Installation prompts +

+

+ There are multiple ways that the installation process can be triggered: +

+
    +
  • An end-user can manually + trigger the installation process through the user agent's + UI, directly invoking the steps + to present an install prompt. +
  • +
  • The installation process can occur through a site-triggered + install prompt: the site can programmatically request that the + user agent present an install prompt to the user. The user agent MAY + restrict the availability of this feature to cases where, for instance, + there are sufficient + installability signals to warrant installation of the web application. +
  • +
+

+ In any case, the user agent MUST NOT present an install prompt + if the document is not installable. +

+

+ The user agent MAY, at any time (only if the document is installable), run the steps to + notify that an install prompt is available at any time, giving the + site the opportunity to show a site-triggered install prompt + without the user needing to interact with the user agent UI. +

+

+ To present + an install prompt: +

+
    +
  1. Show some user-agent-specific UI, asking the user whether to + proceed with installing the app. See privacy and security considerations + for recommendations relating to this UI. The result of this + choice is either {{AppBannerPromptOutcome|accepted}} + accepted or + dismissed. +
  2. +
  3. Return result, and in parallel: +
      +
    1. If result is accepted, run the steps to install + the web application. +
    2. +
    +
  4. +
+

+ The steps to notify that an install prompt is available are + given by the following algorithm: +

+
    +
  1. Wait until the {{Document}} of the top-level browsing + context is completely loaded. +
  2. +
  3. If there is already an install prompt being presented or if + the steps to install the web application are currently being + executed, then abort this step. +
  4. +
  5. + Queue a task on the application life-cycle task source + to do the following: +
      +
    1. Let event be a newly constructed + BeforeInstallPromptEvent named + beforeinstallprompt, with its cancelable + attribute initialized to true. +
    2. +
    3. Let mayShowPrompt be the result of firing + event at the {{Window}} object of the top-level + browsing context. +
    4. +
    5. If mayShowPrompt is true, then the user agent MAY, + in parallel, request to present an install prompt + with event. +
    6. +
    +
  6. +
+

Installable web applications

- Installation prompts + Installation process

- There are multiple ways that the installation process can be - triggered: + The steps to install the web application are given by the + following algorithm:

-
    -
  • An end-user can manually - trigger the installation process through the user agent's - UI, directly invoking the steps - to present an install prompt. +
      +
    1. Let manifest be the manifest of an installable document.
    2. -
    3. The installation process can occur through an automated - install prompt: that is, a UI that the user agent presents to - the user when, for instance, there are sufficient installability signals to - warrant installation of - the web application. +
    4. Perform an unspecified sequence of actions to attempt to register + the web application in the user's operating system (e.g., create + shortcuts that launch the web application, register the application + in the system uninstall menu, etc.). If the installation fails (which + can be for any reason, for example, the OS denying permission to the + user agent to add an icon to the home screen of the device), abort + these steps.
    5. -
    6. The installation process can occur through a site-triggered - install prompt: the site can programmatically request that the - user agent present an install prompt to the user. The user agent MAY - restrict the availability of this feature to cases where, for - instance, there are sufficient installability signals to - warrant installation of - the web application. +
    7. + Queue a task on the application life-cycle task + source to fire an event named appinstalled + at the the {{Window}} object of the top-level browsing + context for which the installation took place.
    8. -
-

- In any case, the user agent MUST NOT present an install prompt - if the document is not installable. -

+ +
+
+

+ Installability signals +

- Prior to presenting an automated install prompt, a user agent - MUST run the steps to notify that an install prompt is - available, to give the site the opportunity to prevent the - default action (which is to install the application). Alternatively, - the user agent MAY, at any time (only if the document is - installable), run - the steps to notify that an install prompt is available at any - time, giving the site the opportunity to show a site-triggered - install prompt without automatically showing the prompt. + By design, this specification does not provide developers with an + explicit API to "install" a web application. Instead, a + manifest can serve as an installability signal to a + user agent that a web application can be installed.

- To present - an install prompt: + Examples of installability signals for a web application:

-
    -
  1. Show some user-agent-specific UI, asking the user whether to - proceed with installing the app. See privacy and security considerations for - recommendations relating to this UI. The result of this - choice is either accepted or dismissed. +
-

- The steps to notify that an install prompt is available - are given by the following algorithm: -

-
    -
  1. Wait until the {{Document}} of the top-level browsing - context is completely loaded. +
  2. has a sensible content security policy.
  3. -
  4. If there is already an install prompt being presented or if - the steps to install the web application are currently being - executed, then abort this step. +
  5. is able to responsively adapt to display on a variety of screen + sizes, catering for both mobile and desktop.
  6. -
  7. - Queue a task on the application life-cycle task - source to do the following: -
      -
    1. Let event be a newly constructed - BeforeInstallPromptEvent named - beforeinstallprompt, with its - cancelable attribute initialized to true. -
    2. -
    3. Let mayShowPrompt be the result of firing - event at the {{Window}} object of the top-level - browsing context. -
    4. -
    5. If mayShowPrompt is true, then the user agent MAY, - in parallel, request to present an install prompt - with event. -
    6. -
    +
  8. is able to function without a network connection.
  9. -
-
-
-

- Installation Events -

-

- Installation events and supporting the {{BeforeInstallPrompt}} is - OPTIONAL. -

+
  • is repeatedly used by the end-user over some extended period of + time. +
  • +
  • has been explicitly marked by the user as one that they value and + trust (e.g., by bookmarking or "starring" it). +
  • +

    - DOM events fired by this specification use the - application life-cycle task source. + This list is not exhaustive and some installability signals + might not apply to all user agents. How a user agent makes use of + these installability signals to determine if a web application + can be installed is left to implementers.

    -
    -

    - BeforeInstallPromptEvent Interface -

    -
    - The beforeinstallprompt event is somewhat misnamed, as it - does not necessarily signal that an automated install prompt - will follow (depending on the user agent, it might just be giving - the site the ability to trigger an install prompt). It is so named - for historical reasons. -
    -
    +      
    +
    +
    +

    + Installation Events +

    +

    + Installation events and supporting the {{BeforeInstallPrompt}} is + OPTIONAL. +

    +

    + DOM events fired by this specification use the application + life-cycle task source. +

    +
    +

    + BeforeInstallPromptEvent Interface +

    +
    + The beforeinstallprompt event is somewhat misnamed, as it does + not necessarily signal that a manual installation will follow + (depending on the user agent, it might just be giving the site the + ability to trigger an install prompt). It is so named for historical + reasons. +
    +
                 [Exposed=Window]
                 interface BeforeInstallPromptEvent : Event {
                   constructor(DOMString type, optional EventInit eventInitDict = {});
    @@ -277,112 +333,109 @@ 

    "dismissed" };

    +

    + The BeforeInstallPromptEvent is dispatched when the site is + allowed to present a site-triggered install prompt, or prior + to the user agent presenting an automated install prompt. It + allows the site to cancel the automated install prompt, as + well as manually present the site-triggered install prompt. +

    +
    + If the BeforeInstallPromptEvent is not cancelled, the + user agent is allowed to present an install prompt + (specifically, an automated install prompt) to the end-user. + Canceling the default action (via preventDefault) prevents the user + agent from presenting an install prompt. The user agent is + free to run steps to notify that an install prompt is + available again at a later time. +
    +

    + The PromptResponseObject contains the result of calling + prompt(). It + contains one member, userChoice, which states the user's + chosen outcome. +

    +

    + An instance of a BeforeInstallPromptEvent has the following + internal slots: +

    +
    +
    + [[\didPrompt]] +
    +
    + A boolean, initially false. Represents whether this + event was used to present an install prompt to the end-user. +
    +
    + [[\userResponsePromise]] +
    +
    + A promise that represents the outcome of presenting an install + prompt. +
    +
    +
    +

    + prompt() method +

    - The BeforeInstallPromptEvent is dispatched when the site is - allowed to present a site-triggered install prompt, or prior - to the user agent presenting an automated install prompt. It - allows the site to cancel the automated install prompt, as - well as manually present the site-triggered install prompt. + The prompt method, when called, runs the following + steps:

    -
    - If the BeforeInstallPromptEvent is not cancelled, - the user agent is allowed to present an install prompt - (specifically, an automated install prompt) to the end-user. - Canceling the default action (via preventDefault) prevents the - user agent from presenting an install prompt. The user agent - is free to run steps to notify that an install prompt is - available again at a later time. -
    -

    - The PromptResponseObject contains the result of calling - prompt(). It - contains one member, userChoice, which states the user's - chosen outcome. +

      +
    1. If this.[[\userResponsePromise]] is pending: +
        +
      1. If this event's isTrusted attribute + is false, reject + this.[[\userResponsePromise]] with + {{"NotAllowedError"}}, optionally informing the developer that + untrusted events can't call prompt(). +
      2. +
      3. Else if this.[[\didPrompt]] is + false, set this.[[\didPrompt]] + to true, then in parallel, request to + present an install prompt with this event. Wait, possibly + indefinitely, for the end-user to make a choice. +
      4. +
      +
    2. +
    3. Return this.[[\userResponsePromise]]. +
    4. +
    +

    + To request to present an install prompt + with BeforeInstallPromptEvent event:

    +
      +
    1. + Present an install prompt and let outcome be + the result. +
    2. +
    3. Resolve event.[[\userResponsePromise]] with a + newly created PromptResponseObject whose userChoice member is the value of + outcome. +
    4. +
    +
    +
    +

    + Usage example +

    - An instance of a BeforeInstallPromptEvent has the following - internal slots: + This example shows how one might prevent an automated install + prompt from showing until the user clicks a button to show a + site-triggered install prompt. In this way, the site can + leave installation at the user's discretion (rather than prompting + at an arbitrary time), whilst still providing a prominent UI to do + so.

    -
    -
    - [[\didPrompt]] -
    -
    - A boolean, initially false. Represents whether this - event was used to present an install prompt to the - end-user. -
    -
    - [[\userResponsePromise]] -
    -
    - A promise that represents the outcome of presenting an install - prompt. -
    -
    -
    -

    - prompt() method -

    -

    - The prompt method, when called, runs the following - steps: -

    -
      -
    1. If this.[[\userResponsePromise]] is - pending: -
        -
      1. If this event's isTrusted - attribute is false, reject - this.[[\userResponsePromise]] with - {{"NotAllowedError"}}, optionally informing the developer - that untrusted events can't call prompt(). -
      2. -
      3. Else if this.[[\didPrompt]] is - false, set this.[[\didPrompt]] - to true, then in parallel, request to - present an install prompt with this event. Wait, possibly - indefinitely, for the end-user to make a choice. -
      4. -
      -
    2. -
    3. Return this.[[\userResponsePromise]]. -
    4. -
    -

    - To request to present an install - prompt with BeforeInstallPromptEvent - event: -

    -
      -
    1. - Present an install prompt and let outcome be - the result. -
    2. -
    3. Resolve event.[[\userResponsePromise]] with - a newly created PromptResponseObject whose - userChoice member is - the value of outcome. -
    4. -
    -
    -
    -

    - Usage example -

    -

    - This example shows how one might prevent an automated install - prompt from showing until the user clicks a button to show a - site-triggered install prompt. In this way, the site can - leave installation at the user's discretion (rather than - prompting at an arbitrary time), whilst still providing a - prominent UI to do so. -

    -
    +          
                   window.addEventListener("beforeinstallprompt", event => {
                     // Suppress automatic prompting.
                     event.preventDefault();
    @@ -402,54 +455,31 @@ 

    }); });

    -
    -
    -

    - AppBannerPromptOutcome enum -

    -

    - The AppBannerPromptOutcome enum's values represent the - outcomes from presenting an install prompt. -

    -
    -
    - accepted: -
    -
    - The end-user indicated that they would like the user agent to - install the web application. -
    -
    - dismissed: -
    -
    - The end-user dismissed the install prompt. -
    -
    -
    -
    -
    -

    - Installation process -

    -

    - The steps to install the web application are given by the - following algorithm: -

    -
      -
    1. Let manifest be the manifest of an installable document. -
    2. -
    3. Perform an unspecified sequence of actions to attempt to register - the web application in the user's operating system (e.g., create - shortcuts that launch the web application, register the application - in the system uninstall menu, etc.). If the installation fails (which - can be for any reason, for example, the OS denying permission to the - user agent to add an icon to the home screen of the device), abort - these steps. -
    4. -
    +
    +

    + AppBannerPromptOutcome enum +

    +

    + The AppBannerPromptOutcome enum's values represent the + outcomes from presenting an install prompt. +

    +
    +
    + accepted: +
    +
    + The end-user indicated that they would like the user agent to + install the web application. +
    +
    + dismissed: +
    +
    + The end-user dismissed the install prompt. +
    +
    +

    From ed15a77d3db104553a2c615c254fbb86d5751f53 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 14:24:54 -0700 Subject: [PATCH 03/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 678928d..80e6383 100644 --- a/index.html +++ b/index.html @@ -204,7 +204,7 @@

    to do the following:
    1. Let event be a newly constructed - BeforeInstallPromptEvent named + {{BeforeInstallPromptEvent}} named beforeinstallprompt, with its cancelable attribute initialized to true.
    2. From 0a0d1d56504c38c4d32f3d78cfcea6be64abb74f Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 14:24:59 -0700 Subject: [PATCH 04/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 80e6383..d566a14 100644 --- a/index.html +++ b/index.html @@ -174,8 +174,8 @@

      "appmanifest#installation-sec">privacy and security considerations for recommendations relating to this UI. The result of this choice is either {{AppBannerPromptOutcome|accepted}} - accepted or - dismissed. + {{AppBannerPromptOutcome\accepted}} or + {{AppBannerPromptOutcome\dismissed}}.
    3. Return result, and in parallel:
        From c0eeada659b5ce2492d0de54a43b0cf81b9e281e Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 14:25:05 -0700 Subject: [PATCH 05/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index d566a14..690bd03 100644 --- a/index.html +++ b/index.html @@ -40,7 +40,7 @@

    -

    +

    display_override member

    From 9dc3bcf6ad7f1f64e66ea7663afe8c417842cca0 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 14:25:22 -0700 Subject: [PATCH 06/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 690bd03..62258bc 100644 --- a/index.html +++ b/index.html @@ -352,7 +352,7 @@

    The PromptResponseObject contains the result of calling - prompt(). It + {{BeforeInstallPromptEvent\prompt()}}. It contains one member, userChoice, which states the user's chosen outcome. From f9ceb3a079746ace627a2aa7257e2149c3c7c9bc Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 14:25:36 -0700 Subject: [PATCH 07/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.html b/index.html index 62258bc..2df0194 100644 --- a/index.html +++ b/index.html @@ -344,8 +344,7 @@

    If the BeforeInstallPromptEvent is not cancelled, the user agent is allowed to present an install prompt (specifically, an automated install prompt) to the end-user. - Canceling the default action (via preventDefault) prevents the user + Canceling the default action (via {{Event/preventDefault()}}) prevents the user agent from presenting an install prompt. The user agent is free to run steps to notify that an install prompt is available again at a later time. From c7b3a4fe08d209410a652268948f4665ad317537 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 14:25:46 -0700 Subject: [PATCH 08/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 2df0194..5dfc007 100644 --- a/index.html +++ b/index.html @@ -205,7 +205,7 @@

    1. Let event be a newly constructed {{BeforeInstallPromptEvent}} named - beforeinstallprompt, with its cancelable + `"beforeinstallprompt"`, with its {{Event\cancelable}} attribute initialized to true.
    2. Let mayShowPrompt be the result of firing From 7bf302a98fd73f75ea318ecd5082617706a46414 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 14:26:15 -0700 Subject: [PATCH 09/20] one more --- index.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 678928d..b2d4ac2 100644 --- a/index.html +++ b/index.html @@ -173,9 +173,8 @@

      proceed with installing the app. See privacy and security considerations for recommendations relating to this UI. The result of this - choice is either {{AppBannerPromptOutcome|accepted}} - accepted or - dismissed. + choice is either {{AppBannerPromptOutcome\accepted}} or + {{AppBannerPromptOutcome\dismissed}}.

    3. Return result, and in parallel:
        @@ -192,7 +191,7 @@

        1. Wait until the {{Document}} of the top-level browsing - context is completely loaded. + context is completely loaded.
        2. If there is already an install prompt being presented or if From 0888b35f0f9d0d4bdd3bfc39e0d4e1edb9d3f7ca Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 14:27:40 -0700 Subject: [PATCH 10/20] tidy --- index.html | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index c6b9878..a8d2e64 100644 --- a/index.html +++ b/index.html @@ -191,7 +191,8 @@

          1. Wait until the {{Document}} of the top-level browsing - context is completely loaded. + context is completely + loaded.
          2. If there is already an install prompt being presented or if @@ -203,9 +204,8 @@

            to do the following:
            1. Let event be a newly constructed - {{BeforeInstallPromptEvent}} named - `"beforeinstallprompt"`, with its {{Event\cancelable}} - attribute initialized to true. + {{BeforeInstallPromptEvent}} named `"beforeinstallprompt"`, with + its {{Event\cancelable}} attribute initialized to true.
            2. Let mayShowPrompt be the result of firing event at the {{Window}} object of the top-level @@ -343,17 +343,16 @@

              If the BeforeInstallPromptEvent is not cancelled, the user agent is allowed to present an install prompt (specifically, an automated install prompt) to the end-user. - Canceling the default action (via {{Event/preventDefault()}}) prevents the user - agent from presenting an install prompt. The user agent is - free to run steps to notify that an install prompt is - available again at a later time. + Canceling the default action (via {{Event/preventDefault()}}) + prevents the user agent from presenting an install prompt. The + user agent is free to run steps to notify that an install prompt + is available again at a later time.

              The PromptResponseObject contains the result of calling - {{BeforeInstallPromptEvent\prompt()}}. It - contains one member, userChoice, which states the user's - chosen outcome. + {{BeforeInstallPromptEvent\prompt()}}. It contains one member, + userChoice, which + states the user's chosen outcome.

              An instance of a BeforeInstallPromptEvent has the following From da7baca77d26a53c41f35c7363b0a907a1d55176 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Wed, 14 Jul 2021 15:00:57 -0700 Subject: [PATCH 11/20] Adding back linking section --- index.html | 86 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 77 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index a8d2e64..48b10fc 100644 --- a/index.html +++ b/index.html @@ -173,14 +173,13 @@

              proceed with installing the app. See privacy and security considerations for recommendations relating to this UI. The result of this - choice is either {{AppBannerPromptOutcome\accepted}} or - {{AppBannerPromptOutcome\dismissed}}. + choice is either {{AppBannerPromptOutcome/accepted}} or + {{AppBannerPromptOutcome/dismissed}}.

            3. Return result, and in parallel:
                -
              1. If result is accepted, run the steps to install - the web application. +
              2. If result is {{AppBannerPromptOutcome/accepted}}, + run the steps to install the web application.
            4. @@ -205,11 +204,11 @@

              1. Let event be a newly constructed {{BeforeInstallPromptEvent}} named `"beforeinstallprompt"`, with - its {{Event\cancelable}} attribute initialized to true. + its {{Event/cancelable}} attribute initialized to true.
              2. -
              3. Let mayShowPrompt be the result of firing - event at the {{Window}} object of the top-level - browsing context. +
              4. Let mayShowPrompt be the result of [=fire an + event|fire=] event at the {{Window}} object of the + top-level browsing context.
              5. If mayShowPrompt is true, then the user agent MAY, in parallel, request to present an install prompt @@ -534,5 +533,74 @@

    +
    +

    + Linking to a manifest +

    +

    + The manifest keyword can be used with a [[HTML]] [^link^] + element. This keyword creates an external resource link. +

    + + + + + + + + + + + + + + + + + + + + +
    + Link type + + Effect on... + + Brief description +
    + link + + a and area +
    + manifest + + External Resource Link + + not allowed + + Imports or links to a manifest. +
    +

    + In cases where more than one [^link^] element with a + manifest link type appears in a {{Document}}, the user + agent uses the first [^link^] element in tree order and ignores all + subsequent [^link^] elements with a manifest link type + (even if the first element was erroneous). See the steps for + obtaining a manifest. +

    +

    + To obtain a manifest, the user agent MUST run the steps for obtaining a manifest. The appropriate time + to obtain the manifest is left up to implementations. A user agent MAY + opt to delay fetching a manifest until after the document and its other + resources have been fully loaded (i.e., to not delay the availability + of content and scripts required by the document). +

    +

    + A manifest is obtained and applied regardless of the + {{HTMLLinkElement/media}} attribute of the [^link^] element matches the + environment or not. +

    +
    From dc672293a09ee18f5f1ef645f23cbf15cc0c7395 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Thu, 15 Jul 2021 09:47:20 -0700 Subject: [PATCH 12/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.html b/index.html index 48b10fc..0410591 100644 --- a/index.html +++ b/index.html @@ -146,9 +146,7 @@

    install prompt: the site can programmatically request that the user agent present an install prompt to the user. The user agent MAY restrict the availability of this feature to cases where, for instance, - there are sufficient - installability signals to warrant installation of the web application. + there are sufficient signals to warrant [=installed web application|installation=] of the web application.

    From ff538ad94d54489808d45a6a9116866e5da8f152 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Thu, 15 Jul 2021 09:47:31 -0700 Subject: [PATCH 13/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 0410591..814179c 100644 --- a/index.html +++ b/index.html @@ -162,7 +162,7 @@

    without the user needing to interact with the user agent UI.

    - To present an install prompt:

    From 3a311e5c4b5dc67714354bcdf0914b38df8fdbcd Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Thu, 15 Jul 2021 09:48:07 -0700 Subject: [PATCH 14/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 814179c..a75bde0 100644 --- a/index.html +++ b/index.html @@ -355,7 +355,7 @@

    An instance of a BeforeInstallPromptEvent has the following internal slots:

    -
    +
    [[\didPrompt]]
    From eaa160416775bc668faddc99524f5777406688f3 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Thu, 15 Jul 2021 09:48:15 -0700 Subject: [PATCH 15/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index a75bde0..800e4b1 100644 --- a/index.html +++ b/index.html @@ -352,7 +352,7 @@

    states the user's chosen outcome.

    - An instance of a BeforeInstallPromptEvent has the following + An instance of a {{BeforeInstallPromptEvent}} has the following internal slots:

    From 194e46404861d7d44a0352c13a3fa777a1ed3627 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Thu, 15 Jul 2021 09:48:33 -0700 Subject: [PATCH 16/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.html b/index.html index 800e4b1..fbc1710 100644 --- a/index.html +++ b/index.html @@ -382,8 +382,7 @@

    1. If this.[[\userResponsePromise]] is pending:
        -
      1. If this event's isTrusted attribute +
      2. If this event's {{Event/isTrusted}} attribute is false, reject this.[[\userResponsePromise]] with {{"NotAllowedError"}}, optionally informing the developer that From 9b314b07ba4935cd8616b6435fac168b224d2057 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Thu, 15 Jul 2021 10:06:48 -0700 Subject: [PATCH 17/20] All spec text to define feature now included? --- index.html | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index fbc1710..02bd836 100644 --- a/index.html +++ b/index.html @@ -142,6 +142,11 @@

        UI, directly invoking the steps to present an install prompt.

      3. +
      4. The installation process can occur through an automated + install prompt: that is, a UI that the user agent presents to + the user when, for instance, there are sufficient installability + signals to warrant installation of the web application. +
      5. The installation process can occur through a site-triggered install prompt: the site can programmatically request that the user agent present an install prompt to the user. The user agent MAY @@ -347,7 +352,7 @@

        The PromptResponseObject contains the result of calling - {{BeforeInstallPromptEvent\prompt()}}. It contains one member, + {{BeforeInstallPromptEvent/prompt()}}. It contains one member, userChoice, which states the user's chosen outcome.

        @@ -530,6 +535,15 @@

    +
    +

    + Associating a resource with a manifest +

    +

    + A resource is said to be associated with a manifest if the + resource representation, an HTML document, has a manifest link relationship. +

    Linking to a manifest @@ -599,5 +613,115 @@

    environment or not.

    +
    +
    +

    + Manifest life-cycle +

    +

    + This section defines algorithms for obtaining, + processing, and applying a + manifest. +

    +
    +

    + Obtaining a manifest +

    +

    + The steps + for obtaining a manifest are given by the following algorithm. + The algorithm, if successful, returns a processed manifest and + the manifest URL; otherwise, it aborts prematurely and + returns nothing. In the case of nothing being returned, the user + agent MUST ignore the manifest declaration. In running these steps, a + user agent MUST NOT delay the load event. +

    +
      +
    1. From the {{Document}} of the top-level browsing context, + let origin be the {{Document}}'s origin, and manifest + link be the first [^link^] element in tree order whose + {{HTMLLinkElement/rel}} attribute contains the token + manifest. +
    2. +
    3. If origin is an opaque origin, then abort these + steps. +
    4. +
    5. If manifest link is null, then abort + these steps. +
    6. +
    7. If manifest link's href attribute's value + is the empty string, then abort these steps. +
    8. +
    9. Let manifest URL be the result of [=URL + Parser|parsing=] the value of the href attribute, + relative to the element's base URL. If parsing fails, then + abort these steps. +
    10. +
    11. Let |request:Request| be a new Request. +
    12. +
    13. Set |request|'s [=request/URL=] to |manifest URL|. +
    14. +
    15. Set |request|'s [=request/initiator=] to "`manifest`". +
    16. +
    17. Set |request|'s [=request/destination=] to "`manifest`". +
    18. +
    19. If the |manifest link|'s {{HTMLLinkElement/crossOrigin}} + attribute's value is "`use-credentials`", then set |request|'s + [=request/credentials mode=] to "`include`". Otherwise, set + |request|'s [=request/credentials mode=] to "`omit`". +
    20. +
    21. Set |request|'s [=request/mode=] to "`cors`". +
    22. +
    23. Await the result of performing a fetch with + request, letting response be the result. +
    24. +
    25. If response is a network error, then abort + these steps. +
    26. +
    27. Let text be UTF-8 decode response's + body. +
    28. +
    29. Let manifest be the result of running processing a + manifest given text, manifest URL, and the + URL that represents the address of the top-level browsing + context. +
    30. +
    31. Return manifest and manifest URL. +
    32. +
    +
    +

    + Content security policy +

    +

    + A user agent MUST support [[CSP3]]. +

    +
    +

    + The manifest-src and default-src directives govern + the origins from which a user agent can fetch a manifest. + As with other directives, by default the manifest-src + directive is *, meaning that a user agent can, + [[FETCH]]'s CORS permitting, fetch the manifest + cross-domain. Remote origins (e.g., a CDN) wanting to host manifests + for various web applications will need to include the appropriate + CORS response header in their HTTP response (e.g., + Access-Control-Allow-Origin: https://example.com). +

    +
    + manifest-src directive example illustrated +
    + For a [[HTML]] document, [[CSP3]]'s manifest-src + directive controls the sources from which a [[HTML]] document + can load a manifest from. The same CSP policy's + img-src directive controls where the icon's images + can be fetched from. +
    +
    +
    +
    +
    From 9c563af077b9d8163c535d770278ad874e4e9399 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Thu, 15 Jul 2021 10:07:18 -0700 Subject: [PATCH 18/20] tidy --- index.html | 354 +++++++++++++++++++++++++++-------------------------- 1 file changed, 179 insertions(+), 175 deletions(-) diff --git a/index.html b/index.html index 02bd836..936fa76 100644 --- a/index.html +++ b/index.html @@ -143,15 +143,16 @@

    to present an install prompt.
  • The installation process can occur through an automated - install prompt: that is, a UI that the user agent presents to - the user when, for instance, there are sufficient installability + install prompt: that is, a UI that the user agent presents to the + user when, for instance, there are sufficient installability signals to warrant installation of the web application.
  • The installation process can occur through a site-triggered install prompt: the site can programmatically request that the user agent present an install prompt to the user. The user agent MAY restrict the availability of this feature to cases where, for instance, - there are sufficient signals to warrant [=installed web application|installation=] of the web application. + there are sufficient signals to warrant [=installed web + application|installation=] of the web application.
  • @@ -387,8 +388,8 @@

    1. If this.[[\userResponsePromise]] is pending:
        -
      1. If this event's {{Event/isTrusted}} attribute - is false, reject +
      2. If this event's {{Event/isTrusted}} attribute is + false, reject this.[[\userResponsePromise]] with {{"NotAllowedError"}}, optionally informing the developer that untrusted events can't call prompt(). @@ -544,183 +545,186 @@

        resource representation, an HTML document, has a manifest link relationship.

        -
        -

        - Linking to a manifest -

        -

        - The manifest keyword can be used with a [[HTML]] [^link^] - element. This keyword creates an external resource link. -

        - - - - - - - - - - - - - - - - - - - - -
        - Link type - - Effect on... - - Brief description -
        - link - - a and area -
        - manifest - - External Resource Link - - not allowed - - Imports or links to a manifest. -
        -

        - In cases where more than one [^link^] element with a - manifest link type appears in a {{Document}}, the user - agent uses the first [^link^] element in tree order and ignores all - subsequent [^link^] elements with a manifest link type - (even if the first element was erroneous). See the steps for - obtaining a manifest. -

        -

        - To obtain a manifest, the user agent MUST run the steps for obtaining a manifest. The appropriate time - to obtain the manifest is left up to implementations. A user agent MAY - opt to delay fetching a manifest until after the document and its other - resources have been fully loaded (i.e., to not delay the availability - of content and scripts required by the document). -

        -

        - A manifest is obtained and applied regardless of the - {{HTMLLinkElement/media}} attribute of the [^link^] element matches the - environment or not. -

        +
        +

        + Linking to a manifest +

        +

        + The manifest keyword can be used with a [[HTML]] + [^link^] element. This keyword creates an external resource + link. +

        + + + + + + + + + + + + + + + + + + + + +
        + Link type + + Effect on... + + Brief description +
        + link + + a and area +
        + manifest + + External Resource Link + + not allowed + + Imports or links to a manifest. +
        +

        + In cases where more than one [^link^] element with a + manifest link type appears in a {{Document}}, the user + agent uses the first [^link^] element in tree order and ignores all + subsequent [^link^] elements with a manifest link type + (even if the first element was erroneous). See the steps for + obtaining a manifest. +

        +

        + To obtain a manifest, the user agent MUST run the steps for + obtaining a manifest. The + appropriate time to obtain the manifest is left up to + implementations. A user agent MAY opt to delay fetching a manifest + until after the document and its other resources have been fully + loaded (i.e., to not delay the availability of content and scripts + required by the document). +

        +

        + A manifest is obtained and applied regardless of the + {{HTMLLinkElement/media}} attribute of the [^link^] element matches + the environment or not. +

        +
        -

    -
    -

    - Manifest life-cycle -

    -

    - This section defines algorithms for obtaining, - processing, and applying a - manifest. -

    -
    -

    - Obtaining a manifest -

    +
    +

    + Manifest life-cycle +

    - The steps - for obtaining a manifest are given by the following algorithm. - The algorithm, if successful, returns a processed manifest and - the manifest URL; otherwise, it aborts prematurely and - returns nothing. In the case of nothing being returned, the user - agent MUST ignore the manifest declaration. In running these steps, a - user agent MUST NOT delay the load event. + This section defines algorithms for obtaining, + processing, and applying a + manifest.

    -
      -
    1. From the {{Document}} of the top-level browsing context, - let origin be the {{Document}}'s origin, and manifest - link be the first [^link^] element in tree order whose - {{HTMLLinkElement/rel}} attribute contains the token - manifest. -
    2. -
    3. If origin is an opaque origin, then abort these - steps. -
    4. -
    5. If manifest link is null, then abort - these steps. -
    6. -
    7. If manifest link's href attribute's value - is the empty string, then abort these steps. -
    8. -
    9. Let manifest URL be the result of [=URL - Parser|parsing=] the value of the href attribute, - relative to the element's base URL. If parsing fails, then - abort these steps. -
    10. -
    11. Let |request:Request| be a new Request. -
    12. -
    13. Set |request|'s [=request/URL=] to |manifest URL|. -
    14. -
    15. Set |request|'s [=request/initiator=] to "`manifest`". -
    16. -
    17. Set |request|'s [=request/destination=] to "`manifest`". -
    18. -
    19. If the |manifest link|'s {{HTMLLinkElement/crossOrigin}} - attribute's value is "`use-credentials`", then set |request|'s - [=request/credentials mode=] to "`include`". Otherwise, set - |request|'s [=request/credentials mode=] to "`omit`". -
    20. -
    21. Set |request|'s [=request/mode=] to "`cors`". -
    22. -
    23. Await the result of performing a fetch with - request, letting response be the result. -
    24. -
    25. If response is a network error, then abort - these steps. -
    26. -
    27. Let text be UTF-8 decode response's - body. -
    28. -
    29. Let manifest be the result of running processing a - manifest given text, manifest URL, and the - URL that represents the address of the top-level browsing - context. -
    30. -
    31. Return manifest and manifest URL. -
    32. -
    -
    -

    - Content security policy -

    +
    +

    + Obtaining a manifest +

    - A user agent MUST support [[CSP3]]. + The steps + for obtaining a manifest are given by the following algorithm. + The algorithm, if successful, returns a processed manifest and + the manifest URL; otherwise, it aborts prematurely and + returns nothing. In the case of nothing being returned, the user + agent MUST ignore the manifest declaration. In running these steps, a + user agent MUST NOT delay the load event.

    -
    +
      +
    1. From the {{Document}} of the top-level browsing context, + let origin be the {{Document}}'s origin, and manifest + link be the first [^link^] element in tree order whose + {{HTMLLinkElement/rel}} attribute contains the token + manifest. +
    2. +
    3. If origin is an opaque origin, then abort these + steps. +
    4. +
    5. If manifest link is null, then abort + these steps. +
    6. +
    7. If manifest link's href attribute's value + is the empty string, then abort these steps. +
    8. +
    9. Let manifest URL be the result of [=URL + Parser|parsing=] the value of the href attribute, + relative to the element's base URL. If parsing fails, then + abort these steps. +
    10. +
    11. Let |request:Request| be a new Request. +
    12. +
    13. Set |request|'s [=request/URL=] to |manifest URL|. +
    14. +
    15. Set |request|'s [=request/initiator=] to "`manifest`". +
    16. +
    17. Set |request|'s [=request/destination=] to "`manifest`". +
    18. +
    19. If the |manifest link|'s {{HTMLLinkElement/crossOrigin}} + attribute's value is "`use-credentials`", then set |request|'s + [=request/credentials mode=] to "`include`". Otherwise, set + |request|'s [=request/credentials mode=] to "`omit`". +
    20. +
    21. Set |request|'s [=request/mode=] to "`cors`". +
    22. +
    23. Await the result of performing a fetch with + request, letting response be the result. +
    24. +
    25. If response is a network error, then abort + these steps. +
    26. +
    27. Let text be UTF-8 decode response's + body. +
    28. +
    29. Let manifest be the result of running processing a + manifest given text, manifest URL, and the + URL that represents the address of the top-level browsing + context. +
    30. +
    31. Return manifest and manifest URL. +
    32. +
    +
    +

    + Content security policy +

    - The manifest-src and default-src directives govern - the origins from which a user agent can fetch a manifest. - As with other directives, by default the manifest-src - directive is *, meaning that a user agent can, - [[FETCH]]'s CORS permitting, fetch the manifest - cross-domain. Remote origins (e.g., a CDN) wanting to host manifests - for various web applications will need to include the appropriate - CORS response header in their HTTP response (e.g., - Access-Control-Allow-Origin: https://example.com). + A user agent MUST support [[CSP3]].

    -
    - manifest-src directive example illustrated -
    - For a [[HTML]] document, [[CSP3]]'s manifest-src - directive controls the sources from which a [[HTML]] document - can load a manifest from. The same CSP policy's - img-src directive controls where the icon's images - can be fetched from. -
    -
    -
    +
    +

    + The manifest-src and default-src directives govern + the origins from which a user agent can fetch a manifest. + As with other directives, by default the manifest-src + directive is *, meaning that a user agent can, + [[FETCH]]'s CORS permitting, fetch the manifest + cross-domain. Remote origins (e.g., a CDN) wanting to host manifests + for various web applications will need to include the appropriate + CORS response header in their HTTP response (e.g., + Access-Control-Allow-Origin: https://example.com). +

    +
    + manifest-src directive example illustrated +
    + For a [[HTML]] document, [[CSP3]]'s manifest-src + directive controls the sources from which a [[HTML]] document + can load a manifest from. The same CSP policy's + img-src directive controls where the icon's images + can be fetched from. +
    +
    +
    +
    From 5857e24d319ce52e84deb09654992b618107955c Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Fri, 16 Jul 2021 12:10:31 -0700 Subject: [PATCH 19/20] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marcos Cáceres --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index a4beba7..07cca68 100644 --- a/index.html +++ b/index.html @@ -535,7 +535,7 @@

    steps:

      -
    1. If this.[[\userResponsePromise]] is pending: +
    2. If this.{{BeforeInstallPromptEvent/[[userResponsePromise]]}} is pending:
      1. If this event's {{Event/isTrusted}} attribute is false, reject From 94b4fda5e3362802999376c590bf897687999a33 Mon Sep 17 00:00:00 2001 From: Daniel Murphy Date: Fri, 16 Jul 2021 12:11:17 -0700 Subject: [PATCH 20/20] Adding BeforeInstallPromptEvent --- index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index a4beba7..7560ec4 100644 --- a/index.html +++ b/index.html @@ -535,11 +535,11 @@

        steps:

          -
        1. If this.[[\userResponsePromise]] is pending: +
        2. If this.{{BeforeInstallPromptEvent/[[\userResponsePromise]] is pending:
          1. If this event's {{Event/isTrusted}} attribute is false, reject - this.[[\userResponsePromise]] with + this.{{BeforeInstallPromptEvent/[[\userResponsePromise]] with {{"NotAllowedError"}}, optionally informing the developer that untrusted events can't call prompt().
          2. @@ -551,7 +551,7 @@

        3. -
        4. Return this.[[\userResponsePromise]]. +
        5. Return this.{{BeforeInstallPromptEvent/[[\userResponsePromise]].

        @@ -563,7 +563,7 @@

        Present an install prompt and let outcome be the result.

      2. -
      3. Resolve event.[[\userResponsePromise]] with a +
      4. Resolve event.{{BeforeInstallPromptEvent/[[\userResponsePromise]] with a newly created PromptResponseObject whose userChoice member is the value of outcome.