From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: deepak1556 Date: Thu, 15 Nov 2018 22:04:34 +0530 Subject: cross_site_document_resource_handler.patch Add a content layer hook to disable CORB for a renderer process, this patch can be removed once we switch to network service, where the embedders have a chance to design their URLLoaders. diff --git a/content/browser/loader/cross_site_document_resource_handler.cc b/content/browser/loader/cross_site_document_resource_handler.cc index 2151c5b9698e9a2768875d04a2297956cc4c0d41..8a316a117ab367bcbac947894cbe1bc2428de93e 100644 --- a/content/browser/loader/cross_site_document_resource_handler.cc +++ b/content/browser/loader/cross_site_document_resource_handler.cc @@ -671,6 +671,9 @@ bool CrossSiteDocumentResourceHandler::ShouldBlockBasedOnHeaders( return false; } + if (GetContentClient()->browser()->ShouldBypassCORB(info->GetChildID())) + return false; + return true; } diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc index 3729dcc9ea3272c943754a92c6ed1d7a1fd8fcf3..787cd81b26508d3e04956721f0e7cec2f457aa60 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -56,6 +56,10 @@ BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts( return nullptr; } +bool ContentBrowserClient::ShouldBypassCORB(int render_process_id) const { + return false; +} + void ContentBrowserClient::PostAfterStartupTask( const base::Location& from_here, const scoped_refptr& task_runner, diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 4c84fb3648b3de36015b325246559f8aefe2ebd5..bf9b3a601fc16d5070e4467a258a047f47b059f3 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -219,6 +219,9 @@ class CONTENT_EXPORT ContentBrowserClient { virtual BrowserMainParts* CreateBrowserMainParts( const MainFunctionParams& parameters); + // Electron: Allows bypassing CORB checks for a renderer process. + virtual bool ShouldBypassCORB(int render_process_id) const; + // Allows the embedder to change the default behavior of // BrowserThread::PostAfterStartupTask to better match whatever // definition of "startup" the embedder has in mind. This may be