New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 724280 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Opener information is unreliable for BackgroundContents / WebContents

Project Member Reported by lukasza@chromium.org, May 18 2017

Issue description

There are two problems:

1. BackgroundContents doesn't see the opener after the background contents are created via window.open, only when the contents are reused via window.open.

2. WebContents::GetOpener and WebContents::GetOriginalOpener return WebContents* rather than RenderFrameHost*.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jun 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6f8ac625db8fc02373327a9957e6633b62717d0a

commit 6f8ac625db8fc02373327a9957e6633b62717d0a
Author: lukasza <lukasza@chromium.org>
Date: Tue Jun 06 03:10:20 2017

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}

[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/android/document/document_web_contents_delegate.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/android/document/document_web_contents_delegate.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/background/background_contents.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/background/background_contents.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/background/background_contents_service.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/background/background_contents_service.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/content_settings/mixed_content_settings_tab_helper.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/extensions/api/tab_capture/offscreen_tab.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/extensions/api/tab_capture/offscreen_tab.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/extensions/app_background_page_apitest.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/prerender/prerender_contents.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/ui/blocked_content/app_modal_dialog_helper.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/ui/browser.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/chrome/browser/ui/browser.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/components/offline_pages/content/background_loader/background_loader_contents.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/components/offline_pages/content/background_loader/background_loader_contents.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/components/offline_pages/content/background_loader/background_loader_contents_unittest.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/components/web_contents_delegate_android/web_contents_delegate_android.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/components/web_contents_delegate_android/web_contents_delegate_android.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/content/browser/web_contents/web_contents_impl.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/content/browser/web_contents/web_contents_impl.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/content/public/browser/web_contents.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/content/public/browser/web_contents_delegate.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/content/public/browser/web_contents_delegate.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/extensions/browser/guest_view/extension_options/extension_options_guest.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/extensions/browser/guest_view/extension_options/extension_options_guest.h
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/ui/keyboard/content/keyboard_ui_content.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/ui/views/controls/webview/web_dialog_view.cc
[modify] https://crrev.com/6f8ac625db8fc02373327a9957e6633b62717d0a/ui/views/controls/webview/web_dialog_view.h

Status: Fixed (was: Started)

Sign in to add a comment