[tbb-commits] [Git][tpo/applications/tor-browser-build][main] Bug 41089: Register file types in the Mullvad Browser installer.
Pier Angelo Vendrame (@pierov)
git at gitlab.torproject.org
Wed Mar 6 18:17:11 UTC 2024
Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
e764744f by Pier Angelo Vendrame at 2024-03-04T11:24:56+01:00
Bug 41089: Register file types in the Mullvad Browser installer.
This step is needed to set Mullvad Browser as a default browser.
Also, we use the same way as Firefox to identify different installs
uniquely based on the hash of their installation directory.
Therefore, we need to build the CityHash NSIS plugin on Firefox and
consume it in browser.
We do the same for the ApplicationID plugin.
- - - - -
7 changed files:
- projects/browser/build
- projects/browser/config
- projects/browser/windows-installer/browser-install.nsi
- projects/browser/windows-installer/defines.nsh.in
- projects/browser/windows-installer/postupdate.nsi
- projects/browser/windows-installer/registry.nsh
- projects/firefox/build
Changes:
=====================================
projects/browser/build
=====================================
@@ -320,6 +320,7 @@ done
[% IF c('var/mullvad-browser') -%]
pushd $distdir/windows-installer
+ tar -xf $rootdir/[% c('input_files_by_name/firefox') %]/nsis-plugins.tar.[% c("compress_tar") %]
# While Firefox re-uses the uninstaller for this, we cannot do it, because
# we write the uninstaller from the installer.
# Instead, we need to write an updated postupdate.exe also when updating.
=====================================
projects/browser/config
=====================================
@@ -124,6 +124,7 @@ input_files:
- filename: 'defines.nsh'
content: '[% INCLUDE "windows-installer/defines.nsh.in" %]'
refresh_input: 1
+ enable: '[% c("var/windows") %]'
- filename: pe_checksum_fix.py
enable: '[% c("var/windows") %]'
# To generate a new keystore, see how-to-generate-keystore.txt
=====================================
projects/browser/windows-installer/browser-install.nsi
=====================================
@@ -1,5 +1,7 @@
+ !addplugindir nsis-plugins
!include "common.nsh"
!include "registry.nsh"
+ !include "Win\COM.nsh"
;--------------------------------
OutFile "browser-install.exe"
@@ -219,7 +221,7 @@ Section "Browser" SecBrowser
; Write the uninstaller
WriteUninstaller $INSTDIR\uninstall.exe
- !insertmacro UPDATE_REGISTRY
+ Call UpdateRegistry
CreateShortCut "$SMPROGRAMS\${DISPLAY_NAME}.lnk" "$INSTDIR\${EXE_NAME}"
${If} $createDesktopShortcut == "true"
@@ -238,24 +240,57 @@ FunctionEnd
;--------------------------------
; Uninstaller
+
+Function un.GetPathFromString
+ !insertmacro GetPathFromStringImp
+FunctionEnd
+
Section "Uninstall"
+ ; Currently, the uninstaller is written by the installer, only in install
+ ; mode, and we do not have any way to update it.
+ ; However, we keep postupdate.exe updated, so we can use that instead.
+ ExecWait '"$INSTDIR\postupdate.exe" /Uninstall' $0
+
RMDir /r "$INSTDIR"
DeleteRegKey HKCU "${UNINST_KEY}"
- StrCpy $0 ""
- ShellLink::GetShortCutTarget "$SMPROGRAMS\${DISPLAY_NAME}.lnk"
- Pop $0
- ${If} $0 == "$INSTDIR\${EXE_NAME}"
- Delete "$SMPROGRAMS\${DISPLAY_NAME}.lnk"
- ${EndIf}
+ StrCpy $2 "$SMPROGRAMS\${DISPLAY_NAME}.lnk"
+ StrCpy $3 ""
+ ShellLink::GetShortCutTarget "$2"
+ Pop $3
+ ${If} $3 == "$INSTDIR\${EXE_NAME}"
+ ; https://stackoverflow.com/questions/42816091/nsis-remove-pinned-icon-from-taskbar-on-uninstall
+ !insertmacro ComHlpr_CreateInProcInstance ${CLSID_StartMenuPin} ${IID_IStartMenuPinnedList} r0 ""
+ ${If} $0 P<> 0
+ System::Call 'SHELL32::SHCreateItemFromParsingName(ws, p0, g "${IID_IShellItem}", *p0r1)' "$2"
+ ${If} $1 P<> 0
+ ${IStartMenuPinnedList::RemoveFromList} $0 '(r1)'
+ ${IUnknown::Release} $1 ""
+ ${EndIf}
+ ${IUnknown::Release} $0 ""
+ ${EndIf}
- StrCpy $0 ""
- ShellLink::GetShortCutTarget "$DESKTOP\${DISPLAY_NAME}.lnk"
- Pop $0
- ${If} $0 == "$INSTDIR\${EXE_NAME}"
- Delete "$DESKTOP\${DISPLAY_NAME}.lnk"
+ Delete "$2"
${EndIf}
+ FindFirst $1 $2 "$DESKTOP\*.lnk"
+ loop:
+ IfErrors end
+ StrCpy $0 ""
+ ShellLink::GetShortCutTarget "$DESKTOP\$2"
+ ; Do not pop, and pass the value over
+ Call un.GetPathFromString
+ Pop $0
+ ${If} $0 == "$INSTDIR\${EXE_NAME}"
+ Delete "$DESKTOP\$2"
+ ${EndIf}
+ FindNext $1 $2
+ goto loop
+ end:
+ FindClose $1
+
+ ${RefreshShellIcons}
+
; TODO: Optionally remove profiles.
; This operation is not trivial, because it involes finding our installation
; hash, its associated default profile and making sure it is not shared with
=====================================
projects/browser/windows-installer/defines.nsh.in
=====================================
@@ -5,13 +5,7 @@
; Project and display name
!define PROJECT_NAME "[% c('var/Project_Name') %]"
-[% IF c("var/channel") == "release" -%]
- !define DISPLAY_NAME "[% c('var/Project_Name') %]"
-[% ELSIF c("var/testbuild") -%]
- !define DISPLAY_NAME "[% c('var/Project_Name') %] Testbuild"
-[% ELSE -%]
- !define DISPLAY_NAME "[% c('var/Project_Name_Channel') %]"
-[% END -%]
+ !define DISPLAY_NAME "[% c('var/display_name') %]"
!define NAME_NO_SPACES "[% c('var/ProjectName') %]"
!define UPDATE_CHANNEL "[% c('var/channel') FILTER ucfirst %]"
=====================================
projects/browser/windows-installer/postupdate.nsi
=====================================
@@ -1,3 +1,4 @@
+!addplugindir nsis-plugins
!include "FileFunc.nsh"
!include "LogicLib.nsh"
@@ -9,9 +10,14 @@ Icon "${ICON_NAME}"
RequestExecutionLevel user
Function .onInit
+ StrCpy $INSTDIR $EXEDIR
+
${GetOptions} $CMDLINE "/Visible" $0
IfErrors 0 +2
SetSilent silent
+ ${GetOptions} $CMDLINE "/Uninstall" $0
+ IfErrors +2 0
+ Call Uninstall
FunctionEnd
Section PostUpdate "PostUpdate"
@@ -19,10 +25,14 @@ Section PostUpdate "PostUpdate"
IfFileExists $EXEDIR\system-install 0 +2
StrCpy $0 "true"
${If} $0 == "true"
- StrCpy $INSTDIR $EXEDIR
- !insertmacro UPDATE_REGISTRY
+ Call UpdateRegistry
RMDir /r /REBOOTOK $EXEDIR\tobedeleted
${Else}
RMDir /r $EXEDIR\tobedeleted
${EndIf}
SectionEnd
+
+Function Uninstall
+ Call ClearRegistry
+ Quit
+FunctionEnd
=====================================
projects/browser/windows-installer/registry.nsh
=====================================
@@ -1,6 +1,39 @@
+; Utilities to update the registry values in installs.
+; Based on Firefox's NSIS scripts.
+;
+; This Source Code Form is subject to the terms of the Mozilla Public
+; License, v. 2.0. If a copy of the MPL was not distributed with this
+; file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NAME_NO_SPACES}${UPDATE_CHANNEL}"
-!macro UPDATE_REGISTRY
+; The only "public" functions of this file are UpdateRegistry and ClearRegistry.
+
+var aumid
+
+; Compute the AUMID we will use for our links.
+; We use the same strategy as Firefox: we hash the path of the installation
+; directory with CityHash64.
+; See InitHashAppModelId in toolkit/mozapps/installer/windows/nsis/common.nsh.
+; While we could differentiate between channels (we force one install for each
+; channel), following Firefox has the advantage that we have to adapt/rework
+; less stuff.
+Function ComputeAumid
+ StrCpy $0 $INSTDIR
+ ; NSIS command will not convert from short form to the long one.
+ ; So, this is the way they suggest to get the long name in their docs.
+ System::Call 'kernel32::GetLongPathName(t r0, t .r1, i ${NSIS_MAX_STRLEN}) i .r2'
+ ${If} $2 != "error"
+ CityHash::GetCityHash64 $1
+ Pop $aumid
+ ${Else}
+ StrCpy $aumid "error"
+ ${EndIf}
+FunctionEnd
+
+; Set the installation details.
+; See https://nsis.sourceforge.io/Add_uninstall_information_to_Add/Remove_Programs.
+Function SetUninstallData
WriteRegStr HKCU "${UNINST_KEY}" "DisplayName" "${DISPLAY_NAME}"
WriteRegStr HKCU "${UNINST_KEY}" "DisplayIcon" "$\"$INSTDIR\${EXE_NAME}$\""
WriteRegStr HKCU "${UNINST_KEY}" "DisplayVersion" "${VERSION}"
@@ -16,4 +49,332 @@
WriteRegStr HKCU "${UNINST_KEY}" "URLInfoAbout" "${URL_ABOUT}"
WriteRegStr HKCU "${UNINST_KEY}" "URLUpdateInfo" "${URL_UPDATE}"
WriteRegStr HKCU "${UNINST_KEY}" "HelpLink" "${URL_HELP}"
+FunctionEnd
+
+; Register a certain class in the form $browserName$className-$aumid.
+; The classes registered by Firefox are URL, HTML and PDF.
+; The default browser agent checks them before registering anything.
+; See SetDefaultBrowserUserChoice in
+; toolkit/mozapps/defaultagent/SetDefaultBrowser.cpp, FormatProgID and
+; CheckProgIDExists in browser/components/shell/WindowsUserChoice.cpp.
+; See also AddHandlerValues in
+; toolkit/mozapps/installer/windows/nsis/common.nsh.
+Function RegisterClass
+ ; Based on Firefox's AddHandlerValues
+ Pop $3 ; Is this a protocol?
+ Pop $2 ; Icon index
+ Pop $1 ; Description
+ Pop $0 ; Class name
+
+ StrCpy $R0 "${NAME_NO_SPACES}$0-$aumid" ; Expanded class name
+ StrCpy $R1 "${PROJECT_NAME} $1" ; Description with project name
+ StrCpy $R2 "$INSTDIR\${EXE_NAME}" ; Full path to the main executable
+ StrCpy $R3 "Software\Classes\$R0" ; Registry key to update
+
+ WriteRegStr HKCU $R3 "" "$R1"
+ WriteRegStr HKCU $R3 "FriendlyTypeName" "$R1"
+ ${If} $3 == "true"
+ WriteRegStr HKCU $R3 "URL Protocol" ""
+ ${EndIf}
+ ; Firefox sets EditFlags only when empty
+ ReadRegDWORD $R4 HKCU $R3 "EditFlags"
+ ${If} $R4 == ""
+ WriteRegDWORD HKCU $R3 "EditFlags" 0x00000002
+ ${EndIf}
+ WriteRegStr HKCU "$R3\DefaultIcon" "" "$R2,$2"
+ WriteRegStr HKCU "$R3\shell" "" "open"
+ WriteRegStr HKCU "$R3\shell\open\command" "" '"$R2" -osint -url "%1"'
+FunctionEnd
+
+; Register all the classes we need to handle.
+; See RegisterClass.
+Function RegisterClasses
+ Push "URL"
+ Push "URL"
+ Push 1
+ Push true
+ Call RegisterClass
+
+ Push "HTML"
+ Push "HTML Document"
+ Push 1
+ Push false
+ Call RegisterClass
+
+ Push "PDF"
+ Push "PDF Document"
+ Push 5
+ Push false
+ Call RegisterClass
+FunctionEnd
+
+; Register the start menu entry.
+; Microsoft's documentation says this is deprecated after Windows 8, however
+; these entries are still visible in the settings application.
+; See the SetStartMenuInternet macro in
+; browser/installer/windows/nsis/shared.nsh.
+; We do not add entries for features we do not support, such as the safe mode.
+; Also, the functionality to hide/show shortcuts should not apply to Windows 10,
+; so we did not implement that as well.
+Function RegisterStartMenu
+ StrCpy $0 "Software\Clients\StartMenuInternet\${NAME_NO_SPACES}-$aumid"
+ StrCpy $1 "$INSTDIR\${EXE_NAME}"
+ StrCpy $2 "${NAME_NO_SPACES}-$aumid"
+ StrCpy $3 "${NAME_NO_SPACES}URL-$aumid"
+ StrCpy $4 "${NAME_NO_SPACES}HTML-$aumid"
+ StrCpy $5 "${NAME_NO_SPACES}PDF-$aumid"
+
+ WriteRegStr HKCU "$0" "" "${DISPLAY_NAME}"
+ WriteRegStr HKCU "$0\DefaultItcon" "" "$1,0"
+ WriteRegStr HKCU "$0\shell\open\command" "" '"$1"'
+ WriteRegStr HKCU "$0\Capabilities\StartMenu" "StartMenuInternet" "$2"
+ ; Same as Firefox, see SetStartMenuInternet
+ ; URLs
+ WriteRegStr HKCU "$0\Capabilities\URLAssociations" "http" "$3"
+ WriteRegStr HKCU "$0\Capabilities\URLAssociations" "https" "$3"
+ ; mailto is currently unsupported, but we could enable it here, if needed.
+ ; WriteRegStr HKCU "$0\Capabilities\URLAssociations" "mailto" "$3"
+ ; No need to uninstall FTP here, since we had never installed it.
+ ; HTML + aumid
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".htm" "$4"
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".html" "$4"
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".shtml" "$4"
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".xht" "$4"
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".xhtml" "$4"
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".svg" "$4"
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".webp" "$4"
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".avif" "$4"
+ ; PDF + aumid
+ WriteRegStr HKCU "$0\Capabilities\FileAssociations" ".pdf" "$5"
+
+ WriteRegStr HKCU "Software\RegisteredApplications" "$2" "$0\Capabilities"
+FunctionEnd
+
+; Copied from toolkit/mozapps/installer/windows/nsis/common.nsh.
+; Implemented as a macro first so that we can use it both in the installer (to
+; update the registry) and in the uninstaller (to check which links we have to
+; remove). The macro is then expanded in an installer function, and in an
+; uninstaller function, to avoid multiple copies of the same code.
+!macro GetPathFromStringImp
+ Exch $R9
+ Push $R8
+ Push $R7
+
+ StrCpy $R7 0 ; Set the counter to 0.
+
+ ; Handle quoted paths with arguments.
+ StrCpy $R8 $R9 1 ; Copy the first char.
+ StrCmp $R8 '"' +2 +1 ; Is it a "?
+ StrCmp $R8 "'" +1 +9 ; Is it a '?
+ StrCpy $R9 $R9 "" 1 ; Remove the first char.
+ IntOp $R7 $R7 + 1 ; Increment the counter.
+ StrCpy $R8 $R9 1 $R7 ; Starting from the counter copy the next char.
+ StrCmp $R8 "" end +1 ; Are there no more chars?
+ StrCmp $R8 '"' +2 +1 ; Is it a " char?
+ StrCmp $R8 "'" +1 -4 ; Is it a ' char?
+ StrCpy $R9 $R9 $R7 ; Copy chars up to the counter.
+ GoTo end
+
+ ; Handle DefaultIcon paths. DefaultIcon paths are not quoted and end with
+ ; a , and a number.
+ IntOp $R7 $R7 - 1 ; Decrement the counter.
+ StrCpy $R8 $R9 1 $R7 ; Copy one char from the end minus the counter.
+ StrCmp $R8 '' +4 +1 ; Are there no more chars?
+ StrCmp $R8 ',' +1 -3 ; Is it a , char?
+ StrCpy $R9 $R9 $R7 ; Copy chars up to the end minus the counter.
+ GoTo end
+
+ ; Handle unquoted paths with arguments. An unquoted path with arguments
+ ; must be an 8dot3 path.
+ StrCpy $R7 -1 ; Set the counter to -1 so it will start at 0.
+ IntOp $R7 $R7 + 1 ; Increment the counter.
+ StrCpy $R8 $R9 1 $R7 ; Starting from the counter copy the next char.
+ StrCmp $R8 "" end +1 ; Are there no more chars?
+ StrCmp $R8 " " +1 -3 ; Is it a space char?
+ StrCpy $R9 $R9 $R7 ; Copy chars up to the counter.
+
+ end:
+ ClearErrors
+
+ Pop $R7
+ Pop $R8
+ Exch $R9
!macroend
+
+Function GetPathFromString
+ !insertmacro GetPathFromStringImp
+FunctionEnd
+
+; Create a Software\Classes\Applications\$exeName.exe entry, shared by all the
+; installs.
+; If this key has already been registered by another channel/install, we just
+; make sure the open entry has the expected command line flags.
+; See SetStartMenuInternet in browser/installer/windows/nsis/shared.nsh.
+Function RegisterTypes
+ StrCpy $0 "Software\Classes\Applications\${EXE_NAME}"
+ StrCpy $1 "$0\shell\open\command"
+ StrCpy $2 "$0\SupportedTypes"
+
+ ReadRegStr $3 HKCU "$1" ""
+ ${If} $3 != ""
+ ; If the user already has something, we just update it to make sure it
+ ; contains the -osint flag. This should not be a problem if we created these
+ ; entries, but we still check them in case they were added manually.
+ Push $3
+ Call GetPathFromString
+ Pop $3
+ WriteRegStr HKCU "$1" "" '"$3" -osint -url "%1"'
+ ${Else}
+ WriteRegStr HKCU "$1" "" '"$INSTDIR\${EXE_NAME}" -osint -url "%1"'
+ WriteRegStr HKCU "$0\DefaultIcon" "" "$INSTDIR\${EXE_NAME},1"
+
+ ; Same as Firefox, see SetStartMenuInternet
+ WriteRegStr HKCU "$2" ".apng" ""
+ WriteRegStr HKCU "$2" ".bmp" ""
+ WriteRegStr HKCU "$2" ".flac" ""
+ WriteRegStr HKCU "$2" ".gif" ""
+ WriteRegStr HKCU "$2" ".htm" ""
+ WriteRegStr HKCU "$2" ".html" ""
+ WriteRegStr HKCU "$2" ".ico" ""
+ WriteRegStr HKCU "$2" ".jfif" ""
+ WriteRegStr HKCU "$2" ".jpeg" ""
+ WriteRegStr HKCU "$2" ".jpg" ""
+ WriteRegStr HKCU "$2" ".json" ""
+ WriteRegStr HKCU "$2" ".m4a" ""
+ WriteRegStr HKCU "$2" ".mp3" ""
+ WriteRegStr HKCU "$2" ".oga" ""
+ WriteRegStr HKCU "$2" ".ogg" ""
+ WriteRegStr HKCU "$2" ".ogv" ""
+ WriteRegStr HKCU "$2" ".opus" ""
+ WriteRegStr HKCU "$2" ".pdf" ""
+ WriteRegStr HKCU "$2" ".pjpeg" ""
+ WriteRegStr HKCU "$2" ".pjp" ""
+ WriteRegStr HKCU "$2" ".png" ""
+ WriteRegStr HKCU "$2" ".rdf" ""
+ WriteRegStr HKCU "$2" ".shtml" ""
+ WriteRegStr HKCU "$2" ".svg" ""
+ WriteRegStr HKCU "$2" ".webm" ""
+ WriteRegStr HKCU "$2" ".avif" ""
+ WriteRegStr HKCU "$2" ".xht" ""
+ WriteRegStr HKCU "$2" ".xhtml" ""
+ WriteRegStr HKCU "$2" ".xml" ""
+ ${EndIf}
+FunctionEnd
+
+; Set the AUMID to all links pointing to our exe in a certain directory.
+; See RegisterAumid.
+Function RegisterAumidDirectory
+ Pop $0
+ FindFirst $1 $2 "$0\*.lnk"
+ loop:
+ IfErrors end
+ ShellLink::GetShortCutTarget "$0\$2"
+ ; Do not pop, and pass the value over
+ Call GetPathFromString
+ Pop $3
+ ${If} $3 == "$INSTDIR\${EXE_NAME}"
+ ApplicationID::Set "$0\$2" "$aumid" "true"
+ ${EndIf}
+ FindNext $1 $2
+ goto loop
+ end:
+ FindClose $1
+FunctionEnd
+
+; Firefox expects the installer to write its AUMID in the registry.
+; It is hardcoded to use Software\Mozilla\Firefox\TaskBarIDs, but we change it
+; in widget/windows/WinTaskbar.cpp in one of our patches.
+; See InitHashAppModelId in toolkit/mozapps/installer/windows/nsis/common.nsh.
+;
+; In addition to that, we need to associate the AUMID to every link as per
+; specifications:
+; https://learn.microsoft.com/en-us/windows/win32/shell/appids#application-defined-and-system-defined-appusermodelids
+Function RegisterAumid
+ StrCpy $0 "Software\${APP_DIR}\${PROJECT_NAME}\TaskBarIDs"
+ WriteRegStr HKCU "$0" "$INSTDIR" "$aumid"
+
+ Push $DESKTOP
+ Call RegisterAumidDirectory
+ Push "$QUICKLAUNCH\User Pinned\TaskBar"
+ Call RegisterAumidDirectory
+ Push "$QUICKLAUNCH\User Pinned\StartMenu"
+ Call RegisterAumidDirectory
+FunctionEnd
+
+; Sets all the needed registry keys during an install, or run all the needed
+; maintenance in the post update.
+Function UpdateRegistry
+ Call SetUninstallData
+ Call ComputeAumid
+ ${If} $aumid != "error"
+ Call RegisterClasses
+ Call RegisterStartMenu
+ Call RegisterTypes
+ Call RegisterAumid
+ ${EndIf}
+FunctionEnd
+
+;--------------------------------
+; Uninstall helper
+; We do not ship an uninstaller in the updates.
+; However, to be able to undo changes done during the post update step, we call
+; `postupdate.exe` with the `/Uninstall`. They are implemented here.
+; `postupdate.exe` always runs as it was an installer, which is the reason for
+; which the following functions do not have the `un.` prefix.
+; However, they have an `Un` suffix, and each `Un$function` function undoes the
+; changes done by the corresponding `$function` function.
+
+Function UnregisterClass
+ Pop $0 ; Class name
+ StrCpy $1 "${NAME_NO_SPACES}$0-$aumid" ; Expanded class name
+ DeleteRegKey HKCU "Software\Classes\$1"
+FunctionEnd
+
+Function UnregisterClasses
+ Push "URL"
+ Call UnregisterClass
+ Push "HTML"
+ Call UnregisterClass
+ Push "PDF"
+ Call UnregisterClass
+FunctionEnd
+
+Function UnregisterStartMenu
+ DeleteRegValue HKCU "Software\RegisteredApplications" "${NAME_NO_SPACES}-$aumid"
+ DeleteRegKey HKCU "Software\Clients\StartMenuInternet\${NAME_NO_SPACES}-$aumid"
+FunctionEnd
+
+Function UnregisterTypes
+ StrCpy $0 "Software\Classes\Applications\${EXE_NAME}"
+ StrCpy $1 "$0\shell\open\command"
+ ReadRegStr $2 HKCU "$1" ""
+ ${If} $2 != ""
+ Push $2
+ Call GetPathFromString
+ Pop $3
+ ; Do not do anything if we are not the installation that created the keys.
+ ${If} $3 == "$INSTDIR\${EXE_NAME}"
+ DeleteRegKey HKCU "$0"
+ ${EndIf}
+ ${EndIf}
+FunctionEnd
+
+Function UnregisterAumid
+ DeleteRegValue HKCU "Software\${APP_DIR}\${PROJECT_NAME}\TaskBarIDs" "$INSTDIR"
+ ; No need to do anything on the links, as they will be deleted.
+FunctionEnd
+
+; Remove all the registry changes we have done.
+Function ClearRegistry
+ Call ComputeAumid
+ ${If} $aumid != "error"
+ ; We take for granted we do not have conflicting aumids.
+ Call UnregisterClasses
+ Call UnregisterStartMenu
+ Call UnregisterAumid
+ ${EndIf}
+ ; The types do not depend on the AUMID. So, even though we add them only
+ ; when we have an AUMID (they would be useless otherwise), we always check if
+ ; we should remove them.
+ Call UnregisterTypes
+FunctionEnd
=====================================
projects/firefox/build
=====================================
@@ -6,7 +6,8 @@
}) %]
distdir=/var/tmp/dist/[% project %]
mkdir -p /var/tmp/build
-mkdir -p [% dest_dir _ '/' _ c('filename') %]
+[% SET out_dir = dest_dir _ '/' _ c('filename') -%]
+mkdir -p [% out_dir %]
[% IF c("var/windows") -%]
# Setting up fxc2
@@ -276,6 +277,20 @@ cp -L obj-*/dist/bin/geckodriver* $distdir
[% END -%]
[% END -%]
+[% IF c("var/mullvad-browser") && c("var/windows") -%]
+ function make_nsis_plugin {
+ pushd "other-licenses/nsis/Contrib/$1"
+ make CXX=[% c("arch") %]-w64-mingw32-clang++
+ cp "$1.dll" $distdir/nsis-plugins/
+ [% c("touch") %] "$distdir/nsis-plugins/$1.dll"
+ popd
+ }
+
+ mkdir -p $distdir/nsis-plugins
+ make_nsis_plugin ApplicationID
+ make_nsis_plugin CityHash
+[% END -%]
+
cd $distdir
[% IF c("var/linux") -%]
@@ -328,7 +343,7 @@ echo "Starting to package artifacts $(date)"
[% c('tar', {
tar_src => [ browserdir ],
- tar_args => '-caf ' _ dest_dir _ '/' _ c('filename') _ '/browser.tar.' _ c('compress_tar'),
+ tar_args => '-caf ' _ out_dir _ '/browser.tar.' _ c('compress_tar'),
}) %]
# Debug symbols
@@ -339,13 +354,13 @@ echo "Starting to package artifacts $(date)"
mv include [% c('var/project-name') %]/
[% c('tar', {
tar_src => [ c('var/project-name') ],
- tar_args => '-cJf ' _ dest_dir _ '/' _ c('filename') _ '/browser-debug-symbols.tar.xz',
+ tar_args => '-cJf ' _ out_dir _ '/browser-debug-symbols.tar.xz',
}) %]
popd
[% ELSIF c("var/windows") -%]
[% c('zip', {
zip_src => [ 'Debug' ],
- zip_args => dest_dir _ '/' _ c('filename') _ '/browser-debug-symbols.zip',
+ zip_args => out_dir _ '/browser-debug-symbols.zip',
}) %]
[% END -%]
@@ -354,12 +369,12 @@ llvm-strip geckodriver*
[% IF c("var/windows") -%]
[% c('zip', {
zip_src => [ 'geckodriver.exe' ],
- zip_args => dest_dir _ '/' _ c('filename') _ '/geckodriver.zip',
+ zip_args => out_dir _ '/geckodriver.zip',
}) %]
[% ELSE -%]
[% c('tar', {
tar_src => [ 'geckodriver' ],
- tar_args => '-cJf ' _ dest_dir _ '/' _ c('filename') _ '/geckodriver.tar.xz',
+ tar_args => '-cJf ' _ out_dir _ '/geckodriver.tar.xz',
}) %]
[% END -%]
@@ -367,12 +382,19 @@ llvm-strip geckodriver*
[% IF c("var/updater_enabled") -%]
[% c('zip', {
zip_src => [ 'mar-tools' ],
- zip_args => dest_dir _ '/' _ c('filename') _ '/' _ 'mar-tools-' _ c("var/osname") _ '-' _ c("var/torbrowser_version") _ '.zip',
+ zip_args => out_dir _ '/' _ 'mar-tools-' _ c("var/osname") _ '-' _ c("var/torbrowser_version") _ '.zip',
+ }) %]
+[% END -%]
+
+[% IF c("var/mullvad-browser") && c("var/windows") -%]
+ [% c('tar', {
+ tar_src => [ 'nsis-plugins' ],
+ tar_args => '-caf ' _ out_dir _ '/nsis-plugins.tar.' _ c('compress_tar'),
}) %]
[% END -%]
[% IF c("var/build_infos_json") -%]
- cat > "[% dest_dir _ '/' _ c('filename') _ '/build-infos.json' %]" << EOF_BUILDINFOS
+ cat > "[% out_dir _ '/build-infos.json' %]" << EOF_BUILDINFOS
{
"firefox_platform_version" : "[% c("var/firefox_platform_version") %]",
"firefox_buildid" : "$MOZ_BUILD_DATE"
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/e764744fc18762d79ab49b81c36233d337ef5f3e
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/e764744fc18762d79ab49b81c36233d337ef5f3e
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/2ef8e3e8/attachment-0001.htm>
More information about the tbb-commits
mailing list