Window.devicePixelRatio no longer returns OS scale in extension background pages
Categories
(Firefox :: Extension Compatibility, defect)
Tracking
()
People
(Reporter: contact, Unassigned)
Details
Window.devicePixelRatio aways returns 1 in extension background pages. This is a regression introduced by https://phabricator.services.mozilla.com/D149033 according to mozregression, and the first affected stable release is Firefox 103.0.
In Firefox 102 devicePixelRatio returns the correct OS scale in background pages, and the value is not affected by the default zoom level of the browser.
In content scripts devicePixelRatio is only affected by the zoom level of the page if "Zoom text only" is not enabled in the browser's settings, but browser.tabs.getZoom() will always return the zoom level of the page, without any indication if only the text or the the entire page content is zoomed. This ambivalence makes it difficult to calculate the OS scale in a content script, and that's why the value of devicePixelRatio from the background page was useful.
In Chromium we can reliably get the OS scale in a content script or the background page by dividing devicePixelRatio with the value of browser.tabs.getZoom(). The value of devicePixelRatio is always affected by the default zoom level, including in background pages, and there is no option to zoom the text only in the browser.
Comment 1•2 years ago
|
||
Can you please mention what OS are you using? And please attach the about:support information? Thank you.
Comment 2•2 years ago
|
||
Resolving as a duplicate of bug 1798213. We can reopen if this is mistaken.
Description
•