@@ -12,32 +12,35 @@ const {shouldDoAdBlockCheck} = require('../../../../../app/browser/ads/adBlockUt
12
12
describe ( 'adBlockUtil test' , function ( ) {
13
13
describe ( 'shouldDoAdBlockCheck' , function ( ) {
14
14
it ( 'http protocol allows ad block checks' , function ( ) {
15
- assert . ok ( shouldDoAdBlockCheck ( 'script' , new URL ( 'https://www.brave.com' ) , thirdPartyResource ) )
15
+ assert . ok ( shouldDoAdBlockCheck ( 'script' , new URL ( 'https://www.brave.com' ) , thirdPartyResource , false ) )
16
16
} )
17
17
it ( 'https protocol allows ad block checks' , function ( ) {
18
- assert . ok ( shouldDoAdBlockCheck ( 'script' , new URL ( 'https://www.brave.com' ) , thirdPartyResource ) )
18
+ assert . ok ( shouldDoAdBlockCheck ( 'script' , new URL ( 'https://www.brave.com' ) , thirdPartyResource , false ) )
19
19
} )
20
20
it ( 'ftp protocol does not allow ad block checks' , function ( ) {
21
- assert . ok ( ! shouldDoAdBlockCheck ( 'script' , new URL ( 'ftp://www.brave.com' ) , thirdPartyResource ) )
21
+ assert . ok ( ! shouldDoAdBlockCheck ( 'script' , new URL ( 'ftp://www.brave.com' ) , thirdPartyResource , false ) )
22
22
} )
23
23
it ( 'should check third party urls' , function ( ) {
24
- assert . ok ( shouldDoAdBlockCheck ( 'script' , site , thirdPartyResource ) )
24
+ assert . ok ( shouldDoAdBlockCheck ( 'script' , site , thirdPartyResource , false ) )
25
25
} )
26
26
it ( 'should NOT check first party urls' , function ( ) {
27
- assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , firstPartyResource ) )
27
+ assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , firstPartyResource , false ) )
28
28
} )
29
29
it ( 'Avoid checks with unknown resource types' , function ( ) {
30
30
// This test is valid just as long as we don't start handling beefaroni resource types in the ad block lib!!!
31
- assert . ok ( ! shouldDoAdBlockCheck ( 'beefaroni' , site , new URL ( 'https://disqus.com/test' ) ) )
31
+ assert . ok ( ! shouldDoAdBlockCheck ( 'beefaroni' , site , new URL ( 'https://disqus.com/test' ) , false ) )
32
32
} )
33
33
it ( 'should check first party hosts on youtube' , function ( ) {
34
- assert . ok ( shouldDoAdBlockCheck ( 'script' , new URL ( 'https://www.youtube.com' ) , new URL ( 'https://www.youtube.com/script.js' ) ) )
34
+ assert . ok ( shouldDoAdBlockCheck ( 'script' , new URL ( 'https://www.youtube.com' ) , new URL ( 'https://www.youtube.com/script.js' ) , false ) )
35
35
} )
36
36
it ( 'diqus is allowed as third party, for now' , function ( ) {
37
- assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , new URL ( 'https://disqus.com/test' ) ) )
38
- assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , new URL ( 'https://hello.disqus.com/test' ) ) )
39
- assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , new URL ( 'https://a.disquscdn.com/test' ) ) )
40
- assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , new URL ( 'https://b.a.disquscdn.com/test' ) ) )
37
+ assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , new URL ( 'https://disqus.com/test' ) , false ) )
38
+ assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , new URL ( 'https://hello.disqus.com/test' ) , false ) )
39
+ assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , new URL ( 'https://a.disquscdn.com/test' ) , false ) )
40
+ assert . ok ( ! shouldDoAdBlockCheck ( 'script' , site , new URL ( 'https://b.a.disquscdn.com/test' ) , false ) )
41
+ } )
42
+ it ( 'should NOT check third party urls for main frame' , function ( ) {
43
+ assert . ok ( shouldDoAdBlockCheck ( 'mainFrame' , site , site , true ) )
41
44
} )
42
45
} )
43
46
} )
0 commit comments