Opened on 09/20/2018 at 07:53:51 PM

Closed on 11/08/2018 at 01:04:30 AM

Last modified on 03/20/2019 at 01:11:38 AM

#6969 closed change (fixed)

Implement abort-on-property-read snippet

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

Description (last modified by mjethani)


Some circumvention scripts depend on global properties on the window object. The execution of such scripts can be aborted by throwing an error when the property is read.

There is a technique in uBlock Origin called abort-on-property-read that does this.

What to change

Implement a snippet called abort-on-property-read that wraps a given property of the window object and throws an error if the property is read.

Hints for testers

Try this:

<!-- test.html -->
  Lorem ipsum dolor sit amet, consectetur
  adipiscing elit, sed do eiusmod tempor
  incididunt ut labore et dolore magna aliqua.
<script src="script.js"></script>
/* script.js */
adsShown = false;

setTimeout(() =>
  if (!adsShown)
    let ad = document.createElement("div"); = Math.random().toString(36).substring(2);
    ad.innerHTML = "<div><span>Check this!</span><span class='label'>Ad</span></div>";

    adsShown = true;

When you load this page, it should show the "Check this!" ad. If you then add the filter localhost#$#abort-on-property-read adsShown and reload the page, the ad should no longer be shown. Also there should be no error in the tab's console.

Attachments (0)

Change History (25)

comment:1 Changed on 09/20/2018 at 07:54:32 PM by hfiguiere

  • Description modified (diff)
  • Owner set to hfiguiere

comment:2 Changed on 09/20/2018 at 10:14:00 PM by hfiguiere

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed on 09/21/2018 at 08:26:35 AM by arthur

  • Cc arthur added

comment:4 Changed on 09/21/2018 at 12:18:13 PM by hfiguiere

  • Cc Ross added
  • Description modified (diff)

comment:5 Changed on 09/21/2018 at 12:18:35 PM by hfiguiere

  • Description modified (diff)

comment:6 Changed on 09/21/2018 at 08:12:44 PM by hfiguiere

  • Description modified (diff)

comment:7 Changed on 10/30/2018 at 10:33:32 PM by hfiguiere

  • Description modified (diff)

comment:8 Changed on 10/30/2018 at 10:59:48 PM by mjethani,,,$#abort-on-property-read trckd,,,$#abort-on-property-read uabpd3

This can also be just one filter, like so:,,,$#abort-on-property-read trckd; abort-on-property-read uabpd3

comment:9 Changed on 10/31/2018 at 09:06:11 PM by abpbot

A commit referencing this issue has landed:
Issue 6969 - Implement abort-on-property-read snippet

comment:10 Changed on 10/31/2018 at 09:06:53 PM by hfiguiere

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:11 Changed on 11/07/2018 at 11:43:12 AM by abpbot

A commit referencing this issue has landed:
Issue 6969 - Implement abort-on-property-read snippet

comment:12 Changed on 11/07/2018 at 11:58:03 AM by mjethani

Hubert, I think the hints for testers should have a standalone test case just like all the other snippets (see #6919 for example).

comment:13 Changed on 11/07/2018 at 12:39:49 PM by mjethani

  • Resolution fixed deleted
  • Status changed from closed to reopened

I am reopening this until there's a standalone test case.

comment:14 Changed on 11/08/2018 at 01:04:30 AM by mjethani

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from reopened to closed

comment:15 Changed on 11/08/2018 at 01:05:00 AM by mjethani

  • Ready set

comment:16 Changed on 11/08/2018 at 01:43:41 AM by mjethani

  • Description modified (diff)

comment:17 Changed on 11/08/2018 at 01:45:41 AM by mjethani

  • Description modified (diff)

comment:18 Changed on 11/08/2018 at 02:14:50 AM by mjethani

  • Description modified (diff)

comment:19 Changed on 11/08/2018 at 02:15:25 AM by mjethani

  • Description modified (diff)

comment:20 Changed on 11/08/2018 at 07:22:20 PM by hfiguiere

We should make a new test page with this.

comment:21 Changed on 11/08/2018 at 08:06:21 PM by Ross

Thanks for the test HTML. I agree all of these examples should be added to the proper test pages. I've added this one to the list of test data to create to the Test Data section of the ABP WebEx Testing notes document.

comment:22 Changed on 11/08/2018 at 08:29:18 PM by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Done. This works with the example provided with no errors and as far as I can tell, seems to be working fine removing the ads on the domains listed above in comment 8.

Firefox 63 / 51 / Windows 8
Chrome 70 / 49 / Windows 8
Opera 36 / 56 / Windows 8

comment:23 Changed on 11/14/2018 at 07:11:33 PM by hfiguiere

  • Sensitive unset

comment:24 Changed on 03/19/2019 at 06:40:01 PM by SMed79

Question: Does SNIPPET options have an exception syntax rule?

Background: Debug an issue without disabling the main list (ABP filters). xyz done not seems to work (tested for #114, #99 & #112)

Last edited on 03/19/2019 at 06:50:45 PM by SMed79

comment:25 Changed on 03/20/2019 at 01:11:38 AM by mjethani

@SMed79 not yet, but the plan is to apply such exceptions to snippet filters as well (#6842). We will do it soon.

Add Comment

Modify Ticket

Change Properties
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from hfiguiere.
Note: See TracTickets for help on using tickets.