Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2023-10-18 11:48:06 +08:00
commit ecd3cd8676
53 changed files with 67 additions and 1452 deletions

View file

@ -632,22 +632,10 @@ Navigator::GetBuildID(nsAString& aBuildID)
return NS_OK;
}
NS_IMETHODIMP
Navigator::GetDoNotTrack(nsAString &aResult)
bool
Navigator::GlobalPrivacyControl()
{
bool doNotTrack = nsContentUtils::DoNotTrackEnabled();
if (!doNotTrack) {
nsCOMPtr<nsILoadContext> loadContext = do_GetInterface(mWindow);
doNotTrack = loadContext && loadContext->UseTrackingProtection();
}
if (doNotTrack) {
aResult.AssignLiteral("1");
} else {
aResult.AssignLiteral("unspecified");
}
return NS_OK;
return nsContentUtils::GPCEnabled();
}
bool

View file

@ -131,7 +131,7 @@ public:
nsMimeTypeArray* GetMimeTypes(ErrorResult& aRv);
nsPluginArray* GetPlugins(ErrorResult& aRv);
Permissions* GetPermissions(ErrorResult& aRv);
// The XPCOM GetDoNotTrack is ok
bool GlobalPrivacyControl();
Geolocation* GetGeolocation(ErrorResult& aRv);
static void AppName(nsAString& aAppName, bool aUsePrefOverriddenValue);

View file

@ -309,7 +309,7 @@ bool nsContentUtils::sFragmentParsingActive = false;
bool nsContentUtils::sDOMWindowDumpEnabled;
#endif
bool nsContentUtils::sDoNotTrackEnabled = false;
bool nsContentUtils::sGPCEnabled = false;
mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump");
@ -626,8 +626,8 @@ nsContentUtils::Init()
"browser.dom.window.dump.enabled");
#endif
Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
"privacy.donottrackheader.enabled", false);
Preferences::AddBoolVarCache(&sGPCEnabled,
"privacy.GPCheader.enabled", false);
Preferences::AddBoolVarCache(&sUseActivityCursor,
"ui.use_activity_cursor", false);
@ -7337,9 +7337,9 @@ nsContentUtils::DOMWindowDumpEnabled()
}
bool
nsContentUtils::DoNotTrackEnabled()
nsContentUtils::GPCEnabled()
{
return nsContentUtils::sDoNotTrackEnabled;
return nsContentUtils::sGPCEnabled;
}
mozilla::LogModule*

View file

@ -2432,9 +2432,9 @@ public:
static bool DOMWindowDumpEnabled();
/**
* Returns true if the privacy.donottrackheader.enabled pref is set.
* Returns true if the privacy.GPCheader.enabled pref is set.
*/
static bool DoNotTrackEnabled();
static bool GPCEnabled();
/**
* Returns a LogModule that dump calls from content script are logged to.
@ -2971,7 +2971,7 @@ private:
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
static bool sDOMWindowDumpEnabled;
#endif
static bool sDoNotTrackEnabled;
static bool sGPCEnabled;
static mozilla::LazyLogModule sDOMDumpLog;
};