зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1419771 - Introduce DOMPreferences, a thread-safe access to preferences for DOM - part 19 - Resist finger-printing enabled, r=asuth
This commit is contained in:
Родитель
cd3be47aa8
Коммит
4dbb2feaf1
|
@ -53,6 +53,7 @@ PREF(OffscreenCanvasEnabled, "gfx.offscreencanvas.enabled")
|
||||||
PREF(WebkitBlinkDirectoryPickerEnabled, "dom.webkitBlink.dirPicker.enabled")
|
PREF(WebkitBlinkDirectoryPickerEnabled, "dom.webkitBlink.dirPicker.enabled")
|
||||||
PREF(NetworkInformationEnabled, "dom.netinfo.enabled")
|
PREF(NetworkInformationEnabled, "dom.netinfo.enabled")
|
||||||
PREF(FetchObserverEnabled, "dom.fetchObserver.enabled")
|
PREF(FetchObserverEnabled, "dom.fetchObserver.enabled")
|
||||||
|
PREF(ResistFingerprintingEnabled, "privacy.resistFingerprinting")
|
||||||
|
|
||||||
#undef PREF
|
#undef PREF
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,9 @@ public:
|
||||||
// Returns true if the dom.fetchObserver.enabled pref is set.
|
// Returns true if the dom.fetchObserver.enabled pref is set.
|
||||||
static bool FetchObserverEnabled();
|
static bool FetchObserverEnabled();
|
||||||
static bool FetchObserverEnabled(JSContext* aCx, JSObject* aObj);
|
static bool FetchObserverEnabled(JSContext* aCx, JSObject* aObj);
|
||||||
|
|
||||||
|
// Returns true if the privacy.resistFingerprinting pref is set.
|
||||||
|
static bool ResistFingerprintingEnabled();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // dom namespace
|
} // dom namespace
|
||||||
|
|
|
@ -2378,17 +2378,7 @@ nsContentUtils::IsCallerChrome()
|
||||||
bool
|
bool
|
||||||
nsContentUtils::ShouldResistFingerprinting()
|
nsContentUtils::ShouldResistFingerprinting()
|
||||||
{
|
{
|
||||||
if (NS_IsMainThread()) {
|
return DOMPreferences::ResistFingerprintingEnabled();
|
||||||
return nsRFPService::IsResistFingerprintingEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
workers::WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
|
|
||||||
if (NS_WARN_IF(!workerPrivate)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
workerPrivate->AssertIsOnWorkerThread();
|
|
||||||
|
|
||||||
return workerPrivate->ResistFingerprintingEnabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "ImageDocument.h"
|
#include "ImageDocument.h"
|
||||||
|
#include "mozilla/dom/DOMPreferences.h"
|
||||||
#include "mozilla/dom/ImageDocumentBinding.h"
|
#include "mozilla/dom/ImageDocumentBinding.h"
|
||||||
#include "mozilla/dom/HTMLImageElement.h"
|
#include "mozilla/dom/HTMLImageElement.h"
|
||||||
#include "nsRect.h"
|
#include "nsRect.h"
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
//XXX A hack needed for Firefox's site specific zoom.
|
//XXX A hack needed for Firefox's site specific zoom.
|
||||||
static bool IsSiteSpecific()
|
static bool IsSiteSpecific()
|
||||||
{
|
{
|
||||||
return !mozilla::Preferences::GetBool("privacy.resistFingerprinting", false) &&
|
return !mozilla::dom::DOMPreferences::ResistFingerprintingEnabled() &&
|
||||||
mozilla::Preferences::GetBool("browser.zoom.siteSpecific", false);
|
mozilla::Preferences::GetBool("browser.zoom.siteSpecific", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
|
#include "mozilla/dom/DOMPreferences.h"
|
||||||
#include "mozilla/dom/Promise.h"
|
#include "mozilla/dom/Promise.h"
|
||||||
#include "mozilla/dom/PromiseWorkerProxy.h"
|
#include "mozilla/dom/PromiseWorkerProxy.h"
|
||||||
#include "mozilla/dom/StorageManager.h"
|
#include "mozilla/dom/StorageManager.h"
|
||||||
|
@ -81,11 +82,11 @@ WorkerNavigator::GetAppName(nsString& aAppName, CallerType aCallerType) const
|
||||||
MOZ_ASSERT(workerPrivate);
|
MOZ_ASSERT(workerPrivate);
|
||||||
|
|
||||||
if ((!mProperties.mAppNameOverridden.IsEmpty() ||
|
if ((!mProperties.mAppNameOverridden.IsEmpty() ||
|
||||||
workerPrivate->ResistFingerprintingEnabled()) &&
|
DOMPreferences::ResistFingerprintingEnabled()) &&
|
||||||
!workerPrivate->UsesSystemPrincipal()) {
|
!workerPrivate->UsesSystemPrincipal()) {
|
||||||
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
||||||
// See nsRFPService.h for spoofed value.
|
// See nsRFPService.h for spoofed value.
|
||||||
aAppName = workerPrivate->ResistFingerprintingEnabled() ?
|
aAppName = DOMPreferences::ResistFingerprintingEnabled() ?
|
||||||
NS_LITERAL_STRING(SPOOFED_APPNAME) : mProperties.mAppNameOverridden;
|
NS_LITERAL_STRING(SPOOFED_APPNAME) : mProperties.mAppNameOverridden;
|
||||||
} else {
|
} else {
|
||||||
aAppName = mProperties.mAppName;
|
aAppName = mProperties.mAppName;
|
||||||
|
@ -100,11 +101,11 @@ WorkerNavigator::GetAppVersion(nsString& aAppVersion, CallerType aCallerType,
|
||||||
MOZ_ASSERT(workerPrivate);
|
MOZ_ASSERT(workerPrivate);
|
||||||
|
|
||||||
if ((!mProperties.mAppVersionOverridden.IsEmpty() ||
|
if ((!mProperties.mAppVersionOverridden.IsEmpty() ||
|
||||||
workerPrivate->ResistFingerprintingEnabled()) &&
|
DOMPreferences::ResistFingerprintingEnabled()) &&
|
||||||
!workerPrivate->UsesSystemPrincipal()) {
|
!workerPrivate->UsesSystemPrincipal()) {
|
||||||
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
||||||
// See nsRFPService.h for spoofed value.
|
// See nsRFPService.h for spoofed value.
|
||||||
aAppVersion = workerPrivate->ResistFingerprintingEnabled() ?
|
aAppVersion = DOMPreferences::ResistFingerprintingEnabled() ?
|
||||||
NS_LITERAL_STRING(SPOOFED_APPVERSION) : mProperties.mAppVersionOverridden;
|
NS_LITERAL_STRING(SPOOFED_APPVERSION) : mProperties.mAppVersionOverridden;
|
||||||
} else {
|
} else {
|
||||||
aAppVersion = mProperties.mAppVersion;
|
aAppVersion = mProperties.mAppVersion;
|
||||||
|
@ -119,11 +120,11 @@ WorkerNavigator::GetPlatform(nsString& aPlatform, CallerType aCallerType,
|
||||||
MOZ_ASSERT(workerPrivate);
|
MOZ_ASSERT(workerPrivate);
|
||||||
|
|
||||||
if ((!mProperties.mPlatformOverridden.IsEmpty() ||
|
if ((!mProperties.mPlatformOverridden.IsEmpty() ||
|
||||||
workerPrivate->ResistFingerprintingEnabled()) &&
|
DOMPreferences::ResistFingerprintingEnabled()) &&
|
||||||
!workerPrivate->UsesSystemPrincipal()) {
|
!workerPrivate->UsesSystemPrincipal()) {
|
||||||
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
||||||
// See nsRFPService.h for spoofed value.
|
// See nsRFPService.h for spoofed value.
|
||||||
aPlatform = workerPrivate->ResistFingerprintingEnabled() ?
|
aPlatform = DOMPreferences::ResistFingerprintingEnabled() ?
|
||||||
NS_LITERAL_STRING(SPOOFED_PLATFORM) : mProperties.mPlatformOverridden;
|
NS_LITERAL_STRING(SPOOFED_PLATFORM) : mProperties.mPlatformOverridden;
|
||||||
} else {
|
} else {
|
||||||
aPlatform = mProperties.mPlatform;
|
aPlatform = mProperties.mPlatform;
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
// * First argument is the name of the pref.
|
// * First argument is the name of the pref.
|
||||||
// * The name of the function that updates the new value of a pref.
|
// * The name of the function that updates the new value of a pref.
|
||||||
|
|
||||||
WORKER_SIMPLE_PREF("privacy.resistFingerprinting", ResistFingerprintingEnabled, RESISTFINGERPRINTING_ENABLED)
|
|
||||||
WORKER_SIMPLE_PREF("devtools.enabled", DevToolsEnabled, DEVTOOLS_ENABLED)
|
WORKER_SIMPLE_PREF("devtools.enabled", DevToolsEnabled, DEVTOOLS_ENABLED)
|
||||||
WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
|
WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
|
||||||
WORKER_PREF("general.appname.override", AppNameOverrideChanged)
|
WORKER_PREF("general.appname.override", AppNameOverrideChanged)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче