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

Issue 2882513005: Propagate opener to BackgroundsContents. (Closed)

Created:
3 years, 7 months ago by Łukasz Anforowicz
Modified:
3 years, 6 months ago
CC:
cbentzel+watch_chromium.org, chili+watch_chromium.org, chromium-apps-reviews_chromium.org, chromium-reviews, creis+watch_chromium.org, darin-cc_chromium.org, davemoore+watch_chromium.org, dewittj+watch_chromium.org, dfaden+virtualkb_google.com, dimich+watch_chromium.org, extensions-reviews_chromium.org, fgorski+watch_chromium.org, gavinp+prer_chromium.org, groby+virtualkb_chromium.org, jam, mfoltz+watch_chromium.org, miu+watch_chromium.org, nasko+codewatch_chromium.org, oka+watchvk_chromium.org, oshima+watch_chromium.org, petewil+watch_chromium.org, romax+watch_chromium.org, tburkard+watch_chromium.org, tfarina, xjz+watch_chromium.org, yhanada+watchvk_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Propagate opener to BackgroundsContents. Before this CL, the opener would be lost: 1. When creating the BackgroundContents: 1.1. The call from WebContentsImpl::CreateNewWindow to Browser::ShouldCreateWebContents didn't propagate |opener| 1.2. WebContents::CreateWithSessionStorage ignored opener-related fields in WebContents::CreateParams. 2. When inspecting the opener - WebContents::GetOpener used to return WebContents rather than RenderFrameHost (misrepresenting an opener that is a subframe). This CL fixes this by: 1. Adding an |opener| parameter to WebContentsDelegate::ShouldCreateWebContents 2. Modifying constructor of BackgroundContents to take a new |opener| parameter and to pass it to WebContents::CreateParams. 3. Modifying WebContents::CreateWithSessionStorage so that it sets the opener on the newly created contents. 4. Changing WebContents::GetOpener and WebContents::GetOriginalOpener methods to return RenderFrameHost. The accurate opener was originally needed for a planned but ultimately abandoned UMA (see https://crbug.com/718516), but having an accurate opener is desirable in general. This CL re-enables AppBackgroundPageApiTest.OpenThenClose which was disabled due to flakiness 4 years ago. This test is where the verification of the opener has to go. I cannot repro the flakiness when trying the test locally (i.e. running the test 30 times individually, and 20 times as part of the whole AppBackgroundPageApiTest suite) or on the trybots (I've tried 3 x win_chromium_rel_ng, linux_chromium_rel_ng and mac_chromium_rel_ng). BUG=165644, 724280 Review-Url: https://codereview.chromium.org/2882513005 Cr-Commit-Position: refs/heads/master@{#477169} Committed: https://chromium.googlesource.com/chromium/src/+/6f8ac625db8fc02373327a9957e6633b62717d0a

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : . #

Patch Set 4 : . #

Total comments: 4

Patch Set 5 : Added (and re-enabled) tests. Suppressed opener propagation in one case. #

Total comments: 7

