Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Issue 2352083003: Allow top-level navigation in extension pop-ups if it only triggers a download. (Closed)

Created:
4 years, 3 months ago by Łukasz Anforowicz
Modified:
4 years, 2 months ago
Reviewers:
Charlie Reis, Devlin, sky
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org, site-isolation-reviews_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Block navigations in extensions via ShouldTransferNavigation (not via OpenURL). Before this CL, blocking of top-level navigations in extension pop-ups was accomplished by routing them via OpenURL path and blocking (or rather - silently dropping) CURRENT_TAB navigations via ExtensionViewHost::OpenURLFromTab. This was problematic for a few reasons: 1. This unnecessarily blocked navigations that end-up being treated as downloads (i.e. because HTTP response says Content-Disposition: attachment). This was the root cause of the regression raised in https://crbug.com/646261 2. There are still some remaining issues in handling of POST requests via OpenURL path (e.g. dropping Content-Type header - https://crbug.com/648648). 3. In the long-term we want to rely less on process isolation accomplished via OpenURL - an exploited renderer process does not necessarily have to go through OpenURL path and can instead choose to use the regular, renderer-initiated path. After this CL: 1. ExtensionViewHost::ShouldTransferNavigation is used to block top-level navigations in extension pop-ups (and background pages). 2. POST navigations do not go through OpenURL path anymore (i.e. this CL effectively reverts the essence of r407586). In the long-term we want to make all extension navigations to not go through OpenURL path, but this seems too risky to merge back to M54, so for now we only do #1 above (i.e. avoid OpenURL only for POST requests). BUG=646261 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Committed: https://crrev.com/953f8c785a134b2b4bd9ff401ff27f7edef4172c Cr-Commit-Position: refs/heads/master@{#421287}

Patch Set 1 : Testing what will fail when letting CURRENT_TAB to go through #

Patch Set 2 : Browser tests for top-level navigations in pop-up extension #

Patch Set 3 : Allowing CURRENT_TAB disposition to go through. #

Patch Set 4 : Revert essence of r407586 + blocking ext->web via ShouldTransferNavigation. #

Patch Set 5 : Added test for extension -> web navigation in a tab (which should succeed). #

Patch Set 6 : Turns out that there is no downloads "shelf" on ChromeOS. #

Patch Set 7 : Added a comment to ExtensionViewHost::ShouldTransferNavigation. #

Total comments: 10

Patch Set 8 : Addressed CR feedback from creis@. #

Total comments: 30

Patch Set 9 : Addressed CR feedback from rdevlin.cronin@. #

Patch Set 10 : Going back to !defined(OS_CHROMEOS) as download shelf verification trigger. #

Total comments: 8

Patch Set 11 : Addressed more CR feedback from rdevlin.cronin@. #

