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

Commit

Permalink
Merge pull request #12555 from brave/issue-12508
Browse files Browse the repository at this point in the history
Check nullity of webcontents and empty url from getURL()
  • Loading branch information
bsclifton authored Jan 8, 2018
2 parents 9f70216 + 4316345 commit 726ac1c
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 726ac1c

Please sign in to comment.