greasemonkey / greasemonkey

Greasemonkey is a user script manager for Firefox.
http://www.greasespot.net/
Other
2.32k stars 327 forks source link

Cannot access cross-origin style sheets #3151

Open CendioOssman opened 2 years ago

CendioOssman commented 2 years ago

I want to add a script that dynamically adjusts a page's style sheets. Unfortunately, that fails for many sites with:

Uncaught DOMException: CSSStyleSheet.rules getter: Not allowed to access cross-origin stylesheet debugger eval code:1:1

The code to provoke this is simply a document.styleSheets[0].cssRules. Try it on e.g. StackOverflow.

I'm guessing some bypass is needed to allow a user script more privileges that a normal page script.

Is this already possible somehow? Or does something need to change within greasemonkey and/or Firefox?

I found this discussion which seemed relevant, but I'm not sure of the implications for greasemonkey:

https://bugzilla.mozilla.org/show_bug.cgi?id=1393022

arantius commented 2 years ago

Your bugzilla link looks very relevant, and I don't think Greasemonkey can do anything here.

CendioOssman commented 2 years ago

A shame. I'll give Mozilla a poke and see if this limitation can be lifted.