Opened 2 years ago

Closed 2 years ago

#5956 closed defect (fixed)

[webextension] :-abp-has() fail in Firefox

Reported by: hfiguiere Assignee: hfiguiere
Priority: Unknown Milestone:
Module: Core Keywords:
Cc: arthur, trev, kzar, sebastian Blocked By:
Blocking: Platform: Firefox
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29590629/
https://codereview.adblockplus.org/29596576/

Description

Environment

Firefox nightly
Latest dev build of the webextension (900)

How to reproduce

  1. Add the filter eyeo.com#?#.column:-abp-has(#mission)
  2. Go to eyeo.com

Observed behaviour

The page in unchanged.

Expected behaviour

The "Our mission" section is hidden.

Regression

Doesn't happen on Chrome.

Change History (9)

comment:1 Changed 2 years ago by hfiguiere

In the dev tools debugger, pausing on exception and reloading the page trigger a "InvalidAccessError: A parameter or an operation is not supported by the underlying object".
It occurs when enumerating the stylesheets.

If I just add a try { } catch () block things will work.

A delay in running this _addSelectors() (like a breakpoint) will also work around by not having the error.

comment:2 Changed 2 years ago by hfiguiere

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

comment:3 Changed 2 years ago by hfiguiere

I have seen this problem happening also on Facebook.

comment:4 Changed 2 years ago by trev

#5974 has a different set of steps to reproduce, affecting Firefox 56 and older versions as well apparently.

comment:5 Changed 2 years ago by trev

I looked into this and the root cause appears to be our content script running too early, while the document is still loading. I tried checking for document.readyState == "loading" and delaying until DOMContentLoaded event in this case, it fixes the issue in both scenarios.

comment:6 Changed 2 years ago by trev

  • Review URL(s) modified (diff)

comment:7 Changed 2 years ago by hfiguiere

  • Summary changed from :-abp-has() fail in Firefox to [webextension] :-abp-has() fail in Firefox

comment:8 Changed 2 years ago by abpbot

comment:9 Changed 2 years ago by trev

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