diff --git a/browser/installer/unix/packages-static b/browser/installer/unix/packages-static index 82fb10ce77c..52d79c4a39f 100644 --- a/browser/installer/unix/packages-static +++ b/browser/installer/unix/packages-static @@ -26,6 +26,7 @@ bin/defaults/profile/localstore.rdf bin/defaults/profile/prefs.js bin/defaults/profile/mimeTypes.rdf bin/defaults/profile/chrome/* +bin/update.locale bin/updater.ini bin/dictionaries/* diff --git a/browser/installer/windows/packages-static b/browser/installer/windows/packages-static index 330f085ef5b..95c3c84fc99 100644 --- a/browser/installer/windows/packages-static +++ b/browser/installer/windows/packages-static @@ -26,6 +26,7 @@ bin\defaults\profile\prefs.js bin\defaults\profile\mimeTypes.rdf bin\defaults\profile\chrome\* bin\uninstall\helper.exe +bin\update.locale bin\updater.ini bin\dictionaries\* diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in index ea68848100e..05e85e5ec85 100644 --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in @@ -346,15 +346,15 @@ installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-% ifdef MOZ_UPDATER libs:: $(addprefix $(LOCALE_SRCDIR)/,updater/updater.ini) ifeq ($(OS_ARCH),WINNT) - cat $< $(srcdir)/updater_append.ini $(srcdir)/../installer/windows/nsis/updater_append.ini | \ + cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \ sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \ - sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" | \ - sed -e "s/%AB_CD%/$(AB_CD)/" > $(FINAL_TARGET)/updater.ini + sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \ + $(FINAL_TARGET)/updater.ini else - cat $< $(srcdir)/updater_append.ini | \ + cat $< \ sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \ - sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" | \ - sed -e "s/%AB_CD%/$(AB_CD)/" > $(FINAL_TARGET)/updater.ini + sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \ + $(FINAL_TARGET)/updater.ini endif endif diff --git a/browser/locales/updater_append.ini b/browser/locales/updater_append.ini deleted file mode 100644 index d5a9f05ac71..00000000000 --- a/browser/locales/updater_append.ini +++ /dev/null @@ -1,5 +0,0 @@ - -; IMPORTANT: This file should always start with a newline in case a locale -; provided updater.ini does not end with a newline. -[Installation] -Locale=%AB_CD% diff --git a/toolkit/locales/Makefile.in b/toolkit/locales/Makefile.in index 4dcec7bd05c..957b05de20a 100644 --- a/toolkit/locales/Makefile.in +++ b/toolkit/locales/Makefile.in @@ -68,6 +68,12 @@ ifdef MOZ_PSM endif @$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* + +ifdef MOZ_UPDATER +libs:: update.locale + cat $< | sed -e "s/%AB_CD%/$(AB_CD)/" > $(FINAL_TARGET)/update.locale +endif + ifdef MOZ_CRASHREPORTER libs:: crashreporter.ini ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) diff --git a/toolkit/locales/update.locale b/toolkit/locales/update.locale new file mode 100644 index 00000000000..7c1f386ee0f --- /dev/null +++ b/toolkit/locales/update.locale @@ -0,0 +1 @@ +%AB_CD% diff --git a/toolkit/mozapps/update/src/nsUpdateService.js.in b/toolkit/mozapps/update/src/nsUpdateService.js.in index 51f51afea70..b1935fb33b5 100644 --- a/toolkit/mozapps/update/src/nsUpdateService.js.in +++ b/toolkit/mozapps/update/src/nsUpdateService.js.in @@ -78,6 +78,7 @@ const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.proper const URI_UPDATE_NS = "http://www.mozilla.org/2005/app-update"; const KEY_APPDIR = "XCurProcD"; +const KEY_GRED = "GreD"; #ifdef XP_WIN const KEY_UPDROOT = "UpdRootD"; const KEY_UAPPDATA = "UAppData"; @@ -92,7 +93,7 @@ const FILE_UPDATES_DB = "updates.xml"; const FILE_UPDATE_ACTIVE = "active-update.xml"; const FILE_PERMS_TEST = "update.test"; const FILE_LAST_LOG = "last-update.log"; -const FILE_UPDATER_INI = "updater.ini"; +const FILE_UPDATE_LOCALE = "update.locale"; const MODE_RDONLY = 0x01; const MODE_WRONLY = 0x02; @@ -518,19 +519,26 @@ function getPref(func, preference, defaultValue) { } /** - * Gets the locale specified by the 'Locale' key in the 'Installation' section - * of updater.ini. + * Gets the locale from the update.locale file for replacing %LOCALE% in the + * update url. The update.locale file can be located in the application + * directory or the GRE directory with preference given to it being located in + * the application directory. */ function getLocale() { if (gLocale) return gLocale; - var updaterIni = getFile(KEY_APPDIR, [FILE_UPDATER_INI]); - var iniParser = Cc["@mozilla.org/xpcom/ini-parser-factory;1"]. - getService(Ci.nsIINIParserFactory). - createINIParser(updaterIni); - gLocale = iniParser.getString("Installation", "Locale"); - LOG("General", "getLocale - getting locale from file: " + updaterIni.path + + var localeFile = getFile(KEY_APPDIR, [FILE_UPDATE_LOCALE]); + if (!localeFile.exists()) + localeFile = getFile(KEY_GRED, [FILE_UPDATE_LOCALE]); + + if (!localeFile.exists()) + throw Components.Exception(FILE_UPDATE_LOCALE + " file doesn't exist in " + + "either the " + KEY_APPDIR + " or " + KEY_GRED + + " directories", Cr.NS_ERROR_FILE_NOT_FOUND); + + gLocale = readStringFromFile(localeFile); + LOG("General", "getLocale - getting locale from file: " + localeFile.path + ", locale: " + gLocale); return gLocale; } diff --git a/toolkit/mozapps/update/test/unit/test_0040_general.js.in b/toolkit/mozapps/update/test/unit/test_0040_general.js.in index 50a695ebd80..910eb828cfe 100644 --- a/toolkit/mozapps/update/test/unit/test_0040_general.js.in +++ b/toolkit/mozapps/update/test/unit/test_0040_general.js.in @@ -154,7 +154,7 @@ function check_test_pt4() { } // url constructed with %LOCALE% -// Bug 488936 added the locale to the updater.locale file +// Bug 488936 added the update.locale file that stores the update locale function run_test_pt5() { gCheckFunc = check_test_pt5; var url = URL_PREFIX + "%LOCALE%/";