Bug 1027287 - Prevent non-local network connection to aus when enabling app update in add-ons mgr hotfix test. r=mossop, a=test-only
authorRobert Strong <robert.bugzilla@gmail.com>
Mon, 07 Jul 2014 12:49:21 -0700
changeset 171594 45ae726b1d909b17824c0dcde32deaf900980a1f
parent 171593 874adddec55d720a4f4ad38ef65be01b69cc0b5c
child 171595 2dcf2952d2c356df7f8d4c78f7f40b4aa5e29aa3
push id577
push userryanvm@gmail.com
push dateTue, 08 Jul 2014 14:04:54 +0000
reviewersmossop, test-only
bugs1027287
milestone28.0
Bug 1027287 - Prevent non-local network connection to aus when enabling app update in add-ons mgr hotfix test. r=mossop, a=test-only
toolkit/mozapps/extensions/test/browser/browser_hotfix.js
--- a/toolkit/mozapps/extensions/test/browser/browser_hotfix.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_hotfix.js
@@ -7,16 +7,17 @@ const PREF_EM_HOTFIX_LASTVERSION       =
 const PREF_EM_HOTFIX_URL               = "extensions.hotfix.url";
 const PREF_EM_HOTFIX_CERTS             = "extensions.hotfix.certs.";
 const PREF_EM_CERT_CHECKATTRIBUTES     = "extensions.hotfix.cert.checkAttributes";
 
 const PREF_INSTALL_REQUIREBUILTINCERTS = "extensions.install.requireBuiltInCerts";
 const PREF_UPDATE_REQUIREBUILTINCERTS  = "extensions.update.requireBuiltInCerts";
 
 const PREF_APP_UPDATE_ENABLED          = "app.update.enabled";
+const PREF_APP_UPDATE_URL              = "app.update.url";
 
 const HOTFIX_ID = "hotfix@tests.mozilla.org";
 
 var gNextTest;
 
 var SuccessfulInstallListener = {
   onDownloadCancelled: function(aInstall) {
     ok(false, "Should not have seen the download cancelled");
@@ -55,25 +56,28 @@ var FailedInstallListener = {
     Services.prefs.clearUserPref(PREF_EM_HOTFIX_LASTVERSION);
     gNextTest();
   }
 }
 
 function test() {
   waitForExplicitFinish();
 
+  var oldAusUrl = Services.prefs.getDefaultBranch(null).getCharPref(PREF_APP_UPDATE_URL);
+  Services.prefs.getDefaultBranch(null).setCharPref(PREF_APP_UPDATE_URL, TESTROOT + "ausdummy.xml");
   Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
   Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
   Services.prefs.setBoolPref(PREF_UPDATE_REQUIREBUILTINCERTS, false);
   Services.prefs.setCharPref(PREF_EM_HOTFIX_ID, HOTFIX_ID);
   var oldURL = Services.prefs.getCharPref(PREF_EM_HOTFIX_URL);
   Services.prefs.setCharPref(PREF_EM_HOTFIX_URL, TESTROOT + "signed_hotfix.rdf");
 
   registerCleanupFunction(function() {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, false);
+    Services.prefs.getDefaultBranch(null).setCharPref(PREF_APP_UPDATE_URL, oldAusUrl);
     Services.prefs.clearUserPref(PREF_EM_HOTFIX_ID);
     Services.prefs.setCharPref(PREF_EM_HOTFIX_URL, oldURL);
     Services.prefs.clearUserPref(PREF_INSTALL_REQUIREBUILTINCERTS);
     Services.prefs.clearUserPref(PREF_UPDATE_REQUIREBUILTINCERTS);
 
     Services.prefs.clearUserPref(PREF_EM_CERT_CHECKATTRIBUTES);
     var prefs = Services.prefs.getChildList(PREF_EM_HOTFIX_CERTS);
     prefs.forEach(Services.prefs.clearUserPref);