Skip to content

Commit

Permalink
Set correct permission notification index
Browse files Browse the repository at this point in the history
Auditors: @bridiver
  • Loading branch information
bbondy authored and syuan100 committed Nov 9, 2017
1 parent ac993d7 commit d379bd5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ function registerPermissionHandler (session, partition) {

// If this is a duplicate, clear the previous callback and use the new one
if (permissionCallbacks[message]) {
permissionCallbacks[message](0, false, i)
permissionCallbacks[message](0, false)
}

appActions.showNotification({
Expand All @@ -503,7 +503,11 @@ function registerPermissionHandler (session, partition) {
message
})

permissionCallbacks[message] = (buttonIndex, persist, index) => {
// Use a closure here for the index instead of passing an index to the
// function because ipcMain.on(messages.NOTIFICATION_RESPONSE above
// calls into the callback without knowing an index.
const index = i
permissionCallbacks[message] = (buttonIndex, persist) => {
// hide the notification if this was triggered automatically
appActions.hideNotification(message)
const result = !!(buttonIndex)
Expand Down

0 comments on commit d379bd5

Please sign in to comment.