Bug 1863867 - Add expriment targeting based on archiecture bits r=barret

Differential Revision: https://phabricator.services.mozilla.com/D193159
This commit is contained in:
Paul Bone 2023-12-12 11:18:23 +00:00
parent 011eb4b875
commit 62b5d500fd
4 changed files with 36 additions and 0 deletions

View File

@ -11,6 +11,7 @@ Please note that some targeting attributes require stricter controls on the tele
* [activeNotifications](#activenotifications)
* [addonsInfo](#addonsinfo)
* [addressesSaved](#addressessaved)
* [archBits](#archbits)
* [attachedFxAOAuthClients](#attachedfxaoauthclients)
* [attributionData](#attributiondata)
* [backgroundTaskName](#backgroundtaskname)
@ -588,6 +589,16 @@ addressesSaved > 1
declare const addressesSaved: Promise<number>
```
### `archBits`
The number of bits used to represent a pointer in this build.
#### Definition
```ts
declare const archBits: number;
```
### `xpinstallEnabled`
Pref used by system administrators to disallow add-ons from installed altogether.

View File

@ -1012,6 +1012,19 @@ const TargetingGetters = {
height: window?.screen.availHeight,
};
},
get archBits() {
let bits = null;
try {
bits = Services.sysinfo.getProperty("archbits", null);
} catch (_e) {
// getProperty can throw if the memsize does not exist
}
if (bits) {
bits = Number(bits);
}
return bits;
},
};
const ASRouterTargeting = {

View File

@ -1693,3 +1693,9 @@ add_task(async function check_primaryResolution() {
"Height property should return a number"
);
});
add_task(async function check_archBits() {
const bits = ASRouterTargeting.Environment.archBits;
is(typeof bits, "number", "archBits should be a number");
ok(bits === 32 || bits === 64, "archBits is either 32 or 64");
});

View File

@ -974,6 +974,12 @@ nsresult nsSystemInfo::Init() {
SetUint64Property(u"memsize"_ns, PR_GetPhysicalMemorySize());
SetUint32Property(u"umask"_ns, nsSystemInfo::gUserUmask);
#ifdef HAVE_64BIT_BUILD
SetUint32Property(u"archbits"_ns, 64);
#else
SetUint32Property(u"archbits"_ns, 32);
#endif
uint64_t virtualMem = 0;
#if defined(XP_WIN)