Ticket #13398: 13398-pospeselr2.patch

File 13398-pospeselr2.patch, 9.8 KB (added by pospeselr, 23 months ago)
  • browser/app/profile/000-tor-browser.js

    diff --git a/browser/app/profile/000-tor-browser.js b/browser/app/profile/000-tor-browser.js
    index aaeba630422d..e8a0f8fd4439 100644
    a b pref("social.toast-notifications.enabled", false); 
    133133pref("social.whitelist", "");
    134134
    135135// Fingerprinting
     136pref("privacy.hide_user_info", true); // Bug 13398: nsUserInfo interface properties return empty string
    136137pref("webgl.min_capability_mode", true);
    137138pref("webgl.disable-extensions", true);
    138139pref("webgl.disable-fail-if-major-performance-caveat", true);
  • toolkit/components/startup/moz.build

    diff --git a/toolkit/components/startup/moz.build b/toolkit/components/startup/moz.build
    index dbd580384615..aea1087f4c28 100644
    a b XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini'] 
    1515
    1616UNIFIED_SOURCES += [
    1717    'nsAppStartup.cpp',
     18    'nsUserInfo.cpp',
    1819    'StartupTimeline.cpp',
    1920]
    2021
  • toolkit/components/startup/nsAppStartup.cpp

    diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp
    index 85d5afdf97c8..8157628a196b 100644
    a b  
    44 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    55
    66#include "nsAppStartup.h"
     7#include "nsUserInfo.h"
    78
    89#include "nsIAppShellService.h"
    910#include "nsPIDOMWindow.h"
    nsAppStartup::Init() 
    214215  }
    215216#endif //defined(XP_WIN)
    216217
     218  nsUserInfo::InitializeStatics();
     219
    217220  return NS_OK;
    218221}
    219222
  • new file toolkit/components/startup/nsUserInfo.cpp

    diff --git a/toolkit/components/startup/nsUserInfo.cpp b/toolkit/components/startup/nsUserInfo.cpp
    new file mode 100644
    index 000000000000..5543a6b92111
    - +  
     1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2/* This Source Code Form is subject to the terms of the Mozilla Public
     3 * License, v. 2.0. If a copy of the MPL was not distributed with this
     4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5
     6#include "nsUserInfo.h"
     7
     8#include "mozilla/Preferences.h"
     9using mozilla::Preferences;
     10
     11bool nsUserInfo::sHideUserInfo = false;
     12
     13void nsUserInfo::InitializeStatics()
     14{
     15  Preferences::AddBoolVarCache(&sHideUserInfo,
     16                               "privacy.hide_user_info", false);
     17}
     18
     19NS_IMETHODIMP
     20nsUserInfo::GetFullname(char16_t** aFullname)
     21{
     22  NS_ENSURE_ARG_POINTER(aFullname);
     23
     24  if (sHideUserInfo) {
     25    *aFullname = ToNewUnicode(NS_LITERAL_STRING(""));
     26    if (*aFullname) {
     27      return NS_OK;
     28    }
     29
     30    return NS_ERROR_FAILURE;
     31  }
     32
     33  return this->GetFullnameImpl(aFullname);
     34}
     35
     36NS_IMETHODIMP
     37nsUserInfo::GetUsername(char** aUsername)
     38{
     39  NS_ENSURE_ARG_POINTER(aUsername);
     40
     41  if (sHideUserInfo) {
     42    *aUsername = ToNewUTF8String(NS_LITERAL_STRING(""));
     43    if (*aUsername) {
     44      return NS_OK;
     45    }
     46
     47    return NS_ERROR_FAILURE;
     48  }
     49
     50  return this->GetUsernameImpl(aUsername);
     51}
     52
     53NS_IMETHODIMP
     54nsUserInfo::GetEmailAddress(char** aEmailAddress)
     55{
     56  NS_ENSURE_ARG_POINTER(aEmailAddress);
     57
     58  if (sHideUserInfo) {
     59    *aEmailAddress = ToNewUTF8String(NS_LITERAL_STRING(""));
     60    if (*aEmailAddress) {
     61      return NS_OK;
     62    }
     63
     64    return NS_ERROR_FAILURE;
     65  }
     66
     67  return this->GetEmailAddressImpl(aEmailAddress);
     68}
     69
     70NS_IMETHODIMP
     71nsUserInfo::GetDomain(char** aDomain)
     72{
     73  NS_ENSURE_ARG_POINTER(aDomain);
     74
     75  if (sHideUserInfo) {
     76    *aDomain = ToNewUTF8String(NS_LITERAL_STRING(""));
     77    if (*aDomain) {
     78      return NS_OK;
     79    }
     80
     81    return NS_ERROR_FAILURE;
     82  }
     83
     84  return this->GetDomainImpl(aDomain);
     85}
     86 No newline at end of file
  • toolkit/components/startup/nsUserInfo.h

    diff --git a/toolkit/components/startup/nsUserInfo.h b/toolkit/components/startup/nsUserInfo.h
    index 49e86c64a3c6..10b3d0ab4394 100644
    a b public: 
    1616  NS_DECL_ISUPPORTS
    1717  NS_DECL_NSIUSERINFO
    1818
     19  static void InitializeStatics();
     20
    1921protected:
    2022  virtual ~nsUserInfo();
     23
     24  static bool sHideUserInfo;
     25
     26  nsresult GetFullnameImpl(char16_t** aFullname);
     27  nsresult GetUsernameImpl(char** aUsername);
     28  nsresult GetEmailAddressImpl(char** aEmailAddress);
     29  nsresult GetDomainImpl(char** aDomain);
    2130};
    2231
    2332#endif /* __nsUserInfo_h */
  • deleted file toolkit/components/startup/nsUserInfoMac.h

    diff --git a/toolkit/components/startup/nsUserInfoMac.h b/toolkit/components/startup/nsUserInfoMac.h
    deleted file mode 100644
    index 822e0edd5dd5..000000000000
    + -  
    1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
    2 /* This Source Code Form is subject to the terms of the Mozilla Public
    3  * License, v. 2.0. If a copy of the MPL was not distributed with this
    4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    5 #ifndef __nsUserInfoMac_h
    6 #define __nsUserInfoMac_h
    7 
    8 #include "nsIUserInfo.h"
    9 #include "nsReadableUtils.h"
    10 
    11 class nsUserInfo: public nsIUserInfo
    12 {
    13 public:
    14   nsUserInfo();
    15 
    16   NS_DECL_ISUPPORTS
    17   NS_DECL_NSIUSERINFO
    18 
    19   nsresult GetPrimaryEmailAddress(nsCString &aEmailAddress); 
    20 
    21 protected:
    22   virtual ~nsUserInfo() {}
    23 };
    24 
    25 #endif /* __nsUserInfo_h */
  • toolkit/components/startup/nsUserInfoMac.mm

    diff --git a/toolkit/components/startup/nsUserInfoMac.mm b/toolkit/components/startup/nsUserInfoMac.mm
    index 1895cf177353..653aeece0be8 100644
    a b  
    33 * License, v. 2.0. If a copy of the MPL was not distributed with this
    44 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    55
    6 
    7 #include "nsUserInfoMac.h"
     6#include "nsUserInfo.h"
    87#include "nsObjCExceptions.h"
    98#include "nsString.h"
     9#include "nsReadableUtils.h"
    1010
    1111#import <Cocoa/Cocoa.h>
    1212#import <AddressBook/AddressBook.h>
     
    1414NS_IMPL_ISUPPORTS(nsUserInfo, nsIUserInfo)
    1515
    1616nsUserInfo::nsUserInfo() {}
     17nsUserInfo::~nsUserInfo() {}
    1718
    1819NS_IMETHODIMP
    19 nsUserInfo::GetFullname(char16_t **aFullname)
     20nsUserInfo::GetFullnameImpl(char16_t **aFullname)
    2021{
    2122  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT
    2223 
    nsUserInfo::GetFullname(char16_t **aFullname) 
    2829}
    2930
    3031NS_IMETHODIMP
    31 nsUserInfo::GetUsername(char **aUsername)
     32nsUserInfo::GetUsernameImpl(char **aUsername)
    3233{
    3334  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT
    3435 
    nsUserInfo::GetUsername(char **aUsername) 
    3940  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT
    4041}
    4142
    42 nsresult
    43 nsUserInfo::GetPrimaryEmailAddress(nsCString &aEmailAddress)
     43static nsresult
     44GetPrimaryEmailAddress(nsCString &aEmailAddress)
    4445{
    4546  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT
    4647 
    nsUserInfo::GetPrimaryEmailAddress(nsCString &aEmailAddress) 
    6162}
    6263
    6364NS_IMETHODIMP
    64 nsUserInfo::GetEmailAddress(char **aEmailAddress)
     65nsUserInfo::GetEmailAddressImpl(char **aEmailAddress)
    6566{
    6667  nsAutoCString email;
    6768  if (NS_SUCCEEDED(GetPrimaryEmailAddress(email)))
    nsUserInfo::GetEmailAddress(char **aEmailAddress) 
    7071}
    7172
    7273NS_IMETHODIMP
    73 nsUserInfo::GetDomain(char **aDomain)
     74nsUserInfo::GetDomainImpl(char **aDomain)
    7475{
    7576  nsAutoCString email;
    7677  if (NS_SUCCEEDED(GetPrimaryEmailAddress(email))) {
  • toolkit/components/startup/nsUserInfoUnix.cpp

    diff --git a/toolkit/components/startup/nsUserInfoUnix.cpp b/toolkit/components/startup/nsUserInfoUnix.cpp
    index 71bc46da2573..8f9d7cd68d4a 100644
    a b nsUserInfo::~nsUserInfo() 
    3434NS_IMPL_ISUPPORTS(nsUserInfo,nsIUserInfo)
    3535
    3636NS_IMETHODIMP
    37 nsUserInfo::GetFullname(char16_t **aFullname)
     37nsUserInfo::GetFullnameImpl(char16_t **aFullname)
    3838{
    3939    struct passwd *pw = nullptr;
    4040
    nsUserInfo::GetFullname(char16_t **aFullname) 
    7979}
    8080
    8181NS_IMETHODIMP
    82 nsUserInfo::GetUsername(char * *aUsername)
     82nsUserInfo::GetUsernameImpl(char * *aUsername)
    8383{
    8484    struct passwd *pw = nullptr;
    8585
    nsUserInfo::GetUsername(char * *aUsername) 
    9898}
    9999
    100100NS_IMETHODIMP
    101 nsUserInfo::GetDomain(char * *aDomain)
     101nsUserInfo::GetDomainImpl(char * *aDomain)
    102102{
    103103    nsresult rv = NS_ERROR_FAILURE;
    104104
    nsUserInfo::GetDomain(char * *aDomain) 
    135135}
    136136
    137137NS_IMETHODIMP
    138 nsUserInfo::GetEmailAddress(char * *aEmailAddress)
     138nsUserInfo::GetEmailAddressImpl(char * *aEmailAddress)
    139139{
    140140    // use username + "@" + domain for the email address
    141141
    nsUserInfo::GetEmailAddress(char * *aEmailAddress) 
    145145    nsXPIDLCString username;
    146146    nsXPIDLCString domain;
    147147
    148     rv = GetUsername(getter_Copies(username));
     148    rv = GetUsernameImpl(getter_Copies(username));
    149149    if (NS_FAILED(rv)) return rv;
    150150
    151     rv = GetDomain(getter_Copies(domain));
     151    rv = GetDomainImpl(getter_Copies(domain));
    152152    if (NS_FAILED(rv)) return rv;
    153153
    154154    if (!username.IsEmpty() && !domain.IsEmpty()) {
  • toolkit/components/startup/nsUserInfoWin.cpp

    diff --git a/toolkit/components/startup/nsUserInfoWin.cpp b/toolkit/components/startup/nsUserInfoWin.cpp
    index b27a2c483b1c..bff971e30b5b 100644
    a b nsUserInfo::~nsUserInfo() 
    2626NS_IMPL_ISUPPORTS(nsUserInfo, nsIUserInfo)
    2727
    2828NS_IMETHODIMP
    29 nsUserInfo::GetUsername(char **aUsername)
     29nsUserInfo::GetUsernameImpl(char **aUsername)
    3030{
    3131  NS_ENSURE_ARG_POINTER(aUsername);
    3232  *aUsername = nullptr;
    nsUserInfo::GetUsername(char **aUsername) 
    4242}
    4343
    4444NS_IMETHODIMP
    45 nsUserInfo::GetFullname(char16_t **aFullname)
     45nsUserInfo::GetFullnameImpl(char16_t **aFullname)
    4646{
    4747  NS_ENSURE_ARG_POINTER(aFullname);
    4848  *aFullname = nullptr;
    nsUserInfo::GetFullname(char16_t **aFullname) 
    9494}
    9595
    9696NS_IMETHODIMP
    97 nsUserInfo::GetDomain(char **aDomain)
     97nsUserInfo::GetDomainImpl(char **aDomain)
    9898{
    9999  NS_ENSURE_ARG_POINTER(aDomain);
    100100  *aDomain = nullptr;
    nsUserInfo::GetDomain(char **aDomain) 
    113113}
    114114
    115115NS_IMETHODIMP
    116 nsUserInfo::GetEmailAddress(char **aEmailAddress)
     116nsUserInfo::GetEmailAddressImpl(char **aEmailAddress)
    117117{
    118118  NS_ENSURE_ARG_POINTER(aEmailAddress);
    119119  *aEmailAddress = nullptr;