зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337161 - Hide information of connected gamepads from content when privacy.resistFingerprinting is true r=arthuredelstein,smaug
MozReview-Commit-ID: Di6ba9B4w0d --HG-- extra : rebase_source : 69b392d4c0fa7ed5ac8f4fa02091153537a99798
This commit is contained in:
Родитель
d61a420f11
Коммит
49fb1d27d8
|
@ -13870,6 +13870,13 @@ nsGlobalWindow::GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads)
|
|||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
aGamepads.Clear();
|
||||
|
||||
// navigator.getGamepads() always returns an empty array when
|
||||
// privacy.resistFingerprinting is true.
|
||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// mGamepads.Count() may not be sufficient, but it's not harmful.
|
||||
aGamepads.SetCapacity(mGamepads.Count());
|
||||
for (auto iter = mGamepads.Iter(); !iter.Done(); iter.Next()) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "mozilla/StaticPtr.h"
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
@ -138,7 +139,7 @@ GamepadManager::AddListener(nsGlobalWindow* aWindow)
|
|||
MOZ_ASSERT(aWindow->IsInnerWindow());
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mEnabled || mShuttingDown) {
|
||||
if (!mEnabled || mShuttingDown || nsContentUtils::ShouldResistFingerprinting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -315,6 +316,12 @@ GamepadManager::FireAxisMoveEvent(EventTarget* aTarget,
|
|||
void
|
||||
GamepadManager::NewConnectionEvent(uint32_t aIndex, bool aConnected)
|
||||
{
|
||||
// Do not fire gamepadconnected and gamepaddisconnected events when
|
||||
// privacy.resistFingerprinting is true.
|
||||
if (nsContentUtils::ShouldResistFingerprinting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mShuttingDown) {
|
||||
return;
|
||||
}
|
||||
|
@ -398,7 +405,7 @@ GamepadManager::FireConnectionEvent(EventTarget* aTarget,
|
|||
void
|
||||
GamepadManager::SyncGamepadState(uint32_t aIndex, Gamepad* aGamepad)
|
||||
{
|
||||
if (mShuttingDown || !mEnabled) {
|
||||
if (mShuttingDown || !mEnabled || nsContentUtils::ShouldResistFingerprinting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче