BeforeInstallPromptEvent.prompt() should not raise an error if preventDefault() not called |
||
Issue descriptionChrome Version: 60.0.3112.20 Dev OS: Android What steps will reproduce the problem? (1) Turn on flag #bypass-app-banner-engagement-checks. (2) Go to https://killer-marmot.appspot.com/web_redispatch/#early (need console inspect using chrome:inspect) (3) Look in console log. What is the expected result? No error. Should say "testing early resolved". What happens instead? "testing early rejected" "DOMException: The prompt() method may only be called once, following preventDefault()." In other words, getting a beforeinstallprompt event and calling prompt() should be legal without first calling preventDefault(). In the current implementation it throws an InvalidStateError. This is a change from our previous design. Rationale: 1. The spec doesn't say you have to call preventDefault before calling prompt: https://www.w3.org/TR/appmanifest/#prompt-method 2. With plans to make it not automatically prompt but still let you show a prompt by calling BeforeInstallPromptEvent.prompt() ( Issue 730991 ), it doesn't make sense to force you to call preventDefault before prompt, because the default action is not necessarily to show a prompt. If you want to show a prompt immediately, you should be able to just call prompt(). This should be very easy, just removing a check here: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.cpp?l=76
,
Jun 13 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/beeedb8662da2bed75581e0d119d2666656a2edc commit beeedb8662da2bed75581e0d119d2666656a2edc Author: Matt Giuca <mgiuca@chromium.org> Date: Tue Jun 13 05:37:41 2017 BeforeInstallPromptEvent.prompt: Remove check for preventDefault called. Spec compliance change: https://www.w3.org/TR/appmanifest/#prompt-method BUG=730993 Change-Id: Ic103d859147c085922ddd08fe6fd9f5030d745a9 Reviewed-on: https://chromium-review.googlesource.com/527536 Reviewed-by: Dominick Ng <dominickn@chromium.org> Commit-Queue: Matt Giuca <mgiuca@chromium.org> Cr-Commit-Position: refs/heads/master@{#478909} [modify] https://crrev.com/beeedb8662da2bed75581e0d119d2666656a2edc/third_party/WebKit/LayoutTests/app_banner/app-banner-event-prompt.html [modify] https://crrev.com/beeedb8662da2bed75581e0d119d2666656a2edc/third_party/WebKit/Source/modules/app_banner/BeforeInstallPromptEvent.cpp
,
Sep 8 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by mgiuca@chromium.org
, Jun 8 2017