However css @media orientation and also matchMedia leak - see upcoming attached pic where RFP=on, the phone is in reality in portrait mode. Orientation = landscape (spoofed), but the others say otherwise
This one is tricky. I'm not sure if spoofing the device orientation is really important, but I think we should be consistent. We should either spoof all of these values or none of them.
Orientation wouldn't even be a stable metric, IMO: and most mobile device users would orientate the same per site: i.e it is driven by content? I've never seen it in any fp scripts, TBH.
I'm not hardware savvy: but do laptop and desktop support this, e.g with rotating screens. We could ignore android, and only apply orientation to win/mac/linux. i.e least apply landscape to css media orientation like we do for the two css media resolutions. matchMedia I'm not sure about. And their will be other methods, I'm sure.
Or we could not bother. Going full screen will leak orientation. A lot of desktop/laptop users (I assume, once letterboxing is implemented: even if that only enhances rather than replaces new win sizes) will go FS, maximize, or resize to match orientation to get real estate usage: i.e inner window = your orientation. So I think it may be a losing battle. I also wonder how much this may affect functionality on some sites. And lastly, the solution IMO is Tor uptake: e.g tripling the user base etc simplistically negates what we do here now.
I'm not hardware savvy: but do laptop and desktop support this, e.g with rotating screens. We could ignore android, and only apply orientation to win/mac/linux. i.e least apply landscape to css media orientation like we do for the two css media resolutions. matchMedia I'm not sure about. And their will be other methods, I'm sure.
I tested with my Windows Surface tablet: yes desktop will reveal the orientation if you have it non-standard and yes there are open leaks where RFP doesn't work.
So this might be a WONTFIX for mobile (which I agree with) but it is an active open issue on desktop that makes a few people look quite unique. We should open a bugzilla bug for these if we don't have one...
^ and their corresponding css values (read by JS using pseudo values)
the actual css values are also displayed
the other 3 values are RFP protected
given android is made to fit the screen, the screen orientation (portrait vs landscape) is already given away by the inner window and screen dimensions and other various methods
given this I think we could/should make it more compat friendly to actually return
portrait, portrait-primary, 0
landscape, landscape-primary, 90
and nothing is lost
edit: the fact that the default (for phones with natural orientation of portrait) breaks web standards (portrait, landscape-primary, 0) is a red flag and we will be punished by it one day e.g. anti-fraud scripts
android isn't leaking any entropy that isn't a dead giveaway that we can't hide, but we should fix RFP to allow portrait-primary + 2700 as well for compat/future-footguns
desktop is fine
tablets I think are fine
note: desktops/tablets in fullscreen (which we do not hide and can use inner measurements to infer the device orientation) on a portrait device will look silly but that's OK, it's always been like this, and we don't encourage FS. Even maximized can leak this inference. That's OK
I am a little confused as to why android and desktop are different - where is this in the code? cc @pierov@tjr
Now the nitty gritty
tablets, e.g. windows devices can have a tablet mode - I do not have a tablet capable device (buy me one please @richard so my test lab is complete)
I suspect it behaves the same as desktop which means .. how would scripts know it's in tablet mode, for all intents and purposes it's a low res laptop?
So that's it - easy peasy, fixup android to allow for portrait-primary
that works on my android (expected) although I had to pull to refresh a few times in each orientation before it kicked in, and I could auto-rotate and the colors changed
not sure what this achieves, as my test already auto-changes on android, but sure - tablet not the same then
Anyway, I think we can ignore real time changes and just focus on what is returned when we load a test. And I'd like someone else to confirm desktop in all four orientations returns a1de035c [RFP desktop]
We lie about the screen dimensions. We lie about device orientation. Sometimes these are at odds, because css + matchmedia are based on our spoofed screen measurements, whilst 'mozOrientation', 'orientation.angle' and 'orientation.type' aren't
This is a red flag, and in particular, really bad on android where most users would be portrait (I assume).
I propose that we spoof 'mozOrientation', 'orientation.angle', 'orientation.type' based on our screen lies
if our screen lie is square or landscape, return landscape-primary + 0
if our screen lie is portrait, return portrait-primary, 0
^ this does not leak any entropy that we aren't already providing, albeit it a lie (screen dimensions)
^ no more paradoxes
This also means the metric becomes less stable for fingerprinting, esp tablets and phones. Users on portrait devices with newwin sizes already stood out
this has landed upstream ... awaiting next nightly to test. We should backport it to TB (I don't think it's a major issue/breakage for upstream to backport it to ESR, it's just tidying up a potential footgun - but maybe they will if you ask @fkilic nicely)
So actually, I would prefer this was backported for TB since the benefit is for android which is the majority of our users. It also makes it easier for TZP's health check