0

Reland "[mojo] Remove DocumentInterfaceBroker"

This is a reland of 3e01d61b62

Removed the remaining #include for frame_host_test_interface.mojom.h

Original change's description:
> [mojo] Remove DocumentInterfaceBroker
>
> This change removes the DocumentInterfaceBroker mojom interface and all
> related plumbing. No functional changes since the interface was not used
> by anything (clients migrated to BrowserInterfaceBroker).
>
> TBR=tommycli@chromium.org,rbpotter@chromium.org,arthursonzogni@chromium.org,kenrb@chromium.org,alexmos@chromium.org,rdevlin.cronin@chromium.org,haraken@chromium.org
>
> Bug: 985120
> Change-Id: I893f940bc2c5d237aac5fb6b3962c06bfa98e938
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881394
> Reviewed-by: Oksana Zhuravlova <oksamyt@chromium.org>
> Reviewed-by: Tommy Li <tommycli@chromium.org>
> Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Reviewed-by: Kentaro Hara <haraken@chromium.org>
> Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
> Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#713278}

Bug: 985120
Change-Id: If3a080592aef38d0c143f6a0d150991c091a4b6d

TBR=tommycli@chromium.org,rbpotter@chromium.org,arthursonzogni@chromium.org,kenrb@chromium.org,alexmos@chromium.org,rdevlin.cronin@chromium.org,haraken@chromium.org

Change-Id: If3a080592aef38d0c143f6a0d150991c091a4b6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903007
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713528}
This commit is contained in:
Oksana Zhuravlova
2019-11-07 19:21:55 +00:00
committed by Commit Bot
parent c98caa3824
commit 977b4b7245
87 changed files with 62 additions and 1605 deletions
components
plugins
printing
content
docs
extensions/renderer
media/blink
third_party/blink
tools/metrics/histograms

@ -21,7 +21,6 @@
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/blink/public/common/page/page_zoom.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom.h"
#include "third_party/blink/public/platform/scheduler/web_thread_scheduler.h"
#include "third_party/blink/public/platform/web_coalesced_input_event.h"
#include "third_party/blink/public/platform/web_url.h"
@ -267,12 +266,8 @@ WebViewPlugin::WebViewHelper::WebViewHelper(WebViewPlugin* plugin,
// ApplyWebPreferences before making a WebLocalFrame so that the frame sees a
// consistent view of our preferences.
content::RenderView::ApplyWebPreferences(preferences, web_view_);
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker;
WebLocalFrame* web_frame = WebLocalFrame::CreateMainFrame(
web_view_, this, nullptr,
document_interface_broker.InitWithNewPipeAndPassReceiver().PassPipe(),
nullptr);
WebLocalFrame* web_frame =
WebLocalFrame::CreateMainFrame(web_view_, this, nullptr, nullptr);
// The created WebFrameWidget is owned by the |web_frame|.
WebFrameWidget::CreateForMainFrame(this, web_frame);

@ -43,7 +43,6 @@
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
#include "third_party/blink/public/common/frame/sandbox_flags.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_data.h"
#include "third_party/blink/public/platform/web_double_size.h"
@ -726,12 +725,8 @@ void PrintRenderFrameHelper::PrintHeaderAndFooter(
};
HeaderAndFooterClient frame_client;
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker;
blink::WebLocalFrame* frame = blink::WebLocalFrame::CreateMainFrame(
web_view, &frame_client, nullptr,
document_interface_broker.InitWithNewPipeAndPassReceiver().PassPipe(),
nullptr);
web_view, &frame_client, nullptr, nullptr);
blink::WebWidgetClient web_widget_client;
blink::WebFrameWidget::CreateForMainFrame(&web_widget_client, frame);
@ -966,12 +961,8 @@ void PrepareFrameAndViewForPrint::CopySelection(
/*compositing_enabled=*/false,
/*opener=*/nullptr);
content::RenderView::ApplyWebPreferences(prefs, web_view);
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker;
blink::WebLocalFrame* main_frame = blink::WebLocalFrame::CreateMainFrame(
web_view, this, nullptr,
document_interface_broker.InitWithNewPipeAndPassReceiver().PassPipe(),
nullptr);
blink::WebLocalFrame* main_frame =
blink::WebLocalFrame::CreateMainFrame(web_view, this, nullptr, nullptr);
frame_.Reset(main_frame);
blink::WebFrameWidget::CreateForMainFrame(this, main_frame);
node_to_print_.Reset();

