Opened 11 months ago

Last modified 7 months ago

#7141 closed change

Implement abort-current-inline-script snippet — at Version 5

Reported by: hfiguiere Assignee: hfiguiere
Priority: P2 Milestone:
Module: Core Keywords: circumvention
Cc: mjethani, arthur, sdixit Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29953560/

Description (last modified by hfiguiere)

Background

Implement abort-current-inline-script snippet that will abort a script based on a function it calls and its text content.

While this looks like issue #6983, this snippet runs on Chrome as well.

What to change

  • Add the snippet in lib/content/snippets.js.

Note for testers

  • Create the following document:
<!DOCTYPE html>
<body>
 <script>
 console.log("Hello from inline script!");
 </script>
 <script>
 console.log("There can only be one!");
 </script>
</body>

And add the following filter

example.com#$# abort-current-inline-script console.log Hello

(change the domain appropriately)

  • The console should only have "There can only be one!" printed.

Test 2:

<!DOCTYPE html>
<body>
 <script>
 console.log("Hello from inline script!");
 </script>
 <script>
 console.log("Hello from inline JavaScript!");
 </script>
 <script>
 console.log("There can only be one!");
 </script>
</body>

And the filter:

example.com#$#abort-current-inline-script console.log '/inline [A-Za-z]*[Ss]cript/'

(change the domain appropriately)

  • The console should only have "There can only be one!" printed.

Change History (5)

comment:1 Changed 11 months ago by hfiguiere

  • Owner set to hfiguiere
  • Review URL(s) modified (diff)

comment:2 Changed 11 months ago by hfiguiere

  • Status changed from new to reviewing

comment:3 Changed 11 months ago by hfiguiere

  • Description modified (diff)

comment:4 Changed 11 months ago by mjethani

We could add one more example here:

<!DOCTYPE html>
<body>
 <script>
 console.log("Hello from inline script!");
 </script>
 <script>
 console.log("Hello from inline JavaScript!");
 </script>
 <script>
 console.log("There can only be one!");
 </script>
</body>

And the filter:

example.com#$#abort-current-inline-script console.log '/inline [A-Za-z]*[Ss]cript/'
Last edited 11 months ago by mjethani (previous) (diff)

comment:5 Changed 11 months ago by hfiguiere

  • Description modified (diff)
Note: See TracTickets for help on using tickets.