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 63f28a5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion 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 @@ -2227,7 +2238,11 @@ describe('scriptlets arguments parsing', () => {
'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 63f28a5

Please sign in to comment.