Opened on 03/05/2018 at 09:58:22 PM

Closed on 03/16/2019 at 03:44:00 PM

#6446 closed change (fixed)

Avoid injecting same style sheet twice

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

https://codereview.adblockplus.org/29714638/
https://codereview.adblockplus.org/29728690/

Description (last modified by mjethani)

Background

Consider this document:

<style>
div {
  color: red;
}
</style>
<div id="price">0.9109041176174169</div>
<script>
setInterval(() =>
{         
  document.getElementById("price").textContent = Math.random();
},
1000);
</script>

And this filter: 127.0.0.1#?#:-abp-properties(color: red)

On Firefox this causes the same style sheet to be injected every one second. Since this is not allowed on Firefox, tabs.insertCSS throws. It is allowed on Chrome though (I implemented it), and Chrome will just insert a duplicate style sheet. Subsequent calls to tabs.removeCSS will then only remove the last matching style sheet.

The correct thing to do here is to make sure we don't inject the same style sheet twice.

Also see #6458.

What to change

In lib/content/elemHideEmulation.js, do not add the exact same list of selectors twice.

Resolution

See #6504. We no longer use style sheets for any element hiding emulation filters (not even :-abp-properties()).

Attachments (0)

Change History (7)

comment:1 Changed on 03/05/2018 at 09:59:32 PM by mjethani

  • Cc kzar sebastian added
  • Owner set to mjethani

comment:2 Changed on 03/05/2018 at 10:43:58 PM by mjethani

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

comment:3 Changed on 03/05/2018 at 10:45:27 PM by sebastian

  • Priority changed from Unknown to P3
  • Ready set

comment:4 Changed on 03/08/2018 at 06:49:34 PM by amrmak

  • Cc amrmak added

comment:5 Changed on 06/12/2018 at 08:04:05 AM by mjethani

  • Review URL(s) modified (diff)

Second attempt at fixing this: patch #29728690

comment:6 Changed on 08/04/2018 at 11:37:51 AM by mjethani

  • Component changed from Platform to Core
  • Description modified (diff)

This should be fixed in core.

comment:7 Changed on 03/16/2019 at 03:44:00 PM by mjethani

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

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