#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)

Environment

A recent version of Adblock Plus with no filter lists

How to reproduce

  1. Add the filter 127.0.0.1#?#:-abp-properties(color: red)
  2. Load the following HTML off 127.0.0.1
<style>
  div {
    color: red;
  }
</style>
<div id="price">0.9109041176174169</div>
<script>
  setTimeout(() =>
  {
    let link = document.createElement("link");
    link.setAttribute("rel", "stylesheet");
    link.setAttribute("href", "https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css");
    document.head.appendChild(link);
  },
  5000);
</script>
  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

Notes

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.

Resolution

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

Change History (5)

comment:1 Changed 22 months ago by mjethani

  • Cc hfiguiere sebastian added

comment:2 Changed 22 months ago 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 22 months ago by mjethani (previous) (diff)

comment:3 Changed 22 months ago by mjethani

  • Keywords circumvention added

comment:4 Changed 22 months ago 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 17 months ago 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.

Note: See TracTickets for help on using tickets.