Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Make shieldsDown take precedence
Browse files Browse the repository at this point in the history
Fix #2950

Auditors: @diracdeltas
  • Loading branch information
bbondy committed Aug 10, 2016
1 parent 034e476 commit 314751e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/state/contentSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ const getContentSettingsFromSiteSettings = (appState) => {
}

let hostSettings = appState.get('siteSettings').toJS()
for (var hostPattern in hostSettings) {
// We do 2 passes for setting content settings. On the first pass we consider all shield types.
for (let hostPattern in hostSettings) {
let hostSetting = hostSettings[hostPattern]
if (typeof hostSetting.noScript === 'boolean') {
// TODO: support temporary override
Expand All @@ -134,8 +135,10 @@ const getContentSettingsFromSiteSettings = (appState) => {
if (typeof hostSetting.flash === 'number') {
addContentSettings(contentSettings.flashActive, hostPattern, '*', 'allow')
}

// these should always be the last rules so they take precendence over the others
}
// On the second pass we consider only shieldsUp === false settings since we want those to take precedence.
for (let hostPattern in hostSettings) {
let hostSetting = hostSettings[hostPattern]
if (hostSetting.shieldsUp === false) {
addContentSettings(contentSettings.cookies, hostPattern, '*', 'allow')
addContentSettings(contentSettings.canvasFingerprinting, hostPattern, '*', 'allow')
Expand Down

1 comment on commit 314751e

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.