Opened 3 years ago

Closed 19 months ago

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

Description (last modified by mjethani)


Consider this document:

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

And this filter: 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.


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

Change History (7)

comment:1 Changed 3 years ago by mjethani

  • Cc kzar sebastian added
  • Owner set to mjethani

comment:2 Changed 3 years ago by mjethani

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

comment:3 Changed 3 years ago by sebastian

  • Priority changed from Unknown to P3
  • Ready set

comment:4 Changed 3 years ago by amrmak

  • Cc amrmak added

comment:5 Changed 2 years ago by mjethani

  • Review URL(s) modified (diff)

Second attempt at fixing this: patch #29728690

comment:6 Changed 2 years ago by mjethani

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

This should be fixed in core.

comment:7 Changed 19 months ago by mjethani

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.