Pier Angelo Vendrame pushed to branch mullvad-browser-147.0a1-16.0-1 at The Tor Project / Applications / Mullvad Browser Commits: a8487fd3 by Pier Angelo Vendrame at 2026-01-19T09:26:39+01:00 MB 80: Enable Mullvad Browser as a default browser - - - - - c493899e by henry at 2026-01-19T09:26:39+01:00 fixup! BB 32308: Use direct browser sizing for letterboxing. TB 44289: Handle the case where --toolbar-field-color is set to "inherit". Also, better handle "currentColor" values to not rely on the computed color, which may vary with the UI state. Also, replace "/*" comments with "//". (cherry picked from commit 961b3271e9af455b91bb43e8ea18701ff6a5577f) Co-authored-by: Henry Wilkes <henry@torproject.org> - - - - - f85f07b7 by henry at 2026-01-19T09:26:39+01:00 fixup! BB 42305: Add script to combine translation files across versions. TB 44498: Change the expected browser version gap between stable and alpha from 0.5 to 1.0. (cherry picked from commit 0f10cc1e6af605090cbd0ba4dbc0615c6f51e286) Co-authored-by: Henry Wilkes <henry@torproject.org> - - - - - 12 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/components/resistfingerprinting/RFPHelper.sys.mjs - toolkit/mozapps/defaultagent/EventLog.h - toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp - tools/base_browser/l10n/combine-translation-versions.py - 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/components/resistfingerprinting/RFPHelper.sys.mjs ===================================== @@ -920,20 +920,49 @@ class _RFPHelper { * @param {CSSStyleDeclaration} style - The computed style for the element we * want to grab the color from. * @param {string} property - The name of the property we want. + * @param {object} [options] - Optional details. + * @param {string} [options.fallbackProperty] - A fallback to use instead if + * the property doesn't have a computed value. + * @param {string} [options.currentColorProperty] - The name of a property to + * use as the currentColor. * * @returns {InspectorRGBATuple} - The RGBA color. The "r", "g", "b" fields * are relative to the 0-255 color range. The "a" field is in the 0-1 range. */ - _convertToRGBA(win, style, property) { + _convertToRGBA(win, style, property, options) { let cssColor = style.getPropertyValue(property); if (!cssColor) { + if (options?.fallbackProperty) { + lazy.logConsole.debug( + "Using fallback property for RGBA.", + property, + options.fallbackProperty + ); + return this._convertToRGBA(win, style, options.fallbackProperty); + } lazy.logConsole.error(`Missing color "${property}"`); return { r: 0, g: 0, b: 0, a: 0 }; } const currentColorRegex = /(^|[^a-zA-Z0-9_-])currentColor($|[^a-zA-Z0-9_-])/g; if (currentColorRegex.test(cssColor)) { - const currentColor = style.color; + let currentColor; + if (options?.currentColorProperty) { + const currRGBA = this._convertToRGBA( + win, + style, + options.currentColorProperty + ); + currentColor = `rgba(${currRGBA.r}, ${currRGBA.g}, ${currRGBA.b}, ${currRGBA.a})`; + } else { + lazy.logConsole.warning( + "Missing a specification for the currentColor, using computed color." + ); + // Use the current "color" value. NOTE: this may not be exactly what we + // want since it's current value may be effected by :hover, :active, + // :focus, etc. But we want this to be a stable colour for the theme. + currentColor = style.color; + } cssColor = cssColor.replace(currentColorRegex, (_, pre, post) => { return pre + currentColor + post; }); @@ -944,7 +973,7 @@ class _RFPHelper { cssColor ); } - /* Can drop the document argument after bugzilla bug 1973684 (142). */ + // Can drop the document argument after bugzilla bug 1973684 (142). const colorRGBA = win.InspectorUtils.colorToRGBA(cssColor, win.document); if (!colorRGBA) { lazy.logConsole.error( @@ -985,12 +1014,13 @@ class _RFPHelper { * @param {Window} win - The window to calculate the color for. * @param {CSSStyleDeclaration} style - The computed style for the #nav-bar * element. + * @param {boolean} verticalTabs - Whether vertical tabs are enabled. * * @returns {InspectorRGBATuple} - The calculated color, which will be opaque. */ - _calculateUrlbarContainerColor(win, style) { + _calculateUrlbarContainerColor(win, style, verticalTabs) { let colorRGBA; - if (!Services.prefs.getBoolPref(kPrefVerticalTabs)) { + if (!verticalTabs) { lazy.logConsole.debug("Toolbar background used."); colorRGBA = this._convertToRGBA(win, style, "--toolbar-bgcolor"); if (colorRGBA.a === 1) { @@ -1069,12 +1099,19 @@ class _RFPHelper { if (letterboxingEnabled) { // Want the effective colour of various elements without any alpha values // so they can be used consistently. + + const verticalTabs = Services.prefs.getBoolPref(kPrefVerticalTabs); + const chromeTextColorProperty = verticalTabs + ? "--toolbox-textcolor" + : "--toolbar-color"; + const navbarStyle = win.getComputedStyle( win.document.getElementById("nav-bar") ); const containerRGBA = this._calculateUrlbarContainerColor( win, - navbarStyle + navbarStyle, + verticalTabs ); urlbarBackgroundRGBA = this._composeRGBA( this._convertToRGBA( @@ -1084,17 +1121,28 @@ class _RFPHelper { ), containerRGBA ); + // NOTE: In the default theme (no "lwtheme" attribute) with + // browser.theme.native-theme set to false, --toolbar-field-color can be + // set to "inherit", which means it will have a blank computed value. We + // fallback to --toolbar-color or --toolbox-textcolor in this case. + // Similarly, for windows OS, it can be set to "currentColor". urlbarTextRGBA = this._composeRGBA( - this._convertToRGBA(win, navbarStyle, "--toolbar-field-color"), + this._convertToRGBA(win, navbarStyle, "--toolbar-field-color", { + fallbackProperty: chromeTextColorProperty, + currentColorProperty: chromeTextColorProperty, + }), urlbarBackgroundRGBA ); - /* Separator between the urlbar container #nav-bar and the tabbox. */ + // Separator between the urlbar container #nav-bar and the tabbox. + // For the default theme, this can be set to --border-color-card, which + // can use "currentColor". const tabboxStyle = win.getComputedStyle(win.gBrowser.tabbox); contentSeparatorRGBA = this._composeRGBA( this._convertToRGBA( win, tabboxStyle, - "--chrome-content-separator-color" + "--chrome-content-separator-color", + { currentColorProperty: chromeTextColorProperty } ), containerRGBA ); @@ -1114,8 +1162,8 @@ class _RFPHelper { contrastRatio ); urlbarBackgroundDark = bgColor.relativeLuminance < 0.5; - /* Very low contrast ratio. For reference the default light theme has - * a contrast ratio of ~1.1. */ + // Very low contrast ratio. For reference the default light theme has + // a contrast ratio of ~1.1. lowBackgroundOutlineContrast = contrastRatio < 1.05; } for (const { name, colorRGBA } of [ ===================================== 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); ===================================== tools/base_browser/l10n/combine-translation-versions.py ===================================== @@ -103,10 +103,11 @@ class BrowserBranch: self.name = branch_name self.prefix = version_match.group("prefix") - self.browser_version = version_match.group("browser") + browser_version_str = version_match.group("browser") + self.browser_version = float(browser_version_str) # Convert tor-browser to "Tor Browser", and similar. browser_name = self.prefix.replace("-", " ").title() - self.browser_version_name = f"{browser_name} {self.browser_version}" + self.browser_version_name = f"{browser_name} {browser_version_str}" self._is_head = is_head self._ref = "HEAD" if is_head else f"origin/{branch_name}" @@ -114,7 +115,7 @@ class BrowserBranch: firefox_nums = [int(n) for n in version_match.group("firefox").split(".")] if len(firefox_nums) == 2: firefox_nums.append(0) - browser_nums = [int(n) for n in self.browser_version.split(".")] + browser_nums = [int(n) for n in browser_version_str.split(".")] branch_number = int(version_match.group("number")) # Prioritise the firefox ESR version, then the browser version then the # branch number. @@ -127,25 +128,8 @@ class BrowserBranch: branch_number, ) - # Minor version for browser is only ever "0" or "5", so we can convert - # the version to an integer. - self._browser_int_version = int(2 * float(self.browser_version)) - self._file_paths: list[str] | None = None - def release_below(self, other: "BrowserBranch", num: int) -> bool: - """Determine whether another branch is within range of a previous - browser release. - - The browser versions are expected to increment by "0.5", and a previous - release branch's version is expected to be `num * 0.5` behind the - current one. - - :param other: The branch to compare. - :param num: The number of "0.5" releases behind to test with. - """ - return other._browser_int_version == self._browser_int_version - num - def __lt__(self, other: "BrowserBranch") -> bool: return self._ordered < other._ordered @@ -259,16 +243,14 @@ def get_stable_branch( # Stable can be one release version behind. # NOTE: In principle, when switching between versions there may be a # window of time where the development branch has not yet progressed - # to the next "0.5" release, so has the same browser version as the + # to the next ".0" release, so has the same browser version as the # stable branch. So we also allow for matching browser versions. # NOTE: # 1. The "Will be unused in" message will not make sense, but we do # not expect string differences in this scenario. # 2. We do not expect this scenario to last for long. - if not ( - compare_version.release_below(branch, 1) - or compare_version.release_below(branch, 0) - ): + release_diff = compare_version.browser_version - branch.browser_version + if release_diff < 0.0 or release_diff > 1.0: continue stable_branches.append(branch) elif is_legacy: ===================================== 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 ===================================== @@ -203,6 +203,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/-/compare/fb7... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/fb7... You're receiving this email because of your account on gitlab.torproject.org.
participants (1)
-
Pier Angelo Vendrame (@pierov)