Pier Angelo Vendrame pushed to branch mullvad-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser

Commits:

14 changed files:

Changes:

  • browser/app/profile/001-base-profile.js
    ... ... @@ -629,11 +629,6 @@ pref("privacy.query_stripping.strip_on_share.enabled", true);
    629 629
     pref("dom.text-recognition.enabled", false);
    
    630 630
     
    
    631 631
     #ifdef XP_WIN
    
    632
    -// prefs to disable jump-list entries in the taskbar on Windows (see bug #12885)
    
    633
    -// this pref changes the app's set AUMID to be dependent on the profile path, rather than
    
    634
    -// attempting to read it from the registry; this is necessary so that the file generated
    
    635
    -// by the jumplist system can be properly deleted if it is disabled
    
    636
    -pref("taskbar.grouping.useprofile", true);
    
    637 632
     pref("browser.taskbar.lists.enabled", false);
    
    638 633
     pref("browser.taskbar.lists.frequent.enabled", false);
    
    639 634
     pref("browser.taskbar.lists.tasks.enabled", false);
    

  • browser/components/preferences/main.js
    ... ... @@ -1743,10 +1743,11 @@ var gMainPane = {
    1743 1743
           let shellSvc = getShellService();
    
    1744 1744
           let defaultBrowserBox = document.getElementById("defaultBrowserBox");
    
    1745 1745
           let isInFlatpak = gGIOService?.isRunningUnderFlatpak;
    
    1746
    +      const xreDirProvider = Cc[
    
    1747
    +        "@mozilla.org/xre/directory-provider;1"
    
    1748
    +      ].getService(Ci.nsIXREDirProvider);
    
    1746 1749
           // Flatpak does not support setting nor detection of default browser
    
    1747
    -      // privacy-browser#87: Let's keep the default browser box only on macOS
    
    1748
    -      // for now.
    
    1749
    -      if (!shellSvc || isInFlatpak || Services.appinfo.OS !== "Darwin") {
    
    1750
    +      if (!shellSvc || isInFlatpak || xreDirProvider.isPortableMode) {
    
    1750 1751
             defaultBrowserBox.hidden = true;
    
    1751 1752
             return;
    
    1752 1753
           }
    

  • browser/components/shell/ShellService.sys.mjs
    ... ... @@ -64,7 +64,8 @@ let ShellServiceInternal = {
    64 64
       },
    
    65 65
     
    
    66 66
       isDefaultBrowserOptOut() {
    
    67
    -    if (AppConstants.platform == "win") {
    
    67
    +    // Mozilla is also going to disable this, see Bug 1274517 and Bug 1272162.
    
    68
    +    if (AppConstants.platform == "win" && !AppConstants.BASE_BROWSER_VERSION) {
    
    68 69
           let optOutValue = lazy.WindowsRegistry.readRegKey(
    
    69 70
             Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
    
    70 71
             "Software\\Mozilla\\Firefox",
    
    ... ... @@ -295,7 +296,7 @@ let ShellServiceInternal = {
    295 296
           ) {
    
    296 297
             if (this._shouldSetDefaultPDFHandler()) {
    
    297 298
               lazy.log.info("Setting Firefox as default PDF handler");
    
    298
    -          exeArgs.push(".pdf", "FirefoxPDF");
    
    299
    +          exeArgs.push(".pdf", "MullvadBrowserPDF");
    
    299 300
             } else {
    
    300 301
               lazy.log.info("Not setting Firefox as default PDF handler");
    
    301 302
             }
    
    ... ... @@ -338,7 +339,7 @@ let ShellServiceInternal = {
    338 339
               "set-default-extension-handlers-user-choice",
    
    339 340
               aumi,
    
    340 341
               ".pdf",
    
    341
    -          "FirefoxPDF",
    
    342
    +          "MullvadBrowserPDF",
    
    342 343
             ],
    
    343 344
           });
    
    344 345
           telemetryResult = "ErrOther";
    

  • browser/components/shell/WindowsDefaultBrowser.cpp
    ... ... @@ -31,7 +31,7 @@
    31 31
     #include <wchar.h>
    
    32 32
     #include <windows.h>
    
    33 33
     
    
    34
    -#define APP_REG_NAME_BASE L"Firefox-"
    
    34
    +#define APP_REG_NAME_BASE L"MullvadBrowser-"
    
    35 35
     
    
    36 36
     static bool IsWindowsLogonConnected() {
    
    37 37
       WCHAR userName[UNLEN + 1];
    

  • browser/components/shell/nsWindowsShellService.cpp
    ... ... @@ -310,9 +310,11 @@ nsWindowsShellService::CheckAllProgIDsExist(bool* aResult) {
    310 310
         return NS_OK;
    
    311 311
       }
    
    312 312
       *aResult =
    
    313
    -      CheckProgIDExists(FormatProgID(L"FirefoxURL", aumid.get()).get()) &&
    
    314
    -      CheckProgIDExists(FormatProgID(L"FirefoxHTML", aumid.get()).get()) &&
    
    315
    -      CheckProgIDExists(FormatProgID(L"FirefoxPDF", aumid.get()).get());
    
    313
    +      CheckProgIDExists(
    
    314
    +          FormatProgID(L"MullvadBrowserURL", aumid.get()).get()) &&
    
    315
    +      CheckProgIDExists(
    
    316
    +          FormatProgID(L"MullvadBrowserHTML", aumid.get()).get()) &&
    
    317
    +      CheckProgIDExists(FormatProgID(L"MullvadBrowserPDF", aumid.get()).get());
    
    316 318
       return NS_OK;
    
    317 319
     }
    
    318 320
     
    

  • browser/installer/package-manifest.in
    ... ... @@ -63,8 +63,8 @@
    63 63
     @RESPATH@/updater.ini
    
    64 64
     #endif
    
    65 65
     #ifdef MOZ_DEFAULT_BROWSER_AGENT
    
    66
    -@RESPATH@/defaultagent.ini
    
    67
    -@RESPATH@/defaultagent_localized.ini
    
    66
    +; @RESPATH@/defaultagent.ini
    
    67
    +; @RESPATH@/defaultagent_localized.ini
    
    68 68
     #endif
    
    69 69
     #if defined(MOZ_UPDATE_AGENT) || defined(MOZ_DEFAULT_BROWSER_AGENT)
    
    70 70
     @RESPATH@/locale.ini
    

  • mozconfig-windows-x86_64
    ... ... @@ -8,7 +8,6 @@ ac_add_options --enable-strip
    8 8
     # Bits is Background Intelligent Transfer Service
    
    9 9
     ac_add_options --disable-bits-download
    
    10 10
     ac_add_options --disable-maintenance-service
    
    11
    -ac_add_options --disable-default-browser-agent
    
    12 11
     
    
    13 12
     # See bug #13379
    
    14 13
     ac_add_options --enable-nss-mar
    

  • other-licenses/nsis/Contrib/ApplicationID/Makefile
    1
    +CXXFLAGS=-Icityhash -DWIN32 -DNDEBUG -D_WINDOWS -D_USRDLL -DCITYHASH_EXPORTS -DUNICODE
    
    2
    +SRCS=Set.cpp
    
    3
    +OBJS=$(subst .cpp,.o,$(SRCS))
    
    4
    +LDFLAGS=-lole32 -lshlwapi -shared -Wl,--no-insert-timestamp
    
    5
    +PLUGIN=ApplicationID.dll
    
    6
    +
    
    7
    +all: $(PLUGIN)
    
    8
    +
    
    9
    +$(PLUGIN): $(OBJS)
    
    10
    +	$(CXX) $(OBJS) $(LDFLAGS) -o $@
    
    11
    +	llvm-strip $@
    
    12
    +
    
    13
    +clean:
    
    14
    +	$(RM) $(OBJS) $(PLUGIN)

  • other-licenses/nsis/Contrib/CityHash/Makefile
    1
    +CXXFLAGS=-Icityhash -DWIN32 -DNDEBUG -D_WINDOWS -D_USRDLL -DCITYHASH_EXPORTS -DUNICODE
    
    2
    +SRCS=CityHash.cpp cityhash/city.cpp
    
    3
    +OBJS=$(subst .cpp,.o,$(SRCS))
    
    4
    +LDFLAGS=-shared -Wl,--no-insert-timestamp
    
    5
    +PLUGIN=CityHash.dll
    
    6
    +
    
    7
    +all: $(PLUGIN)
    
    8
    +
    
    9
    +$(PLUGIN): $(OBJS)
    
    10
    +	$(CXX) $(OBJS) $(LDFLAGS) -o $@
    
    11
    +	llvm-strip $@
    
    12
    +
    
    13
    +clean:
    
    14
    +	$(RM) $(OBJS) $(PLUGIN)

  • toolkit/mozapps/defaultagent/EventLog.h
    ... ... @@ -7,7 +7,7 @@
    7 7
     #ifndef __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__
    
    8 8
     #define __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__
    
    9 9
     
    
    10
    -#include "mozilla/Types.h"
    
    10
    +#include <cwchar>
    
    11 11
     
    
    12 12
     MOZ_BEGIN_EXTERN_C
    
    13 13
     
    
    ... ... @@ -15,10 +15,21 @@ extern MOZ_EXPORT const wchar_t* gWinEventLogSourceName;
    15 15
     
    
    16 16
     MOZ_END_EXTERN_C
    
    17 17
     
    
    18
    -#include "mozilla/WindowsEventLog.h"
    
    19
    -
    
    20
    -#define LOG_ERROR(hr) MOZ_WIN_EVENT_LOG_ERROR(gWinEventLogSourceName, hr)
    
    21
    -#define LOG_ERROR_MESSAGE(format, ...) \
    
    22
    -  MOZ_WIN_EVENT_LOG_ERROR_MESSAGE(gWinEventLogSourceName, format, __VA_ARGS__)
    
    18
    +#ifdef LOG_ERRORS_FILE
    
    19
    +extern FILE* gLogFile;
    
    20
    +#  define LOG_ERROR(hr)                                                 \
    
    21
    +    if (gLogFile) {                                                     \
    
    22
    +      fprintf(gLogFile, "Error in %s:%d: 0x%X\r\n", __FILE__, __LINE__, \
    
    23
    +              (unsigned int)hr);                                        \
    
    24
    +    }
    
    25
    +#  define LOG_ERROR_MESSAGE(format, ...)                     \
    
    26
    +    if (gLogFile) {                                          \
    
    27
    +      fwprintf(gLogFile, format __VA_OPT__(, ) __VA_ARGS__); \
    
    28
    +      fputs("\r\n", gLogFile);                               \
    
    29
    +    }
    
    30
    +#else
    
    31
    +#  define LOG_ERROR(hr)
    
    32
    +#  define LOG_ERROR_MESSAGE(format, ...)
    
    33
    +#endif
    
    23 34
     
    
    24 35
     #endif  // __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__

  • toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp
    ... ... @@ -224,19 +224,19 @@ static bool VerifyUserDefault(const wchar_t* aExt, const wchar_t* aProgID) {
    224 224
     
    
    225 225
     HRESULT SetDefaultBrowserUserChoice(
    
    226 226
         const wchar_t* aAumi, const wchar_t* const* aExtraFileExtensions) {
    
    227
    -  auto urlProgID = FormatProgID(L"FirefoxURL", aAumi);
    
    227
    +  auto urlProgID = FormatProgID(L"MullvadBrowserURL", aAumi);
    
    228 228
       if (!CheckProgIDExists(urlProgID.get())) {
    
    229 229
         LOG_ERROR_MESSAGE(L"ProgID %s not found", urlProgID.get());
    
    230 230
         return MOZ_E_NO_PROGID;
    
    231 231
       }
    
    232 232
     
    
    233
    -  auto htmlProgID = FormatProgID(L"FirefoxHTML", aAumi);
    
    233
    +  auto htmlProgID = FormatProgID(L"MullvadBrowserHTML", aAumi);
    
    234 234
       if (!CheckProgIDExists(htmlProgID.get())) {
    
    235 235
         LOG_ERROR_MESSAGE(L"ProgID %s not found", htmlProgID.get());
    
    236 236
         return MOZ_E_NO_PROGID;
    
    237 237
       }
    
    238 238
     
    
    239
    -  auto pdfProgID = FormatProgID(L"FirefoxPDF", aAumi);
    
    239
    +  auto pdfProgID = FormatProgID(L"MullvadBrowserPDF", aAumi);
    
    240 240
       if (!CheckProgIDExists(pdfProgID.get())) {
    
    241 241
         LOG_ERROR_MESSAGE(L"ProgID %s not found", pdfProgID.get());
    
    242 242
         return MOZ_E_NO_PROGID;
    
    ... ... @@ -363,3 +363,41 @@ HRESULT SetDefaultExtensionHandlersUserChoiceImpl(
    363 363
     
    
    364 364
       return S_OK;
    
    365 365
     }
    
    366
    +
    
    367
    +#ifdef LOG_ERRORS_FILE
    
    368
    +FILE* gLogFile;
    
    369
    +#endif
    
    370
    +
    
    371
    +// Simplified version of wmain that uses only this file from main.cpp.
    
    372
    +int wmain(int argc, wchar_t** argv) {
    
    373
    +  if (argc < 3 || !argv[1] || !argv[2]) {
    
    374
    +    return E_INVALIDARG;
    
    375
    +  }
    
    376
    +
    
    377
    +#ifdef LOG_ERRORS_FILE
    
    378
    +  std::unique_ptr<FILE, decltype(&fclose)> logFile(fopen(LOG_ERRORS_FILE, "a+"),
    
    379
    +                                                   &fclose);
    
    380
    +  gLogFile = logFile.get();
    
    381
    +#endif
    
    382
    +
    
    383
    +  HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
    
    384
    +  if (FAILED(hr)) {
    
    385
    +    LOG_ERROR(hr);
    
    386
    +    return hr;
    
    387
    +  }
    
    388
    +  const struct ComUninitializer {
    
    389
    +    ~ComUninitializer() { CoUninitialize(); }
    
    390
    +  } kCUi;
    
    391
    +
    
    392
    +  if (!wcscmp(argv[1], L"set-default-browser-user-choice")) {
    
    393
    +    // `argv` is itself null-terminated, so we can safely pass the tail of the
    
    394
    +    // array here.
    
    395
    +    return SetDefaultBrowserUserChoice(argv[2], &argv[3]);
    
    396
    +  } else if (!wcscmp(argv[1], L"set-default-extension-handlers-user-choice")) {
    
    397
    +    // `argv` is itself null-terminated, so we can safely pass the tail of the
    
    398
    +    // array here.
    
    399
    +    return SetDefaultExtensionHandlersUserChoice(argv[2], &argv[3]);
    
    400
    +  } else {
    
    401
    +    return E_INVALIDARG;
    
    402
    +  }
    
    403
    +}

  • toolkit/mozapps/defaultagent/moz.build
    ... ... @@ -6,51 +6,23 @@
    6 6
     
    
    7 7
     Program("default-browser-agent")
    
    8 8
     
    
    9
    -SPHINX_TREES["default-browser-agent"] = "docs"
    
    10
    -
    
    11
    -DIRS += ["rust"]
    
    12
    -
    
    13 9
     UNIFIED_SOURCES += [
    
    14 10
         "/mfbt/Poison.cpp",
    
    15 11
         "/mfbt/Unused.cpp",
    
    16
    -    "Cache.cpp",
    
    17
    -    "common.cpp",
    
    18
    -    "DefaultBrowser.cpp",
    
    19
    -    "DefaultPDF.cpp",
    
    20
    -    "EventLog.cpp",
    
    21
    -    "main.cpp",
    
    22
    -    "Notification.cpp",
    
    23
    -    "Policy.cpp",
    
    24
    -    "Registry.cpp",
    
    25
    -    "RemoteSettings.cpp",
    
    26
    -    "ScheduledTask.cpp",
    
    27 12
         "SetDefaultBrowser.cpp",
    
    28
    -    "Telemetry.cpp",
    
    29
    -    "UtfConvert.cpp",
    
    30 13
     ]
    
    31 14
     
    
    32 15
     SOURCES += [
    
    33 16
         "/browser/components/shell/WindowsDefaultBrowser.cpp",
    
    34 17
         "/browser/components/shell/WindowsUserChoice.cpp",
    
    35 18
         "/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp",
    
    36
    -    "/third_party/WinToast/wintoastlib.cpp",
    
    37 19
         "/toolkit/mozapps/update/common/readstrings.cpp",
    
    38 20
     ]
    
    39 21
     
    
    40
    -# Suppress warnings from third-party code.
    
    41
    -SOURCES["/third_party/WinToast/wintoastlib.cpp"].flags += ["-Wno-implicit-fallthrough"]
    
    42
    -
    
    43
    -USE_LIBS += [
    
    44
    -    "defaultagent-static",
    
    45
    -    "jsoncpp",
    
    46
    -]
    
    47
    -
    
    48 22
     LOCAL_INCLUDES += [
    
    49 23
         "/browser/components/shell/",
    
    50 24
         "/mfbt/",
    
    51 25
         "/other-licenses/nsis/Contrib/CityHash/cityhash",
    
    52
    -    "/third_party/WinToast",
    
    53
    -    "/toolkit/components/jsoncpp/include",
    
    54 26
         "/toolkit/mozapps/update/common",
    
    55 27
         "/xpcom/build",
    
    56 28
     ]
    
    ... ... @@ -58,20 +30,12 @@ LOCAL_INCLUDES += [
    58 30
     OS_LIBS += [
    
    59 31
         "advapi32",
    
    60 32
         "bcrypt",
    
    61
    -    "comsupp",
    
    62 33
         "crypt32",
    
    63
    -    "kernel32",
    
    64 34
         "netapi32",
    
    65 35
         "ole32",
    
    66
    -    "oleaut32",
    
    67
    -    "rpcrt4",
    
    68 36
         "shell32",
    
    69 37
         "shlwapi",
    
    70
    -    "taskschd",
    
    71
    -    "userenv",
    
    72
    -    "wininet",
    
    73
    -    "ws2_32",
    
    74
    -    "ntdll",
    
    38
    +    "uuid",
    
    75 39
     ]
    
    76 40
     
    
    77 41
     DEFINES["NS_NO_XPCOM"] = True
    
    ... ... @@ -96,18 +60,3 @@ if CONFIG["CC_TYPE"] == "clang-cl":
    96 60
         WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"]
    
    97 61
     else:
    
    98 62
         WIN32_EXE_LDFLAGS += ["-municode"]
    99
    -
    
    100
    -GENERATED_FILES += ["defaultagent.ini"]
    
    101
    -defaultagentini = GENERATED_FILES["defaultagent.ini"]
    
    102
    -defaultagentini.script = "/browser/locales/generate_ini.py"
    
    103
    -defaultagentini.inputs = [
    
    104
    -    "defaultagent.ini",
    
    105
    -    "defaultagent_append.ini",
    
    106
    -]
    
    107
    -FINAL_TARGET_FILES += ["!defaultagent.ini"]
    
    108
    -
    
    109
    -if CONFIG["ENABLE_TESTS"]:
    
    110
    -    DIRS += ["tests/gtest"]
    
    111
    -
    
    112
    -with Files("**"):
    
    113
    -    BUG_COMPONENT = ("Toolkit", "Default Browser Agent")

  • widget/windows/WinTaskbar.cpp
    ... ... @@ -209,6 +209,19 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId,
    209 209
       // If marked as such in prefs, use a hash of the profile path for the id
    
    210 210
       // instead of the install path hash setup by the installer.
    
    211 211
       bool useProfile = Preferences::GetBool("taskbar.grouping.useprofile", false);
    
    212
    +
    
    213
    +  {
    
    214
    +    // For portable mode, force the AUMID to be based on the profile directory
    
    215
    +    // instead of reading it from the registry.
    
    216
    +    bool isPortable = true;
    
    217
    +    // Do not even check if taskbar.grouping.useprofile is already true.
    
    218
    +    if (!useProfile &&
    
    219
    +        NS_SUCCEEDED(gDirServiceProvider->GetIsPortableMode(&isPortable)) &&
    
    220
    +        isPortable) {
    
    221
    +      useProfile = true;
    
    222
    +    }
    
    223
    +  }
    
    224
    +
    
    212 225
       if (useProfile) {
    
    213 226
         nsCOMPtr<nsIFile> profileDir;
    
    214 227
         NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
    
    ... ... @@ -237,7 +250,7 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId,
    237 250
       nsCString appName;
    
    238 251
       if (appInfo && NS_SUCCEEDED(appInfo->GetName(appName))) {
    
    239 252
         nsAutoString regKey;
    
    240
    -    regKey.AssignLiteral("Software\\Mozilla\\");
    
    253
    +    regKey.AssignLiteral("Software\\" MOZ_APP_VENDOR "\\");
    
    241 254
         AppendASCIItoUTF16(appName, regKey);
    
    242 255
         regKey.AppendLiteral("\\TaskBarIDs");
    
    243 256
     
    

  • widget/windows/moz.build
    ... ... @@ -188,6 +188,7 @@ DEFINES["MOZ_UNICODE"] = True
    188 188
     DEFINES["MOZ_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"]
    
    189 189
     # Turn `firefox` into `Firefox`.
    
    190 190
     DEFINES["MOZ_TOAST_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"].title()
    
    191
    +DEFINES["MOZ_APP_VENDOR"] = '"%s"' % CONFIG["MOZ_APP_VENDOR"]
    
    191 192
     
    
    192 193
     for var in ("MOZ_ENABLE_D3D10_LAYER",):
    
    193 194
         if CONFIG[var]: