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

Unified Diff: content/browser/webui/url_data_manager_backend.cc

Issue 2007223003: Remove obsolete StoragePartition check from old iframe signin path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Inline Created 4 years, 7 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
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webui/url_data_manager_backend.cc
diff --git a/content/browser/webui/url_data_manager_backend.cc b/content/browser/webui/url_data_manager_backend.cc
index fe1015f87e445c77ae396386df9182b94fc81cd0..ff7a79a29821a581465d9c0104037aadf3b93f3f 100644
--- a/content/browser/webui/url_data_manager_backend.cc
+++ b/content/browser/webui/url_data_manager_backend.cc
@@ -180,13 +180,7 @@ class URLRequestChromeJob : public net::URLRequestJob {
// Helper for Start(), to let us start asynchronously.
// (This pattern is shared by most net::URLRequestJob implementations.)
- void StartAsync(bool allowed);
-
- // Called on the UI thread to check if this request is allowed.
- static void CheckStoragePartitionMatches(
- int render_process_id,
- const GURL& url,
- const base::WeakPtr<URLRequestChromeJob>& job);
+ void StartAsync();
// Specific resources require unsafe-eval in the Content Security Policy.
bool RequiresUnsafeEval() const;
@@ -263,40 +257,14 @@ URLRequestChromeJob::~URLRequestChromeJob() {
}
void URLRequestChromeJob::Start() {
- const GURL url = request_->url();
+ // Start reading asynchronously so that all error reporting and data
+ // callbacks happen as they would for network requests.
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&URLRequestChromeJob::StartAsync, weak_factory_.GetWeakPtr()));
TRACE_EVENT_ASYNC_BEGIN1("browser", "DataManager:Request", this, "URL",
- url.possibly_invalid_spec());
-
- int render_process_id, unused;
- bool is_renderer_request = ResourceRequestInfo::GetRenderFrameForRequest(
- request_, &render_process_id, &unused);
-
- if (!is_renderer_request) {
- StartAsync(true);
- return;
- }
-
- if (url.SchemeIs(kChromeUIScheme)) {
- // TODO(dbeam): it's not clear that partition checking is needed or used. It
- // was added for iframe-based signin (http://crbug.com/338127), which has
- // since changed. We should remove if no longer necessary.
- std::vector<std::string> hosts;
- hosts.push_back(content::kChromeUIResourcesHost);
- GetContentClient()->
- browser()->GetAdditionalWebUIHostsToIgnoreParititionCheck(&hosts);
- if (std::find(hosts.begin(), hosts.end(), url.host()) != hosts.end()) {
- StartAsync(true);
- return;
- }
- }
-
- BrowserThread::PostTask(
- BrowserThread::UI,
- FROM_HERE,
- base::Bind(&URLRequestChromeJob::CheckStoragePartitionMatches,
- render_process_id, url,
- weak_factory_.GetWeakPtr()));
+ request_->url().possibly_invalid_spec());
}
void URLRequestChromeJob::Kill() {
@@ -406,33 +374,11 @@ int URLRequestChromeJob::CompleteRead(net::IOBuffer* buf, int buf_size) {
return buf_size;
}
-void URLRequestChromeJob::CheckStoragePartitionMatches(
- int render_process_id,
- const GURL& url,
- const base::WeakPtr<URLRequestChromeJob>& job) {
- // The embedder could put some webui pages in separate storage partition.
- // RenderProcessHostImpl::IsSuitableHost would guard against top level pages
- // being in the same process. We do an extra check to guard against an
- // exploited renderer pretending to add them as a subframe. We skip this check
- // for resources.
- bool allowed = false;
- RenderProcessHost* process = RenderProcessHost::FromID(render_process_id);
- if (process) {
- StoragePartition* partition = BrowserContext::GetStoragePartitionForSite(
- process->GetBrowserContext(), url);
- allowed = partition == process->GetStoragePartition();
- }
- BrowserThread::PostTask(
- BrowserThread::IO,
- FROM_HERE,
- base::Bind(&URLRequestChromeJob::StartAsync, job, allowed));
-}
-
-void URLRequestChromeJob::StartAsync(bool allowed) {
+void URLRequestChromeJob::StartAsync() {
if (!request_)
return;
- if (!allowed || !backend_->StartRequest(request_, this)) {
+ if (!backend_->StartRequest(request_, this)) {
NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED,
net::ERR_INVALID_URL));
}
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698