forked from brave/browser-laptop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resovles brave#8392 Auditors: @bridiver @bbondy Test plan: - test should be green
- Loading branch information
Showing
4 changed files
with
97 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
const appConfig = require('../../../js/constants/appConfig') | ||
const siteSettings = require('../../../js/state/siteSettings') | ||
|
||
module.exports.isNoScriptEnabled = (state, settings) => { | ||
return siteSettings.activeSettings(settings, state, appConfig).noScript === true | ||
const siteSettingsState = { | ||
getAllSiteSettings: (state, frame) => { | ||
if (frame && frame.get('isPrivate')) { | ||
return state.get('siteSettings').mergeDeep(state.get('temporarySiteSettings')) | ||
} | ||
return state.get('siteSettings') | ||
}, | ||
|
||
isNoScriptEnabled (state, settings) { | ||
return siteSettings.activeSettings(settings, state, appConfig).noScript === true | ||
} | ||
} | ||
|
||
module.exports = siteSettingsState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const assert = require('assert') | ||
const { makeImmutable, isMap, isList } = require('./immutableUtil') | ||
|
||
const validateState = function (state) { | ||
state = makeImmutable(state) | ||
assert.ok(isMap(state), 'state must be an Immutable.Map') | ||
assert.ok(isList(state.get('sites')), 'state must contain an Immutable.List of sites') | ||
return state | ||
} | ||
|
||
const siteState = { | ||
getSites: (state) => { | ||
state = validateState(state) | ||
return state.get('sites') | ||
} | ||
} | ||
|
||
module.exports = siteState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters