[tbb-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-115.8.0esr-13.5-1] 6 commits: Revert "MB 87: Disable the default browser box on Windows and Linux"
Pier Angelo Vendrame (@pierov)
git at gitlab.torproject.org
Wed Mar 6 18:19:29 UTC 2024
Pier Angelo Vendrame pushed to branch mullvad-browser-115.8.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser
Commits:
8893383e by Pier Angelo Vendrame at 2024-03-06T19:18:51+01:00
Revert "MB 87: Disable the default browser box on Windows and Linux"
This reverts commit bd64d5f09ec5cd2bab9db6fdc0ff679107b7fc4a.
We are going to disable the default browser whenever we are in portable
mode instead.
- - - - -
757aaf94 by Pier Angelo Vendrame at 2024-03-06T19:18:53+01:00
fixup! Firefox preference overrides.
MB 80: Allow default browser on Windows for Mullvad Browser
- - - - -
51bf1800 by Pier Angelo Vendrame at 2024-03-06T19:18:54+01:00
fixup! Bug 9173: Change the default Firefox profile directory to be relative.
Force `GenerateAppUserModelID` to use the profile directory in portable
mode.
- - - - -
722401c5 by Pier Angelo Vendrame at 2024-03-06T19:18:55+01:00
fixup! MB 38: Mullvad Browser configuration
MB 80: Enable the default browser agent
- - - - -
5eeb2ea8 by Pier Angelo Vendrame at 2024-03-06T19:18:55+01:00
MB 80: Enable Mullvad Browser as a default browser
- - - - -
68744b70 by Pier Angelo Vendrame at 2024-03-06T19:18:56+01:00
fixup! MB 80: Enable Mullvad Browser as a default browser
Debugging faciliites.
- - - - -
14 changed files:
- browser/app/profile/001-base-profile.js
- browser/components/preferences/main.js
- browser/components/shell/ShellService.sys.mjs
- browser/components/shell/WindowsDefaultBrowser.cpp
- browser/components/shell/nsWindowsShellService.cpp
- browser/installer/package-manifest.in
- mozconfig-windows-x86_64
- + other-licenses/nsis/Contrib/ApplicationID/Makefile
- + other-licenses/nsis/Contrib/CityHash/Makefile
- toolkit/mozapps/defaultagent/EventLog.h
- toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp
- toolkit/mozapps/defaultagent/moz.build
- widget/windows/WinTaskbar.cpp
- widget/windows/moz.build
Changes:
=====================================
browser/app/profile/001-base-profile.js
=====================================
@@ -629,11 +629,6 @@ pref("privacy.query_stripping.strip_on_share.enabled", true);
pref("dom.text-recognition.enabled", false);
#ifdef XP_WIN
-// prefs to disable jump-list entries in the taskbar on Windows (see bug #12885)
-// this pref changes the app's set AUMID to be dependent on the profile path, rather than
-// attempting to read it from the registry; this is necessary so that the file generated
-// by the jumplist system can be properly deleted if it is disabled
-pref("taskbar.grouping.useprofile", true);
pref("browser.taskbar.lists.enabled", false);
pref("browser.taskbar.lists.frequent.enabled", false);
pref("browser.taskbar.lists.tasks.enabled", false);
=====================================
browser/components/preferences/main.js
=====================================
@@ -1743,10 +1743,11 @@ var gMainPane = {
let shellSvc = getShellService();
let defaultBrowserBox = document.getElementById("defaultBrowserBox");
let isInFlatpak = gGIOService?.isRunningUnderFlatpak;
+ const xreDirProvider = Cc[
+ "@mozilla.org/xre/directory-provider;1"
+ ].getService(Ci.nsIXREDirProvider);
// Flatpak does not support setting nor detection of default browser
- // privacy-browser#87: Let's keep the default browser box only on macOS
- // for now.
- if (!shellSvc || isInFlatpak || Services.appinfo.OS !== "Darwin") {
+ if (!shellSvc || isInFlatpak || xreDirProvider.isPortableMode) {
defaultBrowserBox.hidden = true;
return;
}
=====================================
browser/components/shell/ShellService.sys.mjs
=====================================
@@ -64,7 +64,8 @@ let ShellServiceInternal = {
},
isDefaultBrowserOptOut() {
- if (AppConstants.platform == "win") {
+ // Mozilla is also going to disable this, see Bug 1274517 and Bug 1272162.
+ if (AppConstants.platform == "win" && !AppConstants.BASE_BROWSER_VERSION) {
let optOutValue = lazy.WindowsRegistry.readRegKey(
Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
"Software\\Mozilla\\Firefox",
@@ -295,7 +296,7 @@ let ShellServiceInternal = {
) {
if (this._shouldSetDefaultPDFHandler()) {
lazy.log.info("Setting Firefox as default PDF handler");
- exeArgs.push(".pdf", "FirefoxPDF");
+ exeArgs.push(".pdf", "MullvadBrowserPDF");
} else {
lazy.log.info("Not setting Firefox as default PDF handler");
}
@@ -338,7 +339,7 @@ let ShellServiceInternal = {
"set-default-extension-handlers-user-choice",
aumi,
".pdf",
- "FirefoxPDF",
+ "MullvadBrowserPDF",
],
});
telemetryResult = "ErrOther";
=====================================
browser/components/shell/WindowsDefaultBrowser.cpp
=====================================
@@ -31,7 +31,7 @@
#include <wchar.h>
#include <windows.h>
-#define APP_REG_NAME_BASE L"Firefox-"
+#define APP_REG_NAME_BASE L"MullvadBrowser-"
static bool IsWindowsLogonConnected() {
WCHAR userName[UNLEN + 1];
=====================================
browser/components/shell/nsWindowsShellService.cpp
=====================================
@@ -310,9 +310,11 @@ nsWindowsShellService::CheckAllProgIDsExist(bool* aResult) {
return NS_OK;
}
*aResult =
- CheckProgIDExists(FormatProgID(L"FirefoxURL", aumid.get()).get()) &&
- CheckProgIDExists(FormatProgID(L"FirefoxHTML", aumid.get()).get()) &&
- CheckProgIDExists(FormatProgID(L"FirefoxPDF", aumid.get()).get());
+ CheckProgIDExists(
+ FormatProgID(L"MullvadBrowserURL", aumid.get()).get()) &&
+ CheckProgIDExists(
+ FormatProgID(L"MullvadBrowserHTML", aumid.get()).get()) &&
+ CheckProgIDExists(FormatProgID(L"MullvadBrowserPDF", aumid.get()).get());
return NS_OK;
}
=====================================
browser/installer/package-manifest.in
=====================================
@@ -63,8 +63,8 @@
@RESPATH@/updater.ini
#endif
#ifdef MOZ_DEFAULT_BROWSER_AGENT
- at RESPATH@/defaultagent.ini
- at RESPATH@/defaultagent_localized.ini
+; @RESPATH@/defaultagent.ini
+; @RESPATH@/defaultagent_localized.ini
#endif
#if defined(MOZ_UPDATE_AGENT) || defined(MOZ_DEFAULT_BROWSER_AGENT)
@RESPATH@/locale.ini
=====================================
mozconfig-windows-x86_64
=====================================
@@ -8,7 +8,6 @@ ac_add_options --enable-strip
# Bits is Background Intelligent Transfer Service
ac_add_options --disable-bits-download
ac_add_options --disable-maintenance-service
-ac_add_options --disable-default-browser-agent
# See bug #13379
ac_add_options --enable-nss-mar
=====================================
other-licenses/nsis/Contrib/ApplicationID/Makefile
=====================================
@@ -0,0 +1,14 @@
+CXXFLAGS=-Icityhash -DWIN32 -DNDEBUG -D_WINDOWS -D_USRDLL -DCITYHASH_EXPORTS -DUNICODE
+SRCS=Set.cpp
+OBJS=$(subst .cpp,.o,$(SRCS))
+LDFLAGS=-lole32 -lshlwapi -shared -Wl,--no-insert-timestamp
+PLUGIN=ApplicationID.dll
+
+all: $(PLUGIN)
+
+$(PLUGIN): $(OBJS)
+ $(CXX) $(OBJS) $(LDFLAGS) -o $@
+ llvm-strip $@
+
+clean:
+ $(RM) $(OBJS) $(PLUGIN)
=====================================
other-licenses/nsis/Contrib/CityHash/Makefile
=====================================
@@ -0,0 +1,14 @@
+CXXFLAGS=-Icityhash -DWIN32 -DNDEBUG -D_WINDOWS -D_USRDLL -DCITYHASH_EXPORTS -DUNICODE
+SRCS=CityHash.cpp cityhash/city.cpp
+OBJS=$(subst .cpp,.o,$(SRCS))
+LDFLAGS=-shared -Wl,--no-insert-timestamp
+PLUGIN=CityHash.dll
+
+all: $(PLUGIN)
+
+$(PLUGIN): $(OBJS)
+ $(CXX) $(OBJS) $(LDFLAGS) -o $@
+ llvm-strip $@
+
+clean:
+ $(RM) $(OBJS) $(PLUGIN)
=====================================
toolkit/mozapps/defaultagent/EventLog.h
=====================================
@@ -7,7 +7,7 @@
#ifndef __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__
#define __DEFAULT_BROWSER_AGENT_EVENT_LOG_H__
-#include "mozilla/Types.h"
+#include <cwchar>
MOZ_BEGIN_EXTERN_C
@@ -15,10 +15,21 @@ extern MOZ_EXPORT const wchar_t* gWinEventLogSourceName;
MOZ_END_EXTERN_C
-#include "mozilla/WindowsEventLog.h"
-
-#define LOG_ERROR(hr) MOZ_WIN_EVENT_LOG_ERROR(gWinEventLogSourceName, hr)
-#define LOG_ERROR_MESSAGE(format, ...) \
- MOZ_WIN_EVENT_LOG_ERROR_MESSAGE(gWinEventLogSourceName, format, __VA_ARGS__)
+#ifdef LOG_ERRORS_FILE
+extern FILE* gLogFile;
+# define LOG_ERROR(hr) \
+ if (gLogFile) { \
+ fprintf(gLogFile, "Error in %s:%d: 0x%X\r\n", __FILE__, __LINE__, \
+ (unsigned int)hr); \
+ }
+# define LOG_ERROR_MESSAGE(format, ...) \
+ if (gLogFile) { \
+ fwprintf(gLogFile, format __VA_OPT__(, ) __VA_ARGS__); \
+ fputs("\r\n", gLogFile); \
+ }
+#else
+# define LOG_ERROR(hr)
+# define LOG_ERROR_MESSAGE(format, ...)
+#endif
#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) {
HRESULT SetDefaultBrowserUserChoice(
const wchar_t* aAumi, const wchar_t* const* aExtraFileExtensions) {
- auto urlProgID = FormatProgID(L"FirefoxURL", aAumi);
+ auto urlProgID = FormatProgID(L"MullvadBrowserURL", aAumi);
if (!CheckProgIDExists(urlProgID.get())) {
LOG_ERROR_MESSAGE(L"ProgID %s not found", urlProgID.get());
return MOZ_E_NO_PROGID;
}
- auto htmlProgID = FormatProgID(L"FirefoxHTML", aAumi);
+ auto htmlProgID = FormatProgID(L"MullvadBrowserHTML", aAumi);
if (!CheckProgIDExists(htmlProgID.get())) {
LOG_ERROR_MESSAGE(L"ProgID %s not found", htmlProgID.get());
return MOZ_E_NO_PROGID;
}
- auto pdfProgID = FormatProgID(L"FirefoxPDF", aAumi);
+ auto pdfProgID = FormatProgID(L"MullvadBrowserPDF", aAumi);
if (!CheckProgIDExists(pdfProgID.get())) {
LOG_ERROR_MESSAGE(L"ProgID %s not found", pdfProgID.get());
return MOZ_E_NO_PROGID;
@@ -363,3 +363,41 @@ HRESULT SetDefaultExtensionHandlersUserChoiceImpl(
return S_OK;
}
+
+#ifdef LOG_ERRORS_FILE
+FILE* gLogFile;
+#endif
+
+// Simplified version of wmain that uses only this file from main.cpp.
+int wmain(int argc, wchar_t** argv) {
+ if (argc < 3 || !argv[1] || !argv[2]) {
+ return E_INVALIDARG;
+ }
+
+#ifdef LOG_ERRORS_FILE
+ std::unique_ptr<FILE, decltype(&fclose)> logFile(fopen(LOG_ERRORS_FILE, "a+"),
+ &fclose);
+ gLogFile = logFile.get();
+#endif
+
+ HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
+ if (FAILED(hr)) {
+ LOG_ERROR(hr);
+ return hr;
+ }
+ const struct ComUninitializer {
+ ~ComUninitializer() { CoUninitialize(); }
+ } kCUi;
+
+ if (!wcscmp(argv[1], L"set-default-browser-user-choice")) {
+ // `argv` is itself null-terminated, so we can safely pass the tail of the
+ // array here.
+ return SetDefaultBrowserUserChoice(argv[2], &argv[3]);
+ } else if (!wcscmp(argv[1], L"set-default-extension-handlers-user-choice")) {
+ // `argv` is itself null-terminated, so we can safely pass the tail of the
+ // array here.
+ return SetDefaultExtensionHandlersUserChoice(argv[2], &argv[3]);
+ } else {
+ return E_INVALIDARG;
+ }
+}
=====================================
toolkit/mozapps/defaultagent/moz.build
=====================================
@@ -6,51 +6,23 @@
Program("default-browser-agent")
-SPHINX_TREES["default-browser-agent"] = "docs"
-
-DIRS += ["rust"]
-
UNIFIED_SOURCES += [
"/mfbt/Poison.cpp",
"/mfbt/Unused.cpp",
- "Cache.cpp",
- "common.cpp",
- "DefaultBrowser.cpp",
- "DefaultPDF.cpp",
- "EventLog.cpp",
- "main.cpp",
- "Notification.cpp",
- "Policy.cpp",
- "Registry.cpp",
- "RemoteSettings.cpp",
- "ScheduledTask.cpp",
"SetDefaultBrowser.cpp",
- "Telemetry.cpp",
- "UtfConvert.cpp",
]
SOURCES += [
"/browser/components/shell/WindowsDefaultBrowser.cpp",
"/browser/components/shell/WindowsUserChoice.cpp",
"/other-licenses/nsis/Contrib/CityHash/cityhash/city.cpp",
- "/third_party/WinToast/wintoastlib.cpp",
"/toolkit/mozapps/update/common/readstrings.cpp",
]
-# Suppress warnings from third-party code.
-SOURCES["/third_party/WinToast/wintoastlib.cpp"].flags += ["-Wno-implicit-fallthrough"]
-
-USE_LIBS += [
- "defaultagent-static",
- "jsoncpp",
-]
-
LOCAL_INCLUDES += [
"/browser/components/shell/",
"/mfbt/",
"/other-licenses/nsis/Contrib/CityHash/cityhash",
- "/third_party/WinToast",
- "/toolkit/components/jsoncpp/include",
"/toolkit/mozapps/update/common",
"/xpcom/build",
]
@@ -58,20 +30,12 @@ LOCAL_INCLUDES += [
OS_LIBS += [
"advapi32",
"bcrypt",
- "comsupp",
"crypt32",
- "kernel32",
"netapi32",
"ole32",
- "oleaut32",
- "rpcrt4",
"shell32",
"shlwapi",
- "taskschd",
- "userenv",
- "wininet",
- "ws2_32",
- "ntdll",
+ "uuid",
]
DEFINES["NS_NO_XPCOM"] = True
@@ -96,18 +60,3 @@ if CONFIG["CC_TYPE"] == "clang-cl":
WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"]
else:
WIN32_EXE_LDFLAGS += ["-municode"]
-
-GENERATED_FILES += ["defaultagent.ini"]
-defaultagentini = GENERATED_FILES["defaultagent.ini"]
-defaultagentini.script = "/browser/locales/generate_ini.py"
-defaultagentini.inputs = [
- "defaultagent.ini",
- "defaultagent_append.ini",
-]
-FINAL_TARGET_FILES += ["!defaultagent.ini"]
-
-if CONFIG["ENABLE_TESTS"]:
- DIRS += ["tests/gtest"]
-
-with Files("**"):
- BUG_COMPONENT = ("Toolkit", "Default Browser Agent")
=====================================
widget/windows/WinTaskbar.cpp
=====================================
@@ -209,6 +209,19 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId,
// If marked as such in prefs, use a hash of the profile path for the id
// instead of the install path hash setup by the installer.
bool useProfile = Preferences::GetBool("taskbar.grouping.useprofile", false);
+
+ {
+ // For portable mode, force the AUMID to be based on the profile directory
+ // instead of reading it from the registry.
+ bool isPortable = true;
+ // Do not even check if taskbar.grouping.useprofile is already true.
+ if (!useProfile &&
+ NS_SUCCEEDED(gDirServiceProvider->GetIsPortableMode(&isPortable)) &&
+ isPortable) {
+ useProfile = true;
+ }
+ }
+
if (useProfile) {
nsCOMPtr<nsIFile> profileDir;
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
@@ -237,7 +250,7 @@ bool WinTaskbar::GenerateAppUserModelID(nsAString& aAppUserModelId,
nsCString appName;
if (appInfo && NS_SUCCEEDED(appInfo->GetName(appName))) {
nsAutoString regKey;
- regKey.AssignLiteral("Software\\Mozilla\\");
+ regKey.AssignLiteral("Software\\" MOZ_APP_VENDOR "\\");
AppendASCIItoUTF16(appName, regKey);
regKey.AppendLiteral("\\TaskBarIDs");
=====================================
widget/windows/moz.build
=====================================
@@ -188,6 +188,7 @@ DEFINES["MOZ_UNICODE"] = True
DEFINES["MOZ_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"]
# Turn `firefox` into `Firefox`.
DEFINES["MOZ_TOAST_APP_NAME"] = '"%s"' % CONFIG["MOZ_APP_NAME"].title()
+DEFINES["MOZ_APP_VENDOR"] = '"%s"' % CONFIG["MOZ_APP_VENDOR"]
for var in ("MOZ_ENABLE_D3D10_LAYER",):
if CONFIG[var]:
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/bbf5383cbf31c607c131151ddd177219ea1db7f4...68744b7063410e0107bddb9ab530a5fd840e5a66
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/bbf5383cbf31c607c131151ddd177219ea1db7f4...68744b7063410e0107bddb9ab530a5fd840e5a66
You're receiving this email because of your account on gitlab.torproject.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240306/fa81c1cc/attachment-0001.htm>
More information about the tbb-commits
mailing list