desktop-pwas: Introduce BookmarkAppNavigationThrottle to defer navigations |
|||||
Issue description(1) As described in Issue 753238 , newly open tabs should be closed if we opened an app window. Also, (2) as described in Issue 764607 , the newly opened app window should be focused. To achieve (1) we need to close the source WebContents of the navigation. We can't do this synchronously as it could lead to UAF for the WebContents. We will have to post a task to close the WebContents. For (2), we will need to post a task to open the app window. Ideally we would just post a task to close the webcontents and another one to open the application. But, there is no guarantee that the WebContents will still be alive by the time our task runs and similarly there is no guarantee that the profile (an argument necessary for opening the app), will be alive by then. Deferring the navigation ensures both the WebContents and the Profile are still there by the time we run our tasks. We have two options to defer navigations: 1. Re-add code to InterceptNavigationThrottle to perform the "should ignore" checks asynchronously. 2. Introduce our own NavigationThrottle which would defer navigations for empty tabs that open an application windows. The benefit of 1. is that it's very easy to do. The downside is that we would run all of our checks in a task, thus introducing delays in navigations. 2. is more work and means having two separate Throttle for Apps, albeit two different types of apps. But it will post tasks only when required. For these reasons, we will introduce a new NavigationThrottle.
,
Sep 13 2017
,
Sep 13 2017
,
Sep 27 2017
,
Oct 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d commit 7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d Author: Giovanni Ortuño Urquidi <ortuno@chromium.org> Date: Mon Oct 09 01:49:57 2017 desktop-pwas: Separate Bookmark Apps redirection from Platform Apps redirection First of two patches to post a task to open the application window: 1. This patch 2. desktop-pwas: Post task to open the app and maybe close the tab (https://crrev.com/c/691635) This patch removes code that redirected navigations to BookmarkApps from AppUrlRedirector and puts it in BookmarkAppNavigationThrottle. It also renames AppUrlRedirector to PlatformAppNavigationRedirector. BookmarkAppNavigationThrottle should have the same functionality as AppUrlRedirector but there are a couple of differences. BookmarkAppNavigationThrottle doesn't inherit from InterceptNavigationThrottle. And BookmarkAppNavigationThrottle performs two checks in WillStartRequest that AppUrlRedirector performs in MaybCreateThrottleFor(): 1. Scheme is HTTP or HTTPS 2. URL is handled by an app This ensures that, once we implement WillRedirectRequest, our NavigationThrottle is run for all URLs in the navigation not only the first one. Bug: 764626 Change-Id: I8a52a8f6bf120e05141952feaccfcf696c821b5e Reviewed-on: https://chromium-review.googlesource.com/686085 Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org> Reviewed-by: Nasko Oskov <nasko@chromium.org> Reviewed-by: Trent Apted <tapted@chromium.org> Reviewed-by: Yutaka Hirano <yhirano@chromium.org> Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org> Cr-Commit-Position: refs/heads/master@{#507315} [modify] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/apps/BUILD.gn [delete] https://crrev.com/dc9d3cffe6f4d3b5655f3bb4824e1f94789b4d69/chrome/browser/apps/app_url_redirector.cc [delete] https://crrev.com/dc9d3cffe6f4d3b5655f3bb4824e1f94789b4d69/chrome/browser/apps/app_url_redirector.h [add] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/apps/platform_app_navigation_redirector.cc [add] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/apps/platform_app_navigation_redirector.h [rename] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/apps/platform_app_navigation_redirector_browsertest.cc [modify] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/chrome_content_browser_client.cc [modify] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/extensions/BUILD.gn [add] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/extensions/bookmark_app_navigation_throttle.cc [add] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/extensions/bookmark_app_navigation_throttle.h [rename] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/extensions/bookmark_app_navigation_throttle_browsertest.cc [modify] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc [modify] https://crrev.com/7ae7fb0a77a596f649bb0ac66f8b762875fc3b6d/chrome/test/BUILD.gn
,
Oct 9 2017
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by ortuno@chromium.org
, Sep 13 2017