DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (5b81998bb7ab)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
# 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/.

# Required Plugins:
# ShellLink   http://nsis.sourceforge.net/ShellLink_plug-in

; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
!verbose 3

; 7-Zip provides better compression than the lzma from NSIS so we add the files
; uncompressed and let the application installer compress it.
SetDatablockOptimize on
SetCompress off
CRCCheck on
SilentInstall silent

RequestExecutionLevel user

!addplugindir ./

; prevents compiling of the reg write logging.
!define NO_LOG

; Variables
Var AppFilename
Var AppName
Var AppRTTempDir

; Variables/macros used by common.nsh
Var TmpVal
!define FileMainEXE           "$AppFilename.exe"

; Other included files may depend upon these includes!
; The following includes are provided by NSIS.
!include "FileFunc.nsh"
!insertmacro GetParameters
!insertmacro un.RefreshShellIcons
!include "LogicLib.nsh"
!include "WinMessages.nsh"
!include "WinVer.nsh"
!include "WordFunc.nsh"

; File properties, version strings, etc
!define CompanyName           "Mozilla Corporation"
!define UninstallerName       "Mozilla Webapp Runtime App Uninstaller"
!define UninstallerFilename   "webapp-uninstaller.exe"
!define AppVersion            "@APP_VERSION@"
VIProductVersion "1.0.0.0"
VIAddVersionKey "ProductName"      "${UninstallerName}"
VIAddVersionKey "CompanyName"      "${CompanyName}"
VIAddVersionKey "LegalCopyright"   "${CompanyName}"
VIAddVersionKey "FileVersion"      "${AppVersion}"
VIAddVersionKey "ProductVersion"   "${AppVersion}"
VIAddVersionKey "FileDescription"  "${UninstallerName}"
VIAddVersionKey "OriginalFilename" "${UninstallerFilename}"

; Mozilla custom include
!include "common.nsh"
!insertmacro un.DeleteShortcuts
!insertmacro un.RegCleanUninstall
!insertmacro un.ParseUninstallLog

Name "Mozilla Web App Runtime App"
OutFile "${UninstallerFilename}"
ShowUnInstDetails nevershow

# Create a blank page so that the default pages (instfiles) don't appear
UninstPage custom un.blankPage

################################################################################
# Install Sections
# The "installer" that is generated by this file will be run during the build
# process to generate an uninstaller.  We call `WriteUninstaller` during
# `onInit` so this section is empty.
Section ""
SectionEnd

################################################################################
# This is where uninstallation happens
################################################################################
Function un.blankPage
  MessageBox MB_OKCANCEL "$(UN_CONFIRM_UNINSTALL)" /SD IDOK IDCANCEL done

  ; Delete the app exe to prevent launching the app while we are uninstalling.
  ClearErrors
  ${DeleteFile} "$INSTDIR\${FileMainEXE}"
  ${If} ${Errors}
    ; If the app is running, rename the EXE out of the way
    CreateDirectory "$AppRTTempDir"
    Rename "$INSTDIR\${FileMainEXE}" "$AppRTTempDir\${FileMainEXE}"
    ClearErrors
  ${EndIf}


  SetShellVarContext current  ; Set SHCTX to HKCU

  ; Remove our entry in the "Uninstall" key
  ${un.RegCleanUninstall}

  ; Remove our shortcuts from start menu, desktop, and taskbar
  ${un.DeleteShortcuts}

  ; Parse the uninstall log to remove all installed
  ; files / directories this install is responsible for.
  ${un.ParseUninstallLog}

  ; Remove the uninstall directory that we control
  RmDir /r "$INSTDIR\uninstall"

  ; Remove the installation directory if it is empty
  ${RemoveDir} "$INSTDIR"

  ; Refresh shell icons to reflect the changes we've made
  ${un.RefreshShellIcons}

  done:
FunctionEnd

################################################################################
# Language

!verbose push
!verbose 3
!include "webapp-uninstaller-locale.nsh"
!verbose pop

; Set this after the locale files to override it if it is in the locale. Using
; " " for BrandingText will hide the "Nullsoft Install System..." branding.
BrandingText " "

# Initialization Functions
Function .onInit
  GetTempFileName $0
  Delete "$0"
  CreateDirectory "$0"
  SetOutPath "$0"

  StrCpy $1 "$0\${UninstallerFilename}"
  WriteUninstaller "$1"

  ${GetParameters} $2
  StrCpy $2 "_?=$EXEDIR $2"
  Exec '"$1" $2'
  Quit
FunctionEnd

Function un.onInit
  StrCpy $LANGUAGE 0

  ${un.GetParent} "$INSTDIR" $INSTDIR
  ${un.GetLongPath} "$INSTDIR" $INSTDIR

  ReadINIStr $AppFilename "$INSTDIR\webapp.ini" "Webapp" "Executable"
  ReadINIStr $AppName "$INSTDIR\webapp.ini" "Webapp" "Name"

  ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
    Abort
  ${EndUnless}

  StrCpy $AppRTTempDir "$TEMP\moz_webapprt"
  RmDir /r "$AppRTTempDir"
FunctionEnd