Skip to content

Commit

Permalink
Linter fixes
Browse files Browse the repository at this point in the history
This is a follow up of brave#7813 and resolves linter errors

Resolves brave#8061
  • Loading branch information
NejcZdovc committed Apr 5, 2017
1 parent d046ad0 commit 80ad10a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
29 changes: 20 additions & 9 deletions app/browser/ads/adBlockUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,27 @@ const mapFilterType = {
const shouldDoAdBlockCheck = (resourceType, firstPartyUrl, url, shouldCheckMainFrame) =>
firstPartyUrl.protocol &&
// By default first party hosts are allowed, but enable the check if a flag is specified in siteHacks
(
shouldCheckMainFrame ||
(resourceType !== 'mainFrame' &&
isThirdPartyHost(firstPartyUrl.hostname || '', url.hostname) ||
siteHacks[firstPartyUrl.hostname] && siteHacks[firstPartyUrl.hostname].allowFirstPartyAdblockChecks) &&
// Only check http and https for now
firstPartyUrl.protocol.startsWith('http') &&
// Only do adblock if the host isn't in the whitelist
!whitelistHosts.find((whitelistHost) => whitelistHost === url.hostname || url.hostname.endsWith('.' + whitelistHost)) &&
// Make sure there's a valid resource type before trying to use adblock
mapFilterType[resourceType] !== undefined
(
(
(
resourceType !== 'mainFrame' &&
isThirdPartyHost(firstPartyUrl.hostname || '', url.hostname)
) ||
(
siteHacks[firstPartyUrl.hostname] &&
siteHacks[firstPartyUrl.hostname].allowFirstPartyAdblockChecks
)
) &&
// Only check http and https for now
firstPartyUrl.protocol.startsWith('http') &&
// Only do adblock if the host isn't in the whitelist
!whitelistHosts.find((whitelistHost) => whitelistHost === url.hostname || url.hostname.endsWith('.' + whitelistHost)) &&
// Make sure there's a valid resource type before trying to use adblock
mapFilterType[resourceType] !== undefined
)
)

module.exports = {
mapFilterType,
Expand Down
1 change: 0 additions & 1 deletion app/renderer/components/preferences/payment/ledgerTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const aboutActions = require('../../../../../js/about/aboutActions')
const {SettingCheckbox, SiteSettingCheckbox} = require('../../settings')

class LedgerTable extends ImmutableComponent {

get synopsis () {
return this.props.ledgerData.get('synopsis')
}
Expand Down
2 changes: 1 addition & 1 deletion js/stores/eventStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const addPageView = (url, tabId) => {
tab.isDestroyed() ||
!tab.session.partition.startsWith('persist:')

if (url && isSourceAboutUrl(url) || isPrivate) {
if ((url && isSourceAboutUrl(url)) || isPrivate) {
url = null
}

Expand Down
3 changes: 2 additions & 1 deletion test/unit/about/newTabPageTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ describe('NewTab component unit tests', function () {
describe('randomBackgroundImage', function () {
it('calls random to get a random index', function () {
randomSpy.reset()
wrapper.instance().randomBackgroundImage
const result = wrapper.instance().randomBackgroundImage
assert.notEqual(result, undefined)
assert.equal(randomSpy.calledOnce, true)
})

Expand Down

0 comments on commit 80ad10a

Please sign in to comment.