Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore storage partition isolation by origin. #2434

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions browser/brave_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,35 @@ GURL BraveContentBrowserClient::GetEffectiveURL(
return url;
#endif
}

std::string BraveContentBrowserClient::GetStoragePartitionIdForSite(
content::BrowserContext* browser_context,
const GURL& site) {
std::string partition_id =
ChromeContentBrowserClient::GetStoragePartitionIdForSite(
browser_context, site);
if (browser_context->IsTorProfile()) {
partition_id = site.spec();
}
DCHECK(IsValidStoragePartitionId(browser_context, partition_id));
return partition_id;
}

void BraveContentBrowserClient::GetStoragePartitionConfigForSite(
content::BrowserContext* browser_context,
const GURL& site,
bool can_be_default,
std::string* partition_domain,
std::string* partition_name,
bool* in_memory) {
ChromeContentBrowserClient::GetStoragePartitionConfigForSite(
browser_context, site, can_be_default, partition_domain, partition_name,
in_memory);
if (browser_context->IsTorProfile()) {
if (!site.is_empty()) {
*partition_domain = site.host();
*partition_name = "tor";
}
*in_memory = true;
}
}
11 changes: 11 additions & 0 deletions browser/brave_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ class BraveContentBrowserClient : public ChromeContentBrowserClient {
GURL GetEffectiveURL(content::BrowserContext* browser_context,
const GURL& url) override;

std::string GetStoragePartitionIdForSite(
content::BrowserContext* browser_context,
const GURL& site) override;
void GetStoragePartitionConfigForSite(
content::BrowserContext* browser_context,
const GURL& site,
bool can_be_default,
std::string* partition_domain,
std::string* partition_name,
bool* in_memory) override;

private:
bool AllowAccessCookie(const GURL& url, const GURL& first_party,
content::ResourceContext* context, int render_process_id,
Expand Down