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 7d5a3367774f558583ea69e60c46ab8636a19a81..190565b067ef869a332b77322dc62403c36c1a00 100644 --- a/content/browser/loader/cross_site_document_resource_handler.cc +++ b/content/browser/loader/cross_site_document_resource_handler.cc @@ -631,6 +631,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 cbd25b0f44a74671c924fd7a35f6fd84632c5f8c..aebf393cf0598335bc395c5584d4e7bcce6bf737 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -58,6 +58,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 d2aa50c1e0ff84ef2313fa058b9ecc677cd20d5c..59d53c27e66e532e7531bf0e8ccee97800a759a5 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -237,6 +237,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.