Patch Set 12 : Changed bug reference (in a TODO comment) to a fresh bug. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+309 lines, -16 lines) Patch
M chrome/browser/extensions/api/extension_action/browser_action_apitest.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +200 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_view_host.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/extension_view_host.cc View 1 2 3 4 5 6 1 chunk +8 lines, -0 lines 0 comments Download
M chrome/browser/extensions/process_management_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +54 lines, -0 lines 0 comments Download
M chrome/browser/prerender/prerender_contents.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/chrome_content_renderer_client.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +10 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/browser_action/popup_with_form/manifest.json View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download
A chrome/test/data/extensions/api_test/browser_action/popup_with_form/other_page.html View 1 2 3 1 chunk +6 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/browser_action/popup_with_form/popup.html View 1 2 3 1 chunk +14 lines, -0 lines 0 comments Download
A + chrome/test/data/extensions/api_test/browser_action/popup_with_form/popup.js View 1 2 3 0 chunks +-1 lines, --1 lines 0 comments Download
M content/browser/cross_site_transfer_browsertest.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M content/browser/frame_host/navigation_request.cc View 1 2 3 1 chunk +2 lines, -3 lines 0 comments Download
M content/browser/frame_host/navigator_delegate.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M content/browser/frame_host/navigator_delegate.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/frame_host/navigator_impl.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M content/public/browser/web_contents_delegate.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M content/public/browser/web_contents_delegate.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 55 (40 generated)
Łukasz Anforowicz
Charlie, could you take a look please? This CL implements the option we discussed on ...
4 years, 2 months ago (2016-09-26 16:18:47 UTC) #22
Charlie Reis
On 2016/09/26 16:18:47, Łukasz Anforowicz wrote: > Charlie, could you take a look please? This ...
4 years, 2 months ago (2016-09-26 17:27:51 UTC) #23
Łukasz Anforowicz
Thanks for the feedback - I've addressed the comments in the latest patchset. https://codereview.chromium.org/2352083003/diff/120001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc File ...
4 years, 2 months ago (2016-09-26 18:30:23 UTC) #26
Łukasz Anforowicz
+rdevlin.cronin - PTAL at: chrome/browser/extensions/api/extension_action/browser_action_apitest.cc chrome/browser/extensions/extension_view_host.cc chrome/browser/extensions/extension_view_host.h chrome/browser/extensions/process_management_browsertest.cc
4 years, 2 months ago (2016-09-26 18:31:28 UTC) #28
Charlie Reis
Thanks! https://codereview.chromium.org/2352083003/diff/120001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc File chrome/browser/extensions/api/extension_action/browser_action_apitest.cc (right): https://codereview.chromium.org/2352083003/diff/120001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc#newcode1035 chrome/browser/extensions/api/extension_action/browser_action_apitest.cc:1035: #if !defined(OS_CHROMEOS) On 2016/09/26 18:30:23, Łukasz Anforowicz wrote: ...
4 years, 2 months ago (2016-09-26 19:00:48 UTC) #29
Devlin
Mostly all nits https://codereview.chromium.org/2352083003/diff/140001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc File chrome/browser/extensions/api/extension_action/browser_action_apitest.cc (right): https://codereview.chromium.org/2352083003/diff/140001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc#newcode828 chrome/browser/extensions/api/extension_action/browser_action_apitest.cc:828: void VerifyNavigationResult(WebContents* popup, Could this be ...
4 years, 2 months ago (2016-09-26 20:57:06 UTC) #32
Łukasz Anforowicz
Devlin, can you take another look please? https://codereview.chromium.org/2352083003/diff/120001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc File chrome/browser/extensions/api/extension_action/browser_action_apitest.cc (right): https://codereview.chromium.org/2352083003/diff/120001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc#newcode1035 chrome/browser/extensions/api/extension_action/browser_action_apitest.cc:1035: #if !defined(OS_CHROMEOS) ...
4 years, 2 months ago (2016-09-26 22:05:11 UTC) #33
Devlin
extensions lgtm https://codereview.chromium.org/2352083003/diff/140001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc File chrome/browser/extensions/api/extension_action/browser_action_apitest.cc (right): https://codereview.chromium.org/2352083003/diff/140001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc#newcode911 chrome/browser/extensions/api/extension_action/browser_action_apitest.cc:911: " 0);"; On 2016/09/26 22:05:11, Łukasz Anforowicz ...
4 years, 2 months ago (2016-09-27 15:57:28 UTC) #38
Łukasz Anforowicz
Thanks for the review. https://codereview.chromium.org/2352083003/diff/140001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc File chrome/browser/extensions/api/extension_action/browser_action_apitest.cc (right): https://codereview.chromium.org/2352083003/diff/140001/chrome/browser/extensions/api/extension_action/browser_action_apitest.cc#newcode911 chrome/browser/extensions/api/extension_action/browser_action_apitest.cc:911: " 0);"; On 2016/09/27 15:57:28, ...
4 years, 2 months ago (2016-09-27 17:00:50 UTC) #41
Łukasz Anforowicz
sky@ - can you please do an OWNERS review for: chrome/browser/prerender/prerender_contents.cc chrome/renderer/chrome_content_renderer_client.cc This CL basically ...
4 years, 2 months ago (2016-09-27 17:07:34 UTC) #43
sky
LGTM
4 years, 2 months ago (2016-09-27 18:45:15 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2352083003/220001
4 years, 2 months ago (2016-09-27 18:55:53 UTC) #51
commit-bot: I haz the power
Committed patchset #12 (id:220001)
4 years, 2 months ago (2016-09-27 19:04:40 UTC) #52
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/953f8c785a134b2b4bd9ff401ff27f7edef4172c Cr-Commit-Position: refs/heads/master@{#421287}
4 years, 2 months ago (2016-09-27 19:09:05 UTC) #54
Łukasz Anforowicz
4 years, 2 months ago (2016-09-27 22:22:19 UTC) #55
Message was sent while issue was closed.
A revert of this CL (patchset #12 id:220001) has been created in
https://codereview.chromium.org/2375623003/ by lukasza@chromium.org.

The reason for reverting is: It seems that tests introduced in this CL are
failing on some non-CQ bots:
https://build.chromium.org/p/chromium.win/builders/Win10%20Tests%20x64/builds...
(and also 4654 and 4655). .

Powered by Google App Engine
This is Rietveld 408576698