$OpenBSD$ index b6f81b4..97480e2 100755 --- browser/installer/windows/nsis/shared.nsh.orig Fri Feb 20 15:40:36 2015 +++ browser/installer/windows/nsis/shared.nsh Fri Feb 20 15:40:36 2015 @@ -396,6 +396,15 @@ FunctionEnd !macroend !define ShowShortcuts "!insertmacro ShowShortcuts" +!macro AddAssociationIfNoneExist FILE_TYPE + ClearErrors + EnumRegKey $7 HKCR "${FILE_TYPE}" 0 + ${If} ${Errors} + WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}" "" "FirefoxHTML" + ${EndIf} +!macroend +!define AddAssociationIfNoneExist "!insertmacro AddAssociationIfNoneExist" + ; Adds the protocol and file handler registry entries for making Firefox the ; default handler (uses SHCTX). !macro SetHandlers @@ -430,35 +439,12 @@ FunctionEnd WriteRegStr SHCTX "$0\.xhtml" "" "FirefoxHTML" ${EndIf} - ; Only add .oga if it's not present - ${CheckIfRegistryKeyExists} "$0" ".oga" $7 - ${If} $7 == "false" - WriteRegStr SHCTX "$0\.oga" "" "FirefoxHTML" - ${EndIf} - - ; Only add .ogg if it's not present - ${CheckIfRegistryKeyExists} "$0" ".ogg" $7 - ${If} $7 == "false" - WriteRegStr SHCTX "$0\.ogg" "" "FirefoxHTML" - ${EndIf} - - ; Only add .ogv if it's not present - ${CheckIfRegistryKeyExists} "$0" ".ogv" $7 - ${If} $7 == "false" - WriteRegStr SHCTX "$0\.ogv" "" "FirefoxHTML" - ${EndIf} - - ; Only add .pdf if it's not present - ${CheckIfRegistryKeyExists} "$0" ".pdf" $7 - ${If} $7 == "false" - WriteRegStr SHCTX "$0\.pdf" "" "FirefoxHTML" - ${EndIf} - - ; Only add webm if it's not present - ${CheckIfRegistryKeyExists} "$0" ".webm" $7 - ${If} $7 == "false" - WriteRegStr SHCTX "$0\.webm" "" "FirefoxHTML" - ${EndIf} + ${AddAssociationIfNoneExist} ".pdf" + ${AddAssociationIfNoneExist} ".oga" + ${AddAssociationIfNoneExist} ".ogg" + ${AddAssociationIfNoneExist} ".ogv" + ${AddAssociationIfNoneExist} ".pdf" + ${AddAssociationIfNoneExist} ".webm" ; An empty string is used for the 5th param because FirefoxHTML is not a ; protocol handler @@ -693,6 +679,40 @@ FunctionEnd !macroend !define SetUninstallKeys "!insertmacro SetUninstallKeys" +; Due to a bug when associating some file handlers, only SHCTX was checked for +; some file types such as ".pdf". SHCTX is set to HKCU or HKLM depending on +; whether the installer has write access to HKLM. The bug would happen when +; HCKU was checked and didn't exist since programs aren't required to set the +; HKCU Software\Classes keys when associating handlers. The fix uses the merged +; view in HKCR to check for existance of an existing association. This macro +; cleans affected installations by removing the HKLM and HKCU value if it is set +; to FirefoxHTML when there is a value for PersistentHandler or by removing the +; HKCU value when the HKLM value has a value other than an empty string. +!macro FixBadFileAssociation FILE_TYPE + ; Only delete the default value in case the key has values for OpenWithList, + ; OpenWithProgids, PersistentHandler, etc. + ReadRegStr $0 HKCU "Software\Classes\${FILE_TYPE}" "" + ReadRegStr $1 HKLM "Software\Classes\${FILE_TYPE}" "" + ReadRegStr $2 HKCR "${FILE_TYPE}\PersistentHandler" "" + ${If} "$2" != "" + ; Since there is a persistent handler remove FirefoxHTML as the default + ; value from both HKCU and HKLM if it set to FirefoxHTML. + ${If} "$0" == "FirefoxHTML" + DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" + ${EndIf} + ${If} "$1" == "FirefoxHTML" + DeleteRegValue HKLM "Software\Classes\${FILE_TYPE}" "" + ${EndIf} + ${ElseIf} "$0" == "FirefoxHTML" + ; Since KHCU is set to FirefoxHTML remove FirefoxHTML as the default value + ; from HKCU if HKLM is set to a value other than an empty string. + ${If} "$1" != "" + DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" "" + ${EndIf} + ${EndIf} +!macroend +!define FixBadFileAssociation "!insertmacro FixBadFileAssociation" + ; Add app specific handler registry entries under Software\Classes if they ; don't exist (does not use SHCTX). !macro FixClassKeys @@ -719,6 +739,14 @@ FunctionEnd ${WriteRegStr2} $TmpVal "$1\.xhtml" "" "xhtmlfile" 0 ${WriteRegStr2} $TmpVal "$1\.xhtml" "Content Type" "application/xhtml+xml" 0 ${EndIf} + + ; Remove possibly badly associated file types + ${FixBadFileAssociation} ".pdf" + ${FixBadFileAssociation} ".oga" + ${FixBadFileAssociation} ".ogg" + ${FixBadFileAssociation} ".ogv" + ${FixBadFileAssociation} ".pdf" + ${FixBadFileAssociation} ".webm" !macroend !define FixClassKeys "!insertmacro FixClassKeys" @@ -1008,6 +1036,14 @@ FunctionEnd ; Removes various directories and files for reasons noted below. !macro RemoveDeprecatedFiles + ; Some users are ending up with unpacked chrome instead of omni.ja. This + ; causes Firefox to break badly after upgrading from Firefox 31, see bug + ; 1063052. Removing the chrome.manifest from the install directory causes + ; Firefox to use the updated omni.ja so it won't crash. + ${If} ${FileExists} "$INSTDIR\chrome.manifest" + Delete "$INSTDIR\chrome.manifest" + ${EndIf} + ; Remove talkback if it is present (remove after bug 386760 is fixed) ${If} ${FileExists} "$INSTDIR\extensions\talkback@mozilla.org" RmDir /r /REBOOTOK "$INSTDIR\extensions\talkback@mozilla.org"