Bug 850721 - Fix social blocklist oranges by not enabling the default update server. r=mixedpuppy, a=test-only
authorMark Hammond <mhammond@skippinet.com.au>
Fri, 07 Feb 2014 12:07:04 +1100
changeset 176238 47e85cc74059aa957d6e255ed0bf7e4910ed4207
parent 176237 58c73681f38885b592a6c73622705e8615591d2f
child 176239 8d553f0b4a8b4f715ae5e92fcdb36d9419c69b53
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy, test-only
bugs850721
milestone28.0
Bug 850721 - Fix social blocklist oranges by not enabling the default update server. r=mixedpuppy, a=test-only
browser/base/content/test/social/head.js
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -321,24 +321,34 @@ function updateBlocklist(aCallback) {
     Services.obs.removeObserver(observer, "blocklist-updated");
     if (aCallback)
       executeSoon(aCallback);
   };
   Services.obs.addObserver(observer, "blocklist-updated", false);
   blocklistNotifier.notify(null);
 }
 
+var _originalTestBlocklistURL = null;
 function setAndUpdateBlocklist(aURL, aCallback) {
+  if (!_originalTestBlocklistURL)
+    _originalTestBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
   Services.prefs.setCharPref("extensions.blocklist.url", aURL);
   updateBlocklist(aCallback);
 }
 
 function resetBlocklist(aCallback) {
-  Services.prefs.clearUserPref("extensions.blocklist.url");
-  updateBlocklist(aCallback);
+  // XXX - this has "forked" from the head.js helpers in our parent directory :(
+  // But let's reuse their blockNoPlugins.xml.  Later, we should arrange to
+  // use their head.js helpers directly
+  let noBlockedURL = "http://example.com/browser/browser/base/content/test/general/blockNoPlugins.xml";
+  setAndUpdateBlocklist(noBlockedURL, function() {
+    Services.prefs.setCharPref("extensions.blocklist.url", _originalTestBlocklistURL);
+    if (aCallback)
+      aCallback();
+  });
 }
 
 function setManifestPref(name, manifest) {
   let string = Cc["@mozilla.org/supports-string;1"].
                createInstance(Ci.nsISupportsString);
   string.data = JSON.stringify(manifest);
   Services.prefs.setComplexValue(name, Ci.nsISupportsString, string);
 }