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

Unified Diff: extensions/browser/guest_view/web_view/web_view_guest.cc

Issue 2396533003: Allow <webview> to access URLs in the origin of the app embedding it. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/guest_view/web_view/web_view_guest.cc
diff --git a/extensions/browser/guest_view/web_view/web_view_guest.cc b/extensions/browser/guest_view/web_view/web_view_guest.cc
index 14917784a30cd27bc5244c1cae4d33572b2642f1..692e490b24e85894f9fd9ce0c30f49204b5521e6 100644
--- a/extensions/browser/guest_view/web_view/web_view_guest.cc
+++ b/extensions/browser/guest_view/web_view/web_view_guest.cc
@@ -364,7 +364,17 @@ void WebViewGuest::CreateWebContents(
owner_render_process_host->GetBrowserContext(),
std::move(guest_site_instance));
params.guest_delegate = this;
- callback.Run(WebContents::Create(params));
+ WebContents* new_contents = WebContents::Create(params);
+
+ // Grant access to the origin of the embedder to the guest process. This
+ // allows blob:/filesystem: URLs with the embedder origin to be created
+ // inside the guest. It is possible to do this by running embedder code
+ // through webview accessible_resources.
+ content::ChildProcessSecurityPolicy::GetInstance()->GrantOrigin(
+ new_contents->GetMainFrame()->GetProcess()->GetID(),
+ url::Origin(GetOwnerSiteURL()));
+
+ callback.Run(new_contents);
}
void WebViewGuest::DidAttachToEmbedder() {

Powered by Google App Engine
This is Rietveld 408576698