From 9f87515fb132f7d5c21c99442db27cbbb4bc0696 Mon Sep 17 00:00:00 2001 From: Marty Rosenberg Date: Thu, 20 Sep 2012 23:38:55 -0400 Subject: [PATCH 01/17] Qualcomm's snapdragon does not interpret "push sp" as a valid instruction, so don't emit it. (bug 791462, r=dvander) --- js/src/ion/arm/Assembler-arm.cpp | 1 + js/src/ion/arm/Assembler-arm.h | 4 +++- js/src/ion/arm/MacroAssembler-arm.cpp | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/js/src/ion/arm/Assembler-arm.cpp b/js/src/ion/arm/Assembler-arm.cpp index ff3fd2699c60..4f5322d8feee 100644 --- a/js/src/ion/arm/Assembler-arm.cpp +++ b/js/src/ion/arm/Assembler-arm.cpp @@ -1373,6 +1373,7 @@ BufferOffset Assembler::as_dtr(LoadStore ls, int size, Index mode, Register rt, DTRAddr addr, Condition c, uint32 *dest) { + JS_ASSERT (mode == Offset || (rt != addr.getBase() && pc != addr.getBase())); JS_ASSERT(size == 32 || size == 8); return writeInst( 0x04000000 | ls | (size == 8 ? 0x00400000 : 0) | mode | c | RT(rt) | addr.encode(), dest); diff --git a/js/src/ion/arm/Assembler-arm.h b/js/src/ion/arm/Assembler-arm.h index 2fc27d6fd487..6af822c56939 100644 --- a/js/src/ion/arm/Assembler-arm.h +++ b/js/src/ion/arm/Assembler-arm.h @@ -748,7 +748,9 @@ class DTRAddr uint32 encode() { return data; } - + Register getBase() { + return Register::FromCode((data >> 16) &0xf); + } private: friend class Operand; DTRAddr(uint32 blob) diff --git a/js/src/ion/arm/MacroAssembler-arm.cpp b/js/src/ion/arm/MacroAssembler-arm.cpp index 28df473df4dc..40ab3ba4224e 100644 --- a/js/src/ion/arm/MacroAssembler-arm.cpp +++ b/js/src/ion/arm/MacroAssembler-arm.cpp @@ -1031,6 +1031,11 @@ MacroAssemblerARM::ma_pop(Register r) void MacroAssemblerARM::ma_push(Register r) { + // pushing sp is not well defined, use two instructions + if (r == sp) { + ma_mov(sp, ScratchRegister); + r = ScratchRegister; + } ma_dtr(IsStore, sp,Imm32(-4), r, PreIndex); } From 1221b03e540bd9729f955f6158130198a4cf9efc Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Fri, 21 Sep 2012 10:38:14 +0300 Subject: [PATCH 02/17] Bug 790856, ensure bounds on the previous viewer, r=bz --- layout/base/nsDocumentViewer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 34aceacb400c..c2d670d7a6cc 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1899,8 +1899,10 @@ DocumentViewerImpl::SetBounds(const nsIntRect& aBounds) // relating to things being hidden while something is loaded. It so // happens that Firefox does this a good bit with its infobar, and it // looks ugly if we don't do this. - if (mPreviousViewer) - mPreviousViewer->SetBounds(aBounds); + if (mPreviousViewer) { + nsCOMPtr previousViewer = mPreviousViewer; + previousViewer->SetBounds(aBounds); + } return NS_OK; } From 6e0f9911b0bc61a29484af502433ee18a832e456 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Thu, 20 Sep 2012 15:40:45 -0400 Subject: [PATCH 03/17] Bug 789743 - Ensure bgupdates executes PostUpdate successfully. r=ehsan --- toolkit/components/maintenanceservice/workmonitor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/toolkit/components/maintenanceservice/workmonitor.cpp b/toolkit/components/maintenanceservice/workmonitor.cpp index 520e793370f1..24a463cb3c53 100644 --- a/toolkit/components/maintenanceservice/workmonitor.cpp +++ b/toolkit/components/maintenanceservice/workmonitor.cpp @@ -133,6 +133,7 @@ GetInstallationDir(int argcTmp, LPWSTR *argvTmp, WCHAR aResultDir[MAX_PATH]) BOOL StartUpdateProcess(int argc, LPWSTR *argv, + LPCWSTR installDir, BOOL &processStarted) { LOG(("Starting update process as the service in session 0.\n")); @@ -248,7 +249,6 @@ StartUpdateProcess(int argc, // Only run the PostUpdate if the update was successful if (updateWasSuccessful && argc > 2) { - LPCWSTR installationDir = argv[2]; LPCWSTR updateInfoDir = argv[1]; bool backgroundUpdate = IsUpdateBeingStaged(argc, argv); @@ -264,8 +264,10 @@ StartUpdateProcess(int argc, // performing the replacing in that case. if (!backgroundUpdate) { LOG(("Launching post update process as the service in session 0.\n")); - if (!LaunchWinPostProcess(installationDir, updateInfoDir, true, NULL)) { - LOG(("The post update process could not be launched.\n")); + if (!LaunchWinPostProcess(installDir, updateInfoDir, true, NULL)) { + LOG(("The post update process could not be launched." + " installDir: %ls, updateInfoDir: %ls\n", + installDir, updateInfoDir)); } } } @@ -419,7 +421,7 @@ ProcessSoftwareUpdateCommand(DWORD argc, LPWSTR *argv) // Only proceed with the update if we have no signing problems if (!updaterSignProblem) { BOOL updateProcessWasStarted = FALSE; - if (StartUpdateProcess(argc, argv, + if (StartUpdateProcess(argc, argv, installDir, updateProcessWasStarted)) { LOG(("updater.exe was launched and run successfully!\n")); LogFlush(); From 885bebe9387d82573bb4fa89996e4f52bd6c3524 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 21 Sep 2012 10:05:23 -0400 Subject: [PATCH 04/17] Bug 791687 - Remove NSIS 2.33 support since everything is upgraded to NSIS 2.46. r=rstrong --- .../installer/windows/nsis/overrides.nsh | 295 ------------------ 1 file changed, 295 deletions(-) diff --git a/toolkit/mozapps/installer/windows/nsis/overrides.nsh b/toolkit/mozapps/installer/windows/nsis/overrides.nsh index 6ebe27371529..0c7a3db6f021 100755 --- a/toolkit/mozapps/installer/windows/nsis/overrides.nsh +++ b/toolkit/mozapps/installer/windows/nsis/overrides.nsh @@ -18,301 +18,6 @@ !include FileFunc.nsh !endif -!ifndef CallArtificialFunction -; The CallArtificialFunction and CallArtificialFunction2 macros are from -; Util.nsh in NSIS v2.46-Unicode and have not been modified. They are needed -; by TextCompareNoDetail when compiling an installer / uninstaller with NSIS -; v2.33-Unicode. -; See /include/Util.nsh for more information. - -# see WinVer.nsh and *Func.nsh for usage examples -!macro CallArtificialFunction NAME - !ifndef __UNINSTALL__ - !define CallArtificialFunction_TYPE inst - !else - !define CallArtificialFunction_TYPE uninst - !endif - Call :.${NAME}${CallArtificialFunction_TYPE} - !ifndef ${NAME}${CallArtificialFunction_TYPE}_DEFINED - Goto ${NAME}${CallArtificialFunction_TYPE}_DONE - !define ${NAME}${CallArtificialFunction_TYPE}_DEFINED - .${NAME}${CallArtificialFunction_TYPE}: - !insertmacro ${NAME} - Return - ${NAME}${CallArtificialFunction_TYPE}_DONE: - !endif - !undef CallArtificialFunction_TYPE -!macroend -!define CallArtificialFunction `!insertmacro CallArtificialFunction` - -# for usage of artificial functions inside artificial functions -# macro recursion is prohibited -!macro CallArtificialFunction2 NAME - !ifndef __UNINSTALL__ - !define CallArtificialFunction2_TYPE inst - !else - !define CallArtificialFunction2_TYPE uninst - !endif - Call :.${NAME}${CallArtificialFunction2_TYPE} - !ifndef ${NAME}${CallArtificialFunction2_TYPE}_DEFINED - Goto ${NAME}${CallArtificialFunction2_TYPE}_DONE - !define ${NAME}${CallArtificialFunction2_TYPE}_DEFINED - .${NAME}${CallArtificialFunction2_TYPE}: - !insertmacro ${NAME} - Return - ${NAME}${CallArtificialFunction2_TYPE}_DONE: - !endif - !undef CallArtificialFunction2_TYPE -!macroend -!define CallArtificialFunction2 `!insertmacro CallArtificialFunction2` - -!endif - -!ifndef _WINVER_VERXBIT -; The following defines and macros are for service pack detection support and -; are from WinVer.nsh in NSIS 2.46. They can be removed after building with -; NSIS 2.33 is deprecated. - -!define _WINVER_VERXBIT 0x00000001 - -!define _WINVER_NTBIT 0x80000000 -!define _WINVER_NTSRVBIT 0x40000000 -!define _WINVER_MASKSP 0x000F0000 -!ifndef WINVER_2008R2 -!define WINVER_2008R2 0x601 -!endif - -!define OSVERSIONINFOW_SIZE 276 -!define OSVERSIONINFOEXW_SIZE 284 -!define VER_PLATFORM_WIN32_NT 2 -!define VER_NT_WORKSTATION 1 - -!macro __WinVer_DeclareVars - - !ifndef __WINVER_VARS_DECLARED - - !define __WINVER_VARS_DECLARED - - Var /GLOBAL __WINVERV - Var /GLOBAL __WINVERSP - - !endif - -!macroend - -# lazy initialization macro - -!ifmacrondef __WinVer_Call_GetVersionEx - - !macro __WinVer_Call_GetVersionEx STRUCT_SIZE - - System::Call '*$0(i ${STRUCT_SIZE})' - System::Call kernel32::GetVersionEx(ir0)i.r3 - - !macroend - -!endif - -!macro __WinVer_InitVars - # variables - !insertmacro __WinVer_DeclareVars - - # only calculate version once - StrCmp $__WINVERV "" _winver_noveryet - Return - _winver_noveryet: - - # push used registers on the stack - Push $0 - Push $1 ;maj - Push $2 ;min - Push $3 ;bld - Push $R0 ;temp - - # allocate memory - System::Alloc ${OSVERSIONINFOEXW_SIZE} - Pop $0 - - # use OSVERSIONINFOEX - !insertmacro __WinVer_Call_GetVersionEx ${OSVERSIONINFOEXW_SIZE} - - IntCmp $3 0 "" _winver_ex _winver_ex - # OSVERSIONINFOEX not allowed (Win9x or NT4 w/SP < 6), use OSVERSIONINFO - !insertmacro __WinVer_Call_GetVersionEx ${OSVERSIONINFOW_SIZE} - _winver_ex: - - # The original struct formatting string here was: - # '*$0(i.s,i.r1,i.r2,i.r3,i.s,&t128.s,&i2.s,&i2,&i2,&i1.s,&i1)' - # but in NSIS v2.33u strings take the size in bytes instead of size in chars - # so the 128 char '&t128.s' is changed here to '&t256.s'. - System::Call '*$0(i.s,i.r1,i.r2,i.r3,i.s,&t256.s,&i2.s,&i2,&i2,&i1.s,&i1)' - - # free struct - System::Free $0 - - # win9x has major and minor info in high word of dwBuildNumber - remove it - IntOp $3 $3 & 0xFFFF - - # get dwOSVersionInfoSize - Pop $R0 - - # get dwPlatformId - Pop $0 - - # NT? - IntCmp $0 ${VER_PLATFORM_WIN32_NT} "" _winver_notnt _winver_notnt - IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTBIT} - IntOp $__WINVERV $__WINVERV | ${_WINVER_NTBIT} - _winver_notnt: - - # get service pack information - IntCmp $0 ${VER_PLATFORM_WIN32_NT} _winver_nt "" _winver_nt # win9x - - # get szCSDVersion - Pop $0 - - # copy second char - StrCpy $0 $0 1 1 - - # discard invalid wServicePackMajor and wProductType - Pop $R0 - Pop $R0 - - # switch - StrCmp $0 'A' "" +3 - StrCpy $0 1 - Goto _winver_sp_done - StrCmp $0 'B' "" +3 - StrCpy $0 2 - Goto _winver_sp_done - StrCmp $0 'C' "" +3 - StrCpy $0 3 - Goto _winver_sp_done - StrCpy $0 0 - Goto _winver_sp_done - - _winver_nt: # nt - - IntCmp $R0 ${OSVERSIONINFOEXW_SIZE} "" _winver_sp_noex _winver_sp_noex - - # discard szCSDVersion - Pop $0 - - # get wProductType - Exch - Pop $0 - - # is server? - IntCmp $0 ${VER_NT_WORKSTATION} _winver_noserver _winver_noserver "" - IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTSRVBIT} - _winver_noserver: - - # get wServicePackMajor - Pop $0 - - # done with sp - Goto _winver_sp_done - - _winver_sp_noex: # OSVERSIONINFO, not OSVERSIONINFOEX - - #### TODO - ## For IsServer to support < NT4SP6, we need to check the registry - ## here to see if we are a server and/or DC - - # get szCSDVersion - Pop $0 - - # discard invalid wServicePackMajor and wProductType - Pop $R0 - Pop $R0 - - # get service pack number from text - StrCpy $R0 $0 13 - StrCmp $R0 "Service Pack " "" +3 - StrCpy $0 $0 "" 13 # cut "Service Pack " - Goto +2 - StrCpy $0 0 # no service pack - -!ifdef WINVER_NT4_OVER_W95 - IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT} -!endif - - _winver_sp_done: - - # store service pack - IntOp $0 $0 << 16 - IntOp $__WINVERSP $__WINVERSP | $0 - - ### now for the version - - # is server? - IntOp $0 $__WINVERSP & ${_WINVER_NTSRVBIT} - - # windows xp x64? - IntCmp $0 0 "" _winver_not_xp_x64 _winver_not_xp_x64 # not server - IntCmp $1 5 "" _winver_not_xp_x64 _winver_not_xp_x64 # maj 5 - IntCmp $2 2 "" _winver_not_xp_x64 _winver_not_xp_x64 # min 2 - # change XP x64 from 5.2 to 5.1 so it's still XP - StrCpy $2 1 - _winver_not_xp_x64: - - # server 2008? - IntCmp $0 0 _winver_not_ntserver # server - IntCmp 6 $1 "" "" _winver_not_ntserver # maj 6 - # extra bit so Server 2008 comes after Vista SP1 that has the same minor version, same for Win7 vs 2008R2 - IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT} - _winver_not_ntserver: - - # pack version - IntOp $1 $1 << 24 # VerMajor - IntOp $__WINVERV $__WINVERV | $1 - IntOp $0 $2 << 16 - IntOp $__WINVERV $__WINVERV | $0 # VerMinor - IntOp $__WINVERSP $__WINVERSP | $3 # VerBuild - - # restore registers - Pop $R0 - Pop $3 - Pop $2 - Pop $1 - Pop $0 - -!macroend - -!macro _WinVer_GetServicePackLevel OUTVAR - ${CallArtificialFunction} __WinVer_InitVars - IntOp ${OUTVAR} $__WINVERSP & ${_WINVER_MASKSP} - IntOp ${OUTVAR} ${OUTVAR} >> 16 -!macroend -!define WinVerGetServicePackLevel '!insertmacro _WinVer_GetServicePackLevel ' - -!macro _AtLeastServicePack _a _b _t _f - !insertmacro _LOGICLIB_TEMP - ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP - !insertmacro _>= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` -!macroend -!define AtLeastServicePack `"" AtLeastServicePack` - -!macro _AtMostServicePack _a _b _t _f - !insertmacro _LOGICLIB_TEMP - ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP - !insertmacro _<= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` -!macroend -!define AtMostServicePack `"" AtMostServicePack` - -!macro _IsServicePack _a _b _t _f - !insertmacro _LOGICLIB_TEMP - ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP - !insertmacro _= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` -!macroend -!define IsServicePack `"" IsServicePack` - -!ifndef AtMostWin2008R2 -!insertmacro __WinVer_DefineOSTest AtMost 2008R2 -!endif - -!endif # _WINVER_VERXBIT - !verbose push !verbose 3 !ifndef _OVERRIDE_VERBOSE From 4c7deba14e2da939e5d1940669051d3be997e13e Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Tue, 11 Sep 2012 14:59:07 -0400 Subject: [PATCH 05/17] Bug 737833 - Add logiclib tests for Windows 8. r=rstrong --- .../mozapps/installer/windows/nsis/common.nsh | 14 ------------- .../installer/windows/nsis/overrides.nsh | 21 +++++++++++++++++++ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh index 6ec8db8a0d35..b7afbae32d18 100755 --- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -79,20 +79,6 @@ !include /NONFATAL WinVer.nsh !endif -; Add Windows 7 / 2008 support for versions of WinVer.nsh that don't support -; them. This can be removed after bug 571381 is fixed. -!ifndef WINVER_7 - !define WINVER_7 0x601 - - !macro __MOZ__WinVer_DefineOSTests Test - !insertmacro __WinVer_DefineOSTest ${Test} 7 - !macroend - - !insertmacro __MOZ__WinVer_DefineOSTests AtLeast - !insertmacro __MOZ__WinVer_DefineOSTests Is - !insertmacro __MOZ__WinVer_DefineOSTests AtMost -!endif - !include x64.nsh ; NSIS provided macros that we have overridden. diff --git a/toolkit/mozapps/installer/windows/nsis/overrides.nsh b/toolkit/mozapps/installer/windows/nsis/overrides.nsh index 0c7a3db6f021..0f0f0efb8072 100755 --- a/toolkit/mozapps/installer/windows/nsis/overrides.nsh +++ b/toolkit/mozapps/installer/windows/nsis/overrides.nsh @@ -18,6 +18,27 @@ !include FileFunc.nsh !endif +!macro __MOZ__WinVer_DefineOSTests WinVer + !insertmacro __WinVer_DefineOSTest AtLeast ${WinVer} "" + !insertmacro __WinVer_DefineOSTest AtMost ${WinVer} "" + !insertmacro __WinVer_DefineOSTest Is ${WinVer} "" +!macroend + +!ifndef WINVER_7 + !define WINVER_7 0x06010000 ;6.01.???? + !insertmacro __MOZ__WinVer_DefineOSTests 7 +!endif + +!ifndef WINVER_2008R2 + !define WINVER_2008R2 0x06010001 ;6.01.???? + !insertmacro __MOZ__WinVer_DefineOSTests 2008R2 +!endif + +!ifndef WINVER_8 + !define WINVER_8 0x06020000 ;6.02.???? + !insertmacro __MOZ__WinVer_DefineOSTests 8 +!endif + !verbose push !verbose 3 !ifndef _OVERRIDE_VERBOSE From 3a2cf3d366692912eb8865db210ee9d61e7e456a Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Tue, 11 Sep 2012 14:58:58 -0400 Subject: [PATCH 06/17] Bug 737833 - Metro style enabled desktop browser installer registration. r=rstrong --- browser/installer/windows/nsis/installer.nsi | 16 ++- browser/installer/windows/nsis/shared.nsh | 24 +++-- .../installer/windows/nsis/uninstaller.nsi | 6 ++ .../mozapps/installer/windows/nsis/common.nsh | 97 +++++++++++++++++++ 4 files changed, 135 insertions(+), 8 deletions(-) diff --git a/browser/installer/windows/nsis/installer.nsi b/browser/installer/windows/nsis/installer.nsi index 3c1eedb3d9d7..f6ad6fc002bc 100755 --- a/browser/installer/windows/nsis/installer.nsi +++ b/browser/installer/windows/nsis/installer.nsi @@ -76,6 +76,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe" !insertmacro CleanUpdatesDir !insertmacro CopyFilesFromDir !insertmacro CreateRegKey +!insertmacro GetLongPath !insertmacro GetPathFromString !insertmacro GetParent !insertmacro InitHashAppModelId @@ -90,6 +91,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe" !insertmacro RegCleanAppHandler !insertmacro RegCleanMain !insertmacro RegCleanUninstall +!insertmacro RemoveDEHRegistrationIfMatching !insertmacro SetAppLSPCategories !insertmacro SetBrandNameVars !insertmacro UpdateShortcutAppModelIDs @@ -324,10 +326,20 @@ Section "-Application" APP_IDX ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 StrCpy $2 "$\"$8$\" -osint -url $\"%1$\"" + ; In Win8, the delegate execute handler picks up the value in FirefoxURL and + ; FirefoxHTML to launch the desktop browser when it needs to. ${AddDisabledDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" \ "${AppRegName} Document" "" ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ "true" + ${If} ${AtLeastWin8} + ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} + ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ + "$INSTDIR\CommandExecuteHandler.exe" \ + $AppUserModelID \ + "FirefoxURL" \ + "FirefoxHTML" + ${EndIf} ; The following keys should only be set if we can write to HKLM ${If} $TmpVal == "HKLM" @@ -444,7 +456,7 @@ Section "-Application" APP_IDX "$INSTDIR" ${If} ${AtLeastWin7} ${AndIf} "$AppUserModelID" != "" - ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" ${EndIf} ${LogMsg} "Added Shortcut: $SMPROGRAMS\${BrandFullName}.lnk" ${Else} @@ -459,7 +471,7 @@ Section "-Application" APP_IDX "$INSTDIR" ${If} ${AtLeastWin7} ${AndIf} "$AppUserModelID" != "" - ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" + ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" ${EndIf} ${LogMsg} "Added Shortcut: $DESKTOP\${BrandFullName}.lnk" ${Else} diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh index 2fa01f07924f..2feab30e27e4 100755 --- a/browser/installer/windows/nsis/shared.nsh +++ b/browser/installer/windows/nsis/shared.nsh @@ -2,6 +2,10 @@ # 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/. +; The registration ID of the COM server which is used for choosing wether +; to launch the Win8 metro browser or desktop browser. +!define DELEGATE_EXECUTE_HANDLER_ID {5100FEC1-212B-4BF5-9BF8-3E650FD794A3} + !macro PostUpdate ${CreateShortcutsLog} @@ -209,7 +213,7 @@ ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR" ${If} ${AtLeastWin7} ${AndIf} "$AppUserModelID" != "" - ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" + ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" ${EndIf} ${Else} SetShellVarContext current ; Set $DESKTOP to the current user's desktop @@ -220,7 +224,7 @@ "$INSTDIR" ${If} ${AtLeastWin7} ${AndIf} "$AppUserModelID" != "" - ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" + ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "$AppUserModelID" "true" ${EndIf} ${EndIf} ${EndUnless} @@ -235,7 +239,7 @@ "$INSTDIR" ${If} ${AtLeastWin7} ${AndIf} "$AppUserModelID" != "" - ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" ${EndIf} ${Else} SetShellVarContext current ; Set $SMPROGRAMS to the current user's Start @@ -247,7 +251,7 @@ "$INSTDIR" ${If} ${AtLeastWin7} ${AndIf} "$AppUserModelID" != "" - ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" ${EndIf} ${EndIf} ${EndUnless} @@ -314,6 +318,14 @@ ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ "true" + ${If} ${AtLeastWin8} + ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} + ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ + "$INSTDIR\CommandExecuteHandler.exe" \ + $AppUserModelID \ + "FirefoxURL" \ + "FirefoxHTML" + ${EndIf} ; An empty string is used for the 4th & 5th params because the following ; protocol handlers already have a display name and the additional keys @@ -846,7 +858,7 @@ ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\$1" \ "$INSTDIR" ${If} "$AppUserModelID" != "" - ApplicationID::Set "$SMPROGRAMS\$1" "$AppUserModelID" + ApplicationID::Set "$SMPROGRAMS\$1" "$AppUserModelID" "true" ${EndIf} ${EndIf} ${EndUnless} @@ -931,7 +943,7 @@ ${If} ${AtLeastWin7} ${AndIf} "$AppUserModelID" != "" ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" \ - "$AppUserModelID" + "$AppUserModelID" "true" ${EndIf} ${EndIf} ${EndIf} diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi index d7a54db13a48..babfd6b8f91d 100755 --- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -76,6 +76,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe" !insertmacro RegCleanAppHandler !insertmacro RegCleanMain !insertmacro RegCleanUninstall +!insertmacro RemoveDEHRegistrationIfMatching !insertmacro SetAppLSPCategories !insertmacro SetBrandNameVars !insertmacro UpdateShortcutAppModelIDs @@ -100,6 +101,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe" !insertmacro un.RegCleanMain !insertmacro un.RegCleanUninstall !insertmacro un.RegCleanProtocolHandler +!insertmacro un.RemoveDEHRegistrationIfMatching !insertmacro un.RemoveQuotesFromPath !insertmacro un.SetAppLSPCategories !insertmacro un.SetBrandNameVars @@ -282,6 +284,10 @@ Section "Uninstall" ${un.SetAppLSPCategories} ${EndIf} + ${If} ${AtLeastWin8} + ${un.CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} + ${EndIf} + ${un.RegCleanAppHandler} "FirefoxURL" ${un.RegCleanAppHandler} "FirefoxHTML" ${un.RegCleanProtocolHandler} "ftp" diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh index b7afbae32d18..2610b5d45735 100755 --- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -6954,3 +6954,100 @@ !verbose pop !endif !macroend + +; Removes the CEH registration if it's set to our installation directory. +; If it's set to some other installation directory, then it should be removed +; by that installation. +!macro RemoveDEHRegistrationIfMatchingCall un + Function ${un}RemoveDEHRegistrationIfMatchingCall + ; Move the old $R0 on the stack and set it to DEH ID + Exch $R0 + ; Backup the old values of R8 and R7 on the stack + Push $R8 + Push $R7 + + ReadRegStr $R8 HKCU "Software\Classes\CLSID\$R0\LocalServer32" "" + ${${un}GetLongPath} "$INSTDIR" $R7 + StrCmp "$R8" "" next +1 + ${${un}GetParent} "$R8" $R8 + ${${un}GetLongPath} "$R8" $R8 + StrCmp "$R7" "$R8" +1 next + DeleteRegKey HKCU "Software\Classes\CLSID\$R0" + DeleteRegValue HKCU \ + "Software\Classes\$AppUserModelID\.exe\shell\open\command" \ + "DelegateExecute" + next: + + ReadRegStr $R8 HKLM "Software\Classes\CLSID\$R0\LocalServer32" "" + ${${un}GetLongPath} "$INSTDIR" $R7 + StrCmp "$R8" "" done +1 + ${${un}GetParent} "$R8" $R8 + ${${un}GetLongPath} "$R8" $R8 + StrCmp "$R7" "$R8" +1 done + DeleteRegKey HKLM "Software\Classes\CLSID\$R0" + DeleteRegValue HKLM \ + "Software\Classes\$AppUserModelID\.exe\shell\open\command" \ + "DelegateExecute" + done: + + ; Restore the stack back to its original state + Pop $R7 + Pop $R8 + Pop $R0 + FunctionEnd +!macroend + +!macro RemoveDEHRegistrationIfMatching + !insertmacro RemoveDEHRegistrationIfMatchingCall "" +!macroend + +!macro un.RemoveDEHRegistrationIfMatching + !insertmacro RemoveDEHRegistrationIfMatchingCall "un." +!macroend + +!macro CleanupMetroBrowserHandlerValues un DELEGATE_EXECUTE_HANDLER_ID + Push ${DELEGATE_EXECUTE_HANDLER_ID} + Call ${un}RemoveDEHRegistrationIfMatchingCall +!macroend +!define CleanupMetroBrowserHandlerValues '!insertmacro CleanupMetroBrowserHandlerValues ""' +!define un.CleanupMetroBrowserHandlerValues '!insertmacro CleanupMetroBrowserHandlerValues "un."' + +!macro AddMetroBrowserHandlerValues DELEGATE_EXECUTE_HANDLER_ID \ + DELEGATE_EXECUTE_HANDLER_PATH \ + APP_USER_MODEL_ID \ + PROTOCOL_ACTIVATION_ID \ + FILE_ACTIVATION_ID + ; Win8 doesn't use conventional progid command data to launch anymore. + ; Instead it uses a delegate execute handler which is a light weight COM + ; server for choosing the metro or desktop browser to launch depending + ; on the current environment (metro/desktop) it was activated in. + WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}" "" "" + WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe" "" "" + WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell" "" "open" + WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open" "CommandId" "open" + WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "" "$2" + WriteRegStr SHCTX "Software\Classes\${APP_USER_MODEL_ID}\.exe\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}" + + ; Augment the url handler registrations with additional data needed for Metro + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}" "AppUserModelID" "${APP_USER_MODEL_ID}" + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "AppUserModelID" "${APP_USER_MODEL_ID}" + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationName" "$BrandShortName" + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationIcon" "$INSTDIR\${FileMainEXE},0" + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationCompany" "${CompanyName}" + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\Application" "ApplicationDescription" "$(REG_APP_DESC)" + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell" "" "open" + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open" "CommandId" "open" + WriteRegStr SHCTX "Software\Classes\${PROTOCOL_ACTIVATION_ID}\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}" + + ; Augment the file handler registrations with additional data needed for Metro + WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}" "AppUserModelID" "${APP_USER_MODEL_ID}" + WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell" "" "open" + WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell\open" "CommandId" "open" + WriteRegStr SHCTX "Software\Classes\${FILE_ACTIVATION_ID}\shell\open\command" "DelegateExecute" "${DELEGATE_EXECUTE_HANDLER_ID}" + + ; Win8 Metro delegate execute handler registration + WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" "" "$BrandShortName CommandExecuteHandler" + WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}" "AppId" "${DELEGATE_EXECUTE_HANDLER_ID}" + WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}\LocalServer32" "" "${DELEGATE_EXECUTE_HANDLER_PATH}" +!macroend +!define AddMetroBrowserHandlerValues "!insertmacro AddMetroBrowserHandlerValues" From 9edffdfab0491242ca7c559ab1483ac847635078 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Mon, 17 Sep 2012 15:22:33 -0400 Subject: [PATCH 07/17] Bug 737833 - Disallow AppUserModelID registration calls for immersive mode. r=rstrong --- widget/windows/WinTaskbar.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/widget/windows/WinTaskbar.cpp b/widget/windows/WinTaskbar.cpp index 5d346829e5e5..07107f532c6e 100644 --- a/widget/windows/WinTaskbar.cpp +++ b/widget/windows/WinTaskbar.cpp @@ -328,6 +328,10 @@ WinTaskbar::RegisterAppUserModelID() { if (WinUtils::GetWindowsVersion() < WinUtils::WIN7_VERSION) return false; + if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) { + return false; + } + SetCurrentProcessExplicitAppUserModelIDPtr funcAppUserModelID = nullptr; bool retVal = false; From 8d0475bda798782941b76e5802b1fc9ef6a63694 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Mon, 17 Sep 2012 15:22:33 -0400 Subject: [PATCH 08/17] Bug 737833 - Add support for clearing out orphaned entries. r=rstrong --- toolkit/mozapps/installer/windows/nsis/common.nsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh index 2610b5d45735..ea319901e533 100755 --- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -6969,9 +6969,11 @@ ReadRegStr $R8 HKCU "Software\Classes\CLSID\$R0\LocalServer32" "" ${${un}GetLongPath} "$INSTDIR" $R7 StrCmp "$R8" "" next +1 + IfFileExists "$R8" +1 clearHKCU ${${un}GetParent} "$R8" $R8 ${${un}GetLongPath} "$R8" $R8 - StrCmp "$R7" "$R8" +1 next + StrCmp "$R7" "$R8" clearHKCU next + clearHKCU: DeleteRegKey HKCU "Software\Classes\CLSID\$R0" DeleteRegValue HKCU \ "Software\Classes\$AppUserModelID\.exe\shell\open\command" \ @@ -6981,9 +6983,11 @@ ReadRegStr $R8 HKLM "Software\Classes\CLSID\$R0\LocalServer32" "" ${${un}GetLongPath} "$INSTDIR" $R7 StrCmp "$R8" "" done +1 + IfFileExists "$R8" +1 clearHKLM ${${un}GetParent} "$R8" $R8 ${${un}GetLongPath} "$R8" $R8 - StrCmp "$R7" "$R8" +1 done + StrCmp "$R7" "$R8" clearHKLM done + clearHKLM: DeleteRegKey HKLM "Software\Classes\CLSID\$R0" DeleteRegValue HKLM \ "Software\Classes\$AppUserModelID\.exe\shell\open\command" \ From 866853f1b21d9b5ac77276f20cecfb61eecb0341 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Mon, 17 Sep 2012 15:22:33 -0400 Subject: [PATCH 09/17] Bug 737833 - Add Win8 to NSIS OS detection log. r=rstrong --- toolkit/mozapps/installer/windows/nsis/common.nsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh index ea319901e533..858c489df56a 100755 --- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -5729,8 +5729,12 @@ ${LogMsg} "OS Name : Windows 2003" ${ElseIf} ${IsWinVista} ${LogMsg} "OS Name : Windows Vista" - ${ElseIf} ${AtLeastWinVista} ; Workaround for NSIS 2.33 WinVer.nsh not knowing Win7 - ${LogMsg} "OS Name : Windows 7 or above" + ${ElseIf} ${IsWin7} + ${LogMsg} "OS Name : Windows 7" + ${ElseIf} ${IsWin8} + ${LogMsg} "OS Name : Windows 8" + ${ElseIf} ${AtLeastWin8} + ${LogMsg} "OS Name : Above Windows 8" ${Else} ${LogMsg} "OS Name : Unable to detect" ${EndIf} From 6c1323ecd34d9b3c36565527e7f8730aaf5d84cb Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Mon, 17 Sep 2012 15:22:33 -0400 Subject: [PATCH 10/17] Bug 737833 - Only do metro registration for metro builds. r=rstrong --- browser/installer/windows/nsis/defines.nsi.in | 4 ++++ browser/installer/windows/nsis/installer.nsi | 4 ++++ browser/installer/windows/nsis/shared.nsh | 2 ++ browser/installer/windows/nsis/uninstaller.nsi | 6 ++++++ toolkit/mozapps/installer/windows/nsis/common.nsh | 3 +++ 5 files changed, 19 insertions(+) diff --git a/browser/installer/windows/nsis/defines.nsi.in b/browser/installer/windows/nsis/defines.nsi.in index a82955e06ebf..e817c671eb91 100644 --- a/browser/installer/windows/nsis/defines.nsi.in +++ b/browser/installer/windows/nsis/defines.nsi.in @@ -53,6 +53,10 @@ !define MOZ_MAINTENANCE_SERVICE #endif +#ifdef MOZ_METRO +!define MOZ_METRO +#endif + # File details shared by both the installer and uninstaller VIProductVersion "1.0.0.0" VIAddVersionKey "ProductName" "${BrandShortName}" diff --git a/browser/installer/windows/nsis/installer.nsi b/browser/installer/windows/nsis/installer.nsi index f6ad6fc002bc..38947cf60cd9 100755 --- a/browser/installer/windows/nsis/installer.nsi +++ b/browser/installer/windows/nsis/installer.nsi @@ -91,7 +91,9 @@ VIAddVersionKey "OriginalFilename" "setup.exe" !insertmacro RegCleanAppHandler !insertmacro RegCleanMain !insertmacro RegCleanUninstall +!ifdef MOZ_METRO !insertmacro RemoveDEHRegistrationIfMatching +!endif !insertmacro SetAppLSPCategories !insertmacro SetBrandNameVars !insertmacro UpdateShortcutAppModelIDs @@ -333,12 +335,14 @@ Section "-Application" APP_IDX ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ "true" ${If} ${AtLeastWin8} +!ifdef MOZ_METRO ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ "$INSTDIR\CommandExecuteHandler.exe" \ $AppUserModelID \ "FirefoxURL" \ "FirefoxHTML" +!endif ${EndIf} ; The following keys should only be set if we can write to HKLM diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh index 2feab30e27e4..4e2c5f7be63d 100755 --- a/browser/installer/windows/nsis/shared.nsh +++ b/browser/installer/windows/nsis/shared.nsh @@ -318,6 +318,7 @@ ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ "true" +!ifdef MOZ_METRO ${If} ${AtLeastWin8} ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ @@ -326,6 +327,7 @@ "FirefoxURL" \ "FirefoxHTML" ${EndIf} +!endif ; An empty string is used for the 4th & 5th params because the following ; protocol handlers already have a display name and the additional keys diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi index babfd6b8f91d..bbc0f2fcfb3c 100755 --- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -76,7 +76,9 @@ VIAddVersionKey "OriginalFilename" "helper.exe" !insertmacro RegCleanAppHandler !insertmacro RegCleanMain !insertmacro RegCleanUninstall +!ifdef MOZ_METRO !insertmacro RemoveDEHRegistrationIfMatching +!endif !insertmacro SetAppLSPCategories !insertmacro SetBrandNameVars !insertmacro UpdateShortcutAppModelIDs @@ -101,7 +103,9 @@ VIAddVersionKey "OriginalFilename" "helper.exe" !insertmacro un.RegCleanMain !insertmacro un.RegCleanUninstall !insertmacro un.RegCleanProtocolHandler +!ifdef MOZ_METRO !insertmacro un.RemoveDEHRegistrationIfMatching +!endif !insertmacro un.RemoveQuotesFromPath !insertmacro un.SetAppLSPCategories !insertmacro un.SetBrandNameVars @@ -284,9 +288,11 @@ Section "Uninstall" ${un.SetAppLSPCategories} ${EndIf} +!ifdef MOZ_METRO ${If} ${AtLeastWin8} ${un.CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} ${EndIf} +!endif ${un.RegCleanAppHandler} "FirefoxURL" ${un.RegCleanAppHandler} "FirefoxHTML" diff --git a/toolkit/mozapps/installer/windows/nsis/common.nsh b/toolkit/mozapps/installer/windows/nsis/common.nsh index 858c489df56a..d8174f827664 100755 --- a/toolkit/mozapps/installer/windows/nsis/common.nsh +++ b/toolkit/mozapps/installer/windows/nsis/common.nsh @@ -6959,6 +6959,7 @@ !endif !macroend +!ifdef MOZ_METRO ; Removes the CEH registration if it's set to our installation directory. ; If it's set to some other installation directory, then it should be removed ; by that installation. @@ -7059,3 +7060,5 @@ WriteRegStr SHCTX "Software\Classes\CLSID\${DELEGATE_EXECUTE_HANDLER_ID}\LocalServer32" "" "${DELEGATE_EXECUTE_HANDLER_PATH}" !macroend !define AddMetroBrowserHandlerValues "!insertmacro AddMetroBrowserHandlerValues" +!endif ;end MOZ_METRO + From bab895a0ea72b8559d0b1416369e4882f28ef156 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 21 Sep 2012 10:05:24 -0400 Subject: [PATCH 11/17] Bug 791019 - Default browser check interface change for review comments. r=felipe --- .../shell/public/nsIShellService.idl | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/browser/components/shell/public/nsIShellService.idl b/browser/components/shell/public/nsIShellService.idl index cf697080b9d4..4825741b3e4f 100644 --- a/browser/components/shell/public/nsIShellService.idl +++ b/browser/components/shell/public/nsIShellService.idl @@ -8,19 +8,23 @@ interface nsIDOMElement; interface nsIFile; -[scriptable, uuid(bb477da4-dddf-4106-a562-f06c85c7f9a8)] +[scriptable, uuid(99d2e9f1-3c86-40f7-81fd-3060c18489f0)] interface nsIShellService : nsISupports { /** * Determines whether or not Firefox is the "Default Browser." - * This is simply whether or not Firefox is registered to handle - * http links. - * + * This is simply whether or not Firefox is registered to handle + * http links. + * * @param aStartupCheck true if this is the check being performed - * by the first browser window at startup, - * false otherwise. + * by the first browser window at startup, + * false otherwise. + * @param aForAllTypes true if the check should be made for HTTP and HTML. + * false if the check should be made for HTTP only. + * This parameter may be ignored on some platforms. */ - boolean isDefaultBrowser(in boolean aStartupCheck); + boolean isDefaultBrowser(in boolean aStartupCheck, + [optional] in boolean aForAllTypes); /** * Registers Firefox as the "Default Browser." From b2a9eaf94d13051eaee21cb816982875c39c152f Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 21 Sep 2012 10:05:24 -0400 Subject: [PATCH 12/17] Bug 791019 - Default browser startup changes for not claiming all types on win8. r=felipe --- browser/components/nsBrowserGlue.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 775bd8fe43f8..2752ce321e3a 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -443,7 +443,9 @@ BrowserGlue.prototype = { (ss.sessionType == Ci.nsISessionStartup.RECOVER_SESSION); } catch (ex) { /* never mind; suppose SessionStore is broken */ } - if (shouldCheck && !shell.isDefaultBrowser(true) && !willRecoverSession) { + if (shouldCheck && + !shell.isDefaultBrowser(true, false) && + !willRecoverSession) { Services.tm.mainThread.dispatch(function() { var win = this.getMostRecentBrowserWindow(); var brandBundle = win.document.getElementById("bundle_brand"); @@ -460,8 +462,22 @@ BrowserGlue.prototype = { var rv = ps.confirmEx(win, promptTitle, promptMessage, ps.STD_YES_NO_BUTTONS, null, null, null, checkboxLabel, checkEveryTime); - if (rv == 0) - shell.setDefaultBrowser(true, false); + if (rv == 0) { + var claimAllTypes = true; +#ifdef XP_WIN + try { + // In Windows 8, the UI for selecting default protocol is much + // nicer than the UI for setting file type associations. So we + // only show the protocol association screen on Windows 8. + // Windows 8 is version 6.2. + let version = Cc["@mozilla.org/system-info;1"] + .getService(Ci.nsIPropertyBag2) + .getProperty("version"); + claimAllTypes = (parseFloat(version) < 6.2); + } catch (ex) { } +#endif + shell.setDefaultBrowser(claimAllTypes, false); + } shell.shouldCheckDefaultBrowser = checkEveryTime.value; }.bind(this), Ci.nsIThread.DISPATCH_NORMAL); } From dba09bf5248553101d094ab0ec48b351f8337ada Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 21 Sep 2012 10:05:24 -0400 Subject: [PATCH 13/17] Bug 791019 - Advanced preferences changes for win8 handling. r=felipe --- browser/components/preferences/advanced.js | 28 +++++++++++++++++-- .../preferences/in-content/advanced.js | 27 ++++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/browser/components/preferences/advanced.js b/browser/components/preferences/advanced.js index 926c51d41dbd..b1cc46f7e307 100644 --- a/browser/components/preferences/advanced.js +++ b/browser/components/preferences/advanced.js @@ -30,7 +30,28 @@ var gAdvancedPane = { #ifdef HAVE_SHELL_SERVICE this.updateSetDefaultBrowser(); +#ifdef XP_WIN + let shellSvc = getShellService(); + // In Windows 8 we launch the control panel since it's the only + // way to get all file type association prefs. So we don't know + // when the user will select the default. We refresh here periodically + // in case the default changes. + if (!shellSvc.isDefaultBrowser(false, true)) { + var isWin8OrHigher = false; + try { + let version = Components.classes["@mozilla.org/system-info;1"]. + getService(Components.interfaces.nsIPropertyBag2). + getProperty("version"); + isWin8OrHigher = parseFloat(version) >= 6.2; + } catch (ex) { } + + if (isWin8OrHigher) { + window.setInterval(this.updateSetDefaultBrowser, 1000); + } + } #endif +#endif + #ifdef MOZ_UPDATER this.updateReadPrefs(); #endif @@ -697,7 +718,8 @@ var gAdvancedPane = { document.getElementById("alwaysCheckDefault").disabled = true; return; } - let selectedIndex = shellSvc.isDefaultBrowser(false) ? 1 : 0; + let selectedIndex = + shellSvc.isDefaultBrowser(false, true) ? 1 : 0; setDefaultPane.selectedIndex = selectedIndex; }, @@ -710,7 +732,9 @@ var gAdvancedPane = { if (!shellSvc) return; shellSvc.setDefaultBrowser(true, false); - document.getElementById("setDefaultPane").selectedIndex = 1; + let selectedIndex = + shellSvc.isDefaultBrowser(false, true) ? 1 : 0; + document.getElementById("setDefaultPane").selectedIndex = selectedIndex; } #endif }; diff --git a/browser/components/preferences/in-content/advanced.js b/browser/components/preferences/in-content/advanced.js index 32af1171054a..2f540a118f2c 100644 --- a/browser/components/preferences/in-content/advanced.js +++ b/browser/components/preferences/in-content/advanced.js @@ -22,6 +22,26 @@ var gAdvancedPane = { #ifdef HAVE_SHELL_SERVICE this.updateSetDefaultBrowser(); +#ifdef XP_WIN + let shellSvc = getShellService(); + // In Windows 8 we launch the control panel since it's the only + // way to get all file type association prefs. So we don't know + // when the user will select the default. We refresh here periodically + // in case the default changes. + if (!shellSvc.isDefaultBrowser(false, true)) { + var isWin8OrHigher = false; + try { + let version = Components.classes["@mozilla.org/system-info;1"]. + getService(Components.interfaces.nsIPropertyBag2). + getProperty("version"); + isWin8OrHigher = parseFloat(version) >= 6.2; + } catch (ex) { } + + if (isWin8OrHigher) { + window.setInterval(this.updateSetDefaultBrowser, 1000); + } + } +#endif #endif #ifdef MOZ_UPDATER this.updateReadPrefs(); @@ -672,7 +692,8 @@ var gAdvancedPane = { document.getElementById("alwaysCheckDefault").disabled = true; return; } - let selectedIndex = shellSvc.isDefaultBrowser(false) ? 1 : 0; + let selectedIndex = + shellSvc.isDefaultBrowser(false, true) ? 1 : 0; setDefaultPane.selectedIndex = selectedIndex; }, @@ -685,7 +706,9 @@ var gAdvancedPane = { if (!shellSvc) return; shellSvc.setDefaultBrowser(true, false); - document.getElementById("setDefaultPane").selectedIndex = 1; + let selectedIndex = + shellSvc.isDefaultBrowser(false, true) ? 1 : 0; + document.getElementById("setDefaultPane").selectedIndex = selectedIndex; } #endif }; From fc9763a6cd995e3e61218fc895319a92afc7153b Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 21 Sep 2012 10:05:24 -0400 Subject: [PATCH 14/17] Bug 791019 - Test update due to Win8 changes for default browser. r=felipe --- browser/components/shell/test/browser_633221.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/browser/components/shell/test/browser_633221.js b/browser/components/shell/test/browser_633221.js index 7bb465f41471..840394dea914 100644 --- a/browser/components/shell/test/browser_633221.js +++ b/browser/components/shell/test/browser_633221.js @@ -10,5 +10,6 @@ function test() { getService(Ci.nsIShellService); shell.setDefaultBrowser(true, false); - ok(shell.isDefaultBrowser(true), "we got here and are the default browser"); + ok(shell.isDefaultBrowser(true, false), "we got here and are the default browser"); + ok(shell.isDefaultBrowser(true, true), "we got here and are the default browser"); } From f117583b036650dd6b7fd0e98249287a00388973 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 21 Sep 2012 10:05:24 -0400 Subject: [PATCH 15/17] Bug 791019 - New parameter for is default browser for non Windows platforms. r=jimm --- browser/components/shell/src/nsGNOMEShellService.cpp | 1 + browser/components/shell/src/nsMacShellService.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/browser/components/shell/src/nsGNOMEShellService.cpp b/browser/components/shell/src/nsGNOMEShellService.cpp index 82526f6bd14c..6f3492c7f76c 100644 --- a/browser/components/shell/src/nsGNOMEShellService.cpp +++ b/browser/components/shell/src/nsGNOMEShellService.cpp @@ -197,6 +197,7 @@ nsGNOMEShellService::CheckHandlerMatchesAppName(const nsACString &handler) const NS_IMETHODIMP nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck, + bool aForAllTypes, bool* aIsDefaultBrowser) { *aIsDefaultBrowser = false; diff --git a/browser/components/shell/src/nsMacShellService.cpp b/browser/components/shell/src/nsMacShellService.cpp index 5444ee59cb38..49898f99c1a1 100644 --- a/browser/components/shell/src/nsMacShellService.cpp +++ b/browser/components/shell/src/nsMacShellService.cpp @@ -32,7 +32,9 @@ NS_IMPL_ISUPPORTS3(nsMacShellService, nsIMacShellService, nsIShellService, nsIWebProgressListener) NS_IMETHODIMP -nsMacShellService::IsDefaultBrowser(bool aStartupCheck, bool* aIsDefaultBrowser) +nsMacShellService::IsDefaultBrowser(bool aStartupCheck, + bool aForAllTypes, + bool* aIsDefaultBrowser) { *aIsDefaultBrowser = false; From 975f35a30192448f47a8c14a23f2455b20252031 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 21 Sep 2012 10:05:24 -0400 Subject: [PATCH 16/17] Bug 791019 - New parameter for checking all defaults for win32. r=jimm --- .../shell/src/nsWindowsShellService.cpp | 101 ++++++++++++++---- .../shell/src/nsWindowsShellService.h | 5 +- 2 files changed, 85 insertions(+), 21 deletions(-) diff --git a/browser/components/shell/src/nsWindowsShellService.cpp b/browser/components/shell/src/nsWindowsShellService.cpp index 5ee8306090fc..f83289a417d1 100644 --- a/browser/components/shell/src/nsWindowsShellService.cpp +++ b/browser/components/shell/src/nsWindowsShellService.cpp @@ -320,7 +320,8 @@ IsWin8OrLater() } bool -nsWindowsShellService::IsDefaultBrowserVista(bool* aIsDefaultBrowser) +nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes, + bool* aIsDefaultBrowser) { IApplicationAssociationRegistration* pAAR; HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, @@ -348,6 +349,22 @@ nsWindowsShellService::IsDefaultBrowserVista(bool* aIsDefaultBrowser) } else { *aIsDefaultBrowser = false; } + // If this is a startup check, then we don't check file type + // associations. This is because the win8 UI for file type + // association has to be done through the control panel. If this + // is not a startup check, then we're checking through the control + // panel and we should also check for file type association. + if (aCheckAllTypes && *aIsDefaultBrowser) { + hr = pAAR->QueryCurrentDefault(L".html", AT_FILEEXTENSION, AL_EFFECTIVE, + ®isteredApp); + if (SUCCEEDED(hr)) { + LPCWSTR firefoxHTMLProgID = L"FirefoxHTML"; + *aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTMLProgID); + CoTaskMemFree(registeredApp); + } else { + *aIsDefaultBrowser = false; + } + } } pAAR->Release(); @@ -358,19 +375,17 @@ nsWindowsShellService::IsDefaultBrowserVista(bool* aIsDefaultBrowser) NS_IMETHODIMP nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, + bool aForAllTypes, bool* aIsDefaultBrowser) { // If this is the first browser window, maintain internal state that we've - // checked this session (so that subsequent window opens don't show the + // checked this session (so that subsequent window opens don't show the // default browser dialog). if (aStartupCheck) mCheckedThisSession = true; - return IsDefaultBrowser(aIsDefaultBrowser); -} -nsresult -nsWindowsShellService::IsDefaultBrowser(bool* aIsDefaultBrowser) -{ + // Assume we're the default unless one of the several checks below tell us + // otherwise. *aIsDefaultBrowser = true; PRUnichar exePath[MAX_BUF]; @@ -448,7 +463,7 @@ nsWindowsShellService::IsDefaultBrowser(bool* aIsDefaultBrowser) // Only check if Firefox is the default browser on Vista and above if the // previous checks show that Firefox is the default browser. if (*aIsDefaultBrowser) { - IsDefaultBrowserVista(aIsDefaultBrowser); + IsDefaultBrowserVista(aForAllTypes, aIsDefaultBrowser); } // To handle the case where DDE isn't disabled due for a user because there @@ -588,6 +603,49 @@ DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo) NS_ERROR_FAILURE; } +nsresult +nsWindowsShellService::LaunchControlPanelDefaultPrograms() +{ + // Build the path control.exe path safely + WCHAR controlEXEPath[MAX_PATH + 1] = { '\0' }; + if (!GetSystemDirectoryW(controlEXEPath, MAX_PATH)) { + return NS_ERROR_FAILURE; + } + LPCWSTR controlEXE = L"control.exe"; + if (wcslen(controlEXEPath) + wcslen(controlEXE) >= MAX_PATH) { + return NS_ERROR_FAILURE; + } + if (!PathAppendW(controlEXEPath, controlEXE)) { + return NS_ERROR_FAILURE; + } + + WCHAR params[] = L"control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram"; + STARTUPINFOW si = {sizeof(si), 0}; + si.dwFlags = STARTF_USESHOWWINDOW; + si.wShowWindow = SW_SHOWDEFAULT; + PROCESS_INFORMATION pi = {0}; + if (!CreateProcessW(controlEXEPath, params, NULL, NULL, FALSE, 0, NULL, + NULL, &si, &pi)) { + return NS_ERROR_FAILURE; + } + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + return NS_OK; +} + +nsresult +nsWindowsShellService::LaunchHTTPHandlerPane() +{ + OPENASINFO info; + info.pcszFile = L"http"; + info.pcszClass = NULL; + info.oaifInFlags = OAIF_FORCE_REGISTRATION | + OAIF_URL_PROTOCOL | + OAIF_REGISTER_EXT; + return DynSHOpenWithDialog(NULL, &info); +} + NS_IMETHODIMP nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) { @@ -603,18 +661,23 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers) nsresult rv = LaunchHelper(appHelperPath); if (NS_SUCCEEDED(rv) && IsWin8OrLater()) { - OPENASINFO info; - info.pcszFile = L"http"; - info.pcszClass = NULL; - info.oaifInFlags = OAIF_FORCE_REGISTRATION | - OAIF_URL_PROTOCOL | - OAIF_REGISTER_EXT; - nsresult rv = DynSHOpenWithDialog(NULL, &info); - NS_ENSURE_SUCCESS(rv, rv); - bool isDefaultBrowser = false; - rv = NS_SUCCEEDED(IsDefaultBrowser(&isDefaultBrowser)) && - isDefaultBrowser ? NS_OK : NS_ERROR_FAILURE; + if (aClaimAllTypes) { + rv = LaunchControlPanelDefaultPrograms(); + // The above call should never really fail, but just in case + // fall back to showing the HTTP association screen only. + if (NS_FAILED(rv)) { + rv = LaunchHTTPHandlerPane(); + } + } else { + rv = LaunchHTTPHandlerPane(); + // The above calls hould never really fail, but just in case + // fallb ack to showing control panel for all defaults + if (NS_FAILED(rv)) { + rv = LaunchControlPanelDefaultPrograms(); + } + } } + return rv; } diff --git a/browser/components/shell/src/nsWindowsShellService.h b/browser/components/shell/src/nsWindowsShellService.h index 3197f3f6d43d..cfd73556ceec 100644 --- a/browser/components/shell/src/nsWindowsShellService.h +++ b/browser/components/shell/src/nsWindowsShellService.h @@ -25,8 +25,9 @@ public: NS_DECL_NSIWINDOWSSHELLSERVICE protected: - static nsresult IsDefaultBrowser(bool* aIsDefaultBrowser); - static bool IsDefaultBrowserVista(bool* aIsDefaultBrowser); + bool IsDefaultBrowserVista(bool aCheckAllTypes, bool* aIsDefaultBrowser); + nsresult LaunchControlPanelDefaultPrograms(); + nsresult LaunchHTTPHandlerPane(); private: bool mCheckedThisSession; From 58762225379c16a517aa3735a0570fafd6e91ac6 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Fri, 21 Sep 2012 10:05:24 -0400 Subject: [PATCH 17/17] Bug 790667 - Setting default browser should never prompt for UAC on Windows 8. r=rstrong --- browser/installer/windows/nsis/installer.nsi | 21 ++- browser/installer/windows/nsis/shared.nsh | 133 ++++++++++++------ .../installer/windows/nsis/uninstaller.nsi | 16 +++ 3 files changed, 126 insertions(+), 44 deletions(-) diff --git a/browser/installer/windows/nsis/installer.nsi b/browser/installer/windows/nsis/installer.nsi index 38947cf60cd9..d5cc38eb5ab6 100755 --- a/browser/installer/windows/nsis/installer.nsi +++ b/browser/installer/windows/nsis/installer.nsi @@ -343,13 +343,28 @@ Section "-Application" APP_IDX "FirefoxURL" \ "FirefoxHTML" !endif + ; Set the Start Menu Internet and Vista Registered App HKCU registry keys. + ${SetStartMenuInternet} "HKCU" + ${FixShellIconHandler} "HKCU" + + ; If we create either the desktop or start menu shortcuts, then + ; set IconsVisible to 1 otherwise to 0. + ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 + StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo" + ${If} $AddDesktopSC == 1 + ${OrIf} $AddStartMenuSC == 1 + WriteRegDWORD HKCU "$0" "IconsVisible" 1 + ${Else} + WriteRegDWORD HKCU "$0" "IconsVisible" 0 + ${EndIf} ${EndIf} - ; The following keys should only be set if we can write to HKLM + ; The following keys should only be set if we can write to HKLM for pre win8 + ; For post win8 we set the keys above in HKCU in addition to below in HKLM. ${If} $TmpVal == "HKLM" ; Set the Start Menu Internet and Vista Registered App HKLM registry keys. - ${SetStartMenuInternet} - ${FixShellIconHandler} + ${SetStartMenuInternet} "HKLM" + ${FixShellIconHandler} "HKLM" ; If we are writing to HKLM and create either the desktop or start menu ; shortcuts set IconsVisible to 1 otherwise to 0. diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh index 4e2c5f7be63d..dd985bcaa0f9 100755 --- a/browser/installer/windows/nsis/shared.nsh +++ b/browser/installer/windows/nsis/shared.nsh @@ -34,14 +34,15 @@ ${RegCleanMain} "Software\Mozilla" ${RegCleanUninstall} ${UpdateProtocolHandlers} - ${FixShellIconHandler} + ${FixShellIconHandler} "HKLM" ${SetAppLSPCategories} ${LSP_CATEGORIES} ; Win7 taskbar and start menu link maintenance Call FixShortcutAppModelIDs - ; Only update the Clients\StartMenuInternet registry key values if they - ; don't exist or this installation is the same as the one set in those keys. + ; Only update the Clients\StartMenuInternet registry key values in HKLM if + ; they don't exist or this installation is the same as the one set in those + ; keys. ${StrFilter} "${FileMainEXE}" "+" "" "" $1 ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$1\DefaultIcon" "" ${GetPathFromString} "$0" $0 @@ -50,7 +51,22 @@ ${GetLongPath} "$0" $0 ${EndIf} ${If} "$0" == "$INSTDIR" - ${SetStartMenuInternet} ; Does not use SHCTX + ${SetStartMenuInternet} "HKLM" + ${EndIf} + + ; Only update the Clients\StartMenuInternet registry key values in HKCU if + ; they don't exist or this installation is the same as the one set in those + ; keys. This is only done in Windows 8 to avoid a UAC prompt. + ${If} ${AtLeastWin8} + ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$1\DefaultIcon" "" + ${GetPathFromString} "$0" $0 + ${GetParent} "$0" $0 + ${If} ${FileExists} "$0" + ${GetLongPath} "$0" $0 + ${EndIf} + ${If} "$0" == "$INSTDIR" + ${SetStartMenuInternet} "HKCU" + ${EndIf} ${EndIf} ReadRegStr $0 HKLM "Software\mozilla.org\Mozilla" "CurrentVersion" @@ -131,8 +147,8 @@ SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) ${SetHandlers} ; Uses SHCTX - ${SetStartMenuInternet} ; Does not use SHCTX - ${FixShellIconHandler} ; Does not use SHCTX + ${SetStartMenuInternet} "HKLM" + ${FixShellIconHandler} "HKLM" ${ShowShortcuts} ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 WriteRegStr HKLM "Software\Clients\StartMenuInternet" "" "$R9" @@ -146,6 +162,9 @@ ${StrFilter} "${FileMainEXE}" "+" "" "" $0 StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo" WriteRegDWORD HKLM "$R1" "IconsVisible" 0 + ${If} ${AtLeastWin8} + WriteRegDWORD HKCU "$R1" "IconsVisible" 0 + ${EndIf} SetShellVarContext all ; Set $DESKTOP to All Users ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" @@ -205,6 +224,9 @@ ${StrFilter} "${FileMainEXE}" "+" "" "" $0 StrCpy $R1 "Software\Clients\StartMenuInternet\$0\InstallInfo" WriteRegDWORD HKLM "$R1" "IconsVisible" 1 + ${If} ${AtLeastWin8} + WriteRegDWORD HKCU "$R1" "IconsVisible" 1 + ${EndIf} SetShellVarContext all ; Set $DESKTOP to All Users ${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk" @@ -346,10 +368,15 @@ ; the key name is derived from the main application executable. ; http://support.microsoft.com/kb/297878 ; +; In Windows 8 this changes slightly, you can store StartMenuInternet entries in +; HKCU. The icon in start menu for StartMenuInternet is deprecated as of Win7, +; but the subkeys are what's important. Control panel default programs looks +; for them only in HKLM pre win8. +; ; Note: we might be able to get away with using the full path to the ; application executable for the key name in order to support multiple ; installations. -!macro SetStartMenuInternet +!macro SetStartMenuInternet RegKey ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 ${GetLongPath} "$INSTDIR\uninstall\helper.exe" $7 @@ -357,55 +384,55 @@ StrCpy $0 "Software\Clients\StartMenuInternet\$R9" - WriteRegStr HKLM "$0" "" "${BrandFullName}" + WriteRegStr ${RegKey} "$0" "" "${BrandFullName}" - WriteRegStr HKLM "$0\DefaultIcon" "" "$8,0" + WriteRegStr ${RegKey} "$0\DefaultIcon" "" "$8,0" ; The Reinstall Command is defined at ; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/registeringapps.asp - WriteRegStr HKLM "$0\InstallInfo" "HideIconsCommand" "$\"$7$\" /HideShortcuts" - WriteRegStr HKLM "$0\InstallInfo" "ShowIconsCommand" "$\"$7$\" /ShowShortcuts" - WriteRegStr HKLM "$0\InstallInfo" "ReinstallCommand" "$\"$7$\" /SetAsDefaultAppGlobal" + WriteRegStr ${RegKey} "$0\InstallInfo" "HideIconsCommand" "$\"$7$\" /HideShortcuts" + WriteRegStr ${RegKey} "$0\InstallInfo" "ShowIconsCommand" "$\"$7$\" /ShowShortcuts" + WriteRegStr ${RegKey} "$0\InstallInfo" "ReinstallCommand" "$\"$7$\" /SetAsDefaultAppGlobal" ClearErrors - ReadRegDWORD $1 HKLM "$0\InstallInfo" "IconsVisible" + ReadRegDWORD $1 ${RegKey} "$0\InstallInfo" "IconsVisible" ; If the IconsVisible name value pair doesn't exist add it otherwise the ; application won't be displayed in Set Program Access and Defaults. ${If} ${Errors} ${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk" - WriteRegDWORD HKLM "$0\InstallInfo" "IconsVisible" 1 + WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 1 ${Else} - WriteRegDWORD HKLM "$0\InstallInfo" "IconsVisible" 0 + WriteRegDWORD ${RegKey} "$0\InstallInfo" "IconsVisible" 0 ${EndIf} ${EndIf} - WriteRegStr HKLM "$0\shell\open\command" "" "$8" + WriteRegStr ${RegKey} "$0\shell\open\command" "" "$8" - WriteRegStr HKLM "$0\shell\properties" "" "$(CONTEXT_OPTIONS)" - WriteRegStr HKLM "$0\shell\properties\command" "" "$\"$8$\" -preferences" + WriteRegStr ${RegKey} "$0\shell\properties" "" "$(CONTEXT_OPTIONS)" + WriteRegStr ${RegKey} "$0\shell\properties\command" "" "$\"$8$\" -preferences" - WriteRegStr HKLM "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)" - WriteRegStr HKLM "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode" + WriteRegStr ${RegKey} "$0\shell\safemode" "" "$(CONTEXT_SAFE_MODE)" + WriteRegStr ${RegKey} "$0\shell\safemode\command" "" "$\"$8$\" -safe-mode" ; Vista Capabilities registry keys - WriteRegStr HKLM "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)" - WriteRegStr HKLM "$0\Capabilities" "ApplicationIcon" "$8,0" - WriteRegStr HKLM "$0\Capabilities" "ApplicationName" "${BrandShortName}" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationDescription" "$(REG_APP_DESC)" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationIcon" "$8,0" + WriteRegStr ${RegKey} "$0\Capabilities" "ApplicationName" "${BrandShortName}" - WriteRegStr HKLM "$0\Capabilities\FileAssociations" ".htm" "FirefoxHTML" - WriteRegStr HKLM "$0\Capabilities\FileAssociations" ".html" "FirefoxHTML" - WriteRegStr HKLM "$0\Capabilities\FileAssociations" ".shtml" "FirefoxHTML" - WriteRegStr HKLM "$0\Capabilities\FileAssociations" ".xht" "FirefoxHTML" - WriteRegStr HKLM "$0\Capabilities\FileAssociations" ".xhtml" "FirefoxHTML" + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".htm" "FirefoxHTML" + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".html" "FirefoxHTML" + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".shtml" "FirefoxHTML" + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xht" "FirefoxHTML" + WriteRegStr ${RegKey} "$0\Capabilities\FileAssociations" ".xhtml" "FirefoxHTML" - WriteRegStr HKLM "$0\Capabilities\StartMenu" "StartMenuInternet" "$R9" + WriteRegStr ${RegKey} "$0\Capabilities\StartMenu" "StartMenuInternet" "$R9" - WriteRegStr HKLM "$0\Capabilities\URLAssociations" "ftp" "FirefoxURL" - WriteRegStr HKLM "$0\Capabilities\URLAssociations" "http" "FirefoxURL" - WriteRegStr HKLM "$0\Capabilities\URLAssociations" "https" "FirefoxURL" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "ftp" "FirefoxURL" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "http" "FirefoxURL" + WriteRegStr ${RegKey} "$0\Capabilities\URLAssociations" "https" "FirefoxURL" ; Vista Registered Application - WriteRegStr HKLM "Software\RegisteredApplications" "${AppRegName}" "$0\Capabilities" + WriteRegStr ${RegKey} "Software\RegisteredApplications" "${AppRegName}" "$0\Capabilities" !macroend !define SetStartMenuInternet "!insertmacro SetStartMenuInternet" @@ -413,14 +440,14 @@ ; due to changes not being detected by the IconHandler for side by side ; installs (see bug 268512). The symptoms can be either an incorrect icon or no ; icon being displayed for files associated with Firefox (does not use SHCTX). -!macro FixShellIconHandler +!macro FixShellIconHandler RegKey ClearErrors - ReadRegStr $1 HKLM "Software\Classes\FirefoxHTML\ShellEx\IconHandler" "" + ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\ShellEx\IconHandler" "" ${Unless} ${Errors} - ReadRegStr $1 HKLM "Software\Classes\FirefoxHTML\DefaultIcon" "" + ReadRegStr $1 ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" ${GetLongPath} "$INSTDIR\${FileMainEXE}" $2 ${If} "$1" != "$2,1" - WriteRegStr HKLM "Software\Classes\FirefoxHTML\DefaultIcon" "" "$2,1" + WriteRegStr ${RegKey} "Software\Classes\FirefoxHTML\DefaultIcon" "" "$2,1" ${EndIf} ${EndUnless} !macroend @@ -1061,7 +1088,12 @@ Function SetAsDefaultAppUserHKCU ; registry keys are for this install. ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 ClearErrors - ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" + ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" + ${If} ${Errors} + ${OrIf} ${AtMostWin2008R2} + ClearErrors + ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" + ${EndIf} ${Unless} ${Errors} ${GetPathFromString} "$0" $0 ${GetParent} "$0" $0 @@ -1084,6 +1116,8 @@ Function SetAsDefaultAppUserHKCU ClearErrors ReadRegStr $0 HKLM "Software\RegisteredApplications" "${AppRegName}" ${Unless} ${Errors} + ; This is all protected by a user choice hash in Windows 8 so it won't + ; help, but it also won't hurt. AppAssocReg::SetAppAsDefaultAll "${AppRegName}" ${EndUnless} ${EndIf} @@ -1112,7 +1146,13 @@ Function SetAsDefaultAppUser ; Check if this install location registered as the StartMenuInternet client ${StrFilter} "${FileMainEXE}" "+" "" "" $R9 ClearErrors - ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" + ReadRegStr $0 HKCU "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" + ${If} ${Errors} + ${OrIf} ${AtMostWin2008R2} + ClearErrors + ReadRegStr $0 HKLM "Software\Clients\StartMenuInternet\$R9\DefaultIcon" "" + ${EndIf} + ${Unless} ${Errors} ${GetPathFromString} "$0" $0 ${GetParent} "$0" $0 @@ -1134,18 +1174,29 @@ Function SetAsDefaultAppUser ${EndIf} ${EndUnless} + ; On Win8, we want to avoid having a UAC prompt since we'll already have + ; another action for control panel default browser selection popping up + ; to the user. Win8 is the first OS where the start menu keys can be + ; added into HKCU. + ${If} ${AtLeastWin8} + ${SetStartMenuInternet} "HKCU" + ${FixShellIconHandler} "HKCU" + ${FixClassKeys} ; Does not use SHCTX + Return + ${EndIf} + ; The code after ElevateUAC won't be executed on Vista and above when the ; user: ; a) is a member of the administrators group (e.g. elevation is required) ; b) is not a member of the administrators group and chooses to elevate ${ElevateUAC} - ${SetStartMenuInternet} ; Does not use SHCTX + ${SetStartMenuInternet} "HKLM" SetShellVarContext all ; Set SHCTX to all users (e.g. HKLM) ${FixClassKeys} ; Does not use SHCTX - ${FixShellIconHandler} ; Does not use SHCTX + ${FixShellIconHandler} "HKLM" ${RemoveDeprecatedKeys} ; Does not use SHCTX ClearErrors diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi index bbc0f2fcfb3c..a76f10299d67 100755 --- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -337,6 +337,22 @@ Section "Uninstall" DeleteRegValue HKLM "Software\RegisteredApplications" "${AppRegName}" ${EndIf} + ReadRegStr $R1 HKCU "$0" "" + ${un.RemoveQuotesFromPath} "$R1" $R1 + ${un.GetParent} "$R1" $R1 + + ; Only remove the StartMenuInternet key if it refers to this install location. + ; The StartMenuInternet registry key is independent of the default browser + ; settings. The XPInstall base un-installer always removes this key if it is + ; uninstalling the default browser and it will always replace the keys when + ; installing even if there is another install of Firefox that is set as the + ; default browser. Now the key is always updated on install but it is only + ; removed if it refers to this install location. + ${If} "$INSTDIR" == "$R1" + DeleteRegKey HKCU "Software\Clients\StartMenuInternet\${FileMainEXE}" + DeleteRegValue HKCU "Software\RegisteredApplications" "${AppRegName}" + ${EndIf} + StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}" ${If} $R9 == "false" DeleteRegKey HKLM "$0"