UAO: correct UA string rebuild code, add platform_version pref.

This commit is contained in:
roytam1 2024-07-09 14:08:03 +08:00
commit f596e3d581
2 changed files with 30 additions and 3 deletions

View file

@ -948,9 +948,35 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
rv = prefs->GetBoolPref(UA_PREF("change_platform_version"), &cVar);
mCompatPlatformEnabled = (NS_SUCCEEDED(rv) && cVar);
// Rebuild application version string.
BuildAppVersion();
// Rebuild rv: and Goanna slice version
mMisc.AssignLiteral("rv:");
if (mCompatGeckoEnabled) {
mMisc += mCompatFirefoxVersion;
} else {
if (mCompatPlatformEnabled) {
mMisc += mCompatPlatformVersion;
} else {
mMisc += MOZILLA_UAVERSION;
}
}
if (mCompatGeckoEnabled) {
if (mCompatPlatformEnabled) {
mProductSub.Assign(mCompatPlatformVersion);
} else {
mProductSub.AssignLiteral(MOZILLA_UAVERSION);
}
} else {
if (mCompatPlatformEnabled) {
mProductSub.Assign(mCompatPlatformVersion);
} else {
mProductSub.Assign(mAppBuildID);
}
}
// In case MOZILLA_UAVERSION is empty for some odd reason...
if (mProductSub.IsEmpty()) {
mProductSub.Assign(mAppBuildID);
}
mUserAgentIsDirty = true;
}
// general.useragent.platform_version