зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1532411 - Pass a document pointer to nsContentUtils::ShouldResistFingerprinting() callers in the gamepad API; r=baku
Differential Revision: https://phabricator.services.mozilla.com/D21996 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1371a0545c
Коммит
c2111e147b
|
@ -5927,7 +5927,7 @@ void nsGlobalWindowInner::SyncGamepadState() {
|
|||
if (mHasSeenGamepadInput) {
|
||||
RefPtr<GamepadManager> gamepadManager(GamepadManager::GetService());
|
||||
for (auto iter = mGamepads.Iter(); !iter.Done(); iter.Next()) {
|
||||
gamepadManager->SyncGamepadState(iter.Key(), iter.UserData());
|
||||
gamepadManager->SyncGamepadState(iter.Key(), this, iter.UserData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ void GamepadManager::AddListener(nsGlobalWindowInner* aWindow) {
|
|||
}
|
||||
|
||||
if (!mEnabled || mShuttingDown ||
|
||||
nsContentUtils::ShouldResistFingerprinting()) {
|
||||
nsContentUtils::ShouldResistFingerprinting(aWindow->GetExtantDoc())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -289,12 +289,6 @@ void GamepadManager::FireAxisMoveEvent(EventTarget* aTarget, Gamepad* aGamepad,
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -310,6 +304,13 @@ void GamepadManager::NewConnectionEvent(uint32_t aIndex, bool aConnected) {
|
|||
|
||||
if (aConnected) {
|
||||
for (uint32_t i = 0; i < listeners.Length(); i++) {
|
||||
// Do not fire gamepadconnected and gamepaddisconnected events when
|
||||
// privacy.resistFingerprinting is true.
|
||||
if (nsContentUtils::ShouldResistFingerprinting(
|
||||
listeners[i]->GetExtantDoc())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only send events to non-background windows
|
||||
if (!listeners[i]->AsInner()->IsCurrentInnerWindow() ||
|
||||
listeners[i]->GetOuterWindow()->IsBackground()) {
|
||||
|
@ -337,6 +338,13 @@ void GamepadManager::NewConnectionEvent(uint32_t aIndex, bool aConnected) {
|
|||
// Even background windows get these events, so we don't have to
|
||||
// deal with the hassle of syncing the state of removed gamepads.
|
||||
|
||||
// Do not fire gamepadconnected and gamepaddisconnected events when
|
||||
// privacy.resistFingerprinting is true.
|
||||
if (nsContentUtils::ShouldResistFingerprinting(
|
||||
listeners[i]->GetExtantDoc())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (WindowHasSeenGamepad(listeners[i], aIndex)) {
|
||||
RefPtr<Gamepad> listenerGamepad = listeners[i]->GetGamepad(aIndex);
|
||||
if (listenerGamepad) {
|
||||
|
@ -365,9 +373,11 @@ void GamepadManager::FireConnectionEvent(EventTarget* aTarget,
|
|||
aTarget->DispatchEvent(*event);
|
||||
}
|
||||
|
||||
void GamepadManager::SyncGamepadState(uint32_t aIndex, Gamepad* aGamepad) {
|
||||
void GamepadManager::SyncGamepadState(uint32_t aIndex,
|
||||
nsGlobalWindowInner* aWindow,
|
||||
Gamepad* aGamepad) {
|
||||
if (mShuttingDown || !mEnabled ||
|
||||
nsContentUtils::ShouldResistFingerprinting()) {
|
||||
nsContentUtils::ShouldResistFingerprinting(aWindow->GetExtantDoc())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,8 @@ class GamepadManager final : public nsIObserver {
|
|||
void RemoveGamepad(uint32_t aIndex, GamepadServiceType aServiceType);
|
||||
|
||||
// Synchronize the state of |aGamepad| to match the gamepad stored at |aIndex|
|
||||
void SyncGamepadState(uint32_t aIndex, Gamepad* aGamepad);
|
||||
void SyncGamepadState(uint32_t aIndex, nsGlobalWindowInner* aWindow,
|
||||
Gamepad* aGamepad);
|
||||
|
||||
// Returns gamepad object if index exists, null otherwise
|
||||
already_AddRefed<Gamepad> GetGamepad(uint32_t aIndex) const;
|
||||
|
|
Загрузка…
Ссылка в новой задаче