marcj / css-element-queries

CSS Element-Queries aka Container Queries. High-speed element dimension/media queries in valid css.
http://marcj.github.io/css-element-queries/
MIT License
4.27k stars 487 forks source link

fix: Allow ResizeSensor to be loaded in a Firefox extension #318

Open gwhitney opened 9 months ago

gwhitney commented 9 months ago

Recent versions of the Firefox browser have a strict Content Security Policy in extension content scripts that disallows any direct or indirect string evaluation. Previously, the Function('return this') in ResizeSensor.js, used to obtain the true global window object, violated that security policy. This PR checks instead for the validity of the globalThis identifier, now provided in Firefox explicitly for the purpose that Function('return this') was being used for.

As Mozilla will not sign extensions that patch third-party packages, without a change along these lines, no extension that directly or indirectly uses ResizeSensor could be created. Hence, it would be greatly appreciated for this small change to be merged and a new release made. Thanks for considering.