Skip to content

Commit

Permalink
Make blocking 3rd party fingerprinting the default behavior in AllowF…
Browse files Browse the repository at this point in the history
…ingerprinting
  • Loading branch information
yrliou committed Mar 28, 2018
1 parent ff901fc commit e9bf144
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions renderer/brave_content_settings_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,20 @@ bool BraveContentSettingsObserver::AllowFingerprinting(
bool enabled_per_settings) {
if (!enabled_per_settings)
return false;

blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
bool allow = true;
const GURL primary_url(
url::Origin(frame->Top()->GetSecurityOrigin()).GetURL());
const GURL secondary_url(
url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL());

bool allow = primary_url == secondary_url; // blocking third party by default
if (content_setting_rules_) {
ContentSetting setting = GetContentSettingFromRules(
content_setting_rules_->fingerprinting_rules, frame, secondary_url);
allow = setting != CONTENT_SETTING_BLOCK;
if (setting == CONTENT_SETTING_ALLOW || setting == CONTENT_SETTING_BLOCK) {
allow = setting != CONTENT_SETTING_BLOCK;
}
}
allow = allow || IsWhitelistedForContentSettings();

Expand Down

0 comments on commit e9bf144

Please sign in to comment.