Patch Set 6 : Tweaked the comment in DriveWebContentsManager::ShouldCreateWebContents #

Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -70 lines) Patch
M chrome/browser/android/document/document_web_contents_delegate.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/android/document/document_web_contents_delegate.cc View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/background/background_contents.h View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/background/background_contents.cc View 3 chunks +7 lines, -0 lines 0 comments Download
M chrome/browser/background/background_contents_service.h View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/background/background_contents_service.cc View 3 chunks +5 lines, -4 lines 0 comments Download
M chrome/browser/chromeos/first_run/drive_first_run_controller.cc View 1 2 3 4 5 3 chunks +8 lines, -3 lines 0 comments Download
M chrome/browser/content_settings/mixed_content_settings_tab_helper.cc View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M chrome/browser/extensions/api/tab_capture/offscreen_tab.h View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/api/tab_capture/offscreen_tab.cc View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/extensions/app_background_page_apitest.cc View 1 2 3 4 7 chunks +82 lines, -14 lines 0 comments Download
M chrome/browser/page_load_metrics/metrics_web_contents_observer.cc View 1 2 3 4 1 chunk +4 lines, -5 lines 0 comments Download
M chrome/browser/prerender/prerender_contents.cc View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc View 1 2 3 4 1 chunk +10 lines, -6 lines 0 comments Download
M chrome/browser/ui/browser.h View 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/ui/browser.cc View 1 2 3 4 5 chunks +5 lines, -3 lines 0 comments Download
M components/offline_pages/content/background_loader/background_loader_contents.h View 1 chunk +1 line, -0 lines 0 comments Download
M components/offline_pages/content/background_loader/background_loader_contents.cc View 1 chunk +1 line, -0 lines 0 comments Download
M components/offline_pages/content/background_loader/background_loader_contents_unittest.cc View 1 1 chunk +3 lines, -3 lines 0 comments Download
M components/web_contents_delegate_android/web_contents_delegate_android.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M components/web_contents_delegate_android/web_contents_delegate_android.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 2 chunks +4 lines, -2 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 6 chunks +39 lines, -27 lines 0 comments Download
M content/public/browser/web_contents.h View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M content/public/browser/web_contents_delegate.h View 1 chunk +1 line, -0 lines 0 comments Download
M content/public/browser/web_contents_delegate.cc View 1 chunk +1 line, -0 lines 0 comments Download
M extensions/browser/guest_view/extension_options/extension_options_guest.h View 1 chunk +1 line, -0 lines 0 comments Download
M extensions/browser/guest_view/extension_options/extension_options_guest.cc View 1 chunk +1 line, -0 lines 0 comments Download
M ui/keyboard/content/keyboard_ui_content.cc View 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/controls/webview/web_dialog_view.h View 1 chunk +1 line, -0 lines 0 comments Download
M ui/views/controls/webview/web_dialog_view.cc View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 64 (39 generated)
Łukasz Anforowicz
nick@, could you PTAL? Without this CL, BackgroundContents won't learn about its opener until the ...
3 years, 7 months ago (2017-05-12 18:20:59 UTC) #18
ncarter (slow)
https://codereview.chromium.org/2882513005/diff/60001/chrome/browser/ui/browser.cc File chrome/browser/ui/browser.cc (right): https://codereview.chromium.org/2882513005/diff/60001/chrome/browser/ui/browser.cc#newcode2625 chrome/browser/ui/browser.cc:2625: opener, MSG_ROUTING_NONE, MSG_ROUTING_NONE, MSG_ROUTING_NONE, profile_, this should be nullptr. ...
3 years, 7 months ago (2017-05-17 20:45:27 UTC) #20
Łukasz Anforowicz
nick@, can you take another look please? I've added extra test verification to AppBackgroundPageApiTest as ...
3 years, 7 months ago (2017-05-22 17:19:27 UTC) #28
ncarter (slow)
lgtm https://codereview.chromium.org/2882513005/diff/80001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc File chrome/browser/page_load_metrics/metrics_web_contents_observer.cc (right): https://codereview.chromium.org/2882513005/diff/80001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc#newcode183 chrome/browser/page_load_metrics/metrics_web_contents_observer.cc:183: ? opener->GetLastCommittedURL() I think this is an accuracy ...
3 years, 7 months ago (2017-05-22 17:32:43 UTC) #30
Łukasz Anforowicz
bmcquade@, could you PTAL at the changes in chrome/browser/page_load_metrics/metrics_web_contents_observer.cc? The CL under review changes WebContents::GetOpener ...
3 years, 7 months ago (2017-05-22 18:25:38 UTC) #32
Bryan McQuade
Thanks! https://codereview.chromium.org/2882513005/diff/80001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc File chrome/browser/page_load_metrics/metrics_web_contents_observer.cc (right): https://codereview.chromium.org/2882513005/diff/80001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc#newcode183 chrome/browser/page_load_metrics/metrics_web_contents_observer.cc:183: ? opener->GetLastCommittedURL() On 2017/05/22 at 18:25:38, Łukasz A. ...
3 years, 7 months ago (2017-05-23 13:57:02 UTC) #33
Łukasz Anforowicz
https://codereview.chromium.org/2882513005/diff/80001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc File chrome/browser/page_load_metrics/metrics_web_contents_observer.cc (right): https://codereview.chromium.org/2882513005/diff/80001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc#newcode183 chrome/browser/page_load_metrics/metrics_web_contents_observer.cc:183: ? opener->GetLastCommittedURL() On 2017/05/23 13:57:02, Bryan McQuade wrote: > ...
3 years, 7 months ago (2017-05-23 18:56:03 UTC) #34
Bryan McQuade
lgtm https://codereview.chromium.org/2882513005/diff/80001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc File chrome/browser/page_load_metrics/metrics_web_contents_observer.cc (right): https://codereview.chromium.org/2882513005/diff/80001/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc#newcode183 chrome/browser/page_load_metrics/metrics_web_contents_observer.cc:183: ? opener->GetLastCommittedURL() On 2017/05/23 at 18:56:03, Łukasz A. ...
3 years, 7 months ago (2017-05-23 19:06:40 UTC) #35
Łukasz Anforowicz
+bauerb@ for chrome/browser/android +hubbe@ for chrome/browser/extensions/api/tab_capture +droger@ for chrome/browser/prerender +dimich@ for components/offline_pages +boliu@ for components/web_contents_delegate_android ...
3 years, 7 months ago (2017-05-23 20:55:56 UTC) #37
boliu
On 2017/05/23 20:55:56, Łukasz A. wrote: > +bauerb@ for chrome/browser/android > +hubbe@ for chrome/browser/extensions/api/tab_capture > ...
3 years, 7 months ago (2017-05-23 21:19:43 UTC) #38
Bernhard Bauer
Android LGTM.
3 years, 7 months ago (2017-05-24 09:34:47 UTC) #39
lfg
guest_view lgtm
3 years, 7 months ago (2017-05-24 14:46:51 UTC) #40
Dmitry Titov
offline_pages lgtm
3 years, 7 months ago (2017-05-24 18:07:52 UTC) #41
hubbe
tab_capture LGTM
3 years, 7 months ago (2017-05-24 18:47:08 UTC) #42
sadrul
lgtm
3 years, 7 months ago (2017-05-25 04:05:51 UTC) #43
Łukasz Anforowicz
davidben@, could you PTAL at chrome/browser/prerender (since droger@ is OOO)? This CL adds a new ...
3 years, 7 months ago (2017-05-25 04:27:36 UTC) #45
davidben
lgtm
3 years, 7 months ago (2017-05-25 17:48:22 UTC) #46
Łukasz Anforowicz
atwilson@, could you PTAL at chrome/browser/background as well as chrome/browser/extensions/app_background_page_apitest.cc and chrome/browser/chromeos/first_run/drive_first_run_controller.cc (even though you ...
3 years, 7 months ago (2017-05-25 18:05:26 UTC) #48
Andrew T Wilson (Slow)
LGTM, although I did have one question about why we're passing in nullptr instead of ...
3 years, 6 months ago (2017-06-05 08:32:46 UTC) #49
Andrew T Wilson (Slow)
LGTM, although I did have one question about why we're passing in nullptr instead of ...
3 years, 6 months ago (2017-06-05 08:32:46 UTC) #50
Łukasz Anforowicz
On 2017/06/05 08:32:46, Andrew T Wilson (Slow) wrote: > LGTM, although I did have one ...
3 years, 6 months ago (2017-06-05 16:57:57 UTC) #51
Łukasz Anforowicz
sky@, could you please do an owners review for //chrome? Most things have already been ...
3 years, 6 months ago (2017-06-05 17:00:47 UTC) #53
sky
Said files LGTM
3 years, 6 months ago (2017-06-05 20:01:30 UTC) #54
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/2882513005/100001
3 years, 6 months ago (2017-06-06 01:08:33 UTC) #61
commit-bot: I haz the power
3 years, 6 months ago (2017-06-06 03:10:42 UTC) #64
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/6f8ac625db8fc02373327a9957e6...

Powered by Google App Engine
This is Rietveld 408576698