media/mtransport/stun_socket_filter.h
author Tim Huang <tihuang@mozilla.com>
Thu, 31 Aug 2017 11:14:14 +0800
changeset 453921 b2f55468b241f28678dc5e35e19eb3b5781a1c5c
parent 332140 11edf75d48c6b3d2c4ada21841f027367777b230
child 508163 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 1222285 - Part 2: Making the keyboard events of modifier keys been suppressed when 'privacy.resistFingerprinting' is true. r=arthuredelstein,masayuki This patch makes 'Shift', 'Alt', 'Contorl' and 'AltGraph' been suppressed for content when fingerprinting resistance is enabled. Chrome can still get these events. The reason behind this is that websites can still observe key combinations to tell which keyboard layout is using even we spoof the keyboardEvent.code, keyboardEvent.keyCode and modifier states. For example, the AZERTY France keyboard, the digit keys of it requires the user press the Shift key. So, it is easy to differentiate AZERTY and QWERTY keyboard by observing whether a Shift key generates its own before the digit keys. There are similar issues for 'Alt' and 'AltGraph' as well. MozReview-Commit-ID: 3CwCgvey4lK

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef stun_socket_filter_h__
#define stun_socket_filter_h__

#include "nsISocketFilter.h"

#define NS_STUN_UDP_SOCKET_FILTER_HANDLER_CID { 0x3e43ee93, 0x829e, 0x4ea6, \
      { 0xa3, 0x4e, 0x62, 0xd9, 0xe4, 0xc9, 0xf9, 0x93 } };

class nsStunUDPSocketFilterHandler : public nsISocketFilterHandler {
public:
  // Threadsafe because we create off-main-thread, but destroy on MainThread
  // via FreeFactoryEntries()
  NS_DECL_THREADSAFE_ISUPPORTS
  NS_DECL_NSISOCKETFILTERHANDLER
private:
  virtual ~nsStunUDPSocketFilterHandler() {}
};

#define NS_STUN_TCP_SOCKET_FILTER_HANDLER_CID { 0x9fea635a, 0x2fc2, 0x4d08, \
  { 0x97, 0x21, 0xd2, 0x38, 0xd3, 0xf5, 0x2f, 0x92 } };

class nsStunTCPSocketFilterHandler : public nsISocketFilterHandler {
public:
  // Threadsafe because we create off-main-thread, but destroy on MainThread
  // via FreeFactoryEntries()
  NS_DECL_THREADSAFE_ISUPPORTS
  NS_DECL_NSISOCKETFILTERHANDLER
private:
  virtual ~nsStunTCPSocketFilterHandler() {}
};


#endif // stun_socket_filter_h__