Bug 889484 Fix timeout in mozmill test-plugin-blocked.js by porting bug 882339 to our tests. r=aceman,a=unit-test fix for CLOSED TREE
authorMark Banner <bugzilla@standard8.plus.com>
Tue, 02 Jul 2013 20:23:31 +0100
changeset 12669 4fb6a496ca3fdc194f0a500043e9668cef5854ef
parent 12668 f878ff74a85a3ae3d69cca9c97311e05ba4367b6
child 12670 fa87b36d83ed6e1da4528aafd450ab9077ff6898
push id9302
push userbugzilla@standard8.plus.com
push dateTue, 02 Jul 2013 19:24:03 +0000
treeherdercomm-central@4fb6a496ca3f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, unit-test
bugs889484, 882339
Bug 889484 Fix timeout in mozmill test-plugin-blocked.js by porting bug 882339 to our tests. r=aceman,a=unit-test fix for CLOSED TREE
mail/test/mozmill/content-tabs/test-plugin-blocked.js
mail/test/mozmill/shared-modules/test-content-tab-helpers.js
--- a/mail/test/mozmill/content-tabs/test-plugin-blocked.js
+++ b/mail/test/mozmill/content-tabs/test-plugin-blocked.js
@@ -60,17 +60,17 @@ function test_blocklisted_plugin_notific
   let pluginState = plugin.enabledState;
   plugin.enabledState = plugin.STATE_ENABLED;
   assert_not_equals(plugin, null, "Test plugin not found");
   assert_false(plugin.blocklisted, "Test plugin was unexpectedly blocklisted");
   assert_false(plugin.disabled, "Test plugin not enabled");
 
   Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
 
-  setAndUpdateBlocklist(kPluginBlocklistUrl, function() {
+  setAndUpdateBlocklist(mc, kPluginBlocklistUrl, function() {
     assert_true(plugin.blocklisted, "Test plugin was not properly blocklisted");
     subtest_blocklisted_plugin_notification();
   });
 
   mc.waitFor(function () { return testDone; }, "Plugin test taking too long",
              100000, 1000);
 
   Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
--- a/mail/test/mozmill/shared-modules/test-content-tab-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-content-tab-helpers.js
@@ -417,30 +417,30 @@ function plugins_run_in_separate_process
   }
   else {
     supportsOOPP = Services.prefs.getBoolPref("dom.ipc.plugins.enabled");
   }
 
   return supportsOOPP;
 }
 
-function updateBlocklist(aCallback) {
+function updateBlocklist(aController, aCallback) {
   let blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
                             .getService(Ci.nsITimerCallback);
   let observer = function() {
-    aCallback();
     Services.obs.removeObserver(observer, "blocklist-updated");
+    aController.window.setTimeout(aCallback, 0);
   };
   Services.obs.addObserver(observer, "blocklist-updated", false);
   blocklistNotifier.notify(null);
 }
 
-function setAndUpdateBlocklist(aURL, aCallback) {
+function setAndUpdateBlocklist(aController, aURL, aCallback) {
   if (!_originalBlocklistURL) {
     _originalBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
   }
   Services.prefs.setCharPref("extensions.blocklist.url", aURL);
-  updateBlocklist(aCallback);
+  updateBlocklist(aController, aCallback);
 }
 
 function resetBlocklist(aCallback) {
   Services.prefs.setCharPref("extensions.blocklist.url", _originalBlocklistURL);
 }