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

Commit

Permalink
only send ipc messages to the hostWebContents of the tab that generat…
Browse files Browse the repository at this point in the history
…ed them

fix #9701
  • Loading branch information
bridiver committed Jun 25, 2017
1 parent d99c5c6 commit bb82dfd
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,16 @@ function registerForBeforeRequest (session, partition) {
appActions.addResourceCount(parentResourceName, 1)
}

BrowserWindow.getAllWindows().forEach((wnd) =>
wnd.webContents.send(message, parentResourceName, {
tabId: details.tabId,
url: details.url
}))
// TODO(bridiver) - convert to appActions/appState
setImmediate(() => {
const tab = webContents.fromTabID(details.tabId)
if (tab && tab.hostWebContents) {
tab.hostWebContents.send(message, parentResourceName, {
tabId: details.tabId,
url: details.url
})
}
})

if (parentResourceName === appConfig.resourceNames.SAFE_BROWSING) {
let redirectURL = appUrlUtil.getTargetAboutUrl('about:safebrowsing#' + details.url)
Expand All @@ -167,11 +172,16 @@ function registerForBeforeRequest (session, partition) {
if (isHttpsEverywhere) {
appActions.addResourceCount(results.resourceName, 1)
}
BrowserWindow.getAllWindows().forEach((wnd) =>
wnd.webContents.send(messages.HTTPSE_RULE_APPLIED, results.ruleset, {
tabId: details.tabId,
url: details.url
}))
// TODO(bridiver) - convert to appActions/appState
setImmediate(() => {
const tab = webContents.fromTabID(details.tabId)
if (tab && tab.hostWebContents) {
tab.hostWebContents.send(messages.HTTPSE_RULE_APPLIED, results.ruleset, {
tabId: details.tabId,
url: details.url
})
}
})
}
cb({redirectURL: results.redirectURL})
return
Expand Down

0 comments on commit bb82dfd

Please sign in to comment.