Opened on 01/23/2019 at 02:55:31 PM

Closed on 04/10/2019 at 01:22:40 PM

Last modified on 04/25/2019 at 10:06:25 PM

#7236 closed change (fixed)

Handle sub properties in abort-on-property-* snippets.

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

https://codereview.adblockplus.org/29995559/

Description (last modified by hfiguiere)

Background

Currently we only support a simple property (like property1) in abort-on-property-read and abort-on-property-write. We need to support any like object1.property1

What to change

  • Change wrapPropertyAccess() in lib/content/snippets.js to deal with that case.
  • Add unit tests.

Hint to testers

Read

Adapted from issue #6969

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

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

    adsOptions.shown = true;
  }
},
500);

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

Write

Adapted from issue #7207

Use the same HTML as above.

/* script.js */
setTimeout(() =>
{  
  if (!window.adsOptions || !window.adsOptions.showing)
  {
    if (!window.adsOptions || typeof window.adsOptions != "object")
      window.adsOptions = {};
    window.adsOptions.showing = true;
    let ad = document.createElement("div");
    ad.id = Math.random().toString(36).substring(2);
    ad.innerHTML = "<div><span>Check this!</span><span class='label'>Ad</span></div>";
    document.body.appendChild(ad);
  }
},
500);

When you load this page, it should show the "Check this!" ad. If you then add the filter localhost#$#abort-on-property-write adsOptions.showing 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 (17)

comment:1 Changed on 01/23/2019 at 02:56:13 PM by hfiguiere

  • Cc mjethani added

comment:2 Changed on 01/23/2019 at 02:57:07 PM by arthur

  • Cc arthur added

comment:3 Changed on 01/25/2019 at 02:10:30 PM by hfiguiere

  • Keywords circumvention added

comment:4 Changed on 02/01/2019 at 08:17:29 PM by hfiguiere

  • Owner set to hfiguiere

comment:5 Changed on 02/01/2019 at 08:17:38 PM by hfiguiere

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

comment:6 Changed on 02/01/2019 at 08:18:38 PM by hfiguiere

  • Description modified (diff)

comment:7 Changed on 03/06/2019 at 12:07:01 PM by amrmak

  • Cc amr added

comment:8 Changed on 03/20/2019 at 04:47:16 PM by mjethani

  • Priority changed from Unknown to P2
  • Ready set

comment:9 Changed on 03/20/2019 at 04:47:40 PM by mjethani

Let's add some hints for testers here before we close the ticket.

comment:10 Changed on 03/20/2019 at 04:51:16 PM by abpbot

A commit referencing this issue has landed:
Issue 7236 - Handle sub properties in abort-on-property snippets

comment:11 Changed on 03/20/2019 at 04:56:31 PM by abpbot

A commit referencing this issue has landed:
Issue 7236 - Handle sub properties in abort-on-property snippets

comment:12 Changed on 03/20/2019 at 05:22:36 PM by hfiguiere

  • Description modified (diff)

comment:13 Changed on 03/20/2019 at 05:22:44 PM by hfiguiere

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

comment:14 Changed on 04/02/2019 at 01:29:20 PM by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Done. Working as expected in the browsers below.

I could not make this work on Edge (which is probably the same issue as #7409) or in Firefox Mobile (which is probably the same issue as #7410).

ABP 2.5.0.2284
Chrome 73.0.3683.86 / Windows 10
Chrome 49.0.2623.75 / Windows 10
Firefox 65.0.1 / Windows 10
Firefox 51.0 / Windows 10
Opera 58.0.3135.118 / Windows 10
Opera 36.0.2130.80 / Windows 10

comment:15 follow-up: Changed on 04/09/2019 at 10:45:53 PM by dimisa

  • Resolution fixed deleted
  • Status changed from closed to reopened

Snippet for some reason does not work. For example:

https://www.drive2.ru/cars/
drive2.ru#$#abort-on-property-write Object.defineProperty

comment:16 Changed on 04/10/2019 at 01:22:40 PM by hfiguiere

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

Please don't reopen bugs that QA verified, file a new bug instead.

Last edited on 04/10/2019 at 01:22:54 PM by hfiguiere

comment:17 in reply to: ↑ 15 Changed on 04/25/2019 at 10:06:25 PM by hfiguiere

Replying to dimisa:

Snippet for some reason does not work. For example:

https://www.drive2.ru/cars/
drive2.ru#$#abort-on-property-write Object.defineProperty

BTW, I believe this is issue #7419 that hasn't made to a release yet.

Add Comment

Modify Ticket

Change Properties
Action
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.