Commit 146922ab authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Remove GetInitiatorSchemeBypassingDocumentBlocking.

This CL removes the GetInitiatorSchemeBypassingDocumentBlocking method
from ContentBrowserClient.

This method used to be called by implementation of Cross-Origin Read
Blocking (CORB) before NetworkService shipped.  This dependency is gone
now.

Before this CL, the only remaining caller of this method was
AppCacheSubresourceURLFactory::CreateLoaderAndStart.  The method was
called to exclude content script requests from request_initiator checks
(this exclusion was introduced in r624685).  Such exclusion is no longer
needed, after request_initiator=website (see r694827 and r710554).

Bug: 940068
Change-Id: I736f1414ffe890da9cd6477d377f4482168befae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1926541Reviewed-by: default avatarCharlie Reis <creis@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#724030}
parent af90d887
......@@ -1603,21 +1603,6 @@ bool ChromeContentBrowserClient::ShouldLockToOrigin(
return true;
}
const char*
ChromeContentBrowserClient::GetInitiatorSchemeBypassingDocumentBlocking() {
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Don't block responses for extension processes or for content scripts.
// TODO(creis): When every extension fetch (including content scripts) has
// been made to go through an extension-specific URLLoaderFactory, this
// mechanism ought to work by enumerating the host permissions from the
// extension manifest, and forwarding them on to the network service while
// brokering the URLLoaderFactory.
return extensions::kExtensionScheme;
#else
return nullptr;
#endif
}
bool ChromeContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme,
bool is_embedded_origin_secure) {
......
......@@ -150,7 +150,6 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
const GURL& effective_site_url) override;
bool ShouldLockToOrigin(content::BrowserContext* browser_context,
const GURL& effective_site_url) override;
const char* GetInitiatorSchemeBypassingDocumentBlocking() override;
bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme,
bool is_embedded_origin_secure) override;
......
......@@ -384,21 +384,14 @@ void AppCacheSubresourceURLFactory::CreateLoaderAndStart(
!policy->CanAccessDataForOrigin(appcache_host_->process_id(),
request.request_initiator.value()) &&
policy->HasSecurityState(appcache_host_->process_id())) {
const char* scheme_exception =
GetContentClient()
->browser()
->GetInitiatorSchemeBypassingDocumentBlocking();
if (!scheme_exception ||
request.request_initiator.value().scheme() != scheme_exception) {
static auto* initiator_origin_key = base::debug::AllocateCrashKeyString(
"initiator_origin", base::debug::CrashKeySize::Size64);
base::debug::SetCrashKeyString(
initiator_origin_key, request.request_initiator.value().Serialize());
mojo::ReportBadMessage(
"APPCACHE_SUBRESOURCE_URL_FACTORY_INVALID_INITIATOR");
return;
}
static auto* initiator_origin_key = base::debug::AllocateCrashKeyString(
"initiator_origin", base::debug::CrashKeySize::Size64);
base::debug::SetCrashKeyString(
initiator_origin_key, request.request_initiator.value().Serialize());
mojo::ReportBadMessage(
"APPCACHE_SUBRESOURCE_URL_FACTORY_INVALID_INITIATOR");
return;
}
// Subresource requests from renderer processes should not be allowed to use
......
......@@ -129,11 +129,6 @@ bool ContentBrowserClient::ShouldLockToOrigin(BrowserContext* browser_context,
return true;
}
const char*
ContentBrowserClient::GetInitiatorSchemeBypassingDocumentBlocking() {
return nullptr;
}
bool ContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
base::StringPiece scheme,
bool is_embedded_origin_secure) {
......
......@@ -330,11 +330,6 @@ class CONTENT_EXPORT ContentBrowserClient {
virtual bool ShouldLockToOrigin(BrowserContext* browser_context,
const GURL& effective_url);
// Returns the scheme of request initiator that should be ignored by
// cross-origin read blocking. nullptr can be returned to indicate that no
// exceptions should be granted based on initiator's scheme.
virtual const char* GetInitiatorSchemeBypassingDocumentBlocking();
// Returns true if everything embedded inside a document with given scheme
// should be treated as first-party content. |scheme| will be in canonical
// (lowercased) form. |is_embedded_origin_secure| refers to whether the origin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment