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 installation process and install prompting logic #790

Merged
merged 14 commits into from
Sep 26, 2019

Conversation

mgiuca
Copy link
Collaborator

@mgiuca mgiuca commented Sep 12, 2019

This change (choose one):

  • Breaks existing normative behavior (please add label "breaking")
  • Adds new normative requirements
  • Adds new normative recommendations or optional items
  • Makes only editorial changes (only changes informative sections, or
    changes normative sections without changing behavior)
  • Is a "chore" (metadata, formatting, fixing warnings, etc).

Commit message:

Rewrite installation process and install prompting logic per #788.

  • Introduces a new concept of the document being "installable", a stateful
    property of the document based on validity of the manifest.
  • Adds a new process, "steps to determine installability of the document", split
    out from "steps to install the web application".
  • Removed the concept of "installation process", "installation succeeded",
    "installation canceled" (which was unused; see Steps to install the web application does not take into account whether the installation process was canceled #787) and "installation
    failed". These concepts are now part of the "steps to install the web
    application".
  • "Steps to install the web application" now assumes that the document is
    installable, and that user has already accepted the install prompt, where
    previously the determination of installability and prompting were all part of
    that same process.
  • Processes that show an install prompt now explicitly call "steps to install
    the web application" after the user accepts the prompt (see BeforeInstallPromptEvent.prompt() does not actually perform installation #786).

Normative changes are to fix bugs in the spec which made it non-implementable; I
believe these simply bring the spec in line with all known implementations, so
no implementation change is required due to this spec change.

Closes #786, #787, #788.


Preview | Diff

@mgiuca
Copy link
Collaborator Author

mgiuca commented Sep 12, 2019

@dominickng to also have a look.

This PR will likely be a prerequisite to fix #784 and #789 (I started work on #784 and found the algorithm to be non-sensical, hence this PR).

Copy link
Member

@marcoscaceres marcoscaceres left a comment

Choose a reason for hiding this comment

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

Looking pretty good @mgiuca. Thanks for cleaning this up. Just one small issue I found with "return result". Rest are mostly just nits.

index.html Outdated
"AppBannerPromptOutcome">accepted</a>, then in parallel, run the <a>
steps to install the web application</a>.
</li>
<li>Return <var>result</var>.
Copy link
Member

Choose a reason for hiding this comment

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

This is ambiguous: is result returned before "in parallel" runs, or after? As it reads (to me), it's returning before, which I think is incorrect, right?

Copy link
Collaborator Author

@mgiuca mgiuca Sep 12, 2019

Choose a reason for hiding this comment

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

It's intended to be before (i.e., your reading is correct). I don't think it's ambiguous: that's precisely the meaning of "in parallel" (otherwise I wouldn't have said "in parallel").

The result of "present an install prompt" should be the user's choice, not the success of the installation. The result of this promise reflects the user's choice, whereas the appinstalled event reflects whether it was actually installed.

At least, that was my intention. Now I'm not so sure. Looking at Chrome's app_banner_manager, the code that sends BannerAccepted (which results in the promise resolving with "accepted") has a comment:

  // Catch only kSuccessNewInstall and kUserInstallDeclined. Report nothing on
  // all other errors.

implying that maybe we resolve with "accepted" if the user accepts AND installation is success, and perhaps we never resole if the user accepts and installation fails??? @dominickng Can you confirm what Chrome is doing here?

We should decide what the (currently unspecified) behaviour should be if the user accepts the banner but the installation fails: if we want to resolve with "accepted" then the proposed text is correct. If not, we should delete "in parallel" and figure out what to resolve with (perhaps we should introduce a new "accepted-but-failed" result)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Discussed with @dominickng. Chrome does:

  • On Android, it resolves with "accepted" as soon as the user chooses to install, regardless of whether the installation actually succeeds (matching the proposed "in parallel" text).
  • On Windows / Chrome OS / Linux / macOS, if the user accepts and the install "fails", the promise won't resolve. But the failures are all very much edge cases (like something has gone horribly wrong, or the web contents is destroyed, etc), not expected to happen in normal situations. We would consider these edge cases Chrome bugs if they happened. For all intents and purposes, the proposed "in parallel" text matches our behaviour.

So I would prefer to keep this as-is.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, alternative:

<li>Return |result| and in parallel: .... 

That way it's clear that in parallel goes off to do other things independently of |result|.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK that works.

<li>If there is already an <a>installation process</a> being
<a data-lt="present an install prompt">presented</a>, terminate this
algorithm.
<li>If there is already an <a data-lt=
Copy link
Member

Choose a reason for hiding this comment

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

We probably need need some kind of internal slot to track this, which can be reset as part of task once installation completes (and can hook into manual installation)... we don't need to do it as part of this PR tho.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep. You're tracking this at #761 so I thought I'd just leave it for now.

Similarly, we should probably add an internal slot for "is installable" since that's a document-global property that I'm adding, but I didn't want to do it in this PR.

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
@mgiuca
Copy link
Collaborator Author

mgiuca commented Sep 12, 2019

Thanks for the quick review, @marcoscaceres. I've accepted or made most of the changes you proposed. I will follow up with @dominickng about the behavioural question.

attempt installation.
<li>Let <var>manifest</var> and <var>manifest URL</var> be the values
that were created during <a>steps to determine installability of the
document</a>.
Copy link
Collaborator

Choose a reason for hiding this comment

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

whether the document is installable ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this phrasing is OK, given that we also define "installability signals" (keeping it this way implies that the two are connected, which they are).

Copy link
Member

@marcoscaceres marcoscaceres left a comment

Choose a reason for hiding this comment

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

Pre-approving... I still think the the |result| + in parallel could be a bit clearer, but overall this is a great improvement. Nice work @mgiuca.

index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated Show resolved Hide resolved
index.html Outdated
"AppBannerPromptOutcome">accepted</a>, then in parallel, run the <a>
steps to install the web application</a>.
</li>
<li>Return <var>result</var>.
Copy link
Member

Choose a reason for hiding this comment

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

Ok, alternative:

<li>Return |result| and in parallel: .... 

That way it's clear that in parallel goes off to do other things independently of |result|.

@mgiuca mgiuca merged commit f8f227e into w3c:gh-pages Sep 26, 2019
@mgiuca mgiuca deleted the install-process-rework branch September 26, 2019 06:52
christianliebel pushed a commit to christianliebel/manifest that referenced this pull request May 27, 2020
Rewrite installation process and install prompting logic per w3c#788.

- Introduces a new concept of the document being "installable", a stateful
  property of the document based on validity of the manifest.
- Adds a new process, "steps to determine installability of the document", split
  out from "steps to install the web application".
- Removed the concept of "installation process", "installation succeeded",
  "installation canceled" (which was unused; see w3c#787) and "installation
  failed". These concepts are now part of the "steps to install the web
  application".
- "Steps to install the web application" now assumes that the document is
  installable, and that user has already accepted the install prompt, where
  previously the determination of installability and prompting were all part of
  that same process.
- Processes that show an install prompt now explicitly call "steps to install
  the web application" after the user accepts the prompt (see w3c#786).

Normative changes are to fix bugs in the spec which made it non-implementable; I
believe these simply bring the spec in line with all known implementations, so
no implementation change is required due to this spec change.

Closes w3c#786, w3c#787, w3c#788.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BeforeInstallPromptEvent.prompt() does not actually perform installation
3 participants