ShadowRoot.adoptedStylesheets returns an opaque object in content scripts
Categories
(WebExtensions :: General, defect, P3)
Tracking
(firefox-esr102 affected, firefox110 affected, firefox111 affected, firefox112 affected)
People
(Reporter: gildas.lormeau, Unassigned)
References
(Depends on 1 open bug)
Details
Attachments
(1 file)
1.09 MB,
application/octet-stream
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/111.0
Steps to reproduce:
This issue can be reproduced with SingleFile:
- Install SingleFile from here: https://addons.mozilla.org/en-US/firefox/addon/single-file/
- Save with SingleFile this page: https://www.virustotal.com/gui/file/49184a08df66331b671fbe93b40c34afe3b943475bca0568a22bebd1208e1164/details
- Open the saved page
Actual results:
The layout of the page is broken.
Expected results:
The layout of the page should be OK. Also, this bug does not happen if you do the same test in a Chromium-based browser.
The bug is due to the fact that ShadowRoot.adoptedStyleSheets can't be read in a content script and throws an exception.
Reporter | ||
Updated•2 years ago
|
Comment 1•2 years ago
•
|
||
[Tracking Requested - why for this release]:
Hello,
following the indicated steps, I have reproduced the issue on
MacOS 12.5 and Win 11, with Fx versions: Nightly 112.0a1 (21-Feb-2023) and 101.0b1-candidates.
This seems to be a regression:
- last good release: 100.0
- first bad release: 101.0
I used these in mozregression and found:
pushlog_url: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=23768574eb6d1c1191228316adbc082aaf3a7fd5&tochange=6d8eefa220596a138aceee2b8e93529128c98451
Comment 2•2 years ago
|
||
Reporter | ||
Comment 3•1 year ago
|
||
Any news about this regression? I'm still surprised that if I use Element#openOrClosedShadowRoot
then ShadowRoot.adoptedStyleSheets
can be opaque. This is also a compatibility issue since this bug does not exist in Chromium-based browsers.
Reporter | ||
Comment 4•1 year ago
|
||
For the record, I've implemented a workaround for this bug in SingleFile. It consists in injecting a script into the web page in order to read the adoptedStylesheets
property and communicate the serialized content to the content script of the extension.
This is not a regression, this was never implemented correctly (the range you found shows the initial implementation of constructable stylesheets), which is an architectural problem in Firefox's XRays. As a workaround you can use document.wrappedJSObject.adoptedStyleSheets
directly from the content script without injecting anything. It's still unsafe, of course, and in some cases may require using cloneInto
helper function.
Updated•8 months ago
|
Comment 6•7 months ago
|
||
The severity field is not set for this bug.
:zombie, could you have a look please?
For more information, please visit BugBot documentation.
Updated•7 months ago
|
Description
•