Pier Angelo Vendrame pushed to branch mullvad-browser-146.0a1-16.0-2 at The Tor Project / Applications / Mullvad Browser Commits: 0801264b by Pier Angelo Vendrame at 2025-12-11T12:21:20+01:00 MB 80: Enable Mullvad Browser as a default browser - - - - - 10 changed files: - browser/components/shell/ShellService.sys.mjs - browser/components/shell/WindowsDefaultBrowser.cpp - browser/components/shell/nsWindowsShellService.cpp - + other-licenses/nsis/Contrib/ApplicationID/Makefile - other-licenses/nsis/Contrib/ApplicationID/Set.cpp - + other-licenses/nsis/Contrib/CityHash/Makefile - toolkit/mozapps/defaultagent/EventLog.h - toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp - widget/windows/WinTaskbar.cpp - widget/windows/moz.build Changes: ===================================== browser/components/shell/ShellService.sys.mjs ===================================== @@ -286,7 +286,7 @@ let ShellServiceInternal = { ) { if (this._shouldSetDefaultPDFHandler()) { lazy.log.info("Setting Firefox as default PDF handler"); - extraFileExtensions.push(".pdf", "FirefoxPDF"); + extraFileExtensions.push(".pdf", "MullvadBrowserPDF"); } else { lazy.log.info("Not setting Firefox as default PDF handler"); } @@ -324,7 +324,7 @@ let ShellServiceInternal = { try { this.defaultAgent.setDefaultExtensionHandlersUserChoice(aumi, [ ".pdf", - "FirefoxPDF", + "MullvadBrowserPDF", ]); } catch (err) { telemetryResult = "ErrOther"; ===================================== browser/components/shell/WindowsDefaultBrowser.cpp ===================================== @@ -24,7 +24,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 ===================================== @@ -361,10 +361,12 @@ nsWindowsShellService::CheckAllProgIDsExist(bool* aResult) { *aResult = result; } else { - *aResult = - CheckProgIDExists(FormatProgID(L"FirefoxURL", aumid.get()).get()) && - CheckProgIDExists(FormatProgID(L"FirefoxHTML", aumid.get()).get()) && - CheckProgIDExists(FormatProgID(L"FirefoxPDF", aumid.get()).get()); + *aResult = CheckProgIDExists( + FormatProgID(L"MullvadBrowserURL", aumid.get()).get()) && + CheckProgIDExists( + FormatProgID(L"MullvadBrowserHTML", aumid.get()).get()) && + CheckProgIDExists( + FormatProgID(L"MullvadBrowserPDF", aumid.get()).get()); } return NS_OK; ===================================== 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/ApplicationID/Set.cpp ===================================== @@ -35,7 +35,8 @@ unsigned int g_stringsize; TCHAR *g_variables; // Indicates that an application supports dual desktop and immersive modes. In Windows 8, this property is only applicable for web browsers. -DEFINE_PROPERTYKEY(PKEY_AppUserModel_IsDualMode, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 11); +// mingw already defines this in propkey.h. +// DEFINE_PROPERTYKEY(PKEY_AppUserModel_IsDualMode, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 11); int popstring(TCHAR *str, int len); void pushstring(const TCHAR *str, int len); ===================================== 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 ===================================== @@ -444,9 +444,10 @@ nsresult SetDefaultBrowserUserChoice( return NS_ERROR_FAILURE; } - nsTArray<nsString> browserDefaults = { - u"https"_ns, u"FirefoxURL"_ns, u"http"_ns, u"FirefoxURL"_ns, - u".html"_ns, u"FirefoxHTML"_ns, u".htm"_ns, u"FirefoxHTML"_ns}; + nsTArray<nsString> browserDefaults = {u"https"_ns, u"MullvadBrowserURL"_ns, + u"http"_ns, u"MullvadBrowserURL"_ns, + u".html"_ns, u"MullvadBrowserHTML"_ns, + u".htm"_ns, u"MullvadBrowserHTML"_ns}; browserDefaults.AppendElements(aExtraFileExtensions); ===================================== widget/windows/WinTaskbar.cpp ===================================== @@ -249,7 +249,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 ===================================== @@ -209,6 +209,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"] USE_LIBS += [ "jsoncpp", View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/0801... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/0801... You're receiving this email because of your account on gitlab.torproject.org.
participants (1)
-
Pier Angelo Vendrame (@pierov)