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 9e65e50de1d45d8435145b56bf7108a8c0272065..3103e4caa2adf853277774092cbd645fd8ece952 100644 --- a/content/browser/loader/cross_site_document_resource_handler.cc +++ b/content/browser/loader/cross_site_document_resource_handler.cc @@ -666,6 +666,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 7e15121545795d39ec3326856919e6582b239506..0c2798cdae8166d792a4bf4ef94fa00cc4b8afa0 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -61,6 +61,10 @@ ContentBrowserClient::SiteInstanceForNavigationType ContentBrowserClient::Should return SiteInstanceForNavigationType::ASK_CHROMIUM; } +bool ContentBrowserClient::ShouldBypassCORB(int render_process_id) const { + return false; +} + BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts( const MainFunctionParams& parameters) { return nullptr; diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index e89f60b3c6297a90e95058c19fc953c82af043e9..e1585d687026cc5d0528dd99ae9e36ffb6699dfc 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -244,6 +244,9 @@ class CONTENT_EXPORT ContentBrowserClient { content::RenderFrameHost* rfh, content::SiteInstance* pending_site_instance) {} + // Electron: Allows bypassing CORB checks for a renderer process. + virtual bool ShouldBypassCORB(int render_process_id) const; + // Allows the embedder to set any number of custom BrowserMainParts // implementations for the browser startup code. See comments in // browser_main_parts.h.