mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
network: UserAgent: add Platform Version override
This commit is contained in:
parent
688fa00ac4
commit
914569c0b9
2 changed files with 53 additions and 3 deletions
|
|
@ -177,6 +177,8 @@ nsHttpHandler::nsHttpHandler()
|
||||||
, mAppBuildID("20200101")
|
, mAppBuildID("20200101")
|
||||||
, mCompatFirefoxEnabled(false)
|
, mCompatFirefoxEnabled(false)
|
||||||
, mCompatFirefoxVersion("68.9")
|
, mCompatFirefoxVersion("68.9")
|
||||||
|
, mCompatPlatformEnabled(false)
|
||||||
|
, mCompatPlatformVersion("6.6")
|
||||||
, mUserAgentIsDirty(true)
|
, mUserAgentIsDirty(true)
|
||||||
, mAcceptLanguagesIsDirty(true)
|
, mAcceptLanguagesIsDirty(true)
|
||||||
, mPromptTempRedirect(true)
|
, mPromptTempRedirect(true)
|
||||||
|
|
@ -297,7 +299,11 @@ nsHttpHandler::Init()
|
||||||
if (mCompatGeckoEnabled) {
|
if (mCompatGeckoEnabled) {
|
||||||
mMisc += mCompatFirefoxVersion;
|
mMisc += mCompatFirefoxVersion;
|
||||||
} else {
|
} else {
|
||||||
mMisc += MOZILLA_UAVERSION;
|
if (mCompatPlatformEnabled) {
|
||||||
|
mMisc += mCompatPlatformVersion;
|
||||||
|
} else {
|
||||||
|
mMisc += MOZILLA_UAVERSION;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mCompatGecko.AssignLiteral("Gecko/20100101");
|
mCompatGecko.AssignLiteral("Gecko/20100101");
|
||||||
|
|
@ -344,7 +350,11 @@ nsHttpHandler::Init()
|
||||||
|
|
||||||
// Goanna slice version
|
// Goanna slice version
|
||||||
if (mCompatGeckoEnabled) {
|
if (mCompatGeckoEnabled) {
|
||||||
mProductSub.AssignLiteral(MOZILLA_UAVERSION);
|
if (mCompatPlatformEnabled) {
|
||||||
|
mProductSub.Assign(mCompatPlatformVersion);
|
||||||
|
} else {
|
||||||
|
mProductSub.AssignLiteral(MOZILLA_UAVERSION);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mProductSub.Assign(mAppBuildID);
|
mProductSub.Assign(mAppBuildID);
|
||||||
}
|
}
|
||||||
|
|
@ -929,6 +939,40 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||||
mUserAgentIsDirty = true;
|
mUserAgentIsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// general.useragent.change_platform_version
|
||||||
|
if (PREF_CHANGED(UA_PREF("change_platform_version"))) {
|
||||||
|
rv = prefs->GetBoolPref(UA_PREF("change_platform_version"), &cVar);
|
||||||
|
mCompatPlatformEnabled = (NS_SUCCEEDED(rv) && cVar);
|
||||||
|
|
||||||
|
// Rebuild application version string.
|
||||||
|
BuildAppVersion();
|
||||||
|
|
||||||
|
mUserAgentIsDirty = true;
|
||||||
|
}
|
||||||
|
// general.useragent.platform_version
|
||||||
|
// This is the version number used in rv: for Gecko compatibility
|
||||||
|
// and in the Firefox/nn.nn slice when compatMode.firefox is enabled.
|
||||||
|
if (PREF_CHANGED(UA_PREF("platform_version"))) {
|
||||||
|
prefs->GetCharPref(UA_PREF("platform_version"),
|
||||||
|
getter_Copies(mCompatPlatformVersion));
|
||||||
|
|
||||||
|
// rebuild mMisc and compatMode slice
|
||||||
|
mMisc.AssignLiteral("rv:");
|
||||||
|
if (mCompatGeckoEnabled) {
|
||||||
|
mMisc += mCompatFirefoxVersion;
|
||||||
|
} else {
|
||||||
|
if (mCompatPlatformEnabled) {
|
||||||
|
mMisc += mCompatPlatformVersion;
|
||||||
|
} else {
|
||||||
|
mMisc += MOZILLA_UAVERSION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mCompatFirefox.AssignLiteral("Firefox/");
|
||||||
|
mCompatFirefox += mCompatFirefoxVersion;
|
||||||
|
|
||||||
|
mUserAgentIsDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (PREF_CHANGED(UA_PREF("compatMode.gecko"))) {
|
if (PREF_CHANGED(UA_PREF("compatMode.gecko"))) {
|
||||||
rv = prefs->GetBoolPref(UA_PREF("compatMode.gecko"), &cVar);
|
rv = prefs->GetBoolPref(UA_PREF("compatMode.gecko"), &cVar);
|
||||||
mCompatGeckoEnabled = (NS_SUCCEEDED(rv) && cVar);
|
mCompatGeckoEnabled = (NS_SUCCEEDED(rv) && cVar);
|
||||||
|
|
@ -938,7 +982,11 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
||||||
if (mCompatGeckoEnabled) {
|
if (mCompatGeckoEnabled) {
|
||||||
mMisc += mCompatFirefoxVersion;
|
mMisc += mCompatFirefoxVersion;
|
||||||
} else {
|
} else {
|
||||||
mMisc += MOZILLA_UAVERSION;
|
if (mCompatPlatformEnabled) {
|
||||||
|
mMisc += mCompatPlatformVersion;
|
||||||
|
} else {
|
||||||
|
mMisc += MOZILLA_UAVERSION;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCompatGeckoEnabled) {
|
if (mCompatGeckoEnabled) {
|
||||||
|
|
|
||||||
|
|
@ -500,6 +500,8 @@ private:
|
||||||
nsCString mCompatFirefox;
|
nsCString mCompatFirefox;
|
||||||
bool mCompatFirefoxEnabled;
|
bool mCompatFirefoxEnabled;
|
||||||
nsCString mCompatFirefoxVersion;
|
nsCString mCompatFirefoxVersion;
|
||||||
|
bool mCompatPlatformEnabled;
|
||||||
|
nsCString mCompatPlatformVersion;
|
||||||
nsCString mAppBuildID;
|
nsCString mAppBuildID;
|
||||||
nsXPIDLCString mCompatDevice;
|
nsXPIDLCString mCompatDevice;
|
||||||
nsCString mDeviceModelId;
|
nsCString mDeviceModelId;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue