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

Commit

Permalink
Merge pull request #66 from brave/fix_3p_noscript
Browse files Browse the repository at this point in the history
Only keep user-allowed origins in the noScriptInfo when a navigation …
  • Loading branch information
bbondy authored Sep 26, 2018
2 parents 64d8d2f + b57edae commit dfac903
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion app/state/shieldsPanelState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ export const resetNoScriptInfo: shieldState.ResetNoScriptInfo = (state, tabId, n
if (newOrigin !== tabs[tabId].origin) { // navigate away
tabs[tabId].noScriptInfo = {}
}
Object.keys(tabs[tabId].noScriptInfo).map(key => tabs[tabId].noScriptInfo[key].actuallyBlocked = false)
Object.keys(tabs[tabId].noScriptInfo).map(key => {
tabs[tabId].noScriptInfo[key].actuallyBlocked = false
// only keep entries which users want to allow
if (tabs[tabId].noScriptInfo[key].willBlock) {
delete tabs[tabId].noScriptInfo[key]
}
})
return { ...state, tabs }
}

Expand Down
3 changes: 1 addition & 2 deletions test/app/state/shieldsPanelStateTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ describe('shieldsPanelState test', () => {
url: 'https://brave.com',
noScriptInfo: {
'https://a.com': { actuallyBlocked: true, willBlock: true },
'https://b.com': { actuallyBlocked: false, willBlock: false }
'https://b.com': { actuallyBlocked: true, willBlock: false }
},
adsBlockedResources: [],
trackersBlockedResources: [],
Expand Down Expand Up @@ -796,7 +796,6 @@ describe('shieldsPanelState test', () => {
fingerprintingBlocked: 0,
url: 'https://brave.com',
noScriptInfo: {
'https://a.com': { actuallyBlocked: false, willBlock: true },
'https://b.com': { actuallyBlocked: false, willBlock: false }
},
adsBlockedResources: [],
Expand Down

0 comments on commit dfac903

Please sign in to comment.