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

noscript exceptions from private tabs should not apply to regular tabs #8783

Merged
merged 1 commit into from
May 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/appActions.md
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ Dispatches a message when a tab is being cloned



### noScriptExceptionsAdded(hostPattern, origins)
### noScriptExceptionsAdded(hostPattern, origins, temporary)

Dispatches a message when noscript exceptions are added for an origin

Expand All @@ -776,6 +776,8 @@ Dispatches a message when noscript exceptions are added for an origin

**origins**: `Object.<string, (boolean|number)>`, Dispatches a message when noscript exceptions are added for an origin

**temporary**: `boolean`, Dispatches a message when noscript exceptions are added for an origin



### setObjectId(objectId, objectPath)
Expand Down
6 changes: 4 additions & 2 deletions js/actions/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -943,12 +943,14 @@ const appActions = {
* Dispatches a message when noscript exceptions are added for an origin
* @param {string} hostPattern
* @param {Object.<string, (boolean|number)>} origins
* @param {boolean} temporary
*/
noScriptExceptionsAdded: function (hostPattern, origins) {
noScriptExceptionsAdded: function (hostPattern, origins, temporary) {
AppDispatcher.dispatch({
actionType: appConstants.APP_ADD_NOSCRIPT_EXCEPTIONS,
hostPattern,
origins
origins,
temporary
})
},

Expand Down
2 changes: 1 addition & 1 deletion js/components/noScriptInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class NoScriptInfo extends ImmutableComponent {
}
})
if (checkedOrigins.filter((value) => value !== false).size) {
appActions.noScriptExceptionsAdded(this.origin, checkedOrigins)
appActions.noScriptExceptionsAdded(this.origin, checkedOrigins, this.isPrivate)
this.reload()
this.props.onHide()
}
Expand Down
21 changes: 12 additions & 9 deletions js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,15 +562,18 @@ const handleAppAction = (action) => {
break
}
case appConstants.APP_ADD_NOSCRIPT_EXCEPTIONS:
// Note that this is always cleared on restart or reload, so should not
// be synced or persisted.
let key = 'noScriptExceptions'
if (!action.origins || !action.origins.size) {
// Clear the exceptions
appState = appState.setIn(['siteSettings', action.hostPattern, key], new Immutable.Map())
} else {
const currentExceptions = appState.getIn(['siteSettings', action.hostPattern, key]) || new Immutable.Map()
appState = appState.setIn(['siteSettings', action.hostPattern, key], currentExceptions.merge(action.origins))
{
const propertyName = action.temporary ? 'temporarySiteSettings' : 'siteSettings'
// Note that this is always cleared on restart or reload, so should not
// be synced or persisted.
const key = 'noScriptExceptions'
if (!action.origins || !action.origins.size) {
// Clear the exceptions
appState = appState.setIn([propertyName, action.hostPattern, key], new Immutable.Map())
} else {
const currentExceptions = appState.getIn([propertyName, action.hostPattern, key]) || new Immutable.Map()
appState = appState.setIn([propertyName, action.hostPattern, key], currentExceptions.merge(action.origins))
}
}
break
case appConstants.APP_UPDATE_LEDGER_INFO:
Expand Down