Skip to content

Commit

Permalink
[MPArch] Migrate GuestView lookups in message_service.cc
Browse files Browse the repository at this point in the history
Uses the RenderFrameHost based lookup method for GuestView instead of
the one based in WebContents. This CL is part of the pre-work to
migrate GuestViews to MPArch.

Bug: 1362569
Change-Id: Ica4560d258650e9adca72249d40432b7d3dd5b25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3933020
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Antia Puentes <apuentes@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1055202}
  • Loading branch information
antiapuentes authored and Chromium LUCI CQ committed Oct 5, 2022
1 parent 16b8944 commit ac5c08b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions extensions/browser/api/messaging/message_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ void MessageService::OpenChannelToExtension(
// Check to see if it was a WebView making the request.
// Sending messages from WebViews to extensions breaks webview isolation,
// so only allow component extensions to receive messages from WebViews.
bool is_web_view = !!WebViewGuest::FromWebContents(source_contents);
bool is_web_view =
!!WebViewGuest::FromRenderFrameHost(source_render_frame_host);
if (is_web_view &&
Manifest::IsComponentLocation(target_extension->location())) {
include_guest_process_info = true;
Expand Down Expand Up @@ -638,8 +639,7 @@ void MessageService::OpenChannelImpl(BrowserContext* browser_context,
DCHECK(port_context.frame);
guest_render_frame_routing_id = port_context.frame->routing_id;

DCHECK(WebViewGuest::FromWebContents(
WebContents::FromRenderFrameHost(source.GetRenderFrameHost())));
DCHECK(WebViewGuest::FromRenderFrameHost(source.GetRenderFrameHost()));
}

// Send the connect event to the receiver. Give it the opener's port ID (the
Expand Down

0 comments on commit ac5c08b

Please sign in to comment.