Closed Bug 1472618 Opened 6 years ago Closed 6 years ago

navigator.platform returns "Win64" in Firefox on Win64 OS but "Win32" in Chrome and Edge

Categories

(Core :: DOM: Core & HTML, defect, P3)

62 Branch
x86_64
Windows
defect

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox-esr52 --- wontfix
firefox-esr60 --- wontfix
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

()

Details

(5 keywords)

Attachments

(1 file)

Bug 483118 made navigator.platform return "Win64" for 64-bit Firefox because 64-bit IE (presumably IE8 because the bug was filed in 2009) returned "Win64". But today in 2018, 64-bit Chrome and Edge return "Win32" even though their User-Agent strings say "Win64; x64". 64-bit IE11 still returns "Win64" but 32-bit IE11 is the default version on Windows 10.

Since Chrome and Edge return "Win32", Firefox probably should, too. That said, I don't know of any actual webcompat issues caused by this difference.

javascript:alert(navigator.platform)
(In reply to Chris Peterson [:cpeterson] from comment #0)
> Since Chrome and Edge return "Win32", Firefox probably should, too. That
> said, I don't know of any actual webcompat issues caused by this difference.

Chris, you set this bug as blocking bug 1383495.
But you are talking about the return value for normal mode, not just for resist fingerprinting. Is that correct?
Flags: needinfo?(cpeterson)
(In reply to Ethan Tseng [:ethan] from comment #1)
> Chris, you set this bug as blocking bug 1383495.
> But you are talking about the return value for normal mode, not just for
> resist fingerprinting. Is that correct?

This bug is not about fingerprinting because the real platform (Win64) is still revealed in navigator.oscpu and navigator.userAgent. Bug 1383495 hard coded navigator.platform to return "Win64" in resist fingering mode (SPOOFED_PLATFORM). I made this bug block that one because, if we fix this bug, we should revert bug 1383495 so resist fingerprinting mode matches normal mode.
Flags: needinfo?(cpeterson)
(In reply to Chris Peterson [:cpeterson] from comment #2)
Very clear. Thank you, Chris!
For comparison:

FIREFOX 61
navigator.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"
navigator.platform = "Win64"

CHROME 68
navigator.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.42 Safari/537.36"
navigator.platform = "Win32"

EDGE 17
navigator.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
navigator.platform = "Win32"

IE11 (64-bit)
navigator.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; Trident/7.0; Touch; rv:11.0) like Gecko"
navigator.platform = "Win64"
Assignee: nobody → cpeterson
Searching for uses of navigator.platform on GitHub, I quickly found some buggy code that would break in Win64 Firefox. This function will return undefined because it assumes navigator.platform must be "Win32" or "Windows" on Windows. This isn't even old code: it was written in May 2018 when Win64 Firefox was used by 70% of Firefox users.

https://github.com/569835014/plugins/blob/e39da6162ce8d2e99b874c303cb2bb90a839a759/libraries/util/tool/detection/device.js#L4
And some code proposed in this Gecko Profiler issue mistakenly assumes that navigator.platform is always "Win32" on Windows. :)

https://github.com/devtools-html/Gecko-Profiler-Addon/issues/42
Summary: navigator.platform returns "Win64" in Firefox but "Win32" in Chrome and Edge → navigator.platform returns "Win64" in Firefox but "Win32" in Chrome and Edge on Win64 OS
Comment on attachment 8989331 [details]
Bug 1472618 - Make navigator.platform return "Win32", even on Win64 OS.

https://reviewboard.mozilla.org/r/254400/#review262812

Let's try.
Attachment #8989331 - Flags: review?(peterv) → review+
Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/16581950a2b9
Make navigator.platform return "Win32", even on Win64 OS. r=peterv
Thanks!
Summary: navigator.platform returns "Win64" in Firefox but "Win32" in Chrome and Edge on Win64 OS → navigator.platform returns "Win64" in Firefox on Win64 OS but "Win32" in Chrome and Edge
https://hg.mozilla.org/mozilla-central/rev/16581950a2b9
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Keywords: compat
Docs updated:

https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/platform

And mentioned on Firefox 63 for developers.
This seems like an obvious regression. Chrome and Edge should change to return the correct value, instead. In fact, Edge allegedly only returns Win32 because Chrome does.
You need to log in before you can comment on or make changes to this bug.