Bug 1343938 - Fix new installs erroneously not prompting to change the default browser setting. r?agashlin draft
authorMatt Howell <mhowell@mozilla.com>
Thu, 02 Mar 2017 10:55:24 -0800
changeset 492259 c23954d629568aba42daa2b57b848027fd16ef5b
parent 492009 d29f84406483c721a13cf9a52936ecced0c5c98a
child 547699 8bc5c4c4fa9485a1661beef5f1a2933a2b179935
push id47581
push usermhowell@mozilla.com
push dateThu, 02 Mar 2017 23:59:53 +0000
reviewersagashlin
bugs1343938
milestone54.0a1
Bug 1343938 - Fix new installs erroneously not prompting to change the default browser setting. r?agashlin MozReview-Commit-ID: EYPeEOE8Ldr
browser/installer/windows/nsis/installer.nsi
--- a/browser/installer/windows/nsis/installer.nsi
+++ b/browser/installer/windows/nsis/installer.nsi
@@ -551,16 +551,17 @@ SectionEnd
 
 ; Cleanup operations to perform at the end of the installation.
 Section "-InstallEndCleanup"
   SetDetailsPrint both
   DetailPrint "$(STATUS_CLEANUP)"
   SetDetailsPrint none
 
   ${Unless} ${Silent}
+    ClearErrors
     ${MUI_INSTALLOPTIONS_READ} $0 "summary.ini" "Field 4" "State"
     ${If} "$0" == "1"
       ; NB: this code is duplicated in stub.nsi. Please keep in sync.
       ; For data migration in the app, we want to know what the default browser
       ; value was before we changed it. To do so, we read it here and store it
       ; in our own registry key.
       StrCpy $0 ""
       AppAssocReg::QueryCurrentDefault "http" "protocol" "effective"
@@ -587,17 +588,17 @@ Section "-InstallEndCleanup"
       ${GetParameters} $0
       ${GetOptions} "$0" "/UAC:" $0
       ${If} ${Errors}
         Call SetAsDefaultAppUserHKCU
       ${Else}
         GetFunctionAddress $0 SetAsDefaultAppUserHKCU
         UAC::ExecCodeSegment $0
       ${EndIf}
-    ${Else}
+    ${ElseIfNot} ${Errors}
       ${LogHeader} "Writing default-browser opt-out"
       ClearErrors
       WriteRegStr HKCU "Software\Mozilla\Firefox" "DefaultBrowserOptOut" "True"
       ${If} ${Errors}
         ${LogMsg} "Error writing default-browser opt-out"
       ${EndIf}
     ${EndIf}
   ${EndUnless}