Opened on 03/08/2018 at 10:41:42 PM

Closed on 08/04/2018 at 12:13:19 PM

#6458 closed defect (worksforme)

Element hiding emulation breaks when a new style sheet is loaded

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

Description (last modified by mjethani)


A recent version of Adblock Plus with no filter lists

How to reproduce

  1. Add the filter red)
  2. Load the following HTML off
  div {
    color: red;
<div id="price">0.9109041176174169</div>
  setTimeout(() =>
    let link = document.createElement("link");
    link.setAttribute("rel", "stylesheet");
    link.setAttribute("href", "");
  1. Wait for 5 seconds

Observed behaviour

Initially the div#price element is hidden, but after 5 second it appears again once the remote style sheet has finished loading

Expected behaviour

The div#price element should remain hidden


This occurs because we only parse the newly added style sheet, so we end up overwriting the previous style sheet that had selectors relevant to the original style sheet.


This bug seems to have been fixed by recent changes and is no longer reproducible as of changeset 64e29bc1a787.

Attachments (0)

Change History (5)

comment:1 Changed on 03/08/2018 at 10:43:03 PM by mjethani

  • Cc hfiguiere sebastian added

comment:2 Changed on 03/08/2018 at 10:49:00 PM by mjethani

To fix this we should implement an append-only mode, similar to what I proposed for the collapsing selectors in patch 29670575. When only a new style sheet has been added to the document (so _addSelectors gets the stylesheets argument), we should collect any new selectors and pass the new appendOnly flag to addSelectorsFunc, which will only add the new selectors without removing any old selectors from the document.

Last edited on 03/08/2018 at 10:49:39 PM by mjethani

comment:3 Changed on 03/08/2018 at 10:50:25 PM by mjethani

  • Keywords circumvention added

comment:4 Changed on 03/08/2018 at 10:55:05 PM by mjethani

Oh, we could consider this a Platform regression because of adblockpluschrome rev:8399e34fff05, but I think we have to fix the underlying issue in both Core and Platform.

comment:5 Changed on 08/04/2018 at 12:13:19 PM by mjethani

  • Description modified (diff)
  • Resolution set to worksforme
  • Status changed from new to closed

I am unable to reproduce this now. It seems to have been fixed by recent changes.

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 (none).
Note: See TracTickets for help on using tickets.