Skip to content

Commit

Permalink
Example of breaking scriptlet
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmod committed Oct 27, 2023
1 parent 15f841c commit f2aa9ad
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions packages/adblocker/test/parsing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2146,6 +2146,17 @@ describe('scriptlets arguments parsing', () => {

it('complex', () => {
for (const [scriptlet, expected] of [
[
'www.amazon.de#@#+js(xml-prune, xpath(//*[name()="Period"][.//*[@value="Ad"]] | //*[name()="Period"]/@start), [value="Ad"], .mpd)',
{
name: 'xml-prune',
args: [
'xpath(//*[name()="Period"][.//*[@value="Ad"]] | //*[name()="Period"]/@start)',
'[value="Ad"]',
'.mpd',
],
},
],
[
'acs, Math, /\\}\\s*\\(.*?\\b(self|this|window)\\b.*?\\)/',
{
Expand Down Expand Up @@ -2216,18 +2227,18 @@ describe('scriptlets arguments parsing', () => {
'trusted-replace-fetch-response, /\\"adPlacements.*?true.*?\\"\\}\\}\\}\\]\\,/, , url:player?key= method:/post/i',
{
name: 'trusted-replace-fetch-response',
args: [
'/\\"adPlacements.*?true.*?\\"\\}\\}\\}\\]\\,/',
'',
'url:player?key= method:/post/i',
],
args: ['/\\"adPlacements.*?true.*?\\"\\}\\}\\}\\]\\,/', '', 'url:player?key= method:/post/i'],
},
],
[
'trusted-replace-fetch-response, /\\"adPlacements.*?\\"\\}\\}\\}\\]\\,/, , url:player?key= method:/post/i bodyUsed:true',
{
name: 'trusted-replace-fetch-response',
args: ['/\\"adPlacements.*?\\"\\}\\}\\}\\]\\,/', '', 'url:player?key= method:/post/i bodyUsed:true'],
args: [
'/\\"adPlacements.*?\\"\\}\\}\\}\\]\\,/',
'',
'url:player?key= method:/post/i bodyUsed:true',
],
},
],
[
Expand Down

0 comments on commit f2aa9ad

Please sign in to comment.