Bug 711679 - Send background version checks to new domain. r=darktrojan,dtownsend

This commit is contained in:
Blair McBride 2012-03-07 21:18:28 +13:00
Родитель 1b727b5c6a
Коммит 23957a1b85
11 изменённых файлов: 57 добавлений и 8 удалений

Просмотреть файл

@ -214,6 +214,7 @@ pref("app.update.service.enabled", true);
//
pref("extensions.update.enabled", true);
pref("extensions.update.url", "https://versioncheck.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%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.update.background.url", "https://versioncheck-bg.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%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.update.interval", 86400); // Check for updates to Extensions and
// Themes every day
// Non-symmetric (not shared by extensions) extension-specific [update] preferences

Просмотреть файл

@ -395,6 +395,7 @@ user_pref("browser.safebrowsing.provider.0.keyURL", "http://%(server)s/safebrows
user_pref("browser.safebrowsing.provider.0.updateURL", "http://%(server)s/safebrowsing-dummy/update");
// Point update checks to the local testing server for fast failures
user_pref("extensions.update.url", "http://%(server)s/extensions-dummy/updateURL");
user_pref("extensions.update.background.url", "http://%(server)s/extensions-dummy/updateBackgroundURL");
user_pref("extensions.blocklist.url", "http://%(server)s/extensions-dummy/blocklistURL");
user_pref("extensions.hotfix.url", "http://%(server)s/extensions-dummy/hotfixURL");
// Make sure opening about:addons won't hit the network

Просмотреть файл

@ -221,6 +221,7 @@ pref("extensions.strictCompatibility", false);
pref("extensions.minCompatibleAppVersion", "11.0");
pref("extensions.update.url", "https://versioncheck.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%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.update.background.url", "https://versioncheck-bg.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%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
/* preferences for the Get Add-ons pane */
pref("extensions.getAddons.cache.enabled", true);

Просмотреть файл

@ -216,6 +216,7 @@ pref("extensions.strictCompatibility", false);
pref("extensions.minCompatibleAppVersion", "4.0");
pref("extensions.update.url", "https://versioncheck.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%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.update.background.url", "https://versioncheck-bg.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%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
/* preferences for the Get Add-ons pane */
pref("extensions.getAddons.cache.enabled", true);

Просмотреть файл

@ -51,7 +51,7 @@ const PREF_EM_LAST_PLATFORM_VERSION = "extensions.lastPlatformVersion";
const PREF_EM_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault";
const PREF_EM_STRICT_COMPATIBILITY = "extensions.strictCompatibility";
const PREF_EM_CHECK_UPDATE_SECURITY = "extensions.checkUpdateSecurity";
const PREF_EM_UPDATE_URL = "extensions.update.url";
const PREF_EM_UPDATE_BACKGROUND_URL = "extensions.update.background.url";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
const PREF_APP_UPDATE_AUTO = "app.update.auto";
const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";
@ -902,7 +902,7 @@ var AddonManagerInternal = {
if (Services.prefs.getPrefType(PREF_EM_HOTFIX_URL) == Ci.nsIPrefBranch.PREF_STRING)
url = Services.prefs.getCharPref(PREF_EM_HOTFIX_URL);
else
url = Services.prefs.getCharPref(PREF_EM_UPDATE_URL);
url = Services.prefs.getCharPref(PREF_EM_UPDATE_BACKGROUND_URL);
// Build the URI from a fake add-on data.
url = AddonManager.escapeAddonURI({

Просмотреть файл

@ -65,6 +65,7 @@ const PREF_DSS_SWITCHPENDING = "extensions.dss.switchPending";
const PREF_DSS_SKIN_TO_SELECT = "extensions.lastSelectedSkin";
const PREF_GENERAL_SKINS_SELECTEDSKIN = "general.skins.selectedSkin";
const PREF_EM_UPDATE_URL = "extensions.update.url";
const PREF_EM_UPDATE_BACKGROUND_URL = "extensions.update.background.url";
const PREF_EM_ENABLED_ADDONS = "extensions.enabledAddons";
const PREF_EM_EXTENSION_FORMAT = "extensions.";
const PREF_EM_ENABLED_SCOPES = "extensions.enabledScopes";
@ -6927,8 +6928,15 @@ function UpdateChecker(aAddon, aListener, aReason, aAppVersion, aPlatformVersion
this.platformVersion = aPlatformVersion;
this.syncCompatibility = (aReason == AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
let updateURL = aAddon.updateURL ? aAddon.updateURL :
Services.prefs.getCharPref(PREF_EM_UPDATE_URL);
let updateURL = aAddon.updateURL;
if (!updateURL) {
if (aReason == AddonManager.UPDATE_WHEN_PERIODIC_UPDATE &&
Services.prefs.getPrefType(PREF_EM_UPDATE_BACKGROUND_URL) == Services.prefs.PREF_STRING) {
updateURL = Services.prefs.getCharPref(PREF_EM_UPDATE_BACKGROUND_URL);
} else {
updateURL = Services.prefs.getCharPref(PREF_EM_UPDATE_URL);
}
}
const UPDATE_TYPE_COMPATIBILITY = 32;
const UPDATE_TYPE_NEWVERSION = 64;

Просмотреть файл

@ -59,6 +59,7 @@ var gUseInContentUI = !gTestInWindow && ("switchToTabHavingURI" in window);
var gRestorePrefs = [{name: PREF_LOGGING_ENABLED},
{name: "extensions.webservice.discoverURL"},
{name: "extensions.update.url"},
{name: "extensions.update.background.url"},
{name: "extensions.getAddons.get.url"},
{name: "extensions.getAddons.getWithPerformance.url"},
{name: "extensions.getAddons.search.browseURL"},

Просмотреть файл

@ -45,5 +45,26 @@
</em:updates>
</RDF:Description>
<RDF:Description about="urn:mozilla:extension:addon3@tests.mozilla.org">
<em:updates>
<RDF:Seq>
<!-- app id compatible update available -->
<RDF:li>
<RDF:Description>
<em:version>2</em:version>
<em:targetApplication>
<RDF:Description>
<em:id>xpcshell@tests.mozilla.org</em:id>
<em:minVersion>1</em:minVersion>
<em:maxVersion>1</em:maxVersion>
<em:updateLink>http://localhost:4444/broken.xpi</em:updateLink>
</RDF:Description>
</em:targetApplication>
</RDF:Description>
</RDF:li>
</RDF:Seq>
</em:updates>
</RDF:Description>
</RDF:RDF>

Просмотреть файл

@ -1127,6 +1127,7 @@ Services.prefs.setBoolPref("extensions.showMismatchUI", false);
// Point update checks to the local machine for fast failures
Services.prefs.setCharPref("extensions.update.url", "http://127.0.0.1/updateURL");
Services.prefs.setCharPref("extensions.update.background.url", "http://127.0.0.1/updateBackgroundURL");
Services.prefs.setCharPref("extensions.blocklist.url", "http://127.0.0.1/blocklistURL");
// By default ignore bundled add-ons

Просмотреть файл

@ -2,7 +2,7 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// This verifies that background update notifications work as expected
// This verifies that background updates & notifications work as expected
// The test extension uses an insecure update url.
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
@ -74,6 +74,20 @@ function run_test_2() {
name: "Test Addon 2",
}, profileDir);
writeInstallRDFForExtension({
id: "addon3@tests.mozilla.org",
version: "1.0",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}],
name: "Test Addon 3",
}, profileDir);
// Background update uses a different pref, if set
Services.prefs.setCharPref("extensions.update.background.url",
"http://localhost:4444/data/test_backgroundupdate.rdf");
restartManager();
// Do hotfix checks
@ -87,7 +101,7 @@ function run_test_2() {
Services.obs.addObserver(function() {
Services.obs.removeObserver(arguments.callee, "addons-background-update-complete");
do_check_eq(installCount, 2);
do_check_eq(installCount, 3);
sawCompleteNotification = true;
}, "addons-background-update-complete", false);
@ -98,7 +112,7 @@ function run_test_2() {
onDownloadFailed: function(aInstall) {
completeCount++;
if (completeCount == 2) {
if (completeCount == 3) {
do_check_true(sawCompleteNotification);
end_test();
}

Просмотреть файл

@ -36,7 +36,7 @@ function end_test() {
// Test that background updates find and install any available hotfix
function run_test_1() {
Services.prefs.setCharPref("extensions.hotfix.id", "hotfix@tests.mozilla.org");
Services.prefs.setCharPref("extensions.update.url", "http://localhost:4444/data/test_hotfix_1.rdf");
Services.prefs.setCharPref("extensions.update.background.url", "http://localhost:4444/data/test_hotfix_1.rdf");
prepare_test({
"hotfix@tests.mozilla.org": [