Fix process selection for chrome.tabs.update(... about:blank ...).
chrome.tabs.update is treated as renderer-initiated to address omnibox/url spoofing problems (see r698617). All renderer-initiated navigations need to have a non-null |initiator_origin| - the extension origin is used in case of chrome.tabs.update. The problem fixed by this CL, is that without explicitly specifying LoadURLParams::source_site_instance, the old SiteInstance of the navigated web contents might be used. In particular, when navigating a tab with https://example.com to about:blank, reusing the SiteInstance of https://example.com means that about:blank (with an origin associated with the extension) would commit in a process locked to https://example.com - this is undesirable from Site Isolation perspective. The CL fixes the problem above, by making sure that chrome.tabs.update populates LoadURLParams::source_site_instance in a way consistent with 1) initiator_origin and 2) the BrowserContext of the target tab. Note that when discussing this CL, we've explicitly decided against setting the |initiator_origin| to the (old/current) origin of the target tab. This is because such initiator would prevent the extension from being able to use chrome.tabs.update to navigate to non-web-accessible-resources owned by the extension. Additionally, using the origin of the target tab is subject to races with other navigations of the tab that might be happening in parallel. Note that this CL does *not* change the fact that using chrome.tabs.update to navigate a non-extension tab to about:blank will commit an *opaque* origin (with precursor set to the extension origin), rather than committing about:blank with the (non-opaque) extension origin. This aspect of behavior is not changed because: 1. There are no compelling reasons to make a change at this point. 2. Changing this behavior is possible when chrome.tabs.update is called from an extension frame in the same BrowserContext as the target tab (in this case |source_site_instance| can be set to the SiteInstance of the extension frame calling chrome.tabs.update). Unfortunately sometimes there is no extension frame (when chrome.tabs.update is called from an extension service worker) and sometimes the target tab is in a different BrowserContext (e.g. in an Incognito profile). Relevant tests: - (new) ExtensionApiTest.TabsUpdate_WebToAboutBlank - (new) ExtensionApiTest.TabsUpdate_WebToNonWAR - IncognitoApiTest.Incognito - ServiceWorkerBasedBackgroundTest.FilteredEvents - ServiceWorkerBasedBackgroundTest.TabsEvents Change-Id: I31b298d9a118de45ba4a255d2384d82f029c8b7a Bug: 991607 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1850355 Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Reviewed-by:Devlin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/master@{#708283}
Showing
Please register or sign in to comment