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

Commit

Permalink
Check nullity of webcontents and empty url from getURL()
Browse files Browse the repository at this point in the history
#12508 is caused by empty
url which will leads to sending {cancel: true} to callback of
`session.webRequest.onBeforeRequest` and download process will be
aborted.
Also verified this won't break the issues which
#12256 fixes

fix #12508

Auditors: @bridiver, @diracdeltas, @bsclifton
  • Loading branch information
darkdh committed Jan 8, 2018
1 parent a24496c commit 4316345
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -863,11 +863,15 @@ module.exports.getMainFrameUrl = (details) => {
if (details.resourceType === 'mainFrame') {
return details.url
}
let url = null
const tab = webContents.fromTabID(details.tabId)
try {
return tab.getURL()
} catch (ex) {}
return details.firstPartyUrl || null
if (tab && !tab.isDestroyed()) {
url = tab.getURL()
}
if (!url && details.firstPartyUrl) {
url = details.firstPartyUrl
}
return url
}

module.exports.alwaysAllowFullscreen = () => {
Expand Down

0 comments on commit 4316345

Please sign in to comment.