Bug 986081 - Allow backing out of closing the stub installer. r=agashlin

Currently, clicking the close button or otherwise trying to exit the Windows
stub installer always ends up canceling the installation. This patch prompts
the user to either continue or cancel the installation.

MozReview-Commit-ID: 4KMgCcyjTnv

--HG--
extra : rebase_source : 0c0636c9c02fabd32df37471033d8e847caea5d3
This commit is contained in:
Matt Howell 2018-03-21 10:39:38 -07:00
Родитель a6e30881e3
Коммит 2a034bc30a
3 изменённых файлов: 130 добавлений и 18 удалений

Просмотреть файл

@ -549,14 +549,30 @@ Function .onUserAbort
${NSD_KillTimer} ClearBlurb
${If} "$IsDownloadFinished" != ""
Call DisplayDownloadError
; Go ahead and cancel the download so it doesn't keep running while this
; prompt is up. We'll resume it if the user decides to continue.
InetBgDL::Get /RESET /END
${ShowTaskDialog} $(STUB_CANCEL_PROMPT_HEADING) \
$(STUB_CANCEL_PROMPT_MESSAGE) \
$(STUB_CANCEL_PROMPT_BUTTON_CONTINUE) \
$(STUB_CANCEL_PROMPT_BUTTON_EXIT)
Pop $0
${If} $0 == 1002
; The cancel button was clicked
Call LaunchHelpPage
Call SendPing
${Else}
; Either the continue button was clicked or the dialog was dismissed
Call StartDownload
${EndIf}
${Else}
Call SendPing
${EndIf}
; Aborting the abort will allow SendPing which is called by
; DisplayDownloadError to hide the installer window and close the installer
; after it sends the metrics ping.
; Aborting the abort will allow SendPing to hide the installer window and
; close the installer after it sends the metrics ping, or allow us to just go
; back to installing if that's what the user selected.
Abort
FunctionEnd
@ -1685,24 +1701,25 @@ Function DisplayDownloadError
; value to the total value.
${ITBL3SetProgressValue} "100" "100"
${ITBL3SetProgressState} "${TBPF_ERROR}"
MessageBox MB_OKCANCEL|MB_ICONSTOP "$(ERROR_DOWNLOAD_CONT)" IDCANCEL +2 IDOK +1
StrCpy $OpenedDownloadPage "1" ; Already initialized to 0
${If} "$OpenedDownloadPage" == "1"
ClearErrors
${GetParameters} $0
${GetOptions} "$0" "/UAC:" $1
${If} ${Errors}
Call OpenManualDownloadURL
${Else}
GetFunctionAddress $0 OpenManualDownloadURL
UAC::ExecCodeSegment $0
${EndIf}
${EndIf}
Call LaunchHelpPage
Call SendPing
FunctionEnd
Function LaunchHelpPage
StrCpy $OpenedDownloadPage "1" ; Already initialized to 0
ClearErrors
${GetParameters} $0
${GetOptions} "$0" "/UAC:" $1
${If} ${Errors}
Call OpenManualDownloadURL
${Else}
GetFunctionAddress $0 OpenManualDownloadURL
UAC::ExecCodeSegment $0
${EndIf}
FunctionEnd
Function OpenManualDownloadURL
ExecShell "open" "${URLManualDownload}${URLManualDownloadAppend}"
FunctionEnd

Просмотреть файл

@ -43,5 +43,10 @@ WARN_MANUALLY_CLOSE_APP_LAUNCH=$BrandShortName is already running.\n\nPlease clo
ERROR_DOWNLOAD_CONT=Hmm. For some reason, we could not install $BrandShortName.\nChoose OK to start over.
STUB_CANCEL_PROMPT_HEADING=Do you want to install $BrandShortName?
STUB_CANCEL_PROMPT_MESSAGE=If you cancel, $BrandShortName will not be installed.
STUB_CANCEL_PROMPT_BUTTON_CONTINUE=Install $BrandShortName
STUB_CANCEL_PROMPT_BUTTON_EXIT=Cancel
VERSION_32BIT=32-bit $BrandShortName
VERSION_64BIT=64-bit $BrandShortName

Просмотреть файл

@ -7528,6 +7528,96 @@
!macroend
!define SetStretchedImageOLE "!insertmacro __SetStretchedImageOLE"
/**
* Display a task dialog box with custom strings and button labels.
*
* The task dialog is highly customizable. The specific style being used here
* is similar to a MessageBox except that the button text is customizable.
* MessageBox-style buttons are used instead of command link buttons; this can
* be made configurable if command buttons are needed.
*
* See https://msdn.microsoft.com/en-us/library/windows/desktop/bb760544.aspx
* for the TaskDialogIndirect function's documentation, and links to definitions
* of the TASKDIALOGCONFIG and TASKDIALOG_BUTTON structures it uses.
*
* @param INSTRUCTION Dialog header string; use empty string if unneeded
* @param CONTENT Secondary message string; use empty string if unneeded
* @param BUTTON1 Text for the first button, the one selected by default
* @param BUTTON2 Text for the second button
*
* @return One of the following values will be left on the stack:
* 1001 if the first button was clicked
* 1002 if the second button was clicked
* 2 (IDCANCEL) if the dialog was closed
* 0 on error
*/
!macro _ShowTaskDialog INSTRUCTION CONTENT BUTTON1 BUTTON2
!ifndef SIZEOF_TASKDIALOGCONFIG_32BIT
!define SIZEOF_TASKDIALOGCONFIG_32BIT 96
!endif
!ifndef TDF_ALLOW_DIALOG_CANCELLATION
!define TDF_ALLOW_DIALOG_CANCELLATION 0x0008
!endif
!ifndef TDF_RTL_LAYOUT
!define TDF_RTL_LAYOUT 0x02000
!endif
!ifndef TD_WARNING_ICON
!define TD_WARNING_ICON 0x0FFFF
!endif
Push $0 ; return value
Push $1 ; TASKDIALOGCONFIG struct
Push $2 ; TASKDIALOG_BUTTON array
Push $3 ; dwFlags member of the TASKDIALOGCONFIG
StrCpy $3 ${TDF_ALLOW_DIALOG_CANCELLATION}
!ifdef ${AB_CD}_rtl
IntOp $3 $3 | ${TDF_RTL_LAYOUT}
!endif
; Build an array of two TASKDIALOG_BUTTON structs
System::Call "*(i 1001, \
w '${BUTTON1}', \
i 1002, \
w '${BUTTON2}' \
) p.r2"
; Build a TASKDIALOGCONFIG struct
System::Call "*(i ${SIZEOF_TASKDIALOGCONFIG_32BIT}, \
p $HWNDPARENT, \
p 0, \
i $3, \
i 0, \
w '$(INSTALLER_WIN_CAPTION)', \
p ${TD_WARNING_ICON}, \
w '${INSTRUCTION}', \
w '${CONTENT}', \
i 2, \
p r2, \
i 1001, \
i 0, \
p 0, \
i 0, \
p 0, \
p 0, \
p 0, \
p 0, \
p 0, \
p 0, \
p 0, \
p 0, \
i 0 \
) p.r1"
System::Call "comctl32::TaskDialogIndirect(p r1, *i 0 r0, p 0, p 0)"
System::Free $1
System::Free $2
Pop $3
Pop $2
Pop $1
Exch $0
!macroend
!define ShowTaskDialog "!insertmacro _ShowTaskDialog"
/**
* Removes a single style from a control.
*