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

Commit

Permalink
route safebrowsing and httpse messages by tabId
Browse files Browse the repository at this point in the history
fixes #3367
requires brave/muon@a6046ca
  • Loading branch information
bridiver committed Aug 25, 2016
1 parent 88f10e3 commit a12cac4
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,27 +315,26 @@ class Main extends ImmutableComponent {
windowActions.setActiveFrame(self.props.windowState.getIn(['frames', self.props.windowState.get('frames').size - 1])))

ipc.on(messages.BLOCKED_RESOURCE, (e, blockType, details) => {
const filteredFrameProps = this.props.windowState.get('frames').filter((frame) => frame.get('provisionalLocation') === details.firstPartyUrl)
filteredFrameProps.forEach((frameProps) =>
windowActions.setBlockedBy(frameProps, blockType, details.url))
const frameProps = FrameStateUtil.getFrameByTabId(self.props.windowState, details.tabId)
frameProps && windowActions.setBlockedBy(frameProps, blockType, details.url)
})

ipc.on(messages.BLOCKED_PAGE, (e, blockType, details) => {
const filteredFrameProps = this.props.windowState.get('frames').filter((frame) => frame.get('provisionalLocation') === details.firstPartyUrl)
filteredFrameProps.forEach((frameProps) => {
if (blockType === appConfig.resourceNames.SAFE_BROWSING) {
// Since Safe Browsing never actually loads the main frame we need to add history here.
// That way about:safebrowsing can figure out the correct location.
windowActions.addHistory(frameProps)
}
windowActions.loadUrl(frameProps, blockType === appConfig.resourceNames.SAFE_BROWSING ? 'about:safebrowsing' : 'about:blank')
})
const frameProps = FrameStateUtil.getFrameByTabId(self.props.windowState, details.tabId)
if (!frameProps) {
return
}
if (blockType === appConfig.resourceNames.SAFE_BROWSING) {
// Since Safe Browsing never actually loads the main frame we need to add history here.
// That way about:safebrowsing can figure out the correct location.
windowActions.addHistory(frameProps)
}
windowActions.loadUrl(frameProps, blockType === appConfig.resourceNames.SAFE_BROWSING ? 'about:safebrowsing' : 'about:blank')
})

ipc.on(messages.HTTPSE_RULE_APPLIED, (e, ruleset, details) => {
const filteredFrameProps = this.props.windowState.get('frames').filter((frame) => frame.get('provisionalLocation') === details.firstPartyUrl)
filteredFrameProps.forEach((frameProps) =>
windowActions.setRedirectedBy(frameProps, ruleset, details.url))
const frameProps = FrameStateUtil.getFrameByTabId(self.props.windowState, details.tabId)
frameProps && windowActions.setRedirectedBy(frameProps, ruleset, details.url)
})

ipc.on(messages.SHOW_NOTIFICATION, (e, text) => {
Expand Down

0 comments on commit a12cac4

Please sign in to comment.