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 #11005 from brave/11004
Browse files Browse the repository at this point in the history
Allow adblock checking within the same origin
  • Loading branch information
bbondy authored Sep 19, 2017
2 parents 22c3129 + b33835f commit 560f997
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
19 changes: 2 additions & 17 deletions app/browser/ads/adBlockUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const {siteHacks} = require('../../../js/data/siteHacks')
const {FilterOptions} = require('ad-block')
const isThirdPartyHost = require('../isThirdPartyHost')

const whitelistHosts = ['disqus.com', 'a.disquscdn.com']

/**
Expand All @@ -30,20 +27,8 @@ 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
)
)
) &&
// By default first party hosts are allowed
(shouldCheckMainFrame || resourceType !== 'mainFrame') &&
// Only check http and https for now
firstPartyUrl.protocol.startsWith('http') &&
// Only do adblock if the host isn't in the whitelist
Expand Down
6 changes: 0 additions & 6 deletions js/data/siteHacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ module.exports.siteHacks = {
'player.siriusxm.com': {
enableFlashCTP: true,
redirectURL: 'https://player.siriusxm.com'
},
'www.youtube.com': {
allowFirstPartyAdblockChecks: true
},
'www.theatlantic.com': {
allowFirstPartyAdblockChecks: true
}
}

Expand Down

1 comment on commit 560f997

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.