Closed Bug 1787649 Opened 2 years ago Closed 2 years ago

Window.devicePixelRatio no longer returns OS scale in extension background pages

Categories

(Firefox :: Extension Compatibility, defect)

Firefox 103
Desktop
All
defect

Tracking

()

RESOLVED DUPLICATE of bug 1798213

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.

Can you please mention what OS are you using? And please attach the about:support information? Thank you.

Flags: needinfo?(contact)

Resolving as a duplicate of bug 1798213. We can reopen if this is mistaken.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1798213
Resolution: --- → DUPLICATE
Flags: needinfo?(contact)
You need to log in before you can comment on or make changes to this bug.