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 207731 677e0185c2b4dd572032a663968b2fe838b87f67
parent 207730 e740529f8f40f3c8d5d4096d793520ae94972d21
child 207732 017a6f2c9952c904dc399215d1f9691867eebde8
push id3741
push userasasaki@mozilla.com
push dateMon, 21 Jul 2014 20:25:18 +0000
treeherdermozilla-beta@4d6f46f5af68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop, test-only
bugs1027287
milestone32.0a2
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";
 
 /*
  * Register an addon install listener and return a promise that:
  *  resolves with the AddonInstall object if the install succeeds
  *  rejects with the AddonInstall if the install fails
  */
@@ -60,25 +61,28 @@ function promiseFailedInstall() {
     },
     aInstall => {
       ok(true, "Should have seen the download cancelled");
       is(aInstall.addon.id, HOTFIX_ID, "Should have seen the right add-on");
     });
 }
 
 add_task(function setup() {
+  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);