Closed Bug 1343688 Opened 9 years ago Closed 3 years ago

WebExtension: devicePixelRatio in background page is always 1

Categories

(WebExtensions :: General, defect, P3)

54 Branch
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1798213

People

(Reporter: n.gollenstede, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0 Build ID: 20170223185858 Steps to reproduce: 1. Load any WebExtension 2. Open its debugger via 'about:debugging' 3. Enter 'devicePixelRatio' [enter] in the console Actual results: It returns '1', regardless of the screen setup. Expected results: It should return the actual devicePixelRatio. If multiple displays with different dprs are connected, it should probably return the maximum, or that of the primary display.
This is especially relevant because the positioning of windows with the `browser.window` API expects scaled CSS px values, not the native device pixels. I imagine this can cause some very confusing bugs if the add-on dev doesn't happen to have a devicePixelRatio other than 1 themselves. The global `screen` object also has unscaled values, so it isn't even possible to reliably create a window that covers say half the screen or is centered. On my phone on the other hand the devicePixelRatio is reported correctly even in the background page. The `screen` object however contains unscaled values too, which is incorrect here. Another use-case I have found that needs the correct devicePixelRatio is loading images in the native resolution so they don't look blurry.
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
Flags: needinfo?(kmaglione+bmo)
Flags: needinfo?(kmaglione+bmo)
Priority: -- → P3
Product: Toolkit → WebExtensions
Component: Untriaged → General
Severity: normal → S3

Resolving as a duplicate of bug 1798213. We can reopen if you think this is a mistake.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Duplicate of bug: 1798213
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.