For Firefox on OS X, at least, it seems to be reporting the resolution of the display which the window is mostly on.
I think this corresponds to the display which holds the backing store for the window, but I'm not sure -- if you drag a window between a HiDPI display and a normal display, for example, it's rendered as a HiDPI window if it's mostly on the HiDPI display, and vice versa.
I agree that I don't know if it's possible to do the "right" thing, or even exactly what the "right" thing would be.
I'm not really sure if it's a glitch in the tool or that the resolution is (deliberately?) misreported by my browser, but on my iPad 3 it reports 1024x768.
A nice extension to this would be to add some kind of database of popular mobile devices, so you can detect the device type from the reported attributes. I think you coud extract some interesting device usage statistics out of it.
I think this corresponds to the display which holds the backing store for the window, but I'm not sure -- if you drag a window between a HiDPI display and a normal display, for example, it's rendered as a HiDPI window if it's mostly on the HiDPI display, and vice versa.
I agree that I don't know if it's possible to do the "right" thing, or even exactly what the "right" thing would be.