Closed Bug 1711835 Opened 4 years ago Closed 1 year ago

Make navigator.oscpu and navigator.platform a compile-time value on Linux

Categories

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

All
Linux
task

Tracking

()

RESOLVED FIXED
132 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox130 --- wontfix
firefox131 --- wontfix
firefox132 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

When reviewing a patch for bug 1711628, hsivonen suggested making navigator.platform a compile-time value on Linux: https://phabricator.services.mozilla.com/D115333?id=439618#inline-640251

Bug 1559747 already made navigator.oscpu and navigator.platform return the CPU architecture the build was compiled for, not the architecture it is running on, i.e. return "Linux i686" instead of "Linux i686 on x86_64". So

oscpu is initialized here on Linux:

https://searchfox.org/mozilla-central/rev/98a9257ca2847fad9a19631ac76199474516b31e/netwerk/protocol/http/nsHttpHandler.cpp#998-1019

And navigator.platform delegates to navigator.oscpu on Linux here:

https://searchfox.org/mozilla-central/rev/98a9257ca2847fad9a19631ac76199474516b31e/dom/base/Navigator.cpp#1867-1872

  // XXX Communicator uses compiled-in build-time string defines
  // to indicate the platform it was compiled *for*, not what it is
  // currently running *on* which is what this does.
  nsAutoCString plat;
  rv = service->GetOscpu(plat);
  CopyASCIItoUTF16(plat, aPlatform);
See Also: → 1861847

This pref was added in Firefox 123 (by bug 1861847) to:

  1. Reduce fingerprintable entropy exposed to web content.
  2. Reduce risk of webcompat problems from unexpected CPU architectures (such as ARM64 Linux YouTube bug 1869521).

Now that this pref has baked in the Release channel for seven months without known regressions, we can remove the pref and simplify some UA string code.

Assignee: nobody → cpeterson
Status: NEW → ASSIGNED

Now that navigator.platform has been frozen on the Android and Linux/etc, SPOOFED_PLATFORM can be removed because the old spoofed values match the new frozen values for all platforms: Windows, macOS, Android, and Linux/etc.

Even though navigator.platform's default and spoofed values are always the same, this change keeps RFPTarget::NavigatorPlatform enum value so we know whether to honor the "general.platform.override" pref: the pref should override the default platform, but the spoofed platform should override the pref.

Depends on D220360

Pushed by cpeterson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a54f7da4b4b4 Remove network.http.useragent.freezeCpu pref. r=necko-reviewers,valentin https://hg.mozilla.org/integration/autoland/rev/463c46e86f2a Hard code navigator.platform on Android and Linux. r=timhuang,necko-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: