Skip to content

Commit

Permalink
Restore storage partition isolation by origin.
Browse files Browse the repository at this point in the history
This got lost in the transition from muon to brave-core.  OOPS.

fix brave/brave-browser#4442
  • Loading branch information
riastradh-brave committed Jun 19, 2019
1 parent c9adcb3 commit 67d85b8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
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

0 comments on commit 67d85b8

Please sign in to comment.