Opened 4 years ago

Closed 2 years ago

#3356 closed defect (duplicate)

Calling Element.createShadowRoot() for an element which already hosts a shadow root is deprecated

Reported by: mapx Assignee:
Priority: Unknown Milestone:
Module: Platform Keywords:
Cc: sebastian, greiner, kzar Blocked By:
Blocking: Platform: Chrome
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by greiner)

Environment

windows 10
ABP 1.9.4.1498
chrome Version 47.0.2526.73 beta-m (64-bit)

How to reproduce

I can see this warning message:

Calling Element.createShadowRoot() for an element which already hosts a shadow root is deprecated. See https://www.chromestatus.com/feature/4769966083538944 for more details.

http://c.speedtest.net/javascript/speedtest-main.js?p=BJIYQ46qcn06&r=6260TU1USUl-SzZ7MCsxKjE1KDIzI0h9KCsxfiIuKyowSCohMEkrKycoe0gmLw%3D%3D&q=207437xt%3DGl9%26%40%3DlD%26kD%3DCmw&s=C392600RWhhXV5FemFXRWphVF5XX1peV11dX1hcXl5dWllgXlhFbmEy%3D&i=

This could be why the ads on chrome (for speedtest) aren't blocked / hidden ? In firefox + ABP it's ok. Also, I get the ads only using an US VPN.

Change History (5)

comment:1 Changed 4 years ago by greiner

  • Description modified (diff)

comment:2 in reply to: ↑ description Changed 4 years ago by sebastian

I don't really see a way to tackle this, while using shadow DOM. We create our shadow DOM before any of the page's JS runs. So checking for an existing shadow root won't help. And creating our shadow root later would cause other issues, see #452.

On a related note createShadowRoot has been removed from the standard and got superseded by attachShadowRoot which however neither supports multiple shadow trees, besides not being implemented by any browser yet.

Also considering other issues we run into with shadow DOM so far, and the growing list of workarounds we had to implement, maybe it's time to give up on shadow DOM for element hiding.

Note that we initially started to use shadow DOM to avoid side effects on pages that rely on the order/presense of own stylesheets in the light DOM. However, once chrome.tabs.insertCSS supports specifying a frameId we could use that API instead.

Replying to mapx:

This could be why the ads on chrome (for speedtest) aren't blocked / hidden ? In firefox + ABP it's ok. Also, I get the ads only using an US VPN.

That is unlikely. As of now, it should work as it has used to be, but merely showing a warning. However, it's also unlikely that chrome.tabs.insertCSS will solve issues like that as we still stick with an author stylesheet on Chrome as opposed to Firefox where we can use user stylesheets which have a higher priority.

comment:4 Changed 4 years ago by sebastian

That's true. We, however, found another issue with chrome.tabs.insertCSS. Stylesheets injected using that API have lower priority than any other stylesheet. So websites could easily override our styles, and they wouldn't even have to use inline styles therefore. So unfortunatelly, unless Chrome reintroduces user stylesheets, and uses these for chrome.tabs.insertCSS, that API is more or less useless.

comment:5 Changed 2 years ago by sebastian

  • Resolution set to duplicate
  • Status changed from new to closed

Closing as duplicate of #242, also see #4713.

Note: See TracTickets for help on using tickets.