@ -236,7 +236,7 @@ enum BadMessageReason {
RFH_CHILD_FRAME_NEEDS_OWNER_ELEMENT_TYPE = 208,
OBSOLETE_RFH_INVALID_WEB_REPORTING_CRASH_ID = 209,
RFH_DETACH_MAIN_FRAME = 210,
RFH_DOCUMENT_INTERFACE_BROKER_MISSING = 211,
RFH_BROWSER_INTERFACE_BROKER_MISSING = 211,
RFPH_POST_MESSAGE_INVALID_SOURCE_ORIGIN = 212,
INVALID_INITIATOR_ORIGIN = 213,
RFHI_BEGIN_NAVIGATION_MISSING_INITIATOR_ORIGIN = 214,

@ -178,10 +178,6 @@ FrameTreeNode* FrameTree::AddFrame(
int process_id,
int new_routing_id,
service_manager::mojom::InterfaceProviderRequest interface_provider_request,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver,
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver,
blink::WebTreeScopeType scope,
@ -226,12 +222,6 @@ FrameTreeNode* FrameTree::AddFrame(
added_node->current_frame_host()->BindInterfaceProviderRequest(
std::move(interface_provider_request));
DCHECK(document_interface_broker_content_receiver.is_valid());
DCHECK(document_interface_broker_blink_receiver.is_valid());
added_node->current_frame_host()->BindDocumentInterfaceBrokerReceiver(
std::move(document_interface_broker_content_receiver),
std::move(document_interface_broker_blink_receiver));
DCHECK(browser_interface_broker_receiver.is_valid());
added_node->current_frame_host()->BindBrowserInterfaceBrokerReceiver(
std::move(browser_interface_broker_receiver));

@ -156,10 +156,6 @@ class CONTENT_EXPORT FrameTree {
int new_routing_id,
service_manager::mojom::InterfaceProviderRequest
interface_provider_request,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver,
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver,
blink::WebTreeScopeType scope,

@ -100,8 +100,6 @@ class FrameTreeNodeBlameContextTest : public RenderViewHostImplTestHarness {
tree()->AddFrame(
node, process_id(), child_id,
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(),
base::StringPrintf("uniqueName%d", child_id), false,

@ -57,11 +57,6 @@ CreateStubInterfaceProviderRequest() {
return TestRenderFrameHost::CreateStubInterfaceProviderRequest();
}
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
CreateStubDocumentInterfaceBrokerReceiver() {
return TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver();
}
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
CreateStubBrowserInterfaceBrokerReceiver() {
return TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver();
@ -176,48 +171,36 @@ TEST_F(FrameTreeTest, Shape) {
// Simulate attaching a series of frames to build the frame tree.
frame_tree->AddFrame(
root, process_id, 14, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
root, process_id, 15, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
root, process_id, 16, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
root->child_at(0), process_id, 244, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName3", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
root->child_at(1), process_id, 255, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, no_children_node, "uniqueName4",
false, base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
root->child_at(0), process_id, 245, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName5", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -232,40 +215,30 @@ TEST_F(FrameTreeTest, Shape) {
FrameTreeNode* child_16 = root->child_at(2);
frame_tree->AddFrame(
child_16, process_id, 264, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName6", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
child_16, process_id, 265, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName7", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
child_16, process_id, 266, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName8", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
child_16, process_id, 267, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, deep_subtree, "uniqueName9", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(
child_16, process_id, 268, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName10", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -274,16 +247,12 @@ TEST_F(FrameTreeTest, Shape) {
FrameTreeNode* child_267 = child_16->child_at(3);
frame_tree->AddFrame(
child_267, process_id, 365, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName11", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), false, kOwnerType);
frame_tree->AddFrame(child_267->child_at(0), process_id, 455,
CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName12", false, base::UnguessableToken::Create(),
@ -291,8 +260,6 @@ TEST_F(FrameTreeTest, Shape) {
kOwnerType);
frame_tree->AddFrame(child_267->child_at(0)->child_at(0), process_id, 555,
CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName13", false, base::UnguessableToken::Create(),
@ -300,8 +267,6 @@ TEST_F(FrameTreeTest, Shape) {
kOwnerType);
frame_tree->AddFrame(child_267->child_at(0)->child_at(0)->child_at(0),
process_id, 655, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(),
"uniqueName14", false, base::UnguessableToken::Create(),
@ -380,24 +345,18 @@ TEST_F(FrameTreeTest, FindFrames) {
constexpr auto kOwnerType = blink::FrameOwnerElementType::kIframe;
main_test_rfh()->OnCreateChildFrame(
22, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "child0", "uniqueName0", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), kOwnerType);
main_test_rfh()->OnCreateChildFrame(
23, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "child1", "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), kOwnerType);
main_test_rfh()->OnCreateChildFrame(
24, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -409,8 +368,6 @@ TEST_F(FrameTreeTest, FindFrames) {
// Add one grandchild frame.
child1->current_frame_host()->OnCreateChildFrame(
33, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "grandchild", "uniqueName3", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -453,24 +410,18 @@ TEST_F(FrameTreeTest, GetSibling) {
FrameTreeNode* root = frame_tree->root();
main_test_rfh()->OnCreateChildFrame(
22, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "child0", "uniqueName0", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), kOwnerType);
main_test_rfh()->OnCreateChildFrame(
23, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "child1", "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), kOwnerType);
main_test_rfh()->OnCreateChildFrame(
24, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "child2", "uniqueName2", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -482,8 +433,6 @@ TEST_F(FrameTreeTest, GetSibling) {
// Add one grandchild frame.
child1->current_frame_host()->OnCreateChildFrame(
33, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "grandchild", "uniqueName3", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -519,8 +468,6 @@ TEST_F(FrameTreeTest, ObserverWalksTreeDuringFrameCreation) {
// Simulate attaching a series of frames to build the frame tree.
main_test_rfh()->OnCreateChildFrame(
14, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -531,8 +478,6 @@ TEST_F(FrameTreeTest, ObserverWalksTreeDuringFrameCreation) {
activity.GetLog());
main_test_rfh()->OnCreateChildFrame(
18, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -557,8 +502,6 @@ TEST_F(FrameTreeTest, ObserverWalksTreeAfterCrash) {
constexpr auto kOwnerType = blink::FrameOwnerElementType::kIframe;
main_test_rfh()->OnCreateChildFrame(
22, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -569,8 +512,6 @@ TEST_F(FrameTreeTest, ObserverWalksTreeAfterCrash) {
activity.GetLog());
main_test_rfh()->OnCreateChildFrame(
23, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -603,8 +544,6 @@ TEST_F(FrameTreeTest, FailAddFrameWithWrongProcessId) {
// Simulate attaching a frame from mismatched process id.
ASSERT_FALSE(frame_tree->AddFrame(
root, process_id + 1, 1, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -623,16 +562,12 @@ TEST_F(FrameTreeTest, ProcessCrashClearsGlobalMap) {
constexpr auto kOwnerType = blink::FrameOwnerElementType::kIframe;
main_test_rfh()->OnCreateChildFrame(
22, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
FrameOwnerProperties(), kOwnerType);
main_test_rfh()->OnCreateChildFrame(
23, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -642,8 +577,6 @@ TEST_F(FrameTreeTest, ProcessCrashClearsGlobalMap) {
RenderFrameHostImpl* child1_rfh = root->child_at(0)->current_frame_host();
child1_rfh->OnCreateChildFrame(
33, CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2", false,
base::UnguessableToken::Create(), blink::FramePolicy(),

@ -1971,8 +1971,6 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
main_test_rfh()->OnCreateChildFrame(
process()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), unique_name0, false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2011,8 +2009,6 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
main_test_rfh()->OnCreateChildFrame(
process()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), unique_name1, false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2051,8 +2047,6 @@ TEST_F(NavigationControllerTest, AutoSubframe) {
subframe->OnCreateChildFrame(
process()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), unique_name2, false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2109,8 +2103,6 @@ TEST_F(NavigationControllerTest, BackSubframe) {
main_test_rfh()->OnCreateChildFrame(
process()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), unique_name, false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -3345,8 +3337,6 @@ TEST_F(NavigationControllerTest, SameSubframe) {
main_test_rfh()->OnCreateChildFrame(
process()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), unique_name, false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -3514,8 +3504,6 @@ TEST_F(NavigationControllerTest, SubframeWhilePending) {
main_test_rfh()->OnCreateChildFrame(
process()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), unique_name, false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -4776,8 +4764,6 @@ TEST_F(NavigationControllerTest, SubFrameNavigationUIData) {
main_test_rfh()->OnCreateChildFrame(
process()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), unique_name, false,
base::UnguessableToken::Create(), blink::FramePolicy(),

@ -202,7 +202,6 @@
#include "third_party/blink/public/mojom/appcache/appcache.mojom.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
#include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
#include "third_party/blink/public/mojom/frame/frame_host_test_interface.mojom.h"
#include "third_party/blink/public/mojom/frame/fullscreen.mojom.h"
#include "third_party/blink/public/mojom/loader/pause_subresource_loading_handle.mojom.h"
#include "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom.h"
@ -1816,8 +1815,6 @@ void RenderFrameHostImpl::RenderProcessExited(
SetRenderFrameCreated(false);
InvalidateMojoConnection();
document_scoped_interface_provider_binding_.Close();
document_interface_broker_content_receiver_.reset();
document_interface_broker_blink_receiver_.reset();
broker_receiver_.reset();
SetLastCommittedUrl(GURL());
bundled_exchanges_handle_.reset();
@ -1992,14 +1989,6 @@ bool RenderFrameHostImpl::CreateRenderFrame(int previous_routing_id,
service_manager::mojom::InterfaceProviderPtr interface_provider;
BindInterfaceProviderRequest(mojo::MakeRequest(&interface_provider));
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content;
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink;
BindDocumentInterfaceBrokerReceiver(
document_interface_broker_content.InitWithNewPipeAndPassReceiver(),
document_interface_broker_blink.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker;
BindBrowserInterfaceBrokerReceiver(
@ -2008,8 +1997,6 @@ bool RenderFrameHostImpl::CreateRenderFrame(int previous_routing_id,
mojom::CreateFrameParamsPtr params = mojom::CreateFrameParams::New();
params->interface_bundle = mojom::DocumentScopedInterfaceBundle::New(
interface_provider.PassInterface(),
std::move(document_interface_broker_content),
std::move(document_interface_broker_blink),
std::move(browser_interface_broker));
params->routing_id = routing_id_;
@ -2211,10 +2198,6 @@ void RenderFrameHostImpl::OnCreateChildFrame(
int new_routing_id,
service_manager::mojom::InterfaceProviderRequest
new_interface_provider_provider_request,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver,
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver,
blink::WebTreeScopeType scope,
@ -2228,8 +2211,6 @@ void RenderFrameHostImpl::OnCreateChildFrame(
// TODO(lukasza): Call ReceivedBadMessage when |frame_unique_name| is empty.
DCHECK(!frame_unique_name.empty());
DCHECK(new_interface_provider_provider_request.is_pending());
DCHECK(document_interface_broker_content_receiver.is_valid());
DCHECK(document_interface_broker_blink_receiver.is_valid());
DCHECK(browser_interface_broker_receiver.is_valid());
if (owner_type == blink::FrameOwnerElementType::kNone) {
// Any child frame must have a HTMLFrameOwnerElement in its parent document
@ -2247,15 +2228,11 @@ void RenderFrameHostImpl::OnCreateChildFrame(
return;
// |new_routing_id|, |new_interface_provider_provider_request|,
// |document_interface_broker_content_receiver|,
// |document_interface_broker_blink_receiver|,
// |browser_interface_broker_receiver| and |devtools_frame_token| were
// generated on the browser's IO thread and not taken from the renderer
// process.
frame_tree_->AddFrame(frame_tree_node_, GetProcess()->GetID(), new_routing_id,
std::move(new_interface_provider_provider_request),
std::move(document_interface_broker_content_receiver),
std::move(document_interface_broker_blink_receiver),
std::move(browser_interface_broker_receiver), scope,
frame_name, frame_unique_name, is_created_by_script,
devtools_frame_token, frame_policy,
@ -4236,23 +4213,6 @@ void RenderFrameHostImpl::BindInterfaceProviderRequest(
std::make_unique<ActiveURLMessageFilter>(this));
}
void RenderFrameHostImpl::BindDocumentInterfaceBrokerReceiver(
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
content_receiver,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
blink_receiver) {
DCHECK(!document_interface_broker_content_receiver_.is_bound());
DCHECK(content_receiver.is_valid());
document_interface_broker_content_receiver_.Bind(std::move(content_receiver));
document_interface_broker_content_receiver_.SetFilter(
std::make_unique<ActiveURLMessageFilter>(this));
DCHECK(!document_interface_broker_blink_receiver_.is_bound());
DCHECK(blink_receiver.is_valid());
document_interface_broker_blink_receiver_.Bind(std::move(blink_receiver));
document_interface_broker_blink_receiver_.SetFilter(
std::make_unique<ActiveURLMessageFilter>(this));
}
void RenderFrameHostImpl::BindBrowserInterfaceBrokerReceiver(
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker> receiver) {
DCHECK(receiver.is_valid());
@ -4430,15 +4390,6 @@ void RenderFrameHostImpl::CreateNewWindow(
main_frame->BindInterfaceProviderRequest(
mojo::MakeRequest(&main_frame_interface_provider_info));
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content;
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink;
main_frame->BindDocumentInterfaceBrokerReceiver(
document_interface_broker_content.InitWithNewPipeAndPassReceiver(),
document_interface_broker_blink.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker;
main_frame->BindBrowserInterfaceBrokerReceiver(
@ -4459,8 +4410,6 @@ void RenderFrameHostImpl::CreateNewWindow(
main_frame->GetLocalRenderWidgetHost()->GetRoutingID(), visual_properties,
mojom::DocumentScopedInterfaceBundle::New(
std::move(main_frame_interface_provider_info),
std::move(document_interface_broker_content),
std::move(document_interface_broker_blink),
std::move(browser_interface_broker)),
cloned_namespace->id(), main_frame->GetDevToolsFrameToken());
@ -6657,22 +6606,6 @@ void RenderFrameHostImpl::GetInterface(
}
}
// This is a test-only interface, not exposed in production.
void RenderFrameHostImpl::GetFrameHostTestInterface(
mojo::PendingReceiver<blink::mojom::FrameHostTestInterface> receiver) {
class FrameHostTestInterfaceImpl
: public blink::mojom::FrameHostTestInterface {
public:
void Ping(const GURL& url, const std::string& event) override {}
void GetName(GetNameCallback callback) override {
std::move(callback).Run("RenderFrameHostImpl");
}
};
mojo::MakeSelfOwnedReceiver(std::make_unique<FrameHostTestInterfaceImpl>(),
std::move(receiver));
}
void RenderFrameHostImpl::CreateAppCacheBackend(
mojo::PendingReceiver<blink::mojom::AppCacheBackend> receiver) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@ -7495,13 +7428,7 @@ void RenderFrameHostImpl::DidCommitNavigation(
std::move(interface_provider_request_of_previous_document));
BindInterfaceProviderRequest(
std::move(interface_params->interface_provider_request));
document_interface_broker_content_receiver_.reset();
document_interface_broker_blink_receiver_.reset();
broker_receiver_.reset();
BindDocumentInterfaceBrokerReceiver(
std::move(interface_params->document_interface_broker_content_receiver),
std::move(interface_params->document_interface_broker_blink_receiver));
BindBrowserInterfaceBrokerReceiver(
std::move(interface_params->browser_interface_broker_receiver));
} else {
@ -7514,8 +7441,6 @@ void RenderFrameHostImpl::DidCommitNavigation(
// possibly from a different security origin, will no longer be dispatched.
if (frame_tree_node_->has_committed_real_load()) {
document_scoped_interface_provider_binding_.Close();
document_interface_broker_content_receiver_.reset();
document_interface_broker_blink_receiver_.reset();
broker_receiver_.reset();
bad_message::ReceivedBadMessage(
process, bad_message::RFH_INTERFACE_PROVIDER_MISSING);

@ -86,7 +86,6 @@
#include "third_party/blink/public/mojom/commit_result/commit_result.mojom.h"
#include "third_party/blink/public/mojom/contacts/contacts_manager.mojom.h"
#include "third_party/blink/public/mojom/devtools/devtools_agent.mojom.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
#include "third_party/blink/public/mojom/frame/frame.mojom.h"
#include "third_party/blink/public/mojom/frame/navigation_initiator.mojom.h"
@ -205,7 +204,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
public RenderProcessHostObserver,
public SiteInstanceImpl::Observer,
public service_manager::mojom::InterfaceProvider,
public blink::mojom::DocumentInterfaceBroker,
public blink::mojom::LocalFrameHost,
public CSPContext,
public ui::AXActionHandler {
@ -418,12 +416,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
// interface that the RenderFrameHost corresponding to the child frame should
// bind to expose services to the renderer process. The caller takes care of
// sending down the client end of the pipe to the child RenderFrame to use.
// |document_interface_broker_content_handle| and
// |document_interface_broker_blink_handle| are the pipe handles bound by
// to request ends of DocumentInterfaceProviderInterface in content and blink
// parts of the child frame. RenderFrameHost should bind these handles to
// expose services to the renderer process. The caller takes care of sending
// down the client end of the pipe to the child RenderFrame to use.
// |browser_interface_broker_receiver| is the receiver end of
// BrowserInterfaceBroker interface in the child frame. RenderFrameHost should
// bind this receiver to expose services to the renderer process. The caller
@ -433,10 +425,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
int new_routing_id,
service_manager::mojom::InterfaceProviderRequest
interface_provider_request,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver,
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver,
blink::WebTreeScopeType scope,
@ -890,16 +878,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
service_manager::mojom::InterfaceProviderRequest
interface_provider_request);
// Binds content and blink receiver ends of the DocumentInterfaceProvider
// interface through which services provided by this RenderFrameHost are
// exposed to the corresponding RenderFrame. The caller is responsible for
// plumbing the client ends to the the renderer process.
void BindDocumentInterfaceBrokerReceiver(
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
content_receiver,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
blink_receiver);
// Binds the receiver end of the BrowserInterfaceBroker interface through
// which services provided by this RenderFrameHost are exposed to the
// corresponding RenderFrame. The caller is responsible for plumbing the
@ -1675,11 +1653,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
void GetInterface(const std::string& interface_name,
mojo::ScopedMessagePipeHandle interface_pipe) override;
// blink::mojom::DocumentInterfaceBroker:
void GetFrameHostTestInterface(
mojo::PendingReceiver<blink::mojom::FrameHostTestInterface> receiver)
override;
// Allows tests to disable the swapout event timer to simulate bugs that
// happen before it fires (to avoid flakiness).
void DisableSwapOutTimerForTesting();
@ -2361,15 +2334,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
mojo::Binding<service_manager::mojom::InterfaceProvider>
document_scoped_interface_provider_binding_;
// Receivers for the DocumentInterfaceBroker through which this
// RenderFrameHostImpl exposes document-scoped Mojo services to the currently
// active document in the corresponding RenderFrame. Because of the type
// difference between content and blink, two separate pipes are used.
mojo::Receiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver_{this};
mojo::Receiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver_{this};
// BrowserInterfaceBroker implementation through which this
// RenderFrameHostImpl exposes document-scoped Mojo services to the currently
// active document in the corresponding RenderFrame.

@ -1797,8 +1797,6 @@ TEST_F(RenderFrameHostManagerTestWithSiteIsolation, DetachPendingChild) {
contents()->GetMainFrame()->OnCreateChildFrame(
contents()->GetMainFrame()->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "frame_name", "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -1806,8 +1804,6 @@ TEST_F(RenderFrameHostManagerTestWithSiteIsolation, DetachPendingChild) {
contents()->GetMainFrame()->OnCreateChildFrame(
contents()->GetMainFrame()->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "frame_name", "uniqueName2", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -1950,8 +1946,6 @@ TEST_F(RenderFrameHostManagerTestWithSiteIsolation,
contents1->GetMainFrame()->OnCreateChildFrame(
contents1->GetMainFrame()->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "frame_name", "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2003,8 +1997,6 @@ TEST_F(RenderFrameHostManagerTestWithSiteIsolation,
main_rfh->OnCreateChildFrame(
main_rfh->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2173,8 +2165,6 @@ TEST_F(RenderFrameHostManagerTest, TraverseComplexOpenerChain) {
tree1->AddFrame(
root1, process_id, 12,
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName0", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2182,8 +2172,6 @@ TEST_F(RenderFrameHostManagerTest, TraverseComplexOpenerChain) {
tree1->AddFrame(
root1, process_id, 13,
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2198,8 +2186,6 @@ TEST_F(RenderFrameHostManagerTest, TraverseComplexOpenerChain) {
tree2->AddFrame(
root2, process_id, 22,
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName2", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2207,8 +2193,6 @@ TEST_F(RenderFrameHostManagerTest, TraverseComplexOpenerChain) {
tree2->AddFrame(
root2, process_id, 23,
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName3", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2228,8 +2212,6 @@ TEST_F(RenderFrameHostManagerTest, TraverseComplexOpenerChain) {
tree4->AddFrame(
root4, process_id, 42,
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), "uniqueName4", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2283,8 +2265,6 @@ TEST_F(RenderFrameHostManagerTest, PageFocusPropagatesToSubframeProcesses) {
main_test_rfh()->OnCreateChildFrame(
main_test_rfh()->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "frame1", "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2292,8 +2272,6 @@ TEST_F(RenderFrameHostManagerTest, PageFocusPropagatesToSubframeProcesses) {
main_test_rfh()->OnCreateChildFrame(
main_test_rfh()->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "frame2", "uniqueName2", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2301,8 +2279,6 @@ TEST_F(RenderFrameHostManagerTest, PageFocusPropagatesToSubframeProcesses) {
main_test_rfh()->OnCreateChildFrame(
main_test_rfh()->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "frame3", "uniqueName3", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2401,8 +2377,6 @@ TEST_F(RenderFrameHostManagerTest,
main_test_rfh()->OnCreateChildFrame(
main_test_rfh()->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "frame1", "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -2899,8 +2873,6 @@ TEST_F(RenderFrameHostManagerTestWithSiteIsolation,
main_test_rfh()->OnCreateChildFrame(
main_test_rfh()->GetProcess()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, "frame1", "uniqueName1", false,
base::UnguessableToken::Create(), blink::FramePolicy(),

@ -81,8 +81,6 @@ void CreateChildFrameOnUI(
blink::FrameOwnerElementType owner_type,
int new_routing_id,
mojo::ScopedMessagePipeHandle interface_provider_request_handle,
mojo::ScopedMessagePipeHandle document_interface_broker_content_handle,
mojo::ScopedMessagePipeHandle document_interface_broker_blink_handle,
mojo::ScopedMessagePipeHandle browser_interface_broker_handle) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
RenderFrameHostImpl* render_frame_host =
@ -94,10 +92,6 @@ void CreateChildFrameOnUI(
new_routing_id,
service_manager::mojom::InterfaceProviderRequest(
std::move(interface_provider_request_handle)),
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>(
std::move(document_interface_broker_content_handle)),
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>(
std::move(document_interface_broker_blink_handle)),
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>(
std::move(browser_interface_broker_handle)),
scope, frame_name, frame_unique_name, is_created_by_script,
@ -278,20 +272,6 @@ void RenderFrameMessageFilter::OnCreateChildFrame(
params_reply->new_interface_provider =
interface_provider.PassInterface().PassHandle().release();
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content;
auto document_interface_broker_receiver_content =
document_interface_broker_content.InitWithNewPipeAndPassReceiver();
params_reply->document_interface_broker_content_handle =
document_interface_broker_content.PassPipe().release();
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink;
auto document_interface_broker_receiver_blink =
document_interface_broker_blink.InitWithNewPipeAndPassReceiver();
params_reply->document_interface_broker_blink_handle =
document_interface_broker_blink.PassPipe().release();
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker;
auto browser_interface_broker_receiver =
@ -310,8 +290,6 @@ void RenderFrameMessageFilter::OnCreateChildFrame(
params.frame_policy, params.frame_owner_properties,
params.frame_owner_element_type, params_reply->child_routing_id,
interface_provider_request.PassMessagePipe(),
document_interface_broker_receiver_content.PassPipe(),
document_interface_broker_receiver_blink.PassPipe(),
browser_interface_broker_receiver.PassPipe()));
}

@ -100,16 +100,6 @@ class InterceptAndCancelDidCommitProvisionalLoad
return intercepted_requests_;
}
std::vector<mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>>&
intercepted_broker_content_receivers() {
return intercepted_broker_content_receivers_;
}
std::vector<mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>>&
intercepted_broker_blink_receivers() {
return intercepted_broker_blink_receivers_;
}
protected:
bool WillProcessDidCommitNavigation(
RenderFrameHost* render_frame_host,
@ -123,16 +113,6 @@ class InterceptAndCancelDidCommitProvisionalLoad
*interface_params
? std::move((*interface_params)->interface_provider_request)
: nullptr);
intercepted_broker_content_receivers_.push_back(
*interface_params
? std::move((*interface_params)
->document_interface_broker_content_receiver)
: mojo::NullReceiver());
intercepted_broker_blink_receivers_.push_back(
*interface_params
? std::move(
(*interface_params)->document_interface_broker_blink_receiver)
: mojo::NullReceiver());
if (loop_)
loop_->Quit();
// Do not send the message to the RenderFrameHostImpl.
@ -146,10 +126,6 @@ class InterceptAndCancelDidCommitProvisionalLoad
intercepted_messages_;
std::vector<::service_manager::mojom::InterfaceProviderRequest>
intercepted_requests_;
std::vector<mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>>
intercepted_broker_content_receivers_;
std::vector<mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>>
intercepted_broker_blink_receivers_;
std::unique_ptr<base::RunLoop> loop_;
};

@ -148,10 +148,6 @@ RenderFrameProxyHost* Portal::CreateProxyAndAttachPortal() {
owner_render_frame_host_->GetProcess()->GetID(),
owner_render_frame_host_->GetProcess()->GetNextRoutingID(),
std::move(interface_provider_request),
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver(),
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver(),
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>()
.InitWithNewPipeAndPassReceiver(),
blink::WebTreeScopeType::kDocument, "", "", true,

@ -1501,7 +1501,7 @@ RenderProcessHostImpl::RenderProcessHostImpl(
// This instance of PushMessagingManager is only used from clients
// bound to service workers (i.e. PushProvider), since frame-bound
// clients will rely on DocumentInterfaceBroker instead. Therefore,
// clients will rely on BrowserInterfaceBroker instead. Therefore,
// pass an invalid frame ID here.
//
// Constructing the manager must occur after RegisterHost(), since

@ -134,8 +134,6 @@ TEST_F(RenderProcessHostUnitTest, ReuseCommittedSite) {
main_test_rfh()->OnCreateChildFrame(
process()->GetNextRoutingID(),
TestRenderFrameHost::CreateStubInterfaceProviderRequest(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver(),
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, std::string(), unique_name, false,
base::UnguessableToken::Create(), blink::FramePolicy(),

@ -349,11 +349,6 @@ bool RenderViewHostImpl::CreateRenderView(
mojom::DocumentScopedInterfaceBundle::New();
main_rfh->BindInterfaceProviderRequest(mojo::MakeRequest(
&params->main_frame_interface_bundle->interface_provider));
main_rfh->BindDocumentInterfaceBrokerReceiver(
params->main_frame_interface_bundle->document_interface_broker_content
.InitWithNewPipeAndPassReceiver(),
params->main_frame_interface_bundle->document_interface_broker_blink
.InitWithNewPipeAndPassReceiver());
main_rfh->BindBrowserInterfaceBrokerReceiver(
params->main_frame_interface_bundle->browser_interface_broker
.InitWithNewPipeAndPassReceiver());

@ -749,7 +749,7 @@ class ScopedInterfaceParamsReplacer : public DidCommitNavigationInterceptor {
// rule, see: RenderFrameHostImplBrowserTest.
// InterfaceProviderRequestIsOptionalForFirstCommit.
// TODO(crbug.com/718652): when all clients are converted to use
// DocumentInterfaceBroker, InterfaceProviderRequest-related code will be
// BrowserInterfaceBroker, InterfaceProviderRequest-related code will be
// removed.
IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest,
MissingInterfaceProviderOnNonSameDocumentCommit) {
@ -883,10 +883,6 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, PageStateToWrongEntry) {
std::move(params),
mojom::DidCommitProvisionalLoadInterfaceParams::New(
mojo::MakeRequest(&isolated_interface_provider),
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver(),
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver(),
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()));

@ -6200,10 +6200,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
params->routing_id = frame_routing_id;
params->interface_bundle = mojom::DocumentScopedInterfaceBundle::New();
mojo::MakeRequest(&params->interface_bundle->interface_provider);
ignore_result(params->interface_bundle->document_interface_broker_content
.InitWithNewPipeAndPassReceiver());
ignore_result(params->interface_bundle->document_interface_broker_blink
.InitWithNewPipeAndPassReceiver());
ignore_result(params->interface_bundle->browser_interface_broker
.InitWithNewPipeAndPassReceiver());
params->previous_routing_id = previous_routing_id;
@ -6270,10 +6266,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, ParentDetachRemoteChild) {
params->routing_id = frame_routing_id;
params->interface_bundle = mojom::DocumentScopedInterfaceBundle::New();
mojo::MakeRequest(&params->interface_bundle->interface_provider);
ignore_result(params->interface_bundle->document_interface_broker_content
.InitWithNewPipeAndPassReceiver());
ignore_result(params->interface_bundle->document_interface_broker_blink
.InitWithNewPipeAndPassReceiver());
ignore_result(params->interface_bundle->browser_interface_broker
.InitWithNewPipeAndPassReceiver());
params->previous_routing_id = IPC::mojom::kRoutingIdNone;
@ -14435,10 +14427,6 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
std::move(params),
mojom::DidCommitProvisionalLoadInterfaceParams::New(
mojo::MakeRequest(&interface_provider),
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver(),
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver(),
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()));

@ -5,7 +5,6 @@
module content.mojom;
import "services/service_manager/public/mojom/interface_provider.mojom";
import "third_party/blink/public/mojom/frame/document_interface_broker.mojom";
import "third_party/blink/public/mojom/browser_interface_broker.mojom";
struct DocumentScopedInterfaceBundle {
@ -13,17 +12,10 @@ struct DocumentScopedInterfaceBundle {
// services exposed by its RenderFrameHost.
service_manager.mojom.InterfaceProvider interface_provider;
// The DocumentInterfaceBroker through which the RenderFrame can access
// interfaces exposed by its RenderFrameHost
pending_remote<blink.mojom.DocumentInterfaceBroker>
document_interface_broker_content;
pending_remote<blink.mojom.DocumentInterfaceBroker>
document_interface_broker_blink;
// The BrowserInterfaceBroker through which the RenderFrame can access
// interfaces exposed by its RenderFrameHost
// It will eventually replace interface_provider and
// document_interface_broker* above and become the only way to get
// document-scoped interfaces from the browser (see crbug.com/985120)
// interfaces exposed by its RenderFrameHost.
// It will eventually replace interface_provider above and become the
// only way to get document-scoped interfaces from the browser
// (see crbug.com/985120).
pending_remote<blink.mojom.BrowserInterfaceBroker> browser_interface_broker;
};

@ -377,7 +377,7 @@ interface FrameHost {
// Sent by the renderer when a navigation commits in the frame.
// If |interface_params| is non-empty, the FrameHost implementation
// must unbind the old InterfaceProvider and DocumentInterfaceBroker
// must unbind the old InterfaceProvider and BrowserInterfaceBroker
// connections, and drop any interface requests pending on them.
// Then it should bind the appropriate requests and start servicing
// GetInterface messages coming in on these new connections
@ -387,9 +387,8 @@ interface FrameHost {
// is set for cross-document navigations. This prevents origin confusion by
// ensuring that interface requests racing with navigation commit will be
// either ignored, or serviced correctly in the security context of the
// document they originated from (based on which InterfaceProvider connection
// the GetInterface messages arrive on or DocumentInterfaceBroker
// connection the Get<interface> messages arrive on).
// document they originated from (based on which InterfaceProvider or
// BrowserInterfaceBroker connection the GetInterface messages arrive on).
DidCommitProvisionalLoad(
DidCommitProvisionalLoadParams params,
DidCommitProvisionalLoadInterfaceParams? interface_params);

@ -568,10 +568,6 @@ IPC_STRUCT_END()
IPC_STRUCT_BEGIN(FrameHostMsg_CreateChildFrame_Params_Reply)
IPC_STRUCT_MEMBER(int32_t, child_routing_id)
IPC_STRUCT_MEMBER(mojo::MessagePipeHandle, new_interface_provider)
IPC_STRUCT_MEMBER(mojo::MessagePipeHandle,
document_interface_broker_content_handle)
IPC_STRUCT_MEMBER(mojo::MessagePipeHandle,
document_interface_broker_blink_handle)
IPC_STRUCT_MEMBER(mojo::MessagePipeHandle, browser_interface_broker_handle)
IPC_STRUCT_MEMBER(base::UnguessableToken, devtools_frame_token)
IPC_STRUCT_END()

@ -6,17 +6,12 @@ module content.mojom;
import "services/service_manager/public/mojom/interface_provider.mojom";
import "third_party/blink/public/mojom/browser_interface_broker.mojom";
import "third_party/blink/public/mojom/frame/document_interface_broker.mojom";
[Native]
struct DidCommitProvisionalLoadParams;
struct DidCommitProvisionalLoadInterfaceParams {
service_manager.mojom.InterfaceProvider& interface_provider_request;
pending_receiver<blink.mojom.DocumentInterfaceBroker>
document_interface_broker_content_receiver;
pending_receiver<blink.mojom.DocumentInterfaceBroker>
document_interface_broker_blink_receiver;
pending_receiver<blink.mojom.BrowserInterfaceBroker>
browser_interface_broker_receiver;
};

@ -22,7 +22,6 @@
#include "services/service_manager/public/cpp/binder_registry.h"
#include "third_party/blink/public/common/navigation/triggering_event_info.h"
#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/web/web_navigation_policy.h"
#include "ui/accessibility/ax_mode.h"
@ -173,11 +172,6 @@ class CONTENT_EXPORT RenderFrame : public IPC::Listener,
// interfaces exposed to it by the application running in this frame.
virtual service_manager::InterfaceProvider* GetRemoteInterfaces() = 0;
// Returns the DocumentInterfaceBroker that this process can use to bind
// interfaces exposed to it by the application running in this frame.
virtual blink::mojom::DocumentInterfaceBroker*
GetDocumentInterfaceBroker() = 0;
// Returns the BrowserInterfaceBrokerProxy that this process can use to bind
// interfaces exposed to it by the application running in this frame.
virtual blink::BrowserInterfaceBrokerProxy* GetBrowserInterfaceBroker() = 0;

@ -277,18 +277,6 @@ MockRenderThread::TakeInitialInterfaceProviderRequestForFrame(
return interface_provider_request;
}
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
MockRenderThread::TakeInitialDocumentInterfaceBrokerReceiverForFrame(
int32_t routing_id) {
auto it =
frame_routing_id_to_initial_document_broker_receivers_.find(routing_id);
if (it == frame_routing_id_to_initial_document_broker_receivers_.end())
return mojo::NullReceiver();
auto document_broker_receiver = std::move(it->second);
frame_routing_id_to_initial_document_broker_receivers_.erase(it);
return document_broker_receiver;
}
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
MockRenderThread::TakeInitialBrowserInterfaceBrokerReceiverForFrame(
int32_t routing_id) {
@ -323,21 +311,6 @@ void MockRenderThread::OnCreateChildFrame(
params_reply->new_interface_provider =
interface_provider.PassInterface().PassHandle().release();
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker;
frame_routing_id_to_initial_document_broker_receivers_.emplace(
params_reply->child_routing_id,
document_interface_broker.InitWithNewPipeAndPassReceiver());
params_reply->document_interface_broker_content_handle =
document_interface_broker.PassPipe().release();
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink;
ignore_result(
document_interface_broker_blink.InitWithNewPipeAndPassReceiver());
params_reply->document_interface_broker_blink_handle =
document_interface_broker_blink.PassPipe().release();
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker;
frame_routing_id_to_initial_browser_broker_receivers_.emplace(
@ -391,25 +364,11 @@ void MockRenderThread::OnCreateWindow(
reply->main_frame_route_id,
mojo::MakeRequest(
&reply->main_frame_interface_bundle->interface_provider));
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker;
frame_routing_id_to_initial_document_broker_receivers_.emplace(
reply->main_frame_route_id,
document_interface_broker.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker;
frame_routing_id_to_initial_browser_broker_receivers_.emplace(
reply->main_frame_route_id,
browser_interface_broker.InitWithNewPipeAndPassReceiver());
reply->main_frame_interface_bundle->document_interface_broker_content =
std::move(document_interface_broker);
ignore_result(document_interface_broker.InitWithNewPipeAndPassReceiver());
reply->main_frame_interface_bundle->document_interface_broker_blink =
std::move(document_interface_broker);
reply->main_frame_interface_bundle->browser_interface_broker =
std::move(browser_interface_broker);

@ -20,7 +20,6 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/service_manager/public/mojom/interface_provider.mojom.h"
#include "third_party/blink/public/mojom/browser_interface_broker.mojom.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom.h"
struct FrameHostMsg_CreateChildFrame_Params;
struct FrameHostMsg_CreateChildFrame_Params_Reply;
@ -120,13 +119,6 @@ class MockRenderThread : public RenderThread {
service_manager::mojom::InterfaceProviderRequest
TakeInitialInterfaceProviderRequestForFrame(int32_t routing_id);
// Returns the receiver end of the DocumentInterfaceBroker interface whose
// client end was passed in to construct RenderFrame with |routing_id|; if
// any. The client end will be used by the RenderFrame to service interface
// requests originating from the initial empty document.
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
TakeInitialDocumentInterfaceBrokerReceiverForFrame(int32_t routing_id);
// Returns the receiver end of the BrowserInterfaceBroker interface whose
// client end was passed in to construct RenderFrame with |routing_id|; if
// any. The client end will be used by the RenderFrame to service interface
@ -165,10 +157,6 @@ class MockRenderThread : public RenderThread {
std::map<int32_t, service_manager::mojom::InterfaceProviderRequest>
frame_routing_id_to_initial_interface_provider_requests_;
std::map<int32_t,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>>
frame_routing_id_to_initial_document_broker_receivers_;
std::map<int32_t, mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>>
frame_routing_id_to_initial_browser_broker_receivers_;

@ -428,14 +428,6 @@ void RenderViewTest::SetUp() {
mojo::MakeRequest(
&view_params->main_frame_interface_bundle->interface_provider));
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker;
ignore_result(document_interface_broker.InitWithNewPipeAndPassReceiver());
view_params->main_frame_interface_bundle->document_interface_broker_content =
std::move(document_interface_broker);
ignore_result(document_interface_broker.InitWithNewPipeAndPassReceiver());
view_params->main_frame_interface_bundle->document_interface_broker_blink =
std::move(document_interface_broker);
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker;
// Ignoring the returned PendingReceiver because it is not bound to anything

@ -1359,14 +1359,11 @@ RenderFrameImpl* RenderFrameImpl::Create(
RenderViewImpl* render_view,
int32_t routing_id,
service_manager::mojom::InterfaceProviderPtr interface_provider,
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content,
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker,
const base::UnguessableToken& devtools_frame_token) {
DCHECK(routing_id != MSG_ROUTING_NONE);
CreateParams params(render_view, routing_id, std::move(interface_provider),
std::move(document_interface_broker_content),
std::move(browser_interface_broker),
devtools_frame_token);
@ -1406,26 +1403,16 @@ RenderFrameImpl* RenderFrameImpl::CreateMainFrame(
service_manager::mojom::InterfaceProviderPtr main_frame_interface_provider(
std::move(params->main_frame_interface_bundle->interface_provider));
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content(
std::move(params->main_frame_interface_bundle
->document_interface_broker_content));
RenderFrameImpl* render_frame = RenderFrameImpl::Create(
render_view, params->main_frame_routing_id,
std::move(main_frame_interface_provider),
std::move(document_interface_broker_content),
std::move(params->main_frame_interface_bundle->browser_interface_broker),
params->devtools_main_frame_token);
render_frame->InitializeBlameContext(nullptr);
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink(
std::move(params->main_frame_interface_bundle
->document_interface_broker_blink));
WebLocalFrame* web_frame = WebLocalFrame::CreateMainFrame(
render_view->webview(), render_frame,
render_frame->blink_interface_registry_.get(),
document_interface_broker_blink.PassPipe(), opener,
render_frame->blink_interface_registry_.get(), opener,
// This conversion is a little sad, as this often comes from a
// WebString...
WebString::FromUTF8(params->replicated_frame_state.name),
@ -1474,10 +1461,6 @@ RenderFrameImpl* RenderFrameImpl::CreateMainFrame(
void RenderFrameImpl::CreateFrame(
int routing_id,
service_manager::mojom::InterfaceProviderPtr interface_provider,
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content,
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink,
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker,
int previous_routing_id,
@ -1521,8 +1504,6 @@ void RenderFrameImpl::CreateFrame(
// Create the RenderFrame and WebLocalFrame, linking the two.
render_frame = RenderFrameImpl::Create(
parent_proxy->render_view(), routing_id, std::move(interface_provider),
mojo::Remote<blink::mojom::DocumentInterfaceBroker>(
std::move(document_interface_broker_content)),
std::move(browser_interface_broker), devtools_frame_token);
render_frame->InitializeBlameContext(FromRoutingID(parent_routing_id));
render_frame->unique_name_helper_.set_propagated_name(
@ -1531,7 +1512,7 @@ void RenderFrameImpl::CreateFrame(
replicated_state.scope, WebString::FromUTF8(replicated_state.name),
replicated_state.frame_policy, render_frame,
render_frame->blink_interface_registry_.get(),
document_interface_broker_blink.PassPipe(), previous_sibling_web_frame,
previous_sibling_web_frame,
ConvertFrameOwnerPropertiesToWebFrameOwnerProperties(
frame_owner_properties),
replicated_state.frame_owner_element_type,
@ -1560,16 +1541,13 @@ void RenderFrameImpl::CreateFrame(
render_view = proxy->render_view();
render_frame = RenderFrameImpl::Create(
render_view, routing_id, std::move(interface_provider),
mojo::Remote<blink::mojom::DocumentInterfaceBroker>(
std::move(document_interface_broker_content)),
std::move(browser_interface_broker), devtools_frame_token);
render_frame->InitializeBlameContext(nullptr);
render_frame->previous_routing_id_ = previous_routing_id;
proxy->set_provisional_frame_routing_id(routing_id);
web_frame = blink::WebLocalFrame::CreateProvisional(
render_frame, render_frame->blink_interface_registry_.get(),
document_interface_broker_blink.PassPipe(), proxy->web_frame(),
replicated_state.frame_policy);
proxy->web_frame(), replicated_state.frame_policy);
// The new |web_frame| is a main frame iff the proxy's frame was.
DCHECK_EQ(proxy_is_main_frame, !web_frame->Parent());
}
@ -1804,16 +1782,12 @@ RenderFrameImpl::CreateParams::CreateParams(
RenderViewImpl* render_view,
int32_t routing_id,
service_manager::mojom::InterfaceProviderPtr interface_provider,
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content,
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker,
const base::UnguessableToken& devtools_frame_token)
: render_view(render_view),
routing_id(routing_id),
interface_provider(std::move(interface_provider)),
document_interface_broker_content(
std::move(document_interface_broker_content)),
browser_interface_broker(std::move(browser_interface_broker)),
devtools_frame_token(devtools_frame_token) {}
RenderFrameImpl::CreateParams::~CreateParams() = default;
@ -1861,12 +1835,6 @@ RenderFrameImpl::RenderFrameImpl(CreateParams params)
blink_interface_registry_.reset(new BlinkInterfaceRegistryImpl(
registry_.GetWeakPtr(), associated_interfaces_.GetWeakPtr()));
// The DocumentInterfaceBroker to access Mojo services exposed by the RFHI
// must be provided at construction time. See: https://crbug.com/718652/.
CHECK(params.document_interface_broker_content.is_bound());
document_interface_broker_ =
std::move(params.document_interface_broker_content);
CHECK(params.browser_interface_broker.is_valid());
browser_interface_broker_proxy_.Bind(
std::move(params.browser_interface_broker));
@ -3057,18 +3025,6 @@ service_manager::InterfaceProvider* RenderFrameImpl::GetRemoteInterfaces() {
return &remote_interfaces_;
}
blink::mojom::DocumentInterfaceBroker*
RenderFrameImpl::GetDocumentInterfaceBroker() {
DCHECK(document_interface_broker_.is_bound());
return document_interface_broker_.get();
}
void RenderFrameImpl::SetDocumentInterfaceBrokerForTesting(
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker> test_broker) {
document_interface_broker_.reset();
document_interface_broker_.Bind(std::move(test_broker));
}
blink::AssociatedInterfaceRegistry*
RenderFrameImpl::GetAssociatedInterfaceRegistry() {
return &associated_interfaces_;
@ -4175,28 +4131,8 @@ blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame(
0u),
GetTaskRunner(blink::TaskType::kInternalIPC));
DCHECK(params_reply.document_interface_broker_content_handle.is_valid());
DCHECK(params_reply.document_interface_broker_blink_handle.is_valid());
DCHECK(params_reply.browser_interface_broker_handle.is_valid());
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content;
document_interface_broker_content.Bind(
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>(
mojo::ScopedMessagePipeHandle(
params_reply.document_interface_broker_content_handle),
blink::mojom::DocumentInterfaceBroker::Version_),
GetTaskRunner(blink::TaskType::kInternalIPC));
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink;
document_interface_broker_blink.Bind(
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>(
mojo::ScopedMessagePipeHandle(
params_reply.document_interface_broker_blink_handle),
blink::mojom::DocumentInterfaceBroker::Version_),
GetTaskRunner(blink::TaskType::kInternalIPC));
// This method is always called by local frames, never remote frames.
// Tracing analysis uses this to find main frames when this value is
@ -4208,7 +4144,6 @@ blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame(
RenderFrameImpl* child_render_frame = RenderFrameImpl::Create(
render_view_, params_reply.child_routing_id,
std::move(child_interface_provider),
std::move(document_interface_broker_content),
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>(
mojo::ScopedMessagePipeHandle(
params_reply.browser_interface_broker_handle),
@ -4221,8 +4156,7 @@ blink::WebLocalFrame* RenderFrameImpl::CreateChildFrame(
child_render_frame->InitializeBlameContext(this);
blink::WebLocalFrame* web_frame = parent->CreateLocalChild(
scope, child_render_frame,
child_render_frame->blink_interface_registry_.get(),
document_interface_broker_blink.Unbind().PassPipe());
child_render_frame->blink_interface_registry_.get());
child_render_frame->in_frame_tree_ = true;
child_render_frame->Initialize();
@ -4528,7 +4462,6 @@ void RenderFrameImpl::DidStartProvisionalLoad(
void RenderFrameImpl::DidCommitProvisionalLoad(
const blink::WebHistoryItem& item,
blink::WebHistoryCommitType commit_type,
mojo::ScopedMessagePipeHandle document_interface_broker_blink_handle,
bool should_reset_browser_interface_broker) {
TRACE_EVENT2("navigation,rail", "RenderFrameImpl::didCommitProvisionalLoad",
"id", routing_id_,
@ -4565,8 +4498,6 @@ void RenderFrameImpl::DidCommitProvisionalLoad(
service_manager::mojom::InterfaceProviderRequest
remote_interface_provider_request;
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_receiver;
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver;
@ -4588,22 +4519,6 @@ void RenderFrameImpl::DidCommitProvisionalLoad(
remote_interfaces_.Close();
remote_interfaces_.Bind(std::move(interfaces_provider));
// If we're navigating to a new document, bind |document_interface_broker_|
// to a new message pipe. The receiver end of the new
// DocumentInterfaceBroker interface will be sent over as part of
// DidCommitProvisionalLoad. After the RFHI receives the commit
// confirmation, it will immediately close the old message pipe to avoid
// Get<interface> calls racing with navigation commit, and bind the receiver
// end of the message pipe created here. Must initialize
// |document_interface_broker_| with a new working pipe *before* observers
// receive DidCommitProvisionalLoad, so they can already receive remote
// interfaces. The interface receivers will be serviced once the
// DocumentInterfaceBroker interface receiver is bound by the
// RenderFrameHostImpl.
document_interface_broker_.reset();
document_interface_broker_receiver =
document_interface_broker_.BindNewPipeAndPassReceiver();
// If we're navigating to a new document, bind
// |browser_interface_broker_proxy_| to a new browser interface broker. The
// request end of the new BrowserInterfaceBroker interface will be sent over
@ -4658,9 +4573,6 @@ void RenderFrameImpl::DidCommitProvisionalLoad(
should_reset_browser_interface_broker
? mojom::DidCommitProvisionalLoadInterfaceParams::New(
std::move(remote_interface_provider_request),
std::move(document_interface_broker_receiver),
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>(
std::move(document_interface_broker_blink_handle)),
std::move(browser_interface_broker_receiver))
: nullptr);

@ -219,10 +219,6 @@ class CONTENT_EXPORT RenderFrameImpl
static void CreateFrame(
int routing_id,
service_manager::mojom::InterfaceProviderPtr interface_provider,
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content,
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink,
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker,
int previous_routing_id,
@ -248,8 +244,6 @@ class CONTENT_EXPORT RenderFrameImpl
RenderViewImpl* render_view,
int32_t routing_id,
service_manager::mojom::InterfaceProviderPtr interface_provider,
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content,
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker,
const base::UnguessableToken& devtools_frame_token);
@ -261,8 +255,6 @@ class CONTENT_EXPORT RenderFrameImpl
RenderViewImpl* render_view;
int32_t routing_id;
service_manager::mojom::InterfaceProviderPtr interface_provider;
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content;
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker;
base::UnguessableToken devtools_frame_token;
@ -464,7 +456,6 @@ class CONTENT_EXPORT RenderFrameImpl
const std::string& interface_name,
mojo::ScopedMessagePipeHandle interface_pipe) override;
service_manager::InterfaceProvider* GetRemoteInterfaces() override;
blink::mojom::DocumentInterfaceBroker* GetDocumentInterfaceBroker() override;
blink::AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry() override;
blink::AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
#if BUILDFLAG(ENABLE_PLUGINS)
@ -729,7 +720,6 @@ class CONTENT_EXPORT RenderFrameImpl
void DidCommitProvisionalLoad(
const blink::WebHistoryItem& item,
blink::WebHistoryCommitType commit_type,
mojo::ScopedMessagePipeHandle document_interface_broker_blink_handle,
bool should_reset_browser_interface_broker) override;
void DidCreateNewDocument() override;
void DidClearWindowObject() override;
@ -972,10 +962,6 @@ class CONTENT_EXPORT RenderFrameImpl
void TransferUserActivationFrom(blink::WebLocalFrame* source_frame) override;
// Used in tests to override DocumentInterfaceBroker's methods
void SetDocumentInterfaceBrokerForTesting(
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker> test_broker);
// Used in tests to install a fake WebURLLoaderFactory via
// RenderViewTest::CreateFakeWebURLLoaderFactory().
void SetWebURLLoaderFactoryOverrideForTest(
@ -1059,15 +1045,13 @@ class CONTENT_EXPORT RenderFrameImpl
// Creates a new RenderFrame. |render_view| is the RenderView object that this
// frame belongs to, |interface_provider| is the RenderFrameHost's
// InterfaceProvider through which services are exposed to the RenderFrame,
// and |document_interface_broker_content| is the RenderFrameHost's
// DocumentInterfaceBroker through which services are exposed to the
// and |browser_interface_broker| is the RenderFrameHost's
// BrowserInterfaceBroker through which services are exposed to the
// RenderFrame.
static RenderFrameImpl* Create(
RenderViewImpl* render_view,
int32_t routing_id,
service_manager::mojom::InterfaceProviderPtr interface_provider,
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content,
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker,
const base::UnguessableToken& devtools_frame_token);
@ -1551,8 +1535,6 @@ class CONTENT_EXPORT RenderFrameImpl
service_manager::InterfaceProvider remote_interfaces_;
std::unique_ptr<BlinkInterfaceRegistryImpl> blink_interface_registry_;
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_;
blink::BrowserInterfaceBrokerProxy browser_interface_broker_proxy_;
service_manager::BindSourceInfo local_info_;

@ -38,7 +38,6 @@
#include "content/renderer/render_view_impl.h"
#include "content/test/fake_compositor_dependencies.h"
#include "content/test/frame_host_test_interface.mojom.h"
#include "content/test/test_document_interface_broker.h"
#include "content/test/test_render_frame.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
@ -48,7 +47,6 @@
#include "services/service_manager/public/mojom/interface_provider.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/frame/frame_host_test_interface.mojom.h"
#include "third_party/blink/public/platform/web_runtime_features.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h"
@ -73,9 +71,6 @@ constexpr int32_t kEmbeddedSubframeRouteId = 23;
const char kParentFrameHTML[] = "Parent frame <iframe name='frame'></iframe>";
const char kAutoplayTestOrigin[] = "https://www.google.com";
constexpr char kGetNameTestResponse[] = "TestName";
} // namespace
// RenderFrameImplTest creates a RenderFrameImpl that is a child of the
@ -113,16 +108,6 @@ class RenderFrameImplTest : public RenderViewTest {
service_manager::mojom::InterfaceProviderPtr stub_interface_provider;
mojo::MakeRequest(&stub_interface_provider);
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
stub_document_interface_broker_content;
ignore_result(stub_document_interface_broker_content
.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
stub_document_interface_broker_blink;
ignore_result(
stub_document_interface_broker_blink.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
stub_browser_interface_broker;
ignore_result(
@ -130,8 +115,6 @@ class RenderFrameImplTest : public RenderViewTest {
RenderFrameImpl::CreateFrame(
kSubframeRouteId, std::move(stub_interface_provider),
std::move(stub_document_interface_broker_content),
std::move(stub_document_interface_broker_blink),
std::move(stub_browser_interface_broker), MSG_ROUTING_NONE,
MSG_ROUTING_NONE, kFrameProxyRouteId, MSG_ROUTING_NONE,
base::UnguessableToken::Create(), frame_replication_state,
@ -267,11 +250,6 @@ TEST_F(RenderFrameImplTest, FrameWasShown) {
TEST_F(RenderFrameImplTest, LocalChildFrameWasShown) {
service_manager::mojom::InterfaceProviderPtr stub_interface_provider;
mojo::MakeRequest(&stub_interface_provider);
mojo::Remote<blink::mojom::DocumentInterfaceBroker>
stub_document_interface_broker;
ignore_result(stub_document_interface_broker.BindNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
stub_browser_interface_broker;
ignore_result(stub_browser_interface_broker.InitWithNewPipeAndPassReceiver());
@ -281,15 +259,13 @@ TEST_F(RenderFrameImplTest, LocalChildFrameWasShown) {
RenderFrameImpl* grandchild =
RenderFrameImpl::Create(frame()->render_view(), kEmbeddedSubframeRouteId,
std::move(stub_interface_provider),
std::move(stub_document_interface_broker),
std::move(stub_browser_interface_broker),
base::UnguessableToken::Create());
blink::WebLocalFrame* parent_web_frame = frame()->GetWebFrame();
parent_web_frame->CreateLocalChild(
blink::WebTreeScopeType::kDocument, grandchild,
grandchild->blink_interface_registry_.get(),
stub_document_interface_broker.BindNewPipeAndPassReceiver().PassPipe());
grandchild->blink_interface_registry_.get());
grandchild->in_frame_tree_ = true;
grandchild->Initialize();
@ -521,74 +497,6 @@ struct SourceAnnotation {
}
};
// TODO(crbug.com/718652): this is a blink version of the FrameHostTestInterface
// implementation. The non-blink one will be removed when all clients are
// converted to use DocumentInterfaceBroker.
class BlinkFrameHostTestInterfaceImpl
: public blink::mojom::FrameHostTestInterface {
public:
BlinkFrameHostTestInterfaceImpl() {}
~BlinkFrameHostTestInterfaceImpl() override {}
void BindAndFlush(
mojo::PendingReceiver<blink::mojom::FrameHostTestInterface> receiver) {
receiver_.Bind(std::move(receiver));
receiver_.WaitForIncomingCall();
}
const base::Optional<SourceAnnotation>& ping_source() const {
return ping_source_;
}
protected:
// blink::mojom::FrameHostTestInterface
void Ping(const GURL& url, const std::string& event) override {
ping_source_ = SourceAnnotation{url, event};
}
void GetName(GetNameCallback callback) override {
std::move(callback).Run(kGetNameTestResponse);
}
private:
mojo::Receiver<blink::mojom::FrameHostTestInterface> receiver_{this};
base::Optional<SourceAnnotation> ping_source_;
DISALLOW_COPY_AND_ASSIGN(BlinkFrameHostTestInterfaceImpl);
};
class FrameHostTestDocumentInterfaceBroker
: public TestDocumentInterfaceBroker {
public:
FrameHostTestDocumentInterfaceBroker(
blink::mojom::DocumentInterfaceBroker* document_interface_broker,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker> receiver)
: TestDocumentInterfaceBroker(document_interface_broker,
std::move(receiver)) {}
void GetFrameHostTestInterface(
mojo::PendingReceiver<blink::mojom::FrameHostTestInterface> receiver)
override {
BlinkFrameHostTestInterfaceImpl impl;
impl.BindAndFlush(std::move(receiver));
}
};
TEST_F(RenderFrameImplTest, TestDocumentInterfaceBrokerOverride) {
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker> doc;
FrameHostTestDocumentInterfaceBroker frame_interface_broker(
frame()->GetDocumentInterfaceBroker(),
doc.InitWithNewPipeAndPassReceiver());
frame()->SetDocumentInterfaceBrokerForTesting(std::move(doc));
mojo::Remote<blink::mojom::FrameHostTestInterface> frame_test;
frame()->GetDocumentInterfaceBroker()->GetFrameHostTestInterface(
frame_test.BindNewPipeAndPassReceiver());
frame_test->GetName(base::BindOnce([](const std::string& result) {
EXPECT_EQ(result, kGetNameTestResponse);
}));
frame_interface_broker.Flush();
}
// RenderFrameRemoteInterfacesTest ------------------------------------
namespace {
@ -650,34 +558,6 @@ class TestSimpleInterfaceProviderImpl
DISALLOW_COPY_AND_ASSIGN(TestSimpleInterfaceProviderImpl);
};
class TestSimpleDocumentInterfaceBrokerImpl
: public blink::mojom::DocumentInterfaceBroker {
public:
using BinderCallback = base::RepeatingCallback<void(
mojo::PendingReceiver<blink::mojom::FrameHostTestInterface>)>;
explicit TestSimpleDocumentInterfaceBrokerImpl(BinderCallback binder_callback)
: binder_callback_(binder_callback) {}
void BindAndFlush(
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker> receiver) {
ASSERT_FALSE(receiver_.is_bound());
receiver_.Bind(std::move(receiver));
receiver_.FlushForTesting();
}
private:
// blink::mojom::DocumentInterfaceBroker
void GetFrameHostTestInterface(
mojo::PendingReceiver<blink::mojom::FrameHostTestInterface> receiver)
override {
binder_callback_.Run(std::move(receiver));
}
mojo::Receiver<blink::mojom::DocumentInterfaceBroker> receiver_{this};
BinderCallback binder_callback_;
DISALLOW_COPY_AND_ASSIGN(TestSimpleDocumentInterfaceBrokerImpl);
};
class TestSimpleBrowserInterfaceBrokerImpl
: public blink::mojom::BrowserInterfaceBroker {
public:
@ -759,16 +639,6 @@ class FrameHostTestInterfaceRequestIssuer : public RenderFrameObserver {
!document.IsNull() ? GURL(document.Url()) : GURL(kNoDocumentMarkerURL),
event);
mojo::Remote<blink::mojom::FrameHostTestInterface> blink_remote;
blink::mojom::DocumentInterfaceBroker* document_interface_broker =
render_frame()->GetDocumentInterfaceBroker();
DCHECK(document_interface_broker);
document_interface_broker->GetFrameHostTestInterface(
blink_remote.BindNewPipeAndPassReceiver());
blink_remote->Ping(
!document.IsNull() ? GURL(document.Url()) : GURL(kNoDocumentMarkerURL),
event);
remote.reset();
render_frame()->GetBrowserInterfaceBroker()->GetInterface(
remote.BindNewPipeAndPassReceiver());
@ -891,9 +761,6 @@ class ScopedNewFrameInterfaceProviderExerciser {
interface_request_for_first_document_ =
frame_->TakeLastInterfaceProviderRequest();
document_interface_broker_receiver_for_first_document_ =
frame_->TakeLastDocumentInterfaceBrokerReceiver();
browser_interface_broker_receiver_for_first_document_ =
frame_->TakeLastBrowserInterfaceBrokerReceiver();
}
@ -903,12 +770,6 @@ class ScopedNewFrameInterfaceProviderExerciser {
return std::move(interface_request_for_initial_empty_document_);
}
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_receiver_for_initial_empty_document() {
return std::move(
document_interface_broker_receiver_for_initial_empty_document_);
}
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver_for_initial_empty_document() {
return std::move(
@ -920,11 +781,6 @@ class ScopedNewFrameInterfaceProviderExerciser {
return std::move(interface_request_for_first_document_);
}
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_receiver_for_first_document() {
return std::move(document_interface_broker_receiver_for_first_document_);
}
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver_for_first_document() {
return std::move(browser_interface_broker_receiver_for_first_document_);
@ -950,8 +806,6 @@ class ScopedNewFrameInterfaceProviderExerciser {
interface_request_for_initial_empty_document_ =
frame->TakeLastInterfaceProviderRequest();
document_interface_broker_receiver_for_initial_empty_document_ =
frame->TakeLastDocumentInterfaceBrokerReceiver();
browser_interface_broker_receiver_for_initial_empty_document_ =
frame_->TakeLastBrowserInterfaceBrokerReceiver();
EXPECT_TRUE(frame->current_history_item().IsNull());
@ -970,11 +824,6 @@ class ScopedNewFrameInterfaceProviderExerciser {
service_manager::mojom::InterfaceProviderRequest
interface_request_for_first_document_;
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_receiver_for_initial_empty_document_;
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_receiver_for_first_document_;
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver_for_initial_empty_document_;
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
@ -989,8 +838,6 @@ class ScopedNewFrameInterfaceProviderExerciser {
// FrameHostTestInterface requests.
void ExpectPendingInterfaceRequestsFromSources(
service_manager::mojom::InterfaceProviderRequest interface_provider_request,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_receiver,
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver,
std::vector<SourceAnnotation> expected_sources) {
@ -1010,21 +857,6 @@ void ExpectPendingInterfaceRequestsFromSources(
provider.BindAndFlush(std::move(interface_provider_request));
EXPECT_THAT(sources, ::testing::ElementsAreArray(expected_sources));
std::vector<SourceAnnotation> document_interface_broker_sources;
ASSERT_TRUE(document_interface_broker_receiver.is_valid());
TestSimpleDocumentInterfaceBrokerImpl broker(base::BindLambdaForTesting(
[&document_interface_broker_sources](
mojo::PendingReceiver<blink::mojom::FrameHostTestInterface>
receiver) {
BlinkFrameHostTestInterfaceImpl impl;
impl.BindAndFlush(std::move(receiver));
ASSERT_TRUE(impl.ping_source().has_value());
document_interface_broker_sources.push_back(impl.ping_source().value());
}));
broker.BindAndFlush(std::move(document_interface_broker_receiver));
EXPECT_THAT(document_interface_broker_sources,
::testing::ElementsAreArray(expected_sources));
std::vector<SourceAnnotation> browser_interface_broker_sources;
ASSERT_TRUE(browser_interface_broker_receiver.is_valid());
TestSimpleBrowserInterfaceBrokerImpl browser_broker(
@ -1088,7 +920,7 @@ class RenderFrameRemoteInterfacesTest : public RenderViewTest {
// Expect that |remote_interfaces_| is bound before the first committed load in
// a child frame, and then re-bound on the first commit.
// TODO(crbug.com/718652): when all clients are converted to use
// DocumentInterfaceBroker, InterfaceProviderRequest-related code will be
// BrowserInterfaceBroker, InterfaceProviderRequest-related code will be
// removed.
TEST_F(RenderFrameRemoteInterfacesTest, ChildFrameAtFirstCommittedLoad) {
ScopedNewFrameInterfaceProviderExerciser child_frame_exerciser(
@ -1106,8 +938,6 @@ TEST_F(RenderFrameRemoteInterfacesTest, ChildFrameAtFirstCommittedLoad) {
const GURL initial_empty_url(kAboutBlankURL);
ExpectPendingInterfaceRequestsFromSources(
child_frame_exerciser.interface_request_for_initial_empty_document(),
child_frame_exerciser
.document_interface_broker_receiver_for_initial_empty_document(),
child_frame_exerciser
.browser_interface_broker_receiver_for_initial_empty_document(),
{{GURL(kNoDocumentMarkerURL), kFrameEventDidCreateNewFrame},
@ -1120,8 +950,6 @@ TEST_F(RenderFrameRemoteInterfacesTest, ChildFrameAtFirstCommittedLoad) {
{child_frame_url, kFrameEventDidCreateNewDocument}});
ExpectPendingInterfaceRequestsFromSources(
child_frame_exerciser.interface_request_for_first_document(),
child_frame_exerciser
.document_interface_broker_receiver_for_first_document(),
child_frame_exerciser
.browser_interface_broker_receiver_for_first_document(),
{{child_frame_url, kFrameEventDidCommitProvisionalLoad},
@ -1131,7 +959,7 @@ TEST_F(RenderFrameRemoteInterfacesTest, ChildFrameAtFirstCommittedLoad) {
// Expect that |remote_interfaces_| is bound before the first committed load in
// the main frame of an opened window, and then re-bound on the first commit.
// TODO(crbug.com/718652): when all clients are converted to use
// DocumentInterfaceBroker, InterfaceProviderRequest-related code will be
// BrowserInterfaceBroker, InterfaceProviderRequest-related code will be
// removed.
TEST_F(RenderFrameRemoteInterfacesTest,
MainFrameOfOpenedWindowAtFirstCommittedLoad) {
@ -1162,8 +990,6 @@ TEST_F(RenderFrameRemoteInterfacesTest,
const GURL initial_empty_url;
ExpectPendingInterfaceRequestsFromSources(
main_frame_exerciser.interface_request_for_initial_empty_document(),
main_frame_exerciser
.document_interface_broker_receiver_for_initial_empty_document(),
main_frame_exerciser
.browser_interface_broker_receiver_for_initial_empty_document(),
{{initial_empty_url, kFrameEventDidCreateNewFrame},
@ -1171,8 +997,6 @@ TEST_F(RenderFrameRemoteInterfacesTest,
{new_window_url, kFrameEventDidCreateNewDocument}});
ExpectPendingInterfaceRequestsFromSources(
main_frame_exerciser.interface_request_for_first_document(),
main_frame_exerciser
.document_interface_broker_receiver_for_first_document(),
main_frame_exerciser
.browser_interface_broker_receiver_for_first_document(),
{{new_window_url, kFrameEventDidCommitProvisionalLoad},
@ -1202,7 +1026,7 @@ TEST_F(RenderFrameRemoteInterfacesTest,
// their own DocumentLoader in blink and model them as a real navigation, we
// should add a test case here.
// TODO(crbug.com/718652): when all clients are converted to use
// DocumentInterfaceBroker, InterfaceProviderRequest-related code will be
// BrowserInterfaceBroker, InterfaceProviderRequest-related code will be
// removed.
TEST_F(RenderFrameRemoteInterfacesTest,
ChildFrameReusingWindowOfInitialDocument) {
@ -1228,8 +1052,6 @@ TEST_F(RenderFrameRemoteInterfacesTest,
ExpectPendingInterfaceRequestsFromSources(
child_frame_exerciser.interface_request_for_initial_empty_document(),
child_frame_exerciser
.document_interface_broker_receiver_for_initial_empty_document(),
child_frame_exerciser
.browser_interface_broker_receiver_for_initial_empty_document(),
{{GURL(kNoDocumentMarkerURL), kFrameEventDidCreateNewFrame},
@ -1242,10 +1064,6 @@ TEST_F(RenderFrameRemoteInterfacesTest,
auto request = child_frame_exerciser.interface_request_for_first_document();
ASSERT_FALSE(request.is_pending());
auto document_interface_broker_receiver =
child_frame_exerciser
.document_interface_broker_receiver_for_first_document();
ASSERT_FALSE(document_interface_broker_receiver.is_valid());
auto browser_interface_broker_receiver =
child_frame_exerciser
.browser_interface_broker_receiver_for_first_document();
@ -1256,7 +1074,7 @@ TEST_F(RenderFrameRemoteInterfacesTest,
// Expect that |remote_interfaces_| is bound to a new pipe on cross-document
// navigations.
// TODO(crbug.com/718652): when all clients are converted to use
// DocumentInterfaceBroker, InterfaceProviderRequest-related code will be
// BrowserInterfaceBroker, InterfaceProviderRequest-related code will be
// removed.
TEST_F(RenderFrameRemoteInterfacesTest, ReplacedOnNonSameDocumentNavigation) {
LoadHTMLWithUrlOverride("", kTestFirstURL);
@ -1264,9 +1082,6 @@ TEST_F(RenderFrameRemoteInterfacesTest, ReplacedOnNonSameDocumentNavigation) {
auto interface_provider_request_for_first_document =
GetMainRenderFrame()->TakeLastInterfaceProviderRequest();
auto document_interface_broker_receiver_for_first_document =
GetMainRenderFrame()->TakeLastDocumentInterfaceBrokerReceiver();
auto browser_interface_broker_receiver_for_first_document =
GetMainRenderFrame()->TakeLastBrowserInterfaceBrokerReceiver();
@ -1278,31 +1093,24 @@ TEST_F(RenderFrameRemoteInterfacesTest, ReplacedOnNonSameDocumentNavigation) {
auto interface_provider_request_for_second_document =
GetMainRenderFrame()->TakeLastInterfaceProviderRequest();
auto document_interface_broker_request_for_second_document =
GetMainRenderFrame()->TakeLastDocumentInterfaceBrokerReceiver();
auto browser_interface_broker_receiver_for_second_document =
GetMainRenderFrame()->TakeLastBrowserInterfaceBrokerReceiver();
ASSERT_TRUE(interface_provider_request_for_first_document.is_pending());
ASSERT_TRUE(document_interface_broker_receiver_for_first_document.is_valid());
ASSERT_TRUE(browser_interface_broker_receiver_for_first_document.is_valid());
ExpectPendingInterfaceRequestsFromSources(
std::move(interface_provider_request_for_first_document),
std::move(document_interface_broker_receiver_for_first_document),
std::move(browser_interface_broker_receiver_for_first_document),
{{GURL(kTestFirstURL), kFrameEventAfterCommit},
{GURL(kTestSecondURL), kFrameEventReadyToCommitNavigation},
{GURL(kTestSecondURL), kFrameEventDidCreateNewDocument}});
ASSERT_TRUE(interface_provider_request_for_second_document.is_pending());
ASSERT_TRUE(document_interface_broker_request_for_second_document.is_valid());
ASSERT_TRUE(browser_interface_broker_receiver_for_second_document.is_valid());
ExpectPendingInterfaceRequestsFromSources(
std::move(interface_provider_request_for_second_document),
std::move(document_interface_broker_request_for_second_document),
std::move(browser_interface_broker_receiver_for_second_document),
{{GURL(kTestSecondURL), kFrameEventDidCommitProvisionalLoad},
{GURL(kTestSecondURL), kFrameEventDidCreateDocumentElement}});
@ -1312,7 +1120,7 @@ TEST_F(RenderFrameRemoteInterfacesTest, ReplacedOnNonSameDocumentNavigation) {
// navigations, i.e. the existing InterfaceProvider connection is continued to
// be used.
// TODO(crbug.com/718652): when all clients are converted to use
// DocumentInterfaceBroker, InterfaceProviderRequest-related code will be
// BrowserInterfaceBroker, InterfaceProviderRequest-related code will be
// removed.
TEST_F(RenderFrameRemoteInterfacesTest, ReusedOnSameDocumentNavigation) {
LoadHTMLWithUrlOverride("", kTestFirstURL);
@ -1320,9 +1128,6 @@ TEST_F(RenderFrameRemoteInterfacesTest, ReusedOnSameDocumentNavigation) {
auto interface_provider_request =
GetMainRenderFrame()->TakeLastInterfaceProviderRequest();
auto document_interface_broker =
GetMainRenderFrame()->TakeLastDocumentInterfaceBrokerReceiver();
auto browser_interface_broker_receiver =
GetMainRenderFrame()->TakeLastBrowserInterfaceBrokerReceiver();
@ -1332,17 +1137,11 @@ TEST_F(RenderFrameRemoteInterfacesTest, ReusedOnSameDocumentNavigation) {
EXPECT_FALSE(
GetMainRenderFrame()->TakeLastInterfaceProviderRequest().is_pending());
EXPECT_FALSE(GetMainRenderFrame()
->TakeLastDocumentInterfaceBrokerReceiver()
.is_valid());
ASSERT_TRUE(interface_provider_request.is_pending());
ASSERT_TRUE(document_interface_broker.is_valid());
ASSERT_TRUE(browser_interface_broker_receiver.is_valid());
ExpectPendingInterfaceRequestsFromSources(
std::move(interface_provider_request),
std::move(document_interface_broker),
std::move(browser_interface_broker_receiver),
{{GURL(kTestFirstURL), kFrameEventDidCommitSameDocumentLoad}});
}

@ -2045,19 +2045,11 @@ void RenderThreadImpl::CreateFrame(mojom::CreateFrameParamsPtr params) {
CompositorDependencies* compositor_deps = this;
service_manager::mojom::InterfaceProviderPtr interface_provider(
std::move(params->interface_bundle->interface_provider));
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content(std::move(
params->interface_bundle->document_interface_broker_content));
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink(
std::move(params->interface_bundle->document_interface_broker_blink));
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker(
std::move(params->interface_bundle->browser_interface_broker));
RenderFrameImpl::CreateFrame(
params->routing_id, std::move(interface_provider),
std::move(document_interface_broker_content),
std::move(document_interface_broker_blink),
std::move(browser_interface_broker), params->previous_routing_id,
params->opener_routing_id, params->parent_routing_id,
params->previous_sibling_routing_id, params->devtools_frame_token,

@ -1104,14 +1104,6 @@ TEST_F(RenderViewImplEnableZoomForDSFTest, UpdateDSFAfterSwapIn) {
int routing_id = kProxyRoutingId + 1;
service_manager::mojom::InterfaceProviderPtr stub_interface_provider;
mojo::MakeRequest(&stub_interface_provider);
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
stub_document_interface_broker_content;
ignore_result(
stub_document_interface_broker_content.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
stub_document_interface_broker_blink;
ignore_result(
stub_document_interface_broker_blink.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
stub_browser_interface_broker;
ignore_result(stub_browser_interface_broker.InitWithNewPipeAndPassReceiver());
@ -1123,8 +1115,6 @@ TEST_F(RenderViewImplEnableZoomForDSFTest, UpdateDSFAfterSwapIn) {
widget_params.visual_properties = test_visual_properties;
RenderFrameImpl::CreateFrame(
routing_id, std::move(stub_interface_provider),
std::move(stub_document_interface_broker_content),
std::move(stub_document_interface_broker_blink),
std::move(stub_browser_interface_broker), kProxyRoutingId,
MSG_ROUTING_NONE, MSG_ROUTING_NONE, MSG_ROUTING_NONE,
base::UnguessableToken::Create(), replication_state, nullptr,
@ -1182,22 +1172,12 @@ TEST_F(RenderViewImplTest, DetachingProxyAlsoDestroysProvisionalFrame) {
int routing_id = kProxyRoutingId + 1;
service_manager::mojom::InterfaceProviderPtr stub_interface_provider;
mojo::MakeRequest(&stub_interface_provider);
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
stub_document_interface_broker_content;
ignore_result(
stub_document_interface_broker_content.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>
stub_document_interface_broker_blink;
ignore_result(
stub_document_interface_broker_blink.InitWithNewPipeAndPassReceiver());
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
stub_browser_interface_broker;
ignore_result(stub_browser_interface_broker.InitWithNewPipeAndPassReceiver());
RenderFrameImpl::CreateFrame(
routing_id, std::move(stub_interface_provider),
std::move(stub_document_interface_broker_content),
std::move(stub_document_interface_broker_blink),
std::move(stub_browser_interface_broker), kProxyRoutingId,
MSG_ROUTING_NONE, frame()->GetRoutingID(), MSG_ROUTING_NONE,
base::UnguessableToken::Create(), replication_state, nullptr,

@ -1394,10 +1394,6 @@ WebView* RenderViewImpl::CreateView(
view_params
->main_frame_interface_bundle = mojom::DocumentScopedInterfaceBundle::New(
std::move(reply->main_frame_interface_bundle->interface_provider),
std::move(reply->main_frame_interface_bundle
->document_interface_broker_content),
std::move(
reply->main_frame_interface_bundle->document_interface_broker_blink),
std::move(reply->main_frame_interface_bundle->browser_interface_broker));
view_params->main_frame_widget_routing_id = reply->main_frame_widget_route_id;
view_params->session_storage_namespace_id =

@ -300,8 +300,6 @@ jumbo_static_library("test_support") {
"test_content_browser_client.h",
"test_content_client.cc",
"test_content_client.h",
"test_document_interface_broker.cc",
"test_document_interface_broker.h",
"test_mojo_proxy_resolver_factory.cc",
"test_mojo_proxy_resolver_factory.h",
"test_navigation_url_loader.cc",

@ -344,13 +344,6 @@ NavigationSimulatorImpl::NavigationSimulatorImpl(
service_manager::mojom::InterfaceProviderPtr stub_interface_provider;
interface_provider_request_ = mojo::MakeRequest(&stub_interface_provider);
document_interface_broker_content_receiver_ =
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver();
document_interface_broker_blink_receiver_ =
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver();
browser_interface_broker_receiver_ =
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>()
.InitWithNewPipeAndPassReceiver();
@ -597,8 +590,6 @@ void NavigationSimulatorImpl::Commit() {
if (same_document_) {
interface_provider_request_ = nullptr;
document_interface_broker_content_receiver_.reset();
document_interface_broker_blink_receiver_.reset();
browser_interface_broker_receiver_.reset();
}
@ -617,8 +608,6 @@ void NavigationSimulatorImpl::Commit() {
false /* same_document */, false /* failed_navigation */);
render_frame_host_->SimulateCommitProcessed(
request_, std::move(params), std::move(interface_provider_request_),
std::move(document_interface_broker_content_receiver_),
std::move(document_interface_broker_blink_receiver_),
std::move(browser_interface_broker_receiver_), same_document_);
// Simulate the UnloadACK in the old RenderFrameHost if it was swapped out at
@ -764,8 +753,6 @@ void NavigationSimulatorImpl::CommitErrorPage() {
false /* same_document */, true /* failed_navigation */);
render_frame_host_->SimulateCommitProcessed(
request_, std::move(params), std::move(interface_provider_request_),
std::move(document_interface_broker_content_receiver_),
std::move(document_interface_broker_blink_receiver_),
std::move(browser_interface_broker_receiver_), false /* same_document */);
// Simulate the UnloadACK in the old RenderFrameHost if it was swapped out at
@ -798,14 +785,10 @@ void NavigationSimulatorImpl::CommitSameDocument() {
true /* same_document */, false /* failed_navigation */);
interface_provider_request_ = nullptr;
document_interface_broker_content_receiver_.reset();
document_interface_broker_blink_receiver_.reset();
browser_interface_broker_receiver_.reset();
render_frame_host_->SimulateCommitProcessed(
request_, std::move(params), nullptr /* interface_provider_request_ */,
mojo::NullReceiver() /* document_interface_broker_content_receiver */,
mojo::NullReceiver() /* document_interface_broker_blink_receiver */,
mojo::NullReceiver() /* browser_interface_broker_receiver */,
true /* same_document */);

@ -22,7 +22,6 @@
#include "net/base/host_port_pair.h"
#include "net/base/ip_endpoint.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom.h"
#include "third_party/blink/public/mojom/referrer.mojom.h"
#include "url/gurl.h"
@ -284,10 +283,6 @@ class NavigationSimulatorImpl : public NavigationSimulator,
int session_history_offset_ = 0;
bool has_user_gesture_ = true;
service_manager::mojom::InterfaceProviderRequest interface_provider_request_;
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver_;
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver_;
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver_;
std::string contents_mime_type_;

@ -1,26 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/test/test_document_interface_broker.h"
namespace content {
TestDocumentInterfaceBroker::TestDocumentInterfaceBroker(
blink::mojom::DocumentInterfaceBroker* document_interface_broker,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker> receiver)
: real_broker_(document_interface_broker),
receiver_(this, std::move(receiver)) {}
TestDocumentInterfaceBroker::~TestDocumentInterfaceBroker() {}
blink::mojom::DocumentInterfaceBroker*
TestDocumentInterfaceBroker::GetForwardingInterface() {
return real_broker_;
}
void TestDocumentInterfaceBroker::Flush() {
receiver_.FlushForTesting();
}
} // namespace content

@ -1,36 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_TEST_TEST_DOCUMENT_INTERFACE_BROKER_H_
#define CONTENT_TEST_TEST_DOCUMENT_INTERFACE_BROKER_H_
#include <utility>
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-test-utils.h"
namespace content {
// This class can be subclassed to override specific methods of RenderFrame's
// DocumentInterfaceBroker in tests. The rest of the calls will be forwarded to
// the implementation passed to the constructor (typically returned by
// RenderFrame::GetDocumentInterfaceBroker()).
class TestDocumentInterfaceBroker
: public blink::mojom::DocumentInterfaceBrokerInterceptorForTesting {
public:
TestDocumentInterfaceBroker(
blink::mojom::DocumentInterfaceBroker* document_interface_broker,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker> receiver);
~TestDocumentInterfaceBroker() override;
blink::mojom::DocumentInterfaceBroker* GetForwardingInterface() override;
void Flush();
private:
blink::mojom::DocumentInterfaceBroker* real_broker_;
mojo::Receiver<DocumentInterfaceBroker> receiver_;
};
} // namespace content
#endif // CONTENT_TEST_TEST_DOCUMENT_INTERFACE_BROKER_H_

@ -49,11 +49,6 @@ class MockFrameHost : public mojom::FrameHost {
return std::move(last_interface_provider_request_);
}
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
TakeLastDocumentInterfaceBrokerReceiver() {
return std::move(last_document_interface_broker_receiver_);
}
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
TakeLastBrowserInterfaceBrokerReceiver() {
return std::move(last_browser_interface_broker_receiver_);
@ -74,17 +69,6 @@ class MockFrameHost : public mojom::FrameHost {
last_interface_provider_request_ = std::move(interface_provider_request);
}
// Holds on to the receiver end of the DocumentInterfaceBroker interface whose
// client end is bound to the corresponding RenderFrame's
// |document_interface_broker_| to facilitate retrieving the most recent
// |document_interface_broker_receiver| in tests.
void PassLastDocumentInterfaceBrokerReceiver(
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_receiver) {
last_document_interface_broker_receiver_ =
std::move(document_interface_broker_receiver);
}
// Holds on to the request end of the BrowserInterfaceBroker interface whose
// client end is bound to the corresponding RenderFrame's
// |browser_interface_broker_proxy_| to facilitate retrieving the most recent
@ -104,10 +88,6 @@ class MockFrameHost : public mojom::FrameHost {
if (interface_params) {
last_interface_provider_request_ =
std::move(interface_params->interface_provider_request);
last_document_interface_broker_receiver_ =
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>(
std::move(interface_params
->document_interface_broker_content_receiver));
last_browser_interface_broker_receiver_ =
std::move(interface_params->browser_interface_broker_receiver);
}
@ -222,8 +202,6 @@ class MockFrameHost : public mojom::FrameHost {
last_commit_params_;
service_manager::mojom::InterfaceProviderRequest
last_interface_provider_request_;
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
last_document_interface_broker_receiver_;
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
last_browser_interface_broker_receiver_;
@ -247,9 +225,6 @@ TestRenderFrame::TestRenderFrame(RenderFrameImpl::CreateParams params)
mock_frame_host_->PassLastInterfaceProviderRequest(
mock_render_thread->TakeInitialInterfaceProviderRequestForFrame(
params.routing_id));
mock_frame_host_->PassLastDocumentInterfaceBrokerReceiver(
mock_render_thread->TakeInitialDocumentInterfaceBrokerReceiverForFrame(
params.routing_id));
mock_frame_host_->PassLastBrowserInterfaceBrokerReceiver(
mock_render_thread->TakeInitialBrowserInterfaceBrokerReceiverForFrame(
params.routing_id));
@ -399,11 +374,6 @@ TestRenderFrame::TakeLastInterfaceProviderRequest() {
return mock_frame_host_->TakeLastInterfaceProviderRequest();
}
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
TestRenderFrame::TakeLastDocumentInterfaceBrokerReceiver() {
return mock_frame_host_->TakeLastDocumentInterfaceBrokerReceiver();
}
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
TestRenderFrame::TakeLastBrowserInterfaceBrokerReceiver() {
return mock_frame_host_->TakeLastBrowserInterfaceBrokerReceiver();

@ -78,9 +78,6 @@ class TestRenderFrame : public RenderFrameImpl {
service_manager::mojom::InterfaceProviderRequest
TakeLastInterfaceProviderRequest();
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
TakeLastDocumentInterfaceBrokerReceiver();
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
TakeLastBrowserInterfaceBrokerReceiver();

@ -135,8 +135,6 @@ TestRenderFrameHost* TestRenderFrameHost::AppendChild(
std::string frame_unique_name = base::GenerateGUID();
OnCreateChildFrame(
GetProcess()->GetNextRoutingID(), CreateStubInterfaceProviderRequest(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubDocumentInterfaceBrokerReceiver(),
CreateStubBrowserInterfaceBrokerReceiver(),
blink::WebTreeScopeType::kDocument, frame_name, frame_unique_name, false,
base::UnguessableToken::Create(), blink::FramePolicy(),
@ -434,10 +432,6 @@ void TestRenderFrameHost::SimulateCommitProcessed(
NavigationRequest* navigation_request,
std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params,
service_manager::mojom::InterfaceProviderRequest interface_provider_request,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver,
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver,
bool same_document) {
@ -455,8 +449,6 @@ void TestRenderFrameHost::SimulateCommitProcessed(
.Run(std::move(params),
mojom::DidCommitProvisionalLoadInterfaceParams::New(
std::move(interface_provider_request),
std::move(document_interface_broker_content_receiver),
std::move(document_interface_broker_blink_receiver),
std::move(browser_interface_broker_receiver)));
did_commit = true;
}
@ -468,8 +460,6 @@ void TestRenderFrameHost::SimulateCommitProcessed(
.Run(std::move(params),
mojom::DidCommitProvisionalLoadInterfaceParams::New(
std::move(interface_provider_request),
std::move(document_interface_broker_content_receiver),
std::move(document_interface_broker_blink_receiver),
std::move(browser_interface_broker_receiver)));
did_commit = true;
}
@ -481,8 +471,6 @@ void TestRenderFrameHost::SimulateCommitProcessed(
params.get(),
mojom::DidCommitProvisionalLoadInterfaceParams::New(
std::move(interface_provider_request),
std::move(document_interface_broker_content_receiver),
std::move(document_interface_broker_blink_receiver),
std::move(browser_interface_broker_receiver)),
same_document);
}
@ -605,21 +593,11 @@ TestRenderFrameHost::BuildDidCommitInterfaceParams(bool is_same_document) {
service_manager::mojom::InterfaceProviderPtr interface_provider;
service_manager::mojom::InterfaceProviderRequest interface_provider_request;
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver;
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver;
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver;
if (!is_same_document) {
interface_provider_request = mojo::MakeRequest(&interface_provider);
document_interface_broker_content_receiver =
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver();
document_interface_broker_blink_receiver =
mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver();
browser_interface_broker_receiver =
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>()
.InitWithNewPipeAndPassReceiver();
@ -627,8 +605,6 @@ TestRenderFrameHost::BuildDidCommitInterfaceParams(bool is_same_document) {
auto interface_params = mojom::DidCommitProvisionalLoadInterfaceParams::New(
std::move(interface_provider_request),
std::move(document_interface_broker_content_receiver),
std::move(document_interface_broker_blink_receiver),
std::move(browser_interface_broker_receiver));
return interface_params;
}
@ -645,13 +621,6 @@ TestRenderFrameHost::CreateStubInterfaceProviderRequest() {
return mojo::MakeRequest(&dead_interface_provider_proxy);
}
// static
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
TestRenderFrameHost::CreateStubDocumentInterfaceBrokerReceiver() {
return mojo::PendingRemote<::blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver();
}
// static
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
TestRenderFrameHost::CreateStubBrowserInterfaceBrokerReceiver() {

@ -155,10 +155,6 @@ class TestRenderFrameHost : public RenderFrameHostImpl,
std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params,
service_manager::mojom::InterfaceProviderRequest
interface_provider_request,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_content_receiver,
mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
document_interface_broker_blink_receiver,
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver,
bool same_document);
@ -182,11 +178,6 @@ class TestRenderFrameHost : public RenderFrameHostImpl,
static service_manager::mojom::InterfaceProviderRequest
CreateStubInterfaceProviderRequest();
// Returns a pending PendingReceiver<DocumentInterfaceBroker> that is safe to
// bind to an implementation, but will never receive any interface requests.
static mojo::PendingReceiver<blink::mojom::DocumentInterfaceBroker>
CreateStubDocumentInterfaceBrokerReceiver();
// Returns a PendingReceiver<BrowserInterfaceBroker> that is safe to bind to
// an implementation, but will never receive any interface requests.
static mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>

@ -300,12 +300,6 @@ than whatever would normally service them in the browser process.
The current way to set up that sort of thing looks like
[this](https://cs.chromium.org/chromium/src/third_party/blink/web_tests/battery-status/resources/mock-battery-monitor.js?rcl=be6e0001855f7f1cfc26205d0ff5a2b5b324fcbd&l=19).
*** aside
**NOTE:** The above approach to mocking in JS no longer applies when using
the new recommended `DocumentInterfaceBroker` approach to exposing interfaces
to documents. New JS mocking support is in development for this.
***
#### Feature Impls That Depend on Blink Headers
In the course of servicifying a feature that has Blink as a client, you might
encounter cases where the feature implementation has dependencies on Blink

@ -9,7 +9,6 @@ include_rules = [
"+third_party/cld_3",
"+third_party/blink/public/mojom/devtools/console_message.mojom.h",
"+third_party/blink/public/mojom/frame/document_interface_broker.mojom.h",
"+third_party/blink/public/mojom/service_worker/service_worker_registration.mojom.h",
"+third_party/blink/public/platform",
"+third_party/blink/public/strings/grit/blink_strings.h",

@ -5,31 +5,21 @@
#include "extensions/renderer/scoped_web_frame.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom.h"
#include "third_party/blink/public/web/web_heap.h"
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/public/web/web_widget.h"
namespace extensions {
// returns a valid handle that can be passed to WebLocalFrame constructor
mojo::ScopedMessagePipeHandle CreateStubDocumentInterfaceBrokerHandle() {
return mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe();
}
ScopedWebFrame::ScopedWebFrame()
: view_(blink::WebView::Create(/*client=*/nullptr,
/*is_hidden=*/false,
/*compositing_enabled=*/false,
/*opener=*/nullptr)),
frame_(blink::WebLocalFrame::CreateMainFrame(
view_,
&frame_client_,
nullptr,
CreateStubDocumentInterfaceBrokerHandle(),
nullptr)) {}
frame_(blink::WebLocalFrame::CreateMainFrame(view_,
&frame_client_,
nullptr,
nullptr)) {}
ScopedWebFrame::~ScopedWebFrame() {
view_->Close();

@ -51,7 +51,6 @@
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom.h"
#include "third_party/blink/public/platform/media/webmediaplayer_delegate.h"
#include "third_party/blink/public/platform/web_fullscreen_video_status.h"
#include "third_party/blink/public/platform/web_media_player.h"
@ -102,13 +101,6 @@ MATCHER_P2(PlaybackRateChanged, old_rate_string, new_rate_string, "") {
std::string(new_rate_string));
}
// returns a valid handle that can be passed to WebLocalFrame constructor
mojo::ScopedMessagePipeHandle CreateStubDocumentInterfaceBrokerHandle() {
return mojo::PendingRemote<blink::mojom::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe();
}
class MockWebMediaPlayerClient : public blink::WebMediaPlayerClient {
public:
MockWebMediaPlayerClient() = default;
@ -314,12 +306,11 @@ class WebMediaPlayerImplTest : public testing::Test {
/*is_hidden=*/false,
/*compositing_enabled=*/false,
nullptr)),
web_local_frame_(blink::WebLocalFrame::CreateMainFrame(
web_view_,
&web_frame_client_,
nullptr,
CreateStubDocumentInterfaceBrokerHandle(),
nullptr)),
web_local_frame_(
blink::WebLocalFrame::CreateMainFrame(web_view_,
&web_frame_client_,
nullptr,
nullptr)),
context_provider_(viz::TestContextProvider::Create()),
audio_parameters_(TestAudioParameters::Normal()) {
media_thread_.StartAndWaitForTesting();

@ -52,10 +52,8 @@ mojom("mojom_platform") {
"fetch/fetch_api_response.mojom",
"file/file_utilities.mojom",
"filesystem/file_system.mojom",
"frame/document_interface_broker.mojom",
"frame/find_in_page.mojom",
"frame/frame.mojom",
"frame/frame_host_test_interface.mojom",
"frame/fullscreen.mojom",
"frame/lifecycle.mojom",
"frame/navigation_initiator.mojom",

@ -1,18 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
import "third_party/blink/public/mojom/frame/frame_host_test_interface.mojom";
// An interface through which the renderer may request document-scoped
// interfaces from the browser.
interface DocumentInterfaceBroker {
// Binds the blink.mojom.FrameHostTestInterface pending receiver to its
// remote implementation in the browser process, to allow using this test
// interface to exercise requesting document-scoped interfaces from the
// RenderFrameHost through the DocumentInterfaceBroker interface.
GetFrameHostTestInterface(
pending_receiver<blink.mojom.FrameHostTestInterface> receiver);
};

@ -1,26 +0,0 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
import "url/mojom/url.mojom";
// TODO(crbug.com/718652) This is a copy of
// content/test/frame_host_test_interface.mojom to be used in parallel while
// InterfaceProvider->DocumentInterfaceBroker conversion is taking place.
// Test interface used in RenderFrame and RenderFrameHost tests to exercise
// requesting document-scoped interfaces from the RenderFrameHost through
// the DocumentInterfaceBroker interface.
//
// The `Ping` method is invoked by clients immediately after making the
// FrameHostTestInterfaceRequest, so as to annotate where the request
// originates from. This allows verification that the request was delivered /
// not delivered to a certain DocumentInterfaceBroker implementation.
interface FrameHostTestInterface {
Ping(url.mojom.Url source_url, string source_event);
// Used in tests to distinguish between the different implementations
// and verify that interface requests are routed to the proper override.
GetName() => (string name);
};

@ -84,7 +84,6 @@ class WebLocalFrame : public WebFrame {
WebView*,
WebLocalFrameClient*,
blink::InterfaceRegistry*,
mojo::ScopedMessagePipeHandle,
WebFrame* opener = nullptr,
const WebString& name = WebString(),
WebSandboxFlags = WebSandboxFlags::kNone,
@ -112,7 +111,6 @@ class WebLocalFrame : public WebFrame {
BLINK_EXPORT static WebLocalFrame* CreateProvisional(
WebLocalFrameClient*,
blink::InterfaceRegistry*,
mojo::ScopedMessagePipeHandle,
WebFrame* previous_web_frame,
const FramePolicy&);
@ -121,8 +119,7 @@ class WebLocalFrame : public WebFrame {
// it's no longer needed.
virtual WebLocalFrame* CreateLocalChild(WebTreeScopeType,
WebLocalFrameClient*,
blink::InterfaceRegistry*,
mojo::ScopedMessagePipeHandle) = 0;
blink::InterfaceRegistry*) = 0;
// Returns the WebFrame associated with the current V8 context. This
// function can return 0 if the context is associated with a Document that

@ -399,14 +399,6 @@ class BLINK_EXPORT WebLocalFrameClient {
// The provisional datasource is now committed. The first part of the
// response body has been received, and the encoding of the response
// body is known.
// The mojo::ScopedMessagePipeHandle is a DocumentInterfaceBroker handle. When
// a load commits and a new Document is created, Blink creates a new
// DocumentInterfaceBroker endpoint to ensure that interface requests in the
// newly committed Document are associated with the correct origin (even if
// the origin of the old and the new Document are the same). The one
// exception is if the Window object is reused; in that case, the old
// DocumentInterfaceBroker handle will be reused, and the endpoint won't be
// bound to any requests.
// When a load commits and a new Document is created, WebLocalFrameClient
// creates a new BrowserInterfaceBroker endpoint to ensure that interface
// receivers in the newly committed Document are associated with the correct
@ -417,7 +409,6 @@ class BLINK_EXPORT WebLocalFrameClient {
virtual void DidCommitProvisionalLoad(
const WebHistoryItem&,
WebHistoryCommitType,
mojo::ScopedMessagePipeHandle,
bool should_reset_browser_interface_broker) {}
// The frame's document has just been initialized.

@ -73,7 +73,6 @@ class WebRemoteFrame : public WebFrame {
const FramePolicy&,
WebLocalFrameClient*,
blink::InterfaceRegistry*,
mojo::ScopedMessagePipeHandle,
WebFrame* previous_sibling,
const WebFrameOwnerProperties&,
FrameOwnerElementType,

@ -273,8 +273,6 @@ jumbo_source_set("testing") {
"testing/death_aware_script_wrappable.h",
"testing/dictionary_test.cc",
"testing/dictionary_test.h",
"testing/document_interface_broker_test_helpers.cc",
"testing/document_interface_broker_test_helpers.h",
"testing/dummy_modulator.cc",
"testing/dummy_modulator.h",
"testing/dummy_page_holder.cc",
@ -309,8 +307,6 @@ jumbo_source_set("testing") {
"testing/sequence_test.h",
"testing/static_selection.cc",
"testing/static_selection.h",
"testing/test_document_interface_broker.cc",
"testing/test_document_interface_broker.h",
"testing/type_conversions.h",
"testing/union_types_test.cc",
"testing/union_types_test.h",

@ -51,7 +51,6 @@
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-blink.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h"
#include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom-blink.h"
#include "third_party/blink/public/mojom/ukm/ukm.mojom-blink.h"
#include "third_party/blink/public/platform/interface_provider.h"
@ -8040,13 +8039,6 @@ bool Document::IsSecureContext() const {
return is_secure;
}
mojo::ScopedMessagePipeHandle Document::SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle) {
DCHECK(GetFrame());
return GetFrame()->SetDocumentInterfaceBrokerForTesting(
std::move(blink_handle));
}
void Document::DidEnforceInsecureRequestPolicy() {
if (!GetFrame())
return;
@ -8143,13 +8135,6 @@ service_manager::InterfaceProvider* Document::GetInterfaceProvider() {
return &GetFrame()->GetInterfaceProvider();
}
mojom::blink::DocumentInterfaceBroker* Document::GetDocumentInterfaceBroker() {
if (!GetFrame())
return nullptr;
return &GetFrame()->GetDocumentInterfaceBroker();
}
BrowserInterfaceBrokerProxy& Document::GetBrowserInterfaceBroker() {
if (!GetFrame())
return GetEmptyBrowserInterfaceBroker();
@ -8168,13 +8153,6 @@ DocumentResourceCoordinator* Document::GetResourceCoordinator() {
return resource_coordinator_.get();
}
void Document::BindDocumentInterfaceBroker(
mojo::ScopedMessagePipeHandle js_handle) {
if (!GetFrame())
return;
GetFrame()->BindDocumentInterfaceBroker(std::move(js_handle));
}
FrameOrWorkerScheduler* Document::GetScheduler() {
DCHECK(IsMainThread());

@ -1359,11 +1359,6 @@ class CORE_EXPORT Document : public ContainerNode,
secure_context_state_ = state;
}
void BindDocumentInterfaceBroker(mojo::ScopedMessagePipeHandle js_handle);
mojo::ScopedMessagePipeHandle SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle);
CanvasFontCache* GetCanvasFontCache();
// Used by unit tests so that all parsing will be main thread for
@ -1430,7 +1425,6 @@ class CORE_EXPORT Document : public ContainerNode,
CoreProbeSink* GetProbeSink() final;
service_manager::InterfaceProvider* GetInterfaceProvider() final;
mojom::blink::DocumentInterfaceBroker* GetDocumentInterfaceBroker() final;
BrowserInterfaceBrokerProxy& GetBrowserInterfaceBroker() final;

@ -36,7 +36,6 @@
#include "base/optional.h"
#include "base/unguessable_token.h"
#include "services/network/public/mojom/referrer_policy.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink-forward.h"
#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h"
#include "third_party/blink/renderer/core/core_export.h"
@ -276,10 +275,6 @@ class CORE_EXPORT ExecutionContext : public ContextLifecycleNotifier,
return nullptr;
}
virtual mojom::blink::DocumentInterfaceBroker* GetDocumentInterfaceBroker() {
return nullptr;
}
virtual BrowserInterfaceBrokerProxy& GetBrowserInterfaceBroker() = 0;
virtual FrameOrWorkerScheduler* GetScheduler() = 0;

@ -161,16 +161,8 @@ void ResetWheelAndTouchEventHandlerProperties(LocalFrame& frame) {
} // namespace
LocalFrameClientImpl::LocalFrameClientImpl(
WebLocalFrameImpl* frame,
mojo::ScopedMessagePipeHandle document_interface_broker_handle)
: web_frame_(frame) {
DCHECK(document_interface_broker_handle.is_valid());
document_interface_broker_.Bind(
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker>(
std::move(document_interface_broker_handle),
mojom::blink::DocumentInterfaceBroker::Version_));
}
LocalFrameClientImpl::LocalFrameClientImpl(WebLocalFrameImpl* frame)
: web_frame_(frame) {}
LocalFrameClientImpl::~LocalFrameClientImpl() = default;
@ -443,17 +435,8 @@ void LocalFrameClientImpl::DispatchDidCommitLoad(
}
if (web_frame_->Client()) {
mojo::PendingReceiver<mojom::blink::DocumentInterfaceBroker>
document_interface_broker_receiver;
if (global_object_reuse_policy != GlobalObjectReusePolicy::kUseExisting) {
document_interface_broker_.reset();
document_interface_broker_receiver =
document_interface_broker_.BindNewPipeAndPassReceiver();
}
web_frame_->Client()->DidCommitProvisionalLoad(
WebHistoryItem(item), commit_type,
document_interface_broker_receiver.PassPipe(),
global_object_reuse_policy == GlobalObjectReusePolicy::kCreateNew);
if (web_frame_->GetFrame()->IsLocalRoot()) {
// This update should be sent as soon as loading the new document begins
@ -1055,40 +1038,11 @@ LocalFrameClientImpl::GetInterfaceProvider() {
return web_frame_->Client()->GetInterfaceProvider();
}
mojom::blink::DocumentInterfaceBroker*
LocalFrameClientImpl::GetDocumentInterfaceBroker() {
DCHECK(document_interface_broker_.is_bound());
return document_interface_broker_.get();
}
blink::BrowserInterfaceBrokerProxy&
LocalFrameClientImpl::GetBrowserInterfaceBroker() {
return *web_frame_->Client()->GetBrowserInterfaceBroker();
}
void LocalFrameClientImpl::BindDocumentInterfaceBroker(
mojo::ScopedMessagePipeHandle js_handle) {
document_interface_broker_receivers_.Add(
this, mojo::PendingReceiver<mojom::blink::DocumentInterfaceBroker>(
std::move(js_handle)));
}
mojo::ScopedMessagePipeHandle
LocalFrameClientImpl::SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle) {
// Ensure all pending calls get dispatched before the implementation swap
document_interface_broker_receivers_.FlushForTesting();
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker> test_broker(
std::move(blink_handle), mojom::blink::DocumentInterfaceBroker::Version_);
mojo::ScopedMessagePipeHandle real_handle =
document_interface_broker_.Unbind().PassPipe();
document_interface_broker_.Bind(std::move(test_broker));
return real_handle;
}
AssociatedInterfaceProvider*
LocalFrameClientImpl::GetRemoteNavigationAssociatedInterfaces() {
return web_frame_->Client()->GetRemoteNavigationAssociatedInterfaces();

@ -41,7 +41,6 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h"
#include "third_party/blink/public/platform/web_insecure_request_policy.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
@ -59,7 +58,7 @@ struct WebScrollIntoViewParams;
class LocalFrameClientImpl final : public LocalFrameClient {
public:
LocalFrameClientImpl(WebLocalFrameImpl*, mojo::ScopedMessagePipeHandle);
explicit LocalFrameClientImpl(WebLocalFrameImpl*);
~LocalFrameClientImpl() override;
void Trace(blink::Visitor*) override;
@ -247,21 +246,6 @@ class LocalFrameClientImpl final : public LocalFrameClient {
service_manager::InterfaceProvider* GetInterfaceProvider() override;
// Binds |js_handle| to the current implementation bound to
// |document_interface_broker_| to share the same broker between C++ and
// JavaScript clients.
void BindDocumentInterfaceBroker(
mojo::ScopedMessagePipeHandle js_handle) override;
mojom::blink::DocumentInterfaceBroker* GetDocumentInterfaceBroker() override;
// Binds |document_interface_broker_| to |blink_handle|. Used in tests to set
// a custom override for DocumentInterfaceBroker methods. Returns the handle
// to the previously bound 'production' implementation, which will be used to
// forward the calls to methods that have not been overridden.
mojo::ScopedMessagePipeHandle SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle) override;
blink::BrowserInterfaceBrokerProxy& GetBrowserInterfaceBroker() override;
AssociatedInterfaceProvider* GetRemoteNavigationAssociatedInterfaces()
@ -317,18 +301,6 @@ class LocalFrameClientImpl final : public LocalFrameClient {
std::unique_ptr<blink::URLLoaderFactoryBundleInfo> info) override;
private:
struct DocumentInterfaceBrokerForwarderTraits {
using Interface = mojom::blink::DocumentInterfaceBroker;
using PointerType = WeakPersistent<LocalFrameClientImpl>;
static bool IsNull(PointerType ptr) {
return !ptr || !ptr->document_interface_broker_;
}
static Interface* GetRawPointer(PointerType* ptr) {
return (*ptr)->GetDocumentInterfaceBroker();
}
};
friend struct DocumentInterfaceBrokerForwarderTraits;
bool IsLocalFrameClientImpl() const override { return true; }
WebDevToolsAgentImpl* DevToolsAgent();
@ -338,19 +310,6 @@ class LocalFrameClientImpl final : public LocalFrameClient {
String user_agent_;
blink::UserAgentMetadata user_agent_metadata_;
mojo::Remote<mojom::blink::DocumentInterfaceBroker>
document_interface_broker_;
// |document_interface_broker_receivers_| basically just forwards the broker
// methods to GetDocumentInterfaceBroker()
// via DocumentInterfaceBrokerForwarderTraits.
// Used to connect JavaScript clients of DocumentInterfaceBroker with the same
// implementation that |document_interface_broker_| is bound to.
mojo::ReceiverSetBase<mojo::Receiver<mojom::blink::DocumentInterfaceBroker,
DocumentInterfaceBrokerForwarderTraits>,
void>
document_interface_broker_receivers_;
};
DEFINE_TYPE_CASTS(LocalFrameClientImpl,

@ -39,7 +39,6 @@
#include "third_party/blink/public/web/web_view.h"
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/testing/document_interface_broker_test_helpers.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
@ -111,23 +110,5 @@ TEST_F(LocalFrameClientImplTest, UserAgentOverride) {
EXPECT_TRUE(default_user_agent.Equals(UserAgent()));
}
TEST_F(LocalFrameClientImplTest, TestDocumentInterfaceBrokerOverride) {
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker> doc;
FrameHostTestDocumentInterfaceBroker frame_interface_broker(
&MainFrame()->GetFrame()->GetDocumentInterfaceBroker(),
doc.InitWithNewPipeAndPassReceiver());
MainFrame()->GetFrame()->SetDocumentInterfaceBrokerForTesting(doc.PassPipe());
mojo::Remote<mojom::blink::FrameHostTestInterface> frame_test;
MainFrame()
->GetFrame()
->GetDocumentInterfaceBroker()
.GetFrameHostTestInterface(frame_test.BindNewPipeAndPassReceiver());
frame_test->GetName(base::BindOnce([](const WTF::String& result) {
EXPECT_EQ(result, kGetNameTestResponse);
}));
frame_interface_broker.Flush();
}
} // namespace
} // namespace blink

@ -4228,7 +4228,6 @@ class ClearScrollStateOnCommitWebFrameClient
// frame_test_helpers::TestWebFrameClient:
void DidCommitProvisionalLoad(const WebHistoryItem&,
WebHistoryCommitType,
mojo::ScopedMessagePipeHandle,
bool) override {
Frame()->View()->ResetScrollAndScaleState();
}
@ -6354,7 +6353,6 @@ class TestWillInsertBodyWebFrameClient
// frame_test_helpers::TestWebFrameClient:
void DidCommitProvisionalLoad(const WebHistoryItem&,
WebHistoryCommitType,
mojo::ScopedMessagePipeHandle,
bool) override {
did_load_ = true;
}
@ -9430,7 +9428,6 @@ class RemoteToLocalSwapWebFrameClient
// frame_test_helpers::TestWebFrameClient:
void DidCommitProvisionalLoad(const WebHistoryItem&,
WebHistoryCommitType history_commit_type,
mojo::ScopedMessagePipeHandle,
bool) override {
history_commit_type_ = history_commit_type;
remote_frame_->Swap(Frame());
@ -9658,7 +9655,6 @@ class CommitTypeWebFrameClient : public frame_test_helpers::TestWebFrameClient {
// frame_test_helpers::TestWebFrameClient:
void DidCommitProvisionalLoad(const WebHistoryItem&,
WebHistoryCommitType history_commit_type,
mojo::ScopedMessagePipeHandle,
bool) override {
history_commit_type_ = history_commit_type;
}
@ -10565,7 +10561,6 @@ class CallbackOrderingWebFrameClient
}
void DidCommitProvisionalLoad(const WebHistoryItem&,
WebHistoryCommitType,
mojo::ScopedMessagePipeHandle,
bool) override {
EXPECT_EQ(2, callback_count_++);
}

@ -191,14 +191,12 @@ WebLocalFrame* WebRemoteFrameImpl::CreateLocalChild(
const FramePolicy& frame_policy,
WebLocalFrameClient* client,
blink::InterfaceRegistry* interface_registry,
mojo::ScopedMessagePipeHandle document_interface_broker_handle,
WebFrame* previous_sibling,
const WebFrameOwnerProperties& frame_owner_properties,
FrameOwnerElementType frame_owner_element_type,
WebFrame* opener) {
auto* child = MakeGarbageCollected<WebLocalFrameImpl>(
scope, client, interface_registry,
std::move(document_interface_broker_handle));
auto* child = MakeGarbageCollected<WebLocalFrameImpl>(scope, client,
interface_registry);
child->SetOpener(opener);
InsertAfter(child, previous_sibling);
auto* owner = MakeGarbageCollected<RemoteFrameOwner>(

@ -63,7 +63,6 @@ class CORE_EXPORT WebRemoteFrameImpl final
const FramePolicy&,
WebLocalFrameClient*,
blink::InterfaceRegistry*,
mojo::ScopedMessagePipeHandle,
WebFrame* previous_sibling,
const WebFrameOwnerProperties&,
FrameOwnerElementType,

@ -49,7 +49,6 @@
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
#include "third_party/blink/public/common/page/page_zoom.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom-shared.h"
#include "third_party/blink/public/platform/web_coalesced_input_event.h"
#include "third_party/blink/public/platform/web_cursor_info.h"
@ -507,11 +506,7 @@ TEST_F(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) {
frame_test_helpers::TestWebFrameClient web_frame_client;
WebLocalFrame* frame = WebLocalFrame::CreateMainFrame(
web_view, &web_frame_client, nullptr,
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe(),
nullptr);
web_view, &web_frame_client, nullptr, nullptr);
web_frame_client.Bind(frame);
{
@ -2647,11 +2642,7 @@ TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient) {
frame_test_helpers::TestWebFrameClient web_frame_client;
frame_test_helpers::TestWebWidgetClient web_widget_client;
WebLocalFrame* local_frame = WebLocalFrame::CreateMainFrame(
web_view, &web_frame_client, nullptr,
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe(),
nullptr);
web_view, &web_frame_client, nullptr, nullptr);
web_frame_client.Bind(local_frame);
blink::WebFrameWidget::CreateForMainFrame(&web_widget_client, local_frame);

@ -9,7 +9,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/core/dom/user_gesture_indicator.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/testing/document_interface_broker_test_helpers.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
@ -185,23 +184,4 @@ TEST_F(FrameTest, UserActivationInterfaceTest) {
LocalFrame::ConsumeTransientUserActivation(GetDocument().GetFrame()));
}
TEST_F(FrameTest, TestDocumentInterfaceBrokerOverride) {
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker> doc;
FrameHostTestDocumentInterfaceBroker frame_interface_broker(
&GetDocument().GetFrame()->GetDocumentInterfaceBroker(),
doc.InitWithNewPipeAndPassReceiver());
GetDocument().GetFrame()->SetDocumentInterfaceBrokerForTesting(
doc.PassPipe());
mojo::Remote<mojom::blink::FrameHostTestInterface> frame_test;
GetDocument()
.GetFrame()
->GetDocumentInterfaceBroker()
.GetFrameHostTestInterface(frame_test.BindNewPipeAndPassReceiver());
frame_test->GetName(base::BindOnce([](const WTF::String& result) {
EXPECT_EQ(result, kGetNameTestResponse);
}));
frame_interface_broker.Flush();
}
} // namespace blink

@ -212,11 +212,8 @@ WebLocalFrameImpl* CreateLocalChild(WebLocalFrame& parent,
TestWebFrameClient* client) {
std::unique_ptr<TestWebFrameClient> owned_client;
client = CreateDefaultClientIfNeeded(client, owned_client);
auto* frame = To<WebLocalFrameImpl>(parent.CreateLocalChild(
scope, client, nullptr,
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe()));
auto* frame =
To<WebLocalFrameImpl>(parent.CreateLocalChild(scope, client, nullptr));
client->Bind(frame, std::move(owned_client));
return frame;
}
@ -227,11 +224,8 @@ WebLocalFrameImpl* CreateLocalChild(
std::unique_ptr<TestWebFrameClient> self_owned) {
DCHECK(self_owned);
TestWebFrameClient* client = self_owned.get();
auto* frame = To<WebLocalFrameImpl>(parent.CreateLocalChild(
scope, client, nullptr,
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe()));
auto* frame =
To<WebLocalFrameImpl>(parent.CreateLocalChild(scope, client, nullptr));
client->Bind(frame, std::move(self_owned));
return frame;
}
@ -241,11 +235,7 @@ WebLocalFrameImpl* CreateProvisional(WebRemoteFrame& old_frame,
std::unique_ptr<TestWebFrameClient> owned_client;
client = CreateDefaultClientIfNeeded(client, owned_client);
auto* frame = To<WebLocalFrameImpl>(WebLocalFrame::CreateProvisional(
client, nullptr,
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe(),
&old_frame, FramePolicy()));
client, nullptr, &old_frame, FramePolicy()));
client->Bind(frame, std::move(owned_client));
std::unique_ptr<TestWebWidgetClient> widget_client;
// Create a local root, if necessary.
@ -289,9 +279,6 @@ WebLocalFrameImpl* CreateLocalChild(WebRemoteFrame& parent,
client = CreateDefaultClientIfNeeded(client, owned_client);
auto* frame = To<WebLocalFrameImpl>(parent.CreateLocalChild(
WebTreeScopeType::kDocument, name, FramePolicy(), client, nullptr,
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe(),
previous_sibling, properties, FrameOwnerElementType::kIframe, nullptr));
client->Bind(frame, std::move(owned_client));
@ -355,11 +342,7 @@ WebViewImpl* WebViewHelper::InitializeWithOpener(
web_frame_client =
CreateDefaultClientIfNeeded(web_frame_client, owned_web_frame_client);
WebLocalFrame* frame = WebLocalFrame::CreateMainFrame(
web_view_, web_frame_client, nullptr,
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker>()
.InitWithNewPipeAndPassReceiver()
.PassPipe(),
opener);
web_view_, web_frame_client, nullptr, opener);
web_frame_client->Bind(frame, std::move(owned_web_frame_client));
test_web_widget_client_ = CreateDefaultClientIfNeeded(

@ -41,7 +41,6 @@
#include "third_party/blink/public/common/frame/blocked_navigation_types.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/ad_tagging/ad_frame.mojom-blink.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink.h"
#include "third_party/blink/public/platform/interface_provider.h"
#include "third_party/blink/public/platform/interface_registry.h"
@ -1135,30 +1134,11 @@ service_manager::InterfaceProvider& LocalFrame::GetInterfaceProvider() {
return *Client()->GetInterfaceProvider();
}
void LocalFrame::BindDocumentInterfaceBroker(
mojo::ScopedMessagePipeHandle js_handle) {
DCHECK(Client());
Client()->BindDocumentInterfaceBroker(std::move(js_handle));
}
mojom::blink::DocumentInterfaceBroker&
LocalFrame::GetDocumentInterfaceBroker() {
DCHECK(Client());
return *Client()->GetDocumentInterfaceBroker();
}
BrowserInterfaceBrokerProxy& LocalFrame::GetBrowserInterfaceBroker() {
DCHECK(Client());
return Client()->GetBrowserInterfaceBroker();
}
mojo::ScopedMessagePipeHandle LocalFrame::SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle) {
DCHECK(Client());
return Client()->SetDocumentInterfaceBrokerForTesting(
std::move(blink_handle));
}
AssociatedInterfaceProvider*
LocalFrame::GetRemoteNavigationAssociatedInterfaces() {
DCHECK(Client());

@ -40,7 +40,6 @@
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/unique_receiver_set.h"
#include "third_party/blink/public/mojom/ad_tagging/ad_frame.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/frame/frame.mojom-blink.h"
#include "third_party/blink/public/mojom/frame/lifecycle.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/loader/pause_subresource_loading_handle.mojom-blink-forward.h"
@ -278,10 +277,6 @@ class CORE_EXPORT LocalFrame final : public Frame,
bool CanNavigate(const Frame&, const KURL& destination_url = KURL());
service_manager::InterfaceProvider& GetInterfaceProvider();
void BindDocumentInterfaceBroker(mojo::ScopedMessagePipeHandle js_handle);
mojom::blink::DocumentInterfaceBroker& GetDocumentInterfaceBroker();
mojo::ScopedMessagePipeHandle SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle);
BrowserInterfaceBrokerProxy& GetBrowserInterfaceBroker();

@ -84,10 +84,6 @@ class InterfaceProvider;
namespace blink {
namespace mojom {
enum class WebFeature : int32_t;
namespace blink {
class DocumentInterfaceBroker;
} // namespace blink
} // namespace mojom
class AssociatedInterfaceProvider;
@ -372,28 +368,8 @@ class CORE_EXPORT LocalFrameClient : public FrameClient {
return nullptr;
}
// Binds |js_handle| to the currently bound implementation of
// DocumentInterfaceBroker to share the same broker between C++ and JavaScript
// clients.
virtual void BindDocumentInterfaceBroker(
mojo::ScopedMessagePipeHandle js_handle) {}
virtual mojom::blink::DocumentInterfaceBroker* GetDocumentInterfaceBroker() {
return nullptr;
}
virtual BrowserInterfaceBrokerProxy& GetBrowserInterfaceBroker() = 0;
// Used in tests to set a custom override for DocumentInterfaceBroker methods.
// |blink_handle| is bound to the test implementation on the caller side.
// Returns the handle to the previously bound 'production' implementation,
// which will be used to forward the calls to methods that have not been
// overridden.
virtual mojo::ScopedMessagePipeHandle SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle) {
return mojo::ScopedMessagePipeHandle();
}
virtual AssociatedInterfaceProvider*
GetRemoteNavigationAssociatedInterfaces() = 0;

@ -1598,40 +1598,34 @@ WebLocalFrame* WebLocalFrame::CreateMainFrame(
WebView* web_view,
WebLocalFrameClient* client,
InterfaceRegistry* interface_registry,
mojo::ScopedMessagePipeHandle document_interface_broker_handle,
WebFrame* opener,
const WebString& name,
WebSandboxFlags sandbox_flags,
const FeaturePolicy::FeatureState& opener_feature_state) {
return WebLocalFrameImpl::CreateMainFrame(
web_view, client, interface_registry,
std::move(document_interface_broker_handle), opener, name, sandbox_flags,
web_view, client, interface_registry, opener, name, sandbox_flags,
opener_feature_state);
}
WebLocalFrame* WebLocalFrame::CreateProvisional(
WebLocalFrameClient* client,
InterfaceRegistry* interface_registry,
mojo::ScopedMessagePipeHandle document_interface_broker_handle,
WebFrame* previous_frame,
const FramePolicy& frame_policy) {
return WebLocalFrameImpl::CreateProvisional(
client, interface_registry, std::move(document_interface_broker_handle),
previous_frame, frame_policy);
return WebLocalFrameImpl::CreateProvisional(client, interface_registry,
previous_frame, frame_policy);
}
WebLocalFrameImpl* WebLocalFrameImpl::CreateMainFrame(
WebView* web_view,
WebLocalFrameClient* client,
InterfaceRegistry* interface_registry,
mojo::ScopedMessagePipeHandle document_interface_broker_handle,
WebFrame* opener,
const WebString& name,
WebSandboxFlags sandbox_flags,
const FeaturePolicy::FeatureState& opener_feature_state) {
WebLocalFrameImpl* frame = MakeGarbageCollected<WebLocalFrameImpl>(
WebTreeScopeType::kDocument, client, interface_registry,
std::move(document_interface_broker_handle));
WebTreeScopeType::kDocument, client, interface_registry);
frame->SetOpener(opener);
Page& page = *static_cast<WebViewImpl*>(web_view)->GetPage();
DCHECK(!page.MainFrame());
@ -1645,14 +1639,13 @@ WebLocalFrameImpl* WebLocalFrameImpl::CreateMainFrame(
WebLocalFrameImpl* WebLocalFrameImpl::CreateProvisional(
WebLocalFrameClient* client,
blink::InterfaceRegistry* interface_registry,
mojo::ScopedMessagePipeHandle document_interface_broker_handle,
WebFrame* previous_web_frame,
const FramePolicy& frame_policy) {
DCHECK(client);
auto* web_frame = MakeGarbageCollected<WebLocalFrameImpl>(
previous_web_frame->InShadowTree() ? WebTreeScopeType::kShadow
: WebTreeScopeType::kDocument,
client, interface_registry, std::move(document_interface_broker_handle));
client, interface_registry);
Frame* previous_frame = ToCoreFrame(*previous_web_frame);
web_frame->SetParent(previous_web_frame->Parent());
web_frame->SetOpener(previous_web_frame->Opener());
@ -1697,11 +1690,9 @@ WebLocalFrameImpl* WebLocalFrameImpl::CreateProvisional(
WebLocalFrameImpl* WebLocalFrameImpl::CreateLocalChild(
WebTreeScopeType scope,
WebLocalFrameClient* client,
blink::InterfaceRegistry* interface_registry,
mojo::ScopedMessagePipeHandle document_interface_broker_handle) {
blink::InterfaceRegistry* interface_registry) {
WebLocalFrameImpl* frame = MakeGarbageCollected<WebLocalFrameImpl>(
scope, client, interface_registry,
std::move(document_interface_broker_handle));
scope, client, interface_registry);
AppendChild(frame);
return frame;
}
@ -1709,13 +1700,10 @@ WebLocalFrameImpl* WebLocalFrameImpl::CreateLocalChild(
WebLocalFrameImpl::WebLocalFrameImpl(
WebTreeScopeType scope,
WebLocalFrameClient* client,
blink::InterfaceRegistry* interface_registry,
mojo::ScopedMessagePipeHandle document_interface_broker_handle)
blink::InterfaceRegistry* interface_registry)
: WebNavigationControl(scope),
client_(client),
local_frame_client_(MakeGarbageCollected<LocalFrameClientImpl>(
this,
std::move(document_interface_broker_handle))),
local_frame_client_(MakeGarbageCollected<LocalFrameClientImpl>(this)),
autofill_client_(nullptr),
find_in_page_(
MakeGarbageCollected<FindInPage>(*this, interface_registry)),

@ -103,8 +103,7 @@ class CORE_EXPORT WebLocalFrameImpl final
// WebLocalFrame overrides:
WebLocalFrameImpl* CreateLocalChild(WebTreeScopeType,
WebLocalFrameClient*,
blink::InterfaceRegistry*,
mojo::ScopedMessagePipeHandle) override;
blink::InterfaceRegistry*) override;
WebLocalFrameClient* Client() const override { return client_; }
void SetAutofillClient(WebAutofillClient*) override;
WebAutofillClient* AutofillClient() override;
@ -355,21 +354,18 @@ class CORE_EXPORT WebLocalFrameImpl final
static WebLocalFrameImpl* CreateMainFrame(WebView*,
WebLocalFrameClient*,
InterfaceRegistry*,
mojo::ScopedMessagePipeHandle,
WebFrame* opener,
const WebString& name,
WebSandboxFlags,
const FeaturePolicy::FeatureState&);
static WebLocalFrameImpl* CreateProvisional(WebLocalFrameClient*,
InterfaceRegistry*,
mojo::ScopedMessagePipeHandle,
WebFrame*,
const FramePolicy&);
WebLocalFrameImpl(WebTreeScopeType,
WebLocalFrameClient*,
blink::InterfaceRegistry*,
mojo::ScopedMessagePipeHandle);
blink::InterfaceRegistry*);
~WebLocalFrameImpl() override;
LocalFrame* CreateChildFrame(const AtomicString& name,

@ -120,26 +120,6 @@ DocumentLoader* EmptyLocalFrameClient::CreateDocumentLoader(
std::move(navigation_params));
}
mojom::blink::DocumentInterfaceBroker*
EmptyLocalFrameClient::GetDocumentInterfaceBroker() {
if (!document_interface_broker_.is_bound())
ignore_result(document_interface_broker_.BindNewPipeAndPassReceiver());
return document_interface_broker_.get();
}
mojo::ScopedMessagePipeHandle
EmptyLocalFrameClient::SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle) {
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker> test_broker(
std::move(blink_handle), mojom::blink::DocumentInterfaceBroker::Version_);
mojo::ScopedMessagePipeHandle real_handle =
document_interface_broker_.Unbind().PassPipe();
document_interface_broker_.Bind(std::move(test_broker));
return real_handle;
}
LocalFrame* EmptyLocalFrameClient::CreateFrame(const AtomicString&,
HTMLFrameOwnerElement*) {
return nullptr;

@ -37,7 +37,6 @@
#include "mojo/public/cpp/bindings/remote.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_focus_type.h"
#include "third_party/blink/public/platform/web_menu_source_type.h"
@ -380,10 +379,6 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
return &interface_provider_;
}
mojom::blink::DocumentInterfaceBroker* GetDocumentInterfaceBroker() override;
mojo::ScopedMessagePipeHandle SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle blink_handle) override;
BrowserInterfaceBrokerProxy& GetBrowserInterfaceBroker() override {
return GetEmptyBrowserInterfaceBroker();
}
@ -433,8 +428,6 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient {
WebTextCheckClient* text_check_client_;
service_manager::InterfaceProvider interface_provider_;
mojo::Remote<mojom::blink::DocumentInterfaceBroker>
document_interface_broker_;
DISALLOW_COPY_AND_ASSIGN(EmptyLocalFrameClient);
};

@ -9,7 +9,6 @@
#include "mojo/public/cpp/system/message_pipe.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h"
#include "third_party/blink/public/platform/interface_provider.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/core/dom/document.h"
@ -128,32 +127,4 @@ void Mojo::bindInterface(ScriptState* script_state,
}
}
// static
MojoHandle* Mojo::getDocumentInterfaceBrokerHandle(ScriptState* script_state) {
ExecutionContext* execution_context = ExecutionContext::From(script_state);
DCHECK(execution_context);
Document* document = static_cast<Document*>(execution_context);
DCHECK(document);
mojo::MessagePipe pipe;
document->BindDocumentInterfaceBroker(std::move(pipe.handle0));
return MakeGarbageCollected<MojoHandle>(
mojo::ScopedHandle::From(std::move(pipe.handle1)));
}
// static
MojoHandle* Mojo::replaceDocumentInterfaceBrokerForTesting(
ScriptState* script_state,
MojoHandle* test_broker_handle) {
ExecutionContext* execution_context = ExecutionContext::From(script_state);
DCHECK(execution_context);
Document* document = static_cast<Document*>(execution_context);
DCHECK(document);
return MakeGarbageCollected<MojoHandle>(
mojo::ScopedHandle::From(document->SetDocumentInterfaceBrokerForTesting(
mojo::ScopedMessagePipeHandle(mojo::MessagePipeHandle(
test_broker_handle->TakeHandle().release().value())))));
}
} // namespace blink

@ -56,9 +56,6 @@ class Mojo final : public ScriptWrappable {
MojoHandle*,
const String& scope,
bool use_browser_interface_broker);
static MojoHandle* getDocumentInterfaceBrokerHandle(ScriptState*);
static MojoHandle* replaceDocumentInterfaceBrokerForTesting(ScriptState*,
MojoHandle*);
};
} // namespace blink

@ -47,6 +47,4 @@ enum MojoScope {
static MojoCreateSharedBufferResult createSharedBuffer(unsigned long numBytes);
[CallWith=ScriptState] static void bindInterface(DOMString interfaceName, MojoHandle request_handle, optional MojoScope scope = "context", optional boolean useBrowserInterfaceBroker = false);
[CallWith=ScriptState] static MojoHandle getDocumentInterfaceBrokerHandle();
[CallWith=ScriptState] static MojoHandle replaceDocumentInterfaceBrokerForTesting(MojoHandle test_broker_handle);
};

@ -1,27 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/testing/document_interface_broker_test_helpers.h"
#include <utility>
namespace blink {
void FrameHostTestInterfaceImpl::BindAndFlush(
mojo::PendingReceiver<mojom::blink::FrameHostTestInterface> receiver) {
receiver_.Bind(std::move(receiver));
receiver_.WaitForIncomingCall();
}
void FrameHostTestInterfaceImpl::GetName(GetNameCallback callback) {
std::move(callback).Run(kGetNameTestResponse);
}
void FrameHostTestDocumentInterfaceBroker::GetFrameHostTestInterface(
mojo::PendingReceiver<mojom::blink::FrameHostTestInterface> receiver) {
FrameHostTestInterfaceImpl impl;
impl.BindAndFlush(std::move(receiver));
}
} // namespace blink

@ -1,58 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_DOCUMENT_INTERFACE_BROKER_TEST_HELPERS_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_DOCUMENT_INTERFACE_BROKER_TEST_HELPERS_H_
#include <utility>
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/frame/frame_host_test_interface.mojom-blink.h"
#include "third_party/blink/renderer/core/testing/test_document_interface_broker.h"
namespace blink {
constexpr char kGetNameTestResponse[] = "BlinkTestName";
// These classes can be used for verifying that overriding mechanism for
// DocumentInterfaceBroker method calls works as expected with LocalFrameClient
// implementations. See frame_test.cc and local_frame_client_impl.cc for
// examples.
class FrameHostTestInterfaceImpl : public mojom::blink::FrameHostTestInterface {
public:
FrameHostTestInterfaceImpl() = default;
~FrameHostTestInterfaceImpl() override {}
void BindAndFlush(
mojo::PendingReceiver<mojom::blink::FrameHostTestInterface> receiver);
protected:
void Ping(const KURL& url, const WTF::String& event) override {}
void GetName(GetNameCallback callback) override;
private:
mojo::Receiver<mojom::blink::FrameHostTestInterface> receiver_{this};
DISALLOW_COPY_AND_ASSIGN(FrameHostTestInterfaceImpl);
};
class FrameHostTestDocumentInterfaceBroker
: public TestDocumentInterfaceBroker {
public:
FrameHostTestDocumentInterfaceBroker(
mojom::blink::DocumentInterfaceBroker* document_interface_broker,
mojo::PendingReceiver<mojom::blink::DocumentInterfaceBroker> receiver)
: TestDocumentInterfaceBroker(document_interface_broker,
std::move(receiver)) {}
void GetFrameHostTestInterface(
mojo::PendingReceiver<mojom::blink::FrameHostTestInterface> receiver)
override;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_DOCUMENT_INTERFACE_BROKER_TEST_HELPERS_H_

@ -1,28 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/testing/test_document_interface_broker.h"
#include <utility>
namespace blink {
TestDocumentInterfaceBroker::TestDocumentInterfaceBroker(
mojom::blink::DocumentInterfaceBroker* document_interface_broker,
mojo::PendingReceiver<mojom::blink::DocumentInterfaceBroker> receiver)
: real_broker_(document_interface_broker),
receiver_(this, std::move(receiver)) {}
TestDocumentInterfaceBroker::~TestDocumentInterfaceBroker() {}
mojom::blink::DocumentInterfaceBroker*
TestDocumentInterfaceBroker::GetForwardingInterface() {
return real_broker_;
}
void TestDocumentInterfaceBroker::Flush() {
receiver_.FlushForTesting();
}
} // namespace blink

@ -1,34 +0,0 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_TEST_DOCUMENT_INTERFACE_BROKER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_TEST_DOCUMENT_INTERFACE_BROKER_H_
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink-test-utils.h"
namespace blink {
// This class can be subclassed to override specific methods of
// LocalFrameClient's DocumentInterfaceBroker in tests. The rest of the calls
// will be forwarded to the implementation passed to the constructor (typically
// returned by LocalFrameClient::GetDocumentInterfaceBroker()).
class TestDocumentInterfaceBroker
: public mojom::blink::DocumentInterfaceBrokerInterceptorForTesting {
public:
TestDocumentInterfaceBroker(
mojom::blink::DocumentInterfaceBroker* document_interface_broker,
mojo::PendingReceiver<mojom::blink::DocumentInterfaceBroker> receiver);
~TestDocumentInterfaceBroker() override;
mojom::blink::DocumentInterfaceBroker* GetForwardingInterface() override;
void Flush();
private:
mojom::blink::DocumentInterfaceBroker* real_broker_;
mojo::Receiver<mojom::blink::DocumentInterfaceBroker> receiver_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_TESTING_TEST_DOCUMENT_INTERFACE_BROKER_H_

@ -13,7 +13,6 @@
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/virtual-navigator-credentials.js"></script>
<script>

@ -1,43 +0,0 @@
<body>
<script src="/js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/frame_host_test_interface.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script>
'use strict';
promise_test(async t => {
// Create a test implementation of FrameHostTestInterface
const frameHostTestImpl = new blink.mojom.FrameHostTestInterfaceCallbackRouter;
frameHostTestImpl.getName.addListener(() => ({ name: 'TestFrameHostTestImpl' }));
const broker = new blink.mojom.DocumentInterfaceBrokerRemote(
Mojo.getDocumentInterfaceBrokerHandle());
const testInterfaceBeforeOverride = new blink.mojom.FrameHostTestInterfaceRemote;
broker.getFrameHostTestInterface(testInterfaceBeforeOverride.$.bindNewPipeAndPassReceiver());
setDocumentInterfaceBrokerOverrides({ getFrameHostTestInterface: request => {
frameHostTestImpl.$.bindHandle(request.handle);
}});
const testInterfaceAfterOverride = new blink.mojom.FrameHostTestInterfaceRemote;
broker.getFrameHostTestInterface(testInterfaceAfterOverride.$.bindNewPipeAndPassReceiver());
// Verify that RenderFrameHostImpl's implementation gets called without an override
let reply = await testInterfaceBeforeOverride.getName();
assert_equals(reply.name, 'RenderFrameHostImpl');
// Verify that the test implementation gets called after the override
reply = await testInterfaceAfterOverride.getName();
assert_equals(reply.name, 'TestFrameHostTestImpl');
},
'Appropriate DocumentInterfaceBroker implementations are called before and after overriding');
</script>
</body>
</html>

@ -834,8 +834,6 @@ interface Mojo
static method createDataPipe
static method createMessagePipe
static method createSharedBuffer
static method getDocumentInterfaceBrokerHandle
static method replaceDocumentInterfaceBrokerForTesting
attribute @@toStringTag
attribute RESULT_ABORTED
attribute RESULT_ALREADY_EXISTS

@ -1,30 +0,0 @@
'use strict';
/**
* Allows to override specific interface request handlers for
* DocumentInterfaceBroker for testing purposes
* @param {Object} overrides an object where the keys are names of
* DocumentInterfaceBroker's methods and the values are corresponding handler
* functions taking a request parameter and binding its handle to the relevant
* testing implementation.
* Example:
* const testFooImpl = new FooInterfaceCallbackRouter;
* ... override FooInterface methods ...
* setDocumentInterfaceBrokerOverrides({getFooInterface: request => {
* testFooImpl.$.bindHandle(request.handle);
* }});
*/
function setDocumentInterfaceBrokerOverrides(overrides) {
const {handle0, handle1} = Mojo.createMessagePipe();
const realBrokerRemote = new blink.mojom.DocumentInterfaceBrokerRemote(
Mojo.replaceDocumentInterfaceBrokerForTesting(handle0));
for (const method of Object.keys(overrides)) {
realBrokerRemote[method] = overrides[method];
}
// Use the real broker (with overrides) as the implementation of the JS-side broker
const testBrokerReceiver =
new blink.mojom.DocumentInterfaceBrokerReceiver(realBrokerRemote);
testBrokerReceiver.$.bindHandle(handle1);
}

@ -806,8 +806,6 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] static method createDataPipe
[Worker] static method createMessagePipe
[Worker] static method createSharedBuffer
[Worker] static method getDocumentInterfaceBrokerHandle
[Worker] static method replaceDocumentInterfaceBrokerForTesting
[Worker] attribute @@toStringTag
[Worker] attribute RESULT_ABORTED
[Worker] attribute RESULT_ALREADY_EXISTS

@ -4987,8 +4987,6 @@ interface Mojo
static method createDataPipe
static method createMessagePipe
static method createSharedBuffer
static method getDocumentInterfaceBrokerHandle
static method replaceDocumentInterfaceBrokerForTesting
attribute @@toStringTag
attribute RESULT_ABORTED
attribute RESULT_ALREADY_EXISTS

@ -788,8 +788,6 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] static method createDataPipe
[Worker] static method createMessagePipe
[Worker] static method createSharedBuffer
[Worker] static method getDocumentInterfaceBrokerHandle
[Worker] static method replaceDocumentInterfaceBrokerForTesting
[Worker] attribute @@toStringTag
[Worker] attribute RESULT_ABORTED
[Worker] attribute RESULT_ALREADY_EXISTS

@ -5268,7 +5268,7 @@ Unknown properties are collapsed to zero. -->
<int value="208" label="RFH_CHILD_FRAME_NEEDS_OWNER_ELEMENT_TYPE"/>
<int value="209" label="OBSOLETE_RFH_INVALID_WEB_REPORTING_CRASH_ID"/>
<int value="210" label="RFH_DETACH_MAIN_FRAME"/>
<int value="211" label="RFH_DOCUMENT_INTERFACE_BROKER_MISSING"/>
<int value="211" label="RFH_BROWSER_INTERFACE_BROKER_MISSING"/>
<int value="212" label="RFPH_POST_MESSAGE_INVALID_SOURCE_ORIGIN"/>
<int value="213" label="INVALID_INITIATOR_ORIGIN"/>
<int value="214" label="RFHI_BEGIN_NAVIGATION_MISSING_INITIATOR_ORIGIN"/>