Skip to content

Commit

Permalink
Reset event bindings in AppBannerManager::OnInstall.
Browse files Browse the repository at this point in the history
This addresses a bug where sites using the beforeinstallpromptevent to
implement an install button could have users trigger a do-nothing
install prompt if the user first used the menu item "Add to Shelf" to
install, and then pressed the beforeinstallprompt-connected button.

Resetting the event binding when the OnInstall() method is triggered
means that when an install is started, all outstanding
beforeinstallpromptevents are voided, fixing the bug.

BUG=823602

Change-Id: Ib2c747c74f7083a7663580ed37da7a319d9a9c60
Reviewed-on: https://chromium-review.googlesource.com/970050
Reviewed-by: Matt Giuca <[email protected]>
Commit-Queue: Dominick Ng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#544317}
  • Loading branch information
Dominick Ng authored and Commit Bot committed Mar 20, 2018
1 parent 5f72e43 commit 10f218c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chrome/browser/banners/app_banner_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ void AppBannerManager::OnInstall(bool is_native,
mojo::MakeRequest(&installation_service));
DCHECK(installation_service);
installation_service->OnInstall();

// We've triggered an installation, so reset bindings to ensure that any
// existing beforeinstallprompt events cannot trigger add to home screen.
ResetBindings();
}

void AppBannerManager::SendBannerAccepted() {
Expand Down

0 comments on commit 10f218c

Please sign in to comment.