From d232b49fa068eb2dd18cea331e8e7b5e78c161d1 Mon Sep 17 00:00:00 2001 From: "dietrich%mozilla.com" Date: Sat, 19 Aug 2006 02:00:52 +0000 Subject: [PATCH] Bug 348076 remove generated URLs from region.properties (r=phil, sr=mconnor) --- browser/app/profile/firefox.js | 40 ++++++++++++++----- browser/components/nsBrowserContentHandler.js | 8 ++-- .../chrome/browser-region/region.properties | 8 ---- .../mozapps/extensions/extensions.properties | 2 - .../mozapps/extensions/content/extensions.js | 8 ++-- .../mozapps/extensions/content/extensions.xml | 4 +- toolkit/mozapps/extensions/content/list.js | 6 +-- toolkit/mozapps/update/content/updates.js | 4 +- .../mozapps/update/src/nsUpdateService.js.in | 5 ++- 9 files changed, 49 insertions(+), 36 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 72de9fd8788..b185c932baf 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -48,8 +48,30 @@ #endif #endif -pref("startup.homepage_override_url","chrome://browser-region/locale/region.properties"); -pref("startup.homepage_welcome_url","chrome://browser-region/locale/region.properties"); +#ifdef OFFICIAL_BRANDING + +pref("startup.homepage_override_url","http://%LOCALE%.www.mozilla.com/%LOCALE%/firefox/%VERSION%/whatsnew/"); +pref("startup.homepage_welcome_url","http://%LOCALE%.www.mozilla.com/%LOCALE%/firefox/%VERSION%/firstrun/"); +// URL user can browse to manually if for some reason all update installation +// attempts fail. +pref("app.update.url.manual", "http://%LOCALE%.www.mozilla.com/%LOCALE%/products/firefox/"); +// A default value for the "More information about this update" link +// supplied in the "An update is available" page of the update wizard. +pref("app.update.url.details", "http://%LOCALE%.www.mozilla.com/%LOCALE%/firefox/releases/"); + +#else + +pref("startup.homepage_override_url","http://www.mozilla.org/projects/firefox/%VERSION%/whatsnew/"); +pref("startup.homepage_welcome_url","http://www.mozilla.org/projects/firefox/%VERSION%/firstrun/"); +// URL user can browse to manually if for some reason all update installation +// attempts fail. +pref("app.update.url.manual", "http://www.mozilla.org/products/firefox/"); +// A default value for the "More information about this update" link +// supplied in the "An update is available" page of the update wizard. +pref("app.update.url.details", "http://www.mozilla.org/projects/firefox/"); + +#endif + pref("general.startup.browser", true); pref("browser.chromeURL","chrome://browser/content/"); @@ -74,7 +96,7 @@ pref("extensions.hideInstallButton", true); pref("extensions.blocklist.enabled", true); pref("extensions.blocklist.interval", 86400); pref("extensions.blocklist.url", "https://addons.mozilla.org/blocklist/1/%APP_ID%/%APP_VERSION%/"); -pref("extensions.blocklist.detailsURL", "http://www.mozilla.com/blocklist/"); +pref("extensions.blocklist.detailsURL", "http://%LOCALE%.www.mozilla.com/%LOCALE%/blocklist/"); // Dictionary download preference pref("browser.dictionaries.download.url", "https://%LOCALE%.add-ons.mozilla.com/%LOCALE%/firefox/%VERSION%/dictionaries/"); @@ -105,12 +127,8 @@ pref("app.update.silent", false); // Update service URL: pref("app.update.url", "https://aus2.mozilla.org/update/2/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/update.xml"); -// URL user can browse to manually if for some reason all update installation -// attempts fail. TODO: Change this URL -pref("app.update.url.manual", "http://www.mozilla.org/products/firefox/"); -// A default value for the "More information about this update" link -// supplied in the "An update is available" page of the update wizard. -pref("app.update.url.details", "chrome://browser-region/locale/region.properties"); +// app.update.url.manual is in branding section +// app.update.url.details is in branding section // User-settable override to app.update.url for testing purposes. //pref("app.update.url.override", ""); @@ -154,8 +172,8 @@ pref("extensions.update.url", "chrome://mozapps/locale/extensions/extensions.pro pref("extensions.update.interval", 86400); // Check for updates to Extensions and // Themes every day // Non-symmetric (not shared by extensions) extension-specific [update] preferences -pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties"); -pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties"); +pref("extensions.getMoreExtensionsURL", "http://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/%VERSION%/extensions/"); +pref("extensions.getMoreThemesURL", "http://%LOCALE%.add-ons.mozilla.com/%LOCALE%/%APP%/%VERSION%/themes/"); pref("extensions.dss.enabled", false); // Dynamic Skin Switching pref("extensions.dss.switchPending", false); // Non-dynamic switch pending after next // restart. diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js index 4f89b6960da..61ad10a7261 100644 --- a/browser/components/nsBrowserContentHandler.js +++ b/browser/components/nsBrowserContentHandler.js @@ -406,17 +406,17 @@ var nsBrowserContentHandler = { get defaultArgs() { var prefb = Components.classes["@mozilla.org/preferences-service;1"] .getService(nsIPrefBranch); + var formatter = Components.classes["@mozilla.org/browser/URLFormatterService;1"] + .getService(Components.interfaces.nsIURLFormatter); var pagesToLoad = ""; var overrideState = needHomepageOverride(prefb); try { if (overrideState == 1) { - pagesToLoad = prefb.getComplexValue("startup.homepage_welcome_url", - nsIPrefLocalizedString).data; + pagesToLoad = formatter.formatURLPref("startup.homepage_welcome_url", null); } else if (overrideState == 2) { - pagesToLoad = prefb.getComplexValue("startup.homepage_override_url", - nsIPrefLocalizedString).data; + pagesToLoad = formatter.formatURLPref("startup.homepage_override_url", null); } } catch (e) { diff --git a/browser/locales/en-US/chrome/browser-region/region.properties b/browser/locales/en-US/chrome/browser-region/region.properties index f8ae9144a2a..23b836d68ab 100644 --- a/browser/locales/en-US/chrome/browser-region/region.properties +++ b/browser/locales/en-US/chrome/browser-region/region.properties @@ -9,14 +9,6 @@ browser.search.order.2=Yahoo searchEnginesURL=https://addons.mozilla.org/search-engines.php -# This page gets displayed on first start and update -startup.homepage_override_url=http://www.mozilla.com/firefox/updated -startup.homepage_welcome_url=http://www.mozilla.com/firefox/central - -# This is the fallback URL for release notes. Do not change this -# unless you are providing localized release notes! -app.update.url.details=http://www.mozilla.com/firefox/releases/ - # This is the default set of web based feed handlers shown in the reader # selection UI browser.contentHandlers.types.0.title=Bloglines diff --git a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties index 21b94a60b43..6c73499210a 100644 --- a/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties +++ b/toolkit/locales/en-US/chrome/mozapps/extensions/extensions.properties @@ -32,8 +32,6 @@ disableWarningDependMessage=If you disable %S, the following items that require disableQueryMessage=Do you want to disable %S? extensions.update.url=https://addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI% -extensions.getMoreExtensionsURL=https://addons.mozilla.org/extensions/?application=%APPID% -extensions.getMoreThemesURL=https://addons.mozilla.org/themes/?application=%APPID% themesTitle=Themes extensionsTitle=Extensions diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js index e6bd5a54930..76e812ac205 100644 --- a/toolkit/mozapps/extensions/content/extensions.js +++ b/toolkit/mozapps/extensions/content/extensions.js @@ -331,10 +331,10 @@ function showView(aView) { "tooltiptextextensions")); getMore.setAttribute("value", getMore.getAttribute(isThemes ? "valuethemes" : "valueextensions")); - var getMoreURL = gPref.getComplexValue(isThemes ? PREF_EXTENSIONS_GETMORETHEMESURL - : PREF_EXTENSIONS_GETMOREEXTENSIONSURL, - Components.interfaces.nsIPrefLocalizedString).data; - getMoreURL = getMoreURL.replace(/%APPID%/g, gAppID); + var getMorePref = isThemes ? PREF_EXTENSIONS_GETMORETHEMESURL : PREF_EXTENSIONS_GETMOREEXTENSIONSURL; + var formatter = Components.classes["@mozilla.org/browser/URLFormatterService;1"] + .getService(Components.interfaces.nsIURLFormatter); + var getMoreURL = formatter.formatURLPref(getMorePref, null); getMore.setAttribute("getMoreURL", getMoreURL); if (getMore.hidden) getMore.hidden = false; diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml index 36133dc9c0a..ae0146db6b8 100644 --- a/toolkit/mozapps/extensions/content/extensions.xml +++ b/toolkit/mozapps/extensions/content/extensions.xml @@ -233,7 +233,9 @@ var blocklistMoreInfo = document.getAnonymousElementByAttribute(this, "anonid", "blocklistMoreInfo"); var prefs = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefBranch); - var url = prefs.getCharPref("extensions.blocklist.detailsURL"); + var formatter = Components.classes["@mozilla.org/browser/URLFormatterService;1"] + .getService(Components.interfaces.nsIURLFormatter); + var url = formatter.formatURLPref("extensions.blocklist.detailsURL", null); blocklistMoreInfo.setAttribute("moreInfoURL", url); } catch(e) { blocklistMoreInfo.hidden = true; diff --git a/toolkit/mozapps/extensions/content/list.js b/toolkit/mozapps/extensions/content/list.js index 5180812c7f6..9771d64a1bf 100755 --- a/toolkit/mozapps/extensions/content/list.js +++ b/toolkit/mozapps/extensions/content/list.js @@ -88,10 +88,10 @@ function init() { items.push(args.GetString(i)); var extensionsBundle = document.getElementById("extensionsBundle"); - var pref = Components.classes["@mozilla.org/preferences-service;1"] - .getService(Components.interfaces.nsIPrefBranch); try { - var url = pref.getCharPref("extensions.blocklist.detailsURL"); + var formatter = Components.classes["@mozilla.org/browser/URLFormatterService;1"] + .getService(Components.interfaces.nsIURLFormatter); + var url = formatter.formatURLPref("extensions.blocklist.detailsURL", null); } catch (e) { } diff --git a/toolkit/mozapps/update/content/updates.js b/toolkit/mozapps/update/content/updates.js index 8ff66bab731..fbd94b0cf78 100755 --- a/toolkit/mozapps/update/content/updates.js +++ b/toolkit/mozapps/update/content/updates.js @@ -1382,7 +1382,9 @@ var gErrorsPage = { var errorReason = document.getElementById("errorReason"); errorReason.value = gUpdates.update.statusText; - var manualURL = getPref("getCharPref", PREF_UPDATE_MANUAL_URL, ""); + var formatter = Components.classes["@mozilla.org/browser/URLFormatterService;1"] + .getService(Components.interfaces.nsIURLFormatter); + var manualURL = formatter.formatURLPref(PREF_UPDATE_MANUAL_URL, null); var errorLinkLabel = document.getElementById("errorLinkLabel"); errorLinkLabel.value = manualURL; errorLinkLabel.href = manualURL; diff --git a/toolkit/mozapps/update/src/nsUpdateService.js.in b/toolkit/mozapps/update/src/nsUpdateService.js.in index 95e9faae93e..be1f462979c 100644 --- a/toolkit/mozapps/update/src/nsUpdateService.js.in +++ b/toolkit/mozapps/update/src/nsUpdateService.js.in @@ -790,8 +790,9 @@ Update.prototype = { try { // Try using a default details URL supplied by the distribution // if the update XML does not supply one. - return gPref.getComplexValue(PREF_APP_UPDATE_URL_DETAILS, - nsIPrefLocalizedString).data; + var formatter = Components.classes["@mozilla.org/browser/URLFormatterService;1"] + .getService(Components.interfaces.nsIURLFormatter); + return formatter.formatURLPref(PREF_APP_UPDATE_URL_DETAILS, null); } catch (e